tracer-sh 0.3.5 → 0.3.6
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/package.json +1 -1
- package/packages/server/dist/index.js +61 -26
- package/packages/web/dist/assets/{SearchableSelect-C0HvVPdQ.js → SearchableSelect-VoTpUxSB.js} +1 -1
- package/packages/web/dist/assets/{Settings-CWfkpcQA.js → Settings-CgEySEhC.js} +1 -1
- package/packages/web/dist/assets/{highlighted-body-OFNGDK62-DTgnP3WX.js → highlighted-body-OFNGDK62-GpbSyT-_.js} +1 -1
- package/packages/web/dist/assets/{index-DWtKdjfG.js → index-BsLO7f3R.js} +2 -2
- package/packages/web/dist/assets/{mermaid-GHXKKRXX-VdzAklnF.js → mermaid-GHXKKRXX-CiyDBVIR.js} +3 -3
- package/packages/web/dist/index.html +1 -1
package/package.json
CHANGED
|
@@ -1445,10 +1445,10 @@ var require_retry = __commonJS({
|
|
|
1445
1445
|
if (!await shouldRetryFn(err)) {
|
|
1446
1446
|
return { shouldRetry: false, config: err.config };
|
|
1447
1447
|
}
|
|
1448
|
-
const
|
|
1448
|
+
const delay4 = getNextRetryDelay(config2);
|
|
1449
1449
|
err.config.retryConfig.currentRetryAttempt += 1;
|
|
1450
|
-
const backoff = config2.retryBackoff ? config2.retryBackoff(err,
|
|
1451
|
-
setTimeout(resolve5,
|
|
1450
|
+
const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay4) : new Promise((resolve5) => {
|
|
1451
|
+
setTimeout(resolve5, delay4);
|
|
1452
1452
|
});
|
|
1453
1453
|
if (config2.onRetryAttempt) {
|
|
1454
1454
|
await config2.onRetryAttempt(err);
|
|
@@ -28202,6 +28202,10 @@ var CONFIG = {
|
|
|
28202
28202
|
/** Buffer cap for `npm install -g` output; well above the 1MB default so a noisy
|
|
28203
28203
|
* but successful install (native rebuild logs) isn't misreported as a failure. */
|
|
28204
28204
|
npmInstallMaxBufferBytes: 16 * 1024 * 1024,
|
|
28205
|
+
/** Transient download truncation (e.g. "Content-Length header ... exceeds response Body")
|
|
28206
|
+
* is not retried inside npm, so the whole install is retried instead. */
|
|
28207
|
+
npmInstallAttempts: 3,
|
|
28208
|
+
npmInstallRetryDelayMs: 3e3,
|
|
28205
28209
|
/** Re-run the background version check when the cached result is older than this. */
|
|
28206
28210
|
updateCheckTtlMs: 6 * 60 * 60 * 1e3,
|
|
28207
28211
|
// ── Dashboard defaults ──
|
|
@@ -28237,6 +28241,7 @@ var RESTART_EXIT_CODE = CONFIG.restartExitCode;
|
|
|
28237
28241
|
var cachedStatus = null;
|
|
28238
28242
|
var lastCheckAtMs = 0;
|
|
28239
28243
|
var checkInFlight = false;
|
|
28244
|
+
var installInFlight = false;
|
|
28240
28245
|
var cachedPackageInfo = null;
|
|
28241
28246
|
function resolvePackage() {
|
|
28242
28247
|
if (cachedPackageInfo) return cachedPackageInfo;
|
|
@@ -28295,7 +28300,7 @@ function fetchLatestNpmVersion() {
|
|
|
28295
28300
|
});
|
|
28296
28301
|
}
|
|
28297
28302
|
function getUpdateStatus() {
|
|
28298
|
-
if (Date.now() - lastCheckAtMs > CONFIG.updateCheckTtlMs) {
|
|
28303
|
+
if (!installInFlight && Date.now() - lastCheckAtMs > CONFIG.updateCheckTtlMs) {
|
|
28299
28304
|
checkForUpdateBackground();
|
|
28300
28305
|
}
|
|
28301
28306
|
if (cachedStatus) return cachedStatus;
|
|
@@ -28338,34 +28343,64 @@ function checkForUpdateBackground() {
|
|
|
28338
28343
|
function npxPrefixDir(root) {
|
|
28339
28344
|
return dirname(dirname(root));
|
|
28340
28345
|
}
|
|
28341
|
-
function
|
|
28342
|
-
const { root } = resolvePackage();
|
|
28343
|
-
const method = detectInstallMethod(root);
|
|
28344
|
-
if (method === "dev" || !root) {
|
|
28345
|
-
return Promise.resolve({
|
|
28346
|
-
ok: false,
|
|
28347
|
-
method,
|
|
28348
|
-
error: "Running from a local source checkout, so in-app update is disabled."
|
|
28349
|
-
});
|
|
28350
|
-
}
|
|
28351
|
-
const install = method === "global" ? "npm install -g tracer-sh@latest" : `npm install --prefix "${npxPrefixDir(root)}" tracer-sh@latest`;
|
|
28346
|
+
function runNpmInstall(install) {
|
|
28352
28347
|
return new Promise((resolve5) => {
|
|
28353
28348
|
exec(
|
|
28354
28349
|
// Quiet flags keep output small (a verbose install can otherwise overflow
|
|
28355
28350
|
// the stdout buffer and look like a failure); maxBuffer adds headroom for
|
|
28356
28351
|
// native rebuild logs so a successful install is never misreported.
|
|
28357
|
-
`${install} --no-fund --no-audit --loglevel=error`,
|
|
28352
|
+
`${install} --no-fund --no-audit --loglevel=error --fetch-retries=5`,
|
|
28358
28353
|
{ encoding: "utf-8", timeout: CONFIG.npmInstallTimeoutMs, maxBuffer: CONFIG.npmInstallMaxBufferBytes },
|
|
28359
28354
|
(err, _stdout, stderr) => {
|
|
28360
28355
|
if (err) {
|
|
28361
|
-
|
|
28356
|
+
const full = (stderr || "").trim() || err.message;
|
|
28357
|
+
resolve5({ ok: false, error: full.length > 2e3 ? `\u2026${full.slice(-2e3)}` : full });
|
|
28362
28358
|
return;
|
|
28363
28359
|
}
|
|
28364
|
-
resolve5({ ok: true
|
|
28360
|
+
resolve5({ ok: true });
|
|
28365
28361
|
}
|
|
28366
28362
|
);
|
|
28367
28363
|
});
|
|
28368
28364
|
}
|
|
28365
|
+
var delay = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
28366
|
+
var PERMANENT_NPM_ERROR = /EACCES|EPERM|ENOSPC|E404|ETARGET/;
|
|
28367
|
+
async function withRetries(run3, attempts, delayMs) {
|
|
28368
|
+
let last = { ok: false };
|
|
28369
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
28370
|
+
last = await run3();
|
|
28371
|
+
if (last.ok) return last;
|
|
28372
|
+
console.warn(`[updater] install attempt ${attempt}/${attempts} failed: ${last.error}`);
|
|
28373
|
+
if (PERMANENT_NPM_ERROR.test(last.error ?? "")) return last;
|
|
28374
|
+
if (attempt < attempts) await delay(delayMs);
|
|
28375
|
+
}
|
|
28376
|
+
return last;
|
|
28377
|
+
}
|
|
28378
|
+
async function performSelfUpdate() {
|
|
28379
|
+
const { root } = resolvePackage();
|
|
28380
|
+
const method = detectInstallMethod(root);
|
|
28381
|
+
if (method === "dev" || !root) {
|
|
28382
|
+
return {
|
|
28383
|
+
ok: false,
|
|
28384
|
+
method,
|
|
28385
|
+
error: "Running from a local source checkout, so in-app update is disabled."
|
|
28386
|
+
};
|
|
28387
|
+
}
|
|
28388
|
+
if (installInFlight) {
|
|
28389
|
+
return { ok: false, method, error: "An update is already in progress." };
|
|
28390
|
+
}
|
|
28391
|
+
const install = method === "global" ? "npm install -g tracer-sh@latest" : `npm install --prefix "${npxPrefixDir(root)}" tracer-sh@latest`;
|
|
28392
|
+
installInFlight = true;
|
|
28393
|
+
try {
|
|
28394
|
+
const result = await withRetries(
|
|
28395
|
+
() => runNpmInstall(install),
|
|
28396
|
+
CONFIG.npmInstallAttempts,
|
|
28397
|
+
CONFIG.npmInstallRetryDelayMs
|
|
28398
|
+
);
|
|
28399
|
+
return { ...result, method };
|
|
28400
|
+
} finally {
|
|
28401
|
+
installInFlight = false;
|
|
28402
|
+
}
|
|
28403
|
+
}
|
|
28369
28404
|
var restartHandler = null;
|
|
28370
28405
|
function setRestartHandler(fn) {
|
|
28371
28406
|
restartHandler = fn;
|
|
@@ -37050,7 +37085,7 @@ function createToolNameMapping({
|
|
|
37050
37085
|
}
|
|
37051
37086
|
};
|
|
37052
37087
|
}
|
|
37053
|
-
async function
|
|
37088
|
+
async function delay2(delayInMs, options) {
|
|
37054
37089
|
if (delayInMs == null) {
|
|
37055
37090
|
return Promise.resolve();
|
|
37056
37091
|
}
|
|
@@ -43666,7 +43701,7 @@ async function _retryWithExponentialBackoff(f, {
|
|
|
43666
43701
|
});
|
|
43667
43702
|
}
|
|
43668
43703
|
if (error48 instanceof Error && APICallError.isInstance(error48) && error48.isRetryable === true && tryNumber <= maxRetries) {
|
|
43669
|
-
await
|
|
43704
|
+
await delay2(
|
|
43670
43705
|
getRetryDelayInMs({
|
|
43671
43706
|
error: error48,
|
|
43672
43707
|
exponentialBackoffDelay: delayInMs
|
|
@@ -49598,7 +49633,7 @@ var CHUNKING_REGEXPS = {
|
|
|
49598
49633
|
function smoothStream({
|
|
49599
49634
|
delayInMs = 10,
|
|
49600
49635
|
chunking = "word",
|
|
49601
|
-
_internal: { delay: delay22 =
|
|
49636
|
+
_internal: { delay: delay22 = delay2 } = {}
|
|
49602
49637
|
} = {}) {
|
|
49603
49638
|
let detectChunk;
|
|
49604
49639
|
if (chunking != null && typeof chunking === "object" && "segment" in chunking && typeof chunking.segment === "function") {
|
|
@@ -57572,7 +57607,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
57572
57607
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
57573
57608
|
});
|
|
57574
57609
|
}
|
|
57575
|
-
await
|
|
57610
|
+
await delay2(pollIntervalMs);
|
|
57576
57611
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
57577
57612
|
throw new AISDKError({
|
|
57578
57613
|
name: "GOOGLE_VIDEO_GENERATION_ABORTED",
|
|
@@ -58123,7 +58158,7 @@ function combineHeaders2(...headers) {
|
|
|
58123
58158
|
{}
|
|
58124
58159
|
);
|
|
58125
58160
|
}
|
|
58126
|
-
async function
|
|
58161
|
+
async function delay3(delayInMs, options) {
|
|
58127
58162
|
if (delayInMs == null) {
|
|
58128
58163
|
return Promise.resolve();
|
|
58129
58164
|
}
|
|
@@ -62985,7 +63020,7 @@ var GoogleVertexVideoModel = class {
|
|
|
62985
63020
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
62986
63021
|
});
|
|
62987
63022
|
}
|
|
62988
|
-
await
|
|
63023
|
+
await delay3(pollIntervalMs);
|
|
62989
63024
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
62990
63025
|
throw new AISDKError2({
|
|
62991
63026
|
name: "VERTEX_VIDEO_GENERATION_ABORTED",
|
|
@@ -65634,13 +65669,13 @@ var HttpMCPTransport = class {
|
|
|
65634
65669
|
);
|
|
65635
65670
|
return;
|
|
65636
65671
|
}
|
|
65637
|
-
const
|
|
65672
|
+
const delay4 = this.getNextReconnectionDelay(this.inboundReconnectAttempts);
|
|
65638
65673
|
this.inboundReconnectAttempts += 1;
|
|
65639
65674
|
setTimeout(async () => {
|
|
65640
65675
|
var _a45;
|
|
65641
65676
|
if ((_a45 = this.abortController) == null ? void 0 : _a45.signal.aborted) return;
|
|
65642
65677
|
await this.openInboundSse(false, this.lastInboundEventId);
|
|
65643
|
-
},
|
|
65678
|
+
}, delay4);
|
|
65644
65679
|
}
|
|
65645
65680
|
// Open optional inbound SSE stream; best-effort and resumable
|
|
65646
65681
|
async openInboundSse(triedAuth = false, resumeToken) {
|
package/packages/web/dist/assets/{SearchableSelect-C0HvVPdQ.js → SearchableSelect-VoTpUxSB.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,r as s,j as r}from"./index-
|
|
1
|
+
import{a as q,r as s,j as r}from"./index-BsLO7f3R.js";var P=q();function $(c){const n=c?`tracer:starred:${c}`:null,[i,S]=s.useState(()=>{if(!n)return new Set;try{const a=localStorage.getItem(n);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}});return[i,a=>{S(u=>{const t=new Set(u);return t.has(a)?t.delete(a):t.add(a),n&&localStorage.setItem(n,JSON.stringify([...t])),t})}]}function I({options:c,value:n,onChange:i,placeholder:S="Select...",storageKey:v,fitContent:a,disabled:u}){const[t,l]=s.useState(!1),[w,y]=s.useState(""),f=s.useRef(null),j=s.useRef(null),N=s.useRef(null),g=s.useRef(null),[x,C]=$(v),[m,L]=s.useState({top:0,left:0,minWidth:0});s.useEffect(()=>{if(!t)return;const e=d=>{f.current?.contains(d.target)||j.current?.contains(d.target)||l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]);const R=s.useCallback(()=>{if(!f.current)return;const e=f.current.getBoundingClientRect();L({top:e.bottom+4,left:e.left,minWidth:e.width})},[]);s.useEffect(()=>{t&&(R(),y(""),requestAnimationFrame(()=>N.current?.focus()))},[t,R]);const h=c.find(e=>e.value===n),p=s.useMemo(()=>{const e=w.toLowerCase();return[...e?c.filter(o=>o.label.toLowerCase().includes(e)||o.value.toLowerCase().includes(e)):c].sort((o,b)=>{const k=x.has(o.value)?0:1,E=x.has(b.value)?0:1;return k!==E?k-E:o.label.localeCompare(b.label)})},[c,w,x]);s.useEffect(()=>{if(t&&n&&g.current){const e=g.current.querySelector(`[data-value="${CSS.escape(n)}"]`);e&&e.scrollIntoView({block:"nearest"})}},[t,n]);const W=t?P.createPortal(r.jsxs("div",{ref:j,className:"fixed z-[100] bg-white border border-[#d4d2cd] rounded shadow-lg",style:{top:m.top,left:m.left,minWidth:m.minWidth,width:a?"max-content":m.minWidth},children:[r.jsx("div",{className:"p-1.5 border-b border-[#e8e6e1]",children:r.jsx("input",{ref:N,type:"text",value:w,onChange:e=>y(e.target.value),placeholder:"Search...",className:"w-full px-2 py-1.5 text-xs text-[#2c2c2c] font-sans bg-[#f5f4f0] border border-[#e8e6e1] rounded focus:outline-none focus:border-[#2b5ea7] placeholder:text-[#9c9890]",onKeyDown:e=>{e.key==="Escape"&&l(!1),e.key==="Enter"&&p.length>0&&(i(p[0].value),l(!1))}})}),r.jsx("div",{ref:g,className:"max-h-[280px] overflow-y-auto",children:p.length===0?r.jsx("div",{className:"px-3 py-3 text-xs text-[#9c9890] text-center",children:"No projects found"}):p.map(e=>{const d=e.value===n,o=x.has(e.value);return r.jsxs("div",{"data-value":e.value,className:`flex items-center gap-1.5 px-2 py-1.5 text-xs font-sans cursor-pointer transition-colors ${d?"bg-[#2b5ea7]/10 text-[#2b5ea7]":"text-[#2c2c2c] hover:bg-[#f5f4f0]"}`,onClick:()=>{i(e.value),l(!1)},children:[r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),C(e.value)},className:`shrink-0 w-4 h-4 flex items-center justify-center text-[10px] transition-colors ${o?"text-[#d4a017]":"text-[#d4d2cd] hover:text-[#9c9890]"}`,title:o?"Unstar":"Star to pin to top",children:o?"★":"☆"}),r.jsx("span",{className:a?"whitespace-nowrap":"truncate flex-1",children:e.label})]},e.value)})})]}),document.body):null;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:f,type:"button",onClick:()=>!u&&l(!t),disabled:u,className:"w-full bg-white border border-[#d4d2cd] rounded px-3 py-2 text-xs text-[#2c2c2c] font-sans text-left flex items-center justify-between focus:outline-none focus:border-[#2b5ea7] hover:border-[#b0ada6] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[r.jsx("span",{className:h?"text-[#2c2c2c] truncate":"text-[#9c9890]",children:h?h.displayLabel??h.label:S}),r.jsx("span",{className:"text-[#9c9890] text-[10px] ml-2 shrink-0 transition-transform duration-200",style:{transform:t?"rotate(180deg)":"rotate(0deg)"},children:"▾"})]}),W]})}export{I as S,P as r,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as m,r as f,j as e,S as I,c as _,b as a,C as E,u as X,W as V,A as ee,d as de,g as ue,m as O,p as G,e as se,M as me}from"./index-DWtKdjfG.js";import{S as te}from"./SearchableSelect-C0HvVPdQ.js";function W({type:s,label:t,note:l}){const i=m.useUtils(),{data:o,isLoading:x}=m.settings.getApiKey.useQuery(s),p=m.settings.saveApiKey.useMutation({onSuccess:()=>i.settings.getApiKey.invalidate(s)}),d=m.settings.removeApiKey.useMutation({onSuccess:()=>i.settings.getApiKey.invalidate(s)}),[h,r]=f.useState(!1),[g,u]=f.useState(""),[v,b]=f.useState(!1);async function C(){await p.mutateAsync({type:s,apiKey:g}),u(""),r(!1)}async function c(){await d.mutateAsync(s),r(!1),b(!1)}return x?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm font-medium w-24 shrink-0",children:t}),e.jsx("span",{className:a.maskedKey+" flex-1 truncate",style:o?{color:_.success}:void 0,children:o?o.maskedApiKey:"Not configured"}),!h&&e.jsx("button",{onClick:()=>{u(""),r(!0)},className:a.secondaryBtn+" text-xs px-3 py-1",children:o?"Edit":"Add"})]}),h&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1] space-y-2",children:[l&&e.jsx("div",{children:l}),e.jsx("input",{type:g?"password":"text",value:g,onChange:N=>u(N.target.value),placeholder:o?.maskedApiKey??"Enter API key",className:a.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:C,disabled:!g||p.isPending,className:a.primaryBtn+" text-xs px-3 py-1",children:p.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>r(!1),disabled:p.isPending,className:a.secondaryBtn+" text-xs px-3 py-1",children:"Cancel"}),o&&e.jsx("button",{onClick:()=>b(!0),disabled:d.isPending,className:a.dangerBtn+" text-xs px-3 py-1",children:"Remove"})]})]}),e.jsx(E,{open:v,title:"Remove API key",message:`Remove the ${t} API key?`,confirmLabel:"Remove",onConfirm:c,onCancel:()=>b(!1)})]})}function J({checked:s,onChange:t,disabled:l,"aria-label":i}){return e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,disabled:l,onClick:()=>t(!s),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s?"bg-[#2b5ea7]":"bg-[#d4d2cd]"} ${l?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s?"translate-x-[18px]":"translate-x-[3px]"}`})})}function H({status:s,label:t}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${a.statusDot[s]}`}),t&&e.jsx("span",{className:a.statusLabel,children:t})]})}function xe(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getVertexConfig.useQuery(),i=X(),o=!!t,x=i.data,p=x?.ok??!1,d=o&&p,h=()=>{s.settings.getVertexConfig.invalidate(),s.provider.listVertexModels.invalidate()},r=m.settings.saveVertexConfig.useMutation({onSuccess:h}),g=m.settings.removeVertexConfig.useMutation({onSuccess:h}),u=r.isPending||g.isPending,[v,b]=f.useState(!1),{data:C,isLoading:c}=m.provider.listGcpProjects.useQuery(void 0,{staleTime:V.updateCheckStaleTimeMs,enabled:d}),N=f.useMemo(()=>(C??[]).map(y=>({value:y.projectId,label:y.name?`${y.name} (${y.projectId})`:y.projectId,displayLabel:y.name||y.projectId})),[C]);function S(y){y?r.mutate({}):b(!0)}function k(){g.mutate(),b(!1)}function j(y){y!==t?.projectId&&r.mutate({projectId:y})}return l?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{checked:o,onChange:S,disabled:u,"aria-label":"Enable Vertex AI"}),e.jsx("span",{className:"text-sm font-medium",children:"Vertex AI"}),o?e.jsx(H,{status:d?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),o&&e.jsx("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1]",children:i.isLoading?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#666666]",children:[e.jsx(I,{size:"sm"})," Checking authentication…"]}):p?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(te,{options:N,value:t?.projectId??"",onChange:j,placeholder:c?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:c||u})})]}),e.jsx(pe,{value:t?.location??"global",onCommit:y=>{const P=y.trim()||"global";P!==t?.location&&r.mutate({location:P})},disabled:u})]}):e.jsx("p",{className:a.warnText,children:x&&!x.ok?x.message:"Not authenticated. Run: gcloud auth application-default login"})}),e.jsx(E,{open:v,title:"Disable Vertex AI",message:"Disable Vertex AI? Your project selection will be removed.",confirmLabel:"Disable",onConfirm:k,onCancel:()=>b(!1)})]})}function pe({value:s,onCommit:t,disabled:l}){const[i,o]=f.useState(s);return f.useEffect(()=>o(s),[s]),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Location"}),e.jsx("input",{type:"text",value:i,onChange:x=>o(x.target.value),onBlur:()=>t(i),onKeyDown:x=>{x.key==="Enter"&&x.currentTarget.blur()},placeholder:"global",disabled:l,className:a.input})]})}function ge({configuredProviders:s}){return e.jsx("div",{className:"border-t border-[#e8e6e1]",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:a.tableHeaderRow,children:[e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2",children:"Model"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2",children:"Provider"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2 text-right",children:"Input ($/M)"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2 text-right",children:"Output ($/M)"})]})}),e.jsx("tbody",{className:"divide-y divide-[#e8e6e1]",children:ee.map(t=>{const l=s.has(t.provider);return e.jsxs("tr",{style:l?{color:_.success}:{color:_.inkFaint},children:[e.jsx("td",{className:"px-4 py-2 font-mono text-xs",children:t.modelId}),e.jsx("td",{className:"px-4 py-2 capitalize",children:t.provider}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.inputPrice.toFixed(2)]}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.outputPrice.toFixed(2)]})]},t.modelId)})})]})})}function $({children:s}){return e.jsx("div",{className:"text-xs leading-relaxed rounded border border-[#d4d2cd] bg-[#f5f4f1] p-3 space-y-2",children:s})}const Z="underline break-all text-[#0052cc]",he=e.jsxs($,{children:[e.jsxs("div",{children:["Create a Gemini API key at:",e.jsx("br",{}),e.jsx("a",{href:"https://aistudio.google.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://aistudio.google.com/api-keys"})]}),e.jsx("div",{className:"opacity-80",children:"This key powers the Gemini models Tracer uses to run chats and analyze your data — it is the model provider, not a data source. Tracer sends your prompts and the data it has already fetched to Google's Gemini API for inference; it grants no access back into your Google account."})]});function fe(){const[s,t]=f.useState(!1),l=de();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"max-w-lg bg-white border border-[#d4d2cd] rounded divide-y divide-[#e8e6e1] overflow-hidden",children:[e.jsx(W,{type:"anthropic",label:"Anthropic"}),e.jsx(W,{type:"google",label:"Google AI",note:he}),e.jsx(xe,{})]}),e.jsxs("div",{className:"bg-white border border-[#d4d2cd] rounded overflow-hidden",children:[e.jsxs("button",{onClick:()=>t(!s),className:"w-full flex items-center justify-between px-4 py-3 text-sm text-[#666666] hover:bg-[#f5f4f0] transition-colors font-sans",children:[e.jsx("span",{className:"font-medium",children:"Model Pricing"}),e.jsx("span",{className:"text-xs transition-transform duration-200",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"▾"})]}),s&&e.jsx(ge,{configuredProviders:l})]})]})}function ne({value:s,models:t,onChange:l,loading:i,disabled:o,label:x="Model"}){const p=ue(t),d=O(s),r=!t.some(u=>O(u)===d)&&!i;function g(u){const v=u.indexOf(":");l({provider:u.slice(0,v),modelId:u.slice(v+1)})}return e.jsxs("div",{className:"flex items-start gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14 mt-2",children:x}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium bg-[#f0eee9] text-[#666666] border border-[#d4d2cd]",children:G(s.provider)}),e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("select",{value:d,onChange:u=>g(u.target.value),disabled:o,className:"w-full appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-7 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans disabled:opacity-50 disabled:cursor-not-allowed",children:[r&&e.jsx("optgroup",{label:"Unavailable",children:e.jsxs("option",{value:d,children:[G(s.provider)," · ",s.modelId]})}),p.map(u=>e.jsx("optgroup",{label:u.label,children:u.models.map(v=>e.jsx("option",{value:O(v),children:v.modelId},O(v)))},u.provider))]}),e.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[#9c9890] text-[10px]",children:"▾"})]})]}),r&&e.jsxs("p",{className:a.warnText+" mt-1.5",children:[G(s.provider)," · ",s.modelId," isn’t available. Configure its provider or pick another model."]})]})]})}const je=ee[0];function ve({providerType:s}){const t=m.useUtils(),{data:l,isLoading:i}=m.settings.getSubAgentModel.useQuery(s),o=m.settings.saveSubAgentModel.useMutation({onSuccess:()=>t.settings.getSubAgentModel.invalidate(s)}),{models:x,isLoading:p}=se();if(i)return null;const d=l??je;return e.jsx(ne,{value:d,models:x,loading:p,disabled:o.isPending,onChange:h=>o.mutate({providerType:s,model:{provider:h.provider,modelId:h.modelId}})})}function be({existingConfig:s}){const t=m.useUtils(),l=X(),{data:i,isLoading:o}=m.provider.listGcpProjects.useQuery(void 0,{staleTime:V.updateCheckStaleTimeMs}),x=m.provider.saveConfig.useMutation({onSuccess:()=>{t.provider.getConfigs.invalidate(),t.provider.list.invalidate()}}),p=f.useMemo(()=>(i??[]).map(r=>({value:r.projectId,label:r.name?`${r.name} (${r.projectId})`:r.projectId,displayLabel:r.name||r.projectId})),[i]),d=s.projectId??"";if(l.data&&!l.data.ok)return null;function h(r){r!==d&&x.mutate({type:"gcp",config:{...s,projectId:r}})}return e.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(te,{options:p,value:d,onChange:h,placeholder:o?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:o||x.isPending})})]})}function ye({type:s,label:t,connected:l,configured:i,onConfigure:o,onToggle:x,togglePending:p,toggleError:d,pingError:h,hasConfigFields:r,existingConfig:g}){const u=i||l;return e.jsxs("div",{className:a.settingsCard+" w-80",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:i,onChange:v=>{v&&r?o():x(v)},disabled:p}),e.jsx("span",{className:"font-medium",children:t}),u?e.jsx(H,{status:l?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:o,className:`${a.secondaryBtn} ${i&&r?"":"invisible"}`,children:"Edit"})]}),u&&e.jsx(ve,{providerType:s}),u&&s==="gcp"&&g&&e.jsx(be,{existingConfig:g}),h&&!l&&e.jsx("p",{className:a.warnText+" mt-2",children:h}),d&&e.jsx("p",{className:a.errorText+" mt-2",children:d})]})}function Y(s,t){return!!s&&!!t&&s===t}function ae({open:s,label:t,configFields:l,formValues:i,onFormChange:o,existingConfig:x,saveResult:p,savePending:d,configured:h,note:r,onSave:g,onClose:u,onRemove:v}){const b=l.some(c=>c.required!==!1&&c.type==="password"&&Y(i[c.key],x?.[c.key])),C=l.some(c=>c.required!==!1&&!i[c.key]);return e.jsxs(me,{open:s,onClose:u,children:[e.jsxs("div",{className:a.dialogTitle+" text-base mb-4",children:["Configure ",t]}),r&&e.jsx("div",{className:"mb-4",children:r}),e.jsx("div",{className:"space-y-3",children:l.map(c=>{const N=c.type==="password"&&Y(i[c.key],x?.[c.key]);return e.jsxs("div",{children:[e.jsxs("label",{className:a.sectionTitle,children:[c.label,c.required===!1&&e.jsx("span",{className:"text-xs opacity-40 ml-1",children:"(optional)"})]}),e.jsx("input",{type:c.type==="password"&&i[c.key]&&!N?"password":"text",value:i[c.key]??"",onChange:S=>o(c.key,S.target.value),onFocus:S=>{N&&S.target.select()},placeholder:`Enter ${c.label.toLowerCase()}`,className:`${a.input} ${N?"!text-[#999] !border-l-2 !border-l-amber-400":""}`})]},c.key)})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t border-[#d4d2cd]",children:[e.jsx("button",{onClick:g,disabled:C||b||d,className:a.primaryBtn,children:d?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save & Test"}),e.jsx("button",{onClick:u,disabled:d,className:a.secondaryBtn,children:"Cancel"}),h&&e.jsx("button",{onClick:v,disabled:d,className:a.dangerBtn,children:"Remove"})]}),b&&!d&&!p&&e.jsx("p",{className:"mt-2 text-xs text-amber-600",children:"Re-enter highlighted fields to save"}),p&&e.jsx("div",{className:`mt-3 ${p.success?a.successText:a.errorText}`,children:p.success?"Connected successfully":p.error||"Connection failed"})]})}const Ne={newrelic:e.jsxs($,{children:[e.jsxs("div",{children:["Create a ",e.jsx("span",{className:"font-medium",children:"User key"})," at:",e.jsx("br",{}),e.jsx("a",{href:"https://one.newrelic.com/admin-portal/api-keys/home",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://one.newrelic.com/admin-portal/api-keys/home"}),e.jsx("br",{}),"Your numeric Account ID is shown on the same page."]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsx("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Run read-only NRQL queries"})," against your account — to inspect metrics, logs, traces, and errors while investigating."]})})]}),e.jsx("div",{className:"opacity-80",children:"It only reads via NRQL. It cannot write, modify, deploy, or delete anything. A New Relic User key inherits your role, so for least privilege use a user scoped to read-only access."})]}),posthog:e.jsxs($,{children:[e.jsxs("div",{children:["Create a ",e.jsx("span",{className:"font-medium",children:"Personal API key"})," in your PostHog instance at:",e.jsx("br",{}),e.jsx("span",{className:"font-mono",children:"/settings/user-api-keys"}),e.jsx("br",{}),"Grant it the single scope ",e.jsx("span",{className:"font-medium",children:"Query → Read"}),". The Project ID is in Settings → Project. Set Host only if you are not on US cloud (e.g.",e.jsx("span",{className:"font-mono",children:" eu.posthog.com"})," or a self-hosted URL)."]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsx("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Run read-only HogQL queries"})," against the project — to inspect events, persons, and analytics while investigating."]})})]}),e.jsxs("div",{className:"opacity-80",children:["With only the ",e.jsx("span",{className:"font-medium",children:"Query → Read"})," scope it cannot create, modify, or delete anything in PostHog, and it reaches only the project you configure."]})]})};function Ce(s,t){const l={};for(const i of s)l[i.key]=t?.[i.key]??"";return l}function we(){const s=m.useUtils(),{data:t,isLoading:l}=m.provider.list.useQuery(),{data:i,isLoading:o}=m.provider.getConfigs.useQuery(),{data:x,isLoading:p}=m.provider.getRegisteredTypes.useQuery(),{data:d}=m.provider.ping.useQuery(void 0,{staleTime:V.sessionStaleTimeMs,refetchOnMount:"always"}),h=m.provider.saveConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),r=m.provider.removeConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),[g,u]=f.useState(null),[v,b]=f.useState({}),[C,c]=f.useState(null),[N,S]=f.useState(null),[k,j]=f.useState({});function y(n){const w=i?.find(M=>M.type===n),A=x?.find(M=>M.type===n);b(Ce(A?.configFields??[],w?.config)),c(null),u(n)}function P(){u(null),b({}),c(null)}async function U(n){c(null);try{const w=await h.mutateAsync({type:n,config:v});c(w),w.success&&(u(null),b({}))}catch{c({success:!1,error:"Failed to save configuration"})}}async function F(n,w){if(w){j(A=>{const M={...A};return delete M[n],M});try{const A=await h.mutateAsync({type:n,config:{}});A.success||j(M=>({...M,[n]:A.error??"Connection failed"}))}catch{j(A=>({...A,[n]:"Failed to save configuration"}))}}else S(n)}async function K(n){await r.mutateAsync(n),u(null),b({}),c(null),S(null)}const z=l||o||p,R=x??[];if(z)return e.jsx(I,{size:"lg",centered:!0});const T=g?R.find(n=>n.type===g):null,B=g?i?.find(n=>n.type===g):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:R.map(({type:n,label:w,configFields:A})=>{const M=t?.find(L=>L.type===n),q=i?.find(L=>L.type===n),oe=!!q,D=d?.find(L=>L.type===n),le=D?D.ok:!!M?.connected,re=A.length>0,ce=D&&!D.ok?D.error:void 0;return e.jsx(ye,{type:n,label:w,connected:le,configured:oe,onConfigure:()=>y(n),onToggle:L=>F(n,L),togglePending:h.isPending||r.isPending,toggleError:k[n],pingError:ce,hasConfigFields:re,existingConfig:q?.config},n)})}),g&&T&&e.jsx(ae,{open:!0,label:T.label,configFields:T.configFields,formValues:v,onFormChange:(n,w)=>b(A=>({...A,[n]:w})),existingConfig:B?.config??null,saveResult:C,savePending:h.isPending,configured:!!B,note:Ne[g],onSave:()=>U(g),onClose:P,onRemove:()=>S(g)}),e.jsx(E,{open:N!==null,title:"Disable provider",message:`Disable ${R.find(n=>n.type===N)?.label??N}?`,confirmLabel:"Disable",onConfirm:()=>{N&&K(N)},onCancel:()=>S(null)})]})}const Se=[{key:"domain",label:"Domain (yourco → yourco.atlassian.net)",type:"text"},{key:"email",label:"Email",type:"text"},{key:"apiToken",label:"API Token",type:"password"}],ke=e.jsxs($,{children:[e.jsxs("div",{children:["Create a token (use the plain ",e.jsx("span",{className:"font-medium",children:"Create API token"}),', not "with scopes") at:',e.jsx("br",{}),e.jsx("a",{href:"https://id.atlassian.com/manage-profile/security/api-tokens",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://id.atlassian.com/manage-profile/security/api-tokens"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsxs("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Read an issue"})," — summary, description, status, type, priority, assignee, reporter, labels, components, fix versions, resolution, dates, and its comment thread"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Post a comment"})," — plain text, only when you ask"]})]})]}),e.jsx("div",{className:"opacity-80",children:"It cannot edit, transition, delete, bulk-read, or administer anything else. The token uses its account's permissions, so for least privilege point it at a Jira account limited to the projects Tracer should touch."})]});function Ae(){const s=m.useUtils(),{data:t,isLoading:l}=m.integrations.getJira.useQuery(),i=m.integrations.saveJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),o=m.integrations.removeJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),[x,p]=f.useState(!1),[d,h]=f.useState({}),[r,g]=f.useState(null),[u,v]=f.useState(!1),b=!!t?.configured,C=t?.config??null;function c(){h({domain:C?.domain??"",email:C?.email??"",apiToken:C?.apiToken??""}),g(null),p(!0)}function N(){p(!1),h({}),g(null)}async function S(){g(null);try{const j=await i.mutateAsync({domain:d.domain??"",email:d.email??"",apiToken:d.apiToken??""});g(j),j.success&&N()}catch{g({success:!1,error:"Failed to save configuration"})}}async function k(){await o.mutateAsync(),v(!1),N()}return l?e.jsx(I,{size:"lg",centered:!0}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:e.jsx("div",{className:a.settingsCard+" w-80",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:b,onChange:j=>{j?c():v(!0)},disabled:i.isPending||o.isPending}),e.jsx("span",{className:"font-medium",children:"Jira"}),b?e.jsx(H,{status:"connected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:c,className:`${a.secondaryBtn} ${b?"":"invisible"}`,children:"Edit"})]})})}),x&&e.jsx(ae,{open:!0,label:"Jira",configFields:Se,formValues:d,onFormChange:(j,y)=>h(P=>({...P,[j]:y})),existingConfig:C,saveResult:r,savePending:i.isPending,configured:b,note:ke,onSave:S,onClose:N,onRemove:()=>v(!0)}),e.jsx(E,{open:u,title:"Disable Jira",message:"Disable the Jira integration?",confirmLabel:"Disable",onConfirm:k,onCancel:()=>v(!1)})]})}function Me({memory:s,editingId:t,editNote:l,setEditNote:i,onUpdate:o,onCancelEdit:x,onStartEdit:p,onDelete:d,updatePending:h,removePending:r}){return e.jsxs("li",{className:"flex items-start justify-between gap-3 py-1.5 border-b border-[#d4d2cd] last:border-b-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:t===s.id?e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:l,onChange:g=>i(g.target.value),className:a.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(s.id),disabled:!l||h,className:a.primaryBtn,children:"Save"}),e.jsx("button",{onClick:x,disabled:h,className:a.secondaryBtn,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-[#444444]",children:s.note}),s.reviewNote&&e.jsx("p",{className:"text-xs text-[#9c9890] italic mt-0.5",children:s.reviewNote}),e.jsx("p",{className:"text-xs text-[#666666] mt-0.5",children:new Date(s.createdAt*1e3).toLocaleDateString()})]})}),t!==s.id&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>p(s.id,s.note),className:a.secondaryBtn,children:"Edit"}),e.jsx("button",{onClick:()=>d(s.id),disabled:r,className:a.dangerBtn,children:"Delete"})]})]})}function Pe(){const s=m.useUtils(),{data:t,isLoading:l}=m.memory.list.useQuery(),{data:i}=m.provider.getRegisteredTypes.useQuery(),o=m.memory.create.useMutation({onSuccess:()=>{s.memory.list.invalidate(),P(""),j("unified"),S(!1)}}),x=m.memory.update.useMutation({onSuccess:()=>s.memory.list.invalidate()}),p=m.memory.remove.useMutation({onSuccess:()=>s.memory.list.invalidate()}),[d,h]=f.useState(null),r=m.memory.optimize.useMutation({onSuccess:n=>{s.memory.list.invalidate(),h(n.stats)}}),[g,u]=f.useState(null),[v,b]=f.useState(""),[C,c]=f.useState(null),[N,S]=f.useState(!1),[k,j]=f.useState("unified"),[y,P]=f.useState("");function U(n,w){u(n),b(w)}async function F(n){await x.mutateAsync({id:n,note:v}),u(null),b("")}function K(){u(null),b("")}const z=[{value:"unified",label:"Unified"},...(i??[]).map(n=>({value:n.type,label:n.label}))],R=5;if(l)return e.jsx(I,{size:"lg",centered:!0});const T=new Map;if(t)for(const n of t){const w=T.get(n.toolName)??[];w.push(n),T.set(n.toolName,w)}const B={editingId:g,editNote:v,setEditNote:b,onUpdate:F,onCancelEdit:K,onStartEdit:U,onDelete:n=>c(n),updatePending:x.isPending,removePending:p.isPending};return e.jsxs("div",{className:"space-y-4",children:[N?e.jsxs("div",{className:a.settingsCard+" space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-[#666666] font-sans",children:"Provider"}),e.jsx("select",{value:k,onChange:n=>{j(n.target.value),n.target.blur()},className:"bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-8 text-sm text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans appearance-none bg-[length:16px_16px] bg-[right_8px_center] bg-no-repeat",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")`},children:z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:a.sectionTitle,children:"Note"}),e.jsx("input",{type:"text",value:y,onChange:n=>P(n.target.value),onKeyDown:n=>{n.key==="Enter"&&y.trim()&&!o.isPending&&o.mutate({toolName:k,note:y})},placeholder:"Reusable lesson or pattern...",className:a.input})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o.mutate({toolName:k,note:y}),disabled:!y.trim()||o.isPending,className:a.primaryBtn,children:o.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>{S(!1),P(""),j("unified")},disabled:o.isPending,className:a.secondaryBtn,children:"Cancel"})]})]}):e.jsx("button",{onClick:()=>S(!0),className:a.secondaryBtn,children:"+ Add Memory"}),T.size===0&&e.jsx("div",{className:a.settingsCard,children:e.jsx("p",{className:"text-sm text-[#666666]",children:"No memories yet. The agent will save notes here as it learns from tool usage."})}),[...T.entries()].map(([n,w])=>{const A=w.length>R;return e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:`${a.badge} ${a.badgeVariants.info}`,children:n}),A&&e.jsxs("span",{className:"text-xs text-[#666666]",children:[w.length," memories"]}),e.jsx("button",{onClick:()=>r.mutate({toolName:n}),disabled:r.isPending||w.length===0,className:`ml-auto ${a.outlineBtn}`,title:"Optimize memories with AI",children:r.isPending&&r.variables?.toolName===n?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:"sm"})," Optimizing..."]}):"Optimize"})]}),e.jsx("ul",{className:`space-y-2${A?" max-h-64 overflow-y-auto":""}`,children:w.map(M=>e.jsx(Me,{memory:M,...B},M.id))})]},n)}),e.jsx(E,{open:C!==null,title:"Delete memory",message:"Delete this agent memory?",onConfirm:()=>{C!==null&&p.mutate({id:C}),c(null)},onCancel:()=>c(null)}),e.jsx(E,{open:d!==null,title:"Optimization Complete",message:d&&e.jsxs("div",{className:"space-y-1.5 text-sm text-[#444444]",children:[e.jsxs("p",{children:["Kept: ",e.jsx("span",{className:"font-medium",children:d.kept})]}),e.jsxs("p",{children:["Updated: ",e.jsx("span",{className:"font-medium",children:d.updated})]}),e.jsxs("p",{children:["Deleted: ",e.jsx("span",{className:"font-medium",children:d.deleted})]})]}),confirmLabel:"OK",cancelLabel:null,confirmStyle:"primary",onConfirm:()=>h(null),onCancel:()=>h(null)})]})}function Ie(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getChatModel.useQuery(),i=m.settings.saveChatModel.useMutation({onSuccess:()=>s.settings.getChatModel.invalidate()}),{models:o,isLoading:x}=se();return l||!t?null:e.jsx(ne,{value:t,models:o,loading:x,disabled:i.isPending,onChange:p=>i.mutate({provider:p.provider,modelId:p.modelId})})}const Q=["Pacific/Auckland","Australia/Sydney","Asia/Tokyo","Asia/Shanghai","Asia/Kolkata","Asia/Dubai","Europe/Moscow","Europe/Berlin","UTC","Europe/London","America/Sao_Paulo","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Pacific/Honolulu"];function ie(s){try{const t=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"short"}).formatToParts(new Date).find(i=>i.type==="timeZoneName")?.value??"",l=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"shortOffset"}).formatToParts(new Date).find(i=>i.type==="timeZoneName")?.value??"";return`${t} (${l})`}catch{return s}}const Te=new Map(Q.map(s=>[s,ie(s)]));function Le(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getAgentConfig.useQuery(),i=m.settings.saveAgentConfig.useMutation({onSuccess:()=>{s.settings.getAgentConfig.invalidate(),c(!1)}}),[o,x]=f.useState(""),[p,d]=f.useState(100),[h,r]=f.useState(50),[g,u]=f.useState(1024),[v,b]=f.useState(1e4),[C,c]=f.useState(!1);if(f.useEffect(()=>{t&&(x(t.timezone),d(t.directModeMaxSteps),r(t.subAgentMaxSteps),u(t.thinkingBudgetGoogle),b(t.thinkingBudgetAnthropic),c(!1))},[t]),l||!t)return null;const N=C&&(o!==t.timezone||p!==t.directModeMaxSteps||h!==t.subAgentMaxSteps||g!==t.thinkingBudgetGoogle||v!==t.thinkingBudgetAnthropic);function S(){i.mutate({timezone:o,directModeMaxSteps:p,subAgentMaxSteps:h,thinkingBudgetGoogle:g,thinkingBudgetAnthropic:v})}function k(){c(!0)}return e.jsxs("div",{className:"max-w-lg space-y-3",children:[e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Unified mode model"}),e.jsx("span",{className:"text-xs opacity-40",children:"used when chat scope is “ALL”"})]}),e.jsx(Ie,{})]}),e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Timezone"}),e.jsxs("select",{value:o,onChange:j=>{x(j.target.value),k()},className:"appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans",children:[Q.map(j=>e.jsx("option",{value:j,children:Te.get(j)??j},j)),!Q.includes(o)&&e.jsx("option",{value:o,children:ie(o)})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Direct mode max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:p,onChange:j=>{d(Number(j.target.value)),k()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Sub-agent max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:h,onChange:j=>{r(Number(j.target.value)),k()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Google thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:256,value:g,onChange:j=>{u(Number(j.target.value)),k()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Anthropic thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:1e3,value:v,onChange:j=>{b(Number(j.target.value)),k()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-3 border-t border-[#e8e6e1]",children:[e.jsx("button",{onClick:S,disabled:!N||i.isPending,className:a.primaryBtn,children:i.isPending?"Saving...":"Save"}),i.isSuccess&&!C&&e.jsx("span",{className:a.successText,children:"Saved"})]})]})]})}function De(){return e.jsxs("div",{className:a.page,children:[e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"LLM API Keys"}),e.jsx(fe,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Data Providers"}),e.jsx(we,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Integrations"}),e.jsx(Ae,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Agent Configuration"}),e.jsx(Le,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Agent Memory"}),e.jsx(Pe,{})]})]})}export{De as Settings};
|
|
1
|
+
import{t as m,r as f,j as e,S as I,c as _,b as a,C as E,u as X,W as V,A as ee,d as de,g as ue,m as O,p as G,e as se,M as me}from"./index-BsLO7f3R.js";import{S as te}from"./SearchableSelect-VoTpUxSB.js";function W({type:s,label:t,note:l}){const i=m.useUtils(),{data:o,isLoading:x}=m.settings.getApiKey.useQuery(s),p=m.settings.saveApiKey.useMutation({onSuccess:()=>i.settings.getApiKey.invalidate(s)}),d=m.settings.removeApiKey.useMutation({onSuccess:()=>i.settings.getApiKey.invalidate(s)}),[h,r]=f.useState(!1),[g,u]=f.useState(""),[v,b]=f.useState(!1);async function C(){await p.mutateAsync({type:s,apiKey:g}),u(""),r(!1)}async function c(){await d.mutateAsync(s),r(!1),b(!1)}return x?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm font-medium w-24 shrink-0",children:t}),e.jsx("span",{className:a.maskedKey+" flex-1 truncate",style:o?{color:_.success}:void 0,children:o?o.maskedApiKey:"Not configured"}),!h&&e.jsx("button",{onClick:()=>{u(""),r(!0)},className:a.secondaryBtn+" text-xs px-3 py-1",children:o?"Edit":"Add"})]}),h&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1] space-y-2",children:[l&&e.jsx("div",{children:l}),e.jsx("input",{type:g?"password":"text",value:g,onChange:N=>u(N.target.value),placeholder:o?.maskedApiKey??"Enter API key",className:a.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:C,disabled:!g||p.isPending,className:a.primaryBtn+" text-xs px-3 py-1",children:p.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>r(!1),disabled:p.isPending,className:a.secondaryBtn+" text-xs px-3 py-1",children:"Cancel"}),o&&e.jsx("button",{onClick:()=>b(!0),disabled:d.isPending,className:a.dangerBtn+" text-xs px-3 py-1",children:"Remove"})]})]}),e.jsx(E,{open:v,title:"Remove API key",message:`Remove the ${t} API key?`,confirmLabel:"Remove",onConfirm:c,onCancel:()=>b(!1)})]})}function J({checked:s,onChange:t,disabled:l,"aria-label":i}){return e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,disabled:l,onClick:()=>t(!s),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s?"bg-[#2b5ea7]":"bg-[#d4d2cd]"} ${l?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s?"translate-x-[18px]":"translate-x-[3px]"}`})})}function H({status:s,label:t}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${a.statusDot[s]}`}),t&&e.jsx("span",{className:a.statusLabel,children:t})]})}function xe(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getVertexConfig.useQuery(),i=X(),o=!!t,x=i.data,p=x?.ok??!1,d=o&&p,h=()=>{s.settings.getVertexConfig.invalidate(),s.provider.listVertexModels.invalidate()},r=m.settings.saveVertexConfig.useMutation({onSuccess:h}),g=m.settings.removeVertexConfig.useMutation({onSuccess:h}),u=r.isPending||g.isPending,[v,b]=f.useState(!1),{data:C,isLoading:c}=m.provider.listGcpProjects.useQuery(void 0,{staleTime:V.updateCheckStaleTimeMs,enabled:d}),N=f.useMemo(()=>(C??[]).map(y=>({value:y.projectId,label:y.name?`${y.name} (${y.projectId})`:y.projectId,displayLabel:y.name||y.projectId})),[C]);function S(y){y?r.mutate({}):b(!0)}function k(){g.mutate(),b(!1)}function j(y){y!==t?.projectId&&r.mutate({projectId:y})}return l?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{checked:o,onChange:S,disabled:u,"aria-label":"Enable Vertex AI"}),e.jsx("span",{className:"text-sm font-medium",children:"Vertex AI"}),o?e.jsx(H,{status:d?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),o&&e.jsx("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1]",children:i.isLoading?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#666666]",children:[e.jsx(I,{size:"sm"})," Checking authentication…"]}):p?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(te,{options:N,value:t?.projectId??"",onChange:j,placeholder:c?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:c||u})})]}),e.jsx(pe,{value:t?.location??"global",onCommit:y=>{const P=y.trim()||"global";P!==t?.location&&r.mutate({location:P})},disabled:u})]}):e.jsx("p",{className:a.warnText,children:x&&!x.ok?x.message:"Not authenticated. Run: gcloud auth application-default login"})}),e.jsx(E,{open:v,title:"Disable Vertex AI",message:"Disable Vertex AI? Your project selection will be removed.",confirmLabel:"Disable",onConfirm:k,onCancel:()=>b(!1)})]})}function pe({value:s,onCommit:t,disabled:l}){const[i,o]=f.useState(s);return f.useEffect(()=>o(s),[s]),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Location"}),e.jsx("input",{type:"text",value:i,onChange:x=>o(x.target.value),onBlur:()=>t(i),onKeyDown:x=>{x.key==="Enter"&&x.currentTarget.blur()},placeholder:"global",disabled:l,className:a.input})]})}function ge({configuredProviders:s}){return e.jsx("div",{className:"border-t border-[#e8e6e1]",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:a.tableHeaderRow,children:[e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2",children:"Model"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2",children:"Provider"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2 text-right",children:"Input ($/M)"}),e.jsx("th",{className:a.tableHeaderCell+" text-xs py-2 text-right",children:"Output ($/M)"})]})}),e.jsx("tbody",{className:"divide-y divide-[#e8e6e1]",children:ee.map(t=>{const l=s.has(t.provider);return e.jsxs("tr",{style:l?{color:_.success}:{color:_.inkFaint},children:[e.jsx("td",{className:"px-4 py-2 font-mono text-xs",children:t.modelId}),e.jsx("td",{className:"px-4 py-2 capitalize",children:t.provider}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.inputPrice.toFixed(2)]}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.outputPrice.toFixed(2)]})]},t.modelId)})})]})})}function $({children:s}){return e.jsx("div",{className:"text-xs leading-relaxed rounded border border-[#d4d2cd] bg-[#f5f4f1] p-3 space-y-2",children:s})}const Z="underline break-all text-[#0052cc]",he=e.jsxs($,{children:[e.jsxs("div",{children:["Create a Gemini API key at:",e.jsx("br",{}),e.jsx("a",{href:"https://aistudio.google.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://aistudio.google.com/api-keys"})]}),e.jsx("div",{className:"opacity-80",children:"This key powers the Gemini models Tracer uses to run chats and analyze your data — it is the model provider, not a data source. Tracer sends your prompts and the data it has already fetched to Google's Gemini API for inference; it grants no access back into your Google account."})]});function fe(){const[s,t]=f.useState(!1),l=de();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"max-w-lg bg-white border border-[#d4d2cd] rounded divide-y divide-[#e8e6e1] overflow-hidden",children:[e.jsx(W,{type:"anthropic",label:"Anthropic"}),e.jsx(W,{type:"google",label:"Google AI",note:he}),e.jsx(xe,{})]}),e.jsxs("div",{className:"bg-white border border-[#d4d2cd] rounded overflow-hidden",children:[e.jsxs("button",{onClick:()=>t(!s),className:"w-full flex items-center justify-between px-4 py-3 text-sm text-[#666666] hover:bg-[#f5f4f0] transition-colors font-sans",children:[e.jsx("span",{className:"font-medium",children:"Model Pricing"}),e.jsx("span",{className:"text-xs transition-transform duration-200",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"▾"})]}),s&&e.jsx(ge,{configuredProviders:l})]})]})}function ne({value:s,models:t,onChange:l,loading:i,disabled:o,label:x="Model"}){const p=ue(t),d=O(s),r=!t.some(u=>O(u)===d)&&!i;function g(u){const v=u.indexOf(":");l({provider:u.slice(0,v),modelId:u.slice(v+1)})}return e.jsxs("div",{className:"flex items-start gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14 mt-2",children:x}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium bg-[#f0eee9] text-[#666666] border border-[#d4d2cd]",children:G(s.provider)}),e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("select",{value:d,onChange:u=>g(u.target.value),disabled:o,className:"w-full appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-7 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans disabled:opacity-50 disabled:cursor-not-allowed",children:[r&&e.jsx("optgroup",{label:"Unavailable",children:e.jsxs("option",{value:d,children:[G(s.provider)," · ",s.modelId]})}),p.map(u=>e.jsx("optgroup",{label:u.label,children:u.models.map(v=>e.jsx("option",{value:O(v),children:v.modelId},O(v)))},u.provider))]}),e.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[#9c9890] text-[10px]",children:"▾"})]})]}),r&&e.jsxs("p",{className:a.warnText+" mt-1.5",children:[G(s.provider)," · ",s.modelId," isn’t available. Configure its provider or pick another model."]})]})]})}const je=ee[0];function ve({providerType:s}){const t=m.useUtils(),{data:l,isLoading:i}=m.settings.getSubAgentModel.useQuery(s),o=m.settings.saveSubAgentModel.useMutation({onSuccess:()=>t.settings.getSubAgentModel.invalidate(s)}),{models:x,isLoading:p}=se();if(i)return null;const d=l??je;return e.jsx(ne,{value:d,models:x,loading:p,disabled:o.isPending,onChange:h=>o.mutate({providerType:s,model:{provider:h.provider,modelId:h.modelId}})})}function be({existingConfig:s}){const t=m.useUtils(),l=X(),{data:i,isLoading:o}=m.provider.listGcpProjects.useQuery(void 0,{staleTime:V.updateCheckStaleTimeMs}),x=m.provider.saveConfig.useMutation({onSuccess:()=>{t.provider.getConfigs.invalidate(),t.provider.list.invalidate()}}),p=f.useMemo(()=>(i??[]).map(r=>({value:r.projectId,label:r.name?`${r.name} (${r.projectId})`:r.projectId,displayLabel:r.name||r.projectId})),[i]),d=s.projectId??"";if(l.data&&!l.data.ok)return null;function h(r){r!==d&&x.mutate({type:"gcp",config:{...s,projectId:r}})}return e.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(te,{options:p,value:d,onChange:h,placeholder:o?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:o||x.isPending})})]})}function ye({type:s,label:t,connected:l,configured:i,onConfigure:o,onToggle:x,togglePending:p,toggleError:d,pingError:h,hasConfigFields:r,existingConfig:g}){const u=i||l;return e.jsxs("div",{className:a.settingsCard+" w-80",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:i,onChange:v=>{v&&r?o():x(v)},disabled:p}),e.jsx("span",{className:"font-medium",children:t}),u?e.jsx(H,{status:l?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:o,className:`${a.secondaryBtn} ${i&&r?"":"invisible"}`,children:"Edit"})]}),u&&e.jsx(ve,{providerType:s}),u&&s==="gcp"&&g&&e.jsx(be,{existingConfig:g}),h&&!l&&e.jsx("p",{className:a.warnText+" mt-2",children:h}),d&&e.jsx("p",{className:a.errorText+" mt-2",children:d})]})}function Y(s,t){return!!s&&!!t&&s===t}function ae({open:s,label:t,configFields:l,formValues:i,onFormChange:o,existingConfig:x,saveResult:p,savePending:d,configured:h,note:r,onSave:g,onClose:u,onRemove:v}){const b=l.some(c=>c.required!==!1&&c.type==="password"&&Y(i[c.key],x?.[c.key])),C=l.some(c=>c.required!==!1&&!i[c.key]);return e.jsxs(me,{open:s,onClose:u,children:[e.jsxs("div",{className:a.dialogTitle+" text-base mb-4",children:["Configure ",t]}),r&&e.jsx("div",{className:"mb-4",children:r}),e.jsx("div",{className:"space-y-3",children:l.map(c=>{const N=c.type==="password"&&Y(i[c.key],x?.[c.key]);return e.jsxs("div",{children:[e.jsxs("label",{className:a.sectionTitle,children:[c.label,c.required===!1&&e.jsx("span",{className:"text-xs opacity-40 ml-1",children:"(optional)"})]}),e.jsx("input",{type:c.type==="password"&&i[c.key]&&!N?"password":"text",value:i[c.key]??"",onChange:S=>o(c.key,S.target.value),onFocus:S=>{N&&S.target.select()},placeholder:`Enter ${c.label.toLowerCase()}`,className:`${a.input} ${N?"!text-[#999] !border-l-2 !border-l-amber-400":""}`})]},c.key)})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t border-[#d4d2cd]",children:[e.jsx("button",{onClick:g,disabled:C||b||d,className:a.primaryBtn,children:d?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save & Test"}),e.jsx("button",{onClick:u,disabled:d,className:a.secondaryBtn,children:"Cancel"}),h&&e.jsx("button",{onClick:v,disabled:d,className:a.dangerBtn,children:"Remove"})]}),b&&!d&&!p&&e.jsx("p",{className:"mt-2 text-xs text-amber-600",children:"Re-enter highlighted fields to save"}),p&&e.jsx("div",{className:`mt-3 ${p.success?a.successText:a.errorText}`,children:p.success?"Connected successfully":p.error||"Connection failed"})]})}const Ne={newrelic:e.jsxs($,{children:[e.jsxs("div",{children:["Create a ",e.jsx("span",{className:"font-medium",children:"User key"})," at:",e.jsx("br",{}),e.jsx("a",{href:"https://one.newrelic.com/admin-portal/api-keys/home",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://one.newrelic.com/admin-portal/api-keys/home"}),e.jsx("br",{}),"Your numeric Account ID is shown on the same page."]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsx("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Run read-only NRQL queries"})," against your account — to inspect metrics, logs, traces, and errors while investigating."]})})]}),e.jsx("div",{className:"opacity-80",children:"It only reads via NRQL. It cannot write, modify, deploy, or delete anything. A New Relic User key inherits your role, so for least privilege use a user scoped to read-only access."})]}),posthog:e.jsxs($,{children:[e.jsxs("div",{children:["Create a ",e.jsx("span",{className:"font-medium",children:"Personal API key"})," in your PostHog instance at:",e.jsx("br",{}),e.jsx("span",{className:"font-mono",children:"/settings/user-api-keys"}),e.jsx("br",{}),"Grant it the single scope ",e.jsx("span",{className:"font-medium",children:"Query → Read"}),". The Project ID is in Settings → Project. Set Host only if you are not on US cloud (e.g.",e.jsx("span",{className:"font-mono",children:" eu.posthog.com"})," or a self-hosted URL)."]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsx("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Run read-only HogQL queries"})," against the project — to inspect events, persons, and analytics while investigating."]})})]}),e.jsxs("div",{className:"opacity-80",children:["With only the ",e.jsx("span",{className:"font-medium",children:"Query → Read"})," scope it cannot create, modify, or delete anything in PostHog, and it reaches only the project you configure."]})]})};function Ce(s,t){const l={};for(const i of s)l[i.key]=t?.[i.key]??"";return l}function we(){const s=m.useUtils(),{data:t,isLoading:l}=m.provider.list.useQuery(),{data:i,isLoading:o}=m.provider.getConfigs.useQuery(),{data:x,isLoading:p}=m.provider.getRegisteredTypes.useQuery(),{data:d}=m.provider.ping.useQuery(void 0,{staleTime:V.sessionStaleTimeMs,refetchOnMount:"always"}),h=m.provider.saveConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),r=m.provider.removeConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),[g,u]=f.useState(null),[v,b]=f.useState({}),[C,c]=f.useState(null),[N,S]=f.useState(null),[k,j]=f.useState({});function y(n){const w=i?.find(M=>M.type===n),A=x?.find(M=>M.type===n);b(Ce(A?.configFields??[],w?.config)),c(null),u(n)}function P(){u(null),b({}),c(null)}async function U(n){c(null);try{const w=await h.mutateAsync({type:n,config:v});c(w),w.success&&(u(null),b({}))}catch{c({success:!1,error:"Failed to save configuration"})}}async function F(n,w){if(w){j(A=>{const M={...A};return delete M[n],M});try{const A=await h.mutateAsync({type:n,config:{}});A.success||j(M=>({...M,[n]:A.error??"Connection failed"}))}catch{j(A=>({...A,[n]:"Failed to save configuration"}))}}else S(n)}async function K(n){await r.mutateAsync(n),u(null),b({}),c(null),S(null)}const z=l||o||p,R=x??[];if(z)return e.jsx(I,{size:"lg",centered:!0});const T=g?R.find(n=>n.type===g):null,B=g?i?.find(n=>n.type===g):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:R.map(({type:n,label:w,configFields:A})=>{const M=t?.find(L=>L.type===n),q=i?.find(L=>L.type===n),oe=!!q,D=d?.find(L=>L.type===n),le=D?D.ok:!!M?.connected,re=A.length>0,ce=D&&!D.ok?D.error:void 0;return e.jsx(ye,{type:n,label:w,connected:le,configured:oe,onConfigure:()=>y(n),onToggle:L=>F(n,L),togglePending:h.isPending||r.isPending,toggleError:k[n],pingError:ce,hasConfigFields:re,existingConfig:q?.config},n)})}),g&&T&&e.jsx(ae,{open:!0,label:T.label,configFields:T.configFields,formValues:v,onFormChange:(n,w)=>b(A=>({...A,[n]:w})),existingConfig:B?.config??null,saveResult:C,savePending:h.isPending,configured:!!B,note:Ne[g],onSave:()=>U(g),onClose:P,onRemove:()=>S(g)}),e.jsx(E,{open:N!==null,title:"Disable provider",message:`Disable ${R.find(n=>n.type===N)?.label??N}?`,confirmLabel:"Disable",onConfirm:()=>{N&&K(N)},onCancel:()=>S(null)})]})}const Se=[{key:"domain",label:"Domain (yourco → yourco.atlassian.net)",type:"text"},{key:"email",label:"Email",type:"text"},{key:"apiToken",label:"API Token",type:"password"}],ke=e.jsxs($,{children:[e.jsxs("div",{children:["Create a token (use the plain ",e.jsx("span",{className:"font-medium",children:"Create API token"}),', not "with scopes") at:',e.jsx("br",{}),e.jsx("a",{href:"https://id.atlassian.com/manage-profile/security/api-tokens",target:"_blank",rel:"noopener noreferrer",className:Z,children:"https://id.atlassian.com/manage-profile/security/api-tokens"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"What Tracer can do with it"}),e.jsxs("ul",{className:"list-disc ml-4 mt-1 space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Read an issue"})," — summary, description, status, type, priority, assignee, reporter, labels, components, fix versions, resolution, dates, and its comment thread"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Post a comment"})," — plain text, only when you ask"]})]})]}),e.jsx("div",{className:"opacity-80",children:"It cannot edit, transition, delete, bulk-read, or administer anything else. The token uses its account's permissions, so for least privilege point it at a Jira account limited to the projects Tracer should touch."})]});function Ae(){const s=m.useUtils(),{data:t,isLoading:l}=m.integrations.getJira.useQuery(),i=m.integrations.saveJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),o=m.integrations.removeJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),[x,p]=f.useState(!1),[d,h]=f.useState({}),[r,g]=f.useState(null),[u,v]=f.useState(!1),b=!!t?.configured,C=t?.config??null;function c(){h({domain:C?.domain??"",email:C?.email??"",apiToken:C?.apiToken??""}),g(null),p(!0)}function N(){p(!1),h({}),g(null)}async function S(){g(null);try{const j=await i.mutateAsync({domain:d.domain??"",email:d.email??"",apiToken:d.apiToken??""});g(j),j.success&&N()}catch{g({success:!1,error:"Failed to save configuration"})}}async function k(){await o.mutateAsync(),v(!1),N()}return l?e.jsx(I,{size:"lg",centered:!0}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:e.jsx("div",{className:a.settingsCard+" w-80",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:b,onChange:j=>{j?c():v(!0)},disabled:i.isPending||o.isPending}),e.jsx("span",{className:"font-medium",children:"Jira"}),b?e.jsx(H,{status:"connected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:c,className:`${a.secondaryBtn} ${b?"":"invisible"}`,children:"Edit"})]})})}),x&&e.jsx(ae,{open:!0,label:"Jira",configFields:Se,formValues:d,onFormChange:(j,y)=>h(P=>({...P,[j]:y})),existingConfig:C,saveResult:r,savePending:i.isPending,configured:b,note:ke,onSave:S,onClose:N,onRemove:()=>v(!0)}),e.jsx(E,{open:u,title:"Disable Jira",message:"Disable the Jira integration?",confirmLabel:"Disable",onConfirm:k,onCancel:()=>v(!1)})]})}function Me({memory:s,editingId:t,editNote:l,setEditNote:i,onUpdate:o,onCancelEdit:x,onStartEdit:p,onDelete:d,updatePending:h,removePending:r}){return e.jsxs("li",{className:"flex items-start justify-between gap-3 py-1.5 border-b border-[#d4d2cd] last:border-b-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:t===s.id?e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:l,onChange:g=>i(g.target.value),className:a.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(s.id),disabled:!l||h,className:a.primaryBtn,children:"Save"}),e.jsx("button",{onClick:x,disabled:h,className:a.secondaryBtn,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-[#444444]",children:s.note}),s.reviewNote&&e.jsx("p",{className:"text-xs text-[#9c9890] italic mt-0.5",children:s.reviewNote}),e.jsx("p",{className:"text-xs text-[#666666] mt-0.5",children:new Date(s.createdAt*1e3).toLocaleDateString()})]})}),t!==s.id&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>p(s.id,s.note),className:a.secondaryBtn,children:"Edit"}),e.jsx("button",{onClick:()=>d(s.id),disabled:r,className:a.dangerBtn,children:"Delete"})]})]})}function Pe(){const s=m.useUtils(),{data:t,isLoading:l}=m.memory.list.useQuery(),{data:i}=m.provider.getRegisteredTypes.useQuery(),o=m.memory.create.useMutation({onSuccess:()=>{s.memory.list.invalidate(),P(""),j("unified"),S(!1)}}),x=m.memory.update.useMutation({onSuccess:()=>s.memory.list.invalidate()}),p=m.memory.remove.useMutation({onSuccess:()=>s.memory.list.invalidate()}),[d,h]=f.useState(null),r=m.memory.optimize.useMutation({onSuccess:n=>{s.memory.list.invalidate(),h(n.stats)}}),[g,u]=f.useState(null),[v,b]=f.useState(""),[C,c]=f.useState(null),[N,S]=f.useState(!1),[k,j]=f.useState("unified"),[y,P]=f.useState("");function U(n,w){u(n),b(w)}async function F(n){await x.mutateAsync({id:n,note:v}),u(null),b("")}function K(){u(null),b("")}const z=[{value:"unified",label:"Unified"},...(i??[]).map(n=>({value:n.type,label:n.label}))],R=5;if(l)return e.jsx(I,{size:"lg",centered:!0});const T=new Map;if(t)for(const n of t){const w=T.get(n.toolName)??[];w.push(n),T.set(n.toolName,w)}const B={editingId:g,editNote:v,setEditNote:b,onUpdate:F,onCancelEdit:K,onStartEdit:U,onDelete:n=>c(n),updatePending:x.isPending,removePending:p.isPending};return e.jsxs("div",{className:"space-y-4",children:[N?e.jsxs("div",{className:a.settingsCard+" space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-[#666666] font-sans",children:"Provider"}),e.jsx("select",{value:k,onChange:n=>{j(n.target.value),n.target.blur()},className:"bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-8 text-sm text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans appearance-none bg-[length:16px_16px] bg-[right_8px_center] bg-no-repeat",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")`},children:z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:a.sectionTitle,children:"Note"}),e.jsx("input",{type:"text",value:y,onChange:n=>P(n.target.value),onKeyDown:n=>{n.key==="Enter"&&y.trim()&&!o.isPending&&o.mutate({toolName:k,note:y})},placeholder:"Reusable lesson or pattern...",className:a.input})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o.mutate({toolName:k,note:y}),disabled:!y.trim()||o.isPending,className:a.primaryBtn,children:o.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>{S(!1),P(""),j("unified")},disabled:o.isPending,className:a.secondaryBtn,children:"Cancel"})]})]}):e.jsx("button",{onClick:()=>S(!0),className:a.secondaryBtn,children:"+ Add Memory"}),T.size===0&&e.jsx("div",{className:a.settingsCard,children:e.jsx("p",{className:"text-sm text-[#666666]",children:"No memories yet. The agent will save notes here as it learns from tool usage."})}),[...T.entries()].map(([n,w])=>{const A=w.length>R;return e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:`${a.badge} ${a.badgeVariants.info}`,children:n}),A&&e.jsxs("span",{className:"text-xs text-[#666666]",children:[w.length," memories"]}),e.jsx("button",{onClick:()=>r.mutate({toolName:n}),disabled:r.isPending||w.length===0,className:`ml-auto ${a.outlineBtn}`,title:"Optimize memories with AI",children:r.isPending&&r.variables?.toolName===n?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:"sm"})," Optimizing..."]}):"Optimize"})]}),e.jsx("ul",{className:`space-y-2${A?" max-h-64 overflow-y-auto":""}`,children:w.map(M=>e.jsx(Me,{memory:M,...B},M.id))})]},n)}),e.jsx(E,{open:C!==null,title:"Delete memory",message:"Delete this agent memory?",onConfirm:()=>{C!==null&&p.mutate({id:C}),c(null)},onCancel:()=>c(null)}),e.jsx(E,{open:d!==null,title:"Optimization Complete",message:d&&e.jsxs("div",{className:"space-y-1.5 text-sm text-[#444444]",children:[e.jsxs("p",{children:["Kept: ",e.jsx("span",{className:"font-medium",children:d.kept})]}),e.jsxs("p",{children:["Updated: ",e.jsx("span",{className:"font-medium",children:d.updated})]}),e.jsxs("p",{children:["Deleted: ",e.jsx("span",{className:"font-medium",children:d.deleted})]})]}),confirmLabel:"OK",cancelLabel:null,confirmStyle:"primary",onConfirm:()=>h(null),onCancel:()=>h(null)})]})}function Ie(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getChatModel.useQuery(),i=m.settings.saveChatModel.useMutation({onSuccess:()=>s.settings.getChatModel.invalidate()}),{models:o,isLoading:x}=se();return l||!t?null:e.jsx(ne,{value:t,models:o,loading:x,disabled:i.isPending,onChange:p=>i.mutate({provider:p.provider,modelId:p.modelId})})}const Q=["Pacific/Auckland","Australia/Sydney","Asia/Tokyo","Asia/Shanghai","Asia/Kolkata","Asia/Dubai","Europe/Moscow","Europe/Berlin","UTC","Europe/London","America/Sao_Paulo","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Pacific/Honolulu"];function ie(s){try{const t=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"short"}).formatToParts(new Date).find(i=>i.type==="timeZoneName")?.value??"",l=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"shortOffset"}).formatToParts(new Date).find(i=>i.type==="timeZoneName")?.value??"";return`${t} (${l})`}catch{return s}}const Te=new Map(Q.map(s=>[s,ie(s)]));function Le(){const s=m.useUtils(),{data:t,isLoading:l}=m.settings.getAgentConfig.useQuery(),i=m.settings.saveAgentConfig.useMutation({onSuccess:()=>{s.settings.getAgentConfig.invalidate(),c(!1)}}),[o,x]=f.useState(""),[p,d]=f.useState(100),[h,r]=f.useState(50),[g,u]=f.useState(1024),[v,b]=f.useState(1e4),[C,c]=f.useState(!1);if(f.useEffect(()=>{t&&(x(t.timezone),d(t.directModeMaxSteps),r(t.subAgentMaxSteps),u(t.thinkingBudgetGoogle),b(t.thinkingBudgetAnthropic),c(!1))},[t]),l||!t)return null;const N=C&&(o!==t.timezone||p!==t.directModeMaxSteps||h!==t.subAgentMaxSteps||g!==t.thinkingBudgetGoogle||v!==t.thinkingBudgetAnthropic);function S(){i.mutate({timezone:o,directModeMaxSteps:p,subAgentMaxSteps:h,thinkingBudgetGoogle:g,thinkingBudgetAnthropic:v})}function k(){c(!0)}return e.jsxs("div",{className:"max-w-lg space-y-3",children:[e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Unified mode model"}),e.jsx("span",{className:"text-xs opacity-40",children:"used when chat scope is “ALL”"})]}),e.jsx(Ie,{})]}),e.jsxs("div",{className:a.settingsCard,children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Timezone"}),e.jsxs("select",{value:o,onChange:j=>{x(j.target.value),k()},className:"appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans",children:[Q.map(j=>e.jsx("option",{value:j,children:Te.get(j)??j},j)),!Q.includes(o)&&e.jsx("option",{value:o,children:ie(o)})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Direct mode max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:p,onChange:j=>{d(Number(j.target.value)),k()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Sub-agent max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:h,onChange:j=>{r(Number(j.target.value)),k()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Google thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:256,value:g,onChange:j=>{u(Number(j.target.value)),k()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Anthropic thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:1e3,value:v,onChange:j=>{b(Number(j.target.value)),k()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-3 border-t border-[#e8e6e1]",children:[e.jsx("button",{onClick:S,disabled:!N||i.isPending,className:a.primaryBtn,children:i.isPending?"Saving...":"Save"}),i.isSuccess&&!C&&e.jsx("span",{className:a.successText,children:"Saved"})]})]})]})}function De(){return e.jsxs("div",{className:a.page,children:[e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"LLM API Keys"}),e.jsx(fe,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Data Providers"}),e.jsx(we,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Integrations"}),e.jsx(Ae,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Agent Configuration"}),e.jsx(Le,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:a.sectionTitle,children:"Agent Memory"}),e.jsx(Pe,{})]})]})}export{De as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as p,L as x,A as d}from"./mermaid-GHXKKRXX-
|
|
1
|
+
import{R as p,L as x,A as d}from"./mermaid-GHXKKRXX-CiyDBVIR.js";import{r,j as f}from"./index-BsLO7f3R.js";import"./SearchableSelect-VoTpUxSB.js";var j=({code:i,language:e,raw:t,className:m,startLine:u,lineNumbers:n,...g})=>{let{shikiTheme:o}=r.useContext(p),a=x(),[h,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},c=>{s(c)});l&&s(l)},[i,e,o,a,t]),f.jsx(d,{className:m,language:e,lineNumbers:n,result:h,startLine:u,...g})};export{j as HighlightedCodeBlockBody};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-GHXKKRXX-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-GHXKKRXX-CiyDBVIR.js","assets/SearchableSelect-VoTpUxSB.js","assets/mermaid-GHXKKRXX-B9Z7D9kT.css","assets/Settings-CgEySEhC.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function qb(n,a){for(var i=0;i<a.length;i++){const l=a[i];if(typeof l!="string"&&!Array.isArray(l)){for(const s in l)if(s!=="default"&&!(s in n)){const f=Object.getOwnPropertyDescriptor(l,s);f&&Object.defineProperty(n,s,f.get?f:{enumerable:!0,get:()=>l[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const f of s)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function i(s){const f={};return s.integrity&&(f.integrity=s.integrity),s.referrerPolicy&&(f.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?f.credentials="include":s.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(s){if(s.ep)return;s.ep=!0;const f=i(s);fetch(s.href,f)}})();function Qb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ec={exports:{}},bi={};var tm;function kb(){if(tm)return bi;tm=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(l,s,f){var d=null;if(f!==void 0&&(d=""+f),s.key!==void 0&&(d=""+s.key),"key"in s){f={};for(var h in s)h!=="key"&&(f[h]=s[h])}else f=s;return s=f.ref,{$$typeof:n,type:l,key:d,ref:s!==void 0?s:null,props:f}}return bi.Fragment=a,bi.jsx=i,bi.jsxs=i,bi}var nm;function Bb(){return nm||(nm=1,ec.exports=kb()),ec.exports}var C=Bb(),tc={exports:{}},fe={};var am;function Hb(){if(am)return fe;am=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),x=Symbol.iterator;function R(_){return _===null||typeof _!="object"?null:(_=x&&_[x]||_["@@iterator"],typeof _=="function"?_:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z=Object.assign,ne={};function ue(_,T,q){this.props=_,this.context=T,this.refs=ne,this.updater=q||L}ue.prototype.isReactComponent={},ue.prototype.setState=function(_,T){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,T,"setState")},ue.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function de(){}de.prototype=ue.prototype;function ve(_,T,q){this.props=_,this.context=T,this.refs=ne,this.updater=q||L}var be=ve.prototype=new de;be.constructor=ve,Z(be,ue.prototype),be.isPureReactComponent=!0;var P=Array.isArray;function Y(){}var D={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function W(_,T,q){var H=q.ref;return{$$typeof:n,type:_,key:T,ref:H!==void 0?H:null,props:q}}function ae(_,T){return W(_.type,T,_.props)}function re(_){return typeof _=="object"&&_!==null&&_.$$typeof===n}function F(_){var T={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(q){return T[q]})}var he=/\/+/g;function ce(_,T){return typeof _=="object"&&_!==null&&_.key!=null?F(""+_.key):T.toString(36)}function oe(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(Y,Y):(_.status="pending",_.then(function(T){_.status==="pending"&&(_.status="fulfilled",_.value=T)},function(T){_.status==="pending"&&(_.status="rejected",_.reason=T)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function A(_,T,q,H,$){var J=typeof _;(J==="undefined"||J==="boolean")&&(_=null);var pe=!1;if(_===null)pe=!0;else switch(J){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(_.$$typeof){case n:case a:pe=!0;break;case g:return pe=_._init,A(pe(_._payload),T,q,H,$)}}if(pe)return $=$(_),pe=H===""?"."+ce(_,0):H,P($)?(q="",pe!=null&&(q=pe.replace(he,"$&/")+"/"),A($,T,q,"",function(Tr){return Tr})):$!=null&&(re($)&&($=ae($,q+($.key==null||_&&_.key===$.key?"":(""+$.key).replace(he,"$&/")+"/")+pe)),T.push($)),1;pe=0;var it=H===""?".":H+":";if(P(_))for(var Xe=0;Xe<_.length;Xe++)H=_[Xe],J=it+ce(H,Xe),pe+=A(H,T,q,J,$);else if(Xe=R(_),typeof Xe=="function")for(_=Xe.call(_),Xe=0;!(H=_.next()).done;)H=H.value,J=it+ce(H,Xe++),pe+=A(H,T,q,J,$);else if(J==="object"){if(typeof _.then=="function")return A(oe(_),T,q,H,$);throw T=String(_),Error("Objects are not valid as a React child (found: "+(T==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":T)+"). If you meant to render a collection of children, use an array instead.")}return pe}function B(_,T,q){if(_==null)return _;var H=[],$=0;return A(_,H,"","",function(J){return T.call(q,J,$++)}),H}function V(_){if(_._status===-1){var T=_._result;T=T(),T.then(function(q){(_._status===0||_._status===-1)&&(_._status=1,_._result=q)},function(q){(_._status===0||_._status===-1)&&(_._status=2,_._result=q)}),_._status===-1&&(_._status=0,_._result=T)}if(_._status===1)return _._result.default;throw _._result}var se=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var T=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(T))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},ge={map:B,forEach:function(_,T,q){B(_,function(){T.apply(this,arguments)},q)},count:function(_){var T=0;return B(_,function(){T++}),T},toArray:function(_){return B(_,function(T){return T})||[]},only:function(_){if(!re(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return fe.Activity=S,fe.Children=ge,fe.Component=ue,fe.Fragment=i,fe.Profiler=s,fe.PureComponent=ve,fe.StrictMode=l,fe.Suspense=m,fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,fe.__COMPILER_RUNTIME={__proto__:null,c:function(_){return D.H.useMemoCache(_)}},fe.cache=function(_){return function(){return _.apply(null,arguments)}},fe.cacheSignal=function(){return null},fe.cloneElement=function(_,T,q){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var H=Z({},_.props),$=_.key;if(T!=null)for(J in T.key!==void 0&&($=""+T.key),T)!K.call(T,J)||J==="key"||J==="__self"||J==="__source"||J==="ref"&&T.ref===void 0||(H[J]=T[J]);var J=arguments.length-2;if(J===1)H.children=q;else if(1<J){for(var pe=Array(J),it=0;it<J;it++)pe[it]=arguments[it+2];H.children=pe}return W(_.type,$,H)},fe.createContext=function(_){return _={$$typeof:d,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:f,_context:_},_},fe.createElement=function(_,T,q){var H,$={},J=null;if(T!=null)for(H in T.key!==void 0&&(J=""+T.key),T)K.call(T,H)&&H!=="key"&&H!=="__self"&&H!=="__source"&&($[H]=T[H]);var pe=arguments.length-2;if(pe===1)$.children=q;else if(1<pe){for(var it=Array(pe),Xe=0;Xe<pe;Xe++)it[Xe]=arguments[Xe+2];$.children=it}if(_&&_.defaultProps)for(H in pe=_.defaultProps,pe)$[H]===void 0&&($[H]=pe[H]);return W(_,J,$)},fe.createRef=function(){return{current:null}},fe.forwardRef=function(_){return{$$typeof:h,render:_}},fe.isValidElement=re,fe.lazy=function(_){return{$$typeof:g,_payload:{_status:-1,_result:_},_init:V}},fe.memo=function(_,T){return{$$typeof:y,type:_,compare:T===void 0?null:T}},fe.startTransition=function(_){var T=D.T,q={};D.T=q;try{var H=_(),$=D.S;$!==null&&$(q,H),typeof H=="object"&&H!==null&&typeof H.then=="function"&&H.then(Y,se)}catch(J){se(J)}finally{T!==null&&q.types!==null&&(T.types=q.types),D.T=T}},fe.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},fe.use=function(_){return D.H.use(_)},fe.useActionState=function(_,T,q){return D.H.useActionState(_,T,q)},fe.useCallback=function(_,T){return D.H.useCallback(_,T)},fe.useContext=function(_){return D.H.useContext(_)},fe.useDebugValue=function(){},fe.useDeferredValue=function(_,T){return D.H.useDeferredValue(_,T)},fe.useEffect=function(_,T){return D.H.useEffect(_,T)},fe.useEffectEvent=function(_){return D.H.useEffectEvent(_)},fe.useId=function(){return D.H.useId()},fe.useImperativeHandle=function(_,T,q){return D.H.useImperativeHandle(_,T,q)},fe.useInsertionEffect=function(_,T){return D.H.useInsertionEffect(_,T)},fe.useLayoutEffect=function(_,T){return D.H.useLayoutEffect(_,T)},fe.useMemo=function(_,T){return D.H.useMemo(_,T)},fe.useOptimistic=function(_,T){return D.H.useOptimistic(_,T)},fe.useReducer=function(_,T,q){return D.H.useReducer(_,T,q)},fe.useRef=function(_){return D.H.useRef(_)},fe.useState=function(_){return D.H.useState(_)},fe.useSyncExternalStore=function(_,T,q){return D.H.useSyncExternalStore(_,T,q)},fe.useTransition=function(){return D.H.useTransition()},fe.version="19.2.5",fe}var rm;function Nc(){return rm||(rm=1,tc.exports=Hb()),tc.exports}var G=Nc();const Lb=Qb(G),Gb=qb({__proto__:null,default:Lb},[G]);var nc={exports:{}},_i={},ac={exports:{}},rc={};var im;function Yb(){return im||(im=1,(function(n){function a(A,B){var V=A.length;A.push(B);e:for(;0<V;){var se=V-1>>>1,ge=A[se];if(0<s(ge,B))A[se]=B,A[V]=ge,V=se;else break e}}function i(A){return A.length===0?null:A[0]}function l(A){if(A.length===0)return null;var B=A[0],V=A.pop();if(V!==B){A[0]=V;e:for(var se=0,ge=A.length,_=ge>>>1;se<_;){var T=2*(se+1)-1,q=A[T],H=T+1,$=A[H];if(0>s(q,V))H<ge&&0>s($,q)?(A[se]=$,A[H]=V,se=H):(A[se]=q,A[T]=V,se=T);else if(H<ge&&0>s($,V))A[se]=$,A[H]=V,se=H;else break e}}return B}function s(A,B){var V=A.sortIndex-B.sortIndex;return V!==0?V:A.id-B.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var m=[],y=[],g=1,S=null,x=3,R=!1,L=!1,Z=!1,ne=!1,ue=typeof setTimeout=="function"?setTimeout:null,de=typeof clearTimeout=="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null;function be(A){for(var B=i(y);B!==null;){if(B.callback===null)l(y);else if(B.startTime<=A)l(y),B.sortIndex=B.expirationTime,a(m,B);else break;B=i(y)}}function P(A){if(Z=!1,be(A),!L)if(i(m)!==null)L=!0,Y||(Y=!0,F());else{var B=i(y);B!==null&&oe(P,B.startTime-A)}}var Y=!1,D=-1,K=5,W=-1;function ae(){return ne?!0:!(n.unstable_now()-W<K)}function re(){if(ne=!1,Y){var A=n.unstable_now();W=A;var B=!0;try{e:{L=!1,Z&&(Z=!1,de(D),D=-1),R=!0;var V=x;try{t:{for(be(A),S=i(m);S!==null&&!(S.expirationTime>A&&ae());){var se=S.callback;if(typeof se=="function"){S.callback=null,x=S.priorityLevel;var ge=se(S.expirationTime<=A);if(A=n.unstable_now(),typeof ge=="function"){S.callback=ge,be(A),B=!0;break t}S===i(m)&&l(m),be(A)}else l(m);S=i(m)}if(S!==null)B=!0;else{var _=i(y);_!==null&&oe(P,_.startTime-A),B=!1}}break e}finally{S=null,x=V,R=!1}B=void 0}}finally{B?F():Y=!1}}}var F;if(typeof ve=="function")F=function(){ve(re)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,ce=he.port2;he.port1.onmessage=re,F=function(){ce.postMessage(null)}}else F=function(){ue(re,0)};function oe(A,B){D=ue(function(){A(n.unstable_now())},B)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(A){A.callback=null},n.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<A?Math.floor(1e3/A):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(A){switch(x){case 1:case 2:case 3:var B=3;break;default:B=x}var V=x;x=B;try{return A()}finally{x=V}},n.unstable_requestPaint=function(){ne=!0},n.unstable_runWithPriority=function(A,B){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var V=x;x=A;try{return B()}finally{x=V}},n.unstable_scheduleCallback=function(A,B,V){var se=n.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?se+V:se):V=se,A){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=V+ge,A={id:g++,callback:B,priorityLevel:A,startTime:V,expirationTime:ge,sortIndex:-1},V>se?(A.sortIndex=V,a(y,A),i(m)===null&&A===i(y)&&(Z?(de(D),D=-1):Z=!0,oe(P,V-se))):(A.sortIndex=ge,a(m,A),L||R||(L=!0,Y||(Y=!0,F()))),A},n.unstable_shouldYield=ae,n.unstable_wrapCallback=function(A){var B=x;return function(){var V=x;x=B;try{return A.apply(this,arguments)}finally{x=V}}}})(rc)),rc}var um;function $b(){return um||(um=1,ac.exports=Yb()),ac.exports}var ic={exports:{}},ht={};var lm;function Vb(){if(lm)return ht;lm=1;var n=Nc();function a(m){var y="https://react.dev/errors/"+m;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)y+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var l={d:{f:i,r:function(){throw Error(a(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},s=Symbol.for("react.portal");function f(m,y,g){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:S==null?null:""+S,children:m,containerInfo:y,implementation:g}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,y){if(m==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return ht.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,ht.createPortal=function(m,y){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(a(299));return f(m,y,null,g)},ht.flushSync=function(m){var y=d.T,g=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=y,l.p=g,l.d.f()}},ht.preconnect=function(m,y){typeof m=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,l.d.C(m,y))},ht.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},ht.preinit=function(m,y){if(typeof m=="string"&&y&&typeof y.as=="string"){var g=y.as,S=h(g,y.crossOrigin),x=typeof y.integrity=="string"?y.integrity:void 0,R=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;g==="style"?l.d.S(m,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:S,integrity:x,fetchPriority:R}):g==="script"&&l.d.X(m,{crossOrigin:S,integrity:x,fetchPriority:R,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},ht.preinitModule=function(m,y){if(typeof m=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var g=h(y.as,y.crossOrigin);l.d.M(m,{crossOrigin:g,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&l.d.M(m)},ht.preload=function(m,y){if(typeof m=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var g=y.as,S=h(g,y.crossOrigin);l.d.L(m,g,{crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},ht.preloadModule=function(m,y){if(typeof m=="string")if(y){var g=h(y.as,y.crossOrigin);l.d.m(m,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:g,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else l.d.m(m)},ht.requestFormReset=function(m){l.d.r(m)},ht.unstable_batchedUpdates=function(m,y){return m(y)},ht.useFormState=function(m,y,g){return d.H.useFormState(m,y,g)},ht.useFormStatus=function(){return d.H.useHostTransitionStatus()},ht.version="19.2.5",ht}var sm;function Kb(){if(sm)return ic.exports;sm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),ic.exports=Vb(),ic.exports}var om;function Pb(){if(om)return _i;om=1;var n=$b(),a=Nc(),i=Kb();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(f(e)!==e)throw Error(l(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(l(188));return t!==e?null:e}for(var r=e,u=t;;){var o=r.return;if(o===null)break;var c=o.alternate;if(c===null){if(u=o.return,u!==null){r=u;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===r)return m(o),e;if(c===u)return m(o),t;c=c.sibling}throw Error(l(188))}if(r.return!==u.return)r=o,u=c;else{for(var p=!1,v=o.child;v;){if(v===r){p=!0,r=o,u=c;break}if(v===u){p=!0,u=o,r=c;break}v=v.sibling}if(!p){for(v=c.child;v;){if(v===r){p=!0,r=c,u=o;break}if(v===u){p=!0,u=c,r=o;break}v=v.sibling}if(!p)throw Error(l(189))}}if(r.alternate!==u)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,x=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),ue=Symbol.for("react.profiler"),de=Symbol.for("react.consumer"),ve=Symbol.for("react.context"),be=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),re=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=re&&e[re]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function ce(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case ue:return"Profiler";case ne:return"StrictMode";case P:return"Suspense";case Y:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case L:return"Portal";case ve:return e.displayName||"Context";case de:return(e._context.displayName||"Context")+".Consumer";case be:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D:return t=e.displayName||null,t!==null?t:ce(e.type)||"Memo";case K:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}var oe=Array.isArray,A=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},se=[],ge=-1;function _(e){return{current:e}}function T(e){0>ge||(e.current=se[ge],se[ge]=null,ge--)}function q(e,t){ge++,se[ge]=e.current,e.current=t}var H=_(null),$=_(null),J=_(null),pe=_(null);function it(e,t){switch(q(J,t),q($,e),q(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ep(t),e=zp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}T(H),q(H,e)}function Xe(){T(H),T($),T(J)}function Tr(e){e.memoizedState!==null&&q(pe,e);var t=H.current,r=zp(t,e.type);t!==r&&(q($,e),q(H,r))}function ki(e){$.current===e&&(T(H),T($)),pe.current===e&&(T(pe),mi._currentValue=V)}var Ul,Wc;function ua(e){if(Ul===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Ul=t&&t[1]||"",Wc=-1<r.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Ul+e+Wc}var Zl=!1;function ql(e,t){if(!e||Zl)return"";Zl=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(t){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(M){var j=M}Reflect.construct(e,[],k)}else{try{k.call()}catch(M){j=M}e.call(k.prototype)}}else{try{throw Error()}catch(M){j=M}(k=e())&&typeof k.catch=="function"&&k.catch(function(){})}}catch(M){if(M&&j&&typeof M.stack=="string")return[M.stack,j.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=u.DetermineComponentFrameRoot(),p=c[0],v=c[1];if(p&&v){var b=p.split(`
|
|
@@ -45,4 +45,4 @@ Error generating stack: `+u.message+`
|
|
|
45
45
|
|
|
46
46
|
`)}R.write("payload.value = newResult;"),R.write("return payload;");const de=R.compile();return(ve,be)=>de(x,ve,be)};let f;const d=Di,h=!fv.jitless,y=h&&Q1.value,g=a.catchall;let S;n._zod.parse=(x,R)=>{S??(S=l.value);const L=x.value;return d(L)?h&&y&&R?.async===!1&&R.jitless!==!0?(f||(f=s(a.shape)),x=f(x,R),g?Av([],L,x,R,S,n):x):i(x,R):(x.issues.push({expected:"object",code:"invalid_type",input:L,inst:n}),x)}});function qm(n,a,i,l){for(const f of n)if(f.issues.length===0)return a.value=f.value,a;const s=n.filter(f=>!gr(f));return s.length===1?(a.value=s[0].value,s[0]):(a.issues.push({code:"invalid_union",input:a.value,inst:i,errors:n.map(f=>f.issues.map(d=>na(d,l,ta())))}),a)}const jv=U("$ZodUnion",(n,a)=>{He.init(n,a),ze(n._zod,"optin",()=>a.options.some(s=>s._zod.optin==="optional")?"optional":void 0),ze(n._zod,"optout",()=>a.options.some(s=>s._zod.optout==="optional")?"optional":void 0),ze(n._zod,"values",()=>{if(a.options.every(s=>s._zod.values))return new Set(a.options.flatMap(s=>Array.from(s._zod.values)))}),ze(n._zod,"pattern",()=>{if(a.options.every(s=>s._zod.pattern)){const s=a.options.map(f=>f._zod.pattern);return new RegExp(`^(${s.map(f=>$c(f.source)).join("|")})$`)}});const i=a.options.length===1,l=a.options[0]._zod.run;n._zod.parse=(s,f)=>{if(i)return l(s,f);let d=!1;const h=[];for(const m of a.options){const y=m._zod.run({value:s.value,issues:[]},f);if(y instanceof Promise)h.push(y),d=!0;else{if(y.issues.length===0)return y;h.push(y)}}return d?Promise.all(h).then(m=>qm(m,s,n,f)):qm(h,s,n,f)}}),TO=U("$ZodDiscriminatedUnion",(n,a)=>{a.inclusive=!1,jv.init(n,a);const i=n._zod.parse;ze(n._zod,"propValues",()=>{const s={};for(const f of a.options){const d=f._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${a.options.indexOf(f)}"`);for(const[h,m]of Object.entries(d)){s[h]||(s[h]=new Set);for(const y of m)s[h].add(y)}}return s});const l=Rl(()=>{const s=a.options,f=new Map;for(const d of s){const h=d._zod.propValues?.[a.discriminator];if(!h||h.size===0)throw new Error(`Invalid discriminated union option at index "${a.options.indexOf(d)}"`);for(const m of h){if(f.has(m))throw new Error(`Duplicate discriminator value "${String(m)}"`);f.set(m,d)}}return f});n._zod.parse=(s,f)=>{const d=s.value;if(!Di(d))return s.issues.push({code:"invalid_type",expected:"object",input:d,inst:n}),s;const h=l.value.get(d?.[a.discriminator]);return h?h._zod.run(s,f):a.unionFallback?i(s,f):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:a.discriminator,input:d,path:[a.discriminator],inst:n}),s)}}),wO=U("$ZodIntersection",(n,a)=>{He.init(n,a),n._zod.parse=(i,l)=>{const s=i.value,f=a.left._zod.run({value:s,issues:[]},l),d=a.right._zod.run({value:s,issues:[]},l);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([m,y])=>Qm(i,m,y)):Qm(i,f,d)}});function Mc(n,a){if(n===a)return{valid:!0,data:n};if(n instanceof Date&&a instanceof Date&&+n==+a)return{valid:!0,data:n};if(xr(n)&&xr(a)){const i=Object.keys(a),l=Object.keys(n).filter(f=>i.indexOf(f)!==-1),s={...n,...a};for(const f of l){const d=Mc(n[f],a[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};s[f]=d.data}return{valid:!0,data:s}}if(Array.isArray(n)&&Array.isArray(a)){if(n.length!==a.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let l=0;l<n.length;l++){const s=n[l],f=a[l],d=Mc(s,f);if(!d.valid)return{valid:!1,mergeErrorPath:[l,...d.mergeErrorPath]};i.push(d.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function Qm(n,a,i){const l=new Map;let s;for(const h of a.issues)if(h.code==="unrecognized_keys"){s??(s=h);for(const m of h.keys)l.has(m)||l.set(m,{}),l.get(m).l=!0}else n.issues.push(h);for(const h of i.issues)if(h.code==="unrecognized_keys")for(const m of h.keys)l.has(m)||l.set(m,{}),l.get(m).r=!0;else n.issues.push(h);const f=[...l].filter(([,h])=>h.l&&h.r).map(([h])=>h);if(f.length&&s&&n.issues.push({...s,keys:f}),gr(n))return n;const d=Mc(a.value,i.value);if(!d.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(d.mergeErrorPath)}`);return n.value=d.data,n}const AO=U("$ZodRecord",(n,a)=>{He.init(n,a),n._zod.parse=(i,l)=>{const s=i.value;if(!xr(s))return i.issues.push({expected:"record",code:"invalid_type",input:s,inst:n}),i;const f=[],d=a.keyType._zod.values;if(d){i.value={};const h=new Set;for(const y of d)if(typeof y=="string"||typeof y=="number"||typeof y=="symbol"){h.add(typeof y=="number"?y.toString():y);const g=a.valueType._zod.run({value:s[y],issues:[]},l);g instanceof Promise?f.push(g.then(S=>{S.issues.length&&i.issues.push(...br(y,S.issues)),i.value[y]=S.value})):(g.issues.length&&i.issues.push(...br(y,g.issues)),i.value[y]=g.value)}let m;for(const y in s)h.has(y)||(m=m??[],m.push(y));m&&m.length>0&&i.issues.push({code:"unrecognized_keys",input:s,inst:n,keys:m})}else{i.value={};for(const h of Reflect.ownKeys(s)){if(h==="__proto__")continue;let m=a.keyType._zod.run({value:h,issues:[]},l);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof h=="string"&&Sv.test(h)&&m.issues.length){const S=a.keyType._zod.run({value:Number(h),issues:[]},l);if(S instanceof Promise)throw new Error("Async schemas not supported in object keys currently");S.issues.length===0&&(m=S)}if(m.issues.length){a.mode==="loose"?i.value[h]=s[h]:i.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(S=>na(S,l,ta())),input:h,path:[h],inst:n});continue}const g=a.valueType._zod.run({value:s[h],issues:[]},l);g instanceof Promise?f.push(g.then(S=>{S.issues.length&&i.issues.push(...br(h,S.issues)),i.value[m.value]=S.value})):(g.issues.length&&i.issues.push(...br(h,g.issues)),i.value[m.value]=g.value)}}return f.length?Promise.all(f).then(()=>i):i}}),jO=U("$ZodEnum",(n,a)=>{He.init(n,a);const i=dv(a.entries),l=new Set(i);n._zod.values=l,n._zod.pattern=new RegExp(`^(${i.filter(s=>k1.has(typeof s)).map(s=>typeof s=="string"?Er(s):s.toString()).join("|")})$`),n._zod.parse=(s,f)=>{const d=s.value;return l.has(d)||s.issues.push({code:"invalid_value",values:i,input:d,inst:n}),s}}),MO=U("$ZodLiteral",(n,a)=>{if(He.init(n,a),a.values.length===0)throw new Error("Cannot create literal schema with no valid values");const i=new Set(a.values);n._zod.values=i,n._zod.pattern=new RegExp(`^(${a.values.map(l=>typeof l=="string"?Er(l):l?Er(l.toString()):String(l)).join("|")})$`),n._zod.parse=(l,s)=>{const f=l.value;return i.has(f)||l.issues.push({code:"invalid_value",values:a.values,input:f,inst:n}),l}}),RO=U("$ZodTransform",(n,a)=>{He.init(n,a),n._zod.parse=(i,l)=>{if(l.direction==="backward")throw new cv(n.constructor.name);const s=a.transform(i.value,i);if(l.async)return(s instanceof Promise?s:Promise.resolve(s)).then(d=>(i.value=d,i));if(s instanceof Promise)throw new _r;return i.value=s,i}});function km(n,a){return n.issues.length&&a===void 0?{issues:[],value:void 0}:n}const Mv=U("$ZodOptional",(n,a)=>{He.init(n,a),n._zod.optin="optional",n._zod.optout="optional",ze(n._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,void 0]):void 0),ze(n._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${$c(i.source)})?$`):void 0}),n._zod.parse=(i,l)=>{if(a.innerType._zod.optin==="optional"){const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(f=>km(f,i.value)):km(s,i.value)}return i.value===void 0?i:a.innerType._zod.run(i,l)}}),CO=U("$ZodExactOptional",(n,a)=>{Mv.init(n,a),ze(n._zod,"values",()=>a.innerType._zod.values),ze(n._zod,"pattern",()=>a.innerType._zod.pattern),n._zod.parse=(i,l)=>a.innerType._zod.run(i,l)}),DO=U("$ZodNullable",(n,a)=>{He.init(n,a),ze(n._zod,"optin",()=>a.innerType._zod.optin),ze(n._zod,"optout",()=>a.innerType._zod.optout),ze(n._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${$c(i.source)}|null)$`):void 0}),ze(n._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,null]):void 0),n._zod.parse=(i,l)=>i.value===null?i:a.innerType._zod.run(i,l)}),NO=U("$ZodDefault",(n,a)=>{He.init(n,a),n._zod.optin="optional",ze(n._zod,"values",()=>a.innerType._zod.values),n._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);if(i.value===void 0)return i.value=a.defaultValue,i;const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(f=>Bm(f,a)):Bm(s,a)}});function Bm(n,a){return n.value===void 0&&(n.value=a.defaultValue),n}const UO=U("$ZodPrefault",(n,a)=>{He.init(n,a),n._zod.optin="optional",ze(n._zod,"values",()=>a.innerType._zod.values),n._zod.parse=(i,l)=>(l.direction==="backward"||i.value===void 0&&(i.value=a.defaultValue),a.innerType._zod.run(i,l))}),ZO=U("$ZodNonOptional",(n,a)=>{He.init(n,a),ze(n._zod,"values",()=>{const i=a.innerType._zod.values;return i?new Set([...i].filter(l=>l!==void 0)):void 0}),n._zod.parse=(i,l)=>{const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(f=>Hm(f,n)):Hm(s,n)}});function Hm(n,a){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:a}),n}const qO=U("$ZodCatch",(n,a)=>{He.init(n,a),ze(n._zod,"optin",()=>a.innerType._zod.optin),ze(n._zod,"optout",()=>a.innerType._zod.optout),ze(n._zod,"values",()=>a.innerType._zod.values),n._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(f=>(i.value=f.value,f.issues.length&&(i.value=a.catchValue({...i,error:{issues:f.issues.map(d=>na(d,l,ta()))},input:i.value}),i.issues=[]),i)):(i.value=s.value,s.issues.length&&(i.value=a.catchValue({...i,error:{issues:s.issues.map(f=>na(f,l,ta()))},input:i.value}),i.issues=[]),i)}}),QO=U("$ZodPipe",(n,a)=>{He.init(n,a),ze(n._zod,"values",()=>a.in._zod.values),ze(n._zod,"optin",()=>a.in._zod.optin),ze(n._zod,"optout",()=>a.out._zod.optout),ze(n._zod,"propValues",()=>a.in._zod.propValues),n._zod.parse=(i,l)=>{if(l.direction==="backward"){const f=a.out._zod.run(i,l);return f instanceof Promise?f.then(d=>sl(d,a.in,l)):sl(f,a.in,l)}const s=a.in._zod.run(i,l);return s instanceof Promise?s.then(f=>sl(f,a.out,l)):sl(s,a.out,l)}});function sl(n,a,i){return n.issues.length?(n.aborted=!0,n):a._zod.run({value:n.value,issues:n.issues},i)}const kO=U("$ZodReadonly",(n,a)=>{He.init(n,a),ze(n._zod,"propValues",()=>a.innerType._zod.propValues),ze(n._zod,"values",()=>a.innerType._zod.values),ze(n._zod,"optin",()=>a.innerType?._zod?.optin),ze(n._zod,"optout",()=>a.innerType?._zod?.optout),n._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(Lm):Lm(s)}});function Lm(n){return n.value=Object.freeze(n.value),n}const BO=U("$ZodLazy",(n,a)=>{He.init(n,a),ze(n._zod,"innerType",()=>a.getter()),ze(n._zod,"pattern",()=>n._zod.innerType?._zod?.pattern),ze(n._zod,"propValues",()=>n._zod.innerType?._zod?.propValues),ze(n._zod,"optin",()=>n._zod.innerType?._zod?.optin??void 0),ze(n._zod,"optout",()=>n._zod.innerType?._zod?.optout??void 0),n._zod.parse=(i,l)=>n._zod.innerType._zod.run(i,l)}),HO=U("$ZodCustom",(n,a)=>{zt.init(n,a),He.init(n,a),n._zod.parse=(i,l)=>i,n._zod.check=i=>{const l=i.value,s=a.fn(l);if(s instanceof Promise)return s.then(f=>Gm(f,i,l,n));Gm(s,i,l,n)}});function Gm(n,a,i,l){if(!n){const s={code:"custom",input:i,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(s.params=l._zod.def.params),a.issues.push(Ni(s))}}var Ym;class LO{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...i){const l=i[0];return this._map.set(a,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){const i=this._map.get(a);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(a),this}get(a){const i=a._zod.parent;if(i){const l={...this.get(i)??{}};delete l.id;const s={...l,...this._map.get(a)};return Object.keys(s).length?s:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}function GO(){return new LO}(Ym=globalThis).__zod_globalRegistry??(Ym.__zod_globalRegistry=GO());const xi=globalThis.__zod_globalRegistry;function YO(n,a){return new n({type:"string",...ee(a)})}function $O(n,a){return new n({type:"string",format:"email",check:"string_format",abort:!1,...ee(a)})}function $m(n,a){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...ee(a)})}function VO(n,a){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...ee(a)})}function KO(n,a){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ee(a)})}function PO(n,a){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ee(a)})}function XO(n,a){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ee(a)})}function JO(n,a){return new n({type:"string",format:"url",check:"string_format",abort:!1,...ee(a)})}function IO(n,a){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...ee(a)})}function FO(n,a){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...ee(a)})}function WO(n,a){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...ee(a)})}function ex(n,a){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...ee(a)})}function tx(n,a){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...ee(a)})}function nx(n,a){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...ee(a)})}function ax(n,a){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...ee(a)})}function rx(n,a){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...ee(a)})}function ix(n,a){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...ee(a)})}function ux(n,a){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ee(a)})}function lx(n,a){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ee(a)})}function sx(n,a){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...ee(a)})}function ox(n,a){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...ee(a)})}function cx(n,a){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...ee(a)})}function fx(n,a){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...ee(a)})}function dx(n,a){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ee(a)})}function hx(n,a){return new n({type:"string",format:"date",check:"string_format",...ee(a)})}function px(n,a){return new n({type:"string",format:"time",check:"string_format",precision:null,...ee(a)})}function mx(n,a){return new n({type:"string",format:"duration",check:"string_format",...ee(a)})}function yx(n,a){return new n({type:"number",checks:[],...ee(a)})}function vx(n,a){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...ee(a)})}function gx(n,a){return new n({type:"boolean",...ee(a)})}function bx(n,a){return new n({type:"null",...ee(a)})}function _x(n){return new n({type:"unknown"})}function Sx(n,a){return new n({type:"never",...ee(a)})}function Vm(n,a){return new xv({check:"less_than",...ee(a),value:n,inclusive:!1})}function fc(n,a){return new xv({check:"less_than",...ee(a),value:n,inclusive:!0})}function Km(n,a){return new Ev({check:"greater_than",...ee(a),value:n,inclusive:!1})}function dc(n,a){return new Ev({check:"greater_than",...ee(a),value:n,inclusive:!0})}function Pm(n,a){return new D2({check:"multiple_of",...ee(a),value:n})}function Rv(n,a){return new U2({check:"max_length",...ee(a),maximum:n})}function _l(n,a){return new Z2({check:"min_length",...ee(a),minimum:n})}function Cv(n,a){return new q2({check:"length_equals",...ee(a),length:n})}function Ox(n,a){return new Q2({check:"string_format",format:"regex",...ee(a),pattern:n})}function xx(n){return new k2({check:"string_format",format:"lowercase",...ee(n)})}function Ex(n){return new B2({check:"string_format",format:"uppercase",...ee(n)})}function zx(n,a){return new H2({check:"string_format",format:"includes",...ee(a),includes:n})}function Tx(n,a){return new L2({check:"string_format",format:"starts_with",...ee(a),prefix:n})}function wx(n,a){return new G2({check:"string_format",format:"ends_with",...ee(a),suffix:n})}function zr(n){return new Y2({check:"overwrite",tx:n})}function Ax(n){return zr(a=>a.normalize(n))}function jx(){return zr(n=>n.trim())}function Mx(){return zr(n=>n.toLowerCase())}function Rx(){return zr(n=>n.toUpperCase())}function Cx(){return zr(n=>q1(n))}function Dx(n,a,i){return new n({type:"array",element:a,...ee(i)})}function Nx(n,a,i){const l=ee(i);return l.abort??(l.abort=!0),new n({type:"custom",check:"custom",fn:a,...l})}function Ux(n,a,i){return new n({type:"custom",check:"custom",fn:a,...ee(i)})}function Zx(n){const a=qx(i=>(i.addIssue=l=>{if(typeof l=="string")i.issues.push(Ni(l,i.value,a._zod.def));else{const s=l;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=a),s.continue??(s.continue=!a._zod.def.abort),i.issues.push(Ni(s))}},n(i.value,i)));return a}function qx(n,a){const i=new zt({check:"custom",...ee(a)});return i._zod.check=n,i}function Sl(n){let a=n?.target??"draft-2020-12";return a==="draft-4"&&(a="draft-04"),a==="draft-7"&&(a="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??xi,target:a,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Qe(n,a,i={path:[],schemaPath:[]}){var l;const s=n._zod.def,f=a.seen.get(n);if(f)return f.count++,i.schemaPath.includes(n)&&(f.cycle=i.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:i.path};a.seen.set(n,d);const h=n._zod.toJSONSchema?.();if(h)d.schema=h;else{const g={...i,schemaPath:[...i.schemaPath,n],path:i.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(a,d.schema,g);else{const x=d.schema,R=a.processors[s.type];if(!R)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);R(n,a,x,g)}const S=n._zod.parent;S&&(d.ref||(d.ref=S),Qe(S,a,g),a.seen.get(S).isParent=!0)}const m=a.metadataRegistry.get(n);return m&&Object.assign(d.schema,m),a.io==="input"&&yt(n)&&(delete d.schema.examples,delete d.schema.default),a.io==="input"&&d.schema._prefault&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,a.seen.get(n).schema}function Ol(n,a){const i=n.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const d of n.seen.entries()){const h=n.metadataRegistry.get(d[0])?.id;if(h){const m=l.get(h);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(h,d[0])}}const s=d=>{const h=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const S=n.external.registry.get(d[0])?.id,x=n.external.uri??(L=>L);if(S)return{ref:x(S)};const R=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=R,{defId:R,ref:`${x("__shared")}#/${h}/${R}`}}if(d[1]===i)return{ref:"#"};const y=`#/${h}/`,g=d[1].schema.id??`__schema${n.counter++}`;return{defId:g,ref:y+g}},f=d=>{if(d[1].schema.$ref)return;const h=d[1],{ref:m,defId:y}=s(d);h.def={...h.schema},y&&(h.defId=y);const g=h.schema;for(const S in g)delete g[S];g.$ref=m};if(n.cycles==="throw")for(const d of n.seen.entries()){const h=d[1];if(h.cycle)throw new Error(`Cycle detected: #/${h.cycle?.join("/")}/<root>
|
|
47
47
|
|
|
48
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const h=d[1];if(a===d[0]){f(d);continue}if(n.external){const y=n.external.registry.get(d[0])?.id;if(a!==d[0]&&y){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(h.cycle){f(d);continue}if(h.count>1&&n.reused==="ref"){f(d);continue}}}function xl(n,a){const i=n.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=d=>{const h=n.seen.get(d);if(h.ref===null)return;const m=h.def??h.schema,y={...m},g=h.ref;if(h.ref=null,g){l(g);const x=n.seen.get(g),R=x.schema;if(R.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(R)):Object.assign(m,R),Object.assign(m,y),d._zod.parent===g)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in y||delete m[Z];if(R.$ref&&x.def)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in x.def&&JSON.stringify(m[Z])===JSON.stringify(x.def[Z])&&delete m[Z]}const S=d._zod.parent;if(S&&S!==g){l(S);const x=n.seen.get(S);if(x?.schema.$ref&&(m.$ref=x.schema.$ref,x.def))for(const R in m)R==="$ref"||R==="allOf"||R in x.def&&JSON.stringify(m[R])===JSON.stringify(x.def[R])&&delete m[R]}n.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(const d of[...n.seen.entries()].reverse())l(d[0]);const s={};if(n.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const d=n.external.registry.get(a)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=n.external.uri(d)}Object.assign(s,i.def??i.schema);const f=n.external?.defs??{};for(const d of n.seen.entries()){const h=d[1];h.def&&h.defId&&(f[h.defId]=h.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?s.$defs=f:s.definitions=f);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...a["~standard"],jsonSchema:{input:El(a,"input",n.processors),output:El(a,"output",n.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function yt(n,a){const i=a??{seen:new Set};if(i.seen.has(n))return!1;i.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return yt(l.element,i);if(l.type==="set")return yt(l.valueType,i);if(l.type==="lazy")return yt(l.getter(),i);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return yt(l.innerType,i);if(l.type==="intersection")return yt(l.left,i)||yt(l.right,i);if(l.type==="record"||l.type==="map")return yt(l.keyType,i)||yt(l.valueType,i);if(l.type==="pipe")return yt(l.in,i)||yt(l.out,i);if(l.type==="object"){for(const s in l.shape)if(yt(l.shape[s],i))return!0;return!1}if(l.type==="union"){for(const s of l.options)if(yt(s,i))return!0;return!1}if(l.type==="tuple"){for(const s of l.items)if(yt(s,i))return!0;return!!(l.rest&&yt(l.rest,i))}return!1}const Qx=(n,a={})=>i=>{const l=Sl({...i,processors:a});return Qe(n,l),Ol(l,n),xl(l,n)},El=(n,a,i={})=>l=>{const{libraryOptions:s,target:f}=l??{},d=Sl({...s??{},target:f,io:a,processors:i});return Qe(n,d),Ol(d,n),xl(d,n)},kx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dv=(n,a,i,l)=>{const s=i;s.type="string";const{minimum:f,maximum:d,format:h,patterns:m,contentEncoding:y}=n._zod.bag;if(typeof f=="number"&&(s.minLength=f),typeof d=="number"&&(s.maxLength=d),h&&(s.format=kx[h]??h,s.format===""&&delete s.format,h==="time"&&delete s.format),y&&(s.contentEncoding=y),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(S=>({...a.target==="draft-07"||a.target==="draft-04"||a.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},Nv=(n,a,i,l)=>{const s=i,{minimum:f,maximum:d,format:h,multipleOf:m,exclusiveMaximum:y,exclusiveMinimum:g}=n._zod.bag;typeof h=="string"&&h.includes("int")?s.type="integer":s.type="number",typeof g=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(s.minimum=g,s.exclusiveMinimum=!0):s.exclusiveMinimum=g),typeof f=="number"&&(s.minimum=f,typeof g=="number"&&a.target!=="draft-04"&&(g>=f?delete s.minimum:delete s.exclusiveMinimum)),typeof y=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(s.maximum=y,s.exclusiveMaximum=!0):s.exclusiveMaximum=y),typeof d=="number"&&(s.maximum=d,typeof y=="number"&&a.target!=="draft-04"&&(y<=d?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},Uv=(n,a,i,l)=>{i.type="boolean"},Bx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Hx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Zv=(n,a,i,l)=>{a.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Lx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Gx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},qv=(n,a,i,l)=>{i.not={}},Yx=(n,a,i,l)=>{},Qv=(n,a,i,l)=>{},$x=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},kv=(n,a,i,l)=>{const s=n._zod.def,f=dv(s.entries);f.every(d=>typeof d=="number")&&(i.type="number"),f.every(d=>typeof d=="string")&&(i.type="string"),i.enum=f},Bv=(n,a,i,l)=>{const s=n._zod.def,f=[];for(const d of s.values)if(d===void 0){if(a.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(a.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];i.type=d===null?"null":typeof d,a.target==="draft-04"||a.target==="openapi-3.0"?i.enum=[d]:i.const=d}else f.every(d=>typeof d=="number")&&(i.type="number"),f.every(d=>typeof d=="string")&&(i.type="string"),f.every(d=>typeof d=="boolean")&&(i.type="boolean"),f.every(d=>d===null)&&(i.type="null"),i.enum=f},Vx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Kx=(n,a,i,l)=>{const s=i,f=n._zod.pattern;if(!f)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=f.source},Px=(n,a,i,l)=>{const s=i,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:d,maximum:h,mime:m}=n._zod.bag;d!==void 0&&(f.minLength=d),h!==void 0&&(f.maxLength=h),m?m.length===1?(f.contentMediaType=m[0],Object.assign(s,f)):(Object.assign(s,f),s.anyOf=m.map(y=>({contentMediaType:y}))):Object.assign(s,f)},Xx=(n,a,i,l)=>{i.type="boolean"},Hv=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Jx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Lv=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ix=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Fx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Gv=(n,a,i,l)=>{const s=i,f=n._zod.def,{minimum:d,maximum:h}=n._zod.bag;typeof d=="number"&&(s.minItems=d),typeof h=="number"&&(s.maxItems=h),s.type="array",s.items=Qe(f.element,a,{...l,path:[...l.path,"items"]})},Yv=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="object",s.properties={};const d=f.shape;for(const y in d)s.properties[y]=Qe(d[y],a,{...l,path:[...l.path,"properties",y]});const h=new Set(Object.keys(d)),m=new Set([...h].filter(y=>{const g=f.shape[y]._zod;return a.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),f.catchall?._zod.def.type==="never"?s.additionalProperties=!1:f.catchall?f.catchall&&(s.additionalProperties=Qe(f.catchall,a,{...l,path:[...l.path,"additionalProperties"]})):a.io==="output"&&(s.additionalProperties=!1)},$v=(n,a,i,l)=>{const s=n._zod.def,f=s.inclusive===!1,d=s.options.map((h,m)=>Qe(h,a,{...l,path:[...l.path,f?"oneOf":"anyOf",m]}));f?i.oneOf=d:i.anyOf=d},Vv=(n,a,i,l)=>{const s=n._zod.def,f=Qe(s.left,a,{...l,path:[...l.path,"allOf",0]}),d=Qe(s.right,a,{...l,path:[...l.path,"allOf",1]}),h=y=>"allOf"in y&&Object.keys(y).length===1,m=[...h(f)?f.allOf:[f],...h(d)?d.allOf:[d]];i.allOf=m},Wx=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="array";const d=a.target==="draft-2020-12"?"prefixItems":"items",h=a.target==="draft-2020-12"||a.target==="openapi-3.0"?"items":"additionalItems",m=f.items.map((x,R)=>Qe(x,a,{...l,path:[...l.path,d,R]})),y=f.rest?Qe(f.rest,a,{...l,path:[...l.path,h,...a.target==="openapi-3.0"?[f.items.length]:[]]}):null;a.target==="draft-2020-12"?(s.prefixItems=m,y&&(s.items=y)):a.target==="openapi-3.0"?(s.items={anyOf:m},y&&s.items.anyOf.push(y),s.minItems=m.length,y||(s.maxItems=m.length)):(s.items=m,y&&(s.additionalItems=y));const{minimum:g,maximum:S}=n._zod.bag;typeof g=="number"&&(s.minItems=g),typeof S=="number"&&(s.maxItems=S)},Kv=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="object";const d=f.keyType,m=d._zod.bag?.patterns;if(f.mode==="loose"&&m&&m.size>0){const g=Qe(f.valueType,a,{...l,path:[...l.path,"patternProperties","*"]});s.patternProperties={};for(const S of m)s.patternProperties[S.source]=g}else(a.target==="draft-07"||a.target==="draft-2020-12")&&(s.propertyNames=Qe(f.keyType,a,{...l,path:[...l.path,"propertyNames"]})),s.additionalProperties=Qe(f.valueType,a,{...l,path:[...l.path,"additionalProperties"]});const y=d._zod.values;if(y){const g=[...y].filter(S=>typeof S=="string"||typeof S=="number");g.length>0&&(s.required=g)}},Pv=(n,a,i,l)=>{const s=n._zod.def,f=Qe(s.innerType,a,l),d=a.seen.get(n);a.target==="openapi-3.0"?(d.ref=s.innerType,i.nullable=!0):i.anyOf=[f,{type:"null"}]},Xv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},Jv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,i.default=JSON.parse(JSON.stringify(s.defaultValue))},Iv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,a.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Fv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType;let d;try{d=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=d},Wv=(n,a,i,l)=>{const s=n._zod.def,f=a.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Qe(f,a,l);const d=a.seen.get(n);d.ref=f},eg=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,i.readOnly=!0},eE=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},Jc=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},tg=(n,a,i,l)=>{const s=n._zod.innerType;Qe(s,a,l);const f=a.seen.get(n);f.ref=s},Xm={string:Dv,number:Nv,boolean:Uv,bigint:Bx,symbol:Hx,null:Zv,undefined:Lx,void:Gx,never:qv,any:Yx,unknown:Qv,date:$x,enum:kv,literal:Bv,nan:Vx,template_literal:Kx,file:Px,success:Xx,custom:Hv,function:Jx,transform:Lv,map:Ix,set:Fx,array:Gv,object:Yv,union:$v,intersection:Vv,tuple:Wx,record:Kv,nullable:Pv,nonoptional:Xv,default:Jv,prefault:Iv,catch:Fv,pipe:Wv,readonly:eg,promise:eE,optional:Jc,lazy:tg};function nT(n,a){if("_idmap"in n){const l=n,s=Sl({...a,processors:Xm}),f={};for(const m of l._idmap.entries()){const[y,g]=m;Qe(g,s)}const d={},h={registry:l,uri:a?.uri,defs:f};s.external=h;for(const m of l._idmap.entries()){const[y,g]=m;Ol(s,g),d[y]=xl(s,g)}if(Object.keys(f).length>0){const m=s.target==="draft-2020-12"?"$defs":"definitions";d.__shared={[m]:f}}return{schemas:d}}const i=Sl({...a,processors:Xm});return Qe(n,i),Ol(i,n),xl(i,n)}const tE=U("ZodISODateTime",(n,a)=>{rO.init(n,a),$e.init(n,a)});function nE(n){return dx(tE,n)}const aE=U("ZodISODate",(n,a)=>{iO.init(n,a),$e.init(n,a)});function rE(n){return hx(aE,n)}const iE=U("ZodISOTime",(n,a)=>{uO.init(n,a),$e.init(n,a)});function uE(n){return px(iE,n)}const lE=U("ZodISODuration",(n,a)=>{lO.init(n,a),$e.init(n,a)});function sE(n){return mx(lE,n)}const oE=(n,a)=>{yv.init(n,a),n.name="ZodError",Object.defineProperties(n,{format:{value:i=>J1(n,i)},flatten:{value:i=>X1(n,i)},addIssue:{value:i=>{n.issues.push(i),n.message=JSON.stringify(n.issues,jc,2)}},addIssues:{value:i=>{n.issues.push(...i),n.message=JSON.stringify(n.issues,jc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Pt=U("ZodError",oE,{Parent:Error}),cE=Kc(Pt),fE=Pc(Pt),dE=Cl(Pt),hE=Dl(Pt),pE=W1(Pt),mE=e2(Pt),yE=t2(Pt),vE=n2(Pt),gE=a2(Pt),bE=r2(Pt),_E=i2(Pt),SE=u2(Pt),Le=U("ZodType",(n,a)=>(He.init(n,a),Object.assign(n["~standard"],{jsonSchema:{input:El(n,"input"),output:El(n,"output")}}),n.toJSONSchema=Qx(n,{}),n.def=a,n.type=a.type,Object.defineProperty(n,"_def",{value:a}),n.check=(...i)=>n.clone(ra(a,{checks:[...a.checks??[],...i.map(l=>typeof l=="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0}),n.with=n.check,n.clone=(i,l)=>ia(n,i,l),n.brand=()=>n,n.register=((i,l)=>(i.add(n,l),n)),n.parse=(i,l)=>cE(n,i,l,{callee:n.parse}),n.safeParse=(i,l)=>dE(n,i,l),n.parseAsync=async(i,l)=>fE(n,i,l,{callee:n.parseAsync}),n.safeParseAsync=async(i,l)=>hE(n,i,l),n.spa=n.safeParseAsync,n.encode=(i,l)=>pE(n,i,l),n.decode=(i,l)=>mE(n,i,l),n.encodeAsync=async(i,l)=>yE(n,i,l),n.decodeAsync=async(i,l)=>vE(n,i,l),n.safeEncode=(i,l)=>gE(n,i,l),n.safeDecode=(i,l)=>bE(n,i,l),n.safeEncodeAsync=async(i,l)=>_E(n,i,l),n.safeDecodeAsync=async(i,l)=>SE(n,i,l),n.refine=(i,l)=>n.check(gz(i,l)),n.superRefine=i=>n.check(bz(i)),n.overwrite=i=>n.check(zr(i)),n.optional=()=>ey(n),n.exactOptional=()=>iz(n),n.nullable=()=>ty(n),n.nullish=()=>ey(ty(n)),n.nonoptional=i=>fz(n,i),n.array=()=>ig(n),n.or=i=>XE([n,i]),n.and=i=>FE(n,i),n.transform=i=>ny(n,az(i)),n.default=i=>sz(n,i),n.prefault=i=>cz(n,i),n.catch=i=>hz(n,i),n.pipe=i=>ny(n,i),n.readonly=()=>yz(n),n.describe=i=>{const l=n.clone();return xi.add(l,{description:i}),l},Object.defineProperty(n,"description",{get(){return xi.get(n)?.description},configurable:!0}),n.meta=(...i)=>{if(i.length===0)return xi.get(n);const l=n.clone();return xi.add(l,i[0]),l},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=i=>i(n),n)),ng=U("_ZodString",(n,a)=>{Xc.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>Dv(n,l,s);const i=n._zod.bag;n.format=i.format??null,n.minLength=i.minimum??null,n.maxLength=i.maximum??null,n.regex=(...l)=>n.check(Ox(...l)),n.includes=(...l)=>n.check(zx(...l)),n.startsWith=(...l)=>n.check(Tx(...l)),n.endsWith=(...l)=>n.check(wx(...l)),n.min=(...l)=>n.check(_l(...l)),n.max=(...l)=>n.check(Rv(...l)),n.length=(...l)=>n.check(Cv(...l)),n.nonempty=(...l)=>n.check(_l(1,...l)),n.lowercase=l=>n.check(xx(l)),n.uppercase=l=>n.check(Ex(l)),n.trim=()=>n.check(jx()),n.normalize=(...l)=>n.check(Ax(...l)),n.toLowerCase=()=>n.check(Mx()),n.toUpperCase=()=>n.check(Rx()),n.slugify=()=>n.check(Cx())}),OE=U("ZodString",(n,a)=>{Xc.init(n,a),ng.init(n,a),n.email=i=>n.check($O(xE,i)),n.url=i=>n.check(JO(EE,i)),n.jwt=i=>n.check(fx(kE,i)),n.emoji=i=>n.check(IO(zE,i)),n.guid=i=>n.check($m(Im,i)),n.uuid=i=>n.check(VO(ol,i)),n.uuidv4=i=>n.check(KO(ol,i)),n.uuidv6=i=>n.check(PO(ol,i)),n.uuidv7=i=>n.check(XO(ol,i)),n.nanoid=i=>n.check(FO(TE,i)),n.guid=i=>n.check($m(Im,i)),n.cuid=i=>n.check(WO(wE,i)),n.cuid2=i=>n.check(ex(AE,i)),n.ulid=i=>n.check(tx(jE,i)),n.base64=i=>n.check(sx(ZE,i)),n.base64url=i=>n.check(ox(qE,i)),n.xid=i=>n.check(nx(ME,i)),n.ksuid=i=>n.check(ax(RE,i)),n.ipv4=i=>n.check(rx(CE,i)),n.ipv6=i=>n.check(ix(DE,i)),n.cidrv4=i=>n.check(ux(NE,i)),n.cidrv6=i=>n.check(lx(UE,i)),n.e164=i=>n.check(cx(QE,i)),n.datetime=i=>n.check(nE(i)),n.date=i=>n.check(rE(i)),n.time=i=>n.check(uE(i)),n.duration=i=>n.check(sE(i))});function Jm(n){return YO(OE,n)}const $e=U("ZodStringFormat",(n,a)=>{Ye.init(n,a),ng.init(n,a)}),xE=U("ZodEmail",(n,a)=>{X2.init(n,a),$e.init(n,a)}),Im=U("ZodGUID",(n,a)=>{K2.init(n,a),$e.init(n,a)}),ol=U("ZodUUID",(n,a)=>{P2.init(n,a),$e.init(n,a)}),EE=U("ZodURL",(n,a)=>{J2.init(n,a),$e.init(n,a)}),zE=U("ZodEmoji",(n,a)=>{I2.init(n,a),$e.init(n,a)}),TE=U("ZodNanoID",(n,a)=>{F2.init(n,a),$e.init(n,a)}),wE=U("ZodCUID",(n,a)=>{W2.init(n,a),$e.init(n,a)}),AE=U("ZodCUID2",(n,a)=>{eO.init(n,a),$e.init(n,a)}),jE=U("ZodULID",(n,a)=>{tO.init(n,a),$e.init(n,a)}),ME=U("ZodXID",(n,a)=>{nO.init(n,a),$e.init(n,a)}),RE=U("ZodKSUID",(n,a)=>{aO.init(n,a),$e.init(n,a)}),CE=U("ZodIPv4",(n,a)=>{sO.init(n,a),$e.init(n,a)}),DE=U("ZodIPv6",(n,a)=>{oO.init(n,a),$e.init(n,a)}),NE=U("ZodCIDRv4",(n,a)=>{cO.init(n,a),$e.init(n,a)}),UE=U("ZodCIDRv6",(n,a)=>{fO.init(n,a),$e.init(n,a)}),ZE=U("ZodBase64",(n,a)=>{dO.init(n,a),$e.init(n,a)}),qE=U("ZodBase64URL",(n,a)=>{pO.init(n,a),$e.init(n,a)}),QE=U("ZodE164",(n,a)=>{mO.init(n,a),$e.init(n,a)}),kE=U("ZodJWT",(n,a)=>{vO.init(n,a),$e.init(n,a)}),ag=U("ZodNumber",(n,a)=>{Tv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>Nv(n,l,s),n.gt=(l,s)=>n.check(Km(l,s)),n.gte=(l,s)=>n.check(dc(l,s)),n.min=(l,s)=>n.check(dc(l,s)),n.lt=(l,s)=>n.check(Vm(l,s)),n.lte=(l,s)=>n.check(fc(l,s)),n.max=(l,s)=>n.check(fc(l,s)),n.int=l=>n.check(Fm(l)),n.safe=l=>n.check(Fm(l)),n.positive=l=>n.check(Km(0,l)),n.nonnegative=l=>n.check(dc(0,l)),n.negative=l=>n.check(Vm(0,l)),n.nonpositive=l=>n.check(fc(0,l)),n.multipleOf=(l,s)=>n.check(Pm(l,s)),n.step=(l,s)=>n.check(Pm(l,s)),n.finite=()=>n;const i=n._zod.bag;n.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),n.isFinite=!0,n.format=i.format??null});function BE(n){return yx(ag,n)}const HE=U("ZodNumberFormat",(n,a)=>{gO.init(n,a),ag.init(n,a)});function Fm(n){return vx(HE,n)}const LE=U("ZodBoolean",(n,a)=>{bO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Uv(n,i,l)});function aT(n){return gx(LE,n)}const GE=U("ZodNull",(n,a)=>{_O.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Zv(n,i,l)});function rT(n){return bx(GE,n)}const YE=U("ZodUnknown",(n,a)=>{SO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Qv()});function Rc(){return _x(YE)}const $E=U("ZodNever",(n,a)=>{OO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>qv(n,i,l)});function rg(n){return Sx($E,n)}const VE=U("ZodArray",(n,a)=>{xO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Gv(n,i,l,s),n.element=a.element,n.min=(i,l)=>n.check(_l(i,l)),n.nonempty=i=>n.check(_l(1,i)),n.max=(i,l)=>n.check(Rv(i,l)),n.length=(i,l)=>n.check(Cv(i,l)),n.unwrap=()=>n.element});function ig(n,a){return Dx(VE,n,a)}const Ic=U("ZodObject",(n,a)=>{zO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Yv(n,i,l,s),ze(n,"shape",()=>a.shape),n.keyof=()=>ez(Object.keys(n._zod.def.shape)),n.catchall=i=>n.clone({...n._zod.def,catchall:i}),n.passthrough=()=>n.clone({...n._zod.def,catchall:Rc()}),n.loose=()=>n.clone({...n._zod.def,catchall:Rc()}),n.strict=()=>n.clone({...n._zod.def,catchall:rg()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=i=>Y1(n,i),n.safeExtend=i=>$1(n,i),n.merge=i=>V1(n,i),n.pick=i=>L1(n,i),n.omit=i=>G1(n,i),n.partial=(...i)=>K1(lg,n,i[0]),n.required=(...i)=>P1(sg,n,i[0])});function KE(n,a){const i={type:"object",shape:n??{},...ee(a)};return new Ic(i)}function iT(n,a){return new Ic({type:"object",shape:n,catchall:rg(),...ee(a)})}function PE(n,a){return new Ic({type:"object",shape:n,catchall:Rc(),...ee(a)})}const ug=U("ZodUnion",(n,a)=>{jv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>$v(n,i,l,s),n.options=a.options});function XE(n,a){return new ug({type:"union",options:n,...ee(a)})}const JE=U("ZodDiscriminatedUnion",(n,a)=>{ug.init(n,a),TO.init(n,a)});function uT(n,a,i){return new JE({type:"union",options:a,discriminator:n,...ee(i)})}const IE=U("ZodIntersection",(n,a)=>{wO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Vv(n,i,l,s)});function FE(n,a){return new IE({type:"intersection",left:n,right:a})}const WE=U("ZodRecord",(n,a)=>{AO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Kv(n,i,l,s),n.keyType=a.keyType,n.valueType=a.valueType});function lT(n,a,i){return new WE({type:"record",keyType:n,valueType:a,...ee(i)})}const Cc=U("ZodEnum",(n,a)=>{jO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>kv(n,l,s),n.enum=a.entries,n.options=Object.values(a.entries);const i=new Set(Object.keys(a.entries));n.extract=(l,s)=>{const f={};for(const d of l)if(i.has(d))f[d]=a.entries[d];else throw new Error(`Key ${d} not found in enum`);return new Cc({...a,checks:[],...ee(s),entries:f})},n.exclude=(l,s)=>{const f={...a.entries};for(const d of l)if(i.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new Cc({...a,checks:[],...ee(s),entries:f})}});function ez(n,a){const i=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new Cc({type:"enum",entries:i,...ee(a)})}const tz=U("ZodLiteral",(n,a)=>{MO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Bv(n,i,l),n.values=new Set(a.values),Object.defineProperty(n,"value",{get(){if(a.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return a.values[0]}})});function Wm(n,a){return new tz({type:"literal",values:Array.isArray(n)?n:[n],...ee(a)})}const nz=U("ZodTransform",(n,a)=>{RO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Lv(n,i),n._zod.parse=(i,l)=>{if(l.direction==="backward")throw new cv(n.constructor.name);i.addIssue=f=>{if(typeof f=="string")i.issues.push(Ni(f,i.value,a));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=i.value),d.inst??(d.inst=n),i.issues.push(Ni(d))}};const s=a.transform(i.value,i);return s instanceof Promise?s.then(f=>(i.value=f,i)):(i.value=s,i)}});function az(n){return new nz({type:"transform",transform:n})}const lg=U("ZodOptional",(n,a)=>{Mv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jc(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function ey(n){return new lg({type:"optional",innerType:n})}const rz=U("ZodExactOptional",(n,a)=>{CO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jc(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function iz(n){return new rz({type:"optional",innerType:n})}const uz=U("ZodNullable",(n,a)=>{DO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Pv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function ty(n){return new uz({type:"nullable",innerType:n})}const lz=U("ZodDefault",(n,a)=>{NO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function sz(n,a){return new lz({type:"default",innerType:n,get defaultValue(){return typeof a=="function"?a():pv(a)}})}const oz=U("ZodPrefault",(n,a)=>{UO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Iv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function cz(n,a){return new oz({type:"prefault",innerType:n,get defaultValue(){return typeof a=="function"?a():pv(a)}})}const sg=U("ZodNonOptional",(n,a)=>{ZO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Xv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function fz(n,a){return new sg({type:"nonoptional",innerType:n,...ee(a)})}const dz=U("ZodCatch",(n,a)=>{qO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Fv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function hz(n,a){return new dz({type:"catch",innerType:n,catchValue:typeof a=="function"?a:()=>a})}const pz=U("ZodPipe",(n,a)=>{QO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Wv(n,i,l,s),n.in=a.in,n.out=a.out});function ny(n,a){return new pz({type:"pipe",in:n,out:a})}const mz=U("ZodReadonly",(n,a)=>{kO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>eg(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function yz(n){return new mz({type:"readonly",innerType:n})}const vz=U("ZodLazy",(n,a)=>{BO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>tg(n,i,l,s),n.unwrap=()=>n._zod.def.getter()});function sT(n){return new vz({type:"lazy",getter:n})}const Fc=U("ZodCustom",(n,a)=>{HO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Hv(n,i)});function oT(n,a){return Nx(Fc,n??(()=>!0),a)}function gz(n,a={}){return Ux(Fc,n,a)}function bz(n){return Zx(n)}function cT(n,a={}){const i=new Fc({type:"custom",check:"custom",fn:l=>l instanceof n,abort:!0,...ee(a)});return i._zod.bag.Class=n,i._zod.check=l=>{l.value instanceof n||l.issues.push({code:"invalid_type",expected:n.name,input:l.value,inst:i,path:[...i._zod.def.path??[]]})},i}const _z={CREATE_WIDGET:"create_widget",UPDATE_WIDGET:"update_widget",DELETE_WIDGET:"delete_widget",CREATE_MONITOR:"create_monitor",UPDATE_MONITOR:"update_monitor",DELETE_MONITOR:"delete_monitor",TOGGLE_MONITOR:"toggle_monitor",BEGIN_ANALYSIS:"begin_analysis"},og=Object.fromEntries(Object.entries(_z).map(([n,a])=>[n,`tool-${a}`])),cg="<analysis>";function Sz(n){return n.role!=="assistant"||!n.parts?!1:n.parts.some(a=>{if(a.type===og.BEGIN_ANALYSIS)return!0;if(a.type!=="text")return!1;const i=a.text;return typeof i=="string"&&i.includes(cg)})}function fT(n,a){const i=n[a];return!i||i.role!=="assistant"?null:Sz(i)?a>=1?a:null:a+1}function Oz(n){const a=n.findIndex(i=>i.type===og.BEGIN_ANALYSIS);if(a!==-1)return{kind:"tool",partIdx:a};for(let i=0;i<n.length;i++){const l=n[i];if(l.type!=="text")continue;const s=l.text;if(typeof s!="string")continue;const f=s.indexOf(cg);if(f!==-1)return{kind:"text",partIdx:i,charIdx:f}}return null}function dT(n){const a=Oz(n);if(!a)return null;if(a.kind==="tool")return n.slice(a.partIdx);const i=n[a.partIdx];return[{...i,text:i.text.slice(a.charIdx)},...n.slice(a.partIdx+1)]}const xz=KE({v:Wm(1),kind:Wm("analysis"),sourceTitle:Jm().max(400),sourceCreatedAt:BE().int().nonnegative(),parts:ig(PE({type:Jm()})).max(200)}),cl={dashboards:!1,monitors:!1},hT={paper:"#fafaf8",inkLight:"#444444",inkMuted:"#666666",inkFaint:"#9c9890",border:"#d4d2cd",success:"#2a7a4a"},Re={shell:"bg-[#fafaf8] text-[#2c2c2c] font-sans",sidebar:"bg-[#f7f6f3] border-r border-[#d4d2cd] font-sans",sidebarLogo:"text-[#2b5ea7]",sidebarSubtitle:"text-[#666666]",navActive:"text-[#2b5ea7] bg-[#eaf0f8] border-l-2 border-[#2b5ea7]",navInactive:"text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] border-l-2 border-transparent",sidebarFooter:"border-t border-[#d4d2cd] text-[#666666]",page:"p-6 space-y-6 bg-[#fafaf8]",sectionTitle:"text-sm font-medium text-[#666666] mb-3 font-sans",card:"rounded bg-white border border-[#d4d2cd] p-6",cardTitle:"text-sm text-[#666666] font-sans",cardValue:"text-2xl font-bold text-[#2c2c2c] mt-1",tableContainer:"bg-white rounded border border-[#d4d2cd] overflow-auto max-h-[440px]",tableHeaderRow:"bg-[#f5f4f0]",tableHeaderCell:"px-4 py-3 text-left text-sm font-medium text-[#666666] uppercase tracking-wider font-sans",tableRow:"border-b border-[#e8e6e1] hover:bg-[#f5f4f0]/50",tableCell:"px-4 py-3 text-sm text-[#444444] max-w-[300px]",tableCellText:"line-clamp-2 cursor-default",badge:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium font-sans",badgeVariants:{info:"bg-[#2b5ea7]/10 text-[#2b5ea7]"},spinner:"border-[#e8e6e1] border-t-[#2b5ea7]",statusLabel:"text-sm text-[#666666]",statusDot:{connected:"bg-[#2a7a4a]",disconnected:"bg-[#b33a2a]",checking:"bg-[#a07020] animate-pulse"},input:"w-full bg-white border border-[#d4d2cd] rounded px-3 py-2 text-sm text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] font-sans",primaryBtn:"px-4 py-1.5 text-sm bg-[#2b5ea7] hover:bg-[#234d8a] text-white rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-sans",secondaryBtn:"px-4 py-1.5 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] rounded transition-colors disabled:opacity-50 font-sans",dangerBtn:"px-4 py-1.5 text-sm bg-[#b33a2a]/10 hover:bg-[#b33a2a]/20 text-[#b33a2a] rounded transition-colors disabled:opacity-50 ml-auto font-sans",outlineBtn:"px-2.5 py-1 text-xs font-medium border border-[#2b5ea7] text-[#2b5ea7] rounded hover:bg-[#2b5ea7] hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-[#2b5ea7] font-sans",successText:"text-sm text-[#2a7a4a] font-sans",errorText:"text-sm text-[#b33a2a] font-sans",warnText:"text-xs text-[#a07020] font-sans",maskedKey:"text-xs text-[#666666] font-mono",chatContainer:"flex flex-col h-full bg-[#fafaf8] font-serif",chatUserLabel:"text-[10px] uppercase tracking-[0.15em] text-[#666666] mb-2 font-sans font-medium",chatAssistantLabel:"text-[10px] uppercase tracking-[0.15em] text-[#2b5ea7] mb-2 font-sans font-medium",chatUserMessage:"text-[#2c2c2c] text-base leading-[1.8] [overflow-wrap:break-word]",chatAssistantMessage:"text-[#444444] text-base leading-[1.8] [overflow-wrap:break-word]",chatSeparator:"my-6 border-b border-[#e8e6e1]",chatInputArea:"px-10 py-5 bg-white border-t border-[#d4d2cd]",chatInput:"flex-1 bg-white border border-[#d4d2cd] rounded px-4 py-2.5 text-base text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] disabled:opacity-50 font-serif resize-none overflow-y-auto max-h-40",chatButton:"px-5 py-2.5 text-sm bg-[#2b5ea7] text-white font-sans font-medium rounded hover:bg-[#234d8a] disabled:opacity-50 disabled:cursor-not-allowed",chatThinking:"text-[#2b5ea7] text-base italic",chatEmptyState:"text-[#666666] text-base italic font-serif",toolLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2b5ea7] font-sans font-semibold mb-2",toolLoading:"text-sm italic text-[#2b5ea7] font-sans",toolQueryToggle:"text-[11px] text-[#666666] font-mono cursor-pointer select-none font-sans",toolQueryCode:"mt-1 px-3 py-2 text-[12px] font-mono text-[#444444] bg-[#f5f4f0] rounded border border-[#d4d2cd] whitespace-pre-wrap",chatMessageCard:"bg-[#fafaf8] p-4 rounded",chatMessageActions:"absolute right-0 top-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",chatActionButton:"p-1 rounded text-[#9c9890] hover:text-[#2b5ea7] hover:bg-[#eaf0f8] transition-colors",chatEditTextarea:"w-full bg-white border border-[#2b5ea7] rounded px-3 py-2 text-base text-[#2c2c2c] focus:outline-none font-serif leading-[1.8] resize-none",chatEditActions:"flex items-center gap-2 mt-2",chatEditSave:"px-3 py-1 text-xs bg-[#2b5ea7] hover:bg-[#234d8a] text-white rounded transition-colors font-sans",chatEditCancel:"px-3 py-1 text-xs bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] rounded transition-colors font-sans",chatStopButton:"px-5 py-2.5 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] font-sans font-medium rounded transition-colors",chatContinueButton:"px-4 py-2 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#2b5ea7] font-sans font-medium rounded transition-colors border border-[#d4d2cd]",resultListItem:"px-4 py-2 text-sm text-[#444444] border-b border-[#e8e6e1] last:border-b-0",resultErrorMessage:"text-sm text-[#b33a2a] font-sans bg-[#b33a2a]/5 border border-[#b33a2a]/20 rounded px-4 py-3 my-2",analysisContainer:"bg-[#eaf0f8] border border-[#2b5ea7]/20 rounded px-4 py-3 my-3",compactionContainer:"bg-[#f5f1e6] border border-[#8a6d3b]/25 rounded px-4 py-3 my-3",compactionLabel:"text-[9px] uppercase tracking-[0.15em] text-[#8a6d3b] font-sans font-semibold mb-1",compactionButton:"px-4 py-2 text-sm bg-[#f5f1e6] hover:bg-[#efe8d5] text-[#8a6d3b] font-sans font-medium rounded transition-colors border border-[#8a6d3b]/25",compactionPill:"flex items-center gap-2 px-4 py-2 text-sm font-sans text-[#8a6d3b] bg-[#f5f1e6] border border-[#8a6d3b]/25 rounded",investigationContainer:"border-l-2 border-[#2a7a4a] pl-4 my-3",investigationLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2a7a4a] font-sans font-semibold mb-2",investigationAccents:{newrelic:{container:"border-l-2 border-[#2a7a4a] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#2a7a4a] font-sans font-semibold mb-2"},posthog:{container:"border-l-2 border-[#f7a501] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#f7a501] font-sans font-semibold mb-2"},gcp:{container:"border-l-2 border-[#7c3aed] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#7c3aed] font-sans font-semibold mb-2"},jira:{container:"border-l-2 border-[#0052cc] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#0052cc] font-sans font-semibold mb-2"}},investigationTask:"text-xs text-[#9c9890] font-sans mb-2 italic",investigationThinking:"text-[#9c9890] py-2",analysisBlock:"text-sm text-[#444444] bg-[#f2f8f5] border border-[#c8e0d2] rounded px-4 py-3 my-2 leading-relaxed font-sans",summaryBlock:"text-sm text-[#2c2c2c] bg-[#eaf0f8] border border-[#2b5ea7]/20 rounded px-4 py-3 my-2 leading-relaxed font-sans",summaryLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2b5ea7] font-sans font-semibold mb-1",chartContainer:"bg-white rounded border border-[#d4d2cd] p-4 my-2",settingsCard:"bg-white border border-[#d4d2cd] rounded p-4",dialogBackdrop:"fixed inset-0 z-50 bg-black/20",dialogCard:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white border border-[#d4d2cd] rounded-lg shadow-lg p-6 w-[340px] font-sans",modalCard:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white border border-[#d4d2cd] rounded-lg shadow-lg p-6 w-[480px] max-h-[85vh] overflow-y-auto font-sans",dialogTitle:"text-sm font-semibold text-[#2c2c2c] mb-2",dialogMessage:"text-sm text-[#666666] mb-5",sessionItem:"w-full flex items-center gap-2 pl-9 pr-4 py-1.5 text-xs text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] transition-colors cursor-pointer group",sessionItemActive:"w-full flex items-center gap-2 pl-9 pr-4 py-1.5 text-xs text-[#2b5ea7] bg-[#eaf0f8] cursor-pointer group font-medium",sessionDeleteBtn:"ml-auto text-[#666666] hover:text-[#b33a2a] transition-colors text-[10px] shrink-0 opacity-0 group-hover:opacity-100",sessionNewBtn:"w-full flex items-center gap-2 pl-9 pr-3 py-1.5 text-xs text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] transition-colors",panelChatUserMessage:"text-sm leading-relaxed text-[#2c2c2c] [overflow-wrap:break-word]",panelChatAssistantMessage:"text-sm leading-relaxed text-[#444444] [overflow-wrap:break-word]",panelChatEmptyState:"text-[#666666] text-sm italic font-sans",panelChatThinking:"text-[#666666] text-sm italic",panelChatSeparator:"my-3 border-b border-[#d4d2cd]",panelChatInputArea:"px-4 py-3 bg-white border-t border-[#d4d2cd]",panelChatTextarea:"flex-1 bg-white border border-[#d4d2cd] rounded px-3 py-2 text-sm text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] disabled:opacity-50 font-sans resize-none overflow-y-auto max-h-24",chartColors:["#6b9fd4","#6bb88a","#d4806e","#d4b06b","#a488c4","#6bb8aa"],popoverWide:"absolute z-30 bg-[#faf8f4] border border-[#e8e3da] rounded-md shadow-lg py-2 px-3 w-72",popoverLabel:"text-[10px] uppercase tracking-wider text-[#9c9890] font-sans mb-2",popoverRow:"flex items-start gap-2 py-1 text-xs text-[#6b6560] font-sans",popoverItemRow:"flex items-center justify-between text-[11px] text-[#6b6560] font-sans py-0.5",popoverDivider:"border-t border-[#e8e3da] my-1",popoverFootnote:"text-[10px] text-[#9c9890] font-sans mt-1 pt-1 border-t border-[#e8e3da]",titleBar:"sticky top-0 z-20 bg-[#faf8f4] px-10 pt-4 pb-4 mb-2 border-b border-[#e8e3da]",titleText:"text-base font-serif font-medium text-[#2b5ea7] tracking-tight",metaLink:"text-xs text-[#666666] hover:text-[#2b5ea7] font-sans transition-colors",streamingDot:"inline-block w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse",tokenSummary:"text-[10px] text-[#9c9890] font-sans tracking-wide hover:text-[#6b6560] transition-colors cursor-default"};function Ez({sidebar:n,children:a}){return C.jsxs("div",{className:`flex h-screen ${Re.shell}`,children:[C.jsx("aside",{className:"w-52 flex-shrink-0 h-full",children:n}),C.jsx("main",{className:"flex-1 overflow-auto",children:a})]})}const pT=n=>`${n.provider}:${n.modelId}`,zz={anthropic:"Anthropic",google:"Google AI","google-vertex":"Vertex AI"};function Tz(n){return zz[n]??n}const ay=["anthropic","google","google-vertex"];function mT(n){const a=new Map;for(const i of n){const l=a.get(i.provider);l?l.push(i):a.set(i.provider,[i])}return[...a.keys()].sort((i,l)=>{const s=ay.indexOf(i),f=ay.indexOf(l);return(s===-1?99:s)-(f===-1?99:f)}).map(i=>({provider:i,label:Tz(i),models:a.get(i)}))}const Dc=[{provider:"google",modelId:"gemini-3.1-pro-preview",inputPrice:2,outputPrice:12,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3.5-flash",inputPrice:1.5,outputPrice:9,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3-flash-preview",inputPrice:.5,outputPrice:3,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3.1-flash-lite-preview",inputPrice:.25,outputPrice:1.5,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"anthropic",modelId:"claude-haiku-4-5-20251001",inputPrice:.8,outputPrice:4,cacheReadMultiplier:.1,cacheWriteMultiplier:1.25}],wz=Object.fromEntries(Dc.map(n=>[n.modelId,{input:n.inputPrice,output:n.outputPrice,cacheRead:n.cacheReadMultiplier,cacheWrite:n.cacheWriteMultiplier}]));function yT(n,a,i,l=0,s=0){if(!n)return 0;const f=wz[n];return f?((a-l)*f.input+l*f.input*f.cacheRead+s*f.input*f.cacheWrite+i*f.output)/1e6:0}function vT(n){return n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const un={sessionStaleTimeMs:3e4,activeStreamPollingMs:5e3,monitorPollingMs:6e4,updateCheckStaleTimeMs:300*1e3,updateRestartProbeDelayMs:1500,updateRestartPollMs:1e3,updateRestartMaxWaitMs:6e4,sidebarWidth:208,panelMinWidth:260,panelMaxWidthRatio:.8,gridRows:12,gridCols:12,gridMinRowHeight:20,gridMargin:[8,8],chatThrottleMs:50,maxSseErrors:3,maxBuckets:366};function gT(){const n=G.useRef(null),a=G.useRef(null),i=G.useRef(!0),[l,s]=G.useState(!0),f=G.useCallback(m=>{const y=n.current;y&&(i.current=!0,y.scrollTo({top:y.scrollHeight,behavior:m?.animation==="smooth"?"smooth":"instant"}))},[]),d=G.useCallback(m=>{const y=n.current;y&&(i.current=!1,y.scrollTo({top:0,behavior:m?.animation==="smooth"?"smooth":"instant"}))},[]),h=G.useCallback(m=>{m.deltaY<0&&(i.current=!1)},[]);return G.useEffect(()=>{const m=n.current;if(!m)return;const y=()=>{const g=m.scrollHeight-m.scrollTop-m.clientHeight<50;s(g),g&&(i.current=!0)};return m.addEventListener("scroll",y,{passive:!0}),()=>m.removeEventListener("scroll",y)},[]),G.useEffect(()=>{const m=a.current;if(!m)return;const y=new ResizeObserver(()=>{i.current&&f()});return y.observe(m),()=>y.disconnect()},[f]),{scrollRef:n,contentRef:a,isAtBottom:l,handleWheel:h,scrollToBottom:f,scrollToTop:d}}function bT(){const n=G.useRef(null),[a,i]=G.useState({width:0,height:0});return G.useEffect(()=>{const l=n.current;if(!l)return;const s=new ResizeObserver(f=>{const d=f[0]?.contentRect;d&&d.width>0&&i({width:d.width,height:d.height})});return s.observe(l),()=>s.disconnect()},[]),{ref:n,size:a}}function ry(n,a,i){const l=G.useRef(n);l.current=n,G.useEffect(()=>{if(!i)return;l.current();const s=setInterval(()=>{document.visibilityState==="visible"&&l.current()},a),f=()=>{document.visibilityState==="visible"&&l.current()};return document.addEventListener("visibilitychange",f),()=>{clearInterval(s),document.removeEventListener("visibilitychange",f)}},[i,a])}function Az(n){const[a,i]=G.useState(!1),[l,s]=G.useState(!1);return G.useEffect(()=>{const f=n.current;if(!f)return;const d=()=>{i(f.scrollTop>0),s(f.scrollTop+f.clientHeight<f.scrollHeight-1)};d(),f.addEventListener("scroll",d,{passive:!0});const h=new ResizeObserver(d);return h.observe(f),()=>{f.removeEventListener("scroll",d),h.disconnect()}},[n]),{showTopFade:a,showBottomFade:l}}function _T(){return at.provider.gcpAuthStatus.useQuery(void 0,{refetchInterval:un.sessionStaleTimeMs,staleTime:un.sessionStaleTimeMs})}function jz(){const{data:n}=at.settings.getApiKey.useQuery("anthropic"),{data:a}=at.settings.getApiKey.useQuery("google"),{data:i}=at.settings.getVertexConfig.useQuery();return G.useMemo(()=>{const l=new Set;return n&&l.add("anthropic"),a&&l.add("google"),i?.projectId&&l.add("google-vertex"),l},[n,a,i])}function ST(){const n=jz(),a=n.has("google-vertex"),{data:i,isLoading:l}=at.provider.listVertexModels.useQuery(void 0,{enabled:a});return{models:G.useMemo(()=>{const f=Dc.filter(m=>n.has(m.provider)),d=a?(i??[]).map(m=>({provider:"google-vertex",modelId:m.modelId})):[],h=[...f,...d];return h.length>0?h:Dc},[n,a,i]),isLoading:a&&l}}function Mz(n,a=!0){const[i,l]=G.useState(!1),s=G.useRef(0),f=G.useRef(n);f.current=n;const d=m=>Array.from(m.dataTransfer.types).includes("Files");return{dragActive:a&&i,dropProps:a?{onDragEnter:m=>{d(m)&&(m.preventDefault(),s.current+=1,l(!0))},onDragOver:m=>{d(m)&&m.preventDefault()},onDragLeave:()=>{s.current=Math.max(0,s.current-1),s.current===0&&l(!1)},onDrop:m=>{m.preventDefault(),s.current=0,l(!1),m.dataTransfer.files?.length&&f.current(m.dataTransfer.files)}}:{}}}function OT(n,a){const i=G.useRef(a);G.useEffect(()=>{i.current=a}),G.useEffect(()=>{function l(s){n.current&&!n.current.contains(s.target)&&i.current()}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n])}const Sr=Uint8Array.from([84,82,67,49]),Rz=4,Ti=Sr.length+Rz,Cz=10*1024*1024;async function fg(n){const a=new Blob([n.buffer],{type:"image/png"});return createImageBitmap(a,{colorSpaceConversion:"none",premultiplyAlpha:"none"})}function dg(n){const a=document.createElement("canvas");a.width=n.width,a.height=n.height;const i=a.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("canvas 2D context unavailable");i.drawImage(n,0,0);const l=i.getImageData(0,0,a.width,a.height);return{canvas:a,ctx:i,imageData:l}}function Dz(n,a){const i=a.length*8;let l=0;for(let s=0;s<n.length&&l<i;s+=4)if(n[s+3]===255)for(let f=0;f<3&&l<i;f++){const d=l>>3,h=7-(l&7),m=a[d]>>h&1;n[s+f]=n[s+f]&254|m,l++}if(l<i)throw new Error("LSB write ran out of capacity mid-stream")}function iy(n,a){const i=new Uint8Array(a),l=a*8;let s=0;for(let f=0;f<n.length&&s<l;f+=4)if(n[f+3]===255)for(let d=0;d<3&&s<l;d++){const h=s>>3,m=7-(s&7);i[h]|=(n[f+d]&1)<<m,s++}return s>=l?i:null}function Nz(n){return new Promise((a,i)=>{n.toBlob(async l=>{if(!l){i(new Error("canvas.toBlob returned null"));return}a(new Uint8Array(await l.arrayBuffer()))},"image/png")})}async function xT(n,a){const i=await fg(n);try{const{canvas:l,ctx:s,imageData:f}=dg(i),d=new Uint8Array(Ti+a.length);return d.set(Sr,0),new DataView(d.buffer).setUint32(Sr.length,a.length,!1),d.set(a,Ti),Dz(f.data,d),s.putImageData(f,0,0),await Nz(l)}finally{i.close?.()}}async function Uz(n){const a=await fg(n);try{const{imageData:{data:i}}=dg(a),l=iy(i,Ti);if(!l)return null;for(let d=0;d<Sr.length;d++)if(l[d]!==Sr[d])return null;const s=new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(Sr.length,!1);if(s<=0||s>Cz)return null;const f=iy(i,Ti+s);return f?f.subarray(Ti):null}finally{a.close?.()}}function fl({children:n}){const a=G.useRef(null),{showTopFade:i,showBottomFade:l}=Az(a);return C.jsxs("div",{className:"relative",children:[C.jsx("div",{className:`absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-[#f7f6f3] to-transparent z-10 pointer-events-none transition-opacity ${i?"opacity-100":"opacity-0"}`}),C.jsx("div",{ref:a,className:"max-h-[300px] overflow-y-auto scrollbar-none",children:n}),C.jsx("div",{className:`absolute bottom-0 left-0 right-0 h-6 bg-gradient-to-t from-[#f7f6f3] to-transparent z-10 pointer-events-none transition-opacity ${l?"opacity-100":"opacity-0"}`})]})}function Zz({open:n,title:a,message:i,confirmLabel:l="Delete",cancelLabel:s="Cancel",confirmStyle:f="danger",onConfirm:d,onCancel:h}){const m=G.useRef(null);return G.useEffect(()=>{n&&m.current?.focus()},[n]),G.useEffect(()=>{if(!n)return;const y=g=>{g.key==="Escape"&&h()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n,h]),n?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:Re.dialogBackdrop,onClick:h}),C.jsxs("div",{className:Re.dialogCard,children:[C.jsx("div",{className:Re.dialogTitle,children:a}),C.jsx("div",{className:Re.dialogMessage,children:i}),C.jsxs("div",{className:"flex justify-end gap-2",children:[s!==null&&C.jsx("button",{onClick:h,className:Re.secondaryBtn,children:s}),C.jsx("button",{ref:m,onClick:d,className:f==="primary"?Re.primaryBtn:Re.dangerBtn,children:l})]})]})]}):null}function qz({open:n,onClose:a,children:i}){return G.useEffect(()=>{if(!n)return;const l=s=>{s.key==="Escape"&&a()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[n,a]),n?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:Re.dialogBackdrop,onClick:a}),C.jsx("div",{className:Re.modalCard,children:i})]}):null}const uy=n=>new Promise(a=>setTimeout(a,n));async function Qz(){await uy(un.updateRestartProbeDelayMs);const n=Date.now()+un.updateRestartMaxWaitMs;for(;Date.now()<n;){try{if((await fetch("/api/trpc/update.check",{cache:"no-store"})).ok)break}catch{}await uy(un.updateRestartPollMs)}window.location.reload()}function ly({command:n}){return C.jsx("code",{className:"block mt-2 p-2 bg-[#1a1a1a] rounded font-mono text-xs text-[#e0e0e0]",children:n})}function kz({open:n,onClose:a}){const i=at.update.check.useQuery(void 0,{staleTime:un.updateCheckStaleTimeMs}),[l,s]=G.useState(!1),[f,d]=G.useState(null),h=i.data,m=h?.canSelfUpdate===!0,y=h?.method==="npx"?"npx tracer-sh@latest":h?.method==="dev"?"git pull && pnpm install && pnpm build":"npm install -g tracer-sh@latest",g=at.update.perform.useMutation({onSuccess:x=>{x.ok?(s(!0),Qz()):d(x.error??"Update failed.")},onError:x=>d(x.message)}),S=g.isPending||l;return C.jsxs(qz,{open:n,onClose:S?()=>{}:a,children:[C.jsx("div",{className:Re.dialogTitle,children:"Update Available"}),C.jsxs("div",{className:"text-sm text-[#666666] mb-4 space-y-1",children:[C.jsxs("p",{children:["Current version: ",C.jsx("span",{className:"font-mono",children:h?.currentVersion})]}),C.jsxs("p",{children:["Latest version: ",C.jsx("span",{className:"font-mono",children:h?.latestVersion})]})]}),l?C.jsx("div",{className:"text-sm text-[#666666] mb-4",children:C.jsx("p",{children:"Installed. Restarting Tracer — this page will reload automatically."})}):m?C.jsxs(C.Fragment,{children:[f&&C.jsxs("div",{className:"text-sm text-[#b3261e] mb-4",children:[C.jsxs("p",{children:["Update failed: ",f]}),C.jsx("p",{className:"mt-2 text-[#666666]",children:"You can update manually instead:"}),C.jsx(ly,{command:y})]}),C.jsxs("div",{className:"flex justify-end gap-2",children:[C.jsx("button",{onClick:a,className:Re.secondaryBtn,disabled:S,children:"Close"}),C.jsx("button",{onClick:()=>{d(null),g.mutate()},className:Re.primaryBtn,disabled:S,children:S?"Updating…":"Update now"})]})]}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"text-sm text-[#666666] mb-4",children:[C.jsx("p",{children:"This instance runs from a source checkout. Update it with:"}),C.jsx(ly,{command:y})]}),C.jsx("div",{className:"flex justify-end",children:C.jsx("button",{onClick:a,className:Re.secondaryBtn,children:"Close"})})]})]})}const dl=({page:n})=>{const a={width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5};switch(n){case"dashboard":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"})});case"debug":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("path",{d:"M8 1.5L14.5 8L8 14.5L1.5 8Z"})});case"monitors":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("circle",{cx:"8",cy:"8",r:"6"})});case"settings":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("path",{d:"M3 4.5h10M3 8h10M3 11.5h10"})})}},Bz=[{page:"debug",label:"Debug"}];function Hz({currentPage:n,onNavigate:a,currentSessionId:i,onSelectSession:l,onNewSession:s,currentDashboardId:f,onSelectDashboard:d,onNewDashboard:h}){const m=at.sessions.list.useQuery(void 0,{staleTime:un.sessionStaleTimeMs}),y=at.dashboards.list.useQuery(void 0,{enabled:cl.dashboards}),g=at.monitorAlerts.activeCount.useQuery(void 0,{enabled:cl.monitors}),S=at.sessions.activeCount.useQuery(),x=at.useUtils();ry(()=>{x.sessions.activeCount.invalidate(),n==="debug"&&x.sessions.list.invalidate()},un.activeStreamPollingMs,!0);const R=at.monitors.shouldPoll.useQuery(void 0,{enabled:cl.monitors});ry(()=>{x.monitorAlerts.activeCount.invalidate(),x.monitors.shouldPoll.invalidate()},un.monitorPollingMs,(R.data??!1)&&cl.monitors);const L=at.sessions.markViewed.useMutation();G.useEffect(()=>{if(!i||n!=="debug"||!m.data)return;const T=m.data.find(q=>q.id===i);!T||T.status!=="done"||(x.sessions.list.setData(void 0,q=>q?.map(H=>H.id===i?{...H,status:"idle"}:H)),x.sessions.activeCount.setData(void 0,q=>q&&{...q,done:Math.max(0,q.done-1)}),L.mutate({id:i}))},[m.data,i,n]);const{regularSessions:Z,importedSessions:ne,apiSessions:ue}=G.useMemo(()=>{const T=m.data??[],q=T.filter(J=>J.kind!==yr.IMPORTED&&J.kind!==yr.API),H=T.filter(J=>J.kind===yr.IMPORTED),$=T.filter(J=>J.kind===yr.API);return{regularSessions:q,importedSessions:H,apiSessions:$}},[m.data]),de=g.data??0,ve=n==="debug"&&m.data?m.data.filter(T=>T.status==="done"&&T.id!==i&&T.kind!==yr.API).length:S.data?.done??0,be=at.sessions.delete.useMutation(),P=at.dashboards.delete.useMutation(),[Y,D]=G.useState(null),[K,W]=G.useState(!1),ae=at.update.check.useQuery(void 0,{staleTime:un.updateCheckStaleTimeMs}),re=ae.data?.available===!0,F=(T,q)=>{T.stopPropagation(),D({type:"session",id:q})},he=(T,q)=>{T.stopPropagation(),D({type:"dashboard",id:q})},[ce,oe]=G.useState(null),A=at.sessions.importAnalysis.useMutation(),B=G.useCallback(async T=>{if(T.type!=="image/png"){oe("Only PNG files are supported.");return}if(T.size>10*1024*1024){oe("PNG is too large (>10 MB).");return}try{const q=new Uint8Array(await T.arrayBuffer());let H;try{H=await Uz(q)}catch{oe("Not a valid PNG file.");return}if(!H){oe("No analysis data found in this image.");return}let $;try{$=xz.parse(JSON.parse(new TextDecoder().decode(H)))}catch{oe("Analysis data is malformed or from an incompatible version.");return}const{id:J}=await A.mutateAsync($);x.sessions.list.setData(void 0,pe=>{const it={id:J,title:$.sourceTitle.slice(0,80)||U1,status:"idle",kind:yr.IMPORTED,updatedAt:Math.floor(Date.now()/1e3),titlePending:!1};return pe?[it,...pe]:[it]}),oe(null),n!=="debug"&&a("debug"),l(J)}catch{oe("Couldn't import analysis.")}},[A,x,l,a,n]),V=G.useCallback(T=>{if(T.length>1){oe("Drop a single PNG to import.");return}B(T[0])},[B]),{dragActive:se,dropProps:ge}=Mz(V),_=()=>{Y&&(Y.type==="session"?be.mutate({id:Y.id},{onSuccess:()=>{x.sessions.list.invalidate(),i===Y.id&&s()}}):P.mutate({id:Y.id},{onSuccess:()=>{x.dashboards.list.invalidate(),f===Y.id&&a("dashboard")}}),D(null))};return C.jsxs("div",{className:`flex flex-col h-full ${Re.sidebar}`,children:[C.jsxs("div",{className:"p-6",children:[C.jsxs("h1",{className:`text-2xl font-bold ${Re.sidebarLogo} flex items-center gap-2`,children:[C.jsx("img",{src:"/logo.svg",alt:"",className:"w-6 h-6"}),"Tracer"]}),C.jsx("p",{className:`text-xs mt-1 ${Re.sidebarSubtitle}`,children:"Observability Platform"})]}),C.jsx("nav",{className:"flex-1 px-3 space-y-1 overflow-y-auto",children:Bz.map(({page:T,label:q})=>{const H=n===T;return C.jsxs("div",{children:[C.jsxs("button",{onClick:()=>a(T),className:`w-full flex items-center gap-3 px-3 py-2 rounded-sm text-sm transition-colors ${H?Re.navActive:Re.navInactive}`,children:[T==="monitors"&&de>0?C.jsxs("span",{className:"relative flex items-center justify-center w-5 shrink-0",children:[C.jsx(dl,{page:T}),C.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{animation:"fill-up-down 4s ease-in-out infinite"},children:C.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:C.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"#b33a2a",stroke:"none"})})})]}):T==="debug"&&ve>0?C.jsxs("span",{className:"relative flex items-center justify-center w-5 shrink-0",children:[C.jsx(dl,{page:T}),C.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{animation:"fill-up-down 4s ease-in-out infinite"},children:C.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:C.jsx("path",{d:"M8 1.5L14.5 8L8 14.5L1.5 8Z",fill:"#2b5ea7",stroke:"none"})})})]}):C.jsx("span",{className:"w-5 flex items-center justify-center shrink-0",children:C.jsx(dl,{page:T})}),q,T==="monitors"&&de>0&&C.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:C.jsx("span",{className:"text-[10px] font-medium text-[#b33a2a]",children:de})})]}),T==="dashboard"&&n==="dashboard"&&C.jsxs("div",{className:"mt-1 space-y-0.5",children:[C.jsxs("button",{onClick:h,className:Re.sessionNewBtn,children:[C.jsx("span",{className:"text-[10px]",children:"+"}),"New dashboard"]}),C.jsx(fl,{children:y.data?.map($=>C.jsxs("button",{onClick:()=>d($.id),className:f===$.id?Re.sessionItemActive:Re.sessionItem,children:[C.jsx("span",{className:"truncate flex-1 text-left",children:$.title}),C.jsx("span",{onClick:J=>he(J,$.id),className:Re.sessionDeleteBtn,children:"×"})]},$.id))})]}),T==="debug"&&(()=>{const $=J=>C.jsxs("button",{onClick:()=>l(J.id),className:i===J.id?Re.sessionItemActive:Re.sessionItem,children:[C.jsx("span",{className:`truncate flex-1 text-left ${(J.status==="streaming"||J.status==="done")&&J.id!==i?"text-[#2b5ea7] underline":""}`,title:J.title,children:J.title}),C.jsx("span",{onClick:pe=>F(pe,J.id),className:Re.sessionDeleteBtn,children:"×"})]},J.id);return C.jsxs("div",{className:"mt-1 space-y-0.5",children:[C.jsxs("button",{onClick:s,className:Re.sessionNewBtn,children:[C.jsx("span",{className:"text-[10px]",children:"+"}),"New chat"]}),C.jsx(fl,{children:Z.map($)}),ne.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9890]/60 px-3 pt-3 pb-1",children:"Imported"}),C.jsx(fl,{children:ne.map($)})]}),ue.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9890]/60 px-3 pt-3 pb-1",children:"API"}),C.jsx(fl,{children:ue.map($)})]}),C.jsxs("label",{className:`mt-3 mx-2 flex items-center justify-center gap-1.5 px-3 py-2 text-[11px] rounded border border-dashed cursor-pointer transition-colors ${se?"border-[#2b5ea7] bg-[#eaf0f8] text-[#2b5ea7]":"border-[#d4d2cd] text-[#9c9890] hover:text-[#2b5ea7] hover:border-[#2b5ea7]"}`,...ge,children:[C.jsx("input",{type:"file",accept:"image/png",className:"hidden",onChange:J=>{const pe=J.target.files?.[0];pe&&B(pe),J.target.value=""}}),C.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),C.jsx("polyline",{points:"17 8 12 3 7 8"}),C.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Import analysis image"]}),ce&&C.jsx("div",{className:"mx-2 mt-1 text-[10px] text-[#b33a2a]",children:ce})]})})()]},T)})}),C.jsx("div",{className:"px-3 pb-2",children:C.jsxs("button",{onClick:()=>a("settings"),className:`w-full flex items-center gap-3 px-3 py-2 rounded-sm text-sm transition-colors ${n==="settings"?Re.navActive:Re.navInactive}`,children:[C.jsx("span",{className:"w-5 flex items-center justify-center shrink-0",children:C.jsx(dl,{page:"settings"})}),"Settings"]})}),C.jsx("div",{className:`p-4 ${Re.sidebarFooter}`,children:C.jsxs("button",{onClick:()=>re&&W(!0),className:`font-mono text-[10px] tracking-wider inline-flex items-center gap-1.5 ${re?"cursor-pointer hover:text-[#2b5ea7]":"cursor-default"}`,children:["v",ae.data?.currentVersion??"0.3.5",re?C.jsx("span",{className:"w-2 h-2 rounded-full bg-[#2b5ea7] animate-pulse"}):ae.data&&!ae.isLoading?C.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:"text-[#2a7a4a]",children:C.jsx("path",{d:"M2 5.5L4 7.5L8 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):null]})}),C.jsx(kz,{open:K,onClose:()=>W(!1)}),C.jsx(Zz,{open:Y!==null,title:Y?.type==="session"?"Delete session":"Delete dashboard",message:Y?.type==="session"?"Delete this chat session?":"Delete this dashboard and all its widgets?",onConfirm:_,onCancel:()=>D(null)})]})}const Lz={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};function Gz({size:n="md",centered:a=!1}){const i=C.jsx("div",{className:`${Lz[n]} animate-spin rounded-full border-2 ${Re.spinner}`});return a?C.jsx("div",{className:"flex items-center justify-center py-12",children:i}):i}const Yz=G.lazy(()=>ov(()=>import("./mermaid-GHXKKRXX-VdzAklnF.js").then(n=>n.D),__vite__mapDeps([0,1,2])).then(n=>({default:n.Debug}))),$z=G.lazy(()=>ov(()=>import("./Settings-CWfkpcQA.js"),__vite__mapDeps([3,1])).then(n=>({default:n.Settings}))),Vz=null,Kz=null,Pz=new Set(["debug","settings"]);function hg(){const n=window.location.pathname.replace(/^\/+/,"").split("/"),a=n[0]&&Pz.has(n[0])?n[0]:"debug",i=a==="debug"&&n[1]?n[1]:null,l=a==="dashboard"&&n[1]?n[1]:null;return{page:a,sessionId:i,dashboardId:l}}let sy="",oy=hg();function Xz(){const n=window.location.pathname;return n!==sy&&(sy=n,oy=hg()),oy}function Jz(n){return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)}function Oi(n){window.history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate"))}const Iz=()=>C.jsx(Gz,{size:"lg",centered:!0});function Fz(){const{page:n,sessionId:a,dashboardId:i}=G.useSyncExternalStore(Jz,Xz),l=G.useCallback(m=>{Oi(m==="debug"?"/":`/${m}`)},[]),s=G.useCallback(m=>{Oi(`/debug/${m}`)},[]),f=G.useCallback(()=>{Oi("/debug")},[]),d=G.useCallback(m=>{Oi(`/dashboard/${m}`)},[]),h=G.useCallback(()=>{Oi(`/dashboard/${crypto.randomUUID()}`)},[]);return C.jsx(Ez,{sidebar:C.jsx(Hz,{currentPage:n,onNavigate:l,currentSessionId:a,onSelectSession:s,onNewSession:f,currentDashboardId:i,onSelectDashboard:d,onNewDashboard:h}),children:C.jsxs(G.Suspense,{fallback:C.jsx(Iz,{}),children:[Vz,n==="debug"&&C.jsx(Yz,{sessionId:a,onSessionChange:s},a??"new"),Kz,n==="settings"&&C.jsx($z,{})]})})}function Wz(){const[n]=G.useState(()=>new x_),[a]=G.useState(()=>at.createClient({links:[_S({url:"/api/trpc",transformer:Te})]}));return C.jsx(at.Provider,{client:a,queryClient:n,children:C.jsx(E_,{client:n,children:C.jsx(Fz,{})})})}Jb.createRoot(document.getElementById("root")).render(C.jsx(G.StrictMode,{children:C.jsx(Wz,{})}));export{yr as $,Dc as A,BE as B,Zz as C,iT as D,ez as E,Qb as F,ov as G,Nc as H,bT as I,og as J,cg as K,Lb as L,qz as M,Oz as N,xT as O,gT as P,Mz as Q,Gb as R,Gz as S,dT as T,tT as U,ry as V,un as W,OT as X,yT as Y,vT as Z,cT as _,Kb as a,U1 as a0,fT as a1,Sz as a2,Re as b,hT as c,jz as d,ST as e,nT as f,mT as g,XE as h,Jm as i,C as j,oT as k,sT as l,pT as m,lT as n,KE as o,Tz as p,Wm as q,G as r,hE as s,at as t,_T as u,aT as v,Rc as w,uT as x,ig as y,rT as z};
|
|
48
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const h=d[1];if(a===d[0]){f(d);continue}if(n.external){const y=n.external.registry.get(d[0])?.id;if(a!==d[0]&&y){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(h.cycle){f(d);continue}if(h.count>1&&n.reused==="ref"){f(d);continue}}}function xl(n,a){const i=n.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=d=>{const h=n.seen.get(d);if(h.ref===null)return;const m=h.def??h.schema,y={...m},g=h.ref;if(h.ref=null,g){l(g);const x=n.seen.get(g),R=x.schema;if(R.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(R)):Object.assign(m,R),Object.assign(m,y),d._zod.parent===g)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in y||delete m[Z];if(R.$ref&&x.def)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in x.def&&JSON.stringify(m[Z])===JSON.stringify(x.def[Z])&&delete m[Z]}const S=d._zod.parent;if(S&&S!==g){l(S);const x=n.seen.get(S);if(x?.schema.$ref&&(m.$ref=x.schema.$ref,x.def))for(const R in m)R==="$ref"||R==="allOf"||R in x.def&&JSON.stringify(m[R])===JSON.stringify(x.def[R])&&delete m[R]}n.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(const d of[...n.seen.entries()].reverse())l(d[0]);const s={};if(n.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const d=n.external.registry.get(a)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=n.external.uri(d)}Object.assign(s,i.def??i.schema);const f=n.external?.defs??{};for(const d of n.seen.entries()){const h=d[1];h.def&&h.defId&&(f[h.defId]=h.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?s.$defs=f:s.definitions=f);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...a["~standard"],jsonSchema:{input:El(a,"input",n.processors),output:El(a,"output",n.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function yt(n,a){const i=a??{seen:new Set};if(i.seen.has(n))return!1;i.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return yt(l.element,i);if(l.type==="set")return yt(l.valueType,i);if(l.type==="lazy")return yt(l.getter(),i);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return yt(l.innerType,i);if(l.type==="intersection")return yt(l.left,i)||yt(l.right,i);if(l.type==="record"||l.type==="map")return yt(l.keyType,i)||yt(l.valueType,i);if(l.type==="pipe")return yt(l.in,i)||yt(l.out,i);if(l.type==="object"){for(const s in l.shape)if(yt(l.shape[s],i))return!0;return!1}if(l.type==="union"){for(const s of l.options)if(yt(s,i))return!0;return!1}if(l.type==="tuple"){for(const s of l.items)if(yt(s,i))return!0;return!!(l.rest&&yt(l.rest,i))}return!1}const Qx=(n,a={})=>i=>{const l=Sl({...i,processors:a});return Qe(n,l),Ol(l,n),xl(l,n)},El=(n,a,i={})=>l=>{const{libraryOptions:s,target:f}=l??{},d=Sl({...s??{},target:f,io:a,processors:i});return Qe(n,d),Ol(d,n),xl(d,n)},kx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dv=(n,a,i,l)=>{const s=i;s.type="string";const{minimum:f,maximum:d,format:h,patterns:m,contentEncoding:y}=n._zod.bag;if(typeof f=="number"&&(s.minLength=f),typeof d=="number"&&(s.maxLength=d),h&&(s.format=kx[h]??h,s.format===""&&delete s.format,h==="time"&&delete s.format),y&&(s.contentEncoding=y),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(S=>({...a.target==="draft-07"||a.target==="draft-04"||a.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},Nv=(n,a,i,l)=>{const s=i,{minimum:f,maximum:d,format:h,multipleOf:m,exclusiveMaximum:y,exclusiveMinimum:g}=n._zod.bag;typeof h=="string"&&h.includes("int")?s.type="integer":s.type="number",typeof g=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(s.minimum=g,s.exclusiveMinimum=!0):s.exclusiveMinimum=g),typeof f=="number"&&(s.minimum=f,typeof g=="number"&&a.target!=="draft-04"&&(g>=f?delete s.minimum:delete s.exclusiveMinimum)),typeof y=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(s.maximum=y,s.exclusiveMaximum=!0):s.exclusiveMaximum=y),typeof d=="number"&&(s.maximum=d,typeof y=="number"&&a.target!=="draft-04"&&(y<=d?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},Uv=(n,a,i,l)=>{i.type="boolean"},Bx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Hx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Zv=(n,a,i,l)=>{a.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Lx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Gx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},qv=(n,a,i,l)=>{i.not={}},Yx=(n,a,i,l)=>{},Qv=(n,a,i,l)=>{},$x=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},kv=(n,a,i,l)=>{const s=n._zod.def,f=dv(s.entries);f.every(d=>typeof d=="number")&&(i.type="number"),f.every(d=>typeof d=="string")&&(i.type="string"),i.enum=f},Bv=(n,a,i,l)=>{const s=n._zod.def,f=[];for(const d of s.values)if(d===void 0){if(a.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(a.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];i.type=d===null?"null":typeof d,a.target==="draft-04"||a.target==="openapi-3.0"?i.enum=[d]:i.const=d}else f.every(d=>typeof d=="number")&&(i.type="number"),f.every(d=>typeof d=="string")&&(i.type="string"),f.every(d=>typeof d=="boolean")&&(i.type="boolean"),f.every(d=>d===null)&&(i.type="null"),i.enum=f},Vx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Kx=(n,a,i,l)=>{const s=i,f=n._zod.pattern;if(!f)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=f.source},Px=(n,a,i,l)=>{const s=i,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:d,maximum:h,mime:m}=n._zod.bag;d!==void 0&&(f.minLength=d),h!==void 0&&(f.maxLength=h),m?m.length===1?(f.contentMediaType=m[0],Object.assign(s,f)):(Object.assign(s,f),s.anyOf=m.map(y=>({contentMediaType:y}))):Object.assign(s,f)},Xx=(n,a,i,l)=>{i.type="boolean"},Hv=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Jx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Lv=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ix=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Fx=(n,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Gv=(n,a,i,l)=>{const s=i,f=n._zod.def,{minimum:d,maximum:h}=n._zod.bag;typeof d=="number"&&(s.minItems=d),typeof h=="number"&&(s.maxItems=h),s.type="array",s.items=Qe(f.element,a,{...l,path:[...l.path,"items"]})},Yv=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="object",s.properties={};const d=f.shape;for(const y in d)s.properties[y]=Qe(d[y],a,{...l,path:[...l.path,"properties",y]});const h=new Set(Object.keys(d)),m=new Set([...h].filter(y=>{const g=f.shape[y]._zod;return a.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),f.catchall?._zod.def.type==="never"?s.additionalProperties=!1:f.catchall?f.catchall&&(s.additionalProperties=Qe(f.catchall,a,{...l,path:[...l.path,"additionalProperties"]})):a.io==="output"&&(s.additionalProperties=!1)},$v=(n,a,i,l)=>{const s=n._zod.def,f=s.inclusive===!1,d=s.options.map((h,m)=>Qe(h,a,{...l,path:[...l.path,f?"oneOf":"anyOf",m]}));f?i.oneOf=d:i.anyOf=d},Vv=(n,a,i,l)=>{const s=n._zod.def,f=Qe(s.left,a,{...l,path:[...l.path,"allOf",0]}),d=Qe(s.right,a,{...l,path:[...l.path,"allOf",1]}),h=y=>"allOf"in y&&Object.keys(y).length===1,m=[...h(f)?f.allOf:[f],...h(d)?d.allOf:[d]];i.allOf=m},Wx=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="array";const d=a.target==="draft-2020-12"?"prefixItems":"items",h=a.target==="draft-2020-12"||a.target==="openapi-3.0"?"items":"additionalItems",m=f.items.map((x,R)=>Qe(x,a,{...l,path:[...l.path,d,R]})),y=f.rest?Qe(f.rest,a,{...l,path:[...l.path,h,...a.target==="openapi-3.0"?[f.items.length]:[]]}):null;a.target==="draft-2020-12"?(s.prefixItems=m,y&&(s.items=y)):a.target==="openapi-3.0"?(s.items={anyOf:m},y&&s.items.anyOf.push(y),s.minItems=m.length,y||(s.maxItems=m.length)):(s.items=m,y&&(s.additionalItems=y));const{minimum:g,maximum:S}=n._zod.bag;typeof g=="number"&&(s.minItems=g),typeof S=="number"&&(s.maxItems=S)},Kv=(n,a,i,l)=>{const s=i,f=n._zod.def;s.type="object";const d=f.keyType,m=d._zod.bag?.patterns;if(f.mode==="loose"&&m&&m.size>0){const g=Qe(f.valueType,a,{...l,path:[...l.path,"patternProperties","*"]});s.patternProperties={};for(const S of m)s.patternProperties[S.source]=g}else(a.target==="draft-07"||a.target==="draft-2020-12")&&(s.propertyNames=Qe(f.keyType,a,{...l,path:[...l.path,"propertyNames"]})),s.additionalProperties=Qe(f.valueType,a,{...l,path:[...l.path,"additionalProperties"]});const y=d._zod.values;if(y){const g=[...y].filter(S=>typeof S=="string"||typeof S=="number");g.length>0&&(s.required=g)}},Pv=(n,a,i,l)=>{const s=n._zod.def,f=Qe(s.innerType,a,l),d=a.seen.get(n);a.target==="openapi-3.0"?(d.ref=s.innerType,i.nullable=!0):i.anyOf=[f,{type:"null"}]},Xv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},Jv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,i.default=JSON.parse(JSON.stringify(s.defaultValue))},Iv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,a.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Fv=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType;let d;try{d=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=d},Wv=(n,a,i,l)=>{const s=n._zod.def,f=a.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Qe(f,a,l);const d=a.seen.get(n);d.ref=f},eg=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType,i.readOnly=!0},eE=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},Jc=(n,a,i,l)=>{const s=n._zod.def;Qe(s.innerType,a,l);const f=a.seen.get(n);f.ref=s.innerType},tg=(n,a,i,l)=>{const s=n._zod.innerType;Qe(s,a,l);const f=a.seen.get(n);f.ref=s},Xm={string:Dv,number:Nv,boolean:Uv,bigint:Bx,symbol:Hx,null:Zv,undefined:Lx,void:Gx,never:qv,any:Yx,unknown:Qv,date:$x,enum:kv,literal:Bv,nan:Vx,template_literal:Kx,file:Px,success:Xx,custom:Hv,function:Jx,transform:Lv,map:Ix,set:Fx,array:Gv,object:Yv,union:$v,intersection:Vv,tuple:Wx,record:Kv,nullable:Pv,nonoptional:Xv,default:Jv,prefault:Iv,catch:Fv,pipe:Wv,readonly:eg,promise:eE,optional:Jc,lazy:tg};function nT(n,a){if("_idmap"in n){const l=n,s=Sl({...a,processors:Xm}),f={};for(const m of l._idmap.entries()){const[y,g]=m;Qe(g,s)}const d={},h={registry:l,uri:a?.uri,defs:f};s.external=h;for(const m of l._idmap.entries()){const[y,g]=m;Ol(s,g),d[y]=xl(s,g)}if(Object.keys(f).length>0){const m=s.target==="draft-2020-12"?"$defs":"definitions";d.__shared={[m]:f}}return{schemas:d}}const i=Sl({...a,processors:Xm});return Qe(n,i),Ol(i,n),xl(i,n)}const tE=U("ZodISODateTime",(n,a)=>{rO.init(n,a),$e.init(n,a)});function nE(n){return dx(tE,n)}const aE=U("ZodISODate",(n,a)=>{iO.init(n,a),$e.init(n,a)});function rE(n){return hx(aE,n)}const iE=U("ZodISOTime",(n,a)=>{uO.init(n,a),$e.init(n,a)});function uE(n){return px(iE,n)}const lE=U("ZodISODuration",(n,a)=>{lO.init(n,a),$e.init(n,a)});function sE(n){return mx(lE,n)}const oE=(n,a)=>{yv.init(n,a),n.name="ZodError",Object.defineProperties(n,{format:{value:i=>J1(n,i)},flatten:{value:i=>X1(n,i)},addIssue:{value:i=>{n.issues.push(i),n.message=JSON.stringify(n.issues,jc,2)}},addIssues:{value:i=>{n.issues.push(...i),n.message=JSON.stringify(n.issues,jc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Pt=U("ZodError",oE,{Parent:Error}),cE=Kc(Pt),fE=Pc(Pt),dE=Cl(Pt),hE=Dl(Pt),pE=W1(Pt),mE=e2(Pt),yE=t2(Pt),vE=n2(Pt),gE=a2(Pt),bE=r2(Pt),_E=i2(Pt),SE=u2(Pt),Le=U("ZodType",(n,a)=>(He.init(n,a),Object.assign(n["~standard"],{jsonSchema:{input:El(n,"input"),output:El(n,"output")}}),n.toJSONSchema=Qx(n,{}),n.def=a,n.type=a.type,Object.defineProperty(n,"_def",{value:a}),n.check=(...i)=>n.clone(ra(a,{checks:[...a.checks??[],...i.map(l=>typeof l=="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0}),n.with=n.check,n.clone=(i,l)=>ia(n,i,l),n.brand=()=>n,n.register=((i,l)=>(i.add(n,l),n)),n.parse=(i,l)=>cE(n,i,l,{callee:n.parse}),n.safeParse=(i,l)=>dE(n,i,l),n.parseAsync=async(i,l)=>fE(n,i,l,{callee:n.parseAsync}),n.safeParseAsync=async(i,l)=>hE(n,i,l),n.spa=n.safeParseAsync,n.encode=(i,l)=>pE(n,i,l),n.decode=(i,l)=>mE(n,i,l),n.encodeAsync=async(i,l)=>yE(n,i,l),n.decodeAsync=async(i,l)=>vE(n,i,l),n.safeEncode=(i,l)=>gE(n,i,l),n.safeDecode=(i,l)=>bE(n,i,l),n.safeEncodeAsync=async(i,l)=>_E(n,i,l),n.safeDecodeAsync=async(i,l)=>SE(n,i,l),n.refine=(i,l)=>n.check(gz(i,l)),n.superRefine=i=>n.check(bz(i)),n.overwrite=i=>n.check(zr(i)),n.optional=()=>ey(n),n.exactOptional=()=>iz(n),n.nullable=()=>ty(n),n.nullish=()=>ey(ty(n)),n.nonoptional=i=>fz(n,i),n.array=()=>ig(n),n.or=i=>XE([n,i]),n.and=i=>FE(n,i),n.transform=i=>ny(n,az(i)),n.default=i=>sz(n,i),n.prefault=i=>cz(n,i),n.catch=i=>hz(n,i),n.pipe=i=>ny(n,i),n.readonly=()=>yz(n),n.describe=i=>{const l=n.clone();return xi.add(l,{description:i}),l},Object.defineProperty(n,"description",{get(){return xi.get(n)?.description},configurable:!0}),n.meta=(...i)=>{if(i.length===0)return xi.get(n);const l=n.clone();return xi.add(l,i[0]),l},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=i=>i(n),n)),ng=U("_ZodString",(n,a)=>{Xc.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>Dv(n,l,s);const i=n._zod.bag;n.format=i.format??null,n.minLength=i.minimum??null,n.maxLength=i.maximum??null,n.regex=(...l)=>n.check(Ox(...l)),n.includes=(...l)=>n.check(zx(...l)),n.startsWith=(...l)=>n.check(Tx(...l)),n.endsWith=(...l)=>n.check(wx(...l)),n.min=(...l)=>n.check(_l(...l)),n.max=(...l)=>n.check(Rv(...l)),n.length=(...l)=>n.check(Cv(...l)),n.nonempty=(...l)=>n.check(_l(1,...l)),n.lowercase=l=>n.check(xx(l)),n.uppercase=l=>n.check(Ex(l)),n.trim=()=>n.check(jx()),n.normalize=(...l)=>n.check(Ax(...l)),n.toLowerCase=()=>n.check(Mx()),n.toUpperCase=()=>n.check(Rx()),n.slugify=()=>n.check(Cx())}),OE=U("ZodString",(n,a)=>{Xc.init(n,a),ng.init(n,a),n.email=i=>n.check($O(xE,i)),n.url=i=>n.check(JO(EE,i)),n.jwt=i=>n.check(fx(kE,i)),n.emoji=i=>n.check(IO(zE,i)),n.guid=i=>n.check($m(Im,i)),n.uuid=i=>n.check(VO(ol,i)),n.uuidv4=i=>n.check(KO(ol,i)),n.uuidv6=i=>n.check(PO(ol,i)),n.uuidv7=i=>n.check(XO(ol,i)),n.nanoid=i=>n.check(FO(TE,i)),n.guid=i=>n.check($m(Im,i)),n.cuid=i=>n.check(WO(wE,i)),n.cuid2=i=>n.check(ex(AE,i)),n.ulid=i=>n.check(tx(jE,i)),n.base64=i=>n.check(sx(ZE,i)),n.base64url=i=>n.check(ox(qE,i)),n.xid=i=>n.check(nx(ME,i)),n.ksuid=i=>n.check(ax(RE,i)),n.ipv4=i=>n.check(rx(CE,i)),n.ipv6=i=>n.check(ix(DE,i)),n.cidrv4=i=>n.check(ux(NE,i)),n.cidrv6=i=>n.check(lx(UE,i)),n.e164=i=>n.check(cx(QE,i)),n.datetime=i=>n.check(nE(i)),n.date=i=>n.check(rE(i)),n.time=i=>n.check(uE(i)),n.duration=i=>n.check(sE(i))});function Jm(n){return YO(OE,n)}const $e=U("ZodStringFormat",(n,a)=>{Ye.init(n,a),ng.init(n,a)}),xE=U("ZodEmail",(n,a)=>{X2.init(n,a),$e.init(n,a)}),Im=U("ZodGUID",(n,a)=>{K2.init(n,a),$e.init(n,a)}),ol=U("ZodUUID",(n,a)=>{P2.init(n,a),$e.init(n,a)}),EE=U("ZodURL",(n,a)=>{J2.init(n,a),$e.init(n,a)}),zE=U("ZodEmoji",(n,a)=>{I2.init(n,a),$e.init(n,a)}),TE=U("ZodNanoID",(n,a)=>{F2.init(n,a),$e.init(n,a)}),wE=U("ZodCUID",(n,a)=>{W2.init(n,a),$e.init(n,a)}),AE=U("ZodCUID2",(n,a)=>{eO.init(n,a),$e.init(n,a)}),jE=U("ZodULID",(n,a)=>{tO.init(n,a),$e.init(n,a)}),ME=U("ZodXID",(n,a)=>{nO.init(n,a),$e.init(n,a)}),RE=U("ZodKSUID",(n,a)=>{aO.init(n,a),$e.init(n,a)}),CE=U("ZodIPv4",(n,a)=>{sO.init(n,a),$e.init(n,a)}),DE=U("ZodIPv6",(n,a)=>{oO.init(n,a),$e.init(n,a)}),NE=U("ZodCIDRv4",(n,a)=>{cO.init(n,a),$e.init(n,a)}),UE=U("ZodCIDRv6",(n,a)=>{fO.init(n,a),$e.init(n,a)}),ZE=U("ZodBase64",(n,a)=>{dO.init(n,a),$e.init(n,a)}),qE=U("ZodBase64URL",(n,a)=>{pO.init(n,a),$e.init(n,a)}),QE=U("ZodE164",(n,a)=>{mO.init(n,a),$e.init(n,a)}),kE=U("ZodJWT",(n,a)=>{vO.init(n,a),$e.init(n,a)}),ag=U("ZodNumber",(n,a)=>{Tv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>Nv(n,l,s),n.gt=(l,s)=>n.check(Km(l,s)),n.gte=(l,s)=>n.check(dc(l,s)),n.min=(l,s)=>n.check(dc(l,s)),n.lt=(l,s)=>n.check(Vm(l,s)),n.lte=(l,s)=>n.check(fc(l,s)),n.max=(l,s)=>n.check(fc(l,s)),n.int=l=>n.check(Fm(l)),n.safe=l=>n.check(Fm(l)),n.positive=l=>n.check(Km(0,l)),n.nonnegative=l=>n.check(dc(0,l)),n.negative=l=>n.check(Vm(0,l)),n.nonpositive=l=>n.check(fc(0,l)),n.multipleOf=(l,s)=>n.check(Pm(l,s)),n.step=(l,s)=>n.check(Pm(l,s)),n.finite=()=>n;const i=n._zod.bag;n.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),n.isFinite=!0,n.format=i.format??null});function BE(n){return yx(ag,n)}const HE=U("ZodNumberFormat",(n,a)=>{gO.init(n,a),ag.init(n,a)});function Fm(n){return vx(HE,n)}const LE=U("ZodBoolean",(n,a)=>{bO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Uv(n,i,l)});function aT(n){return gx(LE,n)}const GE=U("ZodNull",(n,a)=>{_O.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Zv(n,i,l)});function rT(n){return bx(GE,n)}const YE=U("ZodUnknown",(n,a)=>{SO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Qv()});function Rc(){return _x(YE)}const $E=U("ZodNever",(n,a)=>{OO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>qv(n,i,l)});function rg(n){return Sx($E,n)}const VE=U("ZodArray",(n,a)=>{xO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Gv(n,i,l,s),n.element=a.element,n.min=(i,l)=>n.check(_l(i,l)),n.nonempty=i=>n.check(_l(1,i)),n.max=(i,l)=>n.check(Rv(i,l)),n.length=(i,l)=>n.check(Cv(i,l)),n.unwrap=()=>n.element});function ig(n,a){return Dx(VE,n,a)}const Ic=U("ZodObject",(n,a)=>{zO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Yv(n,i,l,s),ze(n,"shape",()=>a.shape),n.keyof=()=>ez(Object.keys(n._zod.def.shape)),n.catchall=i=>n.clone({...n._zod.def,catchall:i}),n.passthrough=()=>n.clone({...n._zod.def,catchall:Rc()}),n.loose=()=>n.clone({...n._zod.def,catchall:Rc()}),n.strict=()=>n.clone({...n._zod.def,catchall:rg()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=i=>Y1(n,i),n.safeExtend=i=>$1(n,i),n.merge=i=>V1(n,i),n.pick=i=>L1(n,i),n.omit=i=>G1(n,i),n.partial=(...i)=>K1(lg,n,i[0]),n.required=(...i)=>P1(sg,n,i[0])});function KE(n,a){const i={type:"object",shape:n??{},...ee(a)};return new Ic(i)}function iT(n,a){return new Ic({type:"object",shape:n,catchall:rg(),...ee(a)})}function PE(n,a){return new Ic({type:"object",shape:n,catchall:Rc(),...ee(a)})}const ug=U("ZodUnion",(n,a)=>{jv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>$v(n,i,l,s),n.options=a.options});function XE(n,a){return new ug({type:"union",options:n,...ee(a)})}const JE=U("ZodDiscriminatedUnion",(n,a)=>{ug.init(n,a),TO.init(n,a)});function uT(n,a,i){return new JE({type:"union",options:a,discriminator:n,...ee(i)})}const IE=U("ZodIntersection",(n,a)=>{wO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Vv(n,i,l,s)});function FE(n,a){return new IE({type:"intersection",left:n,right:a})}const WE=U("ZodRecord",(n,a)=>{AO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Kv(n,i,l,s),n.keyType=a.keyType,n.valueType=a.valueType});function lT(n,a,i){return new WE({type:"record",keyType:n,valueType:a,...ee(i)})}const Cc=U("ZodEnum",(n,a)=>{jO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(l,s,f)=>kv(n,l,s),n.enum=a.entries,n.options=Object.values(a.entries);const i=new Set(Object.keys(a.entries));n.extract=(l,s)=>{const f={};for(const d of l)if(i.has(d))f[d]=a.entries[d];else throw new Error(`Key ${d} not found in enum`);return new Cc({...a,checks:[],...ee(s),entries:f})},n.exclude=(l,s)=>{const f={...a.entries};for(const d of l)if(i.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new Cc({...a,checks:[],...ee(s),entries:f})}});function ez(n,a){const i=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new Cc({type:"enum",entries:i,...ee(a)})}const tz=U("ZodLiteral",(n,a)=>{MO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Bv(n,i,l),n.values=new Set(a.values),Object.defineProperty(n,"value",{get(){if(a.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return a.values[0]}})});function Wm(n,a){return new tz({type:"literal",values:Array.isArray(n)?n:[n],...ee(a)})}const nz=U("ZodTransform",(n,a)=>{RO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Lv(n,i),n._zod.parse=(i,l)=>{if(l.direction==="backward")throw new cv(n.constructor.name);i.addIssue=f=>{if(typeof f=="string")i.issues.push(Ni(f,i.value,a));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=i.value),d.inst??(d.inst=n),i.issues.push(Ni(d))}};const s=a.transform(i.value,i);return s instanceof Promise?s.then(f=>(i.value=f,i)):(i.value=s,i)}});function az(n){return new nz({type:"transform",transform:n})}const lg=U("ZodOptional",(n,a)=>{Mv.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jc(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function ey(n){return new lg({type:"optional",innerType:n})}const rz=U("ZodExactOptional",(n,a)=>{CO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jc(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function iz(n){return new rz({type:"optional",innerType:n})}const uz=U("ZodNullable",(n,a)=>{DO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Pv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function ty(n){return new uz({type:"nullable",innerType:n})}const lz=U("ZodDefault",(n,a)=>{NO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Jv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function sz(n,a){return new lz({type:"default",innerType:n,get defaultValue(){return typeof a=="function"?a():pv(a)}})}const oz=U("ZodPrefault",(n,a)=>{UO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Iv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function cz(n,a){return new oz({type:"prefault",innerType:n,get defaultValue(){return typeof a=="function"?a():pv(a)}})}const sg=U("ZodNonOptional",(n,a)=>{ZO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Xv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function fz(n,a){return new sg({type:"nonoptional",innerType:n,...ee(a)})}const dz=U("ZodCatch",(n,a)=>{qO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Fv(n,i,l,s),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function hz(n,a){return new dz({type:"catch",innerType:n,catchValue:typeof a=="function"?a:()=>a})}const pz=U("ZodPipe",(n,a)=>{QO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Wv(n,i,l,s),n.in=a.in,n.out=a.out});function ny(n,a){return new pz({type:"pipe",in:n,out:a})}const mz=U("ZodReadonly",(n,a)=>{kO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>eg(n,i,l,s),n.unwrap=()=>n._zod.def.innerType});function yz(n){return new mz({type:"readonly",innerType:n})}const vz=U("ZodLazy",(n,a)=>{BO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>tg(n,i,l,s),n.unwrap=()=>n._zod.def.getter()});function sT(n){return new vz({type:"lazy",getter:n})}const Fc=U("ZodCustom",(n,a)=>{HO.init(n,a),Le.init(n,a),n._zod.processJSONSchema=(i,l,s)=>Hv(n,i)});function oT(n,a){return Nx(Fc,n??(()=>!0),a)}function gz(n,a={}){return Ux(Fc,n,a)}function bz(n){return Zx(n)}function cT(n,a={}){const i=new Fc({type:"custom",check:"custom",fn:l=>l instanceof n,abort:!0,...ee(a)});return i._zod.bag.Class=n,i._zod.check=l=>{l.value instanceof n||l.issues.push({code:"invalid_type",expected:n.name,input:l.value,inst:i,path:[...i._zod.def.path??[]]})},i}const _z={CREATE_WIDGET:"create_widget",UPDATE_WIDGET:"update_widget",DELETE_WIDGET:"delete_widget",CREATE_MONITOR:"create_monitor",UPDATE_MONITOR:"update_monitor",DELETE_MONITOR:"delete_monitor",TOGGLE_MONITOR:"toggle_monitor",BEGIN_ANALYSIS:"begin_analysis"},og=Object.fromEntries(Object.entries(_z).map(([n,a])=>[n,`tool-${a}`])),cg="<analysis>";function Sz(n){return n.role!=="assistant"||!n.parts?!1:n.parts.some(a=>{if(a.type===og.BEGIN_ANALYSIS)return!0;if(a.type!=="text")return!1;const i=a.text;return typeof i=="string"&&i.includes(cg)})}function fT(n,a){const i=n[a];return!i||i.role!=="assistant"?null:Sz(i)?a>=1?a:null:a+1}function Oz(n){const a=n.findIndex(i=>i.type===og.BEGIN_ANALYSIS);if(a!==-1)return{kind:"tool",partIdx:a};for(let i=0;i<n.length;i++){const l=n[i];if(l.type!=="text")continue;const s=l.text;if(typeof s!="string")continue;const f=s.indexOf(cg);if(f!==-1)return{kind:"text",partIdx:i,charIdx:f}}return null}function dT(n){const a=Oz(n);if(!a)return null;if(a.kind==="tool")return n.slice(a.partIdx);const i=n[a.partIdx];return[{...i,text:i.text.slice(a.charIdx)},...n.slice(a.partIdx+1)]}const xz=KE({v:Wm(1),kind:Wm("analysis"),sourceTitle:Jm().max(400),sourceCreatedAt:BE().int().nonnegative(),parts:ig(PE({type:Jm()})).max(200)}),cl={dashboards:!1,monitors:!1},hT={paper:"#fafaf8",inkLight:"#444444",inkMuted:"#666666",inkFaint:"#9c9890",border:"#d4d2cd",success:"#2a7a4a"},Re={shell:"bg-[#fafaf8] text-[#2c2c2c] font-sans",sidebar:"bg-[#f7f6f3] border-r border-[#d4d2cd] font-sans",sidebarLogo:"text-[#2b5ea7]",sidebarSubtitle:"text-[#666666]",navActive:"text-[#2b5ea7] bg-[#eaf0f8] border-l-2 border-[#2b5ea7]",navInactive:"text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] border-l-2 border-transparent",sidebarFooter:"border-t border-[#d4d2cd] text-[#666666]",page:"p-6 space-y-6 bg-[#fafaf8]",sectionTitle:"text-sm font-medium text-[#666666] mb-3 font-sans",card:"rounded bg-white border border-[#d4d2cd] p-6",cardTitle:"text-sm text-[#666666] font-sans",cardValue:"text-2xl font-bold text-[#2c2c2c] mt-1",tableContainer:"bg-white rounded border border-[#d4d2cd] overflow-auto max-h-[440px]",tableHeaderRow:"bg-[#f5f4f0]",tableHeaderCell:"px-4 py-3 text-left text-sm font-medium text-[#666666] uppercase tracking-wider font-sans",tableRow:"border-b border-[#e8e6e1] hover:bg-[#f5f4f0]/50",tableCell:"px-4 py-3 text-sm text-[#444444] max-w-[300px]",tableCellText:"line-clamp-2 cursor-default",badge:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium font-sans",badgeVariants:{info:"bg-[#2b5ea7]/10 text-[#2b5ea7]"},spinner:"border-[#e8e6e1] border-t-[#2b5ea7]",statusLabel:"text-sm text-[#666666]",statusDot:{connected:"bg-[#2a7a4a]",disconnected:"bg-[#b33a2a]",checking:"bg-[#a07020] animate-pulse"},input:"w-full bg-white border border-[#d4d2cd] rounded px-3 py-2 text-sm text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] font-sans",primaryBtn:"px-4 py-1.5 text-sm bg-[#2b5ea7] hover:bg-[#234d8a] text-white rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-sans",secondaryBtn:"px-4 py-1.5 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] rounded transition-colors disabled:opacity-50 font-sans",dangerBtn:"px-4 py-1.5 text-sm bg-[#b33a2a]/10 hover:bg-[#b33a2a]/20 text-[#b33a2a] rounded transition-colors disabled:opacity-50 ml-auto font-sans",outlineBtn:"px-2.5 py-1 text-xs font-medium border border-[#2b5ea7] text-[#2b5ea7] rounded hover:bg-[#2b5ea7] hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-[#2b5ea7] font-sans",successText:"text-sm text-[#2a7a4a] font-sans",errorText:"text-sm text-[#b33a2a] font-sans",warnText:"text-xs text-[#a07020] font-sans",maskedKey:"text-xs text-[#666666] font-mono",chatContainer:"flex flex-col h-full bg-[#fafaf8] font-serif",chatUserLabel:"text-[10px] uppercase tracking-[0.15em] text-[#666666] mb-2 font-sans font-medium",chatAssistantLabel:"text-[10px] uppercase tracking-[0.15em] text-[#2b5ea7] mb-2 font-sans font-medium",chatUserMessage:"text-[#2c2c2c] text-base leading-[1.8] [overflow-wrap:break-word]",chatAssistantMessage:"text-[#444444] text-base leading-[1.8] [overflow-wrap:break-word]",chatSeparator:"my-6 border-b border-[#e8e6e1]",chatInputArea:"px-10 py-5 bg-white border-t border-[#d4d2cd]",chatInput:"flex-1 bg-white border border-[#d4d2cd] rounded px-4 py-2.5 text-base text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] disabled:opacity-50 font-serif resize-none overflow-y-auto max-h-40",chatButton:"px-5 py-2.5 text-sm bg-[#2b5ea7] text-white font-sans font-medium rounded hover:bg-[#234d8a] disabled:opacity-50 disabled:cursor-not-allowed",chatThinking:"text-[#2b5ea7] text-base italic",chatEmptyState:"text-[#666666] text-base italic font-serif",toolLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2b5ea7] font-sans font-semibold mb-2",toolLoading:"text-sm italic text-[#2b5ea7] font-sans",toolQueryToggle:"text-[11px] text-[#666666] font-mono cursor-pointer select-none font-sans",toolQueryCode:"mt-1 px-3 py-2 text-[12px] font-mono text-[#444444] bg-[#f5f4f0] rounded border border-[#d4d2cd] whitespace-pre-wrap",chatMessageCard:"bg-[#fafaf8] p-4 rounded",chatMessageActions:"absolute right-0 top-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",chatActionButton:"p-1 rounded text-[#9c9890] hover:text-[#2b5ea7] hover:bg-[#eaf0f8] transition-colors",chatEditTextarea:"w-full bg-white border border-[#2b5ea7] rounded px-3 py-2 text-base text-[#2c2c2c] focus:outline-none font-serif leading-[1.8] resize-none",chatEditActions:"flex items-center gap-2 mt-2",chatEditSave:"px-3 py-1 text-xs bg-[#2b5ea7] hover:bg-[#234d8a] text-white rounded transition-colors font-sans",chatEditCancel:"px-3 py-1 text-xs bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] rounded transition-colors font-sans",chatStopButton:"px-5 py-2.5 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#666666] font-sans font-medium rounded transition-colors",chatContinueButton:"px-4 py-2 text-sm bg-[#f5f4f0] hover:bg-[#eeece7] text-[#2b5ea7] font-sans font-medium rounded transition-colors border border-[#d4d2cd]",resultListItem:"px-4 py-2 text-sm text-[#444444] border-b border-[#e8e6e1] last:border-b-0",resultErrorMessage:"text-sm text-[#b33a2a] font-sans bg-[#b33a2a]/5 border border-[#b33a2a]/20 rounded px-4 py-3 my-2",analysisContainer:"bg-[#eaf0f8] border border-[#2b5ea7]/20 rounded px-4 py-3 my-3",compactionContainer:"bg-[#f5f1e6] border border-[#8a6d3b]/25 rounded px-4 py-3 my-3",compactionLabel:"text-[9px] uppercase tracking-[0.15em] text-[#8a6d3b] font-sans font-semibold mb-1",compactionButton:"px-4 py-2 text-sm bg-[#f5f1e6] hover:bg-[#efe8d5] text-[#8a6d3b] font-sans font-medium rounded transition-colors border border-[#8a6d3b]/25",compactionPill:"flex items-center gap-2 px-4 py-2 text-sm font-sans text-[#8a6d3b] bg-[#f5f1e6] border border-[#8a6d3b]/25 rounded",investigationContainer:"border-l-2 border-[#2a7a4a] pl-4 my-3",investigationLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2a7a4a] font-sans font-semibold mb-2",investigationAccents:{newrelic:{container:"border-l-2 border-[#2a7a4a] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#2a7a4a] font-sans font-semibold mb-2"},posthog:{container:"border-l-2 border-[#f7a501] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#f7a501] font-sans font-semibold mb-2"},gcp:{container:"border-l-2 border-[#7c3aed] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#7c3aed] font-sans font-semibold mb-2"},jira:{container:"border-l-2 border-[#0052cc] pl-4 my-3",label:"text-[9px] uppercase tracking-[0.15em] text-[#0052cc] font-sans font-semibold mb-2"}},investigationTask:"text-xs text-[#9c9890] font-sans mb-2 italic",investigationThinking:"text-[#9c9890] py-2",analysisBlock:"text-sm text-[#444444] bg-[#f2f8f5] border border-[#c8e0d2] rounded px-4 py-3 my-2 leading-relaxed font-sans",summaryBlock:"text-sm text-[#2c2c2c] bg-[#eaf0f8] border border-[#2b5ea7]/20 rounded px-4 py-3 my-2 leading-relaxed font-sans",summaryLabel:"text-[9px] uppercase tracking-[0.15em] text-[#2b5ea7] font-sans font-semibold mb-1",chartContainer:"bg-white rounded border border-[#d4d2cd] p-4 my-2",settingsCard:"bg-white border border-[#d4d2cd] rounded p-4",dialogBackdrop:"fixed inset-0 z-50 bg-black/20",dialogCard:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white border border-[#d4d2cd] rounded-lg shadow-lg p-6 w-[340px] font-sans",modalCard:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white border border-[#d4d2cd] rounded-lg shadow-lg p-6 w-[480px] max-h-[85vh] overflow-y-auto font-sans",dialogTitle:"text-sm font-semibold text-[#2c2c2c] mb-2",dialogMessage:"text-sm text-[#666666] mb-5",sessionItem:"w-full flex items-center gap-2 pl-9 pr-4 py-1.5 text-xs text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] transition-colors cursor-pointer group",sessionItemActive:"w-full flex items-center gap-2 pl-9 pr-4 py-1.5 text-xs text-[#2b5ea7] bg-[#eaf0f8] cursor-pointer group font-medium",sessionDeleteBtn:"ml-auto text-[#666666] hover:text-[#b33a2a] transition-colors text-[10px] shrink-0 opacity-0 group-hover:opacity-100",sessionNewBtn:"w-full flex items-center gap-2 pl-9 pr-3 py-1.5 text-xs text-[#666666] hover:bg-[#eeece7] hover:text-[#2b5ea7] transition-colors",panelChatUserMessage:"text-sm leading-relaxed text-[#2c2c2c] [overflow-wrap:break-word]",panelChatAssistantMessage:"text-sm leading-relaxed text-[#444444] [overflow-wrap:break-word]",panelChatEmptyState:"text-[#666666] text-sm italic font-sans",panelChatThinking:"text-[#666666] text-sm italic",panelChatSeparator:"my-3 border-b border-[#d4d2cd]",panelChatInputArea:"px-4 py-3 bg-white border-t border-[#d4d2cd]",panelChatTextarea:"flex-1 bg-white border border-[#d4d2cd] rounded px-3 py-2 text-sm text-[#2c2c2c] placeholder-[#9c9890] focus:outline-none focus:border-[#2b5ea7] disabled:opacity-50 font-sans resize-none overflow-y-auto max-h-24",chartColors:["#6b9fd4","#6bb88a","#d4806e","#d4b06b","#a488c4","#6bb8aa"],popoverWide:"absolute z-30 bg-[#faf8f4] border border-[#e8e3da] rounded-md shadow-lg py-2 px-3 w-72",popoverLabel:"text-[10px] uppercase tracking-wider text-[#9c9890] font-sans mb-2",popoverRow:"flex items-start gap-2 py-1 text-xs text-[#6b6560] font-sans",popoverItemRow:"flex items-center justify-between text-[11px] text-[#6b6560] font-sans py-0.5",popoverDivider:"border-t border-[#e8e3da] my-1",popoverFootnote:"text-[10px] text-[#9c9890] font-sans mt-1 pt-1 border-t border-[#e8e3da]",titleBar:"sticky top-0 z-20 bg-[#faf8f4] px-10 pt-4 pb-4 mb-2 border-b border-[#e8e3da]",titleText:"text-base font-serif font-medium text-[#2b5ea7] tracking-tight",metaLink:"text-xs text-[#666666] hover:text-[#2b5ea7] font-sans transition-colors",streamingDot:"inline-block w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse",tokenSummary:"text-[10px] text-[#9c9890] font-sans tracking-wide hover:text-[#6b6560] transition-colors cursor-default"};function Ez({sidebar:n,children:a}){return C.jsxs("div",{className:`flex h-screen ${Re.shell}`,children:[C.jsx("aside",{className:"w-52 flex-shrink-0 h-full",children:n}),C.jsx("main",{className:"flex-1 overflow-auto",children:a})]})}const pT=n=>`${n.provider}:${n.modelId}`,zz={anthropic:"Anthropic",google:"Google AI","google-vertex":"Vertex AI"};function Tz(n){return zz[n]??n}const ay=["anthropic","google","google-vertex"];function mT(n){const a=new Map;for(const i of n){const l=a.get(i.provider);l?l.push(i):a.set(i.provider,[i])}return[...a.keys()].sort((i,l)=>{const s=ay.indexOf(i),f=ay.indexOf(l);return(s===-1?99:s)-(f===-1?99:f)}).map(i=>({provider:i,label:Tz(i),models:a.get(i)}))}const Dc=[{provider:"google",modelId:"gemini-3.1-pro-preview",inputPrice:2,outputPrice:12,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3.5-flash",inputPrice:1.5,outputPrice:9,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3-flash-preview",inputPrice:.5,outputPrice:3,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"google",modelId:"gemini-3.1-flash-lite-preview",inputPrice:.25,outputPrice:1.5,cacheReadMultiplier:.25,cacheWriteMultiplier:1},{provider:"anthropic",modelId:"claude-haiku-4-5-20251001",inputPrice:.8,outputPrice:4,cacheReadMultiplier:.1,cacheWriteMultiplier:1.25}],wz=Object.fromEntries(Dc.map(n=>[n.modelId,{input:n.inputPrice,output:n.outputPrice,cacheRead:n.cacheReadMultiplier,cacheWrite:n.cacheWriteMultiplier}]));function yT(n,a,i,l=0,s=0){if(!n)return 0;const f=wz[n];return f?((a-l)*f.input+l*f.input*f.cacheRead+s*f.input*f.cacheWrite+i*f.output)/1e6:0}function vT(n){return n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const un={sessionStaleTimeMs:3e4,activeStreamPollingMs:5e3,monitorPollingMs:6e4,updateCheckStaleTimeMs:300*1e3,updateRestartProbeDelayMs:1500,updateRestartPollMs:1e3,updateRestartMaxWaitMs:6e4,sidebarWidth:208,panelMinWidth:260,panelMaxWidthRatio:.8,gridRows:12,gridCols:12,gridMinRowHeight:20,gridMargin:[8,8],chatThrottleMs:50,maxSseErrors:3,maxBuckets:366};function gT(){const n=G.useRef(null),a=G.useRef(null),i=G.useRef(!0),[l,s]=G.useState(!0),f=G.useCallback(m=>{const y=n.current;y&&(i.current=!0,y.scrollTo({top:y.scrollHeight,behavior:m?.animation==="smooth"?"smooth":"instant"}))},[]),d=G.useCallback(m=>{const y=n.current;y&&(i.current=!1,y.scrollTo({top:0,behavior:m?.animation==="smooth"?"smooth":"instant"}))},[]),h=G.useCallback(m=>{m.deltaY<0&&(i.current=!1)},[]);return G.useEffect(()=>{const m=n.current;if(!m)return;const y=()=>{const g=m.scrollHeight-m.scrollTop-m.clientHeight<50;s(g),g&&(i.current=!0)};return m.addEventListener("scroll",y,{passive:!0}),()=>m.removeEventListener("scroll",y)},[]),G.useEffect(()=>{const m=a.current;if(!m)return;const y=new ResizeObserver(()=>{i.current&&f()});return y.observe(m),()=>y.disconnect()},[f]),{scrollRef:n,contentRef:a,isAtBottom:l,handleWheel:h,scrollToBottom:f,scrollToTop:d}}function bT(){const n=G.useRef(null),[a,i]=G.useState({width:0,height:0});return G.useEffect(()=>{const l=n.current;if(!l)return;const s=new ResizeObserver(f=>{const d=f[0]?.contentRect;d&&d.width>0&&i({width:d.width,height:d.height})});return s.observe(l),()=>s.disconnect()},[]),{ref:n,size:a}}function ry(n,a,i){const l=G.useRef(n);l.current=n,G.useEffect(()=>{if(!i)return;l.current();const s=setInterval(()=>{document.visibilityState==="visible"&&l.current()},a),f=()=>{document.visibilityState==="visible"&&l.current()};return document.addEventListener("visibilitychange",f),()=>{clearInterval(s),document.removeEventListener("visibilitychange",f)}},[i,a])}function Az(n){const[a,i]=G.useState(!1),[l,s]=G.useState(!1);return G.useEffect(()=>{const f=n.current;if(!f)return;const d=()=>{i(f.scrollTop>0),s(f.scrollTop+f.clientHeight<f.scrollHeight-1)};d(),f.addEventListener("scroll",d,{passive:!0});const h=new ResizeObserver(d);return h.observe(f),()=>{f.removeEventListener("scroll",d),h.disconnect()}},[n]),{showTopFade:a,showBottomFade:l}}function _T(){return at.provider.gcpAuthStatus.useQuery(void 0,{refetchInterval:un.sessionStaleTimeMs,staleTime:un.sessionStaleTimeMs})}function jz(){const{data:n}=at.settings.getApiKey.useQuery("anthropic"),{data:a}=at.settings.getApiKey.useQuery("google"),{data:i}=at.settings.getVertexConfig.useQuery();return G.useMemo(()=>{const l=new Set;return n&&l.add("anthropic"),a&&l.add("google"),i?.projectId&&l.add("google-vertex"),l},[n,a,i])}function ST(){const n=jz(),a=n.has("google-vertex"),{data:i,isLoading:l}=at.provider.listVertexModels.useQuery(void 0,{enabled:a});return{models:G.useMemo(()=>{const f=Dc.filter(m=>n.has(m.provider)),d=a?(i??[]).map(m=>({provider:"google-vertex",modelId:m.modelId})):[],h=[...f,...d];return h.length>0?h:Dc},[n,a,i]),isLoading:a&&l}}function Mz(n,a=!0){const[i,l]=G.useState(!1),s=G.useRef(0),f=G.useRef(n);f.current=n;const d=m=>Array.from(m.dataTransfer.types).includes("Files");return{dragActive:a&&i,dropProps:a?{onDragEnter:m=>{d(m)&&(m.preventDefault(),s.current+=1,l(!0))},onDragOver:m=>{d(m)&&m.preventDefault()},onDragLeave:()=>{s.current=Math.max(0,s.current-1),s.current===0&&l(!1)},onDrop:m=>{m.preventDefault(),s.current=0,l(!1),m.dataTransfer.files?.length&&f.current(m.dataTransfer.files)}}:{}}}function OT(n,a){const i=G.useRef(a);G.useEffect(()=>{i.current=a}),G.useEffect(()=>{function l(s){n.current&&!n.current.contains(s.target)&&i.current()}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n])}const Sr=Uint8Array.from([84,82,67,49]),Rz=4,Ti=Sr.length+Rz,Cz=10*1024*1024;async function fg(n){const a=new Blob([n.buffer],{type:"image/png"});return createImageBitmap(a,{colorSpaceConversion:"none",premultiplyAlpha:"none"})}function dg(n){const a=document.createElement("canvas");a.width=n.width,a.height=n.height;const i=a.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("canvas 2D context unavailable");i.drawImage(n,0,0);const l=i.getImageData(0,0,a.width,a.height);return{canvas:a,ctx:i,imageData:l}}function Dz(n,a){const i=a.length*8;let l=0;for(let s=0;s<n.length&&l<i;s+=4)if(n[s+3]===255)for(let f=0;f<3&&l<i;f++){const d=l>>3,h=7-(l&7),m=a[d]>>h&1;n[s+f]=n[s+f]&254|m,l++}if(l<i)throw new Error("LSB write ran out of capacity mid-stream")}function iy(n,a){const i=new Uint8Array(a),l=a*8;let s=0;for(let f=0;f<n.length&&s<l;f+=4)if(n[f+3]===255)for(let d=0;d<3&&s<l;d++){const h=s>>3,m=7-(s&7);i[h]|=(n[f+d]&1)<<m,s++}return s>=l?i:null}function Nz(n){return new Promise((a,i)=>{n.toBlob(async l=>{if(!l){i(new Error("canvas.toBlob returned null"));return}a(new Uint8Array(await l.arrayBuffer()))},"image/png")})}async function xT(n,a){const i=await fg(n);try{const{canvas:l,ctx:s,imageData:f}=dg(i),d=new Uint8Array(Ti+a.length);return d.set(Sr,0),new DataView(d.buffer).setUint32(Sr.length,a.length,!1),d.set(a,Ti),Dz(f.data,d),s.putImageData(f,0,0),await Nz(l)}finally{i.close?.()}}async function Uz(n){const a=await fg(n);try{const{imageData:{data:i}}=dg(a),l=iy(i,Ti);if(!l)return null;for(let d=0;d<Sr.length;d++)if(l[d]!==Sr[d])return null;const s=new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(Sr.length,!1);if(s<=0||s>Cz)return null;const f=iy(i,Ti+s);return f?f.subarray(Ti):null}finally{a.close?.()}}function fl({children:n}){const a=G.useRef(null),{showTopFade:i,showBottomFade:l}=Az(a);return C.jsxs("div",{className:"relative",children:[C.jsx("div",{className:`absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-[#f7f6f3] to-transparent z-10 pointer-events-none transition-opacity ${i?"opacity-100":"opacity-0"}`}),C.jsx("div",{ref:a,className:"max-h-[300px] overflow-y-auto scrollbar-none",children:n}),C.jsx("div",{className:`absolute bottom-0 left-0 right-0 h-6 bg-gradient-to-t from-[#f7f6f3] to-transparent z-10 pointer-events-none transition-opacity ${l?"opacity-100":"opacity-0"}`})]})}function Zz({open:n,title:a,message:i,confirmLabel:l="Delete",cancelLabel:s="Cancel",confirmStyle:f="danger",onConfirm:d,onCancel:h}){const m=G.useRef(null);return G.useEffect(()=>{n&&m.current?.focus()},[n]),G.useEffect(()=>{if(!n)return;const y=g=>{g.key==="Escape"&&h()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n,h]),n?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:Re.dialogBackdrop,onClick:h}),C.jsxs("div",{className:Re.dialogCard,children:[C.jsx("div",{className:Re.dialogTitle,children:a}),C.jsx("div",{className:Re.dialogMessage,children:i}),C.jsxs("div",{className:"flex justify-end gap-2",children:[s!==null&&C.jsx("button",{onClick:h,className:Re.secondaryBtn,children:s}),C.jsx("button",{ref:m,onClick:d,className:f==="primary"?Re.primaryBtn:Re.dangerBtn,children:l})]})]})]}):null}function qz({open:n,onClose:a,children:i}){return G.useEffect(()=>{if(!n)return;const l=s=>{s.key==="Escape"&&a()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[n,a]),n?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:Re.dialogBackdrop,onClick:a}),C.jsx("div",{className:Re.modalCard,children:i})]}):null}const uy=n=>new Promise(a=>setTimeout(a,n));async function Qz(){await uy(un.updateRestartProbeDelayMs);const n=Date.now()+un.updateRestartMaxWaitMs;for(;Date.now()<n;){try{if((await fetch("/api/trpc/update.check",{cache:"no-store"})).ok)break}catch{}await uy(un.updateRestartPollMs)}window.location.reload()}function ly({command:n}){return C.jsx("code",{className:"block mt-2 p-2 bg-[#1a1a1a] rounded font-mono text-xs text-[#e0e0e0]",children:n})}function kz({open:n,onClose:a}){const i=at.update.check.useQuery(void 0,{staleTime:un.updateCheckStaleTimeMs}),[l,s]=G.useState(!1),[f,d]=G.useState(null),h=i.data,m=h?.canSelfUpdate===!0,y=h?.method==="npx"?"npx tracer-sh@latest":h?.method==="dev"?"git pull && pnpm install && pnpm build":"npm install -g tracer-sh@latest",g=at.update.perform.useMutation({onSuccess:x=>{x.ok?(s(!0),Qz()):d(x.error??"Update failed.")},onError:x=>d(x.message)}),S=g.isPending||l;return C.jsxs(qz,{open:n,onClose:S?()=>{}:a,children:[C.jsx("div",{className:Re.dialogTitle,children:"Update Available"}),C.jsxs("div",{className:"text-sm text-[#666666] mb-4 space-y-1",children:[C.jsxs("p",{children:["Current version: ",C.jsx("span",{className:"font-mono",children:h?.currentVersion})]}),C.jsxs("p",{children:["Latest version: ",C.jsx("span",{className:"font-mono",children:h?.latestVersion})]})]}),l?C.jsx("div",{className:"text-sm text-[#666666] mb-4",children:C.jsx("p",{children:"Installed. Restarting Tracer — this page will reload automatically."})}):m?C.jsxs(C.Fragment,{children:[f&&C.jsxs("div",{className:"text-sm text-[#b3261e] mb-4",children:[C.jsxs("p",{children:["Update failed: ",f]}),C.jsx("p",{className:"mt-2 text-[#666666]",children:"You can update manually instead:"}),C.jsx(ly,{command:y})]}),C.jsxs("div",{className:"flex justify-end gap-2",children:[C.jsx("button",{onClick:a,className:Re.secondaryBtn,disabled:S,children:"Close"}),C.jsx("button",{onClick:()=>{d(null),g.mutate()},className:Re.primaryBtn,disabled:S,children:S?"Updating…":"Update now"})]})]}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"text-sm text-[#666666] mb-4",children:[C.jsx("p",{children:"This instance runs from a source checkout. Update it with:"}),C.jsx(ly,{command:y})]}),C.jsx("div",{className:"flex justify-end",children:C.jsx("button",{onClick:a,className:Re.secondaryBtn,children:"Close"})})]})]})}const dl=({page:n})=>{const a={width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5};switch(n){case"dashboard":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"})});case"debug":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("path",{d:"M8 1.5L14.5 8L8 14.5L1.5 8Z"})});case"monitors":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("circle",{cx:"8",cy:"8",r:"6"})});case"settings":return C.jsx("svg",{...a,viewBox:"0 0 16 16",children:C.jsx("path",{d:"M3 4.5h10M3 8h10M3 11.5h10"})})}},Bz=[{page:"debug",label:"Debug"}];function Hz({currentPage:n,onNavigate:a,currentSessionId:i,onSelectSession:l,onNewSession:s,currentDashboardId:f,onSelectDashboard:d,onNewDashboard:h}){const m=at.sessions.list.useQuery(void 0,{staleTime:un.sessionStaleTimeMs}),y=at.dashboards.list.useQuery(void 0,{enabled:cl.dashboards}),g=at.monitorAlerts.activeCount.useQuery(void 0,{enabled:cl.monitors}),S=at.sessions.activeCount.useQuery(),x=at.useUtils();ry(()=>{x.sessions.activeCount.invalidate(),n==="debug"&&x.sessions.list.invalidate()},un.activeStreamPollingMs,!0);const R=at.monitors.shouldPoll.useQuery(void 0,{enabled:cl.monitors});ry(()=>{x.monitorAlerts.activeCount.invalidate(),x.monitors.shouldPoll.invalidate()},un.monitorPollingMs,(R.data??!1)&&cl.monitors);const L=at.sessions.markViewed.useMutation();G.useEffect(()=>{if(!i||n!=="debug"||!m.data)return;const T=m.data.find(q=>q.id===i);!T||T.status!=="done"||(x.sessions.list.setData(void 0,q=>q?.map(H=>H.id===i?{...H,status:"idle"}:H)),x.sessions.activeCount.setData(void 0,q=>q&&{...q,done:Math.max(0,q.done-1)}),L.mutate({id:i}))},[m.data,i,n]);const{regularSessions:Z,importedSessions:ne,apiSessions:ue}=G.useMemo(()=>{const T=m.data??[],q=T.filter(J=>J.kind!==yr.IMPORTED&&J.kind!==yr.API),H=T.filter(J=>J.kind===yr.IMPORTED),$=T.filter(J=>J.kind===yr.API);return{regularSessions:q,importedSessions:H,apiSessions:$}},[m.data]),de=g.data??0,ve=n==="debug"&&m.data?m.data.filter(T=>T.status==="done"&&T.id!==i&&T.kind!==yr.API).length:S.data?.done??0,be=at.sessions.delete.useMutation(),P=at.dashboards.delete.useMutation(),[Y,D]=G.useState(null),[K,W]=G.useState(!1),ae=at.update.check.useQuery(void 0,{staleTime:un.updateCheckStaleTimeMs}),re=ae.data?.available===!0,F=(T,q)=>{T.stopPropagation(),D({type:"session",id:q})},he=(T,q)=>{T.stopPropagation(),D({type:"dashboard",id:q})},[ce,oe]=G.useState(null),A=at.sessions.importAnalysis.useMutation(),B=G.useCallback(async T=>{if(T.type!=="image/png"){oe("Only PNG files are supported.");return}if(T.size>10*1024*1024){oe("PNG is too large (>10 MB).");return}try{const q=new Uint8Array(await T.arrayBuffer());let H;try{H=await Uz(q)}catch{oe("Not a valid PNG file.");return}if(!H){oe("No analysis data found in this image.");return}let $;try{$=xz.parse(JSON.parse(new TextDecoder().decode(H)))}catch{oe("Analysis data is malformed or from an incompatible version.");return}const{id:J}=await A.mutateAsync($);x.sessions.list.setData(void 0,pe=>{const it={id:J,title:$.sourceTitle.slice(0,80)||U1,status:"idle",kind:yr.IMPORTED,updatedAt:Math.floor(Date.now()/1e3),titlePending:!1};return pe?[it,...pe]:[it]}),oe(null),n!=="debug"&&a("debug"),l(J)}catch{oe("Couldn't import analysis.")}},[A,x,l,a,n]),V=G.useCallback(T=>{if(T.length>1){oe("Drop a single PNG to import.");return}B(T[0])},[B]),{dragActive:se,dropProps:ge}=Mz(V),_=()=>{Y&&(Y.type==="session"?be.mutate({id:Y.id},{onSuccess:()=>{x.sessions.list.invalidate(),i===Y.id&&s()}}):P.mutate({id:Y.id},{onSuccess:()=>{x.dashboards.list.invalidate(),f===Y.id&&a("dashboard")}}),D(null))};return C.jsxs("div",{className:`flex flex-col h-full ${Re.sidebar}`,children:[C.jsxs("div",{className:"p-6",children:[C.jsxs("h1",{className:`text-2xl font-bold ${Re.sidebarLogo} flex items-center gap-2`,children:[C.jsx("img",{src:"/logo.svg",alt:"",className:"w-6 h-6"}),"Tracer"]}),C.jsx("p",{className:`text-xs mt-1 ${Re.sidebarSubtitle}`,children:"Observability Platform"})]}),C.jsx("nav",{className:"flex-1 px-3 space-y-1 overflow-y-auto",children:Bz.map(({page:T,label:q})=>{const H=n===T;return C.jsxs("div",{children:[C.jsxs("button",{onClick:()=>a(T),className:`w-full flex items-center gap-3 px-3 py-2 rounded-sm text-sm transition-colors ${H?Re.navActive:Re.navInactive}`,children:[T==="monitors"&&de>0?C.jsxs("span",{className:"relative flex items-center justify-center w-5 shrink-0",children:[C.jsx(dl,{page:T}),C.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{animation:"fill-up-down 4s ease-in-out infinite"},children:C.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:C.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"#b33a2a",stroke:"none"})})})]}):T==="debug"&&ve>0?C.jsxs("span",{className:"relative flex items-center justify-center w-5 shrink-0",children:[C.jsx(dl,{page:T}),C.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{animation:"fill-up-down 4s ease-in-out infinite"},children:C.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:C.jsx("path",{d:"M8 1.5L14.5 8L8 14.5L1.5 8Z",fill:"#2b5ea7",stroke:"none"})})})]}):C.jsx("span",{className:"w-5 flex items-center justify-center shrink-0",children:C.jsx(dl,{page:T})}),q,T==="monitors"&&de>0&&C.jsx("span",{className:"ml-auto flex items-center gap-1.5",children:C.jsx("span",{className:"text-[10px] font-medium text-[#b33a2a]",children:de})})]}),T==="dashboard"&&n==="dashboard"&&C.jsxs("div",{className:"mt-1 space-y-0.5",children:[C.jsxs("button",{onClick:h,className:Re.sessionNewBtn,children:[C.jsx("span",{className:"text-[10px]",children:"+"}),"New dashboard"]}),C.jsx(fl,{children:y.data?.map($=>C.jsxs("button",{onClick:()=>d($.id),className:f===$.id?Re.sessionItemActive:Re.sessionItem,children:[C.jsx("span",{className:"truncate flex-1 text-left",children:$.title}),C.jsx("span",{onClick:J=>he(J,$.id),className:Re.sessionDeleteBtn,children:"×"})]},$.id))})]}),T==="debug"&&(()=>{const $=J=>C.jsxs("button",{onClick:()=>l(J.id),className:i===J.id?Re.sessionItemActive:Re.sessionItem,children:[C.jsx("span",{className:`truncate flex-1 text-left ${(J.status==="streaming"||J.status==="done")&&J.id!==i?"text-[#2b5ea7] underline":""}`,title:J.title,children:J.title}),C.jsx("span",{onClick:pe=>F(pe,J.id),className:Re.sessionDeleteBtn,children:"×"})]},J.id);return C.jsxs("div",{className:"mt-1 space-y-0.5",children:[C.jsxs("button",{onClick:s,className:Re.sessionNewBtn,children:[C.jsx("span",{className:"text-[10px]",children:"+"}),"New chat"]}),C.jsx(fl,{children:Z.map($)}),ne.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9890]/60 px-3 pt-3 pb-1",children:"Imported"}),C.jsx(fl,{children:ne.map($)})]}),ue.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[#9c9890]/60 px-3 pt-3 pb-1",children:"API"}),C.jsx(fl,{children:ue.map($)})]}),C.jsxs("label",{className:`mt-3 mx-2 flex items-center justify-center gap-1.5 px-3 py-2 text-[11px] rounded border border-dashed cursor-pointer transition-colors ${se?"border-[#2b5ea7] bg-[#eaf0f8] text-[#2b5ea7]":"border-[#d4d2cd] text-[#9c9890] hover:text-[#2b5ea7] hover:border-[#2b5ea7]"}`,...ge,children:[C.jsx("input",{type:"file",accept:"image/png",className:"hidden",onChange:J=>{const pe=J.target.files?.[0];pe&&B(pe),J.target.value=""}}),C.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),C.jsx("polyline",{points:"17 8 12 3 7 8"}),C.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Import analysis image"]}),ce&&C.jsx("div",{className:"mx-2 mt-1 text-[10px] text-[#b33a2a]",children:ce})]})})()]},T)})}),C.jsx("div",{className:"px-3 pb-2",children:C.jsxs("button",{onClick:()=>a("settings"),className:`w-full flex items-center gap-3 px-3 py-2 rounded-sm text-sm transition-colors ${n==="settings"?Re.navActive:Re.navInactive}`,children:[C.jsx("span",{className:"w-5 flex items-center justify-center shrink-0",children:C.jsx(dl,{page:"settings"})}),"Settings"]})}),C.jsx("div",{className:`p-4 ${Re.sidebarFooter}`,children:C.jsxs("button",{onClick:()=>re&&W(!0),className:`font-mono text-[10px] tracking-wider inline-flex items-center gap-1.5 ${re?"cursor-pointer hover:text-[#2b5ea7]":"cursor-default"}`,children:["v",ae.data?.currentVersion??"0.3.6",re?C.jsx("span",{className:"w-2 h-2 rounded-full bg-[#2b5ea7] animate-pulse"}):ae.data&&!ae.isLoading?C.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:"text-[#2a7a4a]",children:C.jsx("path",{d:"M2 5.5L4 7.5L8 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):null]})}),C.jsx(kz,{open:K,onClose:()=>W(!1)}),C.jsx(Zz,{open:Y!==null,title:Y?.type==="session"?"Delete session":"Delete dashboard",message:Y?.type==="session"?"Delete this chat session?":"Delete this dashboard and all its widgets?",onConfirm:_,onCancel:()=>D(null)})]})}const Lz={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"};function Gz({size:n="md",centered:a=!1}){const i=C.jsx("div",{className:`${Lz[n]} animate-spin rounded-full border-2 ${Re.spinner}`});return a?C.jsx("div",{className:"flex items-center justify-center py-12",children:i}):i}const Yz=G.lazy(()=>ov(()=>import("./mermaid-GHXKKRXX-CiyDBVIR.js").then(n=>n.D),__vite__mapDeps([0,1,2])).then(n=>({default:n.Debug}))),$z=G.lazy(()=>ov(()=>import("./Settings-CgEySEhC.js"),__vite__mapDeps([3,1])).then(n=>({default:n.Settings}))),Vz=null,Kz=null,Pz=new Set(["debug","settings"]);function hg(){const n=window.location.pathname.replace(/^\/+/,"").split("/"),a=n[0]&&Pz.has(n[0])?n[0]:"debug",i=a==="debug"&&n[1]?n[1]:null,l=a==="dashboard"&&n[1]?n[1]:null;return{page:a,sessionId:i,dashboardId:l}}let sy="",oy=hg();function Xz(){const n=window.location.pathname;return n!==sy&&(sy=n,oy=hg()),oy}function Jz(n){return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)}function Oi(n){window.history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate"))}const Iz=()=>C.jsx(Gz,{size:"lg",centered:!0});function Fz(){const{page:n,sessionId:a,dashboardId:i}=G.useSyncExternalStore(Jz,Xz),l=G.useCallback(m=>{Oi(m==="debug"?"/":`/${m}`)},[]),s=G.useCallback(m=>{Oi(`/debug/${m}`)},[]),f=G.useCallback(()=>{Oi("/debug")},[]),d=G.useCallback(m=>{Oi(`/dashboard/${m}`)},[]),h=G.useCallback(()=>{Oi(`/dashboard/${crypto.randomUUID()}`)},[]);return C.jsx(Ez,{sidebar:C.jsx(Hz,{currentPage:n,onNavigate:l,currentSessionId:a,onSelectSession:s,onNewSession:f,currentDashboardId:i,onSelectDashboard:d,onNewDashboard:h}),children:C.jsxs(G.Suspense,{fallback:C.jsx(Iz,{}),children:[Vz,n==="debug"&&C.jsx(Yz,{sessionId:a,onSessionChange:s},a??"new"),Kz,n==="settings"&&C.jsx($z,{})]})})}function Wz(){const[n]=G.useState(()=>new x_),[a]=G.useState(()=>at.createClient({links:[_S({url:"/api/trpc",transformer:Te})]}));return C.jsx(at.Provider,{client:a,queryClient:n,children:C.jsx(E_,{client:n,children:C.jsx(Fz,{})})})}Jb.createRoot(document.getElementById("root")).render(C.jsx(G.StrictMode,{children:C.jsx(Wz,{})}));export{yr as $,Dc as A,BE as B,Zz as C,iT as D,ez as E,Qb as F,ov as G,Nc as H,bT as I,og as J,cg as K,Lb as L,qz as M,Oz as N,xT as O,gT as P,Mz as Q,Gb as R,Gz as S,dT as T,tT as U,ry as V,un as W,OT as X,yT as Y,vT as Z,cT as _,Kb as a,U1 as a0,fT as a1,Sz as a2,Re as b,hT as c,jz as d,ST as e,nT as f,mT as g,XE as h,Jm as i,C as j,oT as k,sT as l,pT as m,lT as n,KE as o,Tz as p,Wm as q,G as r,hE as s,at as t,_T as u,aT as v,Rc as w,uT as x,ig as y,rT as z};
|
package/packages/web/dist/assets/{mermaid-GHXKKRXX-VdzAklnF.js → mermaid-GHXKKRXX-CiyDBVIR.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-
|
|
2
|
-
import{s as UN,f as HN,h as gr,i as ne,_ as Zu,k as iw,l as zN,n as ao,o as Ve,q as pe,v as er,w as Kn,x as qN,y as No,z as WN,B as VN,D as Qe,E as YN,r as m,F as Mn,j as b,G as uc,H as rm,R as KN,c as rr,b as F,I as GN,J as Gn,K as Th,L as XN,N as ZN,O as QN,P as aw,W as Ba,Q as JN,T as sw,C as ow,t as yt,U as Ca,V as uw,X as lw,Y as $g,Z as cu,$ as eP,a0 as Ug,a1 as tP,a2 as rP}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-GpbSyT-_.js","assets/index-BsLO7f3R.js","assets/index-CatFLQpv.css","assets/SearchableSelect-VoTpUxSB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as UN,f as HN,h as gr,i as ne,_ as Zu,k as iw,l as zN,n as ao,o as Ve,q as pe,v as er,w as Kn,x as qN,y as No,z as WN,B as VN,D as Qe,E as YN,r as m,F as Mn,j as b,G as uc,H as rm,R as KN,c as rr,b as F,I as GN,J as Gn,K as Th,L as XN,N as ZN,O as QN,P as aw,W as Ba,Q as JN,T as sw,C as ow,t as yt,U as Ca,V as uw,X as lw,Y as $g,Z as cu,$ as eP,a0 as Ug,a1 as tP,a2 as rP}from"./index-BsLO7f3R.js";import{r as Po,u as nP}from"./SearchableSelect-VoTpUxSB.js";const cw=new Set(["timestamp","start","end","created_at","updated_at","time"]);function iP(e,t){return cw.has(e)?t>1e12:/time/i.test(e)&&t>1e12&&t<3e12}function aP(e,t){return cw.has(e)?t>1e9&&t<1e12:/time/i.test(e)&&t>1e9&&t<3e9}var fw="vercel.ai.error",sP=Symbol.for(fw),Hg,zg,pn=class dw extends(zg=Error,Hg=sP,zg){constructor({name:t,message:r,cause:n}){super(r),this[Hg]=!0,this.name=t,this.cause=n}static isInstance(t){return dw.hasMarker(t,fw)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};function hw(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var pw="AI_InvalidArgumentError",mw=`vercel.ai.error.${pw}`,oP=Symbol.for(mw),qg,Wg,uP=class extends(Wg=pn,qg=oP,Wg){constructor({message:e,cause:t,argument:r}){super({name:pw,message:e,cause:t}),this[qg]=!0,this.argument=r}static isInstance(e){return pn.hasMarker(e,mw)}},gw="AI_JSONParseError",bw=`vercel.ai.error.${gw}`,lP=Symbol.for(bw),Vg,Yg,Kg=class extends(Yg=pn,Vg=lP,Yg){constructor({text:e,cause:t}){super({name:gw,message:`JSON parsing failed: Text: ${e}.
|
|
3
3
|
Error message: ${hw(t)}`,cause:t}),this[Vg]=!0,this.text=e}static isInstance(e){return pn.hasMarker(e,bw)}},yw="AI_TypeValidationError",vw=`vercel.ai.error.${yw}`,cP=Symbol.for(vw),Gg,Xg,Fa=class wh extends(Xg=pn,Gg=cP,Xg){constructor({value:t,cause:r,context:n}){let i="Type validation failed";if(n?.field&&(i+=` for ${n.field}`),n?.entityName||n?.entityId){i+=" (";const a=[];n.entityName&&a.push(n.entityName),n.entityId&&a.push(`id: "${n.entityId}"`),i+=a.join(", "),i+=")"}super({name:yw,message:`${i}: Value: ${JSON.stringify(t)}.
|
|
4
4
|
Error message: ${hw(r)}`,cause:r}),this[Gg]=!0,this.value=t,this.context=n}static isInstance(t){return pn.hasMarker(t,vw)}static wrap({value:t,cause:r,context:n}){var i,a,s;return wh.isInstance(r)&&r.value===t&&((i=r.context)==null?void 0:i.field)===n?.field&&((a=r.context)==null?void 0:a.entityName)===n?.entityName&&((s=r.context)==null?void 0:s.entityId)===n?.entityId?r:new wh({value:t,cause:r,context:n})}},so;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},e.getValidEnumValues=i=>{const a=e.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},e.find=(i,a)=>{for(const s of i)if(a(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(so||(so={}));var Zg;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zg||(Zg={}));so.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);so.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Qu extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,u=0;for(;u<s.path.length;){const l=s.path[u];u===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(s))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return i(this),n}static assert(t){if(!(t instanceof Qu))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,so.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r=Object.create(null),n=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Qu.create=e=>new Qu(e);var Qg;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Qg||(Qg={}));var ve;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ve||(ve={}));class Jg extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}const eb=10,fP=13,Ti=32;function gf(e){}function dP(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=gf,onError:r=gf,onRetry:n=gf,onComment:i}=e,a=[];let s=!0,o,u="",l=0,c;function f(x){if(s&&(s=!1,x.charCodeAt(0)===239&&x.charCodeAt(1)===187&&x.charCodeAt(2)===191&&(x=x.slice(3))),a.length===0){const k=d(x);k!==""&&a.push(k);return}if(x.indexOf(`
|
|
5
5
|
`)===-1&&x.indexOf("\r")===-1){a.push(x);return}a.push(x);const T=a.join("");a.length=0;const E=d(T);E!==""&&a.push(E)}function d(x){let T=0;if(x.indexOf("\r")===-1){let E=x.indexOf(`
|
|
@@ -128,7 +128,7 @@ ${t}</tr>
|
|
|
128
128
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${An(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:n}){let i=this.parser.parseInline(n),a=Py(t);if(a===null)return i;t=a;let s='<a href="'+t+'"';return r&&(s+=' title="'+An(r)+'"'),s+=">"+i+"</a>",s}image({href:t,title:r,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let a=Py(t);if(a===null)return An(n);t=a;let s=`<img src="${t}" alt="${n}"`;return r&&(s+=` title="${An(r)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:An(t.text)}},Bm=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},zr=class Vh{options;renderer;textRenderer;constructor(t){this.options=t||aa,this.options.renderer=this.options.renderer||new ll,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bm}static parse(t,r){return new Vh(r).parse(t)}static parseInline(t,r){return new Vh(r).parseInline(t)}parse(t){let r="";for(let n=0;n<t.length;n++){let i=t[n];if(this.options.extensions?.renderers?.[i.type]){let s=i,o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){r+=o||"";continue}}let a=i;switch(a.type){case"space":{r+=this.renderer.space(a);break}case"hr":{r+=this.renderer.hr(a);break}case"heading":{r+=this.renderer.heading(a);break}case"code":{r+=this.renderer.code(a);break}case"table":{r+=this.renderer.table(a);break}case"blockquote":{r+=this.renderer.blockquote(a);break}case"list":{r+=this.renderer.list(a);break}case"checkbox":{r+=this.renderer.checkbox(a);break}case"html":{r+=this.renderer.html(a);break}case"def":{r+=this.renderer.def(a);break}case"paragraph":{r+=this.renderer.paragraph(a);break}case"text":{r+=this.renderer.text(a);break}default:{let s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}parseInline(t,r=this.renderer){let n="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=o||"";continue}}let s=a;switch(s.type){case"escape":{n+=r.text(s);break}case"html":{n+=r.html(s);break}case"link":{n+=r.link(s);break}case"image":{n+=r.image(s);break}case"checkbox":{n+=r.checkbox(s);break}case"strong":{n+=r.strong(s);break}case"em":{n+=r.em(s);break}case"codespan":{n+=r.codespan(s);break}case"br":{n+=r.br(s);break}case"del":{n+=r.del(s);break}case"text":{n+=r.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}},Bs=class{options;block;constructor(e){this.options=e||aa}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Mr.lex:Mr.lexInline}provideParser(){return this.block?zr.parse:zr.parseInline}},s7=class{defaults=Om();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=zr;Renderer=ll;TextRenderer=Bm;Lexer=Mr;Tokenizer=ul;Hooks=Bs;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let n of e)switch(r=r.concat(t.call(this,n)),n.type){case"table":{let i=n;for(let a of i.header)r=r.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let s of a)r=r.concat(this.walkTokens(s.tokens,t));break}case"list":{let i=n;r=r.concat(this.walkTokens(i.items,t));break}default:{let i=n;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let s=i[a].flat(1/0);r=r.concat(this.walkTokens(s,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...s){let o=i.renderer.apply(this,s);return o===!1&&(o=a.apply(this,s)),o}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),r.renderer){let i=this.defaults.renderer||new ll(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,o=r.renderer[s],u=i[s];i[s]=(...l)=>{let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c||""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new ul(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,o=r.tokenizer[s],u=i[s];i[s]=(...l)=>{let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Bs;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,o=r.hooks[s],u=i[s];Bs.passThroughHooks.has(a)?i[s]=l=>{if(this.defaults.async&&Bs.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await o.call(i,l);return u.call(i,f)})();let c=o.call(i,l);return u.call(i,c)}:i[s]=(...l)=>{if(this.defaults.async)return(async()=>{let f=await o.apply(i,l);return f===!1&&(f=await u.apply(i,l)),f})();let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;n.walkTokens=function(s){let o=[];return o.push(a.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Mr.lex(e,t??this.defaults)}parser(e,t){return zr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let n={...r},i={...this.defaults,...n},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(t):t,o=await(i.hooks?await i.hooks.provideLexer():e?Mr.lex:Mr.lexInline)(s,i),u=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let l=await(i.hooks?await i.hooks.provideParser():e?zr.parse:zr.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(l):l})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let s=(i.hooks?i.hooks.provideLexer():e?Mr.lex:Mr.lexInline)(t,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let o=(i.hooks?i.hooks.provideParser():e?zr.parse:zr.parseInline)(s,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(s){return a(s)}}}onError(e,t){return r=>{if(r.message+=`
|
|
129
129
|
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+An(r.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},Yi=new s7;function qe(e,t){return Yi.parse(e,t)}qe.options=qe.setOptions=function(e){return Yi.setOptions(e),qe.defaults=Yi.defaults,tk(qe.defaults),qe};qe.getDefaults=Om;qe.defaults=aa;qe.use=function(...e){return Yi.use(...e),qe.defaults=Yi.defaults,tk(qe.defaults),qe};qe.walkTokens=function(e,t){return Yi.walkTokens(e,t)};qe.parseInline=Yi.parseInline;qe.Parser=zr;qe.parser=zr.parse;qe.Renderer=ll;qe.TextRenderer=Bm;qe.Lexer=Mr;qe.lexer=Mr.lex;qe.Tokenizer=ul;qe.Hooks=Bs;qe.parse=qe;qe.options;qe.setOptions;qe.use;qe.walkTokens;qe.parseInline;zr.parse;Mr.lex;var o7=300,u7="300px",l7=500;function c7(e={}){let{immediate:t=!1,debounceDelay:r=o7,rootMargin:n=u7,idleTimeout:i=l7}=e,[a,s]=m.useState(!1),o=m.useRef(null),u=m.useRef(null),l=m.useRef(null),c=m.useMemo(()=>h=>{let p=Date.now();return window.setTimeout(()=>{h({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-p))})},1)},[]),f=m.useMemo(()=>typeof window<"u"&&window.requestIdleCallback?(h,p)=>window.requestIdleCallback(h,p):c,[c]),d=m.useMemo(()=>typeof window<"u"&&window.cancelIdleCallback?h=>window.cancelIdleCallback(h):h=>{clearTimeout(h)},[]);return m.useEffect(()=>{if(t){s(!0);return}let h=o.current;if(!h)return;u.current&&(clearTimeout(u.current),u.current=null),l.current&&(d(l.current),l.current=null);let p=()=>{u.current&&(clearTimeout(u.current),u.current=null),l.current&&(d(l.current),l.current=null)},y=E=>{l.current=f(k=>{k.timeRemaining()>0||k.didTimeout?(s(!0),E.disconnect()):l.current=f(()=>{s(!0),E.disconnect()},{timeout:i/2})},{timeout:i})},v=E=>{p(),u.current=window.setTimeout(()=>{var k,w;let A=E.takeRecords();(A.length===0||(w=(k=A.at(-1))==null?void 0:k.isIntersecting)!=null&&w)&&y(E)},r)},x=(E,k)=>{E.isIntersecting?v(k):p()},T=new IntersectionObserver(E=>{for(let k of E)x(k,T)},{rootMargin:n,threshold:0});return T.observe(h),()=>{u.current&&clearTimeout(u.current),l.current&&d(l.current),T.disconnect()}},[t,r,n,i,d,f]),{shouldRender:a,containerRef:o}}var dk=/\s/,f7=/^\s+$/,d7=new Set(["code","pre","svg","math","annotation"]),h7=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",p7=e=>e.some(t=>h7(t)&&d7.has(t.tagName)),m7=e=>{let t=[],r="",n=!1;for(let i of e){let a=dk.test(i);a!==n&&r&&(t.push(r),r=""),r+=i,n=a}return r&&t.push(r),t},g7=e=>{let t=[],r="";for(let n of e)dk.test(n)?r+=n:(r&&(t.push(r),r=""),t.push(n));return r&&t.push(r),t},b7=(e,t,r,n,i,a)=>{let s=`--sd-animation:sd-${t};--sd-duration:${i?0:r}ms;--sd-easing:${n}`;return a&&(s+=`;--sd-delay:${a}ms`),{type:"element",tagName:"span",properties:{"data-sd-animate":!0,style:s},children:[{type:"text",value:e}]}},y7=(e,t,r,n,i)=>{let a=t.at(-1);if(!(a&&"children"in a))return;if(p7(t))return Ia;let s=a,o=s.children.indexOf(e);if(o===-1)return;let u=e.value;if(!u.trim()){i.count+=u.length;return}let l=r.sep==="char"?g7(u):m7(u),c=n.prevContentLength,f=l.map(d=>{let h=i.count;if(i.count+=d.length,f7.test(d))return{type:"text",value:d};let p=c>0&&h<c,y=p?0:i.newIndex++*r.stagger;return b7(d,r.animation,r.duration,r.easing,p,y)});return s.children.splice(o,1,...f),o+f.length},v7=0;function Yh(e){var t,r,n,i,a;let s={animation:(t=e?.animation)!=null?t:"fadeIn",duration:(r=e?.duration)!=null?r:150,easing:(n=e?.easing)!=null?n:"ease",sep:(i=e?.sep)!=null?i:"word",stagger:(a=e?.stagger)!=null?a:40},o={prevContentLength:0,lastRenderCharCount:0},u=v7++,l=()=>c=>{let f={count:0,newIndex:0};am(c,"text",(d,h)=>y7(d,h,s,o,f)),o.lastRenderCharCount=f.count,o.prevContentLength=0};return Object.defineProperty(l,"name",{value:`rehypeAnimate$${u}`}),{name:"animate",type:"animate",rehypePlugin:l,setPrevContentLength(c){o.prevContentLength=c},getLastRenderCharCount(){let c=o.lastRenderCharCount;return o.lastRenderCharCount=0,c}}}Yh();var hk=m.createContext(!1),x7=()=>m.useContext(hk),Fm=(...e)=>q2($e(e)),E7=(e,t)=>{if(!e||!t)return t;let r=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(r)?n:`${e}:${n}`).join(" ")},T7=e=>e?(...t)=>E7(e,q2($e(t))):Fm,Da=(e,t,r)=>{let n=typeof t=="string"&&r.startsWith("text/csv")?"\uFEFF":"",i=typeof t=="string"?new Blob([n+t],{type:r}):t,a=URL.createObjectURL(i),s=document.createElement("a");s.href=a,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)},Kh=m.createContext(Fm),_e=()=>m.useContext(Kh),w7=Fm("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),A7=e=>{let t={};for(let r of e.split(";")){let n=r.indexOf(":");if(n>0){let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();i&&a&&(t[i]=a)}}return t},k7=m.memo(({children:e,result:t,language:r,className:n,startLine:i,lineNumbers:a=!0,...s})=>{let o=_e(),u=m.useMemo(()=>o(w7),[o]),l=m.useMemo(()=>{let c={};return t.bg&&(c["--sdm-bg"]=t.bg),t.fg&&(c["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(c,A7(t.rootStyle)),c},[t.bg,t.fg,t.rootStyle]);return b.jsx("div",{className:o(n,"overflow-x-auto rounded-md border border-border bg-background p-4 text-sm"),"data-language":r,"data-streamdown":"code-block-body",...s,children:b.jsx("pre",{className:o(n,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:l,children:b.jsx("code",{className:a?o("[counter-increment:line_0] [counter-reset:line]"):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((c,f)=>b.jsx("span",{className:a?u:void 0,children:c.length===0||c.length===1&&c[0].content===""?`
|
|
130
130
|
`:c.map((d,h)=>{let p={},y=!!d.bgColor;if(d.color&&(p["--sdm-c"]=d.color),d.bgColor&&(p["--sdm-tbg"]=d.bgColor),d.htmlStyle)for(let[v,x]of Object.entries(d.htmlStyle))v==="color"?p["--sdm-c"]=x:v==="background-color"?(p["--sdm-tbg"]=x,y=!0):p[v]=x;return b.jsx("span",{className:o("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",y&&"bg-[var(--sdm-tbg)]",y&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:p,...d.htmlAttrs,children:d.content},h)})},f))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),_7=({className:e,language:t,style:r,isIncomplete:n,...i})=>{let a=_e();return b.jsx("div",{className:a("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...i})},pk=m.createContext({code:""}),mk=()=>m.useContext(pk),S7=({language:e})=>{let t=_e();return b.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:b.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})},C7=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
131
|
-
`;)t--;return e.slice(0,t)},I7=m.lazy(()=>uc(()=>import("./highlighted-body-OFNGDK62-
|
|
131
|
+
`;)t--;return e.slice(0,t)},I7=m.lazy(()=>uc(()=>import("./highlighted-body-OFNGDK62-GpbSyT-_.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.HighlightedCodeBlockBody}))),O7=({code:e,language:t,className:r,children:n,isIncomplete:i=!1,startLine:a,lineNumbers:s,...o})=>{let u=_e(),l=m.useMemo(()=>C7(e),[e]),c=m.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:l.split(`
|
|
132
132
|
`).map(f=>[{content:f,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[l]);return b.jsx(pk.Provider,{value:{code:e},children:b.jsxs(_7,{isIncomplete:i,language:t,children:[b.jsx(S7,{language:t}),n?b.jsx("div",{className:u("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:b.jsx("div",{className:u("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,b.jsx(m.Suspense,{fallback:b.jsx(k7,{className:r,language:t,lineNumbers:s,result:c,startLine:a,...o}),children:b.jsx(I7,{className:r,code:l,language:t,lineNumbers:s,raw:c,startLine:a,...o})})]})})},N7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),P7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),R7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),D7=e=>b.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[b.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),L7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),M7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),j7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),B7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),F7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),$7=e=>b.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:b.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),Fs={CheckIcon:N7,CopyIcon:P7,DownloadIcon:R7,ExternalLinkIcon:B7,Loader2Icon:D7,Maximize2Icon:L7,RotateCcwIcon:M7,XIcon:j7,ZoomInIcon:F7,ZoomOutIcon:$7},gk=m.createContext(Fs),U7=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(i=>e[i]===t[i])},Ly=({icons:e,children:t})=>{let r=m.useRef(e),n=m.useRef(e?{...Fs,...e}:Fs);U7(r.current,e)||(r.current=e,n.current=e?{...Fs,...e}:Fs);let i=n.current;return b.jsx(gk.Provider,{value:i,children:t})},Qr=()=>m.useContext(gk),bk={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},Gh=m.createContext(bk),Bn=()=>m.useContext(Gh),My=({onCopy:e,onError:t,timeout:r=2e3,children:n,className:i,code:a,...s})=>{let o=_e(),[u,l]=m.useState(!1),c=m.useRef(0),{code:f}=mk(),{isAnimating:d}=m.useContext(_r),h=Bn(),p=a??f,y=async()=>{var T;if(typeof window>"u"||!((T=navigator?.clipboard)!=null&&T.writeText)){t?.(new Error("Clipboard API not available"));return}try{u||(await navigator.clipboard.writeText(p),l(!0),e?.(),c.current=window.setTimeout(()=>l(!1),r))}catch(E){t?.(E)}};m.useEffect(()=>()=>{window.clearTimeout(c.current)},[]);let v=Qr(),x=u?v.CheckIcon:v.CopyIcon;return b.jsx("button",{className:o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-copy-button",disabled:d,onClick:y,title:h.copyCode,type:"button",...s,children:n??b.jsx(x,{size:14})})},jy={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",文言:"wy"},H7=({onDownload:e,onError:t,language:r,children:n,className:i,code:a,...s})=>{let o=_e(),{code:u}=mk(),{isAnimating:l}=m.useContext(_r),c=Bn(),f=Qr(),d=a??u,h=`file.${r&&r in jy?jy[r]:"txt"}`,p="text/plain",y=()=>{try{Da(h,d,p),e?.()}catch(v){t?.(v)}};return b.jsx("button",{className:o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-download-button",disabled:l,onClick:y,title:c.downloadFile,type:"button",...s,children:n??b.jsx(f.DownloadIcon,{size:14})})},By=()=>{let{Loader2Icon:e}=Qr(),t=_e();return b.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[b.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),b.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:b.jsx(e,{className:t("size-4 animate-spin")})})]})},z7=/\.[^/.]+$/,q7=({node:e,className:t,src:r,alt:n,onLoad:i,onError:a,...s})=>{let{DownloadIcon:o}=Qr(),u=_e(),l=m.useRef(null),[c,f]=m.useState(!1),[d,h]=m.useState(!1),p=Bn(),y=s.width!=null||s.height!=null,v=(c||y)&&!d,x=d&&!y;m.useEffect(()=>{let w=l.current;if(w!=null&&w.complete){let A=w.naturalWidth>0;f(A),h(!A)}},[]);let T=m.useCallback(w=>{f(!0),h(!1),i?.(w)},[i]),E=m.useCallback(w=>{f(!1),h(!0),a?.(w)},[a]),k=async()=>{if(r)try{let w=await(await fetch(r)).blob(),A=new URL(r,window.location.origin).pathname.split("/").pop()||"",C=A.split(".").pop(),N=A.includes(".")&&C!==void 0&&C.length<=4,D="";if(N)D=A;else{let S=w.type,M="png";S.includes("jpeg")||S.includes("jpg")?M="jpg":S.includes("png")?M="png":S.includes("svg")?M="svg":S.includes("gif")?M="gif":S.includes("webp")&&(M="webp"),D=`${(n||A||"image").replace(z7,"")}.${M}`}Da(D,w,w.type)}catch{window.open(r,"_blank")}};return r?b.jsxs("div",{className:u("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[b.jsx("img",{alt:n,className:u("max-w-full rounded-lg",x&&"hidden",t),"data-streamdown":"image",onError:E,onLoad:T,ref:l,src:r,...s}),x&&b.jsx("span",{className:u("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:p.imageNotAvailable}),b.jsx("div",{className:u("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),v&&b.jsx("button",{className:u("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:k,title:p.downloadImage,type:"button",children:b.jsx(o,{size:14})})]}):null},to=0,$m=()=>{to+=1,to===1&&(document.body.style.overflow="hidden")},Um=()=>{to=Math.max(0,to-1),to===0&&(document.body.style.overflow="")},W7=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:s,XIcon:o}=Qr(),u=_e(),[l,c]=m.useState(!1),f=Bn(),d=m.useCallback(async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),2e3)}catch{}},[e]),h=m.useCallback(()=>{n(),r()},[n,r]);return m.useEffect(()=>{if(t){$m();let p=y=>{y.key==="Escape"&&r()};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),Um()}}},[t,r]),t?b.jsx("div",{className:u("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:r,onKeyDown:p=>{p.key==="Escape"&&r()},role:"button",tabIndex:0,children:b.jsxs("div",{className:u("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[b.jsx("button",{className:u("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:r,title:f.close,type:"button",children:b.jsx(o,{size:16})}),b.jsxs("div",{className:u("flex flex-col gap-2"),children:[b.jsxs("div",{className:u("flex items-center gap-2 font-semibold text-lg"),children:[b.jsx(s,{size:20}),b.jsx("span",{children:f.openExternalLink})]}),b.jsx("p",{className:u("text-muted-foreground text-sm"),children:f.externalLinkWarning})]}),b.jsx("div",{className:u("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),b.jsxs("div",{className:u("flex gap-2"),children:[b.jsx("button",{className:u("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:d,type:"button",children:l?b.jsxs(b.Fragment,{children:[b.jsx(i,{size:14}),b.jsx("span",{children:f.copied})]}):b.jsxs(b.Fragment,{children:[b.jsx(a,{size:14}),b.jsx("span",{children:f.copyLink})]})}),b.jsxs("button",{className:u("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:h,type:"button",children:[b.jsx(s,{size:14}),b.jsx("span",{children:f.openLink})]})]})]})}):null},Xh=m.createContext(null),Hm=()=>m.useContext(Xh),coe=()=>{var e;let t=Hm();return(e=t?.code)!=null?e:null},zm=()=>{var e;let t=Hm();return(e=t?.mermaid)!=null?e:null},V7=e=>{var t;let r=Hm();return r!=null&&r.renderers&&e&&(t=r.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?t:null},Y7=(e,t)=>{var r;let n=(r=void 0)!=null?r:5;return new Promise((i,a)=>{let s="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),o=new Image;o.crossOrigin="anonymous",o.onload=()=>{let u=document.createElement("canvas"),l=o.width*n,c=o.height*n;u.width=l,u.height=c;let f=u.getContext("2d");if(!f){a(new Error("Failed to create 2D canvas context for PNG export"));return}f.drawImage(o,0,0,l,c),u.toBlob(d=>{if(!d){a(new Error("Failed to create PNG blob"));return}i(d)},"image/png")},o.onerror=()=>a(new Error("Failed to load SVG image")),o.src=s})},K7=({chart:e,children:t,className:r,onDownload:n,config:i,onError:a})=>{let s=_e(),[o,u]=m.useState(!1),l=m.useRef(null),{isAnimating:c}=m.useContext(_r),f=Qr(),d=zm(),h=Bn(),p=async y=>{try{if(y==="mmd"){Da("diagram.mmd",e,"text/plain"),u(!1),n?.(y);return}if(!d){a?.(new Error("Mermaid plugin not available"));return}let v=d.getMermaid(i),x=e.split("").reduce((k,w)=>(k<<5)-k+w.charCodeAt(0)|0,0),T=`mermaid-${Math.abs(x)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:E}=await v.render(T,e);if(!E){a?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(y==="svg"){Da("diagram.svg",E,"image/svg+xml"),u(!1),n?.(y);return}if(y==="png"){let k=await Y7(E);Da("diagram.png",k,"image/png"),n?.(y),u(!1);return}}catch(v){a?.(v)}};return m.useEffect(()=>{let y=v=>{let x=v.composedPath();l.current&&!x.includes(l.current)&&u(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[]),b.jsxs("div",{className:s("relative"),ref:l,children:[b.jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:c,onClick:()=>u(!o),title:h.downloadDiagram,type:"button",children:t??b.jsx(f.DownloadIcon,{size:14})}),o?b.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[b.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>p("svg"),title:h.downloadDiagramAsSvg,type:"button",children:h.mermaidFormatSvg}),b.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>p("png"),title:h.downloadDiagramAsPng,type:"button",children:h.mermaidFormatPng}),b.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>p("mmd"),title:h.downloadDiagramAsMmd,type:"button",children:h.mermaidFormatMmd})]}):null]})},G7=({chart:e,config:t,onFullscreen:r,onExit:n,className:i,...a})=>{let{Maximize2Icon:s,XIcon:o}=Qr(),u=_e(),[l,c]=m.useState(!1),{isAnimating:f,controls:d}=m.useContext(_r),h=Bn(),p=(()=>{if(typeof d=="boolean")return d;let v=d.mermaid;return v===!1?!1:v===!0||v===void 0?!0:v.panZoom!==!1})(),y=()=>{c(!l)};return m.useEffect(()=>{if(l){$m();let v=x=>{x.key==="Escape"&&c(!1)};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v),Um()}}},[l]),m.useEffect(()=>{l?r?.():n&&n()},[l,r,n]),b.jsxs(b.Fragment,{children:[b.jsx("button",{className:u("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),disabled:f,onClick:y,title:h.viewFullscreen,type:"button",...a,children:b.jsx(s,{size:14})}),l?Po.createPortal(b.jsxs("div",{className:u("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:y,onKeyDown:v=>{v.key==="Escape"&&y()},role:"button",tabIndex:0,children:[b.jsx("button",{className:u("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:y,title:h.exitFullscreen,type:"button",children:b.jsx(o,{size:20})}),b.jsx("div",{className:u("flex size-full items-center justify-center p-4"),onClick:v=>v.stopPropagation(),onKeyDown:v=>v.stopPropagation(),role:"presentation",children:b.jsx(Zk,{chart:e,className:u("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:!0,showControls:p})})]}),document.body):null]})},yk=e=>{var t,r;let n=[],i=[],a=e.querySelectorAll("thead th");for(let o of a)n.push(((t=o.textContent)==null?void 0:t.trim())||"");let s=e.querySelectorAll("tbody tr");for(let o of s){let u=[],l=o.querySelectorAll("td");for(let c of l)u.push(((r=c.textContent)==null?void 0:r.trim())||"");i.push(u)}return{headers:n,rows:i}},vk=e=>{let{headers:t,rows:r}=e,n=o=>{let u=!1,l=!1;for(let c of o){if(c==='"'){u=!0,l=!0;break}(c===","||c===`
|
|
133
133
|
`)&&(u=!0)}return u?l?`"${o.replace(/"/g,'""')}"`:`"${o}"`:o},i=t.length>0?r.length+1:r.length,a=new Array(i),s=0;t.length>0&&(a[s]=t.map(n).join(","),s+=1);for(let o of r)a[s]=o.map(n).join(","),s+=1;return a.join(`
|
|
134
134
|
`)},X7=e=>{let{headers:t,rows:r}=e,n=o=>{let u=!1;for(let c of o)if(c===" "||c===`
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
media="print"
|
|
15
15
|
onload="this.media='all'"
|
|
16
16
|
/>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-BsLO7f3R.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-CatFLQpv.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|