@tonyclaw/agent-inspector 2.0.3 → 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-D5A4bTfV.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-DgQWGvjs.js +1 -0
- 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-BbU0n8eM.js → json-viewer-IXejqXB0.js} +1 -1
- package/.output/public/assets/{main-CZT_F-gu.js → main-2NlGzgOe.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +181 -114
- package/.output/server/{_sessionId-B-s9P7fJ.mjs → _sessionId-DWCTasJU.mjs} +3 -3
- package/.output/server/_ssr/{CompareDrawer-C08L3UOO.mjs → CompareDrawer-DhrN1uC2.mjs} +6 -6
- package/.output/server/_ssr/{ProxyViewerContainer-CMWl3Ijy.mjs → ProxyViewerContainer-DRl51s_n.mjs} +910 -186
- package/.output/server/_ssr/{ReplayDialog-CPDo9_G5.mjs → ReplayDialog-BQT_ygxC.mjs} +240 -14
- package/.output/server/_ssr/{RequestAnatomy-D9wt_K1E.mjs → RequestAnatomy-DS2tZOgq.mjs} +5 -5
- package/.output/server/_ssr/{ResponseView-DXaL7nY3.mjs → ResponseView-e0kL2C3x.mjs} +25 -21
- package/.output/server/_ssr/{StreamingChunkSequence-B_hudZyb.mjs → StreamingChunkSequence-BJG-m7xs.mjs} +3 -3
- package/.output/server/_ssr/{index-CuE_BN86.mjs → index-Dea3OeRw.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{json-viewer-Ci6kkjde.mjs → json-viewer-DDU55MLK.mjs} +3 -3
- package/.output/server/_ssr/{router-BemxgIg7.mjs → router-Dl7oh0zx.mjs} +164 -82
- package/.output/server/_tanstack-start-manifest_v-m-FJNBVf.mjs +4 -0
- package/.output/server/index.mjs +70 -70
- package/package.json +1 -1
- package/src/components/OnboardingBanner.tsx +11 -19
- package/src/components/ProxyViewer.tsx +26 -16
- package/src/components/ProxyViewerContainer.tsx +2 -1
- package/src/components/providers/ProviderCard.tsx +6 -20
- package/src/components/providers/SettingsDialog.tsx +140 -3
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +731 -72
- package/src/components/proxy-viewer/AnswerMarkdown.tsx +16 -0
- package/src/components/proxy-viewer/CompareDrawer.tsx +4 -2
- package/src/components/proxy-viewer/ConversationGroup.tsx +12 -0
- package/src/components/proxy-viewer/ConversationHeader.tsx +6 -6
- package/src/components/proxy-viewer/LogEntry.tsx +5 -5
- package/src/components/proxy-viewer/LogEntryHeader.tsx +21 -36
- package/src/components/proxy-viewer/ReplayDialog.tsx +190 -8
- package/src/components/proxy-viewer/ResponseView.tsx +4 -8
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +37 -17
- package/src/components/proxy-viewer/TurnGroup.tsx +18 -2
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +2 -2
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +6 -12
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +2 -2
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +10 -14
- 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/lib/runtimeConfig.ts +6 -0
- package/src/lib/timeDisplay.ts +22 -0
- package/src/lib/useOnboarding.ts +2 -0
- package/src/lib/useStripConfig.ts +16 -0
- package/src/proxy/config.ts +3 -0
- package/src/routes/api/config.ts +5 -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-Da0jpBkp.js +0 -101
- package/.output/public/assets/ReplayDialog-CxUk_TF0.js +0 -1
- package/.output/public/assets/RequestAnatomy-DIlzjgjJ.js +0 -1
- package/.output/public/assets/ResponseView-DQCuKJ1G.js +0 -1
- package/.output/public/assets/StreamingChunkSequence-DHk4SGGL.js +0 -1
- package/.output/public/assets/_sessionId-dY1TTl7N.js +0 -1
- package/.output/public/assets/index-D7wwbwly.css +0 -1
- package/.output/public/assets/index-FqQZbfl2.js +0 -1
- package/.output/server/_tanstack-start-manifest_v--L1_b4sd.mjs +0 -4
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-D5A4bTfV.js","assets/main-CZT_F-gu.js","assets/json-viewer-BbU0n8eM.js","assets/ReplayDialog-CxUk_TF0.js","assets/ResponseView-DQCuKJ1G.js","assets/RequestAnatomy-DIlzjgjJ.js","assets/StreamingChunkSequence-DHk4SGGL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as Ko,a as ma,r as v,j as a,c as qn,g as Qu,b as Ln,d as He,e as ga,f as ed,h as td,_ as Ft}from"./main-CZT_F-gu.js";function G(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 h=0;h<d.length;h++){const m=d[h];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 xa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const va={};function wt(e){return va}function ya(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 _o(e,t){return typeof t=="bigint"?t.toString():t}function Ar(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Go(e){return e==null}function Yo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function nd(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 Ls=Symbol("evaluating");function ke(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ls)return r===void 0&&(r=Ls,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 Fs(e){return JSON.stringify(e)}function rd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ba="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function An(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const od=Ar(()=>{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(An(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(An(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function wa(e){return on(e)?{...e}:Array.isArray(e)?[...e]:e}const sd=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 id(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const ad={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 ld(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 cd(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 ud(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 dd(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 fd(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 hd(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 pd(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 Jn(e){return typeof e=="string"?e:e?.message}function _t(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Jn(e.inst?._zod.def?.error?.(e))??Jn(t?.error?.(e))??Jn(n.customError?.(e))??Jn(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Xo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function zn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const _a=(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,_o,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ka=G("$ZodError",_a),Ca=G("$ZodError",_a,{Parent:Error});function md(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 gd(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 Qo=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 ba(l,o?.callee),l}return i.value},es=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 ba(l,o?.callee),l}return i.value},zr=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??ka)(s.issues.map(i=>_t(i,o,wt())))}:{success:!0,data:s.value}},xd=zr(Ca),Or=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}},vd=Or(Ca),yd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qo(e)(t,n,o)},bd=e=>(t,n,r)=>Qo(e)(t,n,r),wd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return es(e)(t,n,o)},_d=e=>async(t,n,r)=>es(e)(t,n,r),kd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return zr(e)(t,n,o)},Cd=e=>(t,n,r)=>zr(e)(t,n,r),Sd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Or(e)(t,n,o)},jd=e=>async(t,n,r)=>Or(e)(t,n,r),Ed=/^[cC][^\s-]{8,}$/,Nd=/^[0-9a-z]+$/,Td=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ad=/^[0-9a-vA-V]{20}$/,zd=/^[A-Za-z0-9]{27}$/,Od=/^[a-zA-Z0-9_-]{21}$/,Id=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rd=/^([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})$/,$s=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)$/,Pd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Md="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Dd(){return new RegExp(Md,"u")}const Ld=/^(?:(?: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])$/,Fd=/^(([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}|:))$/,$d=/^((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])$/,Bd=/^(([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])$/,Ud=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sa=/^[A-Za-z0-9_-]*$/,Zd=/^\+[1-9]\d{6,14}$/,ja="(?:(?:\\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])))",Wd=new RegExp(`^${ja}$`);function Ea(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 Vd(e){return new RegExp(`^${Ea(e)}$`)}function Hd(e){const t=Ea({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(`^${ja}T(?:${r})$`)}const qd=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Jd=/^-?\d+$/,Na=/^-?\d+(?:\.\d+)?$/,Kd=/^(?:true|false)$/i,Gd=/^null$/i,Yd=/^[^A-Z]*$/,Xd=/^[^a-z]*$/,qe=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ta={number:"number",bigint:"bigint",object:"date"},Aa=G("$ZodCheckLessThan",(e,t)=>{qe.init(e,t);const n=Ta[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})}}),za=G("$ZodCheckGreaterThan",(e,t)=>{qe.init(e,t);const n=Ta[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})}}),Qd=G("$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):nd(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})}}),ef=G("$ZodCheckNumberFormat",(e,t)=>{qe.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=ad[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=Jd)}),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})}}),tf=G("$ZodCheckMaxLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Go(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=Xo(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nf=G("$ZodCheckMinLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Go(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=Xo(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rf=G("$ZodCheckLengthEquals",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Go(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=Xo(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})}}),Ir=G("$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=()=>{})}),of=G("$ZodCheckRegex",(e,t)=>{Ir.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})}}),sf=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Yd),Ir.init(e,t)}),af=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xd),Ir.init(e,t)}),lf=G("$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})}}),cf=G("$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})}}),uf=G("$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})}}),df=G("$ZodCheckOverwrite",(e,t)=>{qe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ff{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 hf={major:4,minor:3,patch:6},ze=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hf;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 h of l){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,p=h._zod.check(i);if(p instanceof Promise&&c?.async===!1)throw new en;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,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=xd(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return vd(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ts=G("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??qd(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=G("$ZodStringFormat",(e,t)=>{Ir.init(e,t),ts.init(e,t)}),pf=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Rd),Re.init(e,t)}),mf=G("$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=$s(r))}else t.pattern??(t.pattern=$s());Re.init(e,t)}),gf=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Pd),Re.init(e,t)}),xf=G("$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})}}}),vf=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Dd()),Re.init(e,t)}),yf=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Od),Re.init(e,t)}),bf=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ed),Re.init(e,t)}),wf=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nd),Re.init(e,t)}),_f=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Td),Re.init(e,t)}),kf=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ad),Re.init(e,t)}),Cf=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zd),Re.init(e,t)}),Sf=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Hd(t)),Re.init(e,t)}),jf=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Wd),Re.init(e,t)}),Ef=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vd(t)),Re.init(e,t)}),Nf=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Id),Re.init(e,t)}),Tf=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ld),Re.init(e,t),e._zod.bag.format="ipv4"}),Af=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Fd),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})}}}),zf=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$d),Re.init(e,t)}),Of=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Bd),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 Oa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const If=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ud),Re.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Oa(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Rf(e){if(!Sa.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Oa(n)}const Pf=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Sa),Re.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Rf(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Mf=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Zd),Re.init(e,t)});function Df(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 Lf=G("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{Df(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ia=G("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??Na,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}}),Ff=G("$ZodNumberFormat",(e,t)=>{ef.init(e,t),Ia.init(e,t)}),$f=G("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Kd,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}}),Bf=G("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=Gd,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}}),Uf=G("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=n=>n}),Zf=G("$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 Bs(e,t,n){e.issues.length&&t.issues.push(...Qt(n,e.issues)),t.value[n]=e.value}const Wf=G("$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=>Bs(u,n,i))):Bs(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function hr(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 Ra(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=id(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Pa(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 h in t){if(l.has(h))continue;if(u==="never"){i.push(h);continue}const m=c.run({value:t[h],issues:[]},r);m instanceof Promise?e.push(m.then(p=>hr(p,n,h,t,d))):hr(m,n,h,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 Vf=G("$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=Ar(()=>Ra(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 h of d.values)c[u].add(h)}}return c});const o=An,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=[],h=i.shape;for(const m of i.keys){const p=h[m],x=p._zod.optout==="optional",f=p._zod.run({value:u[m],issues:[]},c);f instanceof Promise?d.push(f.then(g=>hr(g,l,m,u,x))):hr(f,l,m,u,x)}return s?Pa(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Hf=G("$ZodObjectJIT",(e,t)=>{Vf.init(e,t);const n=e._zod.parse,r=Ar(()=>Ra(t)),o=m=>{const p=new ff(["shape","payload","ctx"]),x=r.value,f=k=>{const C=Fs(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");const g=Object.create(null);let y=0;for(const k of x.keys)g[k]=`key_${y++}`;p.write("const newResult = {};");for(const k of x.keys){const C=g[k],S=Fs(k),E=m[k]?._zod?.optout==="optional";p.write(`const ${C} = ${f(k)};`),E?p.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
|
-
`):p.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
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");const _=p.compile();return(k,C)=>_(m,k,C)};let s;const i=An,l=!va.jitless,u=l&&od.value,d=t.catchall;let h;e._zod.parse=(m,p)=>{h??(h=r.value);const x=m.value;return i(x)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),m=s(m,p),d?Pa([],x,m,p,h,e):m):n(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m)}});function Us(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 Ma=G("$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=>Yo(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=>Us(c,o,e,s)):Us(l,o,e,s)}}),qf=G("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ma.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=Ar(()=>{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(!An(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)}}),Jf=G("$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])=>Zs(n,c,u)):Zs(n,s,i)}});function ko(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=ko(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=ko(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 Zs(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=ko(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 Kf=G("$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(h=>{h.issues.length&&n.issues.push(...Qt(u,h.issues)),n.value[u]=h.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"&&Na.test(l)&&c.issues.length){const h=t.keyType._zod.run({value:Number(l),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(c=h)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>_t(h,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(h=>{h.issues.length&&n.issues.push(...Qt(l,h.issues)),n.value[c.value]=h.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}}),Gf=G("$ZodEnum",(e,t)=>{ze.init(e,t);const n=ya(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>sd.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}}),Yf=G("$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}}),Xf=G("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xa(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 Ws(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Da=G("$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(`^(${Yo(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=>Ws(s,n.value)):Ws(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Qf=G("$ZodExactOptional",(e,t)=>{Da.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)}),eh=G("$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(`^(${Yo(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)}),th=G("$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=>Vs(s,t)):Vs(o,t)}});function Vs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const nh=G("$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))}),rh=G("$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=>Hs(s,e)):Hs(o,e)}});function Hs(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 oh=G("$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)}}),sh=G("$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=>Kn(i,t.in,r)):Kn(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Kn(s,t.out,r)):Kn(o,t.out,r)}});function Kn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ih=G("$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(qs):qs(o)}});function qs(e){return e.value=Object.freeze(e.value),e}const ah=G("$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)}),lh=G("$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=>Js(s,n,r,e));Js(o,n,r,e)}});function Js(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(zn(o))}}var Ks;class ch{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 uh(){return new ch}(Ks=globalThis).__zod_globalRegistry??(Ks.__zod_globalRegistry=uh());const En=globalThis.__zod_globalRegistry;function dh(e,t){return new e({type:"string",...de(t)})}function fh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Gs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function hh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function ph(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function mh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function gh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function xh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function vh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function yh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function bh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function wh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function _h(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function kh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function Ch(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function Sh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function jh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function Eh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Nh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function Th(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function Ah(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function zh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function Oh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function Ih(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Rh(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function Ph(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function Mh(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function Dh(e,t){return new e({type:"number",checks:[],...de(t)})}function Lh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function Fh(e,t){return new e({type:"boolean",...de(t)})}function $h(e,t){return new e({type:"null",...de(t)})}function Bh(e){return new e({type:"unknown"})}function Uh(e,t){return new e({type:"never",...de(t)})}function Ys(e,t){return new Aa({check:"less_than",...de(t),value:e,inclusive:!1})}function Qr(e,t){return new Aa({check:"less_than",...de(t),value:e,inclusive:!0})}function Xs(e,t){return new za({check:"greater_than",...de(t),value:e,inclusive:!1})}function eo(e,t){return new za({check:"greater_than",...de(t),value:e,inclusive:!0})}function Qs(e,t){return new Qd({check:"multiple_of",...de(t),value:e})}function La(e,t){return new tf({check:"max_length",...de(t),maximum:e})}function pr(e,t){return new nf({check:"min_length",...de(t),minimum:e})}function Fa(e,t){return new rf({check:"length_equals",...de(t),length:e})}function Zh(e,t){return new of({check:"string_format",format:"regex",...de(t),pattern:e})}function Wh(e){return new sf({check:"string_format",format:"lowercase",...de(e)})}function Vh(e){return new af({check:"string_format",format:"uppercase",...de(e)})}function Hh(e,t){return new lf({check:"string_format",format:"includes",...de(t),includes:e})}function qh(e,t){return new cf({check:"string_format",format:"starts_with",...de(t),prefix:e})}function Jh(e,t){return new uf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function fn(e){return new df({check:"overwrite",tx:e})}function Kh(e){return fn(t=>t.normalize(e))}function Gh(){return fn(e=>e.trim())}function Yh(){return fn(e=>e.toLowerCase())}function Xh(){return fn(e=>e.toUpperCase())}function Qh(){return fn(e=>rd(e))}function ep(e,t,n){return new e({type:"array",element:t,...de(n)})}function tp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function np(e){const t=rp(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(zn(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(zn(o))}},e(n.value,n)));return t}function rp(e,t){const n=new qe({check:"custom",...de(t)});return n._zod.check=e,n}function $a(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??En,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,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,d)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),Le(h,t,d),t.seen.get(h).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 Ba(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 h=e.external.registry.get(i[0])?.id,m=e.external.uri??(x=>x);if(h)return{ref:m(h)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${l}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const h in d)delete d[h];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 Ua(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),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),i._zod.parent===d)for(const f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(p.$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 h=i._zod.parent;if(h&&h!==d){r(h);const m=e.seen.get(h);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:mr(t,"input",e.processors),output:mr(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 op=(e,t={})=>n=>{const r=$a({...n,processors:t});return Le(e,r),Ba(r,e),Ua(r,e)},mr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=$a({...o??{},target:s,io:t,processors:n});return Le(e,i),Ba(i,e),Ua(i,e)},sp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ip=(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=sp[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(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},ap=(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)},lp=(e,t,n,r)=>{n.type="boolean"},cp=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},up=(e,t,n,r)=>{n.not={}},dp=(e,t,n,r)=>{},fp=(e,t,n,r)=>{const o=e._zod.def,s=ya(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},hp=(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},pp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gp=(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"]})},xp=(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)},vp=(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},yp=(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},bp=(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 h of c)o.patternProperties[h.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(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},wp=(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"}]},_p=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},kp=(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))},Cp=(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)))},Sp=(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},jp=(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},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.readOnly=!0},Za=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Np=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},Tp=G("ZodISODateTime",(e,t)=>{Sf.init(e,t),Pe.init(e,t)});function Ap(e){return Ih(Tp,e)}const zp=G("ZodISODate",(e,t)=>{jf.init(e,t),Pe.init(e,t)});function Op(e){return Rh(zp,e)}const Ip=G("ZodISOTime",(e,t)=>{Ef.init(e,t),Pe.init(e,t)});function Rp(e){return Ph(Ip,e)}const Pp=G("ZodISODuration",(e,t)=>{Nf.init(e,t),Pe.init(e,t)});function Mp(e){return Mh(Pp,e)}const Dp=(e,t)=>{ka.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>gd(e,n)},flatten:{value:n=>md(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,_o,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,_o,2)}},isEmpty:{get(){return e.issues.length===0}}})},Xe=G("ZodError",Dp,{Parent:Error}),Lp=Qo(Xe),Fp=es(Xe),$p=zr(Xe),Bp=Or(Xe),Up=yd(Xe),Zp=bd(Xe),Wp=wd(Xe),Vp=_d(Xe),Hp=kd(Xe),qp=Cd(Xe),Jp=Sd(Xe),Kp=jd(Xe),Oe=G("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:mr(e,"input"),output:mr(e,"output")}}),e.toJSONSchema=op(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)=>Lp(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>$p(e,n,r),e.parseAsync=async(n,r)=>Fp(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Bp(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Up(e,n,r),e.decode=(n,r)=>Zp(e,n,r),e.encodeAsync=async(n,r)=>Wp(e,n,r),e.decodeAsync=async(n,r)=>Vp(e,n,r),e.safeEncode=(n,r)=>Hp(e,n,r),e.safeDecode=(n,r)=>qp(e,n,r),e.safeEncodeAsync=async(n,r)=>Jp(e,n,r),e.safeDecodeAsync=async(n,r)=>Kp(e,n,r),e.refine=(n,r)=>e.check(Vm(n,r)),e.superRefine=n=>e.check(Hm(n)),e.overwrite=n=>e.check(fn(n)),e.optional=()=>ni(e),e.exactOptional=()=>Am(e),e.nullable=()=>ri(e),e.nullish=()=>ni(ri(e)),e.nonoptional=n=>Mm(e,n),e.array=()=>_e(e),e.or=n=>vt([e,n]),e.and=n=>Cm(e,n),e.transform=n=>oi(e,Nm(n)),e.default=n=>Im(e,n),e.prefault=n=>Pm(e,n),e.catch=n=>Lm(e,n),e.pipe=n=>oi(e,n),e.readonly=()=>Bm(e),e.describe=n=>{const r=e.clone();return En.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return En.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return En.get(e);const r=e.clone();return En.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Wa=G("_ZodString",(e,t)=>{ts.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ip(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(Zh(...r)),e.includes=(...r)=>e.check(Hh(...r)),e.startsWith=(...r)=>e.check(qh(...r)),e.endsWith=(...r)=>e.check(Jh(...r)),e.min=(...r)=>e.check(pr(...r)),e.max=(...r)=>e.check(La(...r)),e.length=(...r)=>e.check(Fa(...r)),e.nonempty=(...r)=>e.check(pr(1,...r)),e.lowercase=r=>e.check(Wh(r)),e.uppercase=r=>e.check(Vh(r)),e.trim=()=>e.check(Gh()),e.normalize=(...r)=>e.check(Kh(...r)),e.toLowerCase=()=>e.check(Yh()),e.toUpperCase=()=>e.check(Xh()),e.slugify=()=>e.check(Qh())}),Gp=G("ZodString",(e,t)=>{ts.init(e,t),Wa.init(e,t),e.email=n=>e.check(fh(Yp,n)),e.url=n=>e.check(xh(Xp,n)),e.jwt=n=>e.check(Oh(hm,n)),e.emoji=n=>e.check(vh(Qp,n)),e.guid=n=>e.check(Gs(ei,n)),e.uuid=n=>e.check(hh(Gn,n)),e.uuidv4=n=>e.check(ph(Gn,n)),e.uuidv6=n=>e.check(mh(Gn,n)),e.uuidv7=n=>e.check(gh(Gn,n)),e.nanoid=n=>e.check(yh(em,n)),e.guid=n=>e.check(Gs(ei,n)),e.cuid=n=>e.check(bh(tm,n)),e.cuid2=n=>e.check(wh(nm,n)),e.ulid=n=>e.check(_h(rm,n)),e.base64=n=>e.check(Th(um,n)),e.base64url=n=>e.check(Ah(dm,n)),e.xid=n=>e.check(kh(om,n)),e.ksuid=n=>e.check(Ch(sm,n)),e.ipv4=n=>e.check(Sh(im,n)),e.ipv6=n=>e.check(jh(am,n)),e.cidrv4=n=>e.check(Eh(lm,n)),e.cidrv6=n=>e.check(Nh(cm,n)),e.e164=n=>e.check(zh(fm,n)),e.datetime=n=>e.check(Ap(n)),e.date=n=>e.check(Op(n)),e.time=n=>e.check(Rp(n)),e.duration=n=>e.check(Mp(n))});function $(e){return dh(Gp,e)}const Pe=G("ZodStringFormat",(e,t)=>{Re.init(e,t),Wa.init(e,t)}),Yp=G("ZodEmail",(e,t)=>{gf.init(e,t),Pe.init(e,t)}),ei=G("ZodGUID",(e,t)=>{pf.init(e,t),Pe.init(e,t)}),Gn=G("ZodUUID",(e,t)=>{mf.init(e,t),Pe.init(e,t)}),Xp=G("ZodURL",(e,t)=>{xf.init(e,t),Pe.init(e,t)}),Qp=G("ZodEmoji",(e,t)=>{vf.init(e,t),Pe.init(e,t)}),em=G("ZodNanoID",(e,t)=>{yf.init(e,t),Pe.init(e,t)}),tm=G("ZodCUID",(e,t)=>{bf.init(e,t),Pe.init(e,t)}),nm=G("ZodCUID2",(e,t)=>{wf.init(e,t),Pe.init(e,t)}),rm=G("ZodULID",(e,t)=>{_f.init(e,t),Pe.init(e,t)}),om=G("ZodXID",(e,t)=>{kf.init(e,t),Pe.init(e,t)}),sm=G("ZodKSUID",(e,t)=>{Cf.init(e,t),Pe.init(e,t)}),im=G("ZodIPv4",(e,t)=>{Tf.init(e,t),Pe.init(e,t)}),am=G("ZodIPv6",(e,t)=>{Af.init(e,t),Pe.init(e,t)}),lm=G("ZodCIDRv4",(e,t)=>{zf.init(e,t),Pe.init(e,t)}),cm=G("ZodCIDRv6",(e,t)=>{Of.init(e,t),Pe.init(e,t)}),um=G("ZodBase64",(e,t)=>{If.init(e,t),Pe.init(e,t)}),dm=G("ZodBase64URL",(e,t)=>{Pf.init(e,t),Pe.init(e,t)}),fm=G("ZodE164",(e,t)=>{Mf.init(e,t),Pe.init(e,t)}),hm=G("ZodJWT",(e,t)=>{Lf.init(e,t),Pe.init(e,t)}),Va=G("ZodNumber",(e,t)=>{Ia.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ap(e,r,o),e.gt=(r,o)=>e.check(Xs(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(Ys(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(ti(r)),e.safe=r=>e.check(ti(r)),e.positive=r=>e.check(Xs(0,r)),e.nonnegative=r=>e.check(eo(0,r)),e.negative=r=>e.check(Ys(0,r)),e.nonpositive=r=>e.check(Qr(0,r)),e.multipleOf=(r,o)=>e.check(Qs(r,o)),e.step=(r,o)=>e.check(Qs(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 Dh(Va,e)}const pm=G("ZodNumberFormat",(e,t)=>{Ff.init(e,t),Va.init(e,t)});function ti(e){return Lh(pm,e)}const mm=G("ZodBoolean",(e,t)=>{$f.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lp(e,n,r)});function Ue(e){return Fh(mm,e)}const gm=G("ZodNull",(e,t)=>{Bf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cp(e,n,r)});function Co(e){return $h(gm,e)}const xm=G("ZodUnknown",(e,t)=>{Uf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dp()});function So(){return Bh(xm)}const vm=G("ZodNever",(e,t)=>{Zf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>up(e,n,r)});function ym(e){return Uh(vm,e)}const bm=G("ZodArray",(e,t)=>{Wf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(pr(n,r)),e.nonempty=n=>e.check(pr(1,n)),e.max=(n,r)=>e.check(La(n,r)),e.length=(n,r)=>e.check(Fa(n,r)),e.unwrap=()=>e.element});function _e(e,t){return ep(bm,e,t)}const wm=G("ZodObject",(e,t)=>{Hf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(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:So()}),e.loose=()=>e.clone({...e._zod.def,catchall:So()}),e.strict=()=>e.clone({...e._zod.def,catchall:ym()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ud(e,n),e.safeExtend=n=>dd(e,n),e.merge=n=>fd(e,n),e.pick=n=>ld(e,n),e.omit=n=>cd(e,n),e.partial=(...n)=>hd(qa,e,n[0]),e.required=(...n)=>pd(Ja,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...de(t)};return new wm(n)}const Ha=G("ZodUnion",(e,t)=>{Ma.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n,r,o),e.options=t.options});function vt(e,t){return new Ha({type:"union",options:e,...de(t)})}const _m=G("ZodDiscriminatedUnion",(e,t)=>{Ha.init(e,t),qf.init(e,t)});function Bt(e,t,n){return new _m({type:"union",options:t,discriminator:e,...de(n)})}const km=G("ZodIntersection",(e,t)=>{Jf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n,r,o)});function Cm(e,t){return new km({type:"intersection",left:e,right:t})}const Sm=G("ZodRecord",(e,t)=>{Kf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function mt(e,t,n){return new Sm({type:"record",keyType:e,valueType:t,...de(n)})}const jo=G("ZodEnum",(e,t)=>{Gf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fp(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 jo({...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 jo({...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 jo({type:"enum",entries:n,...de(t)})}const jm=G("ZodLiteral",(e,t)=>{Yf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp(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 jm({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const Em=G("ZodTransform",(e,t)=>{Xf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xa(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(zn(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(zn(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Nm(e){return new Em({type:"transform",transform:e})}const qa=G("ZodOptional",(e,t)=>{Da.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Za(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ni(e){return new qa({type:"optional",innerType:e})}const Tm=G("ZodExactOptional",(e,t)=>{Qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Za(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Am(e){return new Tm({type:"optional",innerType:e})}const zm=G("ZodNullable",(e,t)=>{eh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ri(e){return new zm({type:"nullable",innerType:e})}const Om=G("ZodDefault",(e,t)=>{th.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Im(e,t){return new Om({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():wa(t)}})}const Rm=G("ZodPrefault",(e,t)=>{nh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pm(e,t){return new Rm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():wa(t)}})}const Ja=G("ZodNonOptional",(e,t)=>{rh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_p(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Mm(e,t){return new Ja({type:"nonoptional",innerType:e,...de(t)})}const Dm=G("ZodCatch",(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,e.removeCatch=e.unwrap});function Lm(e,t){return new Dm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Fm=G("ZodPipe",(e,t)=>{sh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.in=t.in,e.out=t.out});function oi(e,t){return new Fm({type:"pipe",in:e,out:t})}const $m=G("ZodReadonly",(e,t)=>{ih.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ep(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Bm(e){return new $m({type:"readonly",innerType:e})}const Um=G("ZodLazy",(e,t)=>{ah.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Np(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Zm(e){return new Um({type:"lazy",getter:e})}const Wm=G("ZodCustom",(e,t)=>{lh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp(e,n)});function Vm(e,t={}){return tp(Wm,e,t)}function Hm(e){return np(e)}const an=Zm(()=>vt([$(),he(),Ue(),Co(),_e(an),mt($(),an)]));function Ka(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 ns=ne({type:$(),ttl:$().optional(),scope:$().optional()}),rs=ne({type:xe("text"),text:$(),cache_control:ns.optional()}),Ga=ne({type:xe("thinking"),thinking:$(),signature:$().optional()}),qm=ne({type:xe("think"),thinking:$(),signature:$().optional()}),Jm=ne({type:xe("base64"),media_type:$(),data:$()}),Ya=ne({type:xe("image"),source:Jm}),Xa=ne({type:xe("tool_use"),id:$(),name:$(),input:mt($(),an)}),Km=Bt("type",[rs,Ya]),Gm=ne({type:xe("tool_result"),tool_use_id:$().optional(),content:vt([$(),_e(Km)]),is_error:Ue().optional()}),Ym=Bt("type",[rs,Ga,Ya,Xa,Gm]),Xm=vt([$(),_e(Ym)]),Qm=ne({role:Ze(["user","assistant"]),content:Xm}),eg=ne({type:xe("text"),text:$(),cache_control:ns.optional()}),tg=ne({type:$(),properties:mt($(),mt($(),an)).optional(),required:_e($()).optional(),additionalProperties:Ue().optional(),$schema:$().optional()}),ng=ne({name:$(),description:$().optional(),input_schema:tg.optional(),cache_control:ns.optional()}),rg=Bt("type",[ne({type:xe("enabled"),budget_tokens:he()}),ne({type:xe("disabled")}),ne({type:xe("adaptive")})]),Qa=ne({model:$(),messages:_e(Qm),system:_e(eg).optional(),tools:_e(ng).optional(),max_tokens:he().optional(),temperature:he().optional(),stream:Ue().optional(),thinking:rg.optional(),metadata:ne({user_id:$().optional()}).optional()}),os=Bt("type",[rs,Ga,qm,Xa]),og=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(),el=ne({id:$(),type:xe("message"),model:$(),role:xe("assistant"),content:_e(os),stop_reason:$().nullable(),stop_sequence:$().nullable().optional(),usage:og}).passthrough(),sg=ne({type:xe("message_start"),message:ne({id:$(),type:xe("message"),model:$(),role:xe("assistant"),content:_e(os),stop_reason:Co(),stop_sequence:Co(),usage:ne({input_tokens:he(),cache_creation_input_tokens:he().optional(),cache_read_input_tokens:he().optional()}).passthrough()})}),ig=ne({type:xe("content_block_start"),index:he(),content_block:os}),ag=Bt("type",[ne({type:xe("text_delta"),text:$()}),ne({type:xe("input_json_delta"),partial_json:$()}),ne({type:xe("thinking_delta"),thinking:$()}),ne({type:xe("signature_delta"),signature:$()})]),lg=ne({type:xe("content_block_delta"),index:he(),delta:ag}),cg=ne({type:xe("content_block_stop"),index:he()}),ug=ne({type:xe("message_delta"),delta:ne({stop_reason:$().nullable(),stop_sequence:$().nullable().optional()}),usage:ne({output_tokens:he(),input_tokens:he().optional(),cache_creation_input_tokens:he().optional(),cache_read_input_tokens:he().optional()}).passthrough()}),dg=ne({type:xe("message_stop")}),fg=ne({type:xe("ping")}),hg=ne({type:xe("error"),error:ne({type:$(),message:$()})}),pg=Bt("type",[sg,ig,lg,cg,ug,dg,fg,hg]),mg=vt([$(),_e(Bt("type",[ne({type:xe("text"),text:$()}),ne({type:xe("image_url"),image_url:ne({url:$(),detail:$().optional()})})]))]),tl=ne({role:Ze(["system","user","assistant","tool"]),content:mg,name:$().optional(),reasoning_content:$().optional(),thinking:$().optional(),think:$().optional()}),gg=ne({name:$(),arguments:$()}),nl=ne({index:he().optional(),id:$().optional(),type:xe("function").optional(),function:ne({name:$().optional(),arguments:$().optional()})});tl.extend({content:vt([$(),_e(ne({type:xe("text"),text:$()}))]).optional(),function_call:gg.optional(),tool_calls:_e(nl).optional()});const xg=ne({type:xe("function"),function:ne({name:$(),description:$().optional(),parameters:mt($(),an)})}),rl=ne({model:$(),messages:_e(tl),temperature:he().optional(),max_tokens:he().optional(),stream:Ue().optional(),tools:_e(xg).optional(),tool_choice:vt([Ze(["auto","none","required"]),ne({type:xe("auto")}),ne({type:xe("none")}),ne({type:xe("function"),function:ne({name:$()})})]).optional(),user:$().optional()}),ol=ne({role:Ze(["assistant"]).optional(),content:$().nullable().optional(),reasoning_content:$().nullable().optional(),thinking:$().nullable().optional(),think:$().nullable().optional(),function_call:ne({name:$().optional(),arguments:$().optional()}).nullable().optional(),tool_calls:_e(ne({index:he(),id:$().optional(),type:xe("function").optional(),function:ne({name:$().optional(),arguments:$().optional()})})).nullable().optional()}),vg=ne({index:he(),message:ne({role:Ze(["assistant"]),content:$().nullable(),reasoning_content:$().optional(),thinking:$().optional(),think:$().optional(),function_call:ne({name:$(),arguments:$()}).nullable().optional(),tool_calls:_e(nl).optional()}).optional(),delta:ol.optional(),finish_reason:$().nullable()}),yg=ne({id:$(),object:xe("chat.completion"),created:he(),model:$(),choices:_e(vg),usage:ne({prompt_tokens:he().nullable().optional(),completion_tokens:he().nullable().optional(),total_tokens:he().nullable().optional()}).passthrough(),service_tier:$().nullable().optional(),system_fingerprint:$().nullable().optional()}).passthrough(),bg=ne({id:$(),object:xe("chat.completion.chunk"),created:he(),model:$(),choices:_e(ne({index:he(),delta:ol,finish_reason:$().nullable().optional()})),usage:ne({prompt_tokens:he().nullable().optional(),completion_tokens:he().nullable().optional(),total_tokens:he().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function sl(e){try{const t=JSON.parse(e),n=yg.safeParse(t);return n.success?n.data:null}catch{return null}}const il=ne({index:he(),timestamp:he(),type:$(),data:an}),wg=ne({chunks:_e(il),truncated:Ue().optional().default(!1)}),si=ne({id:he(),timestamp:$(),method:$(),path:$(),model:$().nullable(),sessionId:$().nullable(),rawRequestBody:$().nullable(),responseStatus:he().nullable(),responseText:$().nullable(),inputTokens:he().nullable(),outputTokens:he().nullable(),cacheCreationInputTokens:he().nullable(),cacheReadInputTokens:he().nullable(),elapsedMs:he().nullable(),streaming:Ue(),userAgent:$().nullable(),origin:$().nullable(),rawHeaders:mt($(),$()).optional(),headers:mt($(),$()).optional(),apiFormat:Ze(["anthropic","openai","unknown"]).default("unknown"),isTest:Ue().optional().default(!1),providerName:$().nullable().optional(),clientPort:he().nullable().optional(),clientPid:he().nullable().optional(),clientCwd:$().nullable().optional(),clientProjectFolder:$().nullable().optional(),streamingChunks:wg.optional(),streamingChunksPath:$().nullable().optional(),error:$().nullable().optional()});ne({model:$()});ne({model:$().optional(),metadata:ne({user_id:$().optional()}).passthrough().optional()});const _g=ne({error:$()});async function Ot(e,t){const n=await e.json();return t.parse(n)}async function Tn(e,t){try{const n=await e.json(),r=_g.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Fn(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 Tn(o,s))}return Ot(o,t)}const gr=10,Eo=600,Rr=ne({stripClaudeCodeBillingHeader:Ue(),hasSeenOnboarding:Ue().default(!1),slowResponseThresholdSeconds:he().int().min(0).max(Eo).default(gr)}),lr="/api/config";async function kg(e){return Fn(e,Rr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function ii(e){return Fn(lr,Rr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function al(){const e=Ko(lr,kg,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ma(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??gr,o=l=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??gr,...l}),s=async l=>{await t(lr,ii({stripClaudeCodeBillingHeader:l}),{optimisticData:o({stripClaudeCodeBillingHeader:l}),rollbackOnError:!0,revalidate:!1})},i=async l=>{await t(lr,ii({slowResponseThresholdSeconds:l}),{optimisticData:o({slowResponseThresholdSeconds:l}),rollbackOnError:!0,revalidate:!1})};return{strip:n,slowResponseThresholdSeconds:r,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:s,setSlowResponseThresholdSeconds:i}}const ll=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Cg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Sg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ai=e=>{const t=Sg(e);return t.charAt(0).toUpperCase()+t.slice(1)};var jg={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 Eg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Ng=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,...jg,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ll("lucide",o),...!s&&!Eg(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(Ng,{ref:s,iconNode:t,className:ll(`lucide-${Cg(ai(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ai(e),n};const Tg=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ag=ge("arrow-down",Tg);const zg=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Og=ge("arrow-left",zg);const Ig=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Rg=ge("arrow-up",Ig);const Pg=[["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"}]],Mg=ge("brain",Pg);const Dg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ut=ge("check",Dg);const Lg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$n=ge("chevron-down",Lg);const Fg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Pr=ge("chevron-right",Fg);const $g=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Bg=ge("chevron-up",$g);const Ug=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Zg=ge("chevrons-down",Ug);const Wg=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Vg=ge("chevrons-up",Wg);const Hg=[["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"}]],On=ge("circle-alert",Hg);const qg=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Jg=ge("circle-check-big",qg);const Kg=[["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"}]],Gg=ge("circle-question-mark",Kg);const Yg=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rt=ge("clock",Yg);const Xg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Qg=ge("columns-2",Xg);const e0=[["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"}]],Bn=ge("copy",e0);const t0=[["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"}]],ss=ge("download",t0);const n0=[["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"}]],cl=ge("external-link",n0);const r0=[["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"}]],is=ge("eye-off",r0);const o0=[["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"}]],as=ge("eye",o0);const s0=[["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"}]],i0=ge("file-diff",s0);const a0=[["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"}]],l0=ge("file-terminal",a0);const c0=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],u0=ge("gauge",c0);const d0=[["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"}]],f0=ge("git-compare-arrows",d0);const h0=[["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"}]],p0=ge("globe",h0);const m0=[["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"}]],g0=ge("history",m0);const x0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],In=ge("loader-circle",x0);const v0=[["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"}]],y0=ge("lock",v0);const b0=[["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"}]],ls=ge("message-square",b0);const w0=[["path",{d:"M5 12h14",key:"1ays0h"}]],_0=ge("minus",w0);const k0=[["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"}]],C0=ge("octagon-alert",k0);const S0=[["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"}]],j0=ge("pencil",S0);const E0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],No=ge("plus",E0);const N0=[["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"}]],T0=ge("radio",N0);const A0=[["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"}]],z0=ge("rotate-ccw",A0);const O0=[["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"}]],ul=ge("rotate-cw",O0);const I0=[["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"}]],R0=ge("rows-3",I0);const P0=[["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"}]],M0=ge("scan",P0);const D0=[["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"}]],L0=ge("server",D0);const F0=[["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"}]],$0=ge("settings",F0);const B0=[["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"}]],dl=ge("trash-2",B0);const U0=[["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"}]],xr=ge("triangle-alert",U0);const Z0=[["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"}]],W0=ge("upload",Z0);const V0=[["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"}]],H0=ge("user",V0);const q0=[["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"}]],J0=ge("wifi-off",q0);const K0=[["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"}]],G0=ge("wifi",K0);const Y0=[["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"}]],vr=ge("wrench",Y0);const X0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fl=ge("x",X0);const Q0=[["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"}]],Rn=ge("zap",Q0),To="/api/config";async function e1(e){return Fn(e,Rr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function t1(e){return Fn(To,Rr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function n1(){const e=Ko(To,e1,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ma(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(To,t1({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??gr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function r1(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=n1();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(fl,{className:"size-3.5"})})]})}function Yn(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 to={exports:{}};var li;function o1(){return li||(li=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 h=typeof Yn=="function"&&Yn;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(x){var f=r[u][1][x];return i(f||x)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof Yn=="function"&&Yn,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,h,m,p,x,f,g=[],y=0,_=c.length,k=_,C=s.getTypeOf(c)!=="string";y<c.length;)k=_-y,h=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,p=(3&u)<<4|d>>4,x=1<k?(15&d)<<2|h>>6:64,f=2<k?63&h:64,g.push(l.charAt(m)+l.charAt(p)+l.charAt(x)+l.charAt(f));return g.join("")},o.decode=function(c){var u,d,h,m,p,x,f=0,g=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var _,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|(p=l.indexOf(c.charAt(f++)))>>2,h=(3&p)<<6|(x=l.indexOf(c.charAt(f++))),_[g++]=u,p!==64&&(_[g++]=d),x!==64&&(_[g++]=h);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,h,m,p,x){this.compressedSize=d,this.uncompressedSize=h,this.crc32=m,this.compression=p,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.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,h,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},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,h,m){var p=i,x=m+h;u^=-1;for(var f=m;f<x;f++)u=u>>>8^p[255&(u^d[f])];return-1^u})(0|c,l,l.length,0):(function(u,d,h,m){var p=i,x=m+h;u^=-1;for(var f=m;f<x;f++)u=u>>>8^p[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(h,m){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=m,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.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 h=this;this._pako.onData=function(m){h.push({data:m,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,x){var f,g="";for(f=0;f<x;f++)g+=String.fromCharCode(255&p),p>>>=8;return g}function i(p,x,f,g,y,_){var k,C,S=p.file,O=p.compression,E=_!==u.utf8encode,A=l.transformTo("string",_(S.name)),I=l.transformTo("string",u.utf8encode(S.name)),P=S.comment,W=l.transformTo("string",_(P)),j=l.transformTo("string",u.utf8encode(P)),z=I.length!==S.name.length,w=j.length!==P.length,R="",q="",L="",B=S.dir,J=S.date,se={crc32:0,compressedSize:0,uncompressedSize:0};x&&!f||(se.crc32=p.crc32,se.compressedSize=p.compressedSize,se.uncompressedSize=p.uncompressedSize);var Z=0;x&&(Z|=8),E||!z&&!w||(Z|=2048);var U=0,te=0;B&&(U|=16),y==="UNIX"?(te=798,U|=(function(K,ue){var X=K;return K||(X=ue?16893:33204),(65535&X)<<16})(S.unixPermissions,B)):(te=20,U|=(function(K){return 63&(K||0)})(S.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,C=J.getUTCFullYear()-1980,C<<=4,C|=J.getUTCMonth()+1,C<<=5,C|=J.getUTCDate(),z&&(q=s(1,1)+s(d(A),4)+I,R+="up"+s(q.length,2)+q),w&&(L=s(1,1)+s(d(W),4)+j,R+="uc"+s(L.length,2)+L);var ee="";return ee+=`
|
|
41
|
-
\0`,ee+=s(Z,2),ee+=O.magic,ee+=s(k,2),ee+=s(C,2),ee+=s(se.crc32,4),ee+=s(se.compressedSize,4),ee+=s(se.uncompressedSize,4),ee+=s(A.length,2),ee+=s(R.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ee+A+R,dirRecord:h.CENTRAL_FILE_HEADER+s(te,2)+ee+s(W.length,2)+"\0\0\0\0"+s(U,4)+s(g,4)+A+R+W}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function m(p,x,f,g){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=f,this.encodeFileName=g,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(p){var x=p.meta.percent||0,f=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:f?(x+100*(f-g-1))/f:100}}))},m.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var x=this.streamFiles&&!p.file.dir;if(x){var f=i(p,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(p){this.accumulate=!1;var x=this.streamFiles&&!p.file.dir,f=i(p,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),x)this.push({data:(function(g){return h.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)})(p),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 p=this.bytesWritten,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var f=this.bytesWritten-p,g=(function(y,_,k,C,S){var O=l.transformTo("string",S(C));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(_,4)+s(k,4)+s(O.length,2)+O})(this.dirRecords.length,f,p,this.zipComment,this.encodeFileName);this.push({data:g,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(p){this._sources.push(p);var x=this;return p.on("data",function(f){x.processChunk(f)}),p.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),p.on("error",function(f){x.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(p){var x=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var f=0;f<x.length;f++)try{x[f].error(p)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,x=0;x<p.length;x++)p[x].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),h=0;try{l.forEach(function(m,p){h++;var x=(function(_,k){var C=_||k,S=s[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(p.options.compression,c.compression),f=p.options.compressionOptions||c.compressionOptions||{},g=p.dir,y=p.date;p._compressWorker(x,f).withStreamInfo("file",{name:m,dir:g,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}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 h(m){return new i.Promise(function(p,x){var f=m.decompressed.getContentWorker().pipe(new u);f.on("error",function(g){x(g)}).on("end",function(){f.streamInfo.crc32!==m.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(m,p){var x=this;return p=s.extend(p||{},{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,p.optimizedBinaryString,p.base64).then(function(f){var g=new c(p);return g.load(f),g}).then(function(f){var g=[i.Promise.resolve(f)],y=f.files;if(p.checkCRC32)for(var _=0;_<y.length;_++)g.push(h(y[_]));return i.Promise.all(g)}).then(function(f){for(var g=f.shift(),y=g.files,_=0;_<y.length;_++){var k=y[_],C=k.fileNameStr,S=s.resolve(k.fileNameStr);x.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:p.createFolders}),k.dir||(x.file(S).unsafeOriginalName=C)}return g.zipComment.length&&(x.comment=g.zipComment),x})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(h,m){d.push(h)||d._helper.pause(),u&&u(m)}).on("error",function(h){d.emit("error",h)}).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,O,E){var A,I=l.getTypeOf(O),P=l.extend(E||{},d);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&16384&P.unixPermissions&&(P.dir=!0),P.dosPermissions&&16&P.dosPermissions&&(P.dir=!0),P.dir&&(S=y(S)),P.createFolders&&(A=g(S))&&_.call(this,A,!0);var W=I==="string"&&P.binary===!1&&P.base64===!1;E&&E.binary!==void 0||(P.binary=!W),(O instanceof h&&O.uncompressedSize===0||P.dir||!O||O.length===0)&&(P.base64=!1,P.binary=!0,O="",P.compression="STORE",I="string");var j=null;j=O instanceof h||O instanceof c?O:x.isNode&&x.isStream(O)?new f(S,O):l.prepareContent(S,O,P.binary,P.optimizedBinaryString,P.base64);var z=new m(S,j,P);this.files[S]=z}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),m=n("./zipObject"),p=n("./generate"),x=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),g=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var O=S.lastIndexOf("/");return 0<O?S.substring(0,O):""},y=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},_=function(S,O){return O=O!==void 0?O:d.createFolders,S=y(S),this.files[S]||s.call(this,S,null,{dir:!0,createFolders:O}),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 O,E,A;for(O in this.files)A=this.files[O],(E=O.slice(this.root.length,O.length))&&O.slice(0,this.root.length)===this.root&&S(E,A)},filter:function(S){var O=[];return this.forEach(function(E,A){S(E,A)&&O.push(A)}),O},file:function(S,O,E){if(arguments.length!==1)return S=this.root+S,s.call(this,S,O,E),this;if(k(S)){var A=S;return this.filter(function(P,W){return!W.dir&&A.test(P)})}var I=this.files[this.root+S];return I&&!I.dir?I:null},folder:function(S){if(!S)return this;if(k(S))return this.filter(function(I,P){return P.dir&&S.test(I)});var O=this.root+S,E=_.call(this,O),A=this.clone();return A.root=E.name,A},remove:function(S){S=this.root+S;var O=this.files[S];if(O||(S.slice(-1)!=="/"&&(S+="/"),O=this.files[S]),O&&!O.dir)delete this.files[S];else for(var E=this.filter(function(I,P){return P.name.slice(0,S.length)===S}),A=0;A<E.length;A++)delete this.files[E[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 O,E={};try{if((E=l.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var A=E.comment||this.comment||"";O=p.generateWorker(this,E,A)}catch(I){(O=new c("error")).error(I)}return new u(O,E.type||"string",E.mimeType)},generateAsync:function(S,O){return this.generateInternalStream(S).accumulate(O)},generateNodeStream:function(S,O){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(O)}};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),h=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]===h)return m-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&h===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(h){var m=s.getTypeOf(h);return s.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(h):i.uint8array?new d(s.transformTo("uint8array",h)):new l(s.transformTo("array",h)):new c(h)}},{"../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"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,f){return new d.Promise(function(g,y){var _=[],k=x._internalType,C=x._outputType,S=x._mimeType;x.on("data",function(O,E){_.push(O),f&&f(E)}).on("error",function(O){_=[],y(O)}).on("end",function(){try{var O=(function(E,A,I){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",A),I);case"base64":return c.encode(A);default:return s.transformTo(E,A)}})(C,(function(E,A){var I,P=0,W=null,j=0;for(I=0;I<A.length;I++)j+=A[I].length;switch(E){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(W=new Uint8Array(j),I=0;I<A.length;I++)W.set(A[I],P),P+=A[I].length;return W;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,_),S);g(O)}catch(E){y(E)}_=[]}).resume()})}function p(x,f,g){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=g,s.checkSupport(y),this._worker=x.pipe(new i(y)),x.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}p.prototype={accumulate:function(x){return m(this,x)},on:function(x,f){var g=this;return x==="data"?this._worker.on(x,function(y){f.call(g,y.data,y.meta)}):this._worker.on(x,function(){s.delay(f,arguments,g)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(x){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},x)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(x){var f,g,y,_,k,C=x.length,S=0;for(_=0;_<C;_++)(64512&(g=x.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=x.charCodeAt(_+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),_++),S+=g<128?1:g<2048?2:g<65536?3:4;for(f=i.uint8array?new Uint8Array(S):new Array(S),_=k=0;k<S;_++)(64512&(g=x.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=x.charCodeAt(_+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),_++),g<128?f[k++]=g:(g<2048?f[k++]=192|g>>>6:(g<65536?f[k++]=224|g>>>12:(f[k++]=240|g>>>18,f[k++]=128|g>>>12&63),f[k++]=128|g>>>6&63),f[k++]=128|63&g);return f})(p)},o.utf8decode=function(p){return i.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(x){var f,g,y,_,k=x.length,C=new Array(2*k);for(f=g=0;f<k;)if((y=x[f++])<128)C[g++]=y;else if(4<(_=u[y]))C[g++]=65533,f+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&f<k;)y=y<<6|63&x[f++],_--;1<_?C[g++]=65533:y<65536?C[g++]=y:(y-=65536,C[g++]=55296|y>>10&1023,C[g++]=56320|1023&y)}return C.length!==g&&(C.subarray?C=C.subarray(0,g):C.length=g),s.applyFromCharCode(C)})(p=s.transformTo(i.uint8array?"uint8array":"array",p))},s.inherits(h,c),h.prototype.processChunk=function(p){var x=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=x;(x=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),x.set(f,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var g=(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})(x),y=x;g!==x.length&&(i.uint8array?(y=x.subarray(0,g),this.leftOver=x.subarray(g,x.length)):(y=x.slice(0,g),this.leftOver=x.slice(g,x.length))),this.push({data:o.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,s.inherits(m,c),m.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.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,g){for(var y=0;y<f.length;++y)g[y]=255&f.charCodeAt(y);return g}n("setimmediate"),o.newBlob=function(f,g){o.checkSupport("blob");try{return new Blob([f],{type:g})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(f),y.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(f,g,y){var _=[],k=0,C=f.length;if(C<=y)return String.fromCharCode.apply(null,f);for(;k<C;)g==="array"||g==="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 g="",y=0;y<f.length;y++)g+=String.fromCharCode(f[y]);return g},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function m(f){var g=65536,y=o.getTypeOf(f),_=!0;if(y==="uint8array"?_=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(_=h.applyCanBeUsed.nodebuffer),_)for(;1<g;)try{return h.stringifyByChunk(f,y,g)}catch{g=Math.floor(g/2)}return h.stringifyByChar(f)}function p(f,g){for(var y=0;y<f.length;y++)g[y]=f[y];return g}o.applyFromCharCode=m;var x={};x.string={string:u,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return x.string.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:function(f){return d(f,l.allocBuffer(f.length))}},x.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)}},x.arraybuffer={string:function(f){return m(new Uint8Array(f))},array:function(f){return p(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))}},x.uint8array={string:m,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:u,nodebuffer:function(f){return l.newBufferFrom(f)}},x.nodebuffer={string:m,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return x.nodebuffer.uint8array(f).buffer},uint8array:function(f){return p(f,new Uint8Array(f.length))},nodebuffer:u},o.transformTo=function(f,g){if(g=g||"",!f)return g;o.checkSupport(f);var y=o.getTypeOf(g);return x[y][f](g)},o.resolve=function(f){for(var g=f.split("/"),y=[],_=0;_<g.length;_++){var k=g[_];k==="."||k===""&&_!==0&&_!==g.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 g,y,_="";for(y=0;y<(f||"").length;y++)_+="\\x"+((g=f.charCodeAt(y))<16?"0":"")+g.toString(16).toUpperCase();return _},o.delay=function(f,g,y){setImmediate(function(){f.apply(y||null,g||[])})},o.inherits=function(f,g){function y(){}y.prototype=g.prototype,f.prototype=new y},o.extend=function(){var f,g,y={};for(f=0;f<arguments.length;f++)for(g in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],g)&&y[g]===void 0&&(y[g]=arguments[f][g]);return y},o.prepareContent=function(f,g,y,_,k){return c.Promise.resolve(g).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,O){var E=new FileReader;E.onload=function(A){S(A.target.result)},E.onerror=function(A){O(A.target.error)},E.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(O){return d(O,s.uint8array?new Uint8Array(O.length):new Array(O.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(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){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(h)+")")}},isSignature:function(h,m){var p=this.reader.index;this.reader.setIndex(h);var x=this.reader.readString(4)===m;return this.reader.setIndex(p),x},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",p=i.transformTo(m,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,m,p,x=this.zip64EndOfCentralSize-44;0<x;)h=this.reader.readInt(2),m=this.reader.readInt(4),p=this.reader.readData(m),this.zip64ExtensibleData[h]={id:h,length:m,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,m;for(h=0;h<this.files.length;h++)m=this.files[h],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<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(h);var m=h;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,(h=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(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var x=m-p;if(0<x)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" bytes.")},prepareReader:function(h){this.reader=s(h)},load:function(h){this.prepareReader(h),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"),h=n("./support");function m(p,x){this.options=p,this.loadOptions=x}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var x,f;if(p.skip(22),this.fileNameLength=p.readInt(2),f=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.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((x=(function(g){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===g)return d[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,x,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var x=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(x),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var x,f,g,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)x=p.readInt(2),f=p.readInt(2),g=p.readData(f),this.extraFields[x]={id:x,length:f,value:g};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var f=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var y=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var x=s(p.value);return x.readInt(1)!==1||c(this.fileName)!==x.readInt(4)?null:u.utf8decode(x.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var x=s(p.value);return x.readInt(1)!==1||c(this.fileComment)!==x.readInt(4)?null:u.utf8decode(x.readData(p.length-5))}return null}},r.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(x,f,g){this.name=x,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=f,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(x){var f=null,g="string";try{if(!x)throw new Error("No output type specified.");var y=(g=x.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),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,g,"")},async:function(x,f){return this.internalStream(x).accumulate(f)},nodeStream:function(x,f){return this.internalStream(x||"nodebuffer").toNodejsStream(f)},_compressWorker:function(x,f){if(this._data instanceof u&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(g,x,f)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)s.prototype[h[p]]=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(x),h=s.document.createTextNode("");d.observe(h,{characterData:!0}),i=function(){h.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(){x(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(x,0)};else{var m=new s.MessageChannel;m.port1.onmessage=x,i=function(){m.port2.postMessage(0)}}var p=[];function x(){var f,g;l=!0;for(var y=p.length;y;){for(g=p,p=[],f=-1;++f<y;)g[f]();y=p.length}l=!1}r.exports=function(f){p.push(f)!==1||l||i()}}).call(this,typeof qn<"u"?qn: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 h(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 p(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 x(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(E){k||(k=!0,l.reject(y,E))}function S(E){k||(k=!0,l.resolve(y,E))}var O=g(function(){_(S,C)});O.status==="error"&&C(O.value)}function g(y,_){var k={};try{k.value=y(_),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=h).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})})},h.prototype.catch=function(y){return this.then(null,y)},h.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?p(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){p(this.promise,this.onFulfilled,y)},m.prototype.callRejected=function(y){l.reject(this.promise,y)},m.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,_){var k=g(x,_);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,O=y.queue.length;++S<O;)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},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(i),y)},h.reject=function(y){var _=new this(i);return l.reject(_,y)},h.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),O=0,E=-1,A=new this(i);++E<k;)I(y[E],E);return A;function I(P,W){_.resolve(P).then(function(j){S[W]=j,++O!==k||C||(C=!0,l.resolve(A,S))},function(j){C||(C=!0,l.reject(A,j))})}},h.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,O=new this(i);++S<k;)E=y[S],_.resolve(E).then(function(A){C||(C=!0,l.resolve(O,A))},function(A){C||(C=!0,l.reject(O,A))});var E;return O}},{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,h=0,m=-1,p=0,x=8;function f(y){if(!(this instanceof f))return new f(y);this.options=i.assign({level:m,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,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!==h)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))!==h)throw new Error(c[k]);this._dict_set=!0}}function g(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,O=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(O),S.next_out=0,S.avail_out=O),(k=s.deflate(S,C))!==1&&k!==h)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===h):C!==2||(this.onEnd(h),!(S.avail_out=0))},f.prototype.onData=function(y){this.chunks.push(y)},f.prototype.onEnd=function(y){y===h&&(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=g,o.deflateRaw=function(y,_){return(_=_||{}).raw=!0,g(y,_)},o.gzip=function(y,_){return(_=_||{}).gzip=!0,g(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"),h=n("./zlib/gzheader"),m=Object.prototype.toString;function p(f){if(!(this instanceof p))return new p(f);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},f||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||f&&f.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,g.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,s.inflateGetHeader(this.strm,this.header)}function x(f,g){var y=new p(g);if(y.push(f,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(f,g){var y,_,k,C,S,O,E=this.strm,A=this.options.chunkSize,I=this.options.dictionary,P=!1;if(this.ended)return!1;_=g===~~g?g:g===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof f=="string"?E.input=l.binstring2buf(f):m.call(f)==="[object ArrayBuffer]"?E.input=new Uint8Array(f):E.input=f,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(A),E.next_out=0,E.avail_out=A),(y=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&I&&(O=typeof I=="string"?l.string2buf(I):m.call(I)==="[object ArrayBuffer]"?new Uint8Array(I):I,y=s.inflateSetDictionary(this.strm,O)),y===c.Z_BUF_ERROR&&P===!0&&(y=c.Z_OK,P=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&y!==c.Z_STREAM_END&&(E.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(E.output,E.next_out),C=E.next_out-k,S=l.buf2string(E.output,k),E.next_out=C,E.avail_out=A-C,C&&i.arraySet(E.output,E.output,k,C,0),this.onData(S)):this.onData(i.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(P=!0)}while((0<E.avail_in||E.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),!(E.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.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=p,o.inflate=x,o.inflateRaw=function(f,g){return(g=g||{}).raw=!0,x(f,g)},o.ungzip=x},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}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,h,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),m);else for(var p=0;p<h;p++)c[m+p]=u[d+p]},flattenChunks:function(c){var u,d,h,m,p,x;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(x=new Uint8Array(h),u=m=0,d=c.length;u<d;u++)p=c[u],x.set(p,m),m+=p.length;return x}},l={arraySet:function(c,u,d,h,m){for(var p=0;p<h;p++)c[m+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,m){if(m<65537&&(h.subarray&&l||!h.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(h,m));for(var p="",x=0;x<m;x++)p+=String.fromCharCode(h[x]);return p}c[254]=c[254]=1,o.string2buf=function(h){var m,p,x,f,g,y=h.length,_=0;for(f=0;f<y;f++)(64512&(p=h.charCodeAt(f)))==55296&&f+1<y&&(64512&(x=h.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(x-56320),f++),_+=p<128?1:p<2048?2:p<65536?3:4;for(m=new s.Buf8(_),f=g=0;g<_;f++)(64512&(p=h.charCodeAt(f)))==55296&&f+1<y&&(64512&(x=h.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(x-56320),f++),p<128?m[g++]=p:(p<2048?m[g++]=192|p>>>6:(p<65536?m[g++]=224|p>>>12:(m[g++]=240|p>>>18,m[g++]=128|p>>>12&63),m[g++]=128|p>>>6&63),m[g++]=128|63&p);return m},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var m=new s.Buf8(h.length),p=0,x=m.length;p<x;p++)m[p]=h.charCodeAt(p);return m},o.buf2string=function(h,m){var p,x,f,g,y=m||h.length,_=new Array(2*y);for(p=x=0;p<y;)if((f=h[p++])<128)_[x++]=f;else if(4<(g=c[f]))_[x++]=65533,p+=g-1;else{for(f&=g===2?31:g===3?15:7;1<g&&p<y;)f=f<<6|63&h[p++],g--;1<g?_[x++]=65533:f<65536?_[x++]=f:(f-=65536,_[x++]=55296|f>>10&1023,_[x++]=56320|1023&f)}return d(_,x)},o.utf8border=function(h,m){var p;for((m=m||h.length)>h.length&&(m=h.length),p=m-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?m:p+c[h[p]]>m?p: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,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--h;);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,h=u+c;i^=-1;for(var m=u;m<h;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"),h=0,m=4,p=0,x=-2,f=-1,g=4,y=2,_=8,k=9,C=286,S=30,O=19,E=2*C+1,A=15,I=3,P=258,W=P+I+1,j=42,z=113,w=1,R=2,q=3,L=4;function B(b,Y){return b.msg=d[Y],Y}function J(b){return(b<<1)-(4<b?9:0)}function se(b){for(var Y=b.length;0<=--Y;)b[Y]=0}function Z(b){var Y=b.state,H=Y.pending;H>b.avail_out&&(H=b.avail_out),H!==0&&(i.arraySet(b.output,Y.pending_buf,Y.pending_out,H,b.next_out),b.next_out+=H,Y.pending_out+=H,b.total_out+=H,b.avail_out-=H,Y.pending-=H,Y.pending===0&&(Y.pending_out=0))}function U(b,Y){l._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,Y),b.block_start=b.strstart,Z(b.strm)}function te(b,Y){b.pending_buf[b.pending++]=Y}function ee(b,Y){b.pending_buf[b.pending++]=Y>>>8&255,b.pending_buf[b.pending++]=255&Y}function K(b,Y){var H,T,N=b.max_chain_length,D=b.strstart,F=b.prev_length,V=b.nice_match,M=b.strstart>b.w_size-W?b.strstart-(b.w_size-W):0,Q=b.window,oe=b.w_mask,re=b.prev,me=b.strstart+P,Ae=Q[D+F-1],Ce=Q[D+F];b.prev_length>=b.good_match&&(N>>=2),V>b.lookahead&&(V=b.lookahead);do if(Q[(H=Y)+F]===Ce&&Q[H+F-1]===Ae&&Q[H]===Q[D]&&Q[++H]===Q[D+1]){D+=2,H++;do;while(Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&Q[++D]===Q[++H]&&D<me);if(T=P-(me-D),D=me-P,F<T){if(b.match_start=Y,V<=(F=T))break;Ae=Q[D+F-1],Ce=Q[D+F]}}while((Y=re[Y&oe])>M&&--N!=0);return F<=b.lookahead?F:b.lookahead}function ue(b){var Y,H,T,N,D,F,V,M,Q,oe,re=b.w_size;do{if(N=b.window_size-b.lookahead-b.strstart,b.strstart>=re+(re-W)){for(i.arraySet(b.window,b.window,re,re,0),b.match_start-=re,b.strstart-=re,b.block_start-=re,Y=H=b.hash_size;T=b.head[--Y],b.head[Y]=re<=T?T-re:0,--H;);for(Y=H=re;T=b.prev[--Y],b.prev[Y]=re<=T?T-re:0,--H;);N+=re}if(b.strm.avail_in===0)break;if(F=b.strm,V=b.window,M=b.strstart+b.lookahead,Q=N,oe=void 0,oe=F.avail_in,Q<oe&&(oe=Q),H=oe===0?0:(F.avail_in-=oe,i.arraySet(V,F.input,F.next_in,oe,M),F.state.wrap===1?F.adler=c(F.adler,V,oe,M):F.state.wrap===2&&(F.adler=u(F.adler,V,oe,M)),F.next_in+=oe,F.total_in+=oe,oe),b.lookahead+=H,b.lookahead+b.insert>=I)for(D=b.strstart-b.insert,b.ins_h=b.window[D],b.ins_h=(b.ins_h<<b.hash_shift^b.window[D+1])&b.hash_mask;b.insert&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[D+I-1])&b.hash_mask,b.prev[D&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=D,D++,b.insert--,!(b.lookahead+b.insert<I)););}while(b.lookahead<W&&b.strm.avail_in!==0)}function X(b,Y){for(var H,T;;){if(b.lookahead<W){if(ue(b),b.lookahead<W&&Y===h)return w;if(b.lookahead===0)break}if(H=0,b.lookahead>=I&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+I-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),H!==0&&b.strstart-H<=b.w_size-W&&(b.match_length=K(b,H)),b.match_length>=I)if(T=l._tr_tally(b,b.strstart-b.match_start,b.match_length-I),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=I){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+I-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart,--b.match_length!=0;);b.strstart++}else b.strstart+=b.match_length,b.match_length=0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else T=l._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(T&&(U(b,!1),b.strm.avail_out===0))return w}return b.insert=b.strstart<I-1?b.strstart:I-1,Y===m?(U(b,!0),b.strm.avail_out===0?q:L):b.last_lit&&(U(b,!1),b.strm.avail_out===0)?w:R}function ie(b,Y){for(var H,T,N;;){if(b.lookahead<W){if(ue(b),b.lookahead<W&&Y===h)return w;if(b.lookahead===0)break}if(H=0,b.lookahead>=I&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+I-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),b.prev_length=b.match_length,b.prev_match=b.match_start,b.match_length=I-1,H!==0&&b.prev_length<b.max_lazy_match&&b.strstart-H<=b.w_size-W&&(b.match_length=K(b,H),b.match_length<=5&&(b.strategy===1||b.match_length===I&&4096<b.strstart-b.match_start)&&(b.match_length=I-1)),b.prev_length>=I&&b.match_length<=b.prev_length){for(N=b.strstart+b.lookahead-I,T=l._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-I),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=N&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+I-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),--b.prev_length!=0;);if(b.match_available=0,b.match_length=I-1,b.strstart++,T&&(U(b,!1),b.strm.avail_out===0))return w}else if(b.match_available){if((T=l._tr_tally(b,0,b.window[b.strstart-1]))&&U(b,!1),b.strstart++,b.lookahead--,b.strm.avail_out===0)return w}else b.match_available=1,b.strstart++,b.lookahead--}return b.match_available&&(T=l._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0),b.insert=b.strstart<I-1?b.strstart:I-1,Y===m?(U(b,!0),b.strm.avail_out===0?q:L):b.last_lit&&(U(b,!1),b.strm.avail_out===0)?w:R}function ae(b,Y,H,T,N){this.good_length=b,this.max_lazy=Y,this.nice_length=H,this.max_chain=T,this.func=N}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*E),this.dyn_dtree=new i.Buf16(2*(2*S+1)),this.bl_tree=new i.Buf16(2*(2*O+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(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),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),se(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(b){var Y;return b&&b.state?(b.total_in=b.total_out=0,b.data_type=y,(Y=b.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?j:z,b.adler=Y.wrap===2?0:1,Y.last_flush=h,l._tr_init(Y),p):B(b,x)}function we(b){var Y=fe(b);return Y===p&&(function(H){H.window_size=2*H.w_size,se(H.head),H.max_lazy_match=s[H.level].max_lazy,H.good_match=s[H.level].good_length,H.nice_match=s[H.level].nice_length,H.max_chain_length=s[H.level].max_chain,H.strstart=0,H.block_start=0,H.lookahead=0,H.insert=0,H.match_length=H.prev_length=I-1,H.match_available=0,H.ins_h=0})(b.state),Y}function Te(b,Y,H,T,N,D){if(!b)return x;var F=1;if(Y===f&&(Y=6),T<0?(F=0,T=-T):15<T&&(F=2,T-=16),N<1||k<N||H!==_||T<8||15<T||Y<0||9<Y||D<0||g<D)return B(b,x);T===8&&(T=9);var V=new pe;return(b.state=V).strm=b,V.wrap=F,V.gzhead=null,V.w_bits=T,V.w_size=1<<V.w_bits,V.w_mask=V.w_size-1,V.hash_bits=N+7,V.hash_size=1<<V.hash_bits,V.hash_mask=V.hash_size-1,V.hash_shift=~~((V.hash_bits+I-1)/I),V.window=new i.Buf8(2*V.w_size),V.head=new i.Buf16(V.hash_size),V.prev=new i.Buf16(V.w_size),V.lit_bufsize=1<<N+6,V.pending_buf_size=4*V.lit_bufsize,V.pending_buf=new i.Buf8(V.pending_buf_size),V.d_buf=1*V.lit_bufsize,V.l_buf=3*V.lit_bufsize,V.level=Y,V.strategy=D,V.method=H,we(b)}s=[new ae(0,0,0,0,function(b,Y){var H=65535;for(H>b.pending_buf_size-5&&(H=b.pending_buf_size-5);;){if(b.lookahead<=1){if(ue(b),b.lookahead===0&&Y===h)return w;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var T=b.block_start+H;if((b.strstart===0||b.strstart>=T)&&(b.lookahead=b.strstart-T,b.strstart=T,U(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-W&&(U(b,!1),b.strm.avail_out===0))return w}return b.insert=0,Y===m?(U(b,!0),b.strm.avail_out===0?q:L):(b.strstart>b.block_start&&(U(b,!1),b.strm.avail_out),w)}),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(b,Y){return Te(b,Y,_,15,8,0)},o.deflateInit2=Te,o.deflateReset=we,o.deflateResetKeep=fe,o.deflateSetHeader=function(b,Y){return b&&b.state?b.state.wrap!==2?x:(b.state.gzhead=Y,p):x},o.deflate=function(b,Y){var H,T,N,D;if(!b||!b.state||5<Y||Y<0)return b?B(b,x):x;if(T=b.state,!b.output||!b.input&&b.avail_in!==0||T.status===666&&Y!==m)return B(b,b.avail_out===0?-5:x);if(T.strm=b,H=T.last_flush,T.last_flush=Y,T.status===j)if(T.wrap===2)b.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&&(b.adler=u(b.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=z);else{var F=_+(T.w_bits-8<<4)<<8;F|=(2<=T.strategy||T.level<2?0:T.level<6?1:T.level===6?2:3)<<6,T.strstart!==0&&(F|=32),F+=31-F%31,T.status=z,ee(T,F),T.strstart!==0&&(ee(T,b.adler>>>16),ee(T,65535&b.adler)),b.adler=1}if(T.status===69)if(T.gzhead.extra){for(N=T.pending;T.gzindex<(65535&T.gzhead.extra.length)&&(T.pending!==T.pending_buf_size||(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),Z(b),N=T.pending,T.pending!==T.pending_buf_size));)te(T,255&T.gzhead.extra[T.gzindex]),T.gzindex++;T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),T.gzindex===T.gzhead.extra.length&&(T.gzindex=0,T.status=73)}else T.status=73;if(T.status===73)if(T.gzhead.name){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),Z(b),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.name.length?255&T.gzhead.name.charCodeAt(T.gzindex++):0,te(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.gzindex=0,T.status=91)}else T.status=91;if(T.status===91)if(T.gzhead.comment){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),Z(b),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.comment.length?255&T.gzhead.comment.charCodeAt(T.gzindex++):0,te(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(b.adler=u(b.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.status=103)}else T.status=103;if(T.status===103&&(T.gzhead.hcrc?(T.pending+2>T.pending_buf_size&&Z(b),T.pending+2<=T.pending_buf_size&&(te(T,255&b.adler),te(T,b.adler>>8&255),b.adler=0,T.status=z)):T.status=z),T.pending!==0){if(Z(b),b.avail_out===0)return T.last_flush=-1,p}else if(b.avail_in===0&&J(Y)<=J(H)&&Y!==m)return B(b,-5);if(T.status===666&&b.avail_in!==0)return B(b,-5);if(b.avail_in!==0||T.lookahead!==0||Y!==h&&T.status!==666){var V=T.strategy===2?(function(M,Q){for(var oe;;){if(M.lookahead===0&&(ue(M),M.lookahead===0)){if(Q===h)return w;break}if(M.match_length=0,oe=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,oe&&(U(M,!1),M.strm.avail_out===0))return w}return M.insert=0,Q===m?(U(M,!0),M.strm.avail_out===0?q:L):M.last_lit&&(U(M,!1),M.strm.avail_out===0)?w:R})(T,Y):T.strategy===3?(function(M,Q){for(var oe,re,me,Ae,Ce=M.window;;){if(M.lookahead<=P){if(ue(M),M.lookahead<=P&&Q===h)return w;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=I&&0<M.strstart&&(re=Ce[me=M.strstart-1])===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]){Ae=M.strstart+P;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);M.match_length=P-(Ae-me),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=I?(oe=l._tr_tally(M,1,M.match_length-I),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(oe=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),oe&&(U(M,!1),M.strm.avail_out===0))return w}return M.insert=0,Q===m?(U(M,!0),M.strm.avail_out===0?q:L):M.last_lit&&(U(M,!1),M.strm.avail_out===0)?w:R})(T,Y):s[T.level].func(T,Y);if(V!==q&&V!==L||(T.status=666),V===w||V===q)return b.avail_out===0&&(T.last_flush=-1),p;if(V===R&&(Y===1?l._tr_align(T):Y!==5&&(l._tr_stored_block(T,0,0,!1),Y===3&&(se(T.head),T.lookahead===0&&(T.strstart=0,T.block_start=0,T.insert=0))),Z(b),b.avail_out===0))return T.last_flush=-1,p}return Y!==m?p:T.wrap<=0?1:(T.wrap===2?(te(T,255&b.adler),te(T,b.adler>>8&255),te(T,b.adler>>16&255),te(T,b.adler>>24&255),te(T,255&b.total_in),te(T,b.total_in>>8&255),te(T,b.total_in>>16&255),te(T,b.total_in>>24&255)):(ee(T,b.adler>>>16),ee(T,65535&b.adler)),Z(b),0<T.wrap&&(T.wrap=-T.wrap),T.pending!==0?p:1)},o.deflateEnd=function(b){var Y;return b&&b.state?(Y=b.state.status)!==j&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==z&&Y!==666?B(b,x):(b.state=null,Y===z?B(b,-3):p):x},o.deflateSetDictionary=function(b,Y){var H,T,N,D,F,V,M,Q,oe=Y.length;if(!b||!b.state||(D=(H=b.state).wrap)===2||D===1&&H.status!==j||H.lookahead)return x;for(D===1&&(b.adler=c(b.adler,Y,oe,0)),H.wrap=0,oe>=H.w_size&&(D===0&&(se(H.head),H.strstart=0,H.block_start=0,H.insert=0),Q=new i.Buf8(H.w_size),i.arraySet(Q,Y,oe-H.w_size,H.w_size,0),Y=Q,oe=H.w_size),F=b.avail_in,V=b.next_in,M=b.input,b.avail_in=oe,b.next_in=0,b.input=Y,ue(H);H.lookahead>=I;){for(T=H.strstart,N=H.lookahead-(I-1);H.ins_h=(H.ins_h<<H.hash_shift^H.window[T+I-1])&H.hash_mask,H.prev[T&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=T,T++,--N;);H.strstart=T,H.lookahead=I-1,ue(H)}return H.strstart+=H.lookahead,H.block_start=H.strstart,H.insert=H.lookahead,H.lookahead=0,H.match_length=H.prev_length=I-1,H.match_available=0,b.next_in=V,b.input=M,b.avail_in=F,H.wrap=D,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var l,c,u,d,h,m,p,x,f,g,y,_,k,C,S,O,E,A,I,P,W,j,z,w,R;l=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,R=s.output,h=d-(i-s.avail_out),m=d+(s.avail_out-257),p=l.dmax,x=l.wsize,f=l.whave,g=l.wnext,y=l.window,_=l.hold,k=l.bits,C=l.lencode,S=l.distcode,O=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{k<15&&(_+=w[c++]<<k,k+=8,_+=w[c++]<<k,k+=8),A=C[_&O];t:for(;;){if(_>>>=I=A>>>24,k-=I,(I=A>>>16&255)===0)R[d++]=65535&A;else{if(!(16&I)){if((64&I)==0){A=C[(65535&A)+(_&(1<<I)-1)];continue t}if(32&I){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}P=65535&A,(I&=15)&&(k<I&&(_+=w[c++]<<k,k+=8),P+=_&(1<<I)-1,_>>>=I,k-=I),k<15&&(_+=w[c++]<<k,k+=8,_+=w[c++]<<k,k+=8),A=S[_&E];n:for(;;){if(_>>>=I=A>>>24,k-=I,!(16&(I=A>>>16&255))){if((64&I)==0){A=S[(65535&A)+(_&(1<<I)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(W=65535&A,k<(I&=15)&&(_+=w[c++]<<k,(k+=8)<I&&(_+=w[c++]<<k,k+=8)),p<(W+=_&(1<<I)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=I,k-=I,(I=d-h)<W){if(f<(I=W-I)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(z=y,(j=0)===g){if(j+=x-I,I<P){for(P-=I;R[d++]=y[j++],--I;);j=d-W,z=R}}else if(g<I){if(j+=x+g-I,(I-=g)<P){for(P-=I;R[d++]=y[j++],--I;);if(j=0,g<P){for(P-=I=g;R[d++]=y[j++],--I;);j=d-W,z=R}}}else if(j+=g-I,I<P){for(P-=I;R[d++]=y[j++],--I;);j=d-W,z=R}for(;2<P;)R[d++]=z[j++],R[d++]=z[j++],R[d++]=z[j++],P-=3;P&&(R[d++]=z[j++],1<P&&(R[d++]=z[j++]))}else{for(j=d-W;R[d++]=R[j++],R[d++]=R[j++],R[d++]=R[j++],2<(P-=3););P&&(R[d++]=R[j++],1<P&&(R[d++]=R[j++]))}break}}break}}while(c<u&&d<m);c-=P=k>>3,_&=(1<<(k-=P<<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,h=2,m=0,p=-2,x=1,f=852,g=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 z;return j&&j.state?(z=j.state,j.total_in=j.total_out=z.total=0,j.msg="",z.wrap&&(j.adler=1&z.wrap),z.mode=x,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new s.Buf32(f),z.distcode=z.distdyn=new s.Buf32(g),z.sane=1,z.back=-1,m):p}function C(j){var z;return j&&j.state?((z=j.state).wsize=0,z.whave=0,z.wnext=0,k(j)):p}function S(j,z){var w,R;return j&&j.state?(R=j.state,z<0?(w=0,z=-z):(w=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15<z)?p:(R.window!==null&&R.wbits!==z&&(R.window=null),R.wrap=w,R.wbits=z,C(j))):p}function O(j,z){var w,R;return j?(R=new _,(j.state=R).window=null,(w=S(j,z))!==m&&(j.state=null),w):p}var E,A,I=!0;function P(j){if(I){var z;for(E=new s.Buf32(512),A=new s.Buf32(32),z=0;z<144;)j.lens[z++]=8;for(;z<256;)j.lens[z++]=9;for(;z<280;)j.lens[z++]=7;for(;z<288;)j.lens[z++]=8;for(u(d,j.lens,0,288,E,0,j.work,{bits:9}),z=0;z<32;)j.lens[z++]=5;u(h,j.lens,0,32,A,0,j.work,{bits:5}),I=!1}j.lencode=E,j.lenbits=9,j.distcode=A,j.distbits=5}function W(j,z,w,R){var q,L=j.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new s.Buf8(L.wsize)),R>=L.wsize?(s.arraySet(L.window,z,w-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(R<(q=L.wsize-L.wnext)&&(q=R),s.arraySet(L.window,z,w-R,q,L.wnext),(R-=q)?(s.arraySet(L.window,z,w-R,R,0),L.wnext=R,L.whave=L.wsize):(L.wnext+=q,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=q))),0}o.inflateReset=C,o.inflateReset2=S,o.inflateResetKeep=k,o.inflateInit=function(j){return O(j,15)},o.inflateInit2=O,o.inflate=function(j,z){var w,R,q,L,B,J,se,Z,U,te,ee,K,ue,X,ie,ae,pe,fe,we,Te,b,Y,H,T,N=0,D=new s.Buf8(4),F=[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 p;(w=j.state).mode===12&&(w.mode=13),B=j.next_out,q=j.output,se=j.avail_out,L=j.next_in,R=j.input,J=j.avail_in,Z=w.hold,U=w.bits,te=J,ee=se,Y=m;e:for(;;)switch(w.mode){case x:if(w.wrap===0){w.mode=13;break}for(;U<16;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(2&w.wrap&&Z===35615){D[w.check=0]=255&Z,D[1]=Z>>>8&255,w.check=l(w.check,D,2,0),U=Z=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&Z)<<8)+(Z>>8))%31){j.msg="incorrect header check",w.mode=30;break}if((15&Z)!=8){j.msg="unknown compression method",w.mode=30;break}if(U-=4,b=8+(15&(Z>>>=4)),w.wbits===0)w.wbits=b;else if(b>w.wbits){j.msg="invalid window size",w.mode=30;break}w.dmax=1<<b,j.adler=w.check=1,w.mode=512&Z?10:12,U=Z=0;break;case 2:for(;U<16;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(w.flags=Z,(255&w.flags)!=8){j.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){j.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=Z>>8&1),512&w.flags&&(D[0]=255&Z,D[1]=Z>>>8&255,w.check=l(w.check,D,2,0)),U=Z=0,w.mode=3;case 3:for(;U<32;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.head&&(w.head.time=Z),512&w.flags&&(D[0]=255&Z,D[1]=Z>>>8&255,D[2]=Z>>>16&255,D[3]=Z>>>24&255,w.check=l(w.check,D,4,0)),U=Z=0,w.mode=4;case 4:for(;U<16;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.head&&(w.head.xflags=255&Z,w.head.os=Z>>8),512&w.flags&&(D[0]=255&Z,D[1]=Z>>>8&255,w.check=l(w.check,D,2,0)),U=Z=0,w.mode=5;case 5:if(1024&w.flags){for(;U<16;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.length=Z,w.head&&(w.head.extra_len=Z),512&w.flags&&(D[0]=255&Z,D[1]=Z>>>8&255,w.check=l(w.check,D,2,0)),U=Z=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(J<(K=w.length)&&(K=J),K&&(w.head&&(b=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,R,L,K,b)),512&w.flags&&(w.check=l(w.check,R,K,L)),J-=K,L+=K,w.length-=K),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(J===0)break e;for(K=0;b=R[L+K++],w.head&&b&&w.length<65536&&(w.head.name+=String.fromCharCode(b)),b&&K<J;);if(512&w.flags&&(w.check=l(w.check,R,K,L)),J-=K,L+=K,b)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(J===0)break e;for(K=0;b=R[L+K++],w.head&&b&&w.length<65536&&(w.head.comment+=String.fromCharCode(b)),b&&K<J;);if(512&w.flags&&(w.check=l(w.check,R,K,L)),J-=K,L+=K,b)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;U<16;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(Z!==(65535&w.check)){j.msg="header crc mismatch",w.mode=30;break}U=Z=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),j.adler=w.check=0,w.mode=12;break;case 10:for(;U<32;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}j.adler=w.check=y(Z),U=Z=0,w.mode=11;case 11:if(w.havedict===0)return j.next_out=B,j.avail_out=se,j.next_in=L,j.avail_in=J,w.hold=Z,w.bits=U,2;j.adler=w.check=1,w.mode=12;case 12:if(z===5||z===6)break e;case 13:if(w.last){Z>>>=7&U,U-=7&U,w.mode=27;break}for(;U<3;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}switch(w.last=1&Z,U-=1,3&(Z>>>=1)){case 0:w.mode=14;break;case 1:if(P(w),w.mode=20,z!==6)break;Z>>>=2,U-=2;break e;case 2:w.mode=17;break;case 3:j.msg="invalid block type",w.mode=30}Z>>>=2,U-=2;break;case 14:for(Z>>>=7&U,U-=7&U;U<32;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if((65535&Z)!=(Z>>>16^65535)){j.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&Z,U=Z=0,w.mode=15,z===6)break e;case 15:w.mode=16;case 16:if(K=w.length){if(J<K&&(K=J),se<K&&(K=se),K===0)break e;s.arraySet(q,R,L,K,B),J-=K,L+=K,se-=K,B+=K,w.length-=K;break}w.mode=12;break;case 17:for(;U<14;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(w.nlen=257+(31&Z),Z>>>=5,U-=5,w.ndist=1+(31&Z),Z>>>=5,U-=5,w.ncode=4+(15&Z),Z>>>=4,U-=4,286<w.nlen||30<w.ndist){j.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;U<3;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.lens[F[w.have++]]=7&Z,Z>>>=3,U-=3}for(;w.have<19;)w.lens[F[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,H={bits:w.lenbits},Y=u(0,w.lens,0,19,w.lencode,0,w.work,H),w.lenbits=H.bits,Y){j.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;ae=(N=w.lencode[Z&(1<<w.lenbits)-1])>>>16&255,pe=65535&N,!((ie=N>>>24)<=U);){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(pe<16)Z>>>=ie,U-=ie,w.lens[w.have++]=pe;else{if(pe===16){for(T=ie+2;U<T;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(Z>>>=ie,U-=ie,w.have===0){j.msg="invalid bit length repeat",w.mode=30;break}b=w.lens[w.have-1],K=3+(3&Z),Z>>>=2,U-=2}else if(pe===17){for(T=ie+3;U<T;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}U-=ie,b=0,K=3+(7&(Z>>>=ie)),Z>>>=3,U-=3}else{for(T=ie+7;U<T;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}U-=ie,b=0,K=11+(127&(Z>>>=ie)),Z>>>=7,U-=7}if(w.have+K>w.nlen+w.ndist){j.msg="invalid bit length repeat",w.mode=30;break}for(;K--;)w.lens[w.have++]=b}}if(w.mode===30)break;if(w.lens[256]===0){j.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,H={bits:w.lenbits},Y=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,H),w.lenbits=H.bits,Y){j.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,H={bits:w.distbits},Y=u(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,H),w.distbits=H.bits,Y){j.msg="invalid distances set",w.mode=30;break}if(w.mode=20,z===6)break e;case 20:w.mode=21;case 21:if(6<=J&&258<=se){j.next_out=B,j.avail_out=se,j.next_in=L,j.avail_in=J,w.hold=Z,w.bits=U,c(j,ee),B=j.next_out,q=j.output,se=j.avail_out,L=j.next_in,R=j.input,J=j.avail_in,Z=w.hold,U=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;ae=(N=w.lencode[Z&(1<<w.lenbits)-1])>>>16&255,pe=65535&N,!((ie=N>>>24)<=U);){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(ae&&(240&ae)==0){for(fe=ie,we=ae,Te=pe;ae=(N=w.lencode[Te+((Z&(1<<fe+we)-1)>>fe)])>>>16&255,pe=65535&N,!(fe+(ie=N>>>24)<=U);){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}Z>>>=fe,U-=fe,w.back+=fe}if(Z>>>=ie,U-=ie,w.back+=ie,w.length=pe,ae===0){w.mode=26;break}if(32&ae){w.back=-1,w.mode=12;break}if(64&ae){j.msg="invalid literal/length code",w.mode=30;break}w.extra=15&ae,w.mode=22;case 22:if(w.extra){for(T=w.extra;U<T;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.length+=Z&(1<<w.extra)-1,Z>>>=w.extra,U-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;ae=(N=w.distcode[Z&(1<<w.distbits)-1])>>>16&255,pe=65535&N,!((ie=N>>>24)<=U);){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if((240&ae)==0){for(fe=ie,we=ae,Te=pe;ae=(N=w.distcode[Te+((Z&(1<<fe+we)-1)>>fe)])>>>16&255,pe=65535&N,!(fe+(ie=N>>>24)<=U);){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}Z>>>=fe,U-=fe,w.back+=fe}if(Z>>>=ie,U-=ie,w.back+=ie,64&ae){j.msg="invalid distance code",w.mode=30;break}w.offset=pe,w.extra=15&ae,w.mode=24;case 24:if(w.extra){for(T=w.extra;U<T;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}w.offset+=Z&(1<<w.extra)-1,Z>>>=w.extra,U-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){j.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(se===0)break e;if(K=ee-se,w.offset>K){if((K=w.offset-K)>w.whave&&w.sane){j.msg="invalid distance too far back",w.mode=30;break}ue=K>w.wnext?(K-=w.wnext,w.wsize-K):w.wnext-K,K>w.length&&(K=w.length),X=w.window}else X=q,ue=B-w.offset,K=w.length;for(se<K&&(K=se),se-=K,w.length-=K;q[B++]=X[ue++],--K;);w.length===0&&(w.mode=21);break;case 26:if(se===0)break e;q[B++]=w.length,se--,w.mode=21;break;case 27:if(w.wrap){for(;U<32;){if(J===0)break e;J--,Z|=R[L++]<<U,U+=8}if(ee-=se,j.total_out+=ee,w.total+=ee,ee&&(j.adler=w.check=w.flags?l(w.check,q,ee,B-ee):i(w.check,q,ee,B-ee)),ee=se,(w.flags?Z:y(Z))!==w.check){j.msg="incorrect data check",w.mode=30;break}U=Z=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;U<32;){if(J===0)break e;J--,Z+=R[L++]<<U,U+=8}if(Z!==(4294967295&w.total)){j.msg="incorrect length check",w.mode=30;break}U=Z=0}w.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return p}return j.next_out=B,j.avail_out=se,j.next_in=L,j.avail_in=J,w.hold=Z,w.bits=U,(w.wsize||ee!==j.avail_out&&w.mode<30&&(w.mode<27||z!==4))&&W(j,j.output,j.next_out,ee-j.avail_out)?(w.mode=31,-4):(te-=j.avail_in,ee-=j.avail_out,j.total_in+=te,j.total_out+=ee,w.total+=ee,w.wrap&&ee&&(j.adler=w.check=w.flags?l(w.check,q,ee,j.next_out-ee):i(w.check,q,ee,j.next_out-ee)),j.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(te==0&&ee===0||z===4)&&Y===m&&(Y=-5),Y)},o.inflateEnd=function(j){if(!j||!j.state)return p;var z=j.state;return z.window&&(z.window=null),j.state=null,m},o.inflateGetHeader=function(j,z){var w;return j&&j.state?(2&(w=j.state).wrap)==0?p:((w.head=z).done=!1,m):p},o.inflateSetDictionary=function(j,z){var w,R=z.length;return j&&j.state?(w=j.state).wrap!==0&&w.mode!==11?p:w.mode===11&&i(1,z,R,0)!==w.check?-3:W(j,z,R,R)?(w.mode=31,-4):(w.havedict=1,m):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,h,m,p,x,f,g,y){var _,k,C,S,O,E,A,I,P,W=y.bits,j=0,z=0,w=0,R=0,q=0,L=0,B=0,J=0,se=0,Z=0,U=null,te=0,ee=new s.Buf16(16),K=new s.Buf16(16),ue=null,X=0;for(j=0;j<=15;j++)ee[j]=0;for(z=0;z<p;z++)ee[h[m+z]]++;for(q=W,R=15;1<=R&&ee[R]===0;R--);if(R<q&&(q=R),R===0)return x[f++]=20971520,x[f++]=20971520,y.bits=1,0;for(w=1;w<R&&ee[w]===0;w++);for(q<w&&(q=w),j=J=1;j<=15;j++)if(J<<=1,(J-=ee[j])<0)return-1;if(0<J&&(d===0||R!==1))return-1;for(K[1]=0,j=1;j<15;j++)K[j+1]=K[j]+ee[j];for(z=0;z<p;z++)h[m+z]!==0&&(g[K[h[m+z]]++]=z);if(E=d===0?(U=ue=g,19):d===1?(U=i,te-=257,ue=l,X-=257,256):(U=c,ue=u,-1),j=w,O=f,B=z=Z=0,C=-1,S=(se=1<<(L=q))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(A=j-B,P=g[z]<E?(I=0,g[z]):g[z]>E?(I=ue[X+g[z]],U[te+g[z]]):(I=96,0),_=1<<j-B,w=k=1<<L;x[O+(Z>>B)+(k-=_)]=A<<24|I<<16|P|0,k!==0;);for(_=1<<j-1;Z&_;)_>>=1;if(_!==0?(Z&=_-1,Z+=_):Z=0,z++,--ee[j]==0){if(j===R)break;j=h[m+g[z]]}if(q<j&&(Z&S)!==C){for(B===0&&(B=q),O+=w,J=1<<(L=j-B);L+B<R&&!((J-=ee[L+B])<=0);)L++,J<<=1;if(se+=1<<L,d===1&&852<se||d===2&&592<se)return 1;x[C=Z&S]=q<<24|L<<16|O-f|0}}return Z!==0&&(x[O+Z]=j-B<<24|64<<16|0),y.bits=q,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(N){for(var D=N.length;0<=--D;)N[D]=0}var u=0,d=29,h=256,m=h+1+d,p=30,x=19,f=2*m+1,g=15,y=16,_=7,k=256,C=16,S=17,O=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],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],I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=new Array(2*(m+2));c(W);var j=new Array(2*p);c(j);var z=new Array(512);c(z);var w=new Array(256);c(w);var R=new Array(d);c(R);var q,L,B,J=new Array(p);function se(N,D,F,V,M){this.static_tree=N,this.extra_bits=D,this.extra_base=F,this.elems=V,this.max_length=M,this.has_stree=N&&N.length}function Z(N,D){this.dyn_tree=N,this.max_code=0,this.stat_desc=D}function U(N){return N<256?z[N]:z[256+(N>>>7)]}function te(N,D){N.pending_buf[N.pending++]=255&D,N.pending_buf[N.pending++]=D>>>8&255}function ee(N,D,F){N.bi_valid>y-F?(N.bi_buf|=D<<N.bi_valid&65535,te(N,N.bi_buf),N.bi_buf=D>>y-N.bi_valid,N.bi_valid+=F-y):(N.bi_buf|=D<<N.bi_valid&65535,N.bi_valid+=F)}function K(N,D,F){ee(N,F[2*D],F[2*D+1])}function ue(N,D){for(var F=0;F|=1&N,N>>>=1,F<<=1,0<--D;);return F>>>1}function X(N,D,F){var V,M,Q=new Array(g+1),oe=0;for(V=1;V<=g;V++)Q[V]=oe=oe+F[V-1]<<1;for(M=0;M<=D;M++){var re=N[2*M+1];re!==0&&(N[2*M]=ue(Q[re]++,re))}}function ie(N){var D;for(D=0;D<m;D++)N.dyn_ltree[2*D]=0;for(D=0;D<p;D++)N.dyn_dtree[2*D]=0;for(D=0;D<x;D++)N.bl_tree[2*D]=0;N.dyn_ltree[2*k]=1,N.opt_len=N.static_len=0,N.last_lit=N.matches=0}function ae(N){8<N.bi_valid?te(N,N.bi_buf):0<N.bi_valid&&(N.pending_buf[N.pending++]=N.bi_buf),N.bi_buf=0,N.bi_valid=0}function pe(N,D,F,V){var M=2*D,Q=2*F;return N[M]<N[Q]||N[M]===N[Q]&&V[D]<=V[F]}function fe(N,D,F){for(var V=N.heap[F],M=F<<1;M<=N.heap_len&&(M<N.heap_len&&pe(D,N.heap[M+1],N.heap[M],N.depth)&&M++,!pe(D,V,N.heap[M],N.depth));)N.heap[F]=N.heap[M],F=M,M<<=1;N.heap[F]=V}function we(N,D,F){var V,M,Q,oe,re=0;if(N.last_lit!==0)for(;V=N.pending_buf[N.d_buf+2*re]<<8|N.pending_buf[N.d_buf+2*re+1],M=N.pending_buf[N.l_buf+re],re++,V===0?K(N,M,D):(K(N,(Q=w[M])+h+1,D),(oe=E[Q])!==0&&ee(N,M-=R[Q],oe),K(N,Q=U(--V),F),(oe=A[Q])!==0&&ee(N,V-=J[Q],oe)),re<N.last_lit;);K(N,k,D)}function Te(N,D){var F,V,M,Q=D.dyn_tree,oe=D.stat_desc.static_tree,re=D.stat_desc.has_stree,me=D.stat_desc.elems,Ae=-1;for(N.heap_len=0,N.heap_max=f,F=0;F<me;F++)Q[2*F]!==0?(N.heap[++N.heap_len]=Ae=F,N.depth[F]=0):Q[2*F+1]=0;for(;N.heap_len<2;)Q[2*(M=N.heap[++N.heap_len]=Ae<2?++Ae:0)]=1,N.depth[M]=0,N.opt_len--,re&&(N.static_len-=oe[2*M+1]);for(D.max_code=Ae,F=N.heap_len>>1;1<=F;F--)fe(N,Q,F);for(M=me;F=N.heap[1],N.heap[1]=N.heap[N.heap_len--],fe(N,Q,1),V=N.heap[1],N.heap[--N.heap_max]=F,N.heap[--N.heap_max]=V,Q[2*M]=Q[2*F]+Q[2*V],N.depth[M]=(N.depth[F]>=N.depth[V]?N.depth[F]:N.depth[V])+1,Q[2*F+1]=Q[2*V+1]=M,N.heap[1]=M++,fe(N,Q,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],(function(Ce,Ge){var yn,ot,bn,De,Vn,Xr,ut=Ge.dyn_tree,Ms=Ge.max_code,Gu=Ge.stat_desc.static_tree,Yu=Ge.stat_desc.has_stree,Xu=Ge.stat_desc.extra_bits,Ds=Ge.stat_desc.extra_base,wn=Ge.stat_desc.max_length,Hn=0;for(De=0;De<=g;De++)Ce.bl_count[De]=0;for(ut[2*Ce.heap[Ce.heap_max]+1]=0,yn=Ce.heap_max+1;yn<f;yn++)wn<(De=ut[2*ut[2*(ot=Ce.heap[yn])+1]+1]+1)&&(De=wn,Hn++),ut[2*ot+1]=De,Ms<ot||(Ce.bl_count[De]++,Vn=0,Ds<=ot&&(Vn=Xu[ot-Ds]),Xr=ut[2*ot],Ce.opt_len+=Xr*(De+Vn),Yu&&(Ce.static_len+=Xr*(Gu[2*ot+1]+Vn)));if(Hn!==0){do{for(De=wn-1;Ce.bl_count[De]===0;)De--;Ce.bl_count[De]--,Ce.bl_count[De+1]+=2,Ce.bl_count[wn]--,Hn-=2}while(0<Hn);for(De=wn;De!==0;De--)for(ot=Ce.bl_count[De];ot!==0;)Ms<(bn=Ce.heap[--yn])||(ut[2*bn+1]!==De&&(Ce.opt_len+=(De-ut[2*bn+1])*ut[2*bn],ut[2*bn+1]=De),ot--)}})(N,D),X(Q,Ae,N.bl_count)}function b(N,D,F){var V,M,Q=-1,oe=D[1],re=0,me=7,Ae=4;for(oe===0&&(me=138,Ae=3),D[2*(F+1)+1]=65535,V=0;V<=F;V++)M=oe,oe=D[2*(V+1)+1],++re<me&&M===oe||(re<Ae?N.bl_tree[2*M]+=re:M!==0?(M!==Q&&N.bl_tree[2*M]++,N.bl_tree[2*C]++):re<=10?N.bl_tree[2*S]++:N.bl_tree[2*O]++,Q=M,Ae=(re=0)===oe?(me=138,3):M===oe?(me=6,3):(me=7,4))}function Y(N,D,F){var V,M,Q=-1,oe=D[1],re=0,me=7,Ae=4;for(oe===0&&(me=138,Ae=3),V=0;V<=F;V++)if(M=oe,oe=D[2*(V+1)+1],!(++re<me&&M===oe)){if(re<Ae)for(;K(N,M,N.bl_tree),--re!=0;);else M!==0?(M!==Q&&(K(N,M,N.bl_tree),re--),K(N,C,N.bl_tree),ee(N,re-3,2)):re<=10?(K(N,S,N.bl_tree),ee(N,re-3,3)):(K(N,O,N.bl_tree),ee(N,re-11,7));Q=M,Ae=(re=0)===oe?(me=138,3):M===oe?(me=6,3):(me=7,4)}}c(J);var H=!1;function T(N,D,F,V){ee(N,(u<<1)+(V?1:0),3),(function(M,Q,oe,re){ae(M),te(M,oe),te(M,~oe),s.arraySet(M.pending_buf,M.window,Q,oe,M.pending),M.pending+=oe})(N,D,F)}o._tr_init=function(N){H||((function(){var D,F,V,M,Q,oe=new Array(g+1);for(M=V=0;M<d-1;M++)for(R[M]=V,D=0;D<1<<E[M];D++)w[V++]=M;for(w[V-1]=M,M=Q=0;M<16;M++)for(J[M]=Q,D=0;D<1<<A[M];D++)z[Q++]=M;for(Q>>=7;M<p;M++)for(J[M]=Q<<7,D=0;D<1<<A[M]-7;D++)z[256+Q++]=M;for(F=0;F<=g;F++)oe[F]=0;for(D=0;D<=143;)W[2*D+1]=8,D++,oe[8]++;for(;D<=255;)W[2*D+1]=9,D++,oe[9]++;for(;D<=279;)W[2*D+1]=7,D++,oe[7]++;for(;D<=287;)W[2*D+1]=8,D++,oe[8]++;for(X(W,m+1,oe),D=0;D<p;D++)j[2*D+1]=5,j[2*D]=ue(D,5);q=new se(W,E,h+1,m,g),L=new se(j,A,0,p,g),B=new se(new Array(0),I,0,x,_)})(),H=!0),N.l_desc=new Z(N.dyn_ltree,q),N.d_desc=new Z(N.dyn_dtree,L),N.bl_desc=new Z(N.bl_tree,B),N.bi_buf=0,N.bi_valid=0,ie(N)},o._tr_stored_block=T,o._tr_flush_block=function(N,D,F,V){var M,Q,oe=0;0<N.level?(N.strm.data_type===2&&(N.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<h;me++)if(re.dyn_ltree[2*me]!==0)return l;return i})(N)),Te(N,N.l_desc),Te(N,N.d_desc),oe=(function(re){var me;for(b(re,re.dyn_ltree,re.l_desc.max_code),b(re,re.dyn_dtree,re.d_desc.max_code),Te(re,re.bl_desc),me=x-1;3<=me&&re.bl_tree[2*P[me]+1]===0;me--);return re.opt_len+=3*(me+1)+5+5+4,me})(N),M=N.opt_len+3+7>>>3,(Q=N.static_len+3+7>>>3)<=M&&(M=Q)):M=Q=F+5,F+4<=M&&D!==-1?T(N,D,F,V):N.strategy===4||Q===M?(ee(N,2+(V?1:0),3),we(N,W,j)):(ee(N,4+(V?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*P[Ge]+1],3);Y(re,re.dyn_ltree,me-1),Y(re,re.dyn_dtree,Ae-1)})(N,N.l_desc.max_code+1,N.d_desc.max_code+1,oe+1),we(N,N.dyn_ltree,N.dyn_dtree)),ie(N),V&&ae(N)},o._tr_tally=function(N,D,F){return N.pending_buf[N.d_buf+2*N.last_lit]=D>>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&D,N.pending_buf[N.l_buf+N.last_lit]=255&F,N.last_lit++,D===0?N.dyn_ltree[2*F]++:(N.matches++,D--,N.dyn_ltree[2*(w[F]+h+1)]++,N.dyn_dtree[2*U(D)]++),N.last_lit===N.lit_bufsize-1},o._tr_align=function(N){ee(N,2,3),K(N,k,W),(function(D){D.bi_valid===16?(te(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)})(N)}},{"../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,h,m=1,p={},x=!1,f=i.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(i);g=g&&g.setTimeout?g: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}})()?(h="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(C){i.postMessage(h+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)},g.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),O=0;O<S.length;O++)S[O]=arguments[O+1];var E={callback:C,args:S};return p[m]=E,c(m),m++},g.clearImmediate=y}function y(C){delete p[C]}function _(C){if(x)setTimeout(_,0,C);else{var S=p[C];if(S){x=!0;try{(function(O){var E=O.callback,A=O.args;switch(A.length){case 0:E();break;case 1:E(A[0]);break;case 2:E(A[0],A[1]);break;case 3:E(A[0],A[1],A[2]);break;default:E.apply(l,A)}})(S)}finally{y(C),x=!1}}}}function k(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(h)===0&&_(+C.data.slice(h.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof qn<"u"?qn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(to)),to.exports}var s1=o1();const i1=Qu(s1);async function a1(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 l1(e){const t=new i1;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 a1(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 hl(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=hl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pl(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=hl(e))&&(r&&(r+=" "),r+=t);return r}const c1=(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},u1=(e,t)=>({classGroupId:e,validator:t}),ml=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),yr="-",ci=[],d1="arbitrary..",f1=e=>{const t=p1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return h1(i);const l=i.split(yr),c=l[0]===""&&l.length>1?1:0;return gl(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?c1(u,c):c:u||ci}return n[i]||ci}}},gl=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=gl(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(yr):e.slice(t).join(yr),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},h1=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?d1+r:void 0})(),p1=e=>{const{theme:t,classGroups:n}=e;return m1(n,t)},m1=(e,t)=>{const n=ml();for(const r in e){const o=e[r];cs(o,n,r,t)}return n},cs=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];g1(i,t,n,r)}},g1=(e,t,n,r)=>{if(typeof e=="string"){x1(e,t,n);return}if(typeof e=="function"){v1(e,t,n,r);return}y1(e,t,n,r)},x1=(e,t,n)=>{const r=e===""?t:xl(t,e);r.classGroupId=n},v1=(e,t,n,r)=>{if(b1(e)){cs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(u1(n,e))},y1=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];cs(c,xl(t,l),n,r)}},xl=(e,t)=>{let n=e;const r=t.split(yr),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=ml(),n.nextPart.set(i,l)),n=l}return n},b1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,w1=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)}}},Ao="!",ui=":",_1=[],di=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),k1=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 g=o[f];if(i===0&&l===0){if(g===ui){s.push(o.slice(c,f)),c=f+1;continue}if(g==="/"){u=f;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const h=s.length===0?o:o.slice(c);let m=h,p=!1;h.endsWith(Ao)?(m=h.slice(0,-1),p=!0):h.startsWith(Ao)&&(m=h.slice(1),p=!0);const x=u&&u>c?u-c:void 0;return di(s,p,m,x)};if(t){const o=t+ui,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):di(_1,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},C1=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}},S1=e=>({cache:w1(e.cacheSize),parseClassName:k1(e),sortModifiers:C1(e),...f1(e)}),j1=/\s+/,E1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(j1);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:m,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:f}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let g=!!f,y=r(g?x.substring(0,f):x);if(!y){if(!g){c=d+(c.length>0?" "+c:c);continue}if(y=r(x),!y){c=d+(c.length>0?" "+c:c);continue}g=!1}const _=m.length===0?"":m.length===1?m[0]:s(m).join(":"),k=p?_+Ao:_,C=k+y;if(i.indexOf(C)>-1)continue;i.push(C);const S=o(y,g);for(let O=0;O<S.length;++O){const E=S[O];i.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},N1=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=vl(n))&&(o&&(o+=" "),o+=r);return o},vl=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vl(e[r]))&&(n&&(n+=" "),n+=t);return n},T1=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,h)=>h(d),e());return n=S1(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=E1(c,n);return o(c,d),d};return s=i,(...c)=>s(N1(...c))},A1=[],Fe=e=>{const t=n=>n[e]||A1;return t.isThemeGetter=!0,t},yl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z1=/^\d+\/\d+$/,O1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I1=/\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$/,R1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ht=e=>z1.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),yt=e=>!!e&&Number.isInteger(Number(e)),no=e=>e.endsWith("%")&&be(e.slice(0,-1)),dt=e=>O1.test(e),D1=()=>!0,L1=e=>I1.test(e)&&!R1.test(e),wl=()=>!1,F1=e=>P1.test(e),$1=e=>M1.test(e),B1=e=>!le(e)&&!ce(e),U1=e=>hn(e,Cl,wl),le=e=>yl.test(e),zt=e=>hn(e,Sl,L1),ro=e=>hn(e,q1,be),fi=e=>hn(e,_l,wl),Z1=e=>hn(e,kl,$1),Xn=e=>hn(e,jl,F1),ce=e=>bl.test(e),_n=e=>pn(e,Sl),W1=e=>pn(e,J1),hi=e=>pn(e,_l),V1=e=>pn(e,Cl),H1=e=>pn(e,kl),Qn=e=>pn(e,jl,!0),hn=(e,t,n)=>{const r=yl.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pn=(e,t,n=!1)=>{const r=bl.exec(e);return r?r[1]?t(r[1]):n:!1},_l=e=>e==="position"||e==="percentage",kl=e=>e==="image"||e==="url",Cl=e=>e==="length"||e==="size"||e==="bg-size",Sl=e=>e==="length",q1=e=>e==="number",J1=e=>e==="family-name",jl=e=>e==="shadow",K1=()=>{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"),h=Fe("inset-shadow"),m=Fe("text-shadow"),p=Fe("drop-shadow"),x=Fe("blur"),f=Fe("perspective"),g=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],O=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],A=()=>[ce,le,c],I=()=>[Ht,"full","auto",...A()],P=()=>[yt,"none","subgrid",ce,le],W=()=>["auto",{span:["full",yt,ce,le]},yt,ce,le],j=()=>[yt,"auto",ce,le],z=()=>["auto","min","max","fr",ce,le],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...A()],L=()=>[Ht,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],B=()=>[e,ce,le],J=()=>[...C(),hi,fi,{position:[ce,le]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",V1,U1,{size:[ce,le]}],U=()=>[no,_n,zt],te=()=>["","none","full",u,ce,le],ee=()=>["",be,_n,zt],K=()=>["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,no,hi,fi],ie=()=>["","none",x,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:[D1],container:[dt],"drop-shadow":[dt],ease:["in","out","in-out"],font:[B1],"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,g]}],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:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],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":P()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:W()}],"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":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],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:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[l,"screen",...L()]}],"min-w":[{"min-w":[l,"screen","none",...L()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,_n,zt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ce,ro]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",no,le]}],"font-family":[{font:[W1,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,ro]}],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:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,zt]}],"text-decoration-color":[{decoration:B()}],"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:J()}],"bg-repeat":[{bg:se()}],"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]},H1,Z1]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],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:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,_n,zt]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",d,Qn,Xn]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",h,Qn,Xn]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[be,zt]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",m,Qn,Xn]}],"text-shadow-color":[{"text-shadow":B()}],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":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"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":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"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":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"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":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"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":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"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":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"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":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"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":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":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":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:se()}],"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",p,Qn,Xn]}],"drop-shadow-color":[{"drop-shadow":B()}],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:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",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",...B()]}],"stroke-w":[{stroke:[be,_n,zt,ro]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},G1=T1(K1);function ve(...e){return G1(pl(e))}function Be(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Y1(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const X1="2.0.3",Q1={version:X1},pi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mi=pl,us=(e,t)=>n=>{var r;if(t?.variants==null)return mi(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],h=s?.[u];if(d===null)return null;const m=pi(d)||pi(h);return o[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(x=>{let[f,g]=x;return Array.isArray(g)?g.includes({...s,...l}[f]):{...s,...l}[f]===g})?[...u,h,m]:u},[]);return mi(e,i,c,n?.class,n?.className)};function gi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function El(...e){return t=>{let n=!1;const r=e.map(o=>{const s=gi(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():gi(e[o],null)}}}}function Ie(...e){return v.useCallback(El(...e),e)}function ln(e){const t=tx(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,l=v.Children.toArray(s),c=l.find(rx);if(c){const u=c.props.children,d=l.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);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 ex=ln("Slot");function tx(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=sx(o),l=ox(s,o.props);return o.type!==v.Fragment&&(l.ref=r?El(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 Nl=Symbol("radix.slottable");function nx(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Nl,t}function rx(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nl}function ox(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 sx(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 ix=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=ix.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 ax(e,t){e&&Ln.flushSync(()=>e.dispatchEvent(t))}var Tl=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"}),lx="VisuallyHidden",Al=v.forwardRef((e,t)=>a.jsx(Se.span,{...e,ref:t,style:{...Tl,...e.style}}));Al.displayName=lx;var cx=Al;function ux(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=h=>{const{scope:m,children:p,...x}=h,f=m?.[e]?.[c]||l,g=v.useMemo(()=>x,Object.values(x));return a.jsx(f.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(h,m){const p=m?.[e]?.[c]||l,x=v.useContext(p);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${h}\` 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,dx(o,...t)]}function dx(...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 h=c(s)[`__scope${u}`];return{...l,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function zl(e){const t=e+"CollectionProvider",[n,r]=Zt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:g,children:y}=f,_=He.useRef(null),k=He.useRef(new Map).current;return a.jsx(o,{scope:g,itemMap:k,collectionRef:_,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=ln(l),u=He.forwardRef((f,g)=>{const{scope:y,children:_}=f,k=s(l,y),C=Ie(g,k.collectionRef);return a.jsx(c,{ref:C,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=ln(d),p=He.forwardRef((f,g)=>{const{scope:y,children:_,...k}=f,C=He.useRef(null),S=Ie(g,C),O=s(d,y);return He.useEffect(()=>(O.itemMap.set(C,{ref:C,...k}),()=>{O.itemMap.delete(C)})),a.jsx(m,{[h]:"",ref:S,children:_})});p.displayName=d;function x(f){const g=s(e+"CollectionConsumer",f);return He.useCallback(()=>{const _=g.collectionRef.current;if(!_)return[];const k=Array.from(_.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((O,E)=>k.indexOf(O.ref.current)-k.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},x,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:()=>{},fx=ga[" useInsertionEffect ".trim().toString()]||We;function cn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=hx({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${r} is changing from ${h?"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 h=px(d)?d(e):d;h!==e&&i.current?.(h)}else s(d)},[l,e,s,i]);return[c,u]}function hx({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return fx(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function px(e){return typeof e=="function"}function mx(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Wt=e=>{const{present:t,children:n}=e,r=gx(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Ie(r.ref,xx(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};Wt.displayName="Presence";function gx(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[l,c]=mx(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=er(r.current);s.current=l==="mounted"?u:"none"},[l]),We(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,p=er(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),We(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=p=>{const f=er(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&f&&(c("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=p=>{p.target===t&&(s.current=er(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function er(e){return e?.animationName||"none"}function xx(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 vx=ga[" useId ".trim().toString()]||(()=>{}),yx=0;function pt(e){const[t,n]=v.useState(vx());return We(()=>{n(r=>r??String(yx++))},[e]),e||(t?`radix-${t}`:"")}var bx=v.createContext(void 0);function ds(e){const t=v.useContext(bx);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 wx(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 _x="DismissableLayer",zo="dismissableLayer.update",kx="dismissableLayer.pointerDownOutside",Cx="dismissableLayer.focusOutside",xi,Ol=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(Ol),[d,h]=v.useState(null),m=d?.ownerDocument??globalThis?.document,[,p]=v.useState({}),x=Ie(t,E=>h(E)),f=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(g),_=d?f.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,C=_>=y,S=Ex(E=>{const A=E.target,I=[...u.branches].some(P=>P.contains(A));!C||I||(o?.(E),i?.(E),E.defaultPrevented||l?.())},m),O=Nx(E=>{const A=E.target;[...u.branches].some(P=>P.contains(A))||(s?.(E),i?.(E),E.defaultPrevented||l?.())},m);return wx(E=>{_===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},m),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(xi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),vi(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=xi)}},[d,m,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),vi())},[d,u]),v.useEffect(()=>{const E=()=>p({});return document.addEventListener(zo,E),()=>document.removeEventListener(zo,E)},[]),a.jsx(Se.div,{...c,ref:x,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,O.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,S.onPointerDownCapture)})});Mr.displayName=_x;var Sx="DismissableLayerBranch",jx=v.forwardRef((e,t)=>{const n=v.useContext(Ol),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})});jx.displayName=Sx;function Ex(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(){Il(kx,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 Nx(e,t=globalThis?.document){const n=kt(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Il(Cx,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 vi(){const e=new CustomEvent(zo);document.dispatchEvent(e)}function Il(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?ax(o,s):o.dispatchEvent(s)}var oo="focusScope.autoFocusOnMount",so="focusScope.autoFocusOnUnmount",yi={bubbles:!1,cancelable:!0},Tx="FocusScope",fs=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),h=v.useRef(null),m=Ie(t,f=>c(f)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let f=function(k){if(p.paused||!l)return;const C=k.target;l.contains(C)?h.current=C:bt(h.current,{select:!0})},g=function(k){if(p.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||bt(h.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",g);const _=new MutationObserver(y);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g),_.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){wi.add(p);const f=document.activeElement;if(!l.contains(f)){const y=new CustomEvent(oo,yi);l.addEventListener(oo,u),l.dispatchEvent(y),y.defaultPrevented||(Ax(Px(Rl(l)),{select:!0}),document.activeElement===f&&bt(l))}return()=>{l.removeEventListener(oo,u),setTimeout(()=>{const y=new CustomEvent(so,yi);l.addEventListener(so,d),l.dispatchEvent(y),y.defaultPrevented||bt(f??document.body,{select:!0}),l.removeEventListener(so,d),wi.remove(p)},0)}}},[l,u,d,p]);const x=v.useCallback(f=>{if(!n&&!r||p.paused)return;const g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(g&&y){const _=f.currentTarget,[k,C]=zx(_);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,p.paused]);return a.jsx(Se.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});fs.displayName=Tx;function Ax(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(bt(r,{select:t}),document.activeElement!==n)return}function zx(e){const t=Rl(e),n=bi(t,e),r=bi(t.reverse(),e);return[n,r]}function Rl(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 bi(e,t){for(const n of e)if(!Ox(n,{upTo:t}))return n}function Ox(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 Ix(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&&Ix(e)&&t&&e.select()}}var wi=Rx();function Rx(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=_i(e,t),e.unshift(t)},remove(t){e=_i(e,t),e[0]?.resume()}}}function _i(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Px(e){return e.filter(t=>t.tagName!=="A")}var Mx="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?ed.createPortal(a.jsx(Se.div,{...r,ref:t}),i):null});Dr.displayName=Mx;var io=0;function Pl(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ki()),document.body.insertAdjacentElement("beforeend",e[1]??ki()),io++,()=>{io===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),io--}},[])}function ki(){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 Ml(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 Dx(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 cr="right-scroll-bar-position",ur="width-before-scroll-bar",Lx="with-scroll-bars-hidden",Fx="--removed-body-scroll-bar-size";function ao(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $x(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 Bx=typeof window<"u"?v.useLayoutEffect:v.useEffect,Ci=new WeakMap;function Ux(e,t){var n=$x(null,function(r){return e.forEach(function(o){return ao(o,r)})});return Bx(function(){var r=Ci.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||ao(l,null)}),s.forEach(function(l){o.has(l)||ao(l,i)})}Ci.set(n,e)},[e]),n}function Zx(e){return e}function Wx(e,t){t===void 0&&(t=Zx);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 Vx(e){e===void 0&&(e={});var t=Wx(null);return t.options=st({async:!0,ssr:!1},e),t}var Dl=function(e){var t=e.sideCar,n=Ml(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))};Dl.isSideCarExport=!0;function Hx(e,t){return e.useMedium(t),Dl}var Ll=Vx(),lo=function(){},Lr=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:lo,onWheelCapture:lo,onTouchMoveCapture:lo}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,x=e.noIsolation,f=e.inert,g=e.allowPinchZoom,y=e.as,_=y===void 0?"div":y,k=e.gapMode,C=Ml(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,O=Ux([n,t]),E=st(st({},C),o);return v.createElement(v.Fragment,null,d&&v.createElement(S,{sideCar:Ll,removeScrollBar:u,shards:h,noRelative:p,noIsolation:x,inert:f,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(l),st(st({},E),{ref:O})):v.createElement(_,st({},E,{className:c,ref:O}),l))});Lr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lr.classNames={fullWidth:ur,zeroRight:cr};var qx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Jx(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=qx();return t&&e.setAttribute("nonce",t),e}function Kx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Gx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Yx=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Jx())&&(Kx(t,n),Gx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xx=function(){var e=Yx();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Fl=function(){var e=Xx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Qx={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||"",10)||0},ev=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[co(n),co(r),co(o)]},tv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qx;var t=ev(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])}},nv=Fl(),tn="data-scroll-locked",rv=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(Lx,` {
|
|
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(cr,` {
|
|
60
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.`).concat(ur,` {
|
|
64
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.`).concat(cr," .").concat(cr,` {
|
|
68
|
-
right: 0 `).concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.`).concat(ur," .").concat(ur,` {
|
|
72
|
-
margin-right: 0 `).concat(r,`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
body[`).concat(tn,`] {
|
|
76
|
-
`).concat(Fx,": ").concat(l,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},Si=function(){var e=parseInt(document.body.getAttribute(tn)||"0",10);return isFinite(e)?e:0},ov=function(){v.useEffect(function(){return document.body.setAttribute(tn,(Si()+1).toString()),function(){var e=Si()-1;e<=0?document.body.removeAttribute(tn):document.body.setAttribute(tn,e.toString())}},[])},sv=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;ov();var s=v.useMemo(function(){return tv(o)},[o]);return v.createElement(nv,{styles:rv(s,!t,o,n?"":"!important")})},Oo=!1;if(typeof window<"u")try{var tr=Object.defineProperty({},"passive",{get:function(){return Oo=!0,!0}});window.addEventListener("test",tr,tr),window.removeEventListener("test",tr,tr)}catch{Oo=!1}var qt=Oo?{passive:!1}:!1,iv=function(e){return e.tagName==="TEXTAREA"},$l=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!iv(e)&&n[t]==="visible")},av=function(e){return $l(e,"overflowY")},lv=function(e){return $l(e,"overflowX")},ji=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Bl(e,r);if(o){var s=Ul(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cv=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},uv=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Bl=function(e,t){return e==="v"?av(t):lv(t)},Ul=function(e,t){return e==="v"?cv(t):uv(t)},dv=function(e,t){return e==="h"&&t==="rtl"?-1:1},fv=function(e,t,n,r,o){var s=dv(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,d=i>0,h=0,m=0;do{if(!l)break;var p=Ul(e,l),x=p[0],f=p[1],g=p[2],y=f-g-s*x;(x||y)&&Bl(e,l)&&(h+=y,m+=x);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(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},nr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ei=function(e){return[e.deltaX,e.deltaY]},Ni=function(e){return e&&"current"in e?e.current:e},hv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pv=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},mv=0,Jt=[];function gv(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(mv++)[0],s=v.useState(Fl)[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=Dx([e.lockRef.current],(e.shards||[]).map(Ni),!0).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(f,g){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var y=nr(f),_=n.current,k="deltaX"in f?f.deltaX:_[0]-y[0],C="deltaY"in f?f.deltaY:_[1]-y[1],S,O=f.target,E=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in f&&E==="h"&&O.type==="range")return!1;var A=window.getSelection(),I=A&&A.anchorNode,P=I?I===O||I.contains(O):!1;if(P)return!1;var W=ji(E,O);if(!W)return!0;if(W?S=E:(S=E==="v"?"h":"v",W=ji(E,O)),!W)return!1;if(!r.current&&"changedTouches"in f&&(k||C)&&(r.current=S),!S)return!0;var j=r.current||S;return fv(j,g,f,j==="h"?k:C)},[]),c=v.useCallback(function(f){var g=f;if(!(!Jt.length||Jt[Jt.length-1]!==s)){var y="deltaY"in g?Ei(g):nr(g),_=t.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&hv(S.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var k=(i.current.shards||[]).map(Ni).filter(Boolean).filter(function(S){return S.contains(g.target)}),C=k.length>0?l(g,k[0]):!i.current.noIsolation;C&&g.cancelable&&g.preventDefault()}}},[]),u=v.useCallback(function(f,g,y,_){var k={name:f,delta:g,target:y,should:_,shadowParent:xv(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=nr(f),r.current=void 0},[]),h=v.useCallback(function(f){u(f.type,Ei(f),f.target,l(f,e.lockRef.current))},[]),m=v.useCallback(function(f){u(f.type,nr(f),f.target,l(f,e.lockRef.current))},[]);v.useEffect(function(){return Jt.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,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 p=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(s,{styles:pv(o)}):null,p?v.createElement(sv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vv=Hx(Ll,gv);var hs=v.forwardRef(function(e,t){return v.createElement(Lr,st({},e,{ref:t,sideCar:vv}))});hs.classNames=Lr.classNames;var yv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kt=new WeakMap,rr=new WeakMap,or={},uo=0,Zl=function(e){return e&&(e.host||Zl(e.parentNode))},bv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Zl(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})},wv=function(e,t,n,r){var o=bv(t,Array.isArray(e)?e:[e]);or[n]||(or[n]=new WeakMap);var s=or[n],i=[],l=new Set,c=new Set(o),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};o.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))d(m);else try{var p=m.getAttribute(r),x=p!==null&&p!=="false",f=(Kt.get(m)||0)+1,g=(s.get(m)||0)+1;Kt.set(m,f),s.set(m,g),i.push(m),f===1&&x&&rr.set(m,!0),g===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),uo++,function(){i.forEach(function(h){var m=Kt.get(h)-1,p=s.get(h)-1;Kt.set(h,m),s.set(h,p),m||(rr.has(h)||h.removeAttribute(r),rr.delete(h)),p||h.removeAttribute(n)}),uo--,uo||(Kt=new WeakMap,Kt=new WeakMap,rr=new WeakMap,or={})}},Wl=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=yv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),wv(r,o,n,"aria-hidden")):function(){return null}},Fr="Dialog",[Vl]=Zt(Fr),[_v,rt]=Vl(Fr),Hl=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(_v,{scope:t,triggerRef:l,contentRef:c,contentId:pt(),titleId:pt(),descriptionId:pt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:i,children:n})};Hl.displayName=Fr;var ql="DialogTrigger",Jl=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(ql,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":gs(o.open),...r,ref:s,onClick:ye(e.onClick,o.onOpenToggle)})});Jl.displayName=ql;var ps="DialogPortal",[kv,Kl]=Vl(ps,{forceMount:void 0}),Gl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=rt(ps,t);return a.jsx(kv,{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})}))})};Gl.displayName=ps;var br="DialogOverlay",Yl=v.forwardRef((e,t)=>{const n=Kl(br,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=rt(br,e.__scopeDialog);return s.modal?a.jsx(Wt,{present:r||s.open,children:a.jsx(Sv,{...o,ref:t})}):null});Yl.displayName=br;var Cv=ln("DialogOverlay.RemoveScroll"),Sv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(br,n);return a.jsx(hs,{as:Cv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Se.div,{"data-state":gs(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Pt="DialogContent",Xl=v.forwardRef((e,t)=>{const n=Kl(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(jv,{...o,ref:t}):a.jsx(Ev,{...o,ref:t})})});Xl.displayName=Pt;var jv=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 Wl(s)},[]),a.jsx(Ql,{...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())})}),Ev=v.forwardRef((e,t)=>{const n=rt(Pt,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return a.jsx(Ql,{...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()}})}),Ql=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 Pl(),a.jsxs(a.Fragment,{children:[a.jsx(fs,{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":gs(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Tv,{titleId:l.titleId}),a.jsx(zv,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ms="DialogTitle",ec=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(ms,n);return a.jsx(Se.h2,{id:o.titleId,...r,ref:t})});ec.displayName=ms;var tc="DialogDescription",Nv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(tc,n);return a.jsx(Se.p,{id:o.descriptionId,...r,ref:t})});Nv.displayName=tc;var nc="DialogClose",rc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(nc,n);return a.jsx(Se.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>o.onOpenChange(!1))})});rc.displayName=nc;function gs(e){return e?"open":"closed"}var oc="DialogTitleWarning",[p5,sc]=ux(oc,{contentName:Pt,titleName:ms,docsSlug:"dialog"}),Tv=({titleId:e})=>{const t=sc(oc),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},Av="DialogDescriptionWarning",zv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sc(Av).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Ov=Hl,Iv=Jl,Rv=Gl,Pv=Yl,Mv=Xl,Dv=ec,Lv=rc;function Fv(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 $v(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 Bv=["top","right","bottom","left"],Ct=Math.min,Je=Math.max,wr=Math.round,sr=Math.floor,at=e=>({x:e,y:e}),Uv={left:"right",right:"left",bottom:"top",top:"bottom"},Zv={start:"end",end:"start"};function Io(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 mn(e){return e.split("-")[1]}function xs(e){return e==="x"?"y":"x"}function vs(e){return e==="y"?"height":"width"}const Wv=new Set(["top","bottom"]);function it(e){return Wv.has(xt(e))?"y":"x"}function ys(e){return xs(it(e))}function Vv(e,t,n){n===void 0&&(n=!1);const r=mn(e),o=ys(e),s=vs(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=_r(i)),[i,_r(i)]}function Hv(e){const t=_r(e);return[Ro(e),t,Ro(t)]}function Ro(e){return e.replace(/start|end/g,t=>Zv[t])}const Ti=["left","right"],Ai=["right","left"],qv=["top","bottom"],Jv=["bottom","top"];function Kv(e,t,n){switch(e){case"top":case"bottom":return n?t?Ai:Ti:t?Ti:Ai;case"left":case"right":return t?qv:Jv;default:return[]}}function Gv(e,t,n,r){const o=mn(e);let s=Kv(xt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ro)))),s}function _r(e){return e.replace(/left|right|bottom|top/g,t=>Uv[t])}function Yv(e){return{top:0,right:0,bottom:0,left:0,...e}}function ic(e){return typeof e!="number"?Yv(e):{top:e,right:e,bottom:e,left:e}}function kr(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 zi(e,t,n){let{reference:r,floating:o}=e;const s=it(t),i=ys(t),l=vs(i),c=xt(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-o.width,y:h};break;default:p={x:r.x,y:r.y}}switch(mn(t)){case"start":p[i]-=m*(n&&u?-1:1);break;case"end":p[i]+=m*(n&&u?-1:1);break}return p}async function Xv(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:h="floating",altBoundary:m=!1,padding:p=0}=gt(t,e),x=ic(p),g=l[m?h==="floating"?"reference":"floating":h],y=kr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),_=h==="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=kr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:k,strategy:c}):_);return{top:(y.top-S.top+x.top)/C.y,bottom:(S.bottom-y.bottom+x.bottom)/C.y,left:(y.left-S.left+x.left)/C.x,right:(S.right-y.right+x.right)/C.x}}const Qv=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:h}=zi(u,r,c),m=r,p={},x=0;for(let g=0;g<l.length;g++){var f;const{name:y,fn:_}=l[g],{x:k,y:C,data:S,reset:O}=await _({x:d,y:h,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:u,platform:{...i,detectOverflow:(f=i.detectOverflow)!=null?f:Xv},elements:{reference:e,floating:t}});d=k??d,h=C??h,p={...p,[y]:{...p[y],...S}},O&&x<=50&&(x++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(u=O.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:d,y:h}=zi(u,m,c)),g=-1)}return{x:d,y:h,placement:m,strategy:o,middlewareData:p}},ey=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 h=ic(d),m={x:n,y:r},p=ys(o),x=vs(p),f=await i.getDimensions(u),g=p==="y",y=g?"top":"left",_=g?"bottom":"right",k=g?"clientHeight":"clientWidth",C=s.reference[x]+s.reference[p]-m[p]-s.floating[x],S=m[p]-s.reference[p],O=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=O?O[k]:0;(!E||!await(i.isElement==null?void 0:i.isElement(O)))&&(E=l.floating[k]||s.floating[x]);const A=C/2-S/2,I=E/2-f[x]/2-1,P=Ct(h[y],I),W=Ct(h[_],I),j=P,z=E-f[x]-W,w=E/2-f[x]/2+A,R=Io(j,w,z),q=!c.arrow&&mn(o)!=null&&w!==R&&s.reference[x]/2-(w<j?P:W)-f[x]/2<0,L=q?w<j?w-j:w-z:0;return{[p]:m[p]+L,data:{[p]:R,centerOffset:w-R-L,...q&&{alignmentOffset:L}},reset:q}}}),ty=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:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:f=!0,...g}=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?[_r(l)]:Hv(l)),O=x!=="none";!m&&O&&S.push(...Gv(l,f,x,C));const E=[l,...S],A=await c.detectOverflow(t,g),I=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&I.push(A[y]),h){const w=Vv(o,i,C);I.push(A[w[0]],A[w[1]])}if(P=[...P,{placement:o,overflows:I}],!I.every(w=>w<=0)){var W,j;const w=(((W=s.flip)==null?void 0:W.index)||0)+1,R=E[w];if(R&&(!(h==="alignment"?_!==it(R):!1)||P.every(B=>it(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:w,overflows:P},reset:{placement:R}};let q=(j=P.filter(L=>L.overflows[0]<=0).sort((L,B)=>L.overflows[1]-B.overflows[1])[0])==null?void 0:j.placement;if(!q)switch(p){case"bestFit":{var z;const L=(z=P.filter(B=>{if(O){const J=it(B.placement);return J===_||J==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(J=>J>0).reduce((J,se)=>J+se,0)]).sort((B,J)=>B[1]-J[1])[0])==null?void 0:z[0];L&&(q=L);break}case"initialPlacement":q=l;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function Oi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ii(e){return Bv.some(t=>e[t]>=0)}const ny=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=Oi(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ii(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Oi(i,n.floating);return{data:{escapedOffsets:l,escaped:Ii(l)}}}default:return{}}}}},ac=new Set(["left","top"]);async function ry(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=mn(n),c=it(n)==="y",u=ac.has(i)?-1:1,d=s&&c?-1:1,h=gt(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof x=="number"&&(p=l==="end"?x*-1:x),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const oy=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 ry(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}}}}},sy=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},h=await s.detectOverflow(t,u),m=it(xt(o)),p=xs(m);let x=d[p],f=d[m];if(i){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",k=x+h[y],C=x-h[_];x=Io(k,x,C)}if(l){const y=m==="y"?"top":"left",_=m==="y"?"bottom":"right",k=f+h[y],C=f-h[_];f=Io(k,f,C)}const g=c.fn({...t,[p]:x,[m]:f});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[m]:l}}}}}},iy=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},h=it(o),m=xs(h);let p=d[m],x=d[h];const f=gt(l,t),g=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]+g.mainAxis,S=s.reference[m]+s.reference[k]-g.mainAxis;p<C?p=C:p>S&&(p=S)}if(u){var y,_;const k=m==="y"?"width":"height",C=ac.has(xt(o)),S=s.reference[h]-s.floating[k]+(C&&((y=i.offset)==null?void 0:y[h])||0)+(C?0:g.crossAxis),O=s.reference[h]+s.reference[k]+(C?0:((_=i.offset)==null?void 0:_[h])||0)-(C?g.crossAxis:0);x<S?x=S:x>O&&(x=O)}return{[m]:p,[h]:x}}}},ay=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),h=xt(o),m=mn(o),p=it(o)==="y",{width:x,height:f}=s.floating;let g,y;h==="top"||h==="bottom"?(g=h,y=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,g=m==="end"?"top":"bottom");const _=f-d.top-d.bottom,k=x-d.left-d.right,C=Ct(f-d[g],_),S=Ct(x-d[y],k),O=!t.middlewareData.shift;let E=C,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=_),O&&!m){const P=Je(d.left,0),W=Je(d.right,0),j=Je(d.top,0),z=Je(d.bottom,0);p?A=x-2*(P!==0||W!==0?P+W:Je(d.left,d.right)):E=f-2*(j!==0||z!==0?j+z:Je(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:E});const I=await i.getDimensions(l.floating);return x!==I.width||f!==I.height?{reset:{rects:!0}}:{}}}};function $r(){return typeof window<"u"}function gn(e){return lc(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=(lc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lc(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 Ri(e){return!$r()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}const ly=new Set(["inline","contents"]);function Un(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ly.has(o)}const cy=new Set(["table","td","th"]);function uy(e){return cy.has(gn(e))}const dy=[":popover-open",":modal"];function Br(e){return dy.some(t=>{try{return e.matches(t)}catch{return!1}})}const fy=["transform","translate","scale","rotate","perspective"],hy=["transform","translate","scale","rotate","perspective","filter"],py=["paint","layout","strict","content"];function bs(e){const t=ws(),n=tt(e)?nt(e):e;return fy.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)||hy.some(r=>(n.willChange||"").includes(r))||py.some(r=>(n.contain||"").includes(r))}function my(e){let t=St(e);for(;lt(t)&&!un(t);){if(bs(t))return t;if(Br(t))return null;t=St(t)}return null}function ws(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gy=new Set(["html","body","#document"]);function un(e){return gy.has(gn(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(gn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ri(e)&&e.host||ct(e);return Ri(t)?t.host:t}function cc(e){const t=St(e);return un(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&Un(t)?t:cc(t)}function Pn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const l=Po(i);return t.concat(i,i.visualViewport||[],Un(o)?o:[],l&&n?Pn(l):[])}return t.concat(o,Pn(o,[],n))}function Po(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uc(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=wr(n)!==s||wr(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function _s(e){return tt(e)?e:e.contextElement}function nn(e){const t=_s(e);if(!lt(t))return at(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=uc(t);let i=(s?wr(n.width):n.width)/r,l=(s?wr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const xy=at(0);function dc(e){const t=Ke(e);return!ws()||!t.visualViewport?xy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vy(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=_s(e);let i=at(1);t&&(r?tt(r)&&(i=nn(r)):i=nn(e));const l=vy(s,n,r)?dc(s):at(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,h=o.height/i.y;if(s){const m=Ke(s),p=r&&tt(r)?Ke(r):r;let x=m,f=Po(x);for(;f&&r&&p!==x;){const g=nn(f),y=f.getBoundingClientRect(),_=nt(f),k=y.left+(f.clientLeft+parseFloat(_.paddingLeft))*g.x,C=y.top+(f.clientTop+parseFloat(_.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,h*=g.y,c+=k,u+=C,x=Ke(f),f=Po(x)}}return kr({width:d,height:h,x:c,y:u})}function Zr(e,t){const n=Ur(e).scrollLeft;return t?t.left+n:Mt(ct(e)).left+n}function fc(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 yy(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),h=lt(r);if((h||!h&&!s)&&((gn(r)!=="body"||Un(i))&&(c=Ur(r)),lt(r))){const p=Mt(r);u=nn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const m=i&&!h&&!s?fc(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 by(e){return Array.from(e.getClientRects())}function wy(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 Pi=25;function _y(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=ws();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Zr(r);if(u<=0){const d=r.ownerDocument,h=d.body,m=getComputedStyle(h),p=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-h.clientWidth-p);x<=Pi&&(s-=x)}else u<=Pi&&(s+=u);return{width:s,height:i,x:l,y:c}}const ky=new Set(["absolute","fixed"]);function Cy(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 Mi(e,t,n){let r;if(t==="viewport")r=_y(e,n);else if(t==="document")r=wy(ct(e));else if(tt(t))r=Cy(t,n);else{const o=dc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kr(r)}function hc(e,t){const n=St(e);return n===t||!tt(n)||un(n)?!1:nt(n).position==="fixed"||hc(n,t)}function Sy(e,t){const n=t.get(e);if(n)return n;let r=Pn(e,[],!1).filter(l=>tt(l)&&gn(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=bs(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&ky.has(o.position)||Un(i)&&!c&&hc(e,i))?r=r.filter(d=>d!==i):o=l,i=St(i)}return t.set(e,r),r}function jy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Br(t)?[]:Sy(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const h=Mi(t,d,o);return u.top=Je(h.top,u.top),u.right=Ct(h.right,u.right),u.bottom=Ct(h.bottom,u.bottom),u.left=Je(h.left,u.left),u},Mi(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ey(e){const{width:t,height:n}=uc(e);return{width:t,height:n}}function Ny(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((gn(t)!=="body"||Un(o))&&(l=Ur(t)),r){const p=Mt(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?fc(o,l):at(0),h=i.left+l.scrollLeft-c.x-d.x,m=i.top+l.scrollTop-c.y-d.y;return{x:h,y:m,width:i.width,height:i.height}}function fo(e){return nt(e).position==="static"}function Di(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 pc(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)&&!fo(o))return o;o=St(o)}return n}let r=Di(e,t);for(;r&&uy(r)&&fo(r);)r=Di(r,t);return r&&un(r)&&fo(r)&&!bs(r)?n:r||my(e)||n}const Ty=async function(e){const t=this.getOffsetParent||pc,n=this.getDimensions,r=await n(e.floating);return{reference:Ny(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ay(e){return nt(e).direction==="rtl"}const zy={convertOffsetParentRelativeRectToViewportRelativeRect:yy,getDocumentElement:ct,getClippingRect:jy,getOffsetParent:pc,getElementRects:Ty,getClientRects:by,getDimensions:Ey,getScale:nn,isElement:tt,isRTL:Ay};function mc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Oy(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:h,width:m,height:p}=u;if(l||t(),!m||!p)return;const x=sr(h),f=sr(o.clientWidth-(d+m)),g=sr(o.clientHeight-(h+p)),y=sr(d),k={rootMargin:-x+"px "+-f+"px "+-g+"px "+-y+"px",threshold:Je(0,Ct(1,c))||1};let C=!0;function S(O){const E=O[0].intersectionRatio;if(E!==c){if(!C)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!mc(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 Iy(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=_s(e),d=o||s?[...u?Pn(u):[],...Pn(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&l?Oy(u,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(y=>{let[_]=y;_&&_.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let x,f=c?Mt(e):null;c&&g();function g(){const y=Mt(e);f&&!mc(f,y)&&n(),f=y,x=requestAnimationFrame(g)}return n(),()=>{var y;d.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),h?.(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(x)}}const Ry=oy,Py=sy,My=ty,Dy=ay,Ly=ny,Li=ey,Fy=iy,$y=(e,t,n)=>{const r=new Map,o={platform:zy,...n},s={...o.platform,_c:r};return Qv(e,t,{...o,platform:s})};var By=typeof document<"u",Uy=function(){},dr=By?v.useLayoutEffect:Uy;function Cr(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(!Cr(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)&&!Cr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function gc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fi(e,t){const n=gc(e);return Math.round(t*n)/n}function ho(e){const t=v.useRef(e);return dr(()=>{t.current=e}),t}function Zy(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,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=v.useState(r);Cr(m,r)||p(r);const[x,f]=v.useState(null),[g,y]=v.useState(null),_=v.useCallback(B=>{B!==O.current&&(O.current=B,f(B))},[]),k=v.useCallback(B=>{B!==E.current&&(E.current=B,y(B))},[]),C=s||x,S=i||g,O=v.useRef(null),E=v.useRef(null),A=v.useRef(d),I=c!=null,P=ho(c),W=ho(o),j=ho(u),z=v.useCallback(()=>{if(!O.current||!E.current)return;const B={placement:t,strategy:n,middleware:m};W.current&&(B.platform=W.current),$y(O.current,E.current,B).then(J=>{const se={...J,isPositioned:j.current!==!1};w.current&&!Cr(A.current,se)&&(A.current=se,Ln.flushSync(()=>{h(se)}))})},[m,t,n,W,j]);dr(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[u]);const w=v.useRef(!1);dr(()=>(w.current=!0,()=>{w.current=!1}),[]),dr(()=>{if(C&&(O.current=C),S&&(E.current=S),C&&S){if(P.current)return P.current(C,S,z);z()}},[C,S,z,P,I]);const R=v.useMemo(()=>({reference:O,floating:E,setReference:_,setFloating:k}),[_,k]),q=v.useMemo(()=>({reference:C,floating:S}),[C,S]),L=v.useMemo(()=>{const B={position:n,left:0,top:0};if(!q.floating)return B;const J=Fi(q.floating,d.x),se=Fi(q.floating,d.y);return l?{...B,transform:"translate("+J+"px, "+se+"px)",...gc(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:se}},[n,l,q.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:z,refs:R,elements:q,floatingStyles:L}),[d,z,R,q,L])}const Wy=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?Li({element:r.current,padding:o}).fn(n):{}:r?Li({element:r,padding:o}).fn(n):{}}}},Vy=(e,t)=>({...Ry(e),options:[e,t]}),Hy=(e,t)=>({...Py(e),options:[e,t]}),qy=(e,t)=>({...Fy(e),options:[e,t]}),Jy=(e,t)=>({...My(e),options:[e,t]}),Ky=(e,t)=>({...Dy(e),options:[e,t]}),Gy=(e,t)=>({...Ly(e),options:[e,t]}),Yy=(e,t)=>({...Wy(e),options:[e,t]});var Xy="Arrow",xc=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"})})});xc.displayName=Xy;var Qy=xc,ks="Popper",[vc,Wr]=Zt(ks),[eb,yc]=vc(ks),bc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return a.jsx(eb,{scope:t,anchor:r,onAnchorChange:o,children:n})};bc.displayName=ks;var wc="PopperAnchor",_c=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=yc(wc,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})});_c.displayName=wc;var Cs="PopperContent",[tb,nb]=vc(Cs),kc=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:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:x,...f}=e,g=yc(Cs,n),[y,_]=v.useState(null),k=Ie(t,X=>_(X)),[C,S]=v.useState(null),O=$v(C),E=O?.width??0,A=O?.height??0,I=r+(s!=="center"?"-"+s:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},W=Array.isArray(u)?u:[u],j=W.length>0,z={padding:P,boundary:W.filter(ob),altBoundary:j},{refs:w,floatingStyles:R,placement:q,isPositioned:L,middlewareData:B}=Zy({strategy:"fixed",placement:I,whileElementsMounted:(...X)=>Iy(...X,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[Vy({mainAxis:o+A,alignmentAxis:i}),c&&Hy({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?qy():void 0,...z}),c&&Jy({...z}),Ky({...z,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&&Yy({element:C,padding:l}),sb({arrowWidth:E,arrowHeight:A}),m&&Gy({strategy:"referenceHidden",...z})]}),[J,se]=jc(q),Z=kt(x);We(()=>{L&&Z?.()},[L,Z]);const U=B.arrow?.x,te=B.arrow?.y,ee=B.arrow?.centerOffset!==0,[K,ue]=v.useState();return We(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:L?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(tb,{scope:n,placedSide:J,onArrowChange:S,arrowX:U,arrowY:te,shouldHideArrow:ee,children:a.jsx(Se.div,{"data-side":J,"data-align":se,...f,ref:k,style:{...f.style,animation:L?void 0:"none"}})})})});kc.displayName=Cs;var Cc="PopperArrow",rb={top:"bottom",right:"left",bottom:"top",left:"right"},Sc=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=nb(Cc,r),i=rb[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(Qy,{...o,ref:n,style:{...o.style,display:"block"}})})});Sc.displayName=Cc;function ob(e){return e!==null}var sb=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]=jc(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let x="",f="";return u==="bottom"?(x=i?h:`${m}px`,f=`${-c}px`):u==="top"?(x=i?h:`${m}px`,f=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,f=i?h:`${p}px`):u==="left"&&(x=`${r.floating.width+c}px`,f=i?h:`${p}px`),{data:{x,y:f}}}});function jc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ec=bc,Nc=_c,Tc=kc,Ac=Sc,po="rovingFocusGroup.onEntryFocus",ib={bubbles:!1,cancelable:!0},Zn="RovingFocusGroup",[Mo,zc,ab]=zl(Zn),[lb,Oc]=Zt(Zn,[ab]),[cb,ub]=lb(Zn),Ic=v.forwardRef((e,t)=>a.jsx(Mo.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Mo.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(db,{...e,ref:t})})}));Ic.displayName=Zn;var db=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,...h}=e,m=v.useRef(null),p=Ie(t,m),x=ds(s),[f,g]=cn({prop:i,defaultProp:l??null,onChange:c,caller:Zn}),[y,_]=v.useState(!1),k=kt(u),C=zc(n),S=v.useRef(!1),[O,E]=v.useState(0);return v.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(po,k),()=>A.removeEventListener(po,k)},[k]),a.jsx(cb,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:f,onItemFocus:v.useCallback(A=>g(A),[g]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:v.useCallback(()=>E(A=>A-1),[]),children:a.jsx(Se.div,{tabIndex:y||O===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{S.current=!0}),onFocus:ye(e.onFocus,A=>{const I=!S.current;if(A.target===A.currentTarget&&I&&!y){const P=new CustomEvent(po,ib);if(A.currentTarget.dispatchEvent(P),!P.defaultPrevented){const W=C().filter(q=>q.focusable),j=W.find(q=>q.active),z=W.find(q=>q.id===f),R=[j,z,...W].filter(Boolean).map(q=>q.ref.current);Mc(R,d)}}S.current=!1}),onBlur:ye(e.onBlur,()=>_(!1))})})}),Rc="RovingFocusGroupItem",Pc=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=ub(Rc,n),h=d.currentTabStopId===u,m=zc(n),{onFocusableItemAdd:p,onFocusableItemRemove:x,currentTabStopId:f}=d;return v.useEffect(()=>{if(r)return p(),()=>x()},[r,p,x]),a.jsx(Mo.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Se.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,g=>{r?d.onItemFocus(u):g.preventDefault()}),onFocus:ye(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=pb(g,d.orientation,d.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.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(g.currentTarget);k=d.loop?mb(k,C+1):k.slice(C+1)}setTimeout(()=>Mc(k))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:f!=null}):i})})});Pc.displayName=Rc;var fb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function pb(e,t,n){const r=hb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fb[r]}function Mc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gb=Ic,xb=Pc;function $i(e,[t,n]){return Math.min(n,Math.max(t,e))}var vb=[" ","Enter","ArrowUp","ArrowDown"],yb=[" ","Enter"],Dt="Select",[Vr,Hr,bb]=zl(Dt),[xn]=Zt(Dt,[bb,Wr]),qr=Wr(),[wb,Nt]=xn(Dt),[_b,kb]=xn(Dt),Dc=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:x}=e,f=qr(t),[g,y]=v.useState(null),[_,k]=v.useState(null),[C,S]=v.useState(!1),O=ds(u),[E,A]=cn({prop:r,defaultProp:o??!1,onChange:s,caller:Dt}),[I,P]=cn({prop:i,defaultProp:l,onChange:c,caller:Dt}),W=v.useRef(null),j=g?x||!!g.closest("form"):!0,[z,w]=v.useState(new Set),R=Array.from(z).map(q=>q.props.value).join(";");return a.jsx(Ec,{...f,children:a.jsxs(wb,{required:p,scope:t,trigger:g,onTriggerChange:y,valueNode:_,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:pt(),value:I,onValueChange:P,open:E,onOpenChange:A,dir:O,triggerPointerDownPosRef:W,disabled:m,children:[a.jsx(Vr.Provider,{scope:t,children:a.jsx(_b,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(q=>{w(L=>new Set(L).add(q))},[]),onNativeOptionRemove:v.useCallback(q=>{w(L=>{const B=new Set(L);return B.delete(q),B})},[]),children:n})}),j?a.jsxs(su,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:I,onChange:q=>P(q.target.value),disabled:m,form:x,children:[I===void 0?a.jsx("option",{value:""}):null,Array.from(z)]},R):null]})})};Dc.displayName=Dt;var Lc="SelectTrigger",Fc=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=qr(n),i=Nt(Lc,n),l=i.disabled||r,c=Ie(t,i.onTriggerChange),u=Hr(n),d=v.useRef("touch"),[h,m,p]=au(f=>{const g=u().filter(k=>!k.disabled),y=g.find(k=>k.value===i.value),_=lu(g,f,y);_!==void 0&&i.onValueChange(_.value)}),x=f=>{l||(i.onOpenChange(!0),p()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return a.jsx(Nc,{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":iu(i.value)?"":void 0,...o,ref:c,onClick:ye(o.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&x(f)}),onPointerDown:ye(o.onPointerDown,f=>{d.current=f.pointerType;const g=f.target;g.hasPointerCapture(f.pointerId)&&g.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(x(f),f.preventDefault())}),onKeyDown:ye(o.onKeyDown,f=>{const g=h.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(g&&f.key===" ")&&vb.includes(f.key)&&(x(),f.preventDefault())})})})});Fc.displayName=Lc;var $c="SelectValue",Bc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Nt($c,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,h=Ie(t,c.onValueNodeChange);return We(()=>{u(d)},[u,d]),a.jsx(Se.span,{...l,ref:h,style:{pointerEvents:"none"},children:iu(c.value)?a.jsx(a.Fragment,{children:i}):s})});Bc.displayName=$c;var Cb="SelectIcon",Uc=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Se.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Uc.displayName=Cb;var Sb="SelectPortal",Zc=e=>a.jsx(Dr,{asChild:!0,...e});Zc.displayName=Sb;var Lt="SelectContent",Wc=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?Ln.createPortal(a.jsx(Vc,{scope:e.__scopeSelect,children:a.jsx(Vr.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Hc,{...e,ref:t})});Wc.displayName=Lt;var et=10,[Vc,Tt]=xn(Lt),jb="SelectContentImpl",Eb=ln("SelectContent.RemoveScroll"),Hc=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:h,collisionBoundary:m,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:g,...y}=e,_=Nt(Lt,n),[k,C]=v.useState(null),[S,O]=v.useState(null),E=Ie(t,X=>C(X)),[A,I]=v.useState(null),[P,W]=v.useState(null),j=Hr(n),[z,w]=v.useState(!1),R=v.useRef(!1);v.useEffect(()=>{if(k)return Wl(k)},[k]),Pl();const q=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]),L=v.useCallback(()=>q([A,k]),[q,A,k]);v.useEffect(()=>{z&&L()},[z,L]);const{onOpenChange:B,triggerPointerDownPosRef:J}=_;v.useEffect(()=>{if(k){let X={x:0,y:0};const ie=pe=>{X={x:Math.abs(Math.round(pe.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(pe.pageY)-(J.current?.y??0))}},ae=pe=>{X.x<=10&&X.y<=10?pe.preventDefault():k.contains(pe.target)||B(!1),document.removeEventListener("pointermove",ie),J.current=null};return J.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,B,J]),v.useEffect(()=>{const X=()=>B(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[B]);const[se,Z]=au(X=>{const ie=j().filter(fe=>!fe.disabled),ae=ie.find(fe=>fe.ref.current===document.activeElement),pe=lu(ie,X,ae);pe&&setTimeout(()=>pe.ref.current.focus())}),U=v.useCallback((X,ie,ae)=>{const pe=!R.current&&!ae;(_.value!==void 0&&_.value===ie||pe)&&(I(X),pe&&(R.current=!0))},[_.value]),te=v.useCallback(()=>k?.focus(),[k]),ee=v.useCallback((X,ie,ae)=>{const pe=!R.current&&!ae;(_.value!==void 0&&_.value===ie||pe)&&W(X)},[_.value]),K=r==="popper"?Do:qc,ue=K===Do?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:g}:{};return a.jsx(Vc,{scope:n,content:k,viewport:S,onViewportChange:O,itemRefCallback:U,selectedItem:A,onItemLeave:te,itemTextRefCallback:ee,focusSelectedItem:L,selectedItemText:P,position:r,isPositioned:z,searchRef:se,children:a.jsx(hs,{as:Eb,allowPinchZoom:!0,children:a.jsx(fs,{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(K,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...y,...ue,onPlaced:()=>w(!0),ref:E,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(()=>q(pe)),X.preventDefault()}})})})})})})});Hc.displayName=jb;var Nb="SelectItemAlignedPosition",qc=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),h=Ie(t,E=>d(E)),m=Hr(n),p=v.useRef(!1),x=v.useRef(!0),{viewport:f,selectedItem:g,selectedItemText:y,focusSelectedItem:_}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&f&&g&&y){const E=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),P=y.getBoundingClientRect();if(s.dir!=="rtl"){const fe=P.left-A.left,we=I.left-fe,Te=E.left-we,b=E.width+Te,Y=Math.max(b,A.width),H=window.innerWidth-et,T=$i(we,[et,Math.max(et,H-Y)]);l.style.minWidth=b+"px",l.style.left=T+"px"}else{const fe=A.right-P.right,we=window.innerWidth-I.right-fe,Te=window.innerWidth-E.right-we,b=E.width+Te,Y=Math.max(b,A.width),H=window.innerWidth-et,T=$i(we,[et,Math.max(et,H-Y)]);l.style.minWidth=b+"px",l.style.right=T+"px"}const W=m(),j=window.innerHeight-et*2,z=f.scrollHeight,w=window.getComputedStyle(u),R=parseInt(w.borderTopWidth,10),q=parseInt(w.paddingTop,10),L=parseInt(w.borderBottomWidth,10),B=parseInt(w.paddingBottom,10),J=R+q+z+B+L,se=Math.min(g.offsetHeight*5,J),Z=window.getComputedStyle(f),U=parseInt(Z.paddingTop,10),te=parseInt(Z.paddingBottom,10),ee=E.top+E.height/2-et,K=j-ee,ue=g.offsetHeight/2,X=g.offsetTop+ue,ie=R+q+X,ae=J-ie;if(ie<=ee){const fe=W.length>0&&g===W[W.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-f.offsetTop-f.offsetHeight,Te=Math.max(K,ue+(fe?te:0)+we+L),b=ie+Te;l.style.height=b+"px"}else{const fe=W.length>0&&g===W[0].ref.current;l.style.top="0px";const Te=Math.max(ee,R+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=se+"px",l.style.maxHeight=j+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[m,s.trigger,s.valueNode,l,u,f,g,y,s.dir,r]);We(()=>k(),[k]);const[C,S]=v.useState();We(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const O=v.useCallback(E=>{E&&x.current===!0&&(k(),_?.(),x.current=!1)},[k,_]);return a.jsx(Ab,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:O,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:a.jsx(Se.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});qc.displayName=Nb;var Tb="SelectPopperPosition",Do=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=et,...s}=e,i=qr(n);return a.jsx(Tc,{...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)"}})});Do.displayName=Tb;var[Ab,Ss]=xn(Lt,{}),Lo="SelectViewport",Jc=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Tt(Lo,n),i=Ss(Lo,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:h,shouldExpandOnScrollRef:m}=i;if(m?.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const x=window.innerHeight-et*2,f=parseFloat(h.style.minHeight),g=parseFloat(h.style.height),y=Math.max(f,g);if(y<x){const _=y+p,k=Math.min(x,_),C=_-k;h.style.height=k+"px",h.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Jc.displayName=Lo;var Kc="SelectGroup",[zb,Ob]=xn(Kc),Ib=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=pt();return a.jsx(zb,{scope:n,id:o,children:a.jsx(Se.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Ib.displayName=Kc;var Gc="SelectLabel",Rb=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ob(Gc,n);return a.jsx(Se.div,{id:o.id,...r,ref:t})});Rb.displayName=Gc;var Sr="SelectItem",[Pb,Yc]=xn(Sr),Xc=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Nt(Sr,n),c=Tt(Sr,n),u=l.value===r,[d,h]=v.useState(s??""),[m,p]=v.useState(!1),x=Ie(t,_=>c.itemRefCallback?.(_,r,o)),f=pt(),g=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(Pb,{scope:n,value:r,disabled:o,textId:f,isSelected:u,onItemTextChange:v.useCallback(_=>{h(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:x,onFocus:ye(i.onFocus,()=>p(!0)),onBlur:ye(i.onBlur,()=>p(!1)),onClick:ye(i.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:ye(i.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:ye(i.onPointerDown,_=>{g.current=_.pointerType}),onPointerMove:ye(i.onPointerMove,_=>{g.current=_.pointerType,o?c.onItemLeave?.():g.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(i.onPointerLeave,_=>{_.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ye(i.onKeyDown,_=>{c.searchRef?.current!==""&&_.key===" "||(yb.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});Xc.displayName=Sr;var Nn="SelectItemText",Qc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Nt(Nn,n),l=Tt(Nn,n),c=Yc(Nn,n),u=kb(Nn,n),[d,h]=v.useState(null),m=Ie(t,y=>h(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),p=d?.textContent,x=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:g}=u;return We(()=>(f(x),()=>g(x)),[f,g,x]),a.jsxs(a.Fragment,{children:[a.jsx(Se.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ln.createPortal(s.children,i.valueNode):null]})});Qc.displayName=Nn;var eu="SelectItemIndicator",tu=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Yc(eu,n).isSelected?a.jsx(Se.span,{"aria-hidden":!0,...r,ref:t}):null});tu.displayName=eu;var Fo="SelectScrollUpButton",nu=v.forwardRef((e,t)=>{const n=Tt(Fo,e.__scopeSelect),r=Ss(Fo,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(ou,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});nu.displayName=Fo;var $o="SelectScrollDownButton",ru=v.forwardRef((e,t)=>{const n=Tt($o,e.__scopeSelect),r=Ss($o,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(ou,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});ru.displayName=$o;var ou=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()})})}),Mb="SelectSeparator",Db=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Se.div,{"aria-hidden":!0,...r,ref:t})});Db.displayName=Mb;var Bo="SelectArrow",Lb=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=qr(n),s=Nt(Bo,n),i=Tt(Bo,n);return s.open&&i.position==="popper"?a.jsx(Ac,{...o,...r,ref:t}):null});Lb.displayName=Bo;var Fb="SelectBubbleInput",su=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Ie(r,o),i=Fv(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 h=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(h)}},[i,t]),a.jsx(Se.select,{...n,style:{...Tl,...n.style},ref:s,defaultValue:t})});su.displayName=Fb;function iu(e){return e===""||e===void 0}function au(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 lu(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=$b(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 $b(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bb=Dc,Ub=Fc,Zb=Bc,Wb=Uc,Vb=Zc,Hb=Wc,qb=Jc,Jb=Xc,Kb=Qc,Gb=tu,Yb=nu,Xb=ru,Jr="Tabs",[Qb]=Zt(Jr,[Oc]),cu=Oc(),[e2,js]=Qb(Jr),uu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ds(l),[h,m]=cn({prop:r,onChange:o,defaultProp:s??"",caller:Jr});return a.jsx(e2,{scope:n,baseId:pt(),value:h,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Se.div,{dir:d,"data-orientation":i,...u,ref:t})})});uu.displayName=Jr;var du="TabsList",fu=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=js(du,n),i=cu(n);return a.jsx(gb,{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})})});fu.displayName=du;var hu="TabsTrigger",pu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=js(hu,n),l=cu(n),c=xu(i.baseId,r),u=vu(i.baseId,r),d=r===i.value;return a.jsx(xb,{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,h=>{!o&&h.button===0&&h.ctrlKey===!1?i.onValueChange(r):h.preventDefault()}),onKeyDown:ye(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const h=i.activationMode!=="manual";!d&&!o&&h&&i.onValueChange(r)})})})});pu.displayName=hu;var mu="TabsContent",gu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=js(mu,n),c=xu(l.baseId,r),u=vu(l.baseId,r),d=r===l.value,h=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>h.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:h.current?"0s":void 0},children:m&&s})})});gu.displayName=mu;function xu(e,t){return`${e}-trigger-${t}`}function vu(e,t){return`${e}-content-${t}`}var t2=uu,n2=fu,r2=pu,o2=gu,[Kr]=Zt("Tooltip",[Wr]),Gr=Wr(),yu="TooltipProvider",s2=700,Uo="tooltip.open",[i2,Es]=Kr(yu),bu=e=>{const{__scopeTooltip:t,delayDuration:n=s2,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(i2,{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})};bu.displayName=yu;var Mn="Tooltip",[a2,Wn]=Kr(Mn),wu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Es(Mn,e.__scopeTooltip),u=Gr(t),[d,h]=v.useState(null),m=pt(),p=v.useRef(0),x=i??c.disableHoverableContent,f=l??c.delayDuration,g=v.useRef(!1),[y,_]=cn({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(Uo))):c.onClose(),s?.(E)},caller:Mn}),k=v.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),C=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,_(!0)},[_]),S=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),O=v.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,_(!0),p.current=0},f)},[f,_]);return v.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(Ec,{...u,children:a.jsx(a2,{scope:t,contentId:m,open:y,stateAttribute:k,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?O():C()},[c.isOpenDelayedRef,O,C]),onTriggerLeave:v.useCallback(()=>{x?S():(window.clearTimeout(p.current),p.current=0)},[S,x]),onOpen:C,onClose:S,disableHoverableContent:x,children:n})})};wu.displayName=Mn;var Zo="TooltipTrigger",_u=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Wn(Zo,n),s=Es(Zo,n),i=Gr(n),l=v.useRef(null),c=Ie(t,l,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),h=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(Nc,{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",h,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ye(e.onBlur,o.onClose),onClick:ye(e.onClick,o.onClose)})})});_u.displayName=Zo;var Ns="TooltipPortal",[l2,c2]=Kr(Ns,{forceMount:void 0}),ku=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Wn(Ns,t);return a.jsx(l2,{scope:t,forceMount:n,children:a.jsx(Wt,{present:n||s.open,children:a.jsx(Dr,{asChild:!0,container:o,children:r})})})};ku.displayName=Ns;var dn="TooltipContent",Cu=v.forwardRef((e,t)=>{const n=c2(dn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Wn(dn,e.__scopeTooltip);return a.jsx(Wt,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Su,{side:o,...s,ref:t}):a.jsx(u2,{side:o,...s,ref:t})})}),u2=v.forwardRef((e,t)=>{const n=Wn(dn,e.__scopeTooltip),r=Es(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:h}=r,m=v.useCallback(()=>{l(null),h(!1)},[h]),p=v.useCallback((x,f)=>{const g=x.currentTarget,y={x:x.clientX,y:x.clientY},_=p2(y,g.getBoundingClientRect()),k=m2(y,_),C=g2(f.getBoundingClientRect()),S=v2([...k,...C]);l(S),h(!0)},[h]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=g=>p(g,d),f=g=>p(g,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",f)}}},[c,d,p,m]),v.useEffect(()=>{if(i){const x=f=>{const g=f.target,y={x:f.clientX,y:f.clientY},_=c?.contains(g)||d?.contains(g),k=!x2(y,i);_?m():k&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),a.jsx(Su,{...e,ref:s})}),[d2,f2]=Kr(Mn,{isInside:!1}),h2=nx("TooltipContent"),Su=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Wn(dn,n),u=Gr(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(Uo,d),()=>document.removeEventListener(Uo,d)),[d]),v.useEffect(()=>{if(c.trigger){const h=m=>{m.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(Mr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(Tc,{"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(h2,{children:r}),a.jsx(d2,{scope:n,isInside:!0,children:a.jsx(cx,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Cu.displayName=dn;var ju="TooltipArrow",Eu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Gr(n);return f2(ju,n).isInside?null:a.jsx(Ac,{...o,...r,ref:t})});Eu.displayName=ju;function p2(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 m2(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 g2(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 x2(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,h=c.x,m=c.y;d>r!=m>r&&n<(h-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function v2(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),y2(t)}function y2(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 b2=bu,w2=wu,_2=_u,k2=ku,C2=Cu,S2=Eu;const j2=us("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?ex:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:ve(j2({variant:t}),e),...r})}function Ts({...e}){return a.jsx(Ov,{"data-slot":"dialog",...e})}function E2({...e}){return a.jsx(Iv,{"data-slot":"dialog-trigger",...e})}function N2({...e}){return a.jsx(Rv,{"data-slot":"dialog-portal",...e})}function T2({className:e,...t}){return a.jsx(Pv,{"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 As({className:e,children:t,...n}){return a.jsxs(N2,{children:[a.jsx(T2,{}),a.jsxs(Mv,{"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(Lv,{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(fl,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function zs({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Os({className:e,...t}){return a.jsx(Dv,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const A2=us("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 Me({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:ve(A2({variant:t,size:n,className:e})),...r})}function Nu({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(Ts,{open:e,onOpenChange:t,children:a.jsxs(As,{children:[a.jsx(zs,{children:a.jsx(Os,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Me,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Me,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const z2={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Bi(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function O2({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:h,onClear:m}){const[p,x]=v.useState(!1),f=y=>{y.stopPropagation(),m!==void 0&&x(!0)},g=v.useCallback(y=>{y.stopPropagation(),window.open(td(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:y=>{y.target===y.currentTarget&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c())},children:[l?a.jsx($n,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(In,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(Pr,{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}),h!=null&&h!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:h,children:[a.jsx(H0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:h})]}),!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:z2[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.jsxs("span",{className:"font-mono tabular-nums",children:[Bi(t)," - ",Bi(n)]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(ls,{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(Rn,{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:g,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&g(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(cl,{className:"size-3.5"})}),m!==void 0&&a.jsx("button",{type:"button",onClick:f,"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(dl,{className:"size-3.5"})}),a.jsx(Nu,{open:p,onOpenChange:x,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:()=>{m?.()}})]})}function I2(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function R2(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 P2(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 M2(e){const t=new Map;for(const r of e){const o=P2(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 Ui(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function D2(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Ui(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&&Ui(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Tu(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"})]}),Au=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 zu({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 L2({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:Au,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 F2({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 $2({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 B2({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 U2({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 Z2({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:Au,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 W2({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 V2({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 H2({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 q2({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 J2({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 Dn=[zu,L2,F2,$2,B2,U2,Z2,W2,V2,H2,q2,J2];function jr(e){return Dn[Math.abs(e)%Dn.length]??zu}function K2(e){const t=Dn.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function G2(e){return jr(K2(e))}const Y2="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",X2="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",Q2="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",ew="/assets/minimax-BPMzvuL-.jpeg",tw="/assets/alibaba-TTwafVwX.svg",nw="/assets/qwen-CONDcHqt.png",rw="/assets/zhipuai-BPNAnxo-.svg",ow={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Ou(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(ow))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Vt={width:24,height:24,objectFit:"contain"},sw=He.memo(({className:e})=>a.jsx("img",{src:Y2,alt:"Anthropic",className:e,style:Vt})),iw=He.memo(({className:e})=>a.jsx("img",{src:X2,alt:"OpenAI",className:e,style:{...Vt,background:"white",borderRadius:"4px"}})),aw=He.memo(({className:e})=>a.jsx("img",{src:Q2,alt:"DeepSeek",className:e,style:Vt})),lw=He.memo(({className:e})=>a.jsx("img",{src:ew,alt:"MiniMax",className:e,style:Vt})),cw=He.memo(({className:e})=>a.jsx("img",{src:tw,alt:"Alibaba",className:e,style:Vt})),uw=He.memo(({className:e})=>a.jsx("img",{src:nw,alt:"Qwen",className:e,style:Vt})),dw=He.memo(({className:e})=>a.jsx("img",{src:rw,alt:"ZhipuAI",className:e,style:Vt}));function Iu({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(sw,{className:t});case"openai":return a.jsx(iw,{className:t});case"deepseek":return a.jsx(aw,{className:t});case"minimax":return a.jsx(lw,{className:t});case"alibaba":return a.jsx(cw,{className:t});case"qwen":return a.jsx(uw,{className:t});case"zhipuai":return a.jsx(dw,{className:t});case"unknown":return null}}function $e({delayDuration:e=0,...t}){return a.jsx(b2,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function je({...e}){return a.jsx(w2,{"data-slot":"tooltip",...e})}function Ee({...e}){return a.jsx(_2,{"data-slot":"tooltip-trigger",...e})}function Ne({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(k2,{children:a.jsxs(C2,{"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(S2,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const fw="x-anthropic-billing-header:";function hw(e){return e.trimStart().toLowerCase().startsWith(fw)}function pw(e){return Ka(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function mw(e){if(!Ka(e))return!1;const t=Ye(e,"type"),n=Ye(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:hw(n)}function gw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!pw(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(mw(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 xw(e){return{depth:Number.POSITIVE_INFINITY}}function vw(e){try{const t=JSON.parse(e);return{kind:"json",data:Wo(t)}}catch{return{kind:"text"}}}function mo(e){const t=v.useMemo(()=>e===null?null:vw(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:xw(),[n]),[o,s]=v.useState(!1),[i,l]=v.useState(0),[c,u]=v.useState(0),[d,h]=v.useTransition(),m=v.useCallback(()=>{const p=!o,x=p&&r!==null?r.depth:0;h(()=>{s(p),l(x),u(f=>f+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:m,isPending:d,bulkDepth:i,bulkRevision:c}}function Wo(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=>Wo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Wo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Ru({className:e,orientation:t="horizontal",...n}){return a.jsx(t2,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ve("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const yw=us("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 Pu({className:e,variant:t="default",...n}){return a.jsx(n2,{"data-slot":"tabs-list","data-variant":t,className:ve(yw({variant:t}),e),...n})}function ft({className:e,...t}){return a.jsx(r2,{"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(o2,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function kn(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 bw=v.lazy(()=>Ft(()=>import("./CompareDrawer-D5A4bTfV.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),ww=v.lazy(()=>Ft(()=>import("./ReplayDialog-CxUk_TF0.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),_w=v.lazy(()=>Ft(()=>import("./RequestAnatomy-DIlzjgjJ.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),kw=v.lazy(()=>Ft(()=>import("./ResponseView-DQCuKJ1G.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),Cw=v.lazy(()=>Ft(()=>import("./StreamingChunkSequence-DHk4SGGL.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),Zi=v.lazy(()=>Ft(()=>import("./json-viewer-BbU0n8eM.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),Sw=v.lazy(()=>Ft(()=>import("./json-viewer-BbU0n8eM.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),jw=1200,Ew=12;function Nw(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=h=>{h.scrollIntoView({behavior:"smooth",block:"center"}),h.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(()=>{h.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??jw)},u=`[data-anatomy-path="${(h=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(h):h.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=h=>{const m=t.current;if(m!==null){const p=m.querySelector(u);if(p!==null){l(p);return}}h>0?window.requestAnimationFrame(()=>d(h-1)):n(null)};window.requestAnimationFrame(()=>d(Ew))},[t,r,o,n])}class Mu{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 h=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let x=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&x+1>=l)return i(this.buildValues(p[0].lastComponent,n,t));let f=-1/0,g=1/0;const y=()=>{for(let _=Math.max(f,-u);_<=Math.min(g,u);_+=2){let k;const C=p[_-1],S=p[_+1];C&&(p[_-1]=void 0);let O=!1;if(S){const A=S.oldPos-_;O=S&&0<=A&&A<l}const E=C&&C.oldPos+1<c;if(!O&&!E){p[_]=void 0;continue}if(!E||O&&C.oldPos<S.oldPos?k=this.addToPath(S,!0,!1,0,r):k=this.addToPath(C,!1,!0,1,r),x=this.extractCommon(k,n,t,_,r),k.oldPos+1>=c&&x+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[_]=k,k.oldPos+1>=c&&(g=Math.min(g,_-1)),x+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 h=n.slice(c,c+d.count);h=h.map(function(m,p){const x=r[u+p];return x.length>m.length?x:m}),d.value=this.join(h)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class Tw extends Mu{constructor(){super(...arguments),this.tokenize=Lu}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 Aw=new Tw;function Du(e,t,n){return Aw.diff(e,t,n)}function Lu(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 zw extends Mu{constructor(){super(...arguments),this.tokenize=Lu}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(Vo(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 Ow=new zw;function Iw(e,t,n){return Ow.diff(e,t,n)}function Vo(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]=Vo(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]=Vo(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Wi(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Vi([e,t]){return`${e}: ${t}`}function Ho(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 Rw(e,t){const n=Wi(e).map(Vi).join(`
|
|
92
|
-
`),r=Wi(t).map(Vi).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=Du(n,r);return{lines:Ho(o),isEmpty:!1}}function Hi(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function Pw(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Hi(n),s=Hi(r);if(o!==null&&s!==null){const l=Iw(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Ho(l),isEmpty:!1}}const i=Du(n,r);return{lines:Ho(i),isEmpty:!1}}function Mw(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 qi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ji=(e,t)=>Math.abs(e-t)<1.01,Dw=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let Cn;const Ki=()=>{if(Cn!==void 0)return Cn;if(typeof navigator>"u")return Cn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Cn=!0;const e=navigator.maxTouchPoints;return Cn=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Gi=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Lw=e=>e,Fw=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},$w=(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(Gi(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(Gi(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Er={passive:!0},Bw=typeof window>"u"?!0:"onscrollend"in window,Uw=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Bw;let i=0;const l=s?null:Dw(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=h=>()=>{i=n(r),l?.(),t(i,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,Er),s&&r.addEventListener("scrollend",d,Er),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},Zw=(e,t)=>Uw(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),Ww=(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"]},Vw=(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})},Hw=Vw;class qw{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:Lw,rangeExtractor:Fw,onChange:()=>{},measureElement:Ww,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,h=this.getMeasurements(),m=u>0?((r=h[0])==null?void 0:r.key)??i.getItemKey(0):null,p=u>0?((o=h[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)!==p)){const g=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;g&&(l=[g.key,this.getScrollOffset()-g.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=y)}}this.options=s,(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,!(!Ki()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Er),s.addEventListener("touchend",l,Er),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 h=d<c?this.getMeasurements()[d]:void 0;if(h){const m=h.start+i-this.getScrollOffset();Ji(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 x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const x=this.options.gap,f=n*2;let g=this._flatMeasurements;if(!g||g.length<f){const k=new Float64Array(f);g&&h>0&&k.set(g.subarray(0,h*2)),g=k,this._flatMeasurements=g}let y;if(h===0)y=r+o;else{const k=h-1;y=g[k*2]+g[k*2+1]+x}for(let k=h;k<n;k++){const C=s(k),S=d.get(C),O=typeof S=="number"?S:this.options.estimateSize(k);g[k*2]=y,g[k*2+1]=O,y+=O+x}const _=Mw(n,g,s);return this.measurementsCache=_,_}const m=this.measurementsCache.slice(0,h),p=new Array(l).fill(void 0);for(let x=0;x<h;x++){const f=m[x];f&&(p[f.lane]=x)}for(let x=h;x<n;x++){const f=s(x),g=this.laneAssignments.get(x);let y,_;const k=c==="estimate"||d.has(f);if(g!==void 0&&this.options.lanes>1){y=g;const E=p[y],A=E!==void 0?m[E]:void 0;_=A?A.end+this.options.gap:r+o}else{const E=this.options.lanes===1?m[x-1]:this.getFurthestMeasurement(m,x);_=E?E.end+this.options.gap:r+o,y=E?E.lane:x%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(x,y)}const C=d.get(f),S=typeof C=="number"?C:this.options.estimateSize(x),O=_+S;m[x]={index:x,start:_,size:S,end:O,key:f,lane:y},p[y]=x}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?Jw({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,h=r-d;if(h!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,x=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,lane:0},h,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()-p):x&&this.applyScrollAdjustment(h),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=Fu(0,r.length-1,s?l=>o[l*2]:l=>qi(r[l]).start,n);return qi(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&&(Ki()&&(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&&Ji(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 Fu=(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 Jw({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=Fu(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 h=Array(r).fill(n+t);for(;c>=0&&h.some(m=>m>=n);){const m=e[c];h[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 Yi=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Kw({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?Ln.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=v.useState(()=>new qw(r));return o.setOptions(r),Yi(()=>o._didMount(),[]),Yi(()=>o._willUpdate()),o}function Gw(e){return Kw({observeElementRect:$w,observeElementOffset:Zw,scrollToFn:Hw,...e})}const Yw=22,go=1e4;function Xw(e){return e==="added"?"+":e==="removed"?"-":" "}function Qw(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 e_=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=Gw({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>Yw,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>go,u=c?t.lines.slice(0,go):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 ${go.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(R0,{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(Qg,{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(t_,{virtualizer:i,lines:u}):a.jsx(o_,{lines:u})})]})};function t_({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",Qw(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:Xw(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function n_(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 r_(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 o_({lines:e}){const t=n_(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",r_(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 $u=v.memo(e_),s_={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function xo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Xi({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Rg:Ag,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 i_=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null,activeTab:l,tabActions:c,onReplay:u,slowResponseThresholdSeconds:d=0}){const h=Y1(e.responseStatus),m=e.elapsedMs!==null&&d>0&&e.elapsedMs>d*1e3,p=e.inputTokens!==null||e.outputTokens!==null,x=v.useMemo(()=>s?.join(", ")??null,[s]);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:f=>{(f.key==="Enter"||f.key===" ")&&(f.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",children:e.timestamp})]}),e.model!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Iu,{provider:Ou(e.model),className:"size-4"})})}),a.jsx(Ne,{children:e.model})]}),h!=="success"&&a.jsxs(Yr,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",s_[h]),children:[h==="server_error"?a.jsx(C0,{className:"size-3","aria-label":"Server error"}):h==="client_error"?a.jsx(xr,{className:"size-3","aria-label":"Client error"}):h==="pending"?a.jsx(In,{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:xo(e.elapsedMs)}),m&&a.jsx(xr,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:m?`Slow response: ${xo(e.elapsedMs)} exceeds ${xo(d*1e3)}`:"Elapsed response time"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Rn,{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(Xi,{trend:i?.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(Xi,{trend:i?.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(ls,{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(vr,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&s.length>0&&a.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[a.jsx(vr,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:x})]}),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(p0,{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(l0,{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(T0,{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:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),children:[c!==void 0&&l!==void 0&&(()=>{const f=c[l];return f===void 0?null:a.jsxs(a.Fragment,{children:[f.expansion!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:f.expansion.onToggle,disabled:f.expansion.isPending,"aria-pressed":f.expansion.isExpanded,"aria-label":f.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:f.expansion.isExpanded?a.jsx(Vg,{className:"size-3.5"}):a.jsx(Zg,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),f.diffWithRaw!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:ve("size-8",f.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:f.diffWithRaw.onToggle,"aria-pressed":f.diffWithRaw.active,"aria-label":f.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:a.jsx(i0,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),f.diffWithPrevious!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:f.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(g0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Compare this request with the immediately preceding one"})]}),f.copyText!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:f.onCopy,"aria-label":f.copyCopied?"Copied":f.copyLabel,children:f.copyCopied?a.jsx(Ut,{className:"size-3.5 text-emerald-500"}):a.jsx(Bn,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.copyCopied?"Copied to clipboard":f.copyLabel})]})]})})(),u!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:u,"aria-label":"Replay request",children:a.jsx(z0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Re-send this request to the provider"})]})]}),r?a.jsx($n,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(Pr,{className:"size-4 text-muted-foreground shrink-0"})]})})}),a_="/v1/chat/completions",l_="/chat/completions",c_="/v1/messages";class u_{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 vn=new u_;function d_(e){return vn.getByPath(e)??null}function f_(e){return d_(e)?.format??"unknown"}vn.registerPath(c_,"anthropic");vn.registerPath(a_,"openai");vn.registerPath(l_,"openai");function h_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function p_(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:h_(e.inputJson)}}}function Bu(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const h=1e3;let m=0,p=0;const x=[];for(const g of e.split(`
|
|
94
|
-
`)){const y=g.trim();if(y.startsWith("data: "))try{const _=JSON.parse(y.slice(6)),k=pg.safeParse(_);if(!k.success)continue;const C=k.data;switch(m===0&&(p=Date.now()),r===!0&&x.length<h&&x.push({index:m,timestamp:Date.now()-p,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 O=C.delta;O.type==="text_delta"&&S.type==="text"?S.text+=O.text:O.type==="thinking_delta"&&(S.type==="thinking"||S.type==="think")?S.thinking+=O.thinking:O.type==="signature_delta"&&(S.type==="thinking"||S.type==="think")?S.signature+=O.signature:O.type==="input_json_delta"&&S.type==="tool_use"&&(S.inputJson+=O.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:x,truncated:m>h});const f=[...o.entries()].sort(([g],[y])=>g-y).map(([,g])=>p_(g));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 m_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Qa.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=el.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 Bu(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}}};vn.register(m_);class g_{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 Is=new g_,x_="https://api.anthropic.com",v_={MiniMax:"https://api.minimaxi.com/anthropic"},y_={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(v_))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:x_},extractStream(e,t,n,r){return Bu(e,t,n,r)}};Is.register(y_);function Rs(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,h=!1,m=!1;const p=new Map,x=1e3;let f=0,g=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 O=JSON.parse(S);if(typeof O=="object"&&O!==null&&!Array.isArray(O)){const I=Object.getOwnPropertyDescriptor(O,"error");if(I!==void 0&&typeof I.value=="object"&&I.value!==null){const P=Object.getOwnPropertyDescriptor(I.value,"message");P!==void 0&&typeof P.value=="string"&&(t.error=P.value);continue}}const E=bg.safeParse(O);if(!E.success)continue;const A=E.data;if(f===0&&(g=Date.now()),r===!0&&y.length<x&&y.push({index:f,timestamp:Date.now()-g,type:"chat.completion.chunk",data:A}),f++,m||(o=A.id,s=A.model,m=!0),!h&&A.usage!==void 0&&A.usage!==null){if(u=A.usage.prompt_tokens??0,d=A.usage.completion_tokens??0,t.inputTokens=u,typeof O=="object"&&O!==null&&!Array.isArray(O)){const I=Object.getOwnPropertyDescriptor(O,"usage");if(I!==void 0&&typeof I.value=="object"&&I.value!==null){const P=Object.getOwnPropertyDescriptor(I.value,"prompt_tokens_details");if(P!==void 0&&typeof P.value=="object"&&P.value!==null){const W=Object.getOwnPropertyDescriptor(P.value,"cached_tokens");W!==void 0&&typeof W.value=="number"&&(t.cacheReadInputTokens=W.value)}}}h=!0}for(const I of A.choices){const P=I.delta;P.content!==void 0&&P.content!==null&&(i+=P.content),P.reasoning_content!==void 0&&P.reasoning_content!==null&&(l+=P.reasoning_content),P.thinking!==void 0&&P.thinking!==null&&(l+=P.thinking);const W=P.think;if(W!=null&&(l+=W),I.finish_reason!==void 0&&I.finish_reason!==null&&(c=I.finish_reason),P.tool_calls!==void 0&&P.tool_calls!==null)for(const j of P.tool_calls){let z=p.get(j.index);z===void 0&&(z={index:j.index,type:"function",function:{name:"",arguments:""}},p.set(j.index,z)),j.id!==void 0&&(z.id=j.id),j.function?.name!==void 0&&(z.function.name+=j.function.name),j.function?.arguments!==void 0&&(z.function.arguments+=j.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:f>x}),h||(d=Math.ceil(i.length/4)),t.outputTokens=d;const _={role:"assistant",content:i};return l&&(_.reasoning_content=l),p.size>0&&(_.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:_,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const b_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=rl.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=sl(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 Rs(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}}};vn.register(b_);const w_="https://api.openai.com/v1",__={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:w_},extractStream(e,t,n,r){return Rs(e,t,n,r)}};Is.register(__);const k_="https://dashscope.aliyuncs.com/compatible-mode/v1",C_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return k_},extractStream(e,t,n){return Rs(e,t,n)}};Is.register(C_);function Uu(e,t){for(const n of Array.from(e))t(n)}const S_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Zu(e){if(e.length===0)return 0;let t=0,n=0;return Uu(e,r=>{S_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Wu(e){if(e.length===0)return 0;let t=0;return Uu(e,()=>{t+=1}),t}function It(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const rn={parsed:null,toolNames:null};function j_(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 E_(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 N_(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 vo(e,t,n,r){return{role:e,label:t,text:n,size:Zu(n),characters:Wu(n),path:r}}const T_={format:"anthropic",analyzeRequest(e){if(e===null)return It(e);try{const t=Qa.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=el.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=E_(t.system);r.length>0&&n.push(vo("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=j_(s.content);n.push(vo(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=N_(t.tools);n.push(vo("tools","tools",r,"/tools"))}return n.length>0?n: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,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
|
|
99
|
-
`)}function z_(e){const t=[],n=A_(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 O_(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 Qi(e,t,n,r){return{role:e,label:t,text:n,size:Zu(n),characters:Wu(n),path:r}}const I_={format:"openai",analyzeRequest(e){if(e===null)return It(e);try{const t=rl.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=sl(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=z_(s);n.push(Qi(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=O_(t.tools);n.push(Qi("tools","tools",r,"/tools"))}return n.length>0?n:null}},R_={format:"unknown",analyzeRequest(e){return It(e)},analyzeResponse(){return rn},anatomySegments(){return null}},P_={anthropic:T_,openai:I_,unknown:R_};function M_(e){return P_[e]}function Nr(e){const t=f_(e.path);return t==="unknown"?e.apiFormat:t}function ea(e,t,n){return e==="anthropic"&&t==="full"&&n}function D_(e,t){return e==="full"&&t}function L_(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Yt(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function F_({active:e,onClick:t}){return a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(f0,{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 $_=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>Pw(e,t),[e,t]);return a.jsx($u,{result:r,emptyLabel:n})}),B_=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>Rw(e,t),[e,t]);return a.jsx($u,{result:r,emptyLabel:n})}),U_=v.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrend:o=null,onCompareWithPrevious:s}){const[i,l]=v.useState(!1),[c,u]=v.useState(!1),[d,h]=v.useState(!1),[m,p]=v.useState(!1),[x,f]=v.useState("request"),[g,y]=v.useState(null),_=v.useRef(null),k=Nr(e),C=M_(k),S=v.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),O=v.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),A=v.useMemo(()=>!n||k!=="anthropic"||e.rawRequestBody===null?null:gw(e.rawRequestBody).body,[e.rawRequestBody,k,n])??e.rawRequestBody,I=mo(A),P=mo(e.rawRequestBody),W=mo(e.responseText),j=v.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),z=v.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),w=kn(A),R=kn(e.rawRequestBody),q=kn(j),L=kn(z),B=kn(e.responseText),J=v.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:A,copyCopied:w.copied,onCopy:w.copy,expansion:{isExpanded:I.isExpanded,isPending:I.isPending,onToggle:I.toggle},diffWithRaw:L_(k,t,n,e.rawRequestBody!==null)?{active:m,onToggle:()=>p(!m)}:void 0,diffWithPrevious:s===void 0?void 0:()=>{s(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:R.copied,onCopy:R.copy,expansion:{isExpanded:P.isExpanded,isPending:P.isPending,onToggle:P.toggle}},headers:{copyLabel:"Copy headers",copyText:j,copyCopied:q.copied,onCopy:q.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:z,copyCopied:L.copied,onCopy:L.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:B.copied,onCopy:B.copy,expansion:{isExpanded:W.isExpanded,isPending:W.isPending,onToggle:W.toggle}}}),[A,w,I,m,e.rawRequestBody,R,P,j,q,z,L,e.responseText,B,W,k,t,n,s]),se=v.useMemo(()=>I.parsedData!==null?C.anatomySegments(I.parsedData):null,[C,I.parsedData]),Z=v.useMemo(()=>{if(se!==null)return new Set(se.map(te=>te.path))},[se]),U=Nw({containerRef:_,setExpandToPath:y,ensureTabActive:()=>{x!=="request"&&f("request")}});return a.jsxs($e,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(i_,{log:e,messageCount:S.messageCount,toolCount:S.toolCount,expanded:i,onToggle:()=>l(!i),responseToolNames:O.toolNames,cacheTrend:o,slowResponseThresholdSeconds:r,activeTab:x,tabActions:J,onReplay:s===void 0?void 0:()=>{u(!0)}}),i&&a.jsx("div",{onClick:te=>te.stopPropagation(),onKeyDown:te=>te.stopPropagation(),children:a.jsxs(Ru,{value:x,onValueChange:f,children:[a.jsxs(Pu,{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"}),ea(k,t,n)&&a.jsx(ft,{value:"raw-request",children:"Raw Request"}),a.jsx(ft,{value:"request",children:"Request"}),se!==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"})]}),ea(k,t,n)&&a.jsx(ht,{value:"raw-request",children:x==="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"}):P.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Zi,{data:P.parsedData,bulkDepth:P.bulkDepth,bulkRevision:P.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(ht,{value:"request",children:x==="request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:m?a.jsx($_,{rawBody:e.rawRequestBody,displayedBody:A,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):a.jsx("div",{ref:_,children:A===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):I.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Zi,{data:I.parsedData,bulkDepth:I.bulkDepth,bulkRevision:I.bulkRevision,anatomyPaths:Z,expandToPath:g})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:A})})})}),se!==null&&a.jsx(ht,{value:"anatomy",children:x==="anatomy"&&a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(_w,{parsed:null,inputTokens:e.inputTokens??null,segments:se,onSegmentActivate:U})})}),t==="full"&&a.jsx(ht,{value:"headers",children:x==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:D_(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(F_,{active:d,onClick:te=>{te.stopPropagation(),h(!d)}})}),d?a.jsx(B_,{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:x==="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:x==="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(Sw,{text:e.responseText,defaultExpandDepth:0,bulkDepth:W.bulkDepth,bulkRevision:W.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(Cw,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(ht,{value:"parsed",children:x==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(kw,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:k,error:e.error})})})})]})})]}),a.jsx(v.Suspense,{fallback:null,children:a.jsx(ww,{log:e,open:c,onOpenChange:u})})]})});function Z_({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,h=v.useMemo(()=>jr(s),[s]),m=v.useMemo(()=>G2(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:x=>{x.stopPropagation(),l()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(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)",...p,children:a.jsx(h,{className:ve("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...p,children:a.jsx(h,{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(h,{className:ve("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(h,{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 W_({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-amber-500/20 bg-amber-500/5 px-2.5 py-1.5 text-xs",children:[a.jsx(vr,{className:"size-3.5 shrink-0 text-amber-400"}),a.jsx("span",{className:"font-mono font-semibold text-amber-300",children:t.name}),a.jsxs("span",{className:"font-mono text-muted-foreground",children:["#",t.logId]}),t.argumentsPreview!==null&&a.jsxs(a.Fragment,{children:[a.jsx(Pr,{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 ta=180;function V_(e,t){return e||t}function H_(e,t,n){return e>1&&t&&!n}function q_(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:D2(o)});const s=n[n.length-1];s!==void 0&&Tu(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function J_(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=Nr(o),l=Nr(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function Vu(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Hu(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>ta?`${n.slice(0,ta-1)}...`:n}function K_(e){const t=Vu(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:Hu(Ye(o,"input"))})}return r}function G_(e){const t=Vu(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:Hu(Ye(c,"arguments"))})}}return r}function qu(e){switch(Nr(e)){case"anthropic":return K_(e);case"openai":return G_(e);case"unknown":return[]}}function Y_(e,t,n=0){let r=0,o=0,s=0,i=0,l=0,c=0,u=0,d=0,h=null,m=0;for(const p of e)p.responseStatus===null?o+=1:p.responseStatus>=400&&(r+=1),p.elapsedMs!==null&&t>0&&p.elapsedMs>t*1e3&&(s+=1),p.inputTokens!==null&&(i+=p.inputTokens),p.outputTokens!==null&&(l+=p.outputTokens),p.cacheCreationInputTokens!==null&&(c+=p.cacheCreationInputTokens),p.cacheReadInputTokens!==null&&(u+=p.cacheReadInputTokens),p.elapsedMs!==null&&(d+=p.elapsedMs,h=h===null?p.elapsedMs:Math.max(h,p.elapsedMs)),m+=qu(p).length;return{llmCallCount:e.length,toolCallCount:m,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:i,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:h,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function yo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const X_=v.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0}){const u=t.length-1,d=t[u]?.stopReason??null,h=d!==null?Tu(d):!1,m=t[u]?.log.responseStatus===null,p=t.length===1,x=H_(t.length,h,m),[f,g]=v.useState(!1),y=v.useRef(!1);v.useEffect(()=>{x?h&&!y.current&&g(!0):g(!1),y.current=h},[x,h]);const _=v.useCallback(()=>{x&&g(z=>!z)},[x]),k=v.useMemo(()=>{let z=0,w=0,R=null,q=!1;for(const L of t)L.log.inputTokens!==null&&(z+=L.log.inputTokens,q=!0),L.log.outputTokens!==null&&(w+=L.log.outputTokens,q=!0),L.log.elapsedMs!==null&&(R=R===null?L.log.elapsedMs:Math.max(R,L.log.elapsedMs));return{totalInput:z,totalOutput:w,hasTokens:q,maxElapsed:R}},[t,u]),C=v.useMemo(()=>{const z=new Set;for(const w of t){const R=Ou(w.log.model);R!=="unknown"&&z.add(R)}return[...z]},[t]),S=v.useMemo(()=>jr(t[0]?.log.id??0),[t]),O=v.useMemo(()=>jr(t[u]?.log.id??0),[t,u]),E=c%2===0?"bg-muted/10":"bg-muted/25",A=k.maxElapsed!==null&&o>0&&k.maxElapsed>o*1e3,I=v.useMemo(()=>{const z=new Map;for(const w of t){const R=qu(w.log);R.length>0&&z.set(w.log.id,R)}return z},[t]),[P,W]=v.useState(0),j=v.useRef(null);return v.useEffect(()=>{const z=j.current;if(!z)return;let w=0;const R=new ResizeObserver(()=>{window.cancelAnimationFrame(w),w=window.requestAnimationFrame(()=>W(q=>q+1))});return R.observe(z),()=>{R.disconnect(),window.cancelAnimationFrame(w)}},[]),a.jsx("div",{ref:j,className:ve("border rounded-lg",m?"border-amber-500/10":"border-transparent"),children:f?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:_,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),_())},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:z=>{z.stopPropagation(),_()},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),_())},children:a.jsx(S,{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:z=>{z.stopPropagation(),_()},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),_())},children:a.jsx(O,{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",E),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[u]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(z=>a.jsx(Iu,{provider:z,className:"size-4"},z))}),k.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",A?"text-amber-400":"text-muted-foreground"),children:[a.jsx(Rt,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:yo(k.maxElapsed)}),A&&a.jsx(xr,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:A?`Slow response: ${yo(k.maxElapsed)} exceeds ${yo(o*1e3)}`:"Slowest request in this turn"})]})}),k.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Rn,{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(k.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Be(k.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(Pr,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((z,w)=>{const{log:R,stopReason:q}=z,L=w===0;return a.jsxs("div",{className:"flex items-stretch",children:[L?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(Z_,{stopReason:q,isPending:R.responseStatus===null,isFirst:w===0,isTurnStart:L,isOnlyEntry:p,crabIndex:R.id%12,collapsible:x&&L,onToggle:_}),a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg",E),children:[a.jsx(U_,{log:R,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrend:s?.get(R.id)??null,onCompareWithPrevious:l.has(R.id)?i:void 0}),a.jsx(W_,{events:I.get(R.id)??[]})]})]},R.id)})})}),Ps=Ze(["episode","procedure","preference","project-fact"]),Q_=Ze(["draft","promoted","failed"]),Ju=ne({source:xe("agent-inspector"),sessionId:$(),logIds:_e(he().int().positive()),project:$().nullable(),models:_e($())}),ek=ne({redacted:Ue(),patterns:_e($())}),tk=ne({id:$(),type:Ps,title:$(),content:$(),tags:_e($()),source:xe("agent-inspector"),sessionId:$(),logIds:_e(he().int().positive()),evidence:Ju,status:Q_,createdAt:$(),updatedAt:$(),openClawMemoryId:$().nullable(),error:$().nullable(),redaction:ek});ne({idempotencyKey:$(),type:Ps,title:$(),content:$(),tags:_e($()),source:xe("agent-inspector"),project:$().nullable(),evidence:Ju});const nk=ne({id:$(),type:Ps.or($()),title:$(),content:$(),score:he().nullable(),source:$().nullable(),project:$().nullable(),evidence:So().optional()});ne({results:_e(nk),warning:$().nullable()});const rk=ne({candidates:_e(tk)});function na(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function ok(e,t){if(e===null||t===null)return null;const n=r=>new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return`${n(e)} - ${n(t)}`}function sk(e){const t=document.getElementById(`log-${String(e)}`);t instanceof HTMLElement&&(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),t.getAttribute("data-nav-action")==="expand"&&t.click())}function ik({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("button",{type:"button",onClick:()=>sk(n),className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-blue-400 transition-colors hover:bg-muted hover:text-blue-300",children:["#",n]},n))})]},t.id))})}function ak({logs:e,scopeId:t,slowResponseThresholdSeconds:n}){const[r,o]=v.useState([]),[s,i]=v.useState({status:"idle",error:null}),l=v.useMemo(()=>Y_(e,n,r.length),[r.length,e,n]),c=v.useMemo(()=>ok(l.startedAt,l.endedAt),[l.endedAt,l.startedAt]),u=v.useCallback(()=>{e.length===0||s.status==="loading"||(i({status:"loading",error:null}),(async()=>{try{const d=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!d.ok){const m=await Tn(d,`Candidate generation failed with ${String(d.status)}`);i({status:"failed",error:m});return}const h=await Ot(d,rk);o(h.candidates),i({status:"ready",error:null})}catch(d){i({status:"failed",error:d instanceof Error?d.message:"Candidate response was invalid"})}})())},[s.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:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[a.jsx(ls,{className:"size-3.5 text-blue-400"}),l.llmCallCount," LLM"]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(vr,{className:"size-3.5 text-amber-400"}),l.toolCallCount," tools"]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Rn,{className:"size-3.5 text-emerald-400"}),a.jsxs("span",{className:"font-mono",children:[Be(l.totalInputTokens)," / ",Be(l.totalOutputTokens)]})]}),(l.totalCacheCreationInputTokens>0||l.totalCacheReadInputTokens>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Rn,{className:"size-3.5 text-purple-400"}),a.jsxs("span",{className:"font-mono",children:["+",Be(l.totalCacheCreationInputTokens)," / ~",Be(l.totalCacheReadInputTokens)]})]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Rt,{className:"size-3.5"}),a.jsx("span",{className:"font-mono",children:na(l.totalElapsedMs)}),l.maxElapsedMs!==null&&a.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",na(l.maxElapsedMs)]})]}),c!==null&&a.jsx("span",{className:"font-mono text-muted-foreground/70",children:c}),(l.failedCallCount>0||l.pendingCallCount>0||l.slowCallCount>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[a.jsx(xr,{className:"size-3.5"}),a.jsxs("span",{className:"font-mono",children:[l.failedCallCount," fail / ",l.pendingCallCount," pending /"," ",l.slowCallCount," slow"]})]}),a.jsx("span",{className:"flex-1"}),a.jsxs(Yr,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:[l.knowledgeCandidateCount," memory"]}),a.jsxs(Me,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:u,disabled:s.status==="loading",children:[s.status==="loading"?a.jsx(In,{className:"size-3.5 animate-spin"}):a.jsx(Mg,{className:"size-3.5"}),"Candidate"]})]}),s.status==="failed"&&a.jsx("p",{className:"mt-2 text-xs text-destructive",children:s.error}),a.jsx(ik,{candidates:r})]})}function lk(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 ck=v.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1}){const[u,d]=v.useState(!1),h=v.useMemo(()=>lk(e.logs),[e.logs]),m=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),x=R2(e.logs),f=e.logs.some(y=>y.responseStatus===null),g=v.useMemo(()=>q_(e.logs),[e.logs]);return a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(O2,{conversationId:e.conversationId,startTime:m,endTime:p,totalCalls:e.logs.length,totalInputTokens:h.totalInputTokens,totalOutputTokens:h.totalOutputTokens,apiFormat:I2(e.logs),expanded:u,onToggle:()=>d(!u),hideApiFormat:x,isLoading:f,userAgent:e.logs[0]?.userAgent??null,onClear:()=>l(e.logs.map(y=>y.id))}),V_(c,u)&&a.jsxs("div",{children:[a.jsx(ak,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r}),g.map(y=>a.jsx(X_,{entries:y.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:y.turnIndex},y.turnIndex))]})]})});function uk({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 dk="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 fk({className:e}){return a.jsx("img",{src:dk,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function ra({...e}){return a.jsx(Bb,{"data-slot":"select",...e})}function oa({...e}){return a.jsx(Zb,{"data-slot":"select-value",...e})}function sa({className:e,size:t="default",children:n,...r}){return a.jsxs(Ub,{"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(Wb,{asChild:!0,children:a.jsx($n,{className:"size-4 opacity-50"})})]})}function ia({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(Vb,{children:a.jsxs(Hb,{"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(hk,{}),a.jsx(qb,{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(pk,{})]})})}function ir({className:e,children:t,...n}){return a.jsxs(Jb,{"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(Gb,{children:a.jsx(Ut,{className:"size-4"})})}),a.jsx(Kb,{children:t})]})}function hk({className:e,...t}){return a.jsx(Yb,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Bg,{className:"size-4"})})}function pk({className:e,...t}){return a.jsx(Xb,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx($n,{className:"size-4"})})}function mk(){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 gk(){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 xk(){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 vk=ne({name:$(),apiKey:$(),format:Ze(["anthropic","openai"]),anthropicBaseUrl:$(),openaiBaseUrl:$(),models:_e($()),sourceTool:Ze(["claude-code","opencode","mimo-code"]),alreadyExists:Ue()}),yk=ne({providers:_e(vk),warnings:_e($()).optional()}),bk=ne({success:Ue().optional(),imported:he().optional(),message:$().optional(),errors:_e($()).optional()}),wk={"claude-code":mk,opencode:gk,"mimo-code":xk};function _k({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([]),[h,m]=v.useState(new Set),[p,x]=v.useState(!1),[f,g]=v.useState(null),[y,_]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),m(new Set),g(null),_(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(A=>{const I=yk.safeParse(A);if(!I.success){i(`Invalid response: ${I.error.message}`);return}c(I.data.providers),d(I.data.warnings??[]);const P=new Set;I.data.providers.forEach((W,j)=>{W.alreadyExists||P.add(j)}),m(P)}):E.text().then(A=>{i(`Scan failed (${E.status}): ${A}`)})).catch(E=>{i(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const C=v.useCallback(E=>{m(A=>{const I=new Set(A);return I.has(E)?I.delete(E):I.add(E),I})},[]),S=v.useCallback(()=>{const E=l.filter((P,W)=>h.has(W));if(E.length===0)return;x(!0),_(null),g(null);const A=new Date().toISOString(),I=E.map(P=>({id:window.crypto.randomUUID(),name:P.name,apiKey:P.apiKey,format:P.format,anthropicBaseUrl:P.anthropicBaseUrl,openaiBaseUrl:P.openaiBaseUrl,models:P.models,createdAt:A,updatedAt:A}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:I})}).then(P=>P.json()).then(P=>{const W=bk.safeParse(P);if(!W.success){_(`Invalid response: ${W.error.message}`);return}const j=W.data;c(z=>z.map((w,R)=>h.has(R)?{...w,alreadyExists:!0}:w)),m(new Set),j.errors!==void 0&&j.errors.length>0&&j.message!==void 0?g(j.message):g(`Imported ${j.imported??E.length} provider(s)`),n()}).catch(P=>{_(P instanceof Error?P.message:String(P))}).finally(()=>{x(!1)})},[l,h,n]),O=l.some(E=>!E.alreadyExists);return a.jsx(Ts,{open:e,onOpenChange:t,children:a.jsxs(As,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(zs,{children:[a.jsx(Os,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(In,{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(On,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,A)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&a.jsx("input",{type:"checkbox",checked:h.has(A),disabled:p,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 I=wk[E.sourceTool];return I===void 0?null:a.jsx(I,{})})(),E.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,A)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(On,{className:"size-3"}),E]},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(Me,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(In,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Me,{size:"sm",onClick:S,disabled:!O||h.size===0||p,children:[a.jsx(ss,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${h.size})`]})]})]})})}function Ku(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const kk={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function Ck(e){return Object.prototype.hasOwnProperty.call(e,"success")}function Sk(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function jk(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(Rt,{...t});case"network_unreachable":return a.jsx(J0,{...t});case"connection_refused":return a.jsx(G0,{...t});case"auth_failed":return a.jsx(y0,{...t});case"rate_limited":return a.jsx(u0,{...t});case"server_error":return a.jsx(L0,{...t});case"invalid_response":return a.jsx(Gg,{...t});case"unknown":return a.jsx(On,{...t});default:return a.jsx(On,{...t})}}function ar({result:e}){const[t,n]=v.useState(!1);if(!Ck(e))return Sk(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(_0,{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(ul,{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(Jg,{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:[jk(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(is,{className:"size-3"}):a.jsx(as,{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 Ek(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 Nk({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[m,p]=v.useState(!1);function x(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const f=e.apiDocsUrl??Object.entries(kk).find(([g])=>e.name.toLowerCase().includes(g))?.[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(cl,{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(g=>a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:g},g))}),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:Ku(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>u(g=>!g),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?a.jsx(is,{className:"size-4"}):a.jsx(as,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:x,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(Bn,{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(ar,{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(ar,{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 ",Ek(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:()=>p(g=>!g),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(([g,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:g}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(ar,{result:y.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(ar,{result:y.openai.nonStreaming})})]},g))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(ul,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(j0,{className:"size-3"}),"Edit"]}),a.jsxs(Me,{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(dl,{className:"size-3"}),"Delete"]})]})]})}const Tk={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"}},aa=["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"],la=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function Ak({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),h=e?.models,[m,p]=v.useState(h!==void 0&&h.length>0?h:[""]),[x,f]=v.useState("anthropic"),[g,y]=v.useState(e?.anthropicBaseUrl??""),[_,k]=v.useState(e?.openaiBaseUrl??""),[C,S]=v.useState(e?.apiDocsUrl??""),[O,E]=v.useState(e?.source),[A,I]=v.useState({}),[P,W]=v.useState(!1),[j,z]=v.useState(null),w=v.useRef([]);v.useEffect(()=>{if(j===null)return;const K=j;function ue(X){if(!(X.target instanceof Node))return;const ie=w.current[K];ie!=null&&!ie.contains(X.target)&&z(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[j]);const[R,q]=v.useState(!1),[L,B]=v.useState(!1),J=r.toLowerCase().includes("minimax"),se=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),p((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),S(e.apiDocsUrl??""),E(e.source),q(!1),B(!1))},[e]),v.useEffect(()=>{const K=r.toLowerCase();for(const[ue,X]of Object.entries(Tk))if(K.includes(ue)){X.format==="anthropic"&&!R?y(X.baseUrl):X.format==="openai"&&!L&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!C&&S(X.apiDocsUrl),ue==="minimax"&&m.length===1&&m[0]===""&&p([aa[0]??""]),ue==="alibaba"&&m.length===1&&m[0]===""&&p([la[0]??""]);break}},[r]);function U(){const K={};return r.trim()||(K.name="Name is required"),s.trim()||(K.apiKey="API key is required"),(m.length===0||m.every(ue=>!ue.trim()))&&(K.models="At least one model is required"),g.trim()&&!te(g.trim())&&(K.anthropicBaseUrl="Invalid URL format"),_.trim()&&!te(_.trim())&&(K.openaiBaseUrl="Invalid URL format"),!g.trim()&&!_.trim()&&(K.format="At least one format URL (Anthropic or OpenAI) is required"),I(K),Object.keys(K).length===0}function te(K){try{return new URL(K),!0}catch{return!1}}function ee(K){if(K.preventDefault(),!!U()){W(!0);try{t({name:r.trim(),apiKey:s.trim(),models:m.map(ue=>ue.trim()).filter(ue=>ue!==""),anthropicBaseUrl:g.trim()||void 0,openaiBaseUrl:_.trim()||void 0,apiDocsUrl:C.trim()||void 0,source:O})}finally{W(!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:K=>o(K.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:O??"",onChange:K=>E(K.target.value==="company"||K.target.value==="personal"?K.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:Ku(s),onChange:K=>i(K.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(K=>!K),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(is,{className:"size-4"}):a.jsx(as,{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(Bn,{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((K,ue)=>a.jsxs("div",{ref:X=>{w.current[ue]=X},className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:K,onChange:X=>{p(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:J||se?"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"}),(J||se)&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>z(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($n,{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:(J?aa:la).map(X=>a.jsx("button",{type:"button",onClick:()=>{p(ie=>{const ae=[...ie];return ae[ue]=X,ae}),z(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:()=>p(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:()=>p(K=>[...K,""]),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 ${x==="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 ${x==="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})]}),x==="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:g,onChange:K=>{q(!0),y(K.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."})]}),x==="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:K=>{B(!0),k(K.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:K=>S(K.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(Me,{type:"button",variant:"outline",onClick:n,disabled:P,children:"Cancel"}),a.jsx(Me,{type:"submit",disabled:P,children:P?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const qo=ne({id:$(),name:$(),apiKey:$(),model:$().optional(),models:_e($()).min(1),format:Ze(["anthropic","openai"]).optional(),baseUrl:$().optional(),anthropicBaseUrl:$().optional(),openaiBaseUrl:$().optional(),authHeader:Ze(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:$().optional(),source:Ze(["company","personal"]).optional(),createdAt:$(),updatedAt:$()}),zk=Ze(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),Ok=ne({message:$(),type:zk,details:$().optional(),hint:$().optional()}),Ik=ne({type:Ze(["text","thinking"]),text:$().optional(),thinking:$().optional()}),Rk=ne({success:Ue(),error:Ok.optional(),model:$().optional(),inputTokens:he().optional(),outputTokens:he().optional(),cacheCreationInputTokens:he().optional(),cacheReadInputTokens:he().optional(),latencyMs:he().optional(),content:_e(Ik).optional(),rawResponse:$().optional(),streaming:Ue().optional(),streamingChunks:ne({chunks:_e(il),truncated:Ue().default(!1)}).optional(),requestHeaders:mt($(),$()).optional()}),ca=vt([Rk,ne({notConfigured:xe(!0)}),ne({testing:xe(!0)})]),Tr=ne({nonStreaming:ca,streaming:ca}),Pk=ne({anthropic:Tr,openai:Tr}),Mk=ne({anthropic:Tr,openai:Tr,models:mt($(),Pk).optional(),testedAt:$().optional()});function Dk(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function ua(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const Lk=ne({providerConfig:$()}),Fk=ne({success:Ue().optional(),imported:he().optional(),message:$().optional(),errors:_e($()).optional()}),$k=30,bo="Network error: could not reach the server. Is the proxy running?";function da(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 Bk(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 Uk({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),[h,m]=v.useState(),[p,x]=v.useState(null),[f,g]=v.useState({}),[y,_]=v.useState(new Set),[k,C]=v.useState({}),[S,O]=v.useState(null),[E,A]=v.useState(!1),[I,P]=v.useState(null),[W,j]=v.useState(!1),[z,w]=v.useState(!1),[R,q]=v.useState(null),[L,B]=v.useState("all"),J=v.useRef(null),se=v.useRef(null),Z=e??[],U=v.useMemo(()=>{const F=L==="all"?Z:Z.filter(V=>V.source===L);return L==="all"?[...F].sort((V,M)=>{const Q={personal:0,company:1};return(Q[V.source??""]??2)-(Q[M.source??""]??2)}):F},[Z,L]),te=n??f,ee=r??y,K=o??k,ue=c?(F,V)=>c(F,V):(F,V)=>{C(V===void 0?M=>{const Q={...M};return delete Q[F],Q}:M=>({...M,[F]:V}))};v.useEffect(()=>{(async()=>{try{const F=await fetch("/api/config/paths");if(F.ok){const V=await Ot(F,Lk);O(V.providerConfig)}}catch{}})()},[]);const X=v.useCallback(F=>{se.current!==null&&clearTimeout(se.current),P(F),J.current?.scrollTo({top:J.current.scrollHeight,behavior:"smooth"}),se.current=setTimeout(()=>{P(null),se.current=null},2e3)},[]);v.useEffect(()=>()=>{se.current!==null&&clearTimeout(se.current)},[]);const ie=v.useCallback(()=>{s?.().catch(()=>{})},[s]),ae=v.useCallback((F,V)=>{i?i(F,V):g(M=>({...M,[F]:V}))},[i]),pe=v.useCallback((F,V)=>{if(l){l(F,V);return}_(M=>{const Q=new Set(M);return V?Q.add(F):Q.delete(F),Q})},[l]),fe=v.useCallback(async F=>{ae(F,Dk()),pe(F,!0);const V=new AbortController;let M=$k;ue(F,M);const Q=setInterval(()=>{M--,ue(F,M),M<=0&&(clearInterval(Q),V.abort())},1e3);try{const oe=await fetch(`/api/providers/${F}/test`,{method:"POST",signal:V.signal});if(oe.ok){const re=await Ot(oe,Mk);ae(F,re),await Bk(F,re)}else ae(F,ua(`HTTP ${oe.status}: ${oe.statusText}`,"server_error"))}catch(oe){oe instanceof Error&&oe.name==="AbortError"&&ae(F,ua("Request timed out","timeout"))}finally{clearInterval(Q),ue(F,void 0),pe(F,!1)}},[ue,ae,pe]);function we(F){(async()=>{try{const V=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(da(F))});if(!V.ok){x(await Tn(V,"Failed to add provider"));return}const M=await Ot(V,qo);d(!1),X(M.id),ie(),await fe(M.id)}catch{x(bo)}})()}function Te(F){h&&(async()=>{try{const V=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(da(F))});if(!V.ok){x(await Tn(V,"Failed to update provider"));return}const M=await Ot(V,qo);m(void 0),X(M.id),ie(),((F.apiKey??"")!==(h.apiKey??"")||JSON.stringify(F.models)!==JSON.stringify(h.models)||(F.anthropicBaseUrl??"")!==(h.anthropicBaseUrl??"")||(F.openaiBaseUrl??"")!==(h.openaiBaseUrl??""))&&await fe(M.id)}catch{x(bo)}})()}function b(F){q(F),w(!0)}function Y(){const F=R;F!==null&&(async()=>{let V;try{V=await fetch(`/api/providers/${F}`,{method:"DELETE"})}catch{x(bo);return}if(!V.ok){x(await Tn(V,"Failed to delete provider"));return}ie()})()}const H=v.useRef(null);function T(F){const V="/api/providers/export";(async()=>{try{const M=await fetch(V);if(!M.ok){x("Failed to export providers");return}const Q=await M.blob(),oe=URL.createObjectURL(Q),re=document.createElement("a");re.href=oe,re.download=M.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(re),re.click(),document.body.removeChild(re),URL.revokeObjectURL(oe)}catch{x("Failed to export providers")}})()}function N(){H.current?.click()}function D(F){const V=F.target.files?.[0];V&&(async()=>{try{const M=await V.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),oe=await Ot(Q,Fk);Q.ok&&oe.imported!==void 0&&oe.imported>0?(ie(),x(null)):oe.errors&&oe.errors.length>0?x(oe.errors.join("; ")):x(oe.message??"Import failed")}catch{x("Failed to import providers")}F.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||h?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:h?"Edit Provider":"Add New Provider"})}),a.jsx(Ak,{provider:h,onSubmit:h?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(Me,{variant:"outline",size:"sm",onClick:()=>T(),className:"gap-1 hover:bg-muted",children:[a.jsx(ss,{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(Me,{variant:"outline",size:"sm",onClick:N,className:"gap-1 hover:bg-muted",children:[a.jsx(W0,{className:"size-3"}),"Import"]})}),a.jsx(Ne,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:H,accept:".json",onChange:D,style:{display:"none"}}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"gap-1",children:[a.jsx(M0,{className:"size-3"}),"Scan"]})}),a.jsx(Ne,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Me,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(No,{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:E?a.jsx(Ut,{className:"size-3 text-green-500"}):a.jsx(Bn,{className:"size-3"})})}),a.jsx(Ne,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(On,{className:"size-4 shrink-0"}),p]}),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(Me,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(No,{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(F=>a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>B(F),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${L===F?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:F==="all"?"All":F==="personal"?"Personal":"Company"})}),a.jsx(Ne,{children:F==="all"?"Show all providers":F==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},F))}),a.jsx("div",{ref:J,className:"space-y-3",children:U.map(F=>a.jsx(Nk,{provider:F,testResults:te[F.id],isTesting:ee.has(F.id),testingTimeLeft:K[F.id],isHighlighted:F.id===I,onEdit:V=>m(V),onDelete:b,onTest:V=>{fe(V)}},F.id))})]}),a.jsx(_k,{open:W,onOpenChange:j,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(Nu,{open:z,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Y})]})}async function Zk(e){return Fn(e,qo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Wk(){const e=Ko("/api/providers",Zk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function Vk(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=Wk(),[l,c]=v.useState({}),[u,d]=v.useState(new Set),[h,m]=v.useState({}),p=v.useCallback((g,y)=>{c(_=>({..._,[g]:y}))},[]),x=v.useCallback((g,y)=>{d(_=>{const k=new Set(_);return y?k.add(g):k.delete(g),k})},[]),f=v.useCallback((g,y)=>{m(_=>{if(y===void 0){const k={..._};return delete k[g],k}return{..._,[g]:y}})},[]);return a.jsxs(Ts,{open:e,onOpenChange:t,children:[a.jsx(E2,{asChild:!0,children:a.jsxs(Me,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx($0,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(As,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(zs,{children:a.jsx(Os,{children:"Settings"})}),a.jsxs(Ru,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Pu,{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(Uk,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:x,onTestingTimeLeftChange:f})}),a.jsx(ht,{value:"proxy",children:a.jsx(Hk,{})})]})]})]})]})}function Hk(){const{strip:e,slowResponseThresholdSeconds:t,isLoading:n,setStrip:r,setSlowResponseThresholdSeconds:o}=al(),[s,i]=v.useState(null),[l,c]=v.useState(!1),u=v.useCallback(async h=>{i(null),c(!0);try{await r(h)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[r]),d=v.useCallback(async h=>{i(null),c(!0);try{await o(h)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[o]);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:n||l,onChange:h=>{u(h.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:n?"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:Eo,step:1,value:t,disabled:n||l,onChange:h=>{const m=Number(h.currentTarget.value);Number.isInteger(m)&&(m<0||m>Eo||d(m))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),s!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",s]})]})}function qk(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:fa(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:fa(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function fa(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Jo="data-nav-id",Jk="data-nav-action";function ha(e){return Array.from(e.querySelectorAll(`[${Jo}]`))}function pa(e){return e instanceof HTMLElement}function Kk(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Jo))return n;n=n.parentElement}return e.hasAttribute(Jo)?e:null}function wo(e){const t=e.getAttribute(Jk);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Sn(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function jn(e,t){return e[t]??null}function Gk(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||e.isContentEditable)}function Yk(e,t){const n=t??e,r=v.useCallback(o=>{const s=e.current;if(!s)return;const i=o.target;if(!pa(i)||i!==n.current||!s.contains(i))return;const l=ha(s),c=jn(l,0);c!==null&&Sn(c)},[e,n]);v.useEffect(()=>{const o=n.current,s=e.current;if(!o||!s)return;const i=l=>{const c=l.target;if(!pa(c)||!s.contains(c)||Gk(c))return;const u=ha(s);if(u.length===0)return;const d=Kk(c,s),h=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 p=h>0?h-1:h===-1?u.length-1:-1;if(p!==-1){const x=jn(u,p);x!==null&&Sn(x)}m=!0;break}case"ArrowDown":case"S":{if(l.key==="S"&&!l.shiftKey)break;l.preventDefault();const p=h<u.length-1?h+1:h===-1?0:-1;if(p!==-1){const x=jn(u,p);x!==null&&Sn(x)}m=!0;break}case"ArrowLeft":case"A":{if(l.key==="A"&&!l.shiftKey||d===null)break;if(l.preventDefault(),wo(d)==="collapse")d.click();else if(h>0){const x=jn(u,h-1);x!==null&&Sn(x)}m=!0;break}case"ArrowRight":case"D":{if(l.key==="D"&&!l.shiftKey||d===null)break;if(l.preventDefault(),wo(d)==="expand")d.click();else if(h<u.length-1){const x=jn(u,h+1);x!==null&&Sn(x)}m=!0;break}case" ":{if(d===null)break;l.preventDefault(),wo(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 fr(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function Xk(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 Qk(e){const t=e[0],n=e[e.length-1];if(t===void 0||n===void 0)return null;const r=o=>new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return`${r(t.timestamp)} - ${r(n.timestamp)}`}function e5(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function t5({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 n5(){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 r5({sessionId:e,logs:t,totalIn:n,totalOut:r}){const[o,s]=v.useState(!1),i=v.useMemo(()=>Qk(t),[t]),l=v.useMemo(()=>e5(t),[t]),c=v.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{s(!0),setTimeout(()=>s(!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(Og,{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:fr(e)}),l!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:l,children:l})]}),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":""]}),i!==null&&a.jsx("span",{children:i}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[Be(n)," in / ",Be(r)," out"]})]})]}),a.jsx("button",{type:"button",onClick:c,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":o?"Copied session link":"Copy session link",title:o?"Copied session link":"Copy session link",children:o?a.jsx(Ut,{className:"size-3.5"}):a.jsx(Bn,{className:"size-3.5"})})]})}function o5({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:h,slowResponseThresholdSeconds:m,hideSessionFilter:p=!1,pinnedSessionId:x}){const{totalIn:f,totalOut:g}=v.useMemo(()=>Xk(e),[e]),[y,_]=v.useState(!1),[k,C]=v.useState(null),[S,O]=v.useState("hidden"),E=v.useRef(null),A=v.useRef(null);Yk(E,A),v.useEffect(()=>{const L=50+Dn.length*400,B=setTimeout(()=>O("playing"),50),J=setTimeout(()=>O("done"),L);return()=>{clearTimeout(B),clearTimeout(J)}},[]),v.useEffect(()=>{if(x===void 0){document.title="Agent Inspector";return}const R=e.length===1?"1 req":`${e.length} req`;document.title=`${fr(x)} - ${R} - Agent Inspector`},[e.length,x]);const I=v.useCallback(async()=>{_(!0);try{await l1(e)}finally{_(!1)}},[e]);v.useEffect(()=>{C(null)},[r,o]);const P=v.useCallback(()=>{C(null)},[]),W=v.useMemo(()=>M2(e),[e]),j=v.useMemo(()=>qk(W),[W]),z=v.useMemo(()=>J_(W),[W]),w=v.useCallback(R=>{const q=z.get(R.id);q!==void 0&&C([q,R])},[z]);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(uk,{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:Dn.map((R,q)=>{const L=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][q],B=S==="hidden"?"opacity-0 scale-0":S==="playing"?"animate-crab-piano-pop":"";return a.jsx(R,{className:`size-5 ${L} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${B}`,style:{transitionDelay:`${q*50}ms`,...S==="playing"?{animationDelay:`${q*400}ms`}:{}}},q)})})]}),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",Q1.version]})]}),a.jsx(No,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(fk,{className:"size-10 shrink-0"})]}),a.jsx(n5,{})]}),a.jsx("div",{className:"justify-self-end",children:a.jsx(Vk,{})})]}),x!==void 0&&a.jsx(r5,{sessionId:x,logs:e,totalIn:f,totalOut:g}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!p&&a.jsxs(ra,{value:r,onValueChange:s,children:[a.jsx(sa,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(oa,{placeholder:"All sessions"})}),a.jsxs(ia,{children:[a.jsx(ir,{value:"__all__",children:"All sessions"}),t.map(R=>a.jsx(ir,{value:R,children:fr(R)},R))]})]}),a.jsxs(ra,{value:o,onValueChange:i,children:[a.jsx(sa,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(oa,{placeholder:"All models"})}),a.jsxs(ia,{children:[a.jsx(ir,{value:"__all__",children:"All models"}),n.map(R=>a.jsx(ir,{value:R,children:R},R))]})]}),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"}),a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",f>0||g>0?` · ${Be(f)} in / ${Be(g)} out`:""]}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{I()},disabled:y,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:y?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(ss,{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:fr(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",p?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(t5,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):a.jsx("div",{ref:A,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:E,children:W.map(R=>a.jsx(ck,{group:R,viewMode:u,strip:h,slowResponseThresholdSeconds:m,cacheTrends:j,onCompareWithPrevious:w,comparisonPredecessors:z,onClearGroup:c,standalone:W.length===1},R.id))})})}),k!==null&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(bw,{left:k[0],right:k[1],onClose:P})})]})}const s5=vt([ne({type:xe("init"),logs:_e(si)}),ne({type:xe("update"),log:si})]);function i5(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function a5(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function l5(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const c5=50,u5=12,d5=1800;function f5(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function m5({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),h=v.useRef(null),m=v.useRef(null),p=v.useRef(null),x=v.useRef(new Map),f=v.useRef([]),g=v.useRef(null),y=v.useMemo(()=>l5(t,r,s),[t,r,s]),_=v.useMemo(()=>i5(t),[t]),k=v.useMemo(()=>a5(t),[t]),C=v.useCallback(()=>{g.current=null;const W=f.current;f.current=[],W.length!==0&&n(j=>{let z=j;for(const w of W){const R=x.current.get(w.id);R!==void 0?z=[...z.slice(0,R),w,...z.slice(R+1)]:(x.current.set(w.id,z.length),z=[...z,w])}return z})},[]),S=v.useCallback(W=>{f.current.push(W),g.current===null&&(g.current=setTimeout(C,c5))},[C]),O=v.useCallback(()=>{h.current&&h.current.close();const W=new EventSource(f5(e));h.current=W,W.onmessage=j=>{try{const z=String(j.data),w=JSON.parse(z),R=s5.safeParse(w);if(!R.success){d("Failed to parse SSE data");return}const q=R.data;if(q.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),f.current=[];const L=new Map;for(let B=0;B<q.logs.length;B++){const J=q.logs[B];J!==void 0&&L.set(J.id,B)}x.current=L,n(q.logs),d(null)}else q.type==="update"&&S(q.log)}catch{d("Failed to parse SSE data")}},W.onerror=()=>{d("SSE connection lost, reconnecting..."),W.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(O,3e3)}},[e,S]);v.useEffect(()=>(O(),()=>{h.current&&(h.current.close(),h.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),g.current!==null&&(clearTimeout(g.current),g.current=null)}),[O]),v.useEffect(()=>{const W=window.location.hash;if(!W.startsWith("#log-")||p.current===W)return;const j=W.slice(1);let z=!1,w=0,R=null,q=null;const L=()=>{if(z)return;const B=document.getElementById(j);if(B!==null){p.current=W,B.scrollIntoView({block:"center",behavior:"smooth"}),B instanceof HTMLElement&&(R=B,B.setAttribute("data-deep-link-highlight","true"),q=window.setTimeout(()=>{B.removeAttribute("data-deep-link-highlight")},d5),B.focus({preventScroll:!0}),B.getAttribute("data-nav-action")==="expand"&&B.click());return}w+=1,w<u5&&window.setTimeout(L,100)};return L(),()=>{z=!0,q!==null&&window.clearTimeout(q),R!==null&&R.removeAttribute("data-deep-link-highlight")}},[y.length]);const E=v.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const W=e===void 0?void 0:JSON.stringify({ids:t.map(z=>z.id)});if(!(await fetch("/api/logs",{method:"DELETE",...W===void 0?{}:{headers:{"Content-Type":"application/json"},body:W}})).ok){d("Failed to clear logs");return}x.current.clear(),n([]),d(null)}catch(W){d(W instanceof Error?W.message:"Unknown error clearing logs")}})()},[t,e]),A=v.useCallback(W=>{W.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:W})})).ok){d("Failed to clear group");return}const z=new Set(W);n(w=>{const R=w.filter(L=>!z.has(L.id)),q=new Map;for(let L=0;L<R.length;L++){const B=R[L];B!==void 0&&q.set(B.id,L)}return x.current=q,R}),d(null)}catch(j){d(j instanceof Error?j.message:"Unknown error clearing group")}})()},[]),{strip:I,slowResponseThresholdSeconds:P}=al();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(r1,{}),a.jsx(o5,{logs:y,sessions:_,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:E,onClearGroup:A,viewMode:l,onViewModeChange:c,strip:I,slowResponseThresholdSeconds:P,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{vw as $,$ as A,Yr as B,Qg as C,Ts 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,_0 as M,ds as N,kt as O,m5 as P,$i as Q,R0 as R,Mg as S,Ru as T,$n as U,Wo as V,xr as W,fl as X,Y1 as Y,Rn as Z,In as _,P2 as a,Zg as a0,ve as b,ge as c,No as d,j0 as e,Be as f,M_ as g,Pr as h,Ut as i,Bn as j,As as k,zs as l,Os as m,z0 as n,Pu as o,ft as p,ht as q,Nr as r,$e as s,je as t,Ee as u,Ne as v,Me as w,ne as x,Ue as y,he as z};
|