@houtini/gemini-mcp 2.2.0 → 2.2.3
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/README.md +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/types.d.ts +1 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/image-viewer/src/ui/image-viewer.html +2 -184
- package/dist/landing-page-viewer/src/ui/landing-page-viewer.html +2 -185
- package/dist/services/gemini/image-service.d.ts +1 -1
- package/dist/services/gemini/index.d.ts +1 -0
- package/dist/services/gemini/index.d.ts.map +1 -1
- package/dist/services/gemini/index.js +3 -0
- package/dist/services/gemini/index.js.map +1 -1
- package/dist/svg-viewer/src/ui/svg-viewer.html +2 -189
- package/dist/tools/gemini-deep-research.js +2 -2
- package/dist/tools/gemini-deep-research.js.map +1 -1
- package/dist/tools/register-deep-research.js +6 -6
- package/dist/tools/register-deep-research.js.map +1 -1
- package/dist/video-viewer/src/ui/video-viewer.html +2 -175
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@houtini/gemini-mcp)
|
|
4
4
|
[](https://registry.modelcontextprotocol.io)
|
|
5
|
+
[](https://snyk.io/test/github/houtini-ai/gemini-mcp)
|
|
6
|
+
${badge_line}
|
|
5
7
|
|
|
6
8
|
**I've been running this MCP server in my Claude Desktop setup for several months, and it's one of the few I leave enabled permanently.** Not because Gemini replaces Claude -- it doesn't -- but because grounded search, deep research, image generation, and video are things Gemini does well. Having them as tools inside Claude beats switching between browser tabs.
|
|
7
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKpC,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKpC,eAAO,MAAM,MAAM,EAAE,MAwCpB,CAAC;AAEF,wBAAgB,cAAc,IAAI,IAAI,CAOrC"}
|
package/dist/config/index.js
CHANGED
|
@@ -22,8 +22,9 @@ export const config = {
|
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
defaultModel: 'gemini-3.1-pro-preview', // chat / text
|
|
25
|
+
defaultDeepResearchModel: 'gemini-3-flash-preview', // deep_research (flash for speed)
|
|
25
26
|
defaultImageAnalysisModel: 'gemini-3.1-pro-preview', // analyze_image
|
|
26
|
-
defaultImageDescribeModel: 'gemini-3
|
|
27
|
+
defaultImageDescribeModel: 'gemini-3-flash-preview', // describe_image (lighter task)
|
|
27
28
|
defaultImageGenerationModel: 'gemini-3-pro-image-preview', // generate_image / edit_image
|
|
28
29
|
maxTokens: 65536,
|
|
29
30
|
temperature: 1.0,
|
|
@@ -32,7 +33,7 @@ export const config = {
|
|
|
32
33
|
},
|
|
33
34
|
server: {
|
|
34
35
|
name: 'gemini-mcp',
|
|
35
|
-
version: '2.2.
|
|
36
|
+
version: '2.2.3',
|
|
36
37
|
imageOutputDir: process.env.GEMINI_IMAGE_OUTPUT_DIR
|
|
37
38
|
},
|
|
38
39
|
logging: {
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,CAAC,MAAM,MAAM,GAAW;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QAClC,cAAc,EAAE;YACd;gBACE,QAAQ,EAAE,0BAA0B;gBACpC,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,2BAA2B;gBACrC,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,wBAAwB;aACpC;SACF;QACD,YAAY,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,CAAC,MAAM,MAAM,GAAW;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QAClC,cAAc,EAAE;YACd;gBACE,QAAQ,EAAE,0BAA0B;gBACpC,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,2BAA2B;gBACrC,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,wBAAwB;aACpC;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,wBAAwB;aACpC;SACF;QACD,YAAY,EAAE,wBAAwB,EAAiB,cAAc;QACrE,wBAAwB,EAAE,wBAAwB,EAAG,kCAAkC;QACvF,yBAAyB,EAAE,wBAAwB,EAAE,gBAAgB;QACrE,yBAAyB,EAAE,wBAAwB,EAAE,gCAAgC;QACrF,2BAA2B,EAAE,4BAA4B,EAAE,8BAA8B;QACzF,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,GAAG;QAChB,gBAAgB,EAAE,IAAI;QACtB,uBAAuB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,KAAK,MAAM;KAC1E;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;QAChB,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB;KACpD;IACD,OAAO,EAAE;QACP,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;QACtC,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,+CAA+C;YAC/C,yEAAyE,CAC1E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,aAAa,EAAE,CAAC;IAEhC,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,2BAA2B,EAAE,MAAM,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,aAAa,EAAE,CAAC;IAEhC,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,2BAA2B,EAAE,MAAM,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
|
@@ -3,190 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Gemini Image Viewer</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
color-scheme: light dark;
|
|
10
|
-
/* Light mode defaults */
|
|
11
|
-
--bg: var(--color-background-primary, #ffffff);
|
|
12
|
-
--panel: var(--color-background-secondary, #f3f4f6);
|
|
13
|
-
--text: var(--color-text-primary, #1a1a1a);
|
|
14
|
-
--text-secondary: var(--color-text-secondary, #6b7280);
|
|
15
|
-
--border: var(--color-border-default, #d1d5db);
|
|
16
|
-
--accent: var(--color-accent-primary, #059669);
|
|
17
|
-
}
|
|
18
|
-
@media (prefers-color-scheme: dark) {
|
|
19
|
-
:root {
|
|
20
|
-
--bg: var(--color-background-primary, #111827);
|
|
21
|
-
--panel: var(--color-background-secondary, #1f2937);
|
|
22
|
-
--text: var(--color-text-primary, #f3f4f6);
|
|
23
|
-
--text-secondary: var(--color-text-secondary, #9ca3af);
|
|
24
|
-
--border: var(--color-border-default, #374151);
|
|
25
|
-
--accent: var(--color-accent-primary, #6ee7b7);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
30
|
-
|
|
31
|
-
body {
|
|
32
|
-
font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
|
|
33
|
-
background: var(--bg);
|
|
34
|
-
color: var(--text);
|
|
35
|
-
min-height: 100vh;
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
align-items: center;
|
|
39
|
-
padding: 20px;
|
|
40
|
-
gap: 16px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#loading {
|
|
44
|
-
margin-top: 60px;
|
|
45
|
-
color: var(--text-secondary);
|
|
46
|
-
font-size: 14px;
|
|
47
|
-
text-align: center;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
#content { display: none; width: 100%; max-width: 900px; }
|
|
51
|
-
|
|
52
|
-
.image-wrap {
|
|
53
|
-
width: 100%;
|
|
54
|
-
border-radius: 8px;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
|
|
57
|
-
cursor: grab;
|
|
58
|
-
touch-action: none;
|
|
59
|
-
}
|
|
60
|
-
.image-wrap:active { cursor: grabbing; }
|
|
61
|
-
|
|
62
|
-
#panzoom-container { transform-origin: 0 0; }
|
|
63
|
-
|
|
64
|
-
img { width: 100%; height: auto; display: block; }
|
|
65
|
-
|
|
66
|
-
.zoom-controls {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 6px;
|
|
70
|
-
padding: 8px 12px;
|
|
71
|
-
background: var(--panel);
|
|
72
|
-
border: 1px solid var(--border);
|
|
73
|
-
border-radius: 6px;
|
|
74
|
-
margin-top: 8px;
|
|
75
|
-
}
|
|
76
|
-
.zoom-btn {
|
|
77
|
-
width: 28px;
|
|
78
|
-
height: 28px;
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
justify-content: center;
|
|
82
|
-
background: transparent;
|
|
83
|
-
border: 1px solid var(--border);
|
|
84
|
-
color: var(--text);
|
|
85
|
-
border-radius: 4px;
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
font-size: 14px;
|
|
88
|
-
font-weight: bold;
|
|
89
|
-
transition: all 0.15s ease;
|
|
90
|
-
line-height: 1;
|
|
91
|
-
}
|
|
92
|
-
.zoom-btn:hover {
|
|
93
|
-
background: var(--panel);
|
|
94
|
-
border-color: var(--accent);
|
|
95
|
-
color: var(--accent);
|
|
96
|
-
}
|
|
97
|
-
.zoom-level {
|
|
98
|
-
font-size: 12px;
|
|
99
|
-
color: var(--text-secondary);
|
|
100
|
-
min-width: 40px;
|
|
101
|
-
text-align: center;
|
|
102
|
-
font-family: var(--font-mono, 'Menlo', 'Consolas', monospace);
|
|
103
|
-
}
|
|
104
|
-
.zoom-spacer { flex: 1; }
|
|
105
|
-
.image-dims {
|
|
106
|
-
font-size: 11px;
|
|
107
|
-
color: var(--text-secondary);
|
|
108
|
-
font-family: var(--font-mono, 'Menlo', 'Consolas', monospace);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.meta {
|
|
112
|
-
width: 100%;
|
|
113
|
-
background: transparent;
|
|
114
|
-
border: 1px solid var(--border);
|
|
115
|
-
border-radius: 8px;
|
|
116
|
-
padding: 14px 16px;
|
|
117
|
-
font-size: 13px;
|
|
118
|
-
line-height: 1.6;
|
|
119
|
-
margin-top: 12px;
|
|
120
|
-
color: var(--text);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.path {
|
|
124
|
-
font-family: var(--font-mono, 'Menlo', 'Consolas', monospace);
|
|
125
|
-
font-size: 12px;
|
|
126
|
-
color: var(--accent);
|
|
127
|
-
word-break: break-all;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.meta-row {
|
|
131
|
-
display: flex;
|
|
132
|
-
align-items: flex-start;
|
|
133
|
-
justify-content: space-between;
|
|
134
|
-
gap: 12px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.copy-btn {
|
|
138
|
-
flex-shrink: 0;
|
|
139
|
-
padding: 4px 12px;
|
|
140
|
-
background: transparent;
|
|
141
|
-
border: 1px solid var(--border);
|
|
142
|
-
color: var(--text);
|
|
143
|
-
border-radius: 4px;
|
|
144
|
-
font-size: 12px;
|
|
145
|
-
cursor: pointer;
|
|
146
|
-
white-space: nowrap;
|
|
147
|
-
transition: all 0.2s ease;
|
|
148
|
-
}
|
|
149
|
-
.copy-btn:hover {
|
|
150
|
-
background: var(--panel);
|
|
151
|
-
border-color: var(--accent);
|
|
152
|
-
color: var(--accent);
|
|
153
|
-
}
|
|
154
|
-
.copy-btn.copied {
|
|
155
|
-
color: var(--accent);
|
|
156
|
-
border-color: var(--accent);
|
|
157
|
-
background: transparent;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.desc {
|
|
161
|
-
margin-top: 8px;
|
|
162
|
-
color: var(--text-secondary);
|
|
163
|
-
font-size: 13px;
|
|
164
|
-
line-height: 1.6;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.prompt {
|
|
168
|
-
margin-top: 12px;
|
|
169
|
-
padding-top: 12px;
|
|
170
|
-
border-top: 1px solid var(--border);
|
|
171
|
-
color: var(--text-secondary);
|
|
172
|
-
font-size: 12px;
|
|
173
|
-
line-height: 1.6;
|
|
174
|
-
}
|
|
175
|
-
.prompt-label {
|
|
176
|
-
color: var(--text-secondary);
|
|
177
|
-
font-weight: 600;
|
|
178
|
-
margin-bottom: 4px;
|
|
179
|
-
text-transform: uppercase;
|
|
180
|
-
font-size: 11px;
|
|
181
|
-
letter-spacing: 0.5px;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.no-path {
|
|
185
|
-
color: var(--text-secondary);
|
|
186
|
-
font-style: italic;
|
|
187
|
-
font-size: 12px;
|
|
188
|
-
}
|
|
189
|
-
</style>
|
|
6
|
+
<title>Gemini Image Viewer</title>
|
|
190
7
|
<script type="module" crossorigin>var dp=Object.defineProperty;var mp=(e,t,i)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var ge=(e,t,i)=>mp(e,typeof t!="symbol"?t+"":t,i);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function i(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(n){if(n.ep)return;n.ep=!0;const o=i(n);fetch(n.href,o)}})();function v(e,t,i){function r(s,u){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(e),t(s,u);for(const m in a.prototype)m in s||Object.defineProperty(s,m,{value:a.prototype[m].bind(s)});s._zod.constr=a,s._zod.def=u}const n=(i==null?void 0:i.Parent)??Object;class o extends n{}Object.defineProperty(o,"name",{value:e});function a(s){var u;const l=i!=null&&i.Parent?new o:this;r(l,s),(u=l._zod).deferred??(u.deferred=[]);for(const m of l._zod.deferred)m();return l}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>{var u,l;return i!=null&&i.Parent&&s instanceof i.Parent?!0:(l=(u=s==null?void 0:s._zod)==null?void 0:u.traits)==null?void 0:l.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Zt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Zs={};function Je(e){return Zs}function fp(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function pp(e,t){return typeof t=="bigint"?t.toString():t}function pr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hr(e){return e==null}function vr(e){const t=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(t,i)}function hp(e,t){const i=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=i>r?i:r,o=Number.parseInt(e.toFixed(n).replace(".","")),a=Number.parseInt(t.toFixed(n).replace(".",""));return o%a/10**n}function Q(e,t,i){Object.defineProperty(e,t,{get(){{const r=i();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Vn(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}function It(e){return JSON.stringify(e)}const Us=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Pn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vp=pr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Nn(e){if(Pn(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(Pn(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}const gp=new Set(["string","number","symbol"]);function Rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(e,t,i){const r=new e._zod.constr(t??e._zod.def);return(!t||i!=null&&i.parent)&&(r._zod.parent=e),r}function S(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $p(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const _p={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bp(e,t){const i={},r=e._zod.def;for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(i[n]=r.shape[n])}return ot(e,{...e._zod.def,shape:i,checks:[]})}function yp(e,t){const i={...e._zod.def.shape},r=e._zod.def;for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&delete i[n]}return ot(e,{...e._zod.def,shape:i,checks:[]})}function kp(e,t){if(!Nn(t))throw new Error("Invalid input to extend: expected a plain object");const i={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Vn(this,"shape",r),r},checks:[]};return ot(e,i)}function wp(e,t){return ot(e,{...e._zod.def,get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return Vn(this,"shape",i),i},catchall:t._zod.def.catchall,checks:[]})}function Ip(e,t,i){const r=t._zod.def.shape,n={...r};if(i)for(const o in i){if(!(o in r))throw new Error(`Unrecognized key: "${o}"`);i[o]&&(n[o]=e?new e({type:"optional",innerType:r[o]}):r[o])}else for(const o in r)n[o]=e?new e({type:"optional",innerType:r[o]}):r[o];return ot(t,{...t._zod.def,shape:n,checks:[]})}function Sp(e,t,i){const r=t._zod.def.shape,n={...r};if(i)for(const o in i){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);i[o]&&(n[o]=new e({type:"nonoptional",innerType:r[o]}))}else for(const o in r)n[o]=new e({type:"nonoptional",innerType:r[o]});return ot(t,{...t._zod.def,shape:n,checks:[]})}function zt(e,t=0){var i;for(let r=t;r<e.issues.length;r++)if(((i=e.issues[r])==null?void 0:i.continue)!==!0)return!0;return!1}function Qe(e,t){return t.map(i=>{var r;return(r=i).path??(r.path=[]),i.path.unshift(e),i})}function _n(e){return typeof e=="string"?e:e==null?void 0:e.message}function qe(e,t,i){var n,o,a,s,u,l;const r={...e,path:e.path??[]};if(!e.message){const m=_n((a=(o=(n=e.inst)==null?void 0:n._zod.def)==null?void 0:o.error)==null?void 0:a.call(o,e))??_n((s=t==null?void 0:t.error)==null?void 0:s.call(t,e))??_n((u=i.customError)==null?void 0:u.call(i,e))??_n((l=i.localeError)==null?void 0:l.call(i,e))??"Invalid input";r.message=m}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function gr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ut(...e){const[t,i,r]=e;return typeof t=="string"?{message:t,code:"custom",input:i,inst:r}:{...t}}const Os=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,pp,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ps=v("$ZodError",Os),Ns=v("$ZodError",Os,{Parent:Error});function xp(e,t=i=>i.message){const i={},r=[];for(const n of e.issues)n.path.length>0?(i[n.path[0]]=i[n.path[0]]||[],i[n.path[0]].push(t(n))):r.push(t(n));return{formErrors:r,fieldErrors:i}}function zp(e,t){const i=t||function(o){return o.message},r={_errors:[]},n=o=>{for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>n({issues:s}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)r._errors.push(i(a));else{let s=r,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(i(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return n(e),r}const Zp=e=>(t,i,r,n)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Zt;if(a.issues.length){const s=new((n==null?void 0:n.Err)??e)(a.issues.map(u=>qe(u,o,Je())));throw Us(s,n==null?void 0:n.callee),s}return a.value},Up=e=>async(t,i,r,n)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:i,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const s=new((n==null?void 0:n.Err)??e)(a.issues.map(u=>qe(u,o,Je())));throw Us(s,n==null?void 0:n.callee),s}return a.value},Ts=e=>(t,i,r)=>{const n=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:i,issues:[]},n);if(o instanceof Promise)throw new Zt;return o.issues.length?{success:!1,error:new(e??Ps)(o.issues.map(a=>qe(a,n,Je())))}:{success:!0,data:o.value}},Es=Ts(Ns),js=e=>async(t,i,r)=>{const n=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:i,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>qe(a,n,Je())))}:{success:!0,data:o.value}},Op=js(Ns),Pp=/^[cC][^\s-]{8,}$/,Np=/^[0-9a-z]+$/,Tp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ep=/^[0-9a-vA-V]{20}$/,jp=/^[A-Za-z0-9]{27}$/,Dp=/^[a-zA-Z0-9_-]{21}$/,Rp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ap=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,La=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Cp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mp(){return new RegExp(Lp,"u")}const Fp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,qp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ds=/^[A-Za-z0-9_-]*$/,Bp=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Gp=/^\+(?:[0-9]){6,14}[0-9]$/,Rs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Hp=new RegExp(`^${Rs}$`);function As(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kp(e){return new RegExp(`^${As(e)}$`)}function Xp(e){const t=As({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${i.join("|")})`;return new RegExp(`^${Rs}T(?:${r})$`)}const Yp=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Qp=/^\d+$/,eh=/^-?\d+(?:\.\d+)?/i,th=/true|false/i,nh=/null/i,ih=/^[^A-Z]*$/,rh=/^[^a-z]*$/,we=v("$ZodCheck",(e,t)=>{var i;e._zod??(e._zod={}),e._zod.def=t,(i=e._zod).onattach??(i.onattach=[])}),Cs={number:"number",bigint:"bigint",object:"date"},Ls=v("$ZodCheckLessThan",(e,t)=>{we.init(e,t);const i=Cs[typeof t.value];e._zod.onattach.push(r=>{const n=r._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:i,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ms=v("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);const i=Cs[typeof t.value];e._zod.onattach.push(r=>{const n=r._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:i,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),oh=v("$ZodCheckMultipleOf",(e,t)=>{we.init(e,t),e._zod.onattach.push(i=>{var r;(r=i._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=i=>{if(typeof i.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%t.value===BigInt(0):hp(i.value,t.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:t.value,input:i.value,inst:e,continue:!t.abort})}}),ah=v("$ZodCheckNumberFormat",(e,t)=>{var a;we.init(e,t),t.format=t.format||"float64";const i=(a=t.format)==null?void 0:a.includes("int"),r=i?"int":"number",[n,o]=_p[t.format];e._zod.onattach.push(s=>{const u=s._zod.bag;u.format=t.format,u.minimum=n,u.maximum=o,i&&(u.pattern=Qp)}),e._zod.check=s=>{const u=s.value;if(i){if(!Number.isInteger(u)){s.issues.push({expected:r,format:t.format,code:"invalid_type",input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?s.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):s.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}u<n&&s.issues.push({origin:"number",input:u,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),u>o&&s.issues.push({origin:"number",input:u,code:"too_big",maximum:o,inst:e})}}),sh=v("$ZodCheckMaxLength",(e,t)=>{var i;we.init(e,t),(i=e._zod.def).when??(i.when=r=>{const n=r.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{const n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=gr(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),uh=v("$ZodCheckMinLength",(e,t)=>{var i;we.init(e,t),(i=e._zod.def).when??(i.when=r=>{const n=r.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{const n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=gr(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),lh=v("$ZodCheckLengthEquals",(e,t)=>{var i;we.init(e,t),(i=e._zod.def).when??(i.when=r=>{const n=r.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{const n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=r=>{const n=r.value,o=n.length;if(o===t.length)return;const a=gr(n),s=o>t.length;r.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Wn=v("$ZodCheckStringFormat",(e,t)=>{var i,r;we.init(e,t),e._zod.onattach.push(n=>{const o=n._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(i=e._zod).check??(i.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ch=v("$ZodCheckRegex",(e,t)=>{Wn.init(e,t),e._zod.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dh=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ih),Wn.init(e,t)}),mh=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rh),Wn.init(e,t)}),fh=v("$ZodCheckIncludes",(e,t)=>{we.init(e,t);const i=Rt(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${i}`:i);t.pattern=r,e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ph=v("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);const i=new RegExp(`^${Rt(t.prefix)}.*`);t.pattern??(t.pattern=i),e._zod.onattach.push(r=>{const n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(i)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),hh=v("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);const i=new RegExp(`.*${Rt(t.suffix)}$`);t.pattern??(t.pattern=i),e._zod.onattach.push(r=>{const n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(i)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),vh=v("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=i=>{i.value=t.tx(i.value)}});class gh{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
191
8
|
`).filter(a=>a),n=Math.min(...r.map(a=>a.length-a.trimStart().length)),o=r.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const t=Function,i=this==null?void 0:this.args,n=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...i,n.join(`
|
|
192
9
|
`))}}const $h={major:4,minor:0,patch:0},ee=v("$ZodType",(e,t)=>{var n;var i;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$h;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const a of o._zod.onattach)a(e);if(r.length===0)(i=e._zod).deferred??(i.deferred=[]),(n=e._zod.deferred)==null||n.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,s,u)=>{let l=zt(a),m;for(const c of s){if(c._zod.def.when){if(!c._zod.def.when(a))continue}else if(l)continue;const f=a.issues.length,g=c._zod.check(a);if(g instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Zt;if(m||g instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await g,a.issues.length!==f&&(l||(l=zt(a,f)))});else{if(a.issues.length===f)continue;l||(l=zt(a,f))}}return m?m.then(()=>a):a};e._zod.run=(a,s)=>{const u=e._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new Zt;return u.then(l=>o(l,r,s))}return o(u,r,s)}}e["~standard"]={validate:o=>{var a;try{const s=Es(e,o);return s.success?{value:s.data}:{issues:(a=s.error)==null?void 0:a.issues}}catch{return Op(e,o).then(u=>{var l;return u.success?{value:u.data}:{issues:(l=u.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}}),$r=v("$ZodString",(e,t)=>{var i;ee.init(e,t),e._zod.pattern=[...((i=e==null?void 0:e._zod.bag)==null?void 0:i.patterns)??[]].pop()??Yp(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ie=v("$ZodStringFormat",(e,t)=>{Wn.init(e,t),$r.init(e,t)}),_h=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ap),ie.init(e,t)}),bh=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=La(r))}else t.pattern??(t.pattern=La());ie.init(e,t)}),yh=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Cp),ie.init(e,t)}),kh=v("$ZodURL",(e,t)=>{ie.init(e,t),e._zod.check=i=>{try{const r=i.value,n=new URL(r),o=n.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Bp.source,input:i.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:i.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&o.endsWith("/")?i.value=o.slice(0,-1):i.value=o;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!t.abort})}}}),wh=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mp()),ie.init(e,t)}),Ih=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Dp),ie.init(e,t)}),Sh=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pp),ie.init(e,t)}),xh=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Np),ie.init(e,t)}),zh=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Tp),ie.init(e,t)}),Zh=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ep),ie.init(e,t)}),Uh=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=jp),ie.init(e,t)}),Oh=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Xp(t)),ie.init(e,t)}),Ph=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hp),ie.init(e,t)}),Nh=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Kp(t)),ie.init(e,t)}),Th=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Rp),ie.init(e,t)}),Eh=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fp),ie.init(e,t),e._zod.onattach.push(i=>{const r=i._zod.bag;r.format="ipv4"})}),jh=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jp),ie.init(e,t),e._zod.onattach.push(i=>{const r=i._zod.bag;r.format="ipv6"}),e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!t.abort})}}}),Dh=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qp),ie.init(e,t)}),Rh=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vp),ie.init(e,t),e._zod.check=i=>{const[r,n]=i.value.split("/");try{if(!n)throw new Error;const o=Number(n);if(`${o}`!==n)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${r}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!t.abort})}}});function Fs(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ah=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Wp),ie.init(e,t),e._zod.onattach.push(i=>{i._zod.bag.contentEncoding="base64"}),e._zod.check=i=>{Fs(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!t.abort})}});function Ch(e){if(!Ds.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),i=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fs(i)}const Lh=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ds),ie.init(e,t),e._zod.onattach.push(i=>{i._zod.bag.contentEncoding="base64url"}),e._zod.check=i=>{Ch(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!t.abort})}}),Mh=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Gp),ie.init(e,t)});function Fh(e,t=null){try{const i=e.split(".");if(i.length!==3)return!1;const[r]=i;if(!r)return!1;const n=JSON.parse(atob(r));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}const Jh=v("$ZodJWT",(e,t)=>{ie.init(e,t),e._zod.check=i=>{Fh(i.value,t.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!t.abort})}}),Js=v("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=e._zod.bag.pattern??eh,e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=Number(i.value)}catch{}const n=i.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return i;const o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),i}}),qh=v("$ZodNumber",(e,t)=>{ah.init(e,t),Js.init(e,t)}),Vh=v("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=th,e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=!!i.value}catch{}const n=i.value;return typeof n=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),i}}),Wh=v("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=nh,e._zod.values=new Set([null]),e._zod.parse=(i,r)=>{const n=i.value;return n===null||i.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),i}}),Bh=v("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=i=>i}),Gh=v("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(i,r)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function Ma(e,t,i){e.issues.length&&t.issues.push(...Qe(i,e.issues)),t.value[i]=e.value}const Hh=v("$ZodArray",(e,t)=>{ee.init(e,t),e._zod.parse=(i,r)=>{const n=i.value;if(!Array.isArray(n))return i.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),i;i.value=Array(n.length);const o=[];for(let a=0;a<n.length;a++){const s=n[a],u=t.element._zod.run({value:s,issues:[]},r);u instanceof Promise?o.push(u.then(l=>Ma(l,i,a))):Ma(u,i,a)}return o.length?Promise.all(o).then(()=>i):i}});function bn(e,t,i){e.issues.length&&t.issues.push(...Qe(i,e.issues)),t.value[i]=e.value}function Fa(e,t,i,r){e.issues.length?r[i]===void 0?i in r?t.value[i]=void 0:t.value[i]=e.value:t.issues.push(...Qe(i,e.issues)):e.value===void 0?i in r&&(t.value[i]=void 0):t.value[i]=e.value}const Kh=v("$ZodObject",(e,t)=>{ee.init(e,t);const i=pr(()=>{const c=Object.keys(t.shape);for(const g of c)if(!(t.shape[g]instanceof ee))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const f=$p(t.shape);return{shape:t.shape,keys:c,keySet:new Set(c),numKeys:c.length,optionalKeys:new Set(f)}});Q(e._zod,"propValues",()=>{const c=t.shape,f={};for(const g in c){const b=c[g]._zod;if(b.values){f[g]??(f[g]=new Set);for(const k of b.values)f[g].add(k)}}return f});const r=c=>{const f=new gh(["shape","payload","ctx"]),g=i.value,b=M=>{const A=It(M);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");const k=Object.create(null);let L=0;for(const M of g.keys)k[M]=`key_${L++}`;f.write("const newResult = {}");for(const M of g.keys)if(g.optionalKeys.has(M)){const A=k[M];f.write(`const ${A} = ${b(M)};`);const C=It(M);f.write(`
|
|
@@ -290,6 +107,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
290
107
|
- "model": Tool visible to and callable by the agent
|
|
291
108
|
- "app": Tool callable by the app from this server only`)});d.object({mimeTypes:d.array(d.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});d.object({method:d.literal("ui/message"),params:d.object({role:d.literal("user").describe('Message role, currently only "user" is supported.'),content:d.array(Wt).describe("Message content blocks (text, image, etc.).")})});d.object({method:d.literal("ui/notifications/sandbox-resource-ready"),params:d.object({html:d.string().describe("HTML content to load into the inner iframe."),sandbox:d.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Da.optional().describe("CSP configuration from resource metadata."),permissions:Ra.optional().describe("Sandbox permissions from resource metadata.")})});var Yw=d.object({method:d.literal("ui/notifications/tool-result"),params:Xn.describe("Standard MCP tool execution result.")}),op=d.object({toolInfo:d.object({id:Lt.optional().describe("JSON-RPC id of the tools/call request."),tool:Cr.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Rw.optional().describe("Current color theme preference."),styles:Ww.optional().describe("Style configuration for theming the app."),displayMode:jt.optional().describe("How the UI is currently displayed."),availableDisplayModes:d.array(jt).optional().describe("Display modes the host supports."),containerDimensions:d.union([d.object({height:d.number().describe("Fixed container height in pixels.")}),d.object({maxHeight:d.union([d.number(),d.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(d.union([d.object({width:d.number().describe("Fixed container width in pixels.")}),d.object({maxWidth:d.union([d.number(),d.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
292
109
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:d.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:d.string().optional().describe("User's timezone in IANA format."),userAgent:d.string().optional().describe("Host application identifier."),platform:d.union([d.literal("web"),d.literal("desktop"),d.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d.object({touch:d.boolean().optional().describe("Whether the device supports touch input."),hover:d.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:d.object({top:d.number().describe("Top safe area inset in pixels."),right:d.number().describe("Right safe area inset in pixels."),bottom:d.number().describe("Bottom safe area inset in pixels."),left:d.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Qw=d.object({method:d.literal("ui/notifications/host-context-changed"),params:op.describe("Partial context update containing only changed fields.")});d.object({method:d.literal("ui/update-model-context"),params:d.object({content:d.array(Wt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:d.record(d.string(),d.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});d.object({method:d.literal("ui/initialize"),params:d.object({appInfo:Hn.describe("App identification (name and version)."),appCapabilities:Hw.describe("Features and capabilities this app provides."),protocolVersion:d.string().describe("Protocol version this app supports.")})});var eI=d.object({protocolVersion:d.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Hn.describe("Host application identification and version."),hostCapabilities:Gw.describe("Features and capabilities provided by the host."),hostContext:op.describe("Rich context about the host environment.")}).passthrough();class tI extends nb{constructor(i,r={},n={autoResize:!0}){super(n);ge(this,"_appInfo");ge(this,"_capabilities");ge(this,"options");ge(this,"_hostCapabilities");ge(this,"_hostInfo");ge(this,"_hostContext");ge(this,"sendOpenLink",this.openLink);this._appInfo=i,this._capabilities=r,this.options=n,this.setRequestHandler(Kn,o=>(console.log("Received ping:",o.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(i){this.setNotificationHandler(Fw,r=>i(r.params))}set ontoolinputpartial(i){this.setNotificationHandler(Jw,r=>i(r.params))}set ontoolresult(i){this.setNotificationHandler(Yw,r=>i(r.params))}set ontoolcancelled(i){this.setNotificationHandler(qw,r=>i(r.params))}set onhostcontextchanged(i){this.setNotificationHandler(Qw,r=>{this._hostContext={...this._hostContext,...r.params},i(r.params)})}set onteardown(i){this.setRequestHandler(Bw,(r,n)=>i(r.params,n))}set oncalltool(i){this.setRequestHandler(hu,(r,n)=>i(r.params,n))}set onlisttools(i){this.setRequestHandler(pu,(r,n)=>i(r.params,n))}assertCapabilityForMethod(i){}assertRequestHandlerCapability(i){switch(i){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${i})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${i} registered`)}}assertNotificationCapability(i){}assertTaskCapability(i){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(i){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(i,r){if(typeof i=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${i}"). Did you mean: callServerTool({ name: "${i}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:i},Xn,r)}sendMessage(i,r){return this.request({method:"ui/message",params:i},Mw,r)}sendLog(i){return this.notification({method:"notifications/message",params:i})}updateModelContext(i,r){return this.request({method:"ui/update-model-context",params:i},Ir,r)}openLink(i,r){return this.request({method:"ui/open-link",params:i},Lw,r)}requestDisplayMode(i,r){return this.request({method:"ui/request-display-mode",params:i},Kw,r)}sendSizeChanged(i){return this.notification({method:"ui/notifications/size-changed",params:i})}setupSizeChangedNotifications(){let i=!1,r=0,n=0,o=()=>{i||(i=!0,requestAnimationFrame(()=>{i=!1;let s=document.documentElement,u=s.style.width,l=s.style.height;s.style.width="fit-content",s.style.height="fit-content";let m=s.getBoundingClientRect();s.style.width=u,s.style.height=l;let c=window.innerWidth-s.clientWidth,f=Math.ceil(m.width+c),g=Math.ceil(m.height);(f!==r||g!==n)&&(r=f,n=g,this.sendSizeChanged({width:f,height:g}))}))};o();let a=new ResizeObserver(o);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(i=new rb(window.parent,window.parent),r){var n;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(i);try{let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:ob}},eI,r);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),(n=this.options)!=null&&n.autoResize&&this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}var ce=function(){return ce=Object.assign||function(t){for(var i,r=1,n=arguments.length;r<n;r++){i=arguments[r];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},ce.apply(this,arguments)};typeof window<"u"&&(window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window.CustomEvent!="function"&&(window.CustomEvent=function(t,i){i=i||{bubbles:!1,cancelable:!1,detail:null};var r=document.createEvent("CustomEvent");return r.initCustomEvent(t,i.bubbles,i.cancelable,i.detail),r}));var nI=typeof document<"u"&&!!document.documentMode,Qi;function iI(){return Qi||(Qi=document.createElement("div").style)}var Ss=["webkit","moz","ms"],Zn={};function Aa(e){if(Zn[e])return Zn[e];var t=iI();if(e in t)return Zn[e]=e;for(var i=e[0].toUpperCase()+e.slice(1),r=Ss.length;r--;){var n="".concat(Ss[r]).concat(i);if(n in t)return Zn[e]=n}}function Un(e,t){return parseFloat(t[Aa(e)])||0}function On(e,t,i){i===void 0&&(i=window.getComputedStyle(e));var r=t==="border"?"Width":"";return{left:Un("".concat(t,"Left").concat(r),i),right:Un("".concat(t,"Right").concat(r),i),top:Un("".concat(t,"Top").concat(r),i),bottom:Un("".concat(t,"Bottom").concat(r),i)}}function ct(e,t,i){e.style[Aa(t)]=i}function rI(e,t){var i=Aa("transform");ct(e,"transition","".concat(i," ").concat(t.duration,"ms ").concat(t.easing))}function oI(e,t,i){var r=t.x,n=t.y,o=t.scale,a=t.isSVG;if(ct(e,"transform","scale(".concat(o,") translate(").concat(r,"px, ").concat(n,"px)")),a&&nI){var s=window.getComputedStyle(e).getPropertyValue("transform");e.setAttribute("transform",s)}}function er(e){var t=e.parentNode,i=window.getComputedStyle(e),r=window.getComputedStyle(t),n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{elem:{style:i,width:n.width,height:n.height,top:n.top,bottom:n.bottom,left:n.left,right:n.right,margin:On(e,"margin",i),border:On(e,"border",i)},parent:{style:r,width:o.width,height:o.height,top:o.top,bottom:o.bottom,left:o.left,right:o.right,padding:On(t,"padding",r),border:On(t,"border",r)}}}var Dt={down:"mousedown",move:"mousemove",up:"mouseup mouseleave"};typeof window<"u"&&(typeof window.PointerEvent=="function"?Dt={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:typeof window.TouchEvent=="function"&&(Dt={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));function tr(e,t,i,r){Dt[e].split(" ").forEach(function(n){t.addEventListener(n,i,r)})}function nr(e,t,i){Dt[e].split(" ").forEach(function(r){t.removeEventListener(r,i)})}function ap(e,t){for(var i=e.length;i--;)if(e[i].pointerId===t.pointerId)return i;return-1}function fr(e,t){var i;if(t.touches){i=0;for(var r=0,n=t.touches;r<n.length;r++){var o=n[r];o.pointerId=i++,fr(e,o)}return}i=ap(e,t),i>-1&&e.splice(i,1),e.push(t)}function aI(e,t){if(t.touches){for(;e.length;)e.pop();return}var i=ap(e,t);i>-1&&e.splice(i,1)}function xs(e){e=e.slice(0);for(var t=e.pop(),i;i=e.pop();)t={clientX:(i.clientX-t.clientX)/2+t.clientX,clientY:(i.clientY-t.clientY)/2+t.clientY};return t}function ir(e){if(e.length<2)return 0;var t=e[0],i=e[1];return Math.sqrt(Math.pow(Math.abs(i.clientX-t.clientX),2)+Math.pow(Math.abs(i.clientY-t.clientY),2))}function sI(e){for(var t=e;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1}function uI(e){return(e.getAttribute("class")||"").trim()}function lI(e,t){return e.nodeType===1&&" ".concat(uI(e)," ").indexOf(" ".concat(t," "))>-1}function cI(e,t){for(var i=e;i!=null;i=i.parentNode)if(lI(i,t.excludeClass)||t.exclude.indexOf(i)>-1)return!0;return!1}var dI=/^http:[\w\.\/]+svg$/;function mI(e){return dI.test(e.namespaceURI)&&e.nodeName.toLowerCase()!=="svg"}function fI(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}var sp={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(e){e.preventDefault(),e.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:oI,startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function up(e,t){if(!e)throw new Error("Panzoom requires an element as an argument");if(e.nodeType!==1)throw new Error("Panzoom requires an element with a nodeType of 1");if(!sI(e))throw new Error("Panzoom should be called on elements that have been attached to the DOM");t=ce(ce({},sp),t);var i=mI(e),r=e.parentNode;r.style.overflow=t.overflow,r.style.userSelect="none",r.style.touchAction=t.touchAction,(t.canvas?r:e).style.cursor=t.cursor,e.style.userSelect="none",e.style.touchAction=t.touchAction,ct(e,"transformOrigin",typeof t.origin=="string"?t.origin:i?"0 0":"50% 50%");function n(){r.style.overflow="",r.style.userSelect="",r.style.touchAction="",r.style.cursor="",e.style.cursor="",e.style.userSelect="",e.style.touchAction="",ct(e,"transformOrigin","")}function o(w){w===void 0&&(w={});for(var z in w)w.hasOwnProperty(z)&&(t[z]=w[z]);(w.hasOwnProperty("cursor")||w.hasOwnProperty("canvas"))&&(r.style.cursor=e.style.cursor="",(t.canvas?r:e).style.cursor=t.cursor),w.hasOwnProperty("overflow")&&(r.style.overflow=w.overflow),w.hasOwnProperty("touchAction")&&(r.style.touchAction=w.touchAction,e.style.touchAction=w.touchAction)}var a=0,s=0,u=1,l=!1;k(t.startScale,{animate:!1,force:!0}),setTimeout(function(){b(t.startX,t.startY,{animate:!1,force:!0})});function m(w,z,D){if(!D.silent){var q=new CustomEvent(w,{detail:z});e.dispatchEvent(q)}}function c(w,z,D){var q={x:a,y:s,scale:u,isSVG:i,originalEvent:D};return requestAnimationFrame(function(){typeof z.animate=="boolean"&&(z.animate?rI(e,z):ct(e,"transition","none")),z.setTransform(e,q,z),m(w,q,z),m("panzoomchange",q,z)}),q}function f(w,z,D,q){var Z=ce(ce({},t),q),V={x:a,y:s,opts:Z};if(!(q!=null&&q.force)&&(Z.disablePan||Z.panOnlyWhenZoomed&&u===Z.startScale))return V;if(w=parseFloat(w),z=parseFloat(z),Z.disableXAxis||(V.x=(Z.relative?a:0)+w),Z.disableYAxis||(V.y=(Z.relative?s:0)+z),Z.contain){var T=er(e),Ie=T.elem.width/u,Re=T.elem.height/u,kt=Ie*D,wt=Re*D,He=(kt-Ie)/2,Ke=(wt-Re)/2;if(Z.contain==="inside"){var Bi=(-T.elem.margin.left-T.parent.padding.left+He)/D,Gi=(T.parent.width-kt-T.parent.padding.left-T.elem.margin.left-T.parent.border.left-T.parent.border.right+He)/D;V.x=Math.max(Math.min(V.x,Gi),Bi);var Hi=(-T.elem.margin.top-T.parent.padding.top+Ke)/D,Ki=(T.parent.height-wt-T.parent.padding.top-T.elem.margin.top-T.parent.border.top-T.parent.border.bottom+Ke)/D;V.y=Math.max(Math.min(V.y,Ki),Hi)}else if(Z.contain==="outside"){var Bi=(-(kt-T.parent.width)-T.parent.padding.left-T.parent.border.left-T.parent.border.right+He)/D,Gi=(He-T.parent.padding.left)/D;V.x=Math.max(Math.min(V.x,Gi),Bi);var Hi=(-(wt-T.parent.height)-T.parent.padding.top-T.parent.border.top-T.parent.border.bottom+Ke)/D,Ki=(Ke-T.parent.padding.top)/D;V.y=Math.max(Math.min(V.y,Ki),Hi)}}return Z.roundPixels&&(V.x=Math.round(V.x),V.y=Math.round(V.y)),V}function g(w,z){var D=ce(ce({},t),z),q={scale:u,opts:D};if(!(z!=null&&z.force)&&D.disableZoom)return q;var Z=t.minScale,V=t.maxScale;if(D.contain){var T=er(e),Ie=T.elem.width/u,Re=T.elem.height/u;if(Ie>1&&Re>1){var kt=T.parent.width-T.parent.border.left-T.parent.border.right,wt=T.parent.height-T.parent.border.top-T.parent.border.bottom,He=kt/Ie,Ke=wt/Re;t.contain==="inside"?V=Math.min(V,He,Ke):t.contain==="outside"&&(Z=Math.max(Z,He,Ke))}}return q.scale=Math.min(Math.max(w,Z),V),q}function b(w,z,D,q){var Z=f(w,z,u,D);return a!==Z.x||s!==Z.y?(a=Z.x,s=Z.y,c("panzoompan",Z.opts,q)):{x:a,y:s,scale:u,isSVG:i,originalEvent:q}}function k(w,z,D){var q=g(w,z),Z=q.opts;if(!(!(z!=null&&z.force)&&Z.disableZoom)){w=q.scale;var V=a,T=s;if(Z.focal){var Ie=Z.focal;V=(Ie.x/w-Ie.x/u+a*w)/w,T=(Ie.y/w-Ie.y/u+s*w)/w}var Re=f(V,T,w,{relative:!1,force:!0});return a=Re.x,s=Re.y,u=w,c("panzoomzoom",Z,D)}}function L(w,z){var D=ce(ce(ce({},t),{animate:!0}),z);return k(u*Math.exp((w?1:-1)*D.step),D)}function E(w){return L(!0,w)}function M(w){return L(!1,w)}function A(w,z,D,q){var Z=er(e),V={width:Z.parent.width-Z.parent.padding.left-Z.parent.padding.right-Z.parent.border.left-Z.parent.border.right,height:Z.parent.height-Z.parent.padding.top-Z.parent.padding.bottom-Z.parent.border.top-Z.parent.border.bottom},T=z.clientX-Z.parent.left-Z.parent.padding.left-Z.parent.border.left-Z.elem.margin.left,Ie=z.clientY-Z.parent.top-Z.parent.padding.top-Z.parent.border.top-Z.elem.margin.top;i||(T-=Z.elem.width/u/2,Ie-=Z.elem.height/u/2);var Re={x:T/V.width*(V.width*w),y:Ie/V.height*(V.height*w)};return k(w,ce(ce({},D),{animate:!1,focal:Re}),q)}function C(w,z){w.preventDefault();var D=ce(ce(ce({},t),z),{animate:!1}),q=w.deltaY===0&&w.deltaX?w.deltaX:w.deltaY,Z=q<0?1:-1,V=g(u*Math.exp(Z*D.step/3),D).scale;return A(V,w,D,w)}function Y(w){var z=ce(ce(ce({},t),{animate:!0,force:!0}),w);u=g(z.startScale,z).scale;var D=f(z.startX,z.startY,u,z);return a=D.x,s=D.y,c("panzoomreset",z)}var ne,W,he,ve,gn,$n,De=[];function Ji(w){if(!cI(w.target,t)){fr(De,w),l=!0,t.handleStartEvent(w),ne=a,W=s,m("panzoomstart",{x:a,y:s,scale:u,isSVG:i,originalEvent:w},t);var z=xs(De);he=z.clientX,ve=z.clientY,gn=u,$n=ir(De)}}function qi(w){if(!(!l||ne===void 0||W===void 0||he===void 0||ve===void 0)){fr(De,w);var z=xs(De),D=De.length>1,q=u;if(D){$n===0&&($n=ir(De));var Z=ir(De)-$n;q=g(Z*t.step/80+gn).scale,A(q,z,{animate:!1},w)}(!D||t.pinchAndPan)&&b(ne+(z.clientX-he)/q,W+(z.clientY-ve)/q,{animate:!1},w)}}function Vi(w){De.length===1&&m("panzoomend",{x:a,y:s,scale:u,isSVG:i,originalEvent:w},t),aI(De,w),l&&(l=!1,ne=W=he=ve=void 0)}var Wi=!1;function Ca(){Wi||(Wi=!0,tr("down",t.canvas?r:e,Ji),tr("move",document,qi,{passive:!0}),tr("up",document,Vi,{passive:!0}))}function cp(){Wi=!1,nr("down",t.canvas?r:e,Ji),nr("move",document,qi),nr("up",document,Vi)}return t.noBind||Ca(),{bind:Ca,destroy:cp,eventNames:Dt,getPan:function(){return{x:a,y:s}},getScale:function(){return u},getOptions:function(){return fI(t)},handleDown:Ji,handleMove:qi,handleUp:Vi,pan:b,reset:Y,resetStyle:n,setOptions:o,setStyle:function(w,z){return ct(e,w,z)},zoom:k,zoomIn:E,zoomOut:M,zoomToPoint:A,zoomWithWheel:C}}up.defaultOptions=sp;async function pI(e,t,i){try{await navigator.clipboard.writeText(e),zs(t,i)}catch{const r=document.createElement("textarea");r.value=e,r.style.cssText="position:absolute;left:-9999px",document.body.appendChild(r),r.select();try{document.execCommand("copy"),zs(t,i)}catch{t.textContent="Copy failed",setTimeout(()=>{t.textContent=i},2e3)}document.body.removeChild(r)}}function zs(e,t){e.textContent="Copied!",e.classList.add("copied"),setTimeout(()=>{e.textContent=t,e.classList.remove("copied")},2e3)}function hI(e,t,i){e?(t.textContent=e,i.style.display="block",i.addEventListener("click",()=>pI(e,i,"Copy path"))):t.innerHTML='<span class="no-path">Not saved to disk</span>'}function vI(e,t,i){e&&(i.textContent=e,t.style.display="block")}function gI(e,t){e&&(t.textContent=e,t.style.display="block")}function $I(e,t,i="block"){e.style.display="none",t.style.display=i}const lp=new tI({name:"Gemini Image Viewer",version:"1.0.0"});lp.ontoolresult=e=>{const t=e.structuredContent;!t||!t.imageUrl&&!t.base64Data||_I(t)};lp.connect();function _I(e){const t=document.getElementById("loading"),i=document.getElementById("content"),r=document.getElementById("panzoom-container"),n=document.getElementById("img"),o=document.getElementById("path-display"),a=document.getElementById("copy-btn"),s=document.getElementById("desc"),u=document.getElementById("prompt"),l=document.getElementById("prompt-text"),m=document.getElementById("zoom-in"),c=document.getElementById("zoom-out"),f=document.getElementById("zoom-reset"),g=document.getElementById("zoom-level"),b=document.getElementById("image-dims");e.imageUrl?n.src=e.imageUrl:e.base64Data&&e.mimeType&&(n.src=`data:${e.mimeType};base64,${e.base64Data}`),n.addEventListener("load",()=>{b.textContent=`${n.naturalWidth} × ${n.naturalHeight}`});const k=up(r,{maxScale:10,minScale:.1,contain:"outside",canvas:!0});r.parentElement.addEventListener("wheel",M=>{k.zoomWithWheel(M),E()});function E(){const M=k.getScale();g.textContent=`${Math.round(M*100)}%`}m.addEventListener("click",()=>{k.zoomIn(),E()}),c.addEventListener("click",()=>{k.zoomOut(),E()}),f.addEventListener("click",()=>{k.reset(),setTimeout(E,300)}),r.addEventListener("panzoomchange",()=>E()),hI(e.savedPath,o,a),gI(e.description,s),vI(e.prompt,u,l),$I(t,i)}</script>
|
|
110
|
+
<style rel="stylesheet" crossorigin>:root{color-scheme:light dark;--bg: var(--color-background-primary, #ffffff);--panel: var(--color-background-secondary, #f3f4f6);--text: var(--color-text-primary, #1a1a1a);--text-secondary: var(--color-text-secondary, #6b7280);--border: var(--color-border-default, #d1d5db);--accent: var(--color-accent-primary, #059669)}@media(prefers-color-scheme:dark){:root{--bg: var(--color-background-primary, #111827);--panel: var(--color-background-secondary, #1f2937);--text: var(--color-text-primary, #f3f4f6);--text-secondary: var(--color-text-secondary, #9ca3af);--border: var(--color-border-default, #374151);--accent: var(--color-accent-primary, #6ee7b7)}}*{box-sizing:border-box;margin:0;padding:0}body{font-family:var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);background:var(--bg);color:var(--text);min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:20px;gap:16px}#loading{margin-top:60px;color:var(--text-secondary);font-size:14px;text-align:center}#content{display:none;width:100%;max-width:900px}.image-wrap{width:100%;border-radius:8px;overflow:hidden;box-shadow:0 4px 16px #0000001a;cursor:grab;touch-action:none}.image-wrap:active{cursor:grabbing}#panzoom-container{transform-origin:0 0}img{width:100%;height:auto;display:block}.zoom-controls{display:flex;align-items:center;gap:6px;padding:8px 12px;background:var(--panel);border:1px solid var(--border);border-radius:6px;margin-top:8px}.zoom-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:transparent;border:1px solid var(--border);color:var(--text);border-radius:4px;cursor:pointer;font-size:14px;font-weight:700;transition:all .15s ease;line-height:1}.zoom-btn:hover{background:var(--panel);border-color:var(--accent);color:var(--accent)}.zoom-level{font-size:12px;color:var(--text-secondary);min-width:40px;text-align:center;font-family:var(--font-mono, "Menlo", "Consolas", monospace)}.zoom-spacer{flex:1}.image-dims{font-size:11px;color:var(--text-secondary);font-family:var(--font-mono, "Menlo", "Consolas", monospace)}.meta{width:100%;background:transparent;border:1px solid var(--border);border-radius:8px;padding:14px 16px;font-size:13px;line-height:1.6;margin-top:12px;color:var(--text)}.path{font-family:var(--font-mono, "Menlo", "Consolas", monospace);font-size:12px;color:var(--accent);word-break:break-all}.meta-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.copy-btn{flex-shrink:0;padding:4px 12px;background:transparent;border:1px solid var(--border);color:var(--text);border-radius:4px;font-size:12px;cursor:pointer;white-space:nowrap;transition:all .2s ease}.copy-btn:hover{background:var(--panel);border-color:var(--accent);color:var(--accent)}.copy-btn.copied{color:var(--accent);border-color:var(--accent);background:transparent}.desc{margin-top:8px;color:var(--text-secondary);font-size:13px;line-height:1.6}.prompt{margin-top:12px;padding-top:12px;border-top:1px solid var(--border);color:var(--text-secondary);font-size:12px;line-height:1.6}.prompt-label{color:var(--text-secondary);font-weight:600;margin-bottom:4px;text-transform:uppercase;font-size:11px;letter-spacing:.5px}.no-path{color:var(--text-secondary);font-style:italic;font-size:12px}</style>
|
|
293
111
|
</head>
|
|
294
112
|
<body>
|
|
295
113
|
<div id="loading">Waiting for image...</div>
|