@tung-engineering/agent-platform-web-sdk 0.0.60 → 0.0.61
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/dist/web-sdk.cjs +448 -475
- package/dist/web-sdk.cjs.map +1 -1
- package/dist/web-sdk.min.js +453 -480
- package/dist/web-sdk.min.js.map +1 -1
- package/dist/web-sdk.mjs +4757 -4730
- package/dist/web-sdk.mjs.map +1 -1
- package/package.json +2 -2
package/dist/web-sdk.cjs
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
/* ── Agent Platform SDK — namespaced styles ────────────────────────────── */
|
|
3
|
-
|
|
4
|
-
/* Reset Popover API UA defaults so top-layer-promoted elements keep our own
|
|
5
|
-
explicit positioning (see top-layer.ts). The popover UA stylesheet sets
|
|
6
|
-
"inset: 0" on open popovers; component classes below only set the sides
|
|
7
|
-
they actually position (e.g. .ap-sdk-fab sets bottom/right, not top/left),
|
|
8
|
-
so an unscoped reset would leave the *other* sides pinned to the UA's 0.
|
|
9
|
-
Wrapped in :where() to keep this selector's specificity at zero, so every
|
|
10
|
-
component class below (each specificity 10) cleanly overrides whichever
|
|
11
|
-
side it declares, while "inset: auto" still clears the rest. */
|
|
1
|
+
"use strict";var Ru=Object.defineProperty;var Lu=(e,t,n)=>t in e?Ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>Lu(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Iu=`
|
|
12
2
|
:where([data-ap-sdk][popover]) {
|
|
13
3
|
position: fixed;
|
|
14
4
|
margin: 0;
|
|
@@ -19,8 +9,264 @@
|
|
|
19
9
|
overflow: visible;
|
|
20
10
|
inset: auto;
|
|
21
11
|
}
|
|
12
|
+
`,zu=`
|
|
13
|
+
@keyframes ap-sdk-panel-in {
|
|
14
|
+
from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
|
|
15
|
+
to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Capture panel — floating dialog */
|
|
19
|
+
.ap-sdk-panel {
|
|
20
|
+
position: fixed;
|
|
21
|
+
top: 50%;
|
|
22
|
+
right: 24px;
|
|
23
|
+
transform: translateY(-50%);
|
|
24
|
+
width: 340px;
|
|
25
|
+
max-width: calc(100vw - 32px);
|
|
26
|
+
max-height: calc(100vh - 64px);
|
|
27
|
+
overflow-x: hidden;
|
|
28
|
+
overflow-y: auto !important;
|
|
29
|
+
overscroll-behavior: contain;
|
|
30
|
+
background: #ffffff;
|
|
31
|
+
border: 1px solid #e5e7eb;
|
|
32
|
+
border-radius: 12px;
|
|
33
|
+
box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
|
|
34
|
+
z-index: 2147483647;
|
|
35
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
color: #111827;
|
|
38
|
+
pointer-events: all !important;
|
|
39
|
+
animation: ap-sdk-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ap-sdk-panel__header {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
padding: 14px 16px 10px;
|
|
47
|
+
border-bottom: 1px solid #f3f4f6;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ap-sdk-panel__title {
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
color: #111827;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: 6px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ap-sdk-panel__logo {
|
|
60
|
+
width: 18px;
|
|
61
|
+
height: 18px;
|
|
62
|
+
background: oklch(58% 0.13 42);
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
color: #fff;
|
|
68
|
+
font-size: 10px;
|
|
69
|
+
font-weight: 700;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ap-sdk-panel__close {
|
|
74
|
+
background: none;
|
|
75
|
+
border: none;
|
|
76
|
+
padding: 4px;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
color: oklch(58% 0.13 42);
|
|
79
|
+
font-size: 18px;
|
|
80
|
+
line-height: 1;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
transition: color 0.15s, background 0.15s;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ap-sdk-panel__close:hover {
|
|
86
|
+
color: oklch(47% 0.13 40);
|
|
87
|
+
background: oklch(95% 0.035 50);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ap-sdk-panel__header-actions {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 2px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ap-sdk-panel__config {
|
|
97
|
+
background: none;
|
|
98
|
+
border: none;
|
|
99
|
+
padding: 4px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
color: oklch(58% 0.13 42);
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
line-height: 1;
|
|
104
|
+
border-radius: 4px;
|
|
105
|
+
transition: color 0.15s, background 0.15s;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ap-sdk-panel__config:hover {
|
|
109
|
+
color: oklch(47% 0.13 40);
|
|
110
|
+
background: oklch(95% 0.035 50);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ap-sdk-panel__body {
|
|
114
|
+
padding: 14px 16px;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
gap: 12px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ap-sdk-panel__field {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
gap: 4px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ap-sdk-panel__label {
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
color: oklch(38% 0.13 40);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ap-sdk-panel__input,
|
|
133
|
+
.ap-sdk-panel__textarea {
|
|
134
|
+
width: 100%;
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
border: 1px solid oklch(58% 0.13 42);
|
|
137
|
+
border-radius: 8px;
|
|
138
|
+
padding: 7px 10px;
|
|
139
|
+
font-size: 13px;
|
|
140
|
+
font-family: inherit;
|
|
141
|
+
color: #111827;
|
|
142
|
+
background: #fff;
|
|
143
|
+
outline: none;
|
|
144
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
145
|
+
resize: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.ap-sdk-panel__input:focus,
|
|
149
|
+
.ap-sdk-panel__textarea:focus {
|
|
150
|
+
border-color: oklch(58% 0.13 42);
|
|
151
|
+
box-shadow: 0 0 0 3px oklch(58% 0.13 42 / 0.12);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ap-sdk-panel__textarea {
|
|
155
|
+
min-height: 72px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.ap-sdk-panel__toggle {
|
|
159
|
+
display: flex;
|
|
160
|
+
border: 1px solid oklch(58% 0.13 42);
|
|
161
|
+
border-radius: 8px;
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
background: rgba(255, 255, 255, 0.92);
|
|
164
|
+
padding: 2px;
|
|
165
|
+
gap: 2px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.ap-sdk-panel__toggle-btn {
|
|
169
|
+
flex: 1;
|
|
170
|
+
padding: 6px 10px;
|
|
171
|
+
background: transparent;
|
|
172
|
+
border: none;
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
font-size: 12px;
|
|
175
|
+
font-weight: 500;
|
|
176
|
+
color: oklch(58% 0.13 42);
|
|
177
|
+
font-family: inherit;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
transition: background 0.15s, color 0.15s, box-shadow 0.15s;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ap-sdk-panel__toggle-btn:not(:last-child) {
|
|
183
|
+
border-right: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ap-sdk-panel__toggle-btn.ap-sdk-active {
|
|
187
|
+
background: #fff;
|
|
188
|
+
color: oklch(38% 0.13 40);
|
|
189
|
+
box-shadow: inset 0 0 0 2px oklch(58% 0.13 42);
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.ap-sdk-panel__footer {
|
|
194
|
+
display: flex;
|
|
195
|
+
gap: 8px;
|
|
196
|
+
padding: 12px 16px 14px;
|
|
197
|
+
border-top: 1px solid #f3f4f6;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ap-sdk-panel__btn {
|
|
201
|
+
flex: 1;
|
|
202
|
+
padding: 8px 14px;
|
|
203
|
+
border-radius: 8px;
|
|
204
|
+
font-size: 13px;
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
font-family: inherit;
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
border: none;
|
|
209
|
+
transition: background 0.15s, opacity 0.15s;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ap-sdk-panel__btn--primary {
|
|
213
|
+
background: oklch(58% 0.13 42);
|
|
214
|
+
color: #fff;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.ap-sdk-panel__btn--primary:hover:not(:disabled) {
|
|
218
|
+
background: oklch(47% 0.13 40);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.ap-sdk-panel__btn--secondary {
|
|
222
|
+
background: #f3f4f6;
|
|
223
|
+
color: #374151;
|
|
224
|
+
flex: 0 0 auto;
|
|
225
|
+
padding: 8px 16px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.ap-sdk-panel__btn--secondary:hover:not(:disabled) {
|
|
229
|
+
background: #e5e7eb;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.ap-sdk-panel__btn--ghost {
|
|
233
|
+
background: transparent;
|
|
234
|
+
color: oklch(47% 0.13 40);
|
|
235
|
+
border: 1px solid oklch(58% 0.13 42);
|
|
236
|
+
flex: 0 0 auto;
|
|
237
|
+
padding: 8px 16px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.ap-sdk-panel__btn--ghost:hover:not(:disabled) {
|
|
241
|
+
border-color: oklch(58% 0.13 42);
|
|
242
|
+
color: oklch(58% 0.13 42);
|
|
243
|
+
background: oklch(95% 0.035 50);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.ap-sdk-panel__btn:disabled {
|
|
247
|
+
opacity: 0.55;
|
|
248
|
+
cursor: not-allowed;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.ap-sdk-panel__status {
|
|
252
|
+
padding: 10px 16px;
|
|
253
|
+
font-size: 13px;
|
|
254
|
+
border-radius: 6px;
|
|
255
|
+
margin: 0 16px 12px;
|
|
256
|
+
}
|
|
22
257
|
|
|
23
|
-
|
|
258
|
+
.ap-sdk-panel__status--success {
|
|
259
|
+
background: #d1fae5;
|
|
260
|
+
color: #065f46;
|
|
261
|
+
border: 1px solid #a7f3d0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.ap-sdk-panel__status--error {
|
|
265
|
+
background: #fee2e2;
|
|
266
|
+
color: #991b1b;
|
|
267
|
+
border: 1px solid #fca5a5;
|
|
268
|
+
}
|
|
269
|
+
`,$u=`
|
|
24
270
|
.ap-sdk-highlight {
|
|
25
271
|
position: fixed;
|
|
26
272
|
pointer-events: none;
|
|
@@ -31,8 +277,7 @@
|
|
|
31
277
|
z-index: 2147483645;
|
|
32
278
|
transition: top 60ms ease, left 60ms ease, width 60ms ease, height 60ms ease;
|
|
33
279
|
}
|
|
34
|
-
|
|
35
|
-
/* Cursor indicator shown during picker mode */
|
|
280
|
+
`,Ou=`
|
|
36
281
|
.ap-sdk-picker-cursor {
|
|
37
282
|
position: fixed;
|
|
38
283
|
bottom: 16px;
|
|
@@ -106,8 +351,7 @@
|
|
|
106
351
|
background: rgba(255, 255, 255, 0.12);
|
|
107
352
|
opacity: 1;
|
|
108
353
|
}
|
|
109
|
-
|
|
110
|
-
/* Floating bar shown while recorder.ts is capturing a workflow */
|
|
354
|
+
`,Nu=`
|
|
111
355
|
.ap-sdk-recorder-bar {
|
|
112
356
|
position: fixed;
|
|
113
357
|
bottom: 16px;
|
|
@@ -161,107 +405,7 @@
|
|
|
161
405
|
.ap-sdk-recorder-bar__btn--stop:hover {
|
|
162
406
|
background: oklch(95% 0.035 50);
|
|
163
407
|
}
|
|
164
|
-
|
|
165
|
-
@keyframes ap-sdk-panel-in {
|
|
166
|
-
from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
|
|
167
|
-
to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/* Capture panel — floating dialog */
|
|
171
|
-
.ap-sdk-panel {
|
|
172
|
-
position: fixed;
|
|
173
|
-
top: 50%;
|
|
174
|
-
right: 24px;
|
|
175
|
-
transform: translateY(-50%);
|
|
176
|
-
width: 340px;
|
|
177
|
-
max-width: calc(100vw - 32px);
|
|
178
|
-
max-height: calc(100vh - 64px);
|
|
179
|
-
overflow-x: hidden;
|
|
180
|
-
overflow-y: auto !important;
|
|
181
|
-
overscroll-behavior: contain;
|
|
182
|
-
background: #ffffff;
|
|
183
|
-
border: 1px solid #e5e7eb;
|
|
184
|
-
border-radius: 12px;
|
|
185
|
-
box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
|
|
186
|
-
z-index: 2147483647;
|
|
187
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
188
|
-
font-size: 14px;
|
|
189
|
-
color: #111827;
|
|
190
|
-
pointer-events: all !important;
|
|
191
|
-
animation: ap-sdk-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.ap-sdk-panel__header {
|
|
195
|
-
display: flex;
|
|
196
|
-
align-items: center;
|
|
197
|
-
justify-content: space-between;
|
|
198
|
-
padding: 14px 16px 10px;
|
|
199
|
-
border-bottom: 1px solid #f3f4f6;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.ap-sdk-panel__title {
|
|
203
|
-
font-size: 14px;
|
|
204
|
-
font-weight: 600;
|
|
205
|
-
color: #111827;
|
|
206
|
-
display: flex;
|
|
207
|
-
align-items: center;
|
|
208
|
-
gap: 6px;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.ap-sdk-panel__logo {
|
|
212
|
-
width: 18px;
|
|
213
|
-
height: 18px;
|
|
214
|
-
background: oklch(58% 0.13 42);
|
|
215
|
-
border-radius: 4px;
|
|
216
|
-
display: inline-flex;
|
|
217
|
-
align-items: center;
|
|
218
|
-
justify-content: center;
|
|
219
|
-
color: #fff;
|
|
220
|
-
font-size: 10px;
|
|
221
|
-
font-weight: 700;
|
|
222
|
-
flex-shrink: 0;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.ap-sdk-panel__close {
|
|
226
|
-
background: none;
|
|
227
|
-
border: none;
|
|
228
|
-
padding: 4px;
|
|
229
|
-
cursor: pointer;
|
|
230
|
-
color: oklch(58% 0.13 42);
|
|
231
|
-
font-size: 18px;
|
|
232
|
-
line-height: 1;
|
|
233
|
-
border-radius: 4px;
|
|
234
|
-
transition: color 0.15s, background 0.15s;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.ap-sdk-panel__close:hover {
|
|
238
|
-
color: oklch(47% 0.13 40);
|
|
239
|
-
background: oklch(95% 0.035 50);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.ap-sdk-panel__header-actions {
|
|
243
|
-
display: flex;
|
|
244
|
-
align-items: center;
|
|
245
|
-
gap: 2px;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.ap-sdk-panel__config {
|
|
249
|
-
background: none;
|
|
250
|
-
border: none;
|
|
251
|
-
padding: 4px;
|
|
252
|
-
cursor: pointer;
|
|
253
|
-
color: oklch(58% 0.13 42);
|
|
254
|
-
font-size: 14px;
|
|
255
|
-
line-height: 1;
|
|
256
|
-
border-radius: 4px;
|
|
257
|
-
transition: color 0.15s, background 0.15s;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.ap-sdk-panel__config:hover {
|
|
261
|
-
color: oklch(47% 0.13 40);
|
|
262
|
-
background: oklch(95% 0.035 50);
|
|
263
|
-
}
|
|
264
|
-
|
|
408
|
+
`,Du=`
|
|
265
409
|
.ap-sdk-panel__context {
|
|
266
410
|
padding: 10px 16px;
|
|
267
411
|
background: #f9fafb;
|
|
@@ -340,194 +484,158 @@
|
|
|
340
484
|
white-space: nowrap;
|
|
341
485
|
}
|
|
342
486
|
|
|
343
|
-
.ap-sdk-
|
|
344
|
-
padding:
|
|
345
|
-
|
|
346
|
-
flex-direction: column;
|
|
347
|
-
gap: 12px;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.ap-sdk-panel__field {
|
|
487
|
+
.ap-sdk-credentials-section {
|
|
488
|
+
padding: 0 16px 12px;
|
|
489
|
+
border-bottom: 1px solid #f3f4f6;
|
|
351
490
|
display: flex;
|
|
352
491
|
flex-direction: column;
|
|
353
|
-
gap:
|
|
492
|
+
gap: 10px;
|
|
354
493
|
}
|
|
355
494
|
|
|
356
|
-
.ap-sdk-
|
|
495
|
+
.ap-sdk-credentials-heading {
|
|
357
496
|
font-size: 12px;
|
|
358
497
|
font-weight: 500;
|
|
359
|
-
color: oklch(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
.ap-sdk-panel__input,
|
|
363
|
-
.ap-sdk-panel__textarea {
|
|
364
|
-
width: 100%;
|
|
365
|
-
box-sizing: border-box;
|
|
366
|
-
border: 1px solid oklch(58% 0.13 42);
|
|
367
|
-
border-radius: 8px;
|
|
368
|
-
padding: 7px 10px;
|
|
369
|
-
font-size: 13px;
|
|
370
|
-
font-family: inherit;
|
|
371
|
-
color: #111827;
|
|
372
|
-
background: #fff;
|
|
373
|
-
outline: none;
|
|
374
|
-
transition: border-color 0.15s, box-shadow 0.15s;
|
|
375
|
-
resize: none;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.ap-sdk-panel__input:focus,
|
|
379
|
-
.ap-sdk-panel__textarea:focus {
|
|
380
|
-
border-color: oklch(58% 0.13 42);
|
|
381
|
-
box-shadow: 0 0 0 3px oklch(58% 0.13 42 / 0.12);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.ap-sdk-panel__textarea {
|
|
385
|
-
min-height: 72px;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.ap-sdk-panel__toggle {
|
|
389
|
-
display: flex;
|
|
390
|
-
border: 1px solid oklch(58% 0.13 42);
|
|
391
|
-
border-radius: 8px;
|
|
392
|
-
overflow: hidden;
|
|
393
|
-
background: rgba(255, 255, 255, 0.92);
|
|
394
|
-
padding: 2px;
|
|
395
|
-
gap: 2px;
|
|
498
|
+
color: oklch(47% 0.13 40);
|
|
499
|
+
margin: 0;
|
|
500
|
+
padding-top: 12px;
|
|
396
501
|
}
|
|
397
502
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
padding: 6px 10px;
|
|
401
|
-
background: transparent;
|
|
402
|
-
border: none;
|
|
403
|
-
cursor: pointer;
|
|
503
|
+
/* Config panel hint text */
|
|
504
|
+
.ap-sdk-config-hint {
|
|
404
505
|
font-size: 12px;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
border-radius: 6px;
|
|
409
|
-
transition: background 0.15s, color 0.15s, box-shadow 0.15s;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.ap-sdk-panel__toggle-btn:not(:last-child) {
|
|
413
|
-
border-right: none;
|
|
506
|
+
color: oklch(47% 0.13 40);
|
|
507
|
+
margin: 0;
|
|
508
|
+
line-height: 1.5;
|
|
414
509
|
}
|
|
415
510
|
|
|
416
|
-
.ap-sdk-
|
|
417
|
-
background: #fff;
|
|
511
|
+
.ap-sdk-config-hint strong {
|
|
418
512
|
color: oklch(38% 0.13 40);
|
|
419
|
-
box-shadow: inset 0 0 0 2px oklch(58% 0.13 42);
|
|
420
|
-
font-weight: 600;
|
|
421
513
|
}
|
|
422
514
|
|
|
423
|
-
|
|
424
|
-
display: flex;
|
|
425
|
-
gap: 8px;
|
|
426
|
-
padding: 12px 16px 14px;
|
|
427
|
-
border-top: 1px solid #f3f4f6;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.ap-sdk-panel__btn {
|
|
431
|
-
flex: 1;
|
|
432
|
-
padding: 8px 14px;
|
|
433
|
-
border-radius: 8px;
|
|
434
|
-
font-size: 13px;
|
|
435
|
-
font-weight: 500;
|
|
436
|
-
font-family: inherit;
|
|
437
|
-
cursor: pointer;
|
|
438
|
-
border: none;
|
|
439
|
-
transition: background 0.15s, opacity 0.15s;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.ap-sdk-panel__btn--primary {
|
|
443
|
-
background: oklch(58% 0.13 42);
|
|
444
|
-
color: #fff;
|
|
445
|
-
}
|
|
515
|
+
/* ── Success state ──────────────────────────────────────────────────────── */
|
|
446
516
|
|
|
447
|
-
.ap-sdk-
|
|
448
|
-
|
|
517
|
+
.ap-sdk-panel--success .ap-sdk-pick-list,
|
|
518
|
+
.ap-sdk-panel--success .ap-sdk-credentials-section,
|
|
519
|
+
.ap-sdk-panel--success .ap-sdk-panel__body,
|
|
520
|
+
.ap-sdk-panel--success .ap-sdk-panel__footer {
|
|
521
|
+
display: none !important;
|
|
449
522
|
}
|
|
450
523
|
|
|
451
|
-
|
|
452
|
-
background: #f3f4f6;
|
|
453
|
-
color: #374151;
|
|
454
|
-
flex: 0 0 auto;
|
|
455
|
-
padding: 8px 16px;
|
|
456
|
-
}
|
|
524
|
+
/* ── Multi-pick list ─────────────────────────────────────────────────────── */
|
|
457
525
|
|
|
458
|
-
.ap-sdk-
|
|
459
|
-
|
|
526
|
+
.ap-sdk-pick-list {
|
|
527
|
+
border-bottom: 1px solid #f3f4f6;
|
|
528
|
+
max-height: 220px;
|
|
529
|
+
overflow-y: auto;
|
|
530
|
+
overscroll-behavior: contain;
|
|
460
531
|
}
|
|
461
532
|
|
|
462
|
-
.ap-sdk-
|
|
463
|
-
background: transparent;
|
|
464
|
-
color: oklch(47% 0.13 40);
|
|
465
|
-
border: 1px solid oklch(58% 0.13 42);
|
|
466
|
-
flex: 0 0 auto;
|
|
533
|
+
.ap-sdk-pick-entry {
|
|
467
534
|
padding: 8px 16px;
|
|
535
|
+
border-bottom: 1px solid #f3f4f6;
|
|
536
|
+
font-size: 12px;
|
|
468
537
|
}
|
|
469
538
|
|
|
470
|
-
.ap-sdk-
|
|
471
|
-
border-
|
|
472
|
-
color: oklch(58% 0.13 42);
|
|
473
|
-
background: oklch(95% 0.035 50);
|
|
539
|
+
.ap-sdk-pick-entry:last-child {
|
|
540
|
+
border-bottom: none;
|
|
474
541
|
}
|
|
475
542
|
|
|
476
|
-
.ap-sdk-
|
|
477
|
-
|
|
478
|
-
|
|
543
|
+
.ap-sdk-pick-entry__header {
|
|
544
|
+
display: flex;
|
|
545
|
+
align-items: center;
|
|
546
|
+
gap: 6px;
|
|
547
|
+
margin-bottom: 3px;
|
|
479
548
|
}
|
|
480
549
|
|
|
481
|
-
.ap-sdk-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
550
|
+
.ap-sdk-pick-entry__number {
|
|
551
|
+
display: inline-flex;
|
|
552
|
+
align-items: center;
|
|
553
|
+
justify-content: center;
|
|
554
|
+
width: 18px;
|
|
555
|
+
height: 18px;
|
|
556
|
+
background: oklch(58% 0.13 42);
|
|
557
|
+
color: #fff;
|
|
558
|
+
border-radius: 999px;
|
|
559
|
+
font-size: 10px;
|
|
560
|
+
font-weight: 700;
|
|
561
|
+
flex-shrink: 0;
|
|
486
562
|
}
|
|
487
563
|
|
|
488
|
-
.ap-sdk-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
564
|
+
.ap-sdk-pick-entry__element {
|
|
565
|
+
flex: 1;
|
|
566
|
+
font-family: ui-monospace, SFMono-Regular, monospace;
|
|
567
|
+
font-size: 11px;
|
|
568
|
+
color: #374151;
|
|
569
|
+
overflow: hidden;
|
|
570
|
+
text-overflow: ellipsis;
|
|
571
|
+
white-space: nowrap;
|
|
492
572
|
}
|
|
493
573
|
|
|
494
|
-
.ap-sdk-
|
|
495
|
-
background:
|
|
496
|
-
|
|
497
|
-
|
|
574
|
+
.ap-sdk-pick-entry__remove {
|
|
575
|
+
background: none;
|
|
576
|
+
border: none;
|
|
577
|
+
cursor: pointer;
|
|
578
|
+
color: oklch(58% 0.13 42);
|
|
579
|
+
font-size: 16px;
|
|
580
|
+
line-height: 1;
|
|
581
|
+
padding: 0 2px;
|
|
582
|
+
border-radius: 3px;
|
|
583
|
+
flex-shrink: 0;
|
|
584
|
+
transition: color 0.1s, background 0.1s;
|
|
498
585
|
}
|
|
499
586
|
|
|
500
|
-
.ap-sdk-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
display: flex;
|
|
504
|
-
flex-direction: column;
|
|
505
|
-
gap: 10px;
|
|
587
|
+
.ap-sdk-pick-entry__remove:hover {
|
|
588
|
+
color: #ef4444;
|
|
589
|
+
background: #fee2e2;
|
|
506
590
|
}
|
|
507
591
|
|
|
508
|
-
.ap-sdk-
|
|
509
|
-
font-size: 12px;
|
|
510
|
-
font-weight: 500;
|
|
592
|
+
.ap-sdk-pick-entry__instruction {
|
|
511
593
|
color: oklch(47% 0.13 40);
|
|
512
|
-
|
|
513
|
-
padding-
|
|
594
|
+
font-size: 11px;
|
|
595
|
+
padding-left: 24px;
|
|
596
|
+
white-space: pre-wrap;
|
|
597
|
+
word-break: break-word;
|
|
598
|
+
max-height: 48px;
|
|
599
|
+
overflow: hidden;
|
|
600
|
+
text-overflow: ellipsis;
|
|
601
|
+
display: -webkit-box;
|
|
602
|
+
-webkit-line-clamp: 2;
|
|
603
|
+
-webkit-box-orient: vertical;
|
|
514
604
|
}
|
|
515
605
|
|
|
516
|
-
/*
|
|
517
|
-
.ap-sdk-
|
|
518
|
-
|
|
606
|
+
/* "Add another" button */
|
|
607
|
+
.ap-sdk-panel__btn--add-another {
|
|
608
|
+
width: 100%;
|
|
609
|
+
padding: 6px 12px;
|
|
610
|
+
border: 1px dashed oklch(58% 0.13 42);
|
|
611
|
+
border-radius: 8px;
|
|
612
|
+
background: none;
|
|
519
613
|
color: oklch(47% 0.13 40);
|
|
520
|
-
|
|
521
|
-
|
|
614
|
+
font-size: 12px;
|
|
615
|
+
font-weight: 500;
|
|
616
|
+
font-family: inherit;
|
|
617
|
+
cursor: pointer;
|
|
618
|
+
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
|
522
619
|
}
|
|
523
620
|
|
|
524
|
-
.ap-sdk-
|
|
525
|
-
color: oklch(
|
|
621
|
+
.ap-sdk-panel__btn--add-another:not(:disabled):hover {
|
|
622
|
+
border-color: oklch(58% 0.13 42);
|
|
623
|
+
color: oklch(58% 0.13 42);
|
|
624
|
+
background: oklch(95% 0.035 50);
|
|
526
625
|
}
|
|
527
626
|
|
|
627
|
+
.ap-sdk-panel__btn--add-another:disabled {
|
|
628
|
+
opacity: 0.45;
|
|
629
|
+
cursor: not-allowed;
|
|
630
|
+
}
|
|
528
631
|
|
|
529
|
-
/*
|
|
530
|
-
|
|
632
|
+
/* Awaiting-pick indicator in context section */
|
|
633
|
+
.ap-sdk-awaiting-pick {
|
|
634
|
+
color: oklch(58% 0.13 42);
|
|
635
|
+
font-style: italic;
|
|
636
|
+
white-space: normal;
|
|
637
|
+
}
|
|
638
|
+
`,Mu=`
|
|
531
639
|
.ap-sdk-fab {
|
|
532
640
|
position: fixed;
|
|
533
641
|
bottom: 20px;
|
|
@@ -657,18 +765,7 @@
|
|
|
657
765
|
line-height: 1;
|
|
658
766
|
pointer-events: none;
|
|
659
767
|
}
|
|
660
|
-
|
|
661
|
-
/* ── Success state ──────────────────────────────────────────────────────── */
|
|
662
|
-
|
|
663
|
-
.ap-sdk-panel--success .ap-sdk-pick-list,
|
|
664
|
-
.ap-sdk-panel--success .ap-sdk-credentials-section,
|
|
665
|
-
.ap-sdk-panel--success .ap-sdk-panel__body,
|
|
666
|
-
.ap-sdk-panel--success .ap-sdk-panel__footer {
|
|
667
|
-
display: none !important;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
/* ── Advanced options collapsible ───────────────────────────────────────── */
|
|
671
|
-
|
|
768
|
+
`,Uu=`
|
|
672
769
|
.ap-sdk-advanced {
|
|
673
770
|
border-top: 1px solid #f3f4f6;
|
|
674
771
|
padding-top: 8px;
|
|
@@ -724,9 +821,7 @@
|
|
|
724
821
|
color: #9ca3af;
|
|
725
822
|
margin-top: 2px;
|
|
726
823
|
}
|
|
727
|
-
|
|
728
|
-
/* ── List panel ─────────────────────────────────────────────────────────── */
|
|
729
|
-
|
|
824
|
+
`,ju=`
|
|
730
825
|
.ap-sdk-list-body {
|
|
731
826
|
padding: 8px 0;
|
|
732
827
|
max-height: 320px;
|
|
@@ -851,91 +946,7 @@ button.ap-sdk-list-item__link {
|
|
|
851
946
|
.ap-sdk-status-link:hover {
|
|
852
947
|
color: oklch(47% 0.13 40);
|
|
853
948
|
}
|
|
854
|
-
|
|
855
|
-
/* ── Multi-pick list ─────────────────────────────────────────────────────── */
|
|
856
|
-
|
|
857
|
-
.ap-sdk-pick-list {
|
|
858
|
-
border-bottom: 1px solid #f3f4f6;
|
|
859
|
-
max-height: 220px;
|
|
860
|
-
overflow-y: auto;
|
|
861
|
-
overscroll-behavior: contain;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
.ap-sdk-pick-entry {
|
|
865
|
-
padding: 8px 16px;
|
|
866
|
-
border-bottom: 1px solid #f3f4f6;
|
|
867
|
-
font-size: 12px;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
.ap-sdk-pick-entry:last-child {
|
|
871
|
-
border-bottom: none;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
.ap-sdk-pick-entry__header {
|
|
875
|
-
display: flex;
|
|
876
|
-
align-items: center;
|
|
877
|
-
gap: 6px;
|
|
878
|
-
margin-bottom: 3px;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
.ap-sdk-pick-entry__number {
|
|
882
|
-
display: inline-flex;
|
|
883
|
-
align-items: center;
|
|
884
|
-
justify-content: center;
|
|
885
|
-
width: 18px;
|
|
886
|
-
height: 18px;
|
|
887
|
-
background: oklch(58% 0.13 42);
|
|
888
|
-
color: #fff;
|
|
889
|
-
border-radius: 999px;
|
|
890
|
-
font-size: 10px;
|
|
891
|
-
font-weight: 700;
|
|
892
|
-
flex-shrink: 0;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.ap-sdk-pick-entry__element {
|
|
896
|
-
flex: 1;
|
|
897
|
-
font-family: ui-monospace, SFMono-Regular, monospace;
|
|
898
|
-
font-size: 11px;
|
|
899
|
-
color: #374151;
|
|
900
|
-
overflow: hidden;
|
|
901
|
-
text-overflow: ellipsis;
|
|
902
|
-
white-space: nowrap;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
.ap-sdk-pick-entry__remove {
|
|
906
|
-
background: none;
|
|
907
|
-
border: none;
|
|
908
|
-
cursor: pointer;
|
|
909
|
-
color: oklch(58% 0.13 42);
|
|
910
|
-
font-size: 16px;
|
|
911
|
-
line-height: 1;
|
|
912
|
-
padding: 0 2px;
|
|
913
|
-
border-radius: 3px;
|
|
914
|
-
flex-shrink: 0;
|
|
915
|
-
transition: color 0.1s, background 0.1s;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
.ap-sdk-pick-entry__remove:hover {
|
|
919
|
-
color: #ef4444;
|
|
920
|
-
background: #fee2e2;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
.ap-sdk-pick-entry__instruction {
|
|
924
|
-
color: oklch(47% 0.13 40);
|
|
925
|
-
font-size: 11px;
|
|
926
|
-
padding-left: 24px;
|
|
927
|
-
white-space: pre-wrap;
|
|
928
|
-
word-break: break-word;
|
|
929
|
-
max-height: 48px;
|
|
930
|
-
overflow: hidden;
|
|
931
|
-
text-overflow: ellipsis;
|
|
932
|
-
display: -webkit-box;
|
|
933
|
-
-webkit-line-clamp: 2;
|
|
934
|
-
-webkit-box-orient: vertical;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/* ── Record review list ─────────────────────────────────────────────────── */
|
|
938
|
-
|
|
949
|
+
`,Zu=`
|
|
939
950
|
.ap-sdk-record-review__list {
|
|
940
951
|
max-height: 320px;
|
|
941
952
|
overflow-y: auto;
|
|
@@ -996,42 +1007,7 @@ button.ap-sdk-list-item__link {
|
|
|
996
1007
|
color: #ef4444;
|
|
997
1008
|
background: #fee2e2;
|
|
998
1009
|
}
|
|
999
|
-
|
|
1000
|
-
/* "Add another" button */
|
|
1001
|
-
.ap-sdk-panel__btn--add-another {
|
|
1002
|
-
width: 100%;
|
|
1003
|
-
padding: 6px 12px;
|
|
1004
|
-
border: 1px dashed oklch(58% 0.13 42);
|
|
1005
|
-
border-radius: 8px;
|
|
1006
|
-
background: none;
|
|
1007
|
-
color: oklch(47% 0.13 40);
|
|
1008
|
-
font-size: 12px;
|
|
1009
|
-
font-weight: 500;
|
|
1010
|
-
font-family: inherit;
|
|
1011
|
-
cursor: pointer;
|
|
1012
|
-
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
.ap-sdk-panel__btn--add-another:not(:disabled):hover {
|
|
1016
|
-
border-color: oklch(58% 0.13 42);
|
|
1017
|
-
color: oklch(58% 0.13 42);
|
|
1018
|
-
background: oklch(95% 0.035 50);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
.ap-sdk-panel__btn--add-another:disabled {
|
|
1022
|
-
opacity: 0.45;
|
|
1023
|
-
cursor: not-allowed;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
/* Awaiting-pick indicator in context section */
|
|
1027
|
-
.ap-sdk-awaiting-pick {
|
|
1028
|
-
color: oklch(58% 0.13 42);
|
|
1029
|
-
font-style: italic;
|
|
1030
|
-
white-space: normal;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
/* ── Success card ───────────────────────────────────────────────────────── */
|
|
1034
|
-
|
|
1010
|
+
`,qu=`
|
|
1035
1011
|
@keyframes ap-sdk-card-in {
|
|
1036
1012
|
from { opacity: 0; transform: scale(0.97); }
|
|
1037
1013
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -1110,7 +1086,7 @@ button.ap-sdk-list-item__link {
|
|
|
1110
1086
|
flex: 1;
|
|
1111
1087
|
white-space: nowrap;
|
|
1112
1088
|
}
|
|
1113
|
-
|
|
1089
|
+
`,Hu=`
|
|
1114
1090
|
.ap-sdk-runner__approval {
|
|
1115
1091
|
margin-top: 10px;
|
|
1116
1092
|
display: flex;
|
|
@@ -1136,8 +1112,6 @@ button.ap-sdk-list-item__link {
|
|
|
1136
1112
|
font-size: 12px;
|
|
1137
1113
|
}
|
|
1138
1114
|
|
|
1139
|
-
/* ── Automation runner ──────────────────────────────────────────────────── */
|
|
1140
|
-
|
|
1141
1115
|
.ap-sdk-runner__meta {
|
|
1142
1116
|
display: flex;
|
|
1143
1117
|
flex-direction: column;
|
|
@@ -1318,9 +1292,7 @@ button.ap-sdk-list-item__link {
|
|
|
1318
1292
|
font-style: italic;
|
|
1319
1293
|
padding: 4px 0;
|
|
1320
1294
|
}
|
|
1321
|
-
|
|
1322
|
-
/* ── Resize handle (shared by all three floating dialogs) ──────────────── */
|
|
1323
|
-
|
|
1295
|
+
`,Fu=`
|
|
1324
1296
|
.ap-sdk-resize-handle {
|
|
1325
1297
|
position: absolute;
|
|
1326
1298
|
bottom: 2px;
|
|
@@ -1342,11 +1314,12 @@ button.ap-sdk-list-item__link {
|
|
|
1342
1314
|
border-right: 2px solid #d1d5db;
|
|
1343
1315
|
border-bottom: 2px solid #d1d5db;
|
|
1344
1316
|
}
|
|
1345
|
-
|
|
1346
|
-
`)
|
|
1347
|
-
`)}const Kn=new Set;let Gn=null,Po=!1,_s=!1;function qu(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Hu(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Kn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&qu(r))return!0}return!1}function La(){const e=Hu(),t=e&&!_s;_s=e;for(const n of Kn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function Ti(e){if(!(e instanceof Node))return!1;for(const t of Kn)if(t===e||t.contains(e))return!0;return!1}function Wn(e){(Ti(e.target)||"relatedTarget"in e&&Ti(e.relatedTarget))&&e.stopPropagation()}function Fu(){Po||(window.addEventListener("focusin",Wn,!0),window.addEventListener("focusout",Wn,!0),window.addEventListener("pointerdown",Wn,!0),Po=!0),!Gn&&(Gn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&La()}),Gn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function qt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Kn.add(e),Fu(),La())}function Ht(e){if(Kn.delete(e),Kn.size===0&&(Gn&&(Gn.disconnect(),Gn=null),Po&&(window.removeEventListener("focusin",Wn,!0),window.removeEventListener("focusout",Wn,!0),window.removeEventListener("pointerdown",Wn,!0),Po=!1),_s=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Is(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),qt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ht(t),t.remove()}}}const za=/^cc-|current-password|new-password/i,Bu=/token|secret|password|apikey|auth/i,as="[redacted]";function Gu(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&za.test(t)}function Ia(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",as);const r=n.getAttribute("autocomplete");r&&za.test(r)&&n.setAttribute("value",as);for(const o of Array.from(n.attributes))Bu.test(o.name)&&n.setAttribute(o.name,as)}}const Wu="🎯 Click any element to capture";let rn=null,ze=null,Oe=null;function Pr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function Ju(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function Ei(e){rn==null||rn.update(e)}function $a(e){const t=Ra(),n=Uu(e),r=ju(e);let o;try{const i=e.cloneNode(!0);Ia(i),o=i.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Co(e),cssSelector:mo(e),innerTree:Iu(e),outerTree:Mu(e),elementOuterHtml:o,ancestry:n,...r,...t}}function cs(e,t){Oe&&Oe();const n=Ju();rn=Is(),ze=document.createElement("div"),ze.className="ap-sdk-picker-cursor",ze.setAttribute("data-ap-sdk","1"),ze.textContent=n?"Tap any element to preview":Wu,document.body.appendChild(ze),qt(ze);let r=null,o=null;const i=p=>{Oe==null||Oe(),e($a(p),p)},a=p=>{if(o=p,Ei(p),!ze)return;ze.classList.add("ap-sdk-picker-cursor--confirm"),ze.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${p.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),Oe==null||Oe(),t()});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn",_.textContent="⬆ Parent",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o&&i(o)}),ze.appendChild(b),ze.appendChild(m),ze.appendChild(_),ze.appendChild(y)},u=p=>{Pr(p.target)||(r=p.target,Ei(r))},d=p=>{if(Pr(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const b=p.target??r;if(b){if(n){a(b);return}i(b)}},h=p=>{p.key==="Escape"&&(Oe==null||Oe(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),Oe=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),ze&&Ht(ze),ze==null||ze.remove(),rn==null||rn.destroy(),rn=null,ze=null,o=null,Oe=null}}function $s(){Oe==null||Oe()}function Jn(){return Oe!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const h=a.prototype,p=Object.keys(h);for(let b=0;b<p.length;b++){const m=p[b];m in u||(u[m]=h[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var d;const h=n!=null&&n.Parent?new i:this;r(h,u),(d=h._zod).deferred??(d.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Xn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Na extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Oa={};function on(e){return Oa}function Da(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function vs(e,t){return typeof t=="bigint"?t.toString():t}function Bo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ns(e){return e==null}function Os(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Xu(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),u=Number.parseInt(t.toFixed(i).replace(".",""));return a%u/10**i}const Ai=Symbol("evaluating");function Q(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ai)return r===void 0&&(r=Ai,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function an(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ci(e){return JSON.stringify(e)}function Vu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ma="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Yu=Bo(()=>{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 Qn(e){if(Nr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Nr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ua(e){return Qn(e)?{...e}:Array.isArray(e)?[...e]:e}const Ku=new Set(["string","number","symbol"]);function er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function O(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 Qu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const ed={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 td(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=an(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return Pn(this,"shape",a),a},checks:[]});return cn(e,i)}function nd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=an(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return Pn(this,"shape",a),a},checks:[]});return cn(e,i)}function rd(e,t){if(!Qn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=an(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Pn(this,"shape",i),i}});return cn(e,o)}function od(e,t){if(!Qn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Pn(this,"shape",r),r}});return cn(e,n)}function sd(e,t){const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Pn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,n)}function id(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=an(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const h in n){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(d[h]=e?new e({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)d[h]=e?new e({type:"optional",innerType:u[h]}):u[h];return Pn(this,"shape",d),d},checks:[]});return cn(t,a)}function ad(e,t,n){const r=an(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Pn(this,"shape",i),i}});return cn(t,r)}function qn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Hn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function oo(e){return typeof e=="string"?e:e==null?void 0:e.message}function sn(e,t,n){var o,i,a,u,d,h;const r={...e,path:e.path??[]};if(!e.message){const p=oo((a=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:a.call(i,e))??oo((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??oo((d=n.customError)==null?void 0:d.call(n,e))??oo((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ds(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Or(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ja=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Za=v("$ZodError",ja),qa=v("$ZodError",ja,{Parent:Error});function cd(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ld(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const Ms=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Xn;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>sn(d,i,on())));throw Ma(u,o==null?void 0:o.callee),u}return a.value},Us=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>sn(d,i,on())));throw Ma(u,o==null?void 0:o.callee),u}return a.value},Go=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Xn;return i.issues.length?{success:!1,error:new(e??Za)(i.issues.map(a=>sn(a,o,on())))}:{success:!0,data:i.value}},ud=Go(qa),Wo=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>sn(a,o,on())))}:{success:!0,data:i.value}},dd=Wo(qa),pd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ms(e)(t,n,o)},hd=e=>(t,n,r)=>Ms(e)(t,n,r),fd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Us(e)(t,n,o)},gd=e=>async(t,n,r)=>Us(e)(t,n,r),md=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Go(e)(t,n,o)},bd=e=>(t,n,r)=>Go(e)(t,n,r),kd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},_d=e=>async(t,n,r)=>Wo(e)(t,n,r),vd=/^[cC][^\s-]{8,}$/,yd=/^[0-9a-z]+$/,wd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xd=/^[0-9a-vA-V]{20}$/,Sd=/^[A-Za-z0-9]{27}$/,Td=/^[a-zA-Z0-9_-]{21}$/,Ed=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ad=/^([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})$/,Pi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Cd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rd(){return new RegExp(Pd,"u")}const Ld=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Id=/^((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])$/,$d=/^(([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])$/,Nd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ha=/^[A-Za-z0-9_-]*$/,Od=/^\+[1-9]\d{6,14}$/,Fa="(?:(?:\\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])))",Dd=new RegExp(`^${Fa}$`);function Ba(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 Md(e){return new RegExp(`^${Ba(e)}$`)}function Ud(e){const t=Ba({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Fa}T(?:${r})$`)}const jd=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}$`)},Zd=/^-?\d+$/,Ga=/^-?\d+(?:\.\d+)?$/,qd=/^(?:true|false)$/i,Hd=/^[^A-Z]*$/,Fd=/^[^a-z]*$/,et=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Wa={number:"number",bigint:"bigint",object:"date"},Ja=v("$ZodCheckLessThan",(e,t)=>{et.init(e,t);const n=Wa[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xa=v("$ZodCheckGreaterThan",(e,t)=>{et.init(e,t);const n=Wa[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bd=v("$ZodCheckMultipleOf",(e,t)=>{et.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Xu(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Gd=v("$ZodCheckNumberFormat",(e,t)=>{var a;et.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=ed[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=i,n&&(d.pattern=Zd)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>i&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Wd=v("$ZodCheckMaxLength",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ns(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=Ds(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jd=v("$ZodCheckMinLength",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ns(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=Ds(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xd=v("$ZodCheckLengthEquals",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ns(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const a=Ds(o),u=i>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Jo=v("$ZodCheckStringFormat",(e,t)=>{var n,r;et.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Vd=v("$ZodCheckRegex",(e,t)=>{Jo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yd=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Hd),Jo.init(e,t)}),Kd=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fd),Jo.init(e,t)}),Qd=v("$ZodCheckIncludes",(e,t)=>{et.init(e,t);const n=er(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ep=v("$ZodCheckStartsWith",(e,t)=>{et.init(e,t);const n=new RegExp(`^${er(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tp=v("$ZodCheckEndsWith",(e,t)=>{et.init(e,t);const n=new RegExp(`.*${er(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),np=v("$ZodCheckOverwrite",(e,t)=>{et.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class rp{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(`
|
|
1317
|
+
`,Bu=[Iu,zu,$u,Ou,Nu,Du,Mu,Uu,ju,Zu,qu,Hu,Fu].join(`
|
|
1318
|
+
`);let Ei=!1;function Mr(){if(Ei)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Bu,document.head.appendChild(e),Ei=!0}function mo(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Co(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const Gu=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function bo(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=u=>{if(i.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;i.add(u);const h=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${h}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&a(u.name);for(const u of Gu)a(u);return`${t}${n}${r}${o.join("")}`}function Wu(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function Ju(e,t=5,n=10){function r(o,i){const a=bo(o),u=" ".repeat(i),d=Array.from(o.children).slice(0,n);if(i>=t||d.length===0){const h=Wu(o);return h?`${u}${a} "${h}"`:`${u}${a}`}return[`${u}${a}`,...d.map(h=>r(h,i+1))].join(`
|
|
1319
|
+
`)}return r(e,0)}const Yu='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Xu={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function ro(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Vu(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(Yu);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function Ku(e,t=80){var a,u,d;const n=Xu[e.tagName.toLowerCase()];if(n){const h=(u=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:u.trim();if(h)return ro(h,t)}const r=Vu(e);if(r)return ro(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return ro(o,t);const i=e.getAttribute("aria-labelledby");if(i){const h=i.split(/\s+/).map(p=>{var b,m;return((m=(b=document.getElementById(p))==null?void 0:b.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(h)return ro(h,t)}return""}function Qu(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Ku(o),a=i&&!r.has(i)?`${bo(o)} ["${i}"]`:bo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||bo(e)}function Ia(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function _r(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function za(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>_r('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>_r('meta[property="og:title"]')),ogDescription:e(()=>_r('meta[property="og:description"]')),ogType:e(()=>_r('meta[property="og:type"]')),ogSiteName:e(()=>_r('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?Ia(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function ed(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function td(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),u=o.tagName.toLowerCase();r=a?`${u}: ${Ia(a,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function nd(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
|
|
1320
|
+
`)}const Kn=new Set;let Gn=null,Po=!1,ys=!1;function rd(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function od(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Kn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&rd(r))return!0}return!1}function $a(){const e=od(),t=e&&!ys;ys=e;for(const n of Kn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function Ai(e){if(!(e instanceof Node))return!1;for(const t of Kn)if(t===e||t.contains(e))return!0;return!1}function Wn(e){(Ai(e.target)||"relatedTarget"in e&&Ai(e.relatedTarget))&&e.stopPropagation()}function sd(){Po||(window.addEventListener("focusin",Wn,!0),window.addEventListener("focusout",Wn,!0),window.addEventListener("pointerdown",Wn,!0),Po=!0),!Gn&&(Gn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&$a()}),Gn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Ht(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Kn.add(e),sd(),$a())}function Ft(e){if(Kn.delete(e),Kn.size===0&&(Gn&&(Gn.disconnect(),Gn=null),Po&&(window.removeEventListener("focusin",Wn,!0),window.removeEventListener("focusout",Wn,!0),window.removeEventListener("pointerdown",Wn,!0),Po=!1),ys=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Os(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Ht(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ft(t),t.remove()}}}const Oa=/^cc-|current-password|new-password/i,id=/token|secret|password|apikey|auth/i,cs="[redacted]";function ad(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Oa.test(t)}function Na(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",cs);const r=n.getAttribute("autocomplete");r&&Oa.test(r)&&n.setAttribute("value",cs);for(const o of Array.from(n.attributes))id.test(o.name)&&n.setAttribute(o.name,cs)}}const cd="🎯 Click any element to capture";let rn=null,Ie=null,Ne=null;function Pr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function ld(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function Ci(e){rn==null||rn.update(e)}function Da(e){const t=za(),n=ed(e),r=td(e);let o;try{const i=e.cloneNode(!0);Na(i),o=i.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Co(e),cssSelector:mo(e),innerTree:Ju(e),outerTree:Qu(e),elementOuterHtml:o,ancestry:n,...r,...t}}function ls(e,t){Ne&&Ne();const n=ld();rn=Os(),Ie=document.createElement("div"),Ie.className="ap-sdk-picker-cursor",Ie.setAttribute("data-ap-sdk","1"),Ie.textContent=n?"Tap any element to preview":cd,document.body.appendChild(Ie),Ht(Ie);let r=null,o=null;const i=p=>{Ne==null||Ne(),e(Da(p),p)},a=p=>{if(o=p,Ci(p),!Ie)return;Ie.classList.add("ap-sdk-picker-cursor--confirm"),Ie.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${p.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),Ne==null||Ne(),t()});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn",_.textContent="⬆ Parent",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const v=document.createElement("button");v.type="button",v.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",v.textContent="✓ Select",v.setAttribute("data-ap-sdk","1"),v.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o&&i(o)}),Ie.appendChild(b),Ie.appendChild(m),Ie.appendChild(_),Ie.appendChild(v)},u=p=>{Pr(p.target)||(r=p.target,Ci(r))},d=p=>{if(Pr(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const b=p.target??r;if(b){if(n){a(b);return}i(b)}},h=p=>{p.key==="Escape"&&(Ne==null||Ne(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),Ne=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),Ie&&Ft(Ie),Ie==null||Ie.remove(),rn==null||rn.destroy(),rn=null,Ie=null,o=null,Ne=null}}function Ns(){Ne==null||Ne()}function Jn(){return Ne!==null}const oo={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function y(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const h=a.prototype,p=Object.keys(h);for(let b=0;b<p.length;b++){const m=p[b];m in u||(u[m]=h[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var d;const h=n!=null&&n.Parent?new i:this;r(h,u),(d=h._zod).deferred??(d.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Yn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ma extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ua={};function on(e){return Ua}function ja(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ws(e,t){return typeof t=="bigint"?t.toString():t}function Go(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ds(e){return e==null}function Ms(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ud(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),u=Number.parseInt(t.toFixed(i).replace(".",""));return a%u/10**i}const Pi=Symbol("evaluating");function Q(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Pi)return r===void 0&&(r=Pi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function an(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ri(e){return JSON.stringify(e)}function dd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Or(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const pd=Go(()=>{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 Qn(e){if(Or(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Or(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qa(e){return Qn(e)?{...e}:Array.isArray(e)?[...e]:e}const hd=new Set(["string","number","symbol"]);function er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function N(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 fd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const gd={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 md(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=an(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return Pn(this,"shape",a),a},checks:[]});return cn(e,i)}function bd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=an(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return Pn(this,"shape",a),a},checks:[]});return cn(e,i)}function kd(e,t){if(!Qn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=an(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Pn(this,"shape",i),i}});return cn(e,o)}function _d(e,t){if(!Qn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Pn(this,"shape",r),r}});return cn(e,n)}function vd(e,t){const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Pn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,n)}function yd(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=an(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const h in n){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(d[h]=e?new e({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)d[h]=e?new e({type:"optional",innerType:u[h]}):u[h];return Pn(this,"shape",d),d},checks:[]});return cn(t,a)}function wd(e,t,n){const r=an(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Pn(this,"shape",i),i}});return cn(t,r)}function qn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Hn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function so(e){return typeof e=="string"?e:e==null?void 0:e.message}function sn(e,t,n){var o,i,a,u,d,h;const r={...e,path:e.path??[]};if(!e.message){const p=so((a=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:a.call(i,e))??so((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??so((d=n.customError)==null?void 0:d.call(n,e))??so((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Us(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Nr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ha=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ws,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Fa=y("$ZodError",Ha),Ba=y("$ZodError",Ha,{Parent:Error});function xd(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Sd(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const js=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Yn;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>sn(d,i,on())));throw Za(u,o==null?void 0:o.callee),u}return a.value},Zs=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>sn(d,i,on())));throw Za(u,o==null?void 0:o.callee),u}return a.value},Wo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Yn;return i.issues.length?{success:!1,error:new(e??Fa)(i.issues.map(a=>sn(a,o,on())))}:{success:!0,data:i.value}},Td=Wo(Ba),Jo=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>sn(a,o,on())))}:{success:!0,data:i.value}},Ed=Jo(Ba),Ad=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return js(e)(t,n,o)},Cd=e=>(t,n,r)=>js(e)(t,n,r),Pd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zs(e)(t,n,o)},Rd=e=>async(t,n,r)=>Zs(e)(t,n,r),Ld=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},Id=e=>(t,n,r)=>Wo(e)(t,n,r),zd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Jo(e)(t,n,o)},$d=e=>async(t,n,r)=>Jo(e)(t,n,r),Od=/^[cC][^\s-]{8,}$/,Nd=/^[0-9a-z]+$/,Dd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Md=/^[0-9a-vA-V]{20}$/,Ud=/^[A-Za-z0-9]{27}$/,jd=/^[a-zA-Z0-9_-]{21}$/,Zd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qd=/^([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})$/,Li=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Fd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Bd(){return new RegExp(Fd,"u")}const Gd=/^(?:(?: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])$/,Wd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Jd=/^((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])$/,Yd=/^(([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])$/,Xd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ga=/^[A-Za-z0-9_-]*$/,Vd=/^\+[1-9]\d{6,14}$/,Wa="(?:(?:\\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])))",Kd=new RegExp(`^${Wa}$`);function Ja(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 Qd(e){return new RegExp(`^${Ja(e)}$`)}function ep(e){const t=Ja({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Wa}T(?:${r})$`)}const tp=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}$`)},np=/^-?\d+$/,Ya=/^-?\d+(?:\.\d+)?$/,rp=/^(?:true|false)$/i,op=/^[^A-Z]*$/,sp=/^[^a-z]*$/,Qe=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xa={number:"number",bigint:"bigint",object:"date"},Va=y("$ZodCheckLessThan",(e,t)=>{Qe.init(e,t);const n=Xa[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ka=y("$ZodCheckGreaterThan",(e,t)=>{Qe.init(e,t);const n=Xa[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ip=y("$ZodCheckMultipleOf",(e,t)=>{Qe.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):ud(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ap=y("$ZodCheckNumberFormat",(e,t)=>{var a;Qe.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=gd[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=i,n&&(d.pattern=np)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>i&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),cp=y("$ZodCheckMaxLength",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ds(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=Us(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lp=y("$ZodCheckMinLength",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ds(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=Us(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),up=y("$ZodCheckLengthEquals",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ds(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const a=Us(o),u=i>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Yo=y("$ZodCheckStringFormat",(e,t)=>{var n,r;Qe.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dp=y("$ZodCheckRegex",(e,t)=>{Yo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=op),Yo.init(e,t)}),hp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sp),Yo.init(e,t)}),fp=y("$ZodCheckIncludes",(e,t)=>{Qe.init(e,t);const n=er(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),gp=y("$ZodCheckStartsWith",(e,t)=>{Qe.init(e,t);const n=new RegExp(`^${er(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),mp=y("$ZodCheckEndsWith",(e,t)=>{Qe.init(e,t);const n=new RegExp(`.*${er(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bp=y("$ZodCheckOverwrite",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class kp{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(`
|
|
1348
1321
|
`).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
1349
|
-
`))}}const
|
|
1322
|
+
`))}}const _p={major:4,minor:3,patch:5},ge=y("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_p;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const a of i._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(u,d,h)=>{let p=qn(u),b;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(p)continue;const _=u.issues.length,v=m._zod.check(u);if(v instanceof Promise&&(h==null?void 0:h.async)===!1)throw new Yn;if(b||v instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await v,u.issues.length!==_&&(p||(p=qn(u,_)))});else{if(u.issues.length===_)continue;p||(p=qn(u,_))}}return b?b.then(()=>u):u},a=(u,d,h)=>{if(qn(u))return u.aborted=!0,u;const p=i(d,r,h);if(p instanceof Promise){if(h.async===!1)throw new Yn;return p.then(b=>e._zod.parse(b,h))}return e._zod.parse(p,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>a(b,u,d)):a(p,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new Yn;return h.then(p=>i(p,r,d))}return i(h,r,d)}}Q(e,"~standard",()=>({validate:i=>{var a;try{const u=Td(e,i);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return Ed(e,i).then(d=>{var h;return d.success?{value:d.data}:{issues:(h=d.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),qs=y("$ZodString",(e,t)=>{var n;ge.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??tp(e._zod.bag),e._zod.parse=(r,o)=>{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}}),me=y("$ZodStringFormat",(e,t)=>{Yo.init(e,t),qs.init(e,t)}),vp=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qd),me.init(e,t)}),yp=y("$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=Li(r))}else t.pattern??(t.pattern=Li());me.init(e,t)}),wp=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hd),me.init(e,t)}),xp=y("$ZodURL",(e,t)=>{me.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Sp=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bd()),me.init(e,t)}),Tp=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jd),me.init(e,t)}),Ep=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Od),me.init(e,t)}),Ap=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nd),me.init(e,t)}),Cp=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Dd),me.init(e,t)}),Pp=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Md),me.init(e,t)}),Rp=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ud),me.init(e,t)}),Lp=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ep(t)),me.init(e,t)}),Ip=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Kd),me.init(e,t)}),zp=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Qd(t)),me.init(e,t)}),$p=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zd),me.init(e,t)}),Op=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gd),me.init(e,t),e._zod.bag.format="ipv4"}),Np=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wd),me.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Dp=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Jd),me.init(e,t)}),Mp=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yd),me.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Qa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Up=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Xd),me.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Qa(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function jp(e){if(!Ga.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qa(n)}const Zp=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ga),me.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{jp(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),qp=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vd),me.init(e,t)});function Hp(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Fp=y("$ZodJWT",(e,t)=>{me.init(e,t),e._zod.check=n=>{Hp(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ec=y("$ZodNumber",(e,t)=>{ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ya,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Bp=y("$ZodNumberFormat",(e,t)=>{ap.init(e,t),ec.init(e,t)}),Gp=y("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=rp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Wp=y("$ZodAny",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Jp=y("$ZodUnknown",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Yp=y("$ZodNever",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ii(e,t,n){e.issues.length&&t.issues.push(...Hn(n,e.issues)),t.value[n]=e.value}const Xp=y("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const u=o[a],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?i.push(d.then(h=>Ii(h,n,a))):Ii(d,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function Ro(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Hn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function tc(e){var r,o,i,a;const t=Object.keys(e.shape);for(const u of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=fd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function nc(e,t,n,r,o,i){const a=[],u=o.keySet,d=o.catchall._zod,h=d.def.type,p=d.optout==="optional";for(const b in t){if(u.has(b))continue;if(h==="never"){a.push(b);continue}const m=d.run({value:t[b],issues:[]},r);m instanceof Promise?e.push(m.then(_=>Ro(_,n,b,t,p))):Ro(m,n,b,t,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Vp=y("$ZodObject",(e,t)=>{ge.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Go(()=>tc(t));Q(e._zod,"propValues",()=>{const u=t.shape,d={};for(const h in u){const p=u[h]._zod;if(p.values){d[h]??(d[h]=new Set);for(const b of p.values)d[h].add(b)}}return d});const o=Or,i=t.catchall;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const h=u.value;if(!o(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value={};const p=[],b=a.shape;for(const m of a.keys){const _=b[m],v=_._zod.optout==="optional",C=_._zod.run({value:h[m],issues:[]},d);C instanceof Promise?p.push(C.then(M=>Ro(M,u,m,h,v))):Ro(C,u,m,h,v)}return i?nc(p,h,u,d,r.value,e):p.length?Promise.all(p).then(()=>u):u}}),Kp=y("$ZodObjectJIT",(e,t)=>{Vp.init(e,t);const n=e._zod.parse,r=Go(()=>tc(t)),o=m=>{var T;const _=new kp(["shape","payload","ctx"]),v=r.value,C=x=>{const R=Ri(x);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};_.write("const input = payload.value;");const M=Object.create(null);let J=0;for(const x of v.keys)M[x]=`key_${J++}`;_.write("const newResult = {};");for(const x of v.keys){const R=M[x],D=Ri(x),de=m[x],_e=((T=de==null?void 0:de._zod)==null?void 0:T.optout)==="optional";_.write(`const ${R} = ${C(x)};`),_e?_.write(`
|
|
1350
1323
|
if (${R}.issues.length) {
|
|
1351
1324
|
if (${D} in input) {
|
|
1352
1325
|
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
@@ -1380,21 +1353,21 @@ button.ap-sdk-list-item__link {
|
|
|
1380
1353
|
newResult[${D}] = ${R}.value;
|
|
1381
1354
|
}
|
|
1382
1355
|
|
|
1383
|
-
`)}_.write("payload.value = newResult;"),_.write("return payload;");const P=_.compile();return(x,R)=>P(m,x,R)};let i;const a=Nr,u=!Oa.jitless,h=u&&Yu.value,p=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const y=m.value;return a(y)?u&&h&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(i||(i=o(t.shape)),m=i(m,_),p?Qa([],y,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Li(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!qn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>sn(a,r,on())))}),t)}const ec=v("$ZodUnion",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Os(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const u=[];for(const d of t.options){const h=d._zod.run({value:o.value,issues:[]},i);if(h instanceof Promise)u.push(h),a=!0;else{if(h.issues.length===0)return h;u.push(h)}}return a?Promise.all(u).then(d=>Li(d,o,e,i)):Li(u,o,e,i)}}),Mp=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ec.init(e,t);const n=e._zod.parse;Q(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const h of d)o[u].add(h)}}return o});const r=Bo(()=>{var a;const o=t.options,i=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const h of d){if(i.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);i.set(h,u)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Nr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Up=v("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([d,h])=>zi(n,d,h)):zi(n,i,a)}});function ys(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Qn(e)&&Qn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=ys(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=ys(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function zi(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const i=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(i.length&&o&&e.issues.push({...o,keys:i}),qn(e))return e;const a=ys(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const jp=v("$ZodRecord",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Qn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Hn(h,b.issues)),n.value[h]=b.value})):(p.issues.length&&n.issues.push(...Hn(h,p.issues)),n.value[h]=p.value)}let d;for(const h in o)u.has(h)||(d=d??[],d.push(h));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Ga.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>sn(b,r,on())),input:u,path:[u],inst:e});continue}const p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Hn(u,b.issues)),n.value[d.value]=b.value})):(p.issues.length&&n.issues.push(...Hn(u,p.issues)),n.value[d.value]=p.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Zp=v("$ZodEnum",(e,t)=>{ge.init(e,t);const n=Da(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ku.has(typeof o)).map(o=>typeof o=="string"?er(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),qp=v("$ZodLiteral",(e,t)=>{if(ge.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?er(r):r?er(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Hp=v("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Na(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Xn;return n.value=o,n}});function Ii(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const tc=v("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Os(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ii(i,n.value)):Ii(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Fp=v("$ZodExactOptional",(e,t)=>{tc.init(e,t),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Bp=v("$ZodNullable",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Os(n.source)}|null)$`):void 0}),Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Gp=v("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>$i(i,t)):$i(o,t)}});function $i(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Wp=v("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Jp=v("$ZodNonOptional",(e,t)=>{ge.init(e,t),Q(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ni(i,e)):Ni(o,e)}});function Ni(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Xp=v("$ZodCatch",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>sn(a,r,on()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>sn(i,r,on()))},input:n.value}),n.issues=[]),n)}}),Vp=v("$ZodPipe",(e,t)=>{ge.init(e,t),Q(e._zod,"values",()=>t.in._zod.values),Q(e._zod,"optin",()=>t.in._zod.optin),Q(e._zod,"optout",()=>t.out._zod.optout),Q(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>so(a,t.in,r)):so(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>so(i,t.out,r)):so(o,t.out,r)}});function so(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Yp=v("$ZodReadonly",(e,t)=>{ge.init(e,t),Q(e._zod,"propValues",()=>t.innerType._zod.propValues),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Q(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Oi):Oi(o)}});function Oi(e){return e.value=Object.freeze(e.value),e}const Kp=v("$ZodCustom",(e,t)=>{et.init(e,t),ge.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Di(i,n,r,e));Di(o,n,r,e)}});function Di(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Or(o))}}var Mi;class Qp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function eh(){return new Qp}(Mi=globalThis).__zod_globalRegistry??(Mi.__zod_globalRegistry=eh());const Ar=globalThis.__zod_globalRegistry;function th(e,t){return new e({type:"string",...O(t)})}function nh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Ui(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function rh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function oh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function sh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function ih(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function ah(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function ch(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function lh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function uh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function dh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function ph(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function hh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function fh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function gh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function mh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function bh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function kh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function _h(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function vh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function yh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function wh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function xh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Sh(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Th(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Eh(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function Ah(e,t){return new e({type:"number",checks:[],...O(t)})}function Ch(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Ph(e,t){return new e({type:"boolean",...O(t)})}function Rh(e){return new e({type:"any"})}function Lh(e){return new e({type:"unknown"})}function zh(e,t){return new e({type:"never",...O(t)})}function ji(e,t){return new Ja({check:"less_than",...O(t),value:e,inclusive:!1})}function ls(e,t){return new Ja({check:"less_than",...O(t),value:e,inclusive:!0})}function Zi(e,t){return new Xa({check:"greater_than",...O(t),value:e,inclusive:!1})}function us(e,t){return new Xa({check:"greater_than",...O(t),value:e,inclusive:!0})}function qi(e,t){return new Bd({check:"multiple_of",...O(t),value:e})}function nc(e,t){return new Wd({check:"max_length",...O(t),maximum:e})}function Lo(e,t){return new Jd({check:"min_length",...O(t),minimum:e})}function rc(e,t){return new Xd({check:"length_equals",...O(t),length:e})}function Ih(e,t){return new Vd({check:"string_format",format:"regex",...O(t),pattern:e})}function $h(e){return new Yd({check:"string_format",format:"lowercase",...O(e)})}function Nh(e){return new Kd({check:"string_format",format:"uppercase",...O(e)})}function Oh(e,t){return new Qd({check:"string_format",format:"includes",...O(t),includes:e})}function Dh(e,t){return new ep({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Mh(e,t){return new tp({check:"string_format",format:"ends_with",...O(t),suffix:e})}function or(e){return new np({check:"overwrite",tx:e})}function Uh(e){return or(t=>t.normalize(e))}function jh(){return or(e=>e.trim())}function Zh(){return or(e=>e.toLowerCase())}function qh(){return or(e=>e.toUpperCase())}function Hh(){return or(e=>Vu(e))}function Fh(e,t,n){return new e({type:"array",element:t,...O(n)})}function Bh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function Gh(e){const t=Wh(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Or(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Or(o))}},e(n.value,n)));return t}function Wh(e,t){const n=new et({check:"custom",...O(t)});return n._zod.check=e,n}function oc(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Ar,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Te(e,t,n={path:[],schemaPath:[]}){var p,b;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(b=(p=e._zod).toJSONSchema)==null?void 0:b.call(p);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const y=a.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,y,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),Te(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&Ge(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function sc(e,t){var a,u,d,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of e.seen.entries()){const b=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(b){const m=r.get(b);if(m&&m!==p[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,p[0])}}const o=p=>{var C;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const M=(C=e.external.registry.get(p[0]))==null?void 0:C.id,J=e.external.uri??(T=>T);if(M)return{ref:J(M)};const P=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=P,{defId:P,ref:`${J("__shared")}#/${b}/${P}`}}if(p[1]===n)return{ref:"#"};const _=`#/${b}/`,y=p[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:_+y}},i=p=>{if(p[1].schema.$ref)return;const b=p[1],{ref:m,defId:_}=o(p);b.def={...b.schema},_&&(b.defId=_);const y=b.schema;for(const C in y)delete y[C];y.$ref=m};if(e.cycles==="throw")for(const p of e.seen.entries()){const b=p[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
|
|
1356
|
+
`)}_.write("payload.value = newResult;"),_.write("return payload;");const P=_.compile();return(x,R)=>P(m,x,R)};let i;const a=Or,u=!Ua.jitless,h=u&&pd.value,p=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const v=m.value;return a(v)?u&&h&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(i||(i=o(t.shape)),m=i(m,_),p?nc([],v,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m)}});function zi(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!qn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>sn(a,r,on())))}),t)}const rc=y("$ZodUnion",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ms(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const u=[];for(const d of t.options){const h=d._zod.run({value:o.value,issues:[]},i);if(h instanceof Promise)u.push(h),a=!0;else{if(h.issues.length===0)return h;u.push(h)}}return a?Promise.all(u).then(d=>zi(d,o,e,i)):zi(u,o,e,i)}}),Qp=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rc.init(e,t);const n=e._zod.parse;Q(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const h of d)o[u].add(h)}}return o});const r=Go(()=>{var a;const o=t.options,i=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const h of d){if(i.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);i.set(h,u)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Or(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),eh=y("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([d,h])=>$i(n,d,h)):$i(n,i,a)}});function xs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Qn(e)&&Qn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=xs(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=xs(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $i(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const i=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(i.length&&o&&e.issues.push({...o,keys:i}),qn(e))return e;const a=xs(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const th=y("$ZodRecord",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Qn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Hn(h,b.issues)),n.value[h]=b.value})):(p.issues.length&&n.issues.push(...Hn(h,p.issues)),n.value[h]=p.value)}let d;for(const h in o)u.has(h)||(d=d??[],d.push(h));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Ya.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>sn(b,r,on())),input:u,path:[u],inst:e});continue}const p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Hn(u,b.issues)),n.value[d.value]=b.value})):(p.issues.length&&n.issues.push(...Hn(u,p.issues)),n.value[d.value]=p.value)}}return i.length?Promise.all(i).then(()=>n):n}}),nh=y("$ZodEnum",(e,t)=>{ge.init(e,t);const n=ja(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>hd.has(typeof o)).map(o=>typeof o=="string"?er(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),rh=y("$ZodLiteral",(e,t)=>{if(ge.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?er(r):r?er(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),oh=y("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ma(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Yn;return n.value=o,n}});function Oi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const oc=y("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ms(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Oi(i,n.value)):Oi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),sh=y("$ZodExactOptional",(e,t)=>{oc.init(e,t),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ih=y("$ZodNullable",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ms(n.source)}|null)$`):void 0}),Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),ah=y("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ni(i,t)):Ni(o,t)}});function Ni(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ch=y("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),lh=y("$ZodNonOptional",(e,t)=>{ge.init(e,t),Q(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Di(i,e)):Di(o,e)}});function Di(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const uh=y("$ZodCatch",(e,t)=>{ge.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>sn(a,r,on()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>sn(i,r,on()))},input:n.value}),n.issues=[]),n)}}),dh=y("$ZodPipe",(e,t)=>{ge.init(e,t),Q(e._zod,"values",()=>t.in._zod.values),Q(e._zod,"optin",()=>t.in._zod.optin),Q(e._zod,"optout",()=>t.out._zod.optout),Q(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>io(a,t.in,r)):io(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>io(i,t.out,r)):io(o,t.out,r)}});function io(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ph=y("$ZodReadonly",(e,t)=>{ge.init(e,t),Q(e._zod,"propValues",()=>t.innerType._zod.propValues),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Q(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Mi):Mi(o)}});function Mi(e){return e.value=Object.freeze(e.value),e}const hh=y("$ZodCustom",(e,t)=>{Qe.init(e,t),ge.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Ui(i,n,r,e));Ui(o,n,r,e)}});function Ui(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Nr(o))}}var ji;class fh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function gh(){return new fh}(ji=globalThis).__zod_globalRegistry??(ji.__zod_globalRegistry=gh());const Ar=globalThis.__zod_globalRegistry;function mh(e,t){return new e({type:"string",...N(t)})}function bh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...N(t)})}function Zi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...N(t)})}function kh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...N(t)})}function _h(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(t)})}function vh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(t)})}function yh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(t)})}function wh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...N(t)})}function xh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...N(t)})}function Sh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(t)})}function Th(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...N(t)})}function Eh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(t)})}function Ah(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...N(t)})}function Ch(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...N(t)})}function Ph(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(t)})}function Rh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(t)})}function Lh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(t)})}function Ih(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(t)})}function zh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(t)})}function $h(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...N(t)})}function Oh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...N(t)})}function Nh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...N(t)})}function Dh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...N(t)})}function Mh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(t)})}function Uh(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function jh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function Zh(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function qh(e,t){return new e({type:"number",checks:[],...N(t)})}function Hh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...N(t)})}function Fh(e,t){return new e({type:"boolean",...N(t)})}function Bh(e){return new e({type:"any"})}function Gh(e){return new e({type:"unknown"})}function Wh(e,t){return new e({type:"never",...N(t)})}function qi(e,t){return new Va({check:"less_than",...N(t),value:e,inclusive:!1})}function us(e,t){return new Va({check:"less_than",...N(t),value:e,inclusive:!0})}function Hi(e,t){return new Ka({check:"greater_than",...N(t),value:e,inclusive:!1})}function ds(e,t){return new Ka({check:"greater_than",...N(t),value:e,inclusive:!0})}function Fi(e,t){return new ip({check:"multiple_of",...N(t),value:e})}function sc(e,t){return new cp({check:"max_length",...N(t),maximum:e})}function Lo(e,t){return new lp({check:"min_length",...N(t),minimum:e})}function ic(e,t){return new up({check:"length_equals",...N(t),length:e})}function Jh(e,t){return new dp({check:"string_format",format:"regex",...N(t),pattern:e})}function Yh(e){return new pp({check:"string_format",format:"lowercase",...N(e)})}function Xh(e){return new hp({check:"string_format",format:"uppercase",...N(e)})}function Vh(e,t){return new fp({check:"string_format",format:"includes",...N(t),includes:e})}function Kh(e,t){return new gp({check:"string_format",format:"starts_with",...N(t),prefix:e})}function Qh(e,t){return new mp({check:"string_format",format:"ends_with",...N(t),suffix:e})}function or(e){return new bp({check:"overwrite",tx:e})}function ef(e){return or(t=>t.normalize(e))}function tf(){return or(e=>e.trim())}function nf(){return or(e=>e.toLowerCase())}function rf(){return or(e=>e.toUpperCase())}function of(){return or(e=>dd(e))}function sf(e,t,n){return new e({type:"array",element:t,...N(n)})}function af(e,t,n){return new e({type:"custom",check:"custom",fn:t,...N(n)})}function cf(e){const t=lf(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Nr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Nr(o))}},e(n.value,n)));return t}function lf(e,t){const n=new Qe({check:"custom",...N(t)});return n._zod.check=e,n}function ac(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Ar,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Te(e,t,n={path:[],schemaPath:[]}){var p,b;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(b=(p=e._zod).toJSONSchema)==null?void 0:b.call(p);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const v=a.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,v,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),Te(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&Ge(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function cc(e,t){var a,u,d,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of e.seen.entries()){const b=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(b){const m=r.get(b);if(m&&m!==p[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,p[0])}}const o=p=>{var C;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const M=(C=e.external.registry.get(p[0]))==null?void 0:C.id,J=e.external.uri??(T=>T);if(M)return{ref:J(M)};const P=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=P,{defId:P,ref:`${J("__shared")}#/${b}/${P}`}}if(p[1]===n)return{ref:"#"};const _=`#/${b}/`,v=p[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:_+v}},i=p=>{if(p[1].schema.$ref)return;const b=p[1],{ref:m,defId:_}=o(p);b.def={...b.schema},_&&(b.defId=_);const v=b.schema;for(const C in v)delete v[C];v.$ref=m};if(e.cycles==="throw")for(const p of e.seen.entries()){const b=p[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
|
|
1384
1357
|
|
|
1385
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const b=p[1];if(t===p[0]){i(p);continue}if(e.external){const _=(d=e.external.registry.get(p[0]))==null?void 0:d.id;if(t!==p[0]&&_){i(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){i(p);continue}if(b.cycle){i(p);continue}if(b.count>1&&e.reused==="ref"){i(p);continue}}}function ic(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const p=e.seen.get(h);if(p.ref===null)return;const b=p.def??p.schema,m={...b},_=p.ref;if(p.ref=null,_){r(_);const C=e.seen.get(_),M=C.schema;if(M.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(M)):Object.assign(b,M),Object.assign(b,m),h._zod.parent===_)for(const P in b)P==="$ref"||P==="allOf"||P in m||delete b[P];if(M.$ref)for(const P in b)P==="$ref"||P==="allOf"||P in C.def&&JSON.stringify(b[P])===JSON.stringify(C.def[P])&&delete b[P]}const y=h._zod.parent;if(y&&y!==_){r(y);const C=e.seen.get(y);if(C!=null&&C.schema.$ref&&(b.$ref=C.schema.$ref,C.def))for(const M in b)M==="$ref"||M==="allOf"||M in C.def&&JSON.stringify(b[M])===JSON.stringify(C.def[M])&&delete b[M]}e.override({zodSchema:h,jsonSchema:b,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const i=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(i[p.defId]=p.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:zo(t,"input",e.processors),output:zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Ge(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ge(r.element,n);if(r.type==="set")return Ge(r.valueType,n);if(r.type==="lazy")return Ge(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ge(r.innerType,n);if(r.type==="intersection")return Ge(r.left,n)||Ge(r.right,n);if(r.type==="record"||r.type==="map")return Ge(r.keyType,n)||Ge(r.valueType,n);if(r.type==="pipe")return Ge(r.in,n)||Ge(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ge(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ge(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ge(o,n))return!0;return!!(r.rest&&Ge(r.rest,n))}return!1}const Jh=(e,t={})=>n=>{const r=oc({...n,processors:t});return Te(e,r),sc(r,e),ic(r,e)},zo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=oc({...o??{},target:i,io:t,processors:n});return Te(e,a),sc(a,e),ic(a,e)},Xh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vh=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:u,patterns:d,contentEncoding:h}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Xh[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),h&&(o.contentEncoding=h),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},Yh=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:u,multipleOf:d,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof i=="number"&&(o.minimum=i,typeof p=="number"&&t.target!=="draft-04"&&(p>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},Kh=(e,t,n,r)=>{n.type="boolean"},Qh=(e,t,n,r)=>{n.not={}},ef=(e,t,n,r)=>{},tf=(e,t,n,r)=>{},nf=(e,t,n,r)=>{const o=e._zod.def,i=Da(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},rf=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},of=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},sf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},af=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=Te(i.element,t,{...r,path:[...r.path,"items"]})},cf=(e,t,n,r)=>{var h;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const p in a)o.properties[p]=Te(a[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(p=>{const b=i.shape[p]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((h=i.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Te(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},lf=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((u,d)=>Te(u,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));i?n.oneOf=a:n.anyOf=a},uf=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Te(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,d=[...u(i)?i.allOf:[i],...u(a)?a.allOf:[a]];n.allOf=d},df=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(i.mode==="loose"&&d&&d.size>0){const p=Te(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Te(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Te(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(b=>typeof b=="string"||typeof b=="number");p.length>0&&(o.required=p)}},pf=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},hf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},ff=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},gf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},mf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},bf=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Te(i,t,r);const a=t.seen.get(e);a.ref=i},kf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ac=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},_f=v("ZodISODateTime",(e,t)=>{mp.init(e,t),ke.init(e,t)});function vf(e){return xh(_f,e)}const yf=v("ZodISODate",(e,t)=>{bp.init(e,t),ke.init(e,t)});function wf(e){return Sh(yf,e)}const xf=v("ZodISOTime",(e,t)=>{kp.init(e,t),ke.init(e,t)});function Sf(e){return Th(xf,e)}const Tf=v("ZodISODuration",(e,t)=>{_p.init(e,t),ke.init(e,t)});function Ef(e){return Eh(Tf,e)}const Af=(e,t)=>{Za.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ld(e,n)},flatten:{value:n=>cd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,vs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,vs,2)}},isEmpty:{get(){return e.issues.length===0}}})},dt=v("ZodError",Af,{Parent:Error}),Cf=Ms(dt),Pf=Us(dt),Rf=Go(dt),Lf=Wo(dt),zf=pd(dt),If=hd(dt),$f=fd(dt),Nf=gd(dt),Of=md(dt),Df=bd(dt),Mf=kd(dt),Uf=_d(dt),be=v("ZodType",(e,t)=>(ge.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:zo(e,"input"),output:zo(e,"output")}}),e.toJSONSchema=Jh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(an(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>cn(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>Cf(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Rf(e,n,r),e.parseAsync=async(n,r)=>Pf(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Lf(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>zf(e,n,r),e.decode=(n,r)=>If(e,n,r),e.encodeAsync=async(n,r)=>$f(e,n,r),e.decodeAsync=async(n,r)=>Nf(e,n,r),e.safeEncode=(n,r)=>Of(e,n,r),e.safeDecode=(n,r)=>Df(e,n,r),e.safeEncodeAsync=async(n,r)=>Mf(e,n,r),e.safeDecodeAsync=async(n,r)=>Uf(e,n,r),e.refine=(n,r)=>e.check($g(n,r)),e.superRefine=n=>e.check(Ng(n)),e.overwrite=n=>e.check(or(n)),e.optional=()=>Gi(e),e.exactOptional=()=>yg(e),e.nullable=()=>Wi(e),e.nullish=()=>Gi(Wi(e)),e.nonoptional=n=>Ag(e,n),e.array=()=>vt(e),e.or=n=>pg([e,n]),e.and=n=>gg(e,n),e.transform=n=>Ji(e,_g(n)),e.default=n=>Sg(e,n),e.prefault=n=>Eg(e,n),e.catch=n=>Pg(e,n),e.pipe=n=>Ji(e,n),e.readonly=()=>zg(e),e.describe=n=>{const r=e.clone();return Ar.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Ar.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Ar.get(e);const r=e.clone();return Ar.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),cc=v("_ZodString",(e,t)=>{js.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Vh(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Ih(...r)),e.includes=(...r)=>e.check(Oh(...r)),e.startsWith=(...r)=>e.check(Dh(...r)),e.endsWith=(...r)=>e.check(Mh(...r)),e.min=(...r)=>e.check(Lo(...r)),e.max=(...r)=>e.check(nc(...r)),e.length=(...r)=>e.check(rc(...r)),e.nonempty=(...r)=>e.check(Lo(1,...r)),e.lowercase=r=>e.check($h(r)),e.uppercase=r=>e.check(Nh(r)),e.trim=()=>e.check(jh()),e.normalize=(...r)=>e.check(Uh(...r)),e.toLowerCase=()=>e.check(Zh()),e.toUpperCase=()=>e.check(qh()),e.slugify=()=>e.check(Hh())}),jf=v("ZodString",(e,t)=>{js.init(e,t),cc.init(e,t),e.email=n=>e.check(nh(Zf,n)),e.url=n=>e.check(ah(qf,n)),e.jwt=n=>e.check(wh(rg,n)),e.emoji=n=>e.check(ch(Hf,n)),e.guid=n=>e.check(Ui(Hi,n)),e.uuid=n=>e.check(rh(io,n)),e.uuidv4=n=>e.check(oh(io,n)),e.uuidv6=n=>e.check(sh(io,n)),e.uuidv7=n=>e.check(ih(io,n)),e.nanoid=n=>e.check(lh(Ff,n)),e.guid=n=>e.check(Ui(Hi,n)),e.cuid=n=>e.check(uh(Bf,n)),e.cuid2=n=>e.check(dh(Gf,n)),e.ulid=n=>e.check(ph(Wf,n)),e.base64=n=>e.check(_h(eg,n)),e.base64url=n=>e.check(vh(tg,n)),e.xid=n=>e.check(hh(Jf,n)),e.ksuid=n=>e.check(fh(Xf,n)),e.ipv4=n=>e.check(gh(Vf,n)),e.ipv6=n=>e.check(mh(Yf,n)),e.cidrv4=n=>e.check(bh(Kf,n)),e.cidrv6=n=>e.check(kh(Qf,n)),e.e164=n=>e.check(yh(ng,n)),e.datetime=n=>e.check(vf(n)),e.date=n=>e.check(wf(n)),e.time=n=>e.check(Sf(n)),e.duration=n=>e.check(Ef(n))});function A(e){return th(jf,e)}const ke=v("ZodStringFormat",(e,t)=>{me.init(e,t),cc.init(e,t)}),Zf=v("ZodEmail",(e,t)=>{ap.init(e,t),ke.init(e,t)}),Hi=v("ZodGUID",(e,t)=>{sp.init(e,t),ke.init(e,t)}),io=v("ZodUUID",(e,t)=>{ip.init(e,t),ke.init(e,t)}),qf=v("ZodURL",(e,t)=>{cp.init(e,t),ke.init(e,t)}),Hf=v("ZodEmoji",(e,t)=>{lp.init(e,t),ke.init(e,t)}),Ff=v("ZodNanoID",(e,t)=>{up.init(e,t),ke.init(e,t)}),Bf=v("ZodCUID",(e,t)=>{dp.init(e,t),ke.init(e,t)}),Gf=v("ZodCUID2",(e,t)=>{pp.init(e,t),ke.init(e,t)}),Wf=v("ZodULID",(e,t)=>{hp.init(e,t),ke.init(e,t)}),Jf=v("ZodXID",(e,t)=>{fp.init(e,t),ke.init(e,t)}),Xf=v("ZodKSUID",(e,t)=>{gp.init(e,t),ke.init(e,t)}),Vf=v("ZodIPv4",(e,t)=>{vp.init(e,t),ke.init(e,t)}),Yf=v("ZodIPv6",(e,t)=>{yp.init(e,t),ke.init(e,t)}),Kf=v("ZodCIDRv4",(e,t)=>{wp.init(e,t),ke.init(e,t)}),Qf=v("ZodCIDRv6",(e,t)=>{xp.init(e,t),ke.init(e,t)}),eg=v("ZodBase64",(e,t)=>{Sp.init(e,t),ke.init(e,t)}),tg=v("ZodBase64URL",(e,t)=>{Ep.init(e,t),ke.init(e,t)}),ng=v("ZodE164",(e,t)=>{Ap.init(e,t),ke.init(e,t)}),rg=v("ZodJWT",(e,t)=>{Pp.init(e,t),ke.init(e,t)}),lc=v("ZodNumber",(e,t)=>{Ya.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Yh(e,r,o),e.gt=(r,o)=>e.check(Zi(r,o)),e.gte=(r,o)=>e.check(us(r,o)),e.min=(r,o)=>e.check(us(r,o)),e.lt=(r,o)=>e.check(ji(r,o)),e.lte=(r,o)=>e.check(ls(r,o)),e.max=(r,o)=>e.check(ls(r,o)),e.int=r=>e.check(Fi(r)),e.safe=r=>e.check(Fi(r)),e.positive=r=>e.check(Zi(0,r)),e.nonnegative=r=>e.check(us(0,r)),e.negative=r=>e.check(ji(0,r)),e.nonpositive=r=>e.check(ls(0,r)),e.multipleOf=(r,o)=>e.check(qi(r,o)),e.step=(r,o)=>e.check(qi(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Rt(e){return Ah(lc,e)}const og=v("ZodNumberFormat",(e,t)=>{Rp.init(e,t),lc.init(e,t)});function Fi(e){return Ch(og,e)}const sg=v("ZodBoolean",(e,t)=>{Lp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kh(e,n,r)});function he(e){return Ph(sg,e)}const ig=v("ZodAny",(e,t)=>{zp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ef()});function uc(){return Rh(ig)}const ag=v("ZodUnknown",(e,t)=>{Ip.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tf()});function Bi(){return Lh(ag)}const cg=v("ZodNever",(e,t)=>{$p.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qh(e,n,r)});function lg(e){return zh(cg,e)}const ug=v("ZodArray",(e,t)=>{Np.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>af(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Lo(n,r)),e.nonempty=n=>e.check(Lo(1,n)),e.max=(n,r)=>e.check(nc(n,r)),e.length=(n,r)=>e.check(rc(n,r)),e.unwrap=()=>e.element});function vt(e,t){return Fh(ug,e,t)}const dg=v("ZodObject",(e,t)=>{Dp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cf(e,n,r,o),Q(e,"shape",()=>t.shape),e.keyof=()=>ct(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bi()}),e.strict=()=>e.clone({...e._zod.def,catchall:lg()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>rd(e,n),e.safeExtend=n=>od(e,n),e.merge=n=>sd(e,n),e.pick=n=>td(e,n),e.omit=n=>nd(e,n),e.partial=(...n)=>id(hc,e,n[0]),e.required=(...n)=>ad(fc,e,n[0])});function pe(e,t){const n={type:"object",shape:e??{},...O(t)};return new dg(n)}const dc=v("ZodUnion",(e,t)=>{ec.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.options=t.options});function pg(e,t){return new dc({type:"union",options:e,...O(t)})}const hg=v("ZodDiscriminatedUnion",(e,t)=>{dc.init(e,t),Mp.init(e,t)});function pc(e,t,n){return new hg({type:"union",options:t,discriminator:e,...O(n)})}const fg=v("ZodIntersection",(e,t)=>{Up.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uf(e,n,r,o)});function gg(e,t){return new fg({type:"intersection",left:e,right:t})}const mg=v("ZodRecord",(e,t)=>{jp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>df(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function At(e,t,n){return new mg({type:"record",keyType:e,valueType:t,...O(n)})}const ws=v("ZodEnum",(e,t)=>{Zp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>nf(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws({...t,checks:[],...O(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws({...t,checks:[],...O(o),entries:i})}});function ct(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws({type:"enum",entries:n,...O(t)})}const bg=v("ZodLiteral",(e,t)=>{qp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rf(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function at(e,t){return new bg({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const kg=v("ZodTransform",(e,t)=>{Hp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Na(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Or(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Or(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function _g(e){return new kg({type:"transform",transform:e})}const hc=v("ZodOptional",(e,t)=>{tc.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gi(e){return new hc({type:"optional",innerType:e})}const vg=v("ZodExactOptional",(e,t)=>{Fp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yg(e){return new vg({type:"optional",innerType:e})}const wg=v("ZodNullable",(e,t)=>{Bp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Wi(e){return new wg({type:"nullable",innerType:e})}const xg=v("ZodDefault",(e,t)=>{Gp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sg(e,t){return new xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ua(t)}})}const Tg=v("ZodPrefault",(e,t)=>{Wp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e,t){return new Tg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ua(t)}})}const fc=v("ZodNonOptional",(e,t)=>{Jp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ag(e,t){return new fc({type:"nonoptional",innerType:e,...O(t)})}const Cg=v("ZodCatch",(e,t)=>{Xp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pg(e,t){return new Cg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Rg=v("ZodPipe",(e,t)=>{Vp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bf(e,n,r,o),e.in=t.in,e.out=t.out});function Ji(e,t){return new Rg({type:"pipe",in:e,out:t})}const Lg=v("ZodReadonly",(e,t)=>{Yp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zg(e){return new Lg({type:"readonly",innerType:e})}const Ig=v("ZodCustom",(e,t)=>{Kp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>of(e,n)});function $g(e,t={}){return Bh(Ig,e,t)}function Ng(e){return Gh(e)}const Og=pe({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:vt(A()).optional(),failOnError:he().default(!0).optional(),timeout:Rt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:At(A(),A()).optional(),runOnBackground:he().optional()});pe({name:A(),command:A(),success:he(),exitCode:Rt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:Rt(),failOnError:he()});const bn=pe({path:A(),extraCommands:vt(Og).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:ct(["free","in_use"]).optional()}),Dg=pc("operation",[bn.extend({operation:at("create"),content:A().optional(),contentPath:A().optional(),encoding:ct(["utf-8","base64"]).optional()}),bn.extend({operation:at("merge"),data:At(A(),uc()),mergeStrategy:ct(["deep","shallow"]).optional(),arrayMergeStrategy:ct(["concat","replace"]).optional()}),bn.extend({operation:at("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:he().optional()}),bn.extend({operation:at("delete"),ignoreIfMissing:he().optional()}),bn.extend({operation:at("createDirectory"),contentPath:A().optional(),mode:Rt().optional(),ignoreIfExists:he().optional()}),bn.extend({operation:at("download"),url:A().url(),headers:At(A(),A()).optional(),timeout:Rt().min(1e3).max(3e5).optional()}),bn.extend({operation:at("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const Mg=pe({type:ct(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:pe({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),Ug=pe({type:ct(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:uc().describe("Hook-specific configuration")});pe({command:A().optional().describe("Legacy — unused in SDK mode"),args:vt(A()).optional().describe("Legacy — unused in SDK mode"),env:At(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:vt(Dg).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:Mg.optional().describe("Schema for extracting result data"),postExecutionHooks:vt(Ug).optional().describe("Hooks to run after task completion"),executionMode:ct(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:pc("executionMode",[pe({executionMode:at("claudeAgentSdk"),promptText:A(),sdkOptions:pe({model:A(),permissionMode:ct(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:vt(A()),allowDangerouslySkipPermissions:he(),persistSession:he(),streamSdkEvents:he().optional(),allowedTools:vt(A()).optional(),settings:pe({enabledPlugins:At(A(),he())}),env:At(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("opencodeSdk"),promptText:A(),sdkOptions:pe({provider:A(),model:A(),allowedTools:vt(A()).optional(),env:At(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("openaiAgentSdk"),promptText:A(),sdkOptions:pe({model:A(),env:At(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("codexSdk"),promptText:A(),sdkOptions:pe({model:A().optional(),sandboxMode:ct(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ct(["never","on-request","on-failure","untrusted"]).optional(),env:At(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("cursorSdk"),promptText:A(),sdkOptions:pe({model:A(),env:At(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:he().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:he().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:he().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:vt(pe({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Rt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:Rt().optional(),notificationChannelFailedMessageId:Rt().optional(),streamSdkEvents:he().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:he().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:vt(pe({id:A(),selectedText:A(),startOffset:Rt(),endOffset:Rt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:he().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:he().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ct(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:he().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const gc="browser_capture",jg="browser_automate";async function mc(e){if(!e.ok){const t=await e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()}async function Ze(e,t,n,r){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await fetch(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return mc(a)}async function bc(e,t){return Ze(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function xs(e,t,n,r,o,i,a=gc,u){var d,h,p,b,m,_;return Ze(e,"POST","/tasks",{type:a,title:i||n.slice(0,120)||r.pageTitle||"Browser capture",titleInstruction:u??n,projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(d=o==null?void 0:o.selectedPluginIds)!=null&&d.length?{selectedPluginIds:o.selectedPluginIds}:{},...(h=o==null?void 0:o.selectedSkillIds)!=null&&h.length?{selectedSkillIds:o.selectedSkillIds}:{},...(p=o==null?void 0:o.selectedPluginSkillIds)!=null&&p.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(b=o==null?void 0:o.selectedMcpServerIds)!=null&&b.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(m=o==null?void 0:o.selectedSlashCommandIds)!=null&&m.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(_=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&_.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:a,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt,interactionSteps:r.interactionSteps}})}async function Xi(e,t,n,r,o,i,a){return xs(e,t,n,r,o,i,jg,a)}async function Vi(e,t,n,r){return Ze(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function Zg(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ze(e,"GET",`/claude-templates${n}`)}async function kc(e,t){return Ze(e,"GET",`/tasks/${t}`)}async function qg(e,t){return Ze(e,"GET",`/planning-sessions/${t}`)}async function Yi(e){return Ze(e,"GET","/projects")}async function Ki(e,t,n){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return mc(i)}async function Hg(e,t){return Ze(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function Fg(e,t,n,r,o){return Ze(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Bg(e,t){return Ze(e,"GET",`/tasks/${t}/chunks`)}async function Gg(e,t,n){return Ze(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Wg(e,t){return Ze(e,"POST",`/tasks/${t}/cancel`)}async function Jg(e,t){return Ze(e,"POST",`/tasks/${t}/approve-result`)}async function Xg(e,t,n){return Ze(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function Io(e,t){return Ze(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function _c(e,t,n,r){return Ze(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}function Vg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vc={exports:{}};/*!
|
|
1358
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const b=p[1];if(t===p[0]){i(p);continue}if(e.external){const _=(d=e.external.registry.get(p[0]))==null?void 0:d.id;if(t!==p[0]&&_){i(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){i(p);continue}if(b.cycle){i(p);continue}if(b.count>1&&e.reused==="ref"){i(p);continue}}}function lc(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const p=e.seen.get(h);if(p.ref===null)return;const b=p.def??p.schema,m={...b},_=p.ref;if(p.ref=null,_){r(_);const C=e.seen.get(_),M=C.schema;if(M.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(M)):Object.assign(b,M),Object.assign(b,m),h._zod.parent===_)for(const P in b)P==="$ref"||P==="allOf"||P in m||delete b[P];if(M.$ref)for(const P in b)P==="$ref"||P==="allOf"||P in C.def&&JSON.stringify(b[P])===JSON.stringify(C.def[P])&&delete b[P]}const v=h._zod.parent;if(v&&v!==_){r(v);const C=e.seen.get(v);if(C!=null&&C.schema.$ref&&(b.$ref=C.schema.$ref,C.def))for(const M in b)M==="$ref"||M==="allOf"||M in C.def&&JSON.stringify(b[M])===JSON.stringify(C.def[M])&&delete b[M]}e.override({zodSchema:h,jsonSchema:b,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const i=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(i[p.defId]=p.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Io(t,"input",e.processors),output:Io(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Ge(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ge(r.element,n);if(r.type==="set")return Ge(r.valueType,n);if(r.type==="lazy")return Ge(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ge(r.innerType,n);if(r.type==="intersection")return Ge(r.left,n)||Ge(r.right,n);if(r.type==="record"||r.type==="map")return Ge(r.keyType,n)||Ge(r.valueType,n);if(r.type==="pipe")return Ge(r.in,n)||Ge(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ge(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ge(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ge(o,n))return!0;return!!(r.rest&&Ge(r.rest,n))}return!1}const uf=(e,t={})=>n=>{const r=ac({...n,processors:t});return Te(e,r),cc(r,e),lc(r,e)},Io=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=ac({...o??{},target:i,io:t,processors:n});return Te(e,a),cc(a,e),lc(a,e)},df={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pf=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:u,patterns:d,contentEncoding:h}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),u&&(o.format=df[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),h&&(o.contentEncoding=h),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},hf=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:u,multipleOf:d,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof i=="number"&&(o.minimum=i,typeof p=="number"&&t.target!=="draft-04"&&(p>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},ff=(e,t,n,r)=>{n.type="boolean"},gf=(e,t,n,r)=>{n.not={}},mf=(e,t,n,r)=>{},bf=(e,t,n,r)=>{},kf=(e,t,n,r)=>{const o=e._zod.def,i=ja(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},_f=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},vf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wf=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=Te(i.element,t,{...r,path:[...r.path,"items"]})},xf=(e,t,n,r)=>{var h;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const p in a)o.properties[p]=Te(a[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(p=>{const b=i.shape[p]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((h=i.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Te(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Sf=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((u,d)=>Te(u,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));i?n.oneOf=a:n.anyOf=a},Tf=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Te(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,d=[...u(i)?i.allOf:[i],...u(a)?a.allOf:[a]];n.allOf=d},Ef=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(i.mode==="loose"&&d&&d.size>0){const p=Te(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Te(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Te(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(b=>typeof b=="string"||typeof b=="number");p.length>0&&(o.required=p)}},Af=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Cf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Pf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Rf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Lf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},If=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Te(i,t,r);const a=t.seen.get(e);a.ref=i},zf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},uc=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},$f=y("ZodISODateTime",(e,t)=>{Lp.init(e,t),ke.init(e,t)});function Of(e){return Mh($f,e)}const Nf=y("ZodISODate",(e,t)=>{Ip.init(e,t),ke.init(e,t)});function Df(e){return Uh(Nf,e)}const Mf=y("ZodISOTime",(e,t)=>{zp.init(e,t),ke.init(e,t)});function Uf(e){return jh(Mf,e)}const jf=y("ZodISODuration",(e,t)=>{$p.init(e,t),ke.init(e,t)});function Zf(e){return Zh(jf,e)}const qf=(e,t)=>{Fa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Sd(e,n)},flatten:{value:n=>xd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ws,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ws,2)}},isEmpty:{get(){return e.issues.length===0}}})},dt=y("ZodError",qf,{Parent:Error}),Hf=js(dt),Ff=Zs(dt),Bf=Wo(dt),Gf=Jo(dt),Wf=Ad(dt),Jf=Cd(dt),Yf=Pd(dt),Xf=Rd(dt),Vf=Ld(dt),Kf=Id(dt),Qf=zd(dt),eg=$d(dt),be=y("ZodType",(e,t)=>(ge.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Io(e,"input"),output:Io(e,"output")}}),e.toJSONSchema=uf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(an(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>cn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Hf(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Bf(e,n,r),e.parseAsync=async(n,r)=>Ff(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Gf(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Wf(e,n,r),e.decode=(n,r)=>Jf(e,n,r),e.encodeAsync=async(n,r)=>Yf(e,n,r),e.decodeAsync=async(n,r)=>Xf(e,n,r),e.safeEncode=(n,r)=>Vf(e,n,r),e.safeDecode=(n,r)=>Kf(e,n,r),e.safeEncodeAsync=async(n,r)=>Qf(e,n,r),e.safeDecodeAsync=async(n,r)=>eg(e,n,r),e.refine=(n,r)=>e.check(Yg(n,r)),e.superRefine=n=>e.check(Xg(n)),e.overwrite=n=>e.check(or(n)),e.optional=()=>Ji(e),e.exactOptional=()=>Ng(e),e.nullable=()=>Yi(e),e.nullish=()=>Ji(Yi(e)),e.nonoptional=n=>qg(e,n),e.array=()=>vt(e),e.or=n=>Ag([e,n]),e.and=n=>Rg(e,n),e.transform=n=>Xi(e,$g(n)),e.default=n=>Ug(e,n),e.prefault=n=>Zg(e,n),e.catch=n=>Fg(e,n),e.pipe=n=>Xi(e,n),e.readonly=()=>Wg(e),e.describe=n=>{const r=e.clone();return Ar.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Ar.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Ar.get(e);const r=e.clone();return Ar.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),dc=y("_ZodString",(e,t)=>{qs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>pf(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Jh(...r)),e.includes=(...r)=>e.check(Vh(...r)),e.startsWith=(...r)=>e.check(Kh(...r)),e.endsWith=(...r)=>e.check(Qh(...r)),e.min=(...r)=>e.check(Lo(...r)),e.max=(...r)=>e.check(sc(...r)),e.length=(...r)=>e.check(ic(...r)),e.nonempty=(...r)=>e.check(Lo(1,...r)),e.lowercase=r=>e.check(Yh(r)),e.uppercase=r=>e.check(Xh(r)),e.trim=()=>e.check(tf()),e.normalize=(...r)=>e.check(ef(...r)),e.toLowerCase=()=>e.check(nf()),e.toUpperCase=()=>e.check(rf()),e.slugify=()=>e.check(of())}),tg=y("ZodString",(e,t)=>{qs.init(e,t),dc.init(e,t),e.email=n=>e.check(bh(ng,n)),e.url=n=>e.check(wh(rg,n)),e.jwt=n=>e.check(Dh(kg,n)),e.emoji=n=>e.check(xh(og,n)),e.guid=n=>e.check(Zi(Bi,n)),e.uuid=n=>e.check(kh(ao,n)),e.uuidv4=n=>e.check(_h(ao,n)),e.uuidv6=n=>e.check(vh(ao,n)),e.uuidv7=n=>e.check(yh(ao,n)),e.nanoid=n=>e.check(Sh(sg,n)),e.guid=n=>e.check(Zi(Bi,n)),e.cuid=n=>e.check(Th(ig,n)),e.cuid2=n=>e.check(Eh(ag,n)),e.ulid=n=>e.check(Ah(cg,n)),e.base64=n=>e.check($h(gg,n)),e.base64url=n=>e.check(Oh(mg,n)),e.xid=n=>e.check(Ch(lg,n)),e.ksuid=n=>e.check(Ph(ug,n)),e.ipv4=n=>e.check(Rh(dg,n)),e.ipv6=n=>e.check(Lh(pg,n)),e.cidrv4=n=>e.check(Ih(hg,n)),e.cidrv6=n=>e.check(zh(fg,n)),e.e164=n=>e.check(Nh(bg,n)),e.datetime=n=>e.check(Of(n)),e.date=n=>e.check(Df(n)),e.time=n=>e.check(Uf(n)),e.duration=n=>e.check(Zf(n))});function A(e){return mh(tg,e)}const ke=y("ZodStringFormat",(e,t)=>{me.init(e,t),dc.init(e,t)}),ng=y("ZodEmail",(e,t)=>{wp.init(e,t),ke.init(e,t)}),Bi=y("ZodGUID",(e,t)=>{vp.init(e,t),ke.init(e,t)}),ao=y("ZodUUID",(e,t)=>{yp.init(e,t),ke.init(e,t)}),rg=y("ZodURL",(e,t)=>{xp.init(e,t),ke.init(e,t)}),og=y("ZodEmoji",(e,t)=>{Sp.init(e,t),ke.init(e,t)}),sg=y("ZodNanoID",(e,t)=>{Tp.init(e,t),ke.init(e,t)}),ig=y("ZodCUID",(e,t)=>{Ep.init(e,t),ke.init(e,t)}),ag=y("ZodCUID2",(e,t)=>{Ap.init(e,t),ke.init(e,t)}),cg=y("ZodULID",(e,t)=>{Cp.init(e,t),ke.init(e,t)}),lg=y("ZodXID",(e,t)=>{Pp.init(e,t),ke.init(e,t)}),ug=y("ZodKSUID",(e,t)=>{Rp.init(e,t),ke.init(e,t)}),dg=y("ZodIPv4",(e,t)=>{Op.init(e,t),ke.init(e,t)}),pg=y("ZodIPv6",(e,t)=>{Np.init(e,t),ke.init(e,t)}),hg=y("ZodCIDRv4",(e,t)=>{Dp.init(e,t),ke.init(e,t)}),fg=y("ZodCIDRv6",(e,t)=>{Mp.init(e,t),ke.init(e,t)}),gg=y("ZodBase64",(e,t)=>{Up.init(e,t),ke.init(e,t)}),mg=y("ZodBase64URL",(e,t)=>{Zp.init(e,t),ke.init(e,t)}),bg=y("ZodE164",(e,t)=>{qp.init(e,t),ke.init(e,t)}),kg=y("ZodJWT",(e,t)=>{Fp.init(e,t),ke.init(e,t)}),pc=y("ZodNumber",(e,t)=>{ec.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hf(e,r,o),e.gt=(r,o)=>e.check(Hi(r,o)),e.gte=(r,o)=>e.check(ds(r,o)),e.min=(r,o)=>e.check(ds(r,o)),e.lt=(r,o)=>e.check(qi(r,o)),e.lte=(r,o)=>e.check(us(r,o)),e.max=(r,o)=>e.check(us(r,o)),e.int=r=>e.check(Gi(r)),e.safe=r=>e.check(Gi(r)),e.positive=r=>e.check(Hi(0,r)),e.nonnegative=r=>e.check(ds(0,r)),e.negative=r=>e.check(qi(0,r)),e.nonpositive=r=>e.check(us(0,r)),e.multipleOf=(r,o)=>e.check(Fi(r,o)),e.step=(r,o)=>e.check(Fi(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Lt(e){return qh(pc,e)}const _g=y("ZodNumberFormat",(e,t)=>{Bp.init(e,t),pc.init(e,t)});function Gi(e){return Hh(_g,e)}const vg=y("ZodBoolean",(e,t)=>{Gp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ff(e,n,r)});function he(e){return Fh(vg,e)}const yg=y("ZodAny",(e,t)=>{Wp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mf()});function hc(){return Bh(yg)}const wg=y("ZodUnknown",(e,t)=>{Jp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bf()});function Wi(){return Gh(wg)}const xg=y("ZodNever",(e,t)=>{Yp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gf(e,n,r)});function Sg(e){return Wh(xg,e)}const Tg=y("ZodArray",(e,t)=>{Xp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wf(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Lo(n,r)),e.nonempty=n=>e.check(Lo(1,n)),e.max=(n,r)=>e.check(sc(n,r)),e.length=(n,r)=>e.check(ic(n,r)),e.unwrap=()=>e.element});function vt(e,t){return sf(Tg,e,t)}const Eg=y("ZodObject",(e,t)=>{Kp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xf(e,n,r,o),Q(e,"shape",()=>t.shape),e.keyof=()=>ct(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Wi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Wi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Sg()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>kd(e,n),e.safeExtend=n=>_d(e,n),e.merge=n=>vd(e,n),e.pick=n=>md(e,n),e.omit=n=>bd(e,n),e.partial=(...n)=>yd(mc,e,n[0]),e.required=(...n)=>wd(bc,e,n[0])});function pe(e,t){const n={type:"object",shape:e??{},...N(t)};return new Eg(n)}const fc=y("ZodUnion",(e,t)=>{rc.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sf(e,n,r,o),e.options=t.options});function Ag(e,t){return new fc({type:"union",options:e,...N(t)})}const Cg=y("ZodDiscriminatedUnion",(e,t)=>{fc.init(e,t),Qp.init(e,t)});function gc(e,t,n){return new Cg({type:"union",options:t,discriminator:e,...N(n)})}const Pg=y("ZodIntersection",(e,t)=>{eh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tf(e,n,r,o)});function Rg(e,t){return new Pg({type:"intersection",left:e,right:t})}const Lg=y("ZodRecord",(e,t)=>{th.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ef(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ct(e,t,n){return new Lg({type:"record",keyType:e,valueType:t,...N(n)})}const Ss=y("ZodEnum",(e,t)=>{nh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>kf(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Ss({...t,checks:[],...N(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Ss({...t,checks:[],...N(o),entries:i})}});function ct(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ss({type:"enum",entries:n,...N(t)})}const Ig=y("ZodLiteral",(e,t)=>{rh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_f(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function at(e,t){return new Ig({type:"literal",values:Array.isArray(e)?e:[e],...N(t)})}const zg=y("ZodTransform",(e,t)=>{oh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ma(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Nr(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Nr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function $g(e){return new zg({type:"transform",transform:e})}const mc=y("ZodOptional",(e,t)=>{oc.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ji(e){return new mc({type:"optional",innerType:e})}const Og=y("ZodExactOptional",(e,t)=>{sh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ng(e){return new Og({type:"optional",innerType:e})}const Dg=y("ZodNullable",(e,t)=>{ih.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yi(e){return new Dg({type:"nullable",innerType:e})}const Mg=y("ZodDefault",(e,t)=>{ah.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ug(e,t){return new Mg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qa(t)}})}const jg=y("ZodPrefault",(e,t)=>{ch.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Zg(e,t){return new jg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qa(t)}})}const bc=y("ZodNonOptional",(e,t)=>{lh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qg(e,t){return new bc({type:"nonoptional",innerType:e,...N(t)})}const Hg=y("ZodCatch",(e,t)=>{uh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fg(e,t){return new Hg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Bg=y("ZodPipe",(e,t)=>{dh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(e,n,r,o),e.in=t.in,e.out=t.out});function Xi(e,t){return new Bg({type:"pipe",in:e,out:t})}const Gg=y("ZodReadonly",(e,t)=>{ph.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Wg(e){return new Gg({type:"readonly",innerType:e})}const Jg=y("ZodCustom",(e,t)=>{hh.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vf(e,n)});function Yg(e,t={}){return af(Jg,e,t)}function Xg(e){return cf(e)}const Vg=pe({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:vt(A()).optional(),failOnError:he().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Ct(A(),A()).optional(),runOnBackground:he().optional()});pe({name:A(),command:A(),success:he(),exitCode:Lt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:Lt(),failOnError:he()});const bn=pe({path:A(),extraCommands:vt(Vg).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:ct(["free","in_use"]).optional()}),Kg=gc("operation",[bn.extend({operation:at("create"),content:A().optional(),contentPath:A().optional(),encoding:ct(["utf-8","base64"]).optional()}),bn.extend({operation:at("merge"),data:Ct(A(),hc()),mergeStrategy:ct(["deep","shallow"]).optional(),arrayMergeStrategy:ct(["concat","replace"]).optional()}),bn.extend({operation:at("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:he().optional()}),bn.extend({operation:at("delete"),ignoreIfMissing:he().optional()}),bn.extend({operation:at("createDirectory"),contentPath:A().optional(),mode:Lt().optional(),ignoreIfExists:he().optional()}),bn.extend({operation:at("download"),url:A().url(),headers:Ct(A(),A()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),bn.extend({operation:at("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const Qg=pe({type:ct(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:pe({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),em=pe({type:ct(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:hc().describe("Hook-specific configuration")});pe({command:A().optional().describe("Legacy — unused in SDK mode"),args:vt(A()).optional().describe("Legacy — unused in SDK mode"),env:Ct(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:vt(Kg).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:Qg.optional().describe("Schema for extracting result data"),postExecutionHooks:vt(em).optional().describe("Hooks to run after task completion"),executionMode:ct(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:gc("executionMode",[pe({executionMode:at("claudeAgentSdk"),promptText:A(),sdkOptions:pe({model:A(),permissionMode:ct(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:vt(A()),allowDangerouslySkipPermissions:he(),persistSession:he(),streamSdkEvents:he().optional(),allowedTools:vt(A()).optional(),settings:pe({enabledPlugins:Ct(A(),he())}),env:Ct(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("opencodeSdk"),promptText:A(),sdkOptions:pe({provider:A(),model:A(),allowedTools:vt(A()).optional(),env:Ct(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("openaiAgentSdk"),promptText:A(),sdkOptions:pe({model:A(),env:Ct(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("codexSdk"),promptText:A(),sdkOptions:pe({model:A().optional(),sandboxMode:ct(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ct(["never","on-request","on-failure","untrusted"]).optional(),env:Ct(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()}),pe({executionMode:at("cursorSdk"),promptText:A(),sdkOptions:pe({model:A(),env:Ct(A(),A()).optional()}),resume:pe({sessionId:A().optional(),continue:he()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:he().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:he().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:he().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:vt(pe({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:he().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:he().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:vt(pe({id:A(),selectedText:A(),startOffset:Lt(),endOffset:Lt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:he().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:he().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ct(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:he().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const kc="browser_capture",tm="browser_automate";async function _c(e){if(!e.ok){const t=await e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()}const nm=3e4;async function zo(e,t={},n=nm){const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):i}finally{clearTimeout(o)}}async function Ze(e,t,n,r){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await zo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return _c(a)}async function vc(e,t){return Ze(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}const rm=["projectId","note","ctx"];function om(e){const t=rm.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}async function Ts(e,t){var h,p,b,m,_,v;om(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:u,type:d=kc}=t;return Ze(e,"POST","/tasks",{type:d,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:u??r,projectId:n,autoAssign:!0,...i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{},...(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{},...(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{},...(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{},...(i==null?void 0:i.effort)!=null?{effort:i.effort}:{},...(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{},...(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{},...(p=i==null?void 0:i.selectedSkillIds)!=null&&p.length?{selectedSkillIds:i.selectedSkillIds}:{},...(b=i==null?void 0:i.selectedPluginSkillIds)!=null&&b.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{},...(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{},...(_=i==null?void 0:i.selectedSlashCommandIds)!=null&&_.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{},...(v=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&v.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{},metadata:{type:d,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}})}async function Vi(e,t){return Ts(e,{...t,type:tm})}async function Ki(e,t,n,r){return Ze(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function sm(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ze(e,"GET",`/claude-templates${n}`)}async function yc(e,t){return Ze(e,"GET",`/tasks/${t}`)}async function im(e,t){return Ze(e,"GET",`/planning-sessions/${t}`)}async function Qi(e){return Ze(e,"GET","/projects")}async function ea(e,t,n){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=await zo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return _c(i)}async function am(e,t){return Ze(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function cm(e,t,n,r,o){return Ze(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function lm(e,t){return Ze(e,"GET",`/tasks/${t}/chunks`)}async function um(e,t,n){return Ze(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function dm(e,t){return Ze(e,"POST",`/tasks/${t}/cancel`)}async function pm(e,t){return Ze(e,"POST",`/tasks/${t}/approve-result`)}async function hm(e,t,n){return Ze(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function $o(e,t){return Ze(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function wc(e,t,n,r){return Ze(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}function fm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ps={exports:{}};/*!
|
|
1386
1359
|
* Pusher JavaScript Library v8.5.0
|
|
1387
1360
|
* https://pusher.com/
|
|
1388
1361
|
*
|
|
1389
1362
|
* Copyright 2020, Pusher
|
|
1390
1363
|
* Released under the MIT licence.
|
|
1391
|
-
*/(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||function(){var P=function(T,x){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var de in D)D.hasOwnProperty(de)&&(R[de]=D[de])},P(T,x)};return function(T,x){P(T,x);function R(){this.constructor=T}T.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}}();Object.defineProperty(u,"__esModule",{value:!0});var h=256,p=function(){function P(T){T===void 0&&(T="="),this._paddingCharacter=T}return P.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},P.prototype.encode=function(T){for(var x="",R=0;R<T.length-2;R+=3){var D=T[R]<<16|T[R+1]<<8|T[R+2];x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),x+=this._encodeByte(D>>>1*6&63),x+=this._encodeByte(D>>>0*6&63)}var de=T.length-R;if(de>0){var D=T[R]<<16|(de===2?T[R+1]<<8:0);x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),de===2?x+=this._encodeByte(D>>>1*6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},P.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},P.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},P.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(T),R=T.length-x,D=new Uint8Array(this.maxDecodedLength(R)),de=0,_e=0,Ee=0,qe=0,Y=0,Ae=0,Me=0;_e<R-4;_e+=4)qe=this._decodeChar(T.charCodeAt(_e+0)),Y=this._decodeChar(T.charCodeAt(_e+1)),Ae=this._decodeChar(T.charCodeAt(_e+2)),Me=this._decodeChar(T.charCodeAt(_e+3)),D[de++]=qe<<2|Y>>>4,D[de++]=Y<<4|Ae>>>2,D[de++]=Ae<<6|Me,Ee|=qe&h,Ee|=Y&h,Ee|=Ae&h,Ee|=Me&h;if(_e<R-1&&(qe=this._decodeChar(T.charCodeAt(_e)),Y=this._decodeChar(T.charCodeAt(_e+1)),D[de++]=qe<<2|Y>>>4,Ee|=qe&h,Ee|=Y&h),_e<R-2&&(Ae=this._decodeChar(T.charCodeAt(_e+2)),D[de++]=Y<<4|Ae>>>2,Ee|=Ae&h),_e<R-3&&(Me=this._decodeChar(T.charCodeAt(_e+3)),D[de++]=Ae<<6|Me,Ee|=Me&h),Ee!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},P.prototype._encodeByte=function(T){var x=T;return x+=65,x+=25-T>>>8&6,x+=51-T>>>8&-75,x+=61-T>>>8&-15,x+=62-T>>>8&3,String.fromCharCode(x)},P.prototype._decodeChar=function(T){var x=h;return x+=(42-T&T-44)>>>8&-h+T-43+62,x+=(46-T&T-48)>>>8&-h+T-47+63,x+=(47-T&T-58)>>>8&-h+T-48+52,x+=(64-T&T-91)>>>8&-h+T-65+0,x+=(96-T&T-123)>>>8&-h+T-97+26,x},P.prototype._getPaddingLength=function(T){var x=0;if(this._paddingCharacter){for(var R=T.length-1;R>=0&&T[R]===this._paddingCharacter;R--)x++;if(T.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},P}();u.Coder=p;var b=new p;function m(P){return b.encode(P)}u.encode=m;function _(P){return b.decode(P)}u.decode=_;var y=function(P){d(T,P);function T(){return P!==null&&P.apply(this,arguments)||this}return T.prototype._encodeByte=function(x){var R=x;return R+=65,R+=25-x>>>8&6,R+=51-x>>>8&-75,R+=61-x>>>8&-13,R+=62-x>>>8&49,String.fromCharCode(R)},T.prototype._decodeChar=function(x){var R=h;return R+=(44-x&x-46)>>>8&-h+x-45+62,R+=(94-x&x-96)>>>8&-h+x-95+63,R+=(47-x&x-58)>>>8&-h+x-48+52,R+=(64-x&x-91)>>>8&-h+x-65+0,R+=(96-x&x-123)>>>8&-h+x-97+26,R},T}(p);u.URLSafeCoder=y;var C=new y;function M(P){return C.encode(P)}u.encodeURLSafe=M;function J(P){return C.decode(P)}u.decodeURLSafe=J,u.encodedLength=function(P){return b.encodedLength(P)},u.maxDecodedLength=function(P){return b.maxDecodedLength(P)},u.decodedLength=function(P){return b.decodedLength(P)}},978(a,u){var d="utf8: invalid source encoding";function h(p){for(var b=[],m=0;m<p.length;m++){var _=p[m];if(_&128){var y=void 0;if(_<224){if(m>=p.length)throw new Error(d);var C=p[++m];if((C&192)!==128)throw new Error(d);_=(_&31)<<6|C&63,y=128}else if(_<240){if(m>=p.length-1)throw new Error(d);var C=p[++m],M=p[++m];if((C&192)!==128||(M&192)!==128)throw new Error(d);_=(_&15)<<12|(C&63)<<6|M&63,y=2048}else if(_<248){if(m>=p.length-2)throw new Error(d);var C=p[++m],M=p[++m],J=p[++m];if((C&192)!==128||(M&192)!==128||(J&192)!==128)throw new Error(d);_=(_&15)<<18|(C&63)<<12|(M&63)<<6|J&63,y=65536}else throw new Error(d);if(_<y||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=h},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>to});class h{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",w=!1,E=function(){w||(s.apply(null,arguments),w=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(s){delete this[s.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=b;class _{constructor(s){this.options=s,this.receivers=s.receivers||p,this.loading={}}load(s,c,f){var g=this;if(g.loading[s]&&g.loading[s].length>0)g.loading[s].push(f);else{g.loading[s]=[f];var w=F.createScriptRequest(g.getPath(s,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[s]){var q=g.loading[s];delete g.loading[s];for(var V=function(xe){xe||w.cleanup()},te=0;te<q.length;te++)q[te]($,V)}});w.send(E)}}getRoot(s){var c,f=F.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),C=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const M={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},P={buildLogSuffix:function(l){const s="See:",c=M.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=M.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class x extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class de extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class qe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ae extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const pt=function(l,s,c,f,g){const w=F.createXHR();w.open("POST",c.endpoint,!0),w.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)w.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)w.setRequestHeader(E,$[E])}return w.onreadystatechange=function(){if(w.readyState===4)if(w.status===200){let $,q=!1;try{$=JSON.parse(w.responseText),q=!0}catch{g(new Ae(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${w.responseText}`),null)}q&&g(null,$)}else{let $="";switch(f){case T.UserAuthentication:$=P.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${P.buildLogSuffix("authorizationEndpoint")}`;break}g(new Ae(w.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${w.status} from ${c.endpoint}. ${$}`),null)}},w.send(s),w};function Bt(l){return X(K(l))}var tt=String.fromCharCode,zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?tt(192|s>>>6)+tt(128|s&63):tt(224|s>>>12&15)+tt(128|s>>>6&63)+tt(128|s&63)},K=function(l){return l.replace(/[^\x00-\x7F]/g,j)},$e=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[zt.charAt(c>>>18),zt.charAt(c>>>12&63),s>=2?"=":zt.charAt(c>>>6&63),s>=1?"=":zt.charAt(c&63)];return f.join("")},X=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,$e)};class ht{constructor(s,c,f,g){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const ne=ht;function ln(l){window.clearTimeout(l)}function ce(l){window.clearInterval(l)}class re extends ne{constructor(s,c){super(setTimeout,ln,s,function(f){return c(),null})}}class Ce extends ne{constructor(s,c){super(setInterval,ce,s,function(f){return c(),f})}}var Pe={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new re(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Pe;function we(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=we(l[g]||{},f[g]):l[g]=f[g]}return l}function Ye(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(He(arguments[s]));return l.join(" : ")}function rt(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,g=l.length;f<g;f++)if(l[f]===s)return f;return-1}function Re(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function ot(l){var s=[];return Re(l,function(c,f){s.push(f)}),s}function It(l){var s=[];return Re(l,function(c){s.push(c)}),s}function $t(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function Ln(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function Gt(l,s){var c={};return Re(l,function(f,g){c[g]=s(f)}),c}function un(l,s){s=s||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function dn(l,s){var c={};return Re(l,function(f,g){(s&&s(f,g,l,c)||f)&&(c[g]=f)}),c}function Zr(l){var s=[];return Re(l,function(c,f){s.push([f,c])}),s}function ar(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function Vo(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function cr(l){return Gt(l,function(s){return typeof s=="object"&&(s=He(s)),encodeURIComponent(Bt(s.toString()))})}function pn(l){var s=dn(l,function(f){return f!==void 0}),c=Ln(Zr(cr(s)),ee.method("join","=")).join("&");return c}function Wt(l){var s=[],c=[];return function f(g,w){var E,$,q;switch(typeof g){case"object":if(!g)return null;for(E=0;E<s.length;E+=1)if(s[E]===g)return{$ref:c[E]};if(s.push(g),c.push(w),Object.prototype.toString.apply(g)==="[object Array]")for(q=[],E=0;E<g.length;E+=1)q[E]=f(g[E],w+"["+E+"]");else{q={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(q[$]=f(g[$],w+"["+JSON.stringify($)+"]"))}return q;case"number":case"string":case"boolean":return g}}(l,"$")}function He(l){try{return JSON.stringify(l)}catch{return JSON.stringify(Wt(l))}}class lr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=Ye.apply(this,arguments);to.log?to.log(f):to.logToConsole&&s.bind(this)(f)}}const le=new lr;var qr=function(l,s,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&le.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var w=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[w]=function(te){g(null,te)};var q="Pusher.auth_callbacks['"+w+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(q)+"&"+s;var V=E.getElementsByTagName("head")[0]||E.documentElement;V.insertBefore($,V.firstChild)};const ur=qr;class Hr{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class zn{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=pn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=F.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var In=function(l,s){return function(c,f){var g="http"+(s?"s":"")+"://",w=g+(l.host||l.options.host)+l.options.path,E=F.createJSONPRequest(w,c),$=F.ScriptReceivers.create(function(q,V){p.remove($),E.cleanup(),V&&V.host&&(l.host=V.host),f&&f(q,V)});E.send($)}},ft={name:"jsonp",getAgent:In};const Jt=ft;function hn(l,s,c){var f=l+(s.useTLS?"s":""),g=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+g+c}function fn(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var Yo={getInitial:function(l,s){var c=(s.httpPath||"")+fn(l,"flash=false");return hn("ws",s,c)}},$n={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+fn(l);return hn("http",s,c)}},Nn={getInitial:function(l,s){return hn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return fn(l)}};class Ko{constructor(){this._callbacks={}}get(s){return this._callbacks[Nt(s)]}add(s,c,f){var g=Nt(s);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var g=s?[Nt(s)]:ot(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(s,c,f){$t(s,function(g){this._callbacks[g]=un(this._callbacks[g]||[],function(w){return c&&c!==w.fn||f&&f!==w.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(s){$t(s,function(c){delete this._callbacks[c]},this)}}function Nt(l){return"_"+l}class gt{constructor(s){this.callbacks=new Ko,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=un(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](s,c);var w=this.callbacks.get(s),E=[];if(f?E.push(c,f):c&&E.push(c),w&&w.length>0)for(var g=0;g<w.length;g++)w[g].fn.apply(w[g].context||window,E);else this.failThrough&&this.failThrough(s,c);return this}}class Qo extends gt{constructor(s,c,f,g,w){super(),this.initialize=F.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=g,this.options=w,this.state="new",this.timeline=w.timeline,this.activityTimeout=w.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),le.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return we({cid:this.id},s)}}class ue{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,g){return new Qo(this.hooks,s,c,f,g)}}var Xt=new ue({urls:Yo,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(l){return F.createWebSocket(l)}}),Fr={urls:$n,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},dr=we({getSocket:function(l){return F.HTTPFactory.createStreamingSocket(l)}},Fr),On=we({getSocket:function(l){return F.HTTPFactory.createPollingSocket(l)}},Fr),pr={isSupported:function(){return F.isXHRSupported()}},Br=new ue(we({},dr,pr)),es=new ue(we({},On,pr)),st={ws:Xt,xhr_streaming:Br,xhr_polling:es};const it=st;var Gr=new ue({file:"sockjs",urls:Nn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:C.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),hr={isSupported:function(l){var s=F.isXDRSupported(l.useTLS);return s}},fr=new ue(we({},dr,hr)),Wr=new ue(we({},On,hr));it.xdr_streaming=fr,it.xdr_polling=Wr,it.sockjs=Gr;const mt=it;class Jr extends gt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Xr=new Jr;class Vr{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,g){g=we({},g,{activityTimeout:this.pingDelay});var w=this.transport.createConnection(s,c,f,g),E=null,$=function(){w.unbind("open",$),w.bind("closed",q),E=ee.now()},q=V=>{if(w.unbind("closed",q),V.code===1002||V.code===1003)this.manager.reportDeath();else if(!V.wasClean&&E){var te=ee.now()-E;te<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(te/2,this.minPingDelay))}};return w.bind("open",$),w}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const gr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch{}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=gr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Ot=gr;class N extends gt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var g={event:s,data:c};return f&&(g.channel=f),le.debug("Event sent",g),this.send(Ot.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var g;try{g=Ot.decodeMessage(f)}catch(w){this.emit("error",{type:"MessageParseError",error:w,data:f.data})}if(g!==void 0){switch(le.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Re(s,(f,g)=>{this.transport.unbind(g,f)})};Re(s,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(s){var c=Ot.getCloseAction(s),f=Ot.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class k{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Ot.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new N(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Ot.getCloseAction(s)||"backoff",f=Ot.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(we({transport:this.transport,action:s},c))}}class S{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,s),c)}}class L extends gt{constructor(s,c){super(function(f,g){le.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new x("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=P.buildLogSuffix("triggeringClientEvents");le.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,le.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ae?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class oe extends L{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ie{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Re(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,s,c,f){function g(w){return w instanceof c?w:new c(function(E){E(w)})}return new(c||(c=Promise))(function(w,E){function $(te){try{V(f.next(te))}catch(xe){E(xe)}}function q(te){try{V(f.throw(te))}catch(xe){E(xe)}}function V(te){te.done?w(te.value):g(te.value).then($,q)}V((f=f.apply(l,s||[])).next())})};class Ue extends oe{constructor(s,c){super(s,c),this.members=new Ie}authorize(s,c){super.authorize(s,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var w=JSON.parse(g.channel_data);this.members.setMyID(w.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=P.buildLogSuffix("authorizationEndpoint");le.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,g={};s.user_id&&(g.user_id=s.user_id),this.emit(c,f,g)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var w=this.members.removeMember(f);w&&this.emit("pusher:member_removed",w);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var bt=d(978),St=d(594);class mr extends oe{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,g)=>{if(f){c(f,g);return}let w=g.shared_secret;if(!w){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,St.decode)(w),delete g.shared_secret,c(null,g)})}trigger(s,c){throw new Ee("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){le.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){le.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,St.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){le.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,St.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){le.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let w=this.nacl.secretbox.open(f,g,this.key);if(w===null){le.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){le.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(w=this.nacl.secretbox.open(f,g,this.key),w===null){le.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(w))});return}this.emit(s,this.getDataToEmit(w))}getDataToEmit(s){let c=(0,bt.D4)(s);try{return JSON.parse(c)}catch{return c}}}class Le extends gt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=F.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new re(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return we({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return we({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var g=s;g==="connected"&&(g+=" with new socket ID "+c.socket_id),le.debug("State changed",f+" -> "+g),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Yr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=Kr(s,c)),this.channels[s]}all(){return It(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Re(this.channels,function(s){s.disconnect()})}}function Kr(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Dt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=P.buildLogSuffix("encryptedChannelSupport");throw new Ee(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Dt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Dt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new R('Cannot create a channel with name "'+l+'".');return Dt.createChannel(l,s)}}var _l={createChannels(){return new Yr},createConnectionManager(l,s){return new Le(l,s)},createChannel(l,s){return new L(l,s)},createPrivateChannel(l,s){return new oe(l,s)},createPresenceChannel(l,s){return new Ue(l,s)},createEncryptedChannel(l,s,c){return new mr(l,s,c)},createTimelineSender(l,s){return new S(l,s)},createHandshake(l,s){return new k(l,s)},createAssistantToTheTransportManager(l,s,c){return new Vr(l,s,c)}};const Dt=_l;class ci{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Dt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class gn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return ar(this.strategies,ee.method("isSupported"))}connect(s,c){var f=this.strategies,g=0,w=this.timeout,E=null,$=(q,V)=>{V?c(null,V):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(w&&(w=w*2,this.timeoutLimit&&(w=Math.min(w,this.timeoutLimit))),E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(q){s=q,E&&E.forceMinPriority(q)}}}tryStrategy(s,c,f,g){var w=null,E=null;return f.timeout>0&&(w=new re(f.timeout,function(){E.abort(),g(!0)})),E=s.connect(c,function($,q){$&&w&&w.isRunning()&&!f.failFast||(w&&w.ensureAborted(),g($,q))}),{abort:function(){w&&w.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class ts{constructor(s){this.strategies=s}isSupported(){return ar(this.strategies,ee.method("isSupported"))}connect(s,c){return vl(this.strategies,s,function(f,g){return function(w,E){if(g[f].error=w,w){yl(g)&&c(!0);return}$t(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function vl(l,s,c){var f=Ln(l,function(g,w,E,$){return g.connect(s,c(w,$))});return{abort:function(){$t(f,wl)},forceMinPriority:function(g){$t(f,function(w){w.forceMinPriority(g)})}}}function yl(l){return Vo(l,function(s){return!!s.error})}function wl(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class xl{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,g=Sl(f),w=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ee.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||w>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new gn([$],{timeout:g.latency*2+1e3,failFast:!0}))):w++)}var q=ee.now(),V=E.pop().connect(s,function te(xe,no){xe?(li(f),E.length>0?(q=ee.now(),V=E.pop().connect(s,te)):c(xe)):(Tl(f,no.transport.name,ee.now()-q,w),c(null,no))});return{abort:function(){V.abort()},forceMinPriority:function(te){s=te,V&&V.forceMinPriority(te)}}}}function ns(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function Sl(l){var s=F.getLocalStorage();if(s)try{var c=s[ns(l)];if(c)return JSON.parse(c)}catch{li(l)}return null}function Tl(l,s,c,f){var g=F.getLocalStorage();if(g)try{g[ns(l)]=He({timestamp:ee.now(),transport:s,latency:c,cacheSkipCount:f})}catch{}}function li(l){var s=F.getLocalStorage();if(s)try{delete s[ns(l)]}catch{}}class Qr{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,g,w=new re(this.options.delay,function(){g=f.connect(s,c)});return{abort:function(){w.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){s=E,g&&g.forceMinPriority(E)}}}}class br{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class El{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(g,w){w&&f.abort(),c(g,w)});return f}}function kr(l){return function(){return l.isSupported()}}var Al=function(l,s,c){var f={};function g(wi,Su,Tu,Eu,Au){var xi=c(l,wi,Su,Tu,Eu,Au);return f[wi]=xi,xi}var w=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},w,{useTLS:!0}),$=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),q={loop:!0,timeout:15e3,timeoutLimit:6e4},V=new ci({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),te=new ci({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),xe=g("ws","ws",3,w,V),no=g("wss","ws",3,E,V),_u=g("sockjs","sockjs",1,$),mi=g("xhr_streaming","xhr_streaming",1,$,te),vu=g("xdr_streaming","xdr_streaming",1,$,te),bi=g("xhr_polling","xhr_polling",1,$),yu=g("xdr_polling","xdr_polling",1,$),ki=new gn([xe],q),wu=new gn([no],q),xu=new gn([_u],q),_i=new gn([new br(kr(mi),mi,vu)],q),vi=new gn([new br(kr(bi),bi,yu)],q),yi=new gn([new br(kr(_i),new ts([_i,new Qr(vi,{delay:4e3})]),vi)],q),ss=new br(kr(yi),yi,xu),is;return s.useTLS?is=new ts([ki,new Qr(ss,{delay:2e3})]):is=new ts([ki,new Qr(wu,{delay:2e3}),new Qr(ss,{delay:5e3})]),new xl(new El(new br(kr(xe),is,ss)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Cl=Al;function Pl(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),C.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var Rl={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new D),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Ll=Rl,zl=256*1024;class Il extends gt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
|
|
1392
|
-
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>zl}}var rs;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(rs||(rs={}));const mn=rs;var $l=1;class Nl{constructor(s,c){this.hooks=s,this.session=di(1e3)+"/"+Ul(8),this.location=Ol(c),this.readyState=mn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===mn.OPEN)try{return F.createSocketRequest("POST",ui(Dl(this.location,this.session))).start(s),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=mn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===mn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===mn.CONNECTING?(s&&s.hostname&&(this.location.base=Ml(this.location.base,s.hostname)),this.readyState=mn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===mn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=F.createSocketRequest("POST",ui(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ee.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Ol(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function Dl(l,s){return l.base+"/"+s+"/xhr_send"}function ui(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+$l++}function Ml(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function di(l){return F.randomInt(l)}function Ul(l){for(var s=[],c=0;c<l;c++)s.push(di(32).toString(32));return s.join("")}const jl=Nl;var Zl={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const ql=Zl;var Hl={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Fl=Hl;var Bl={getRequest:function(l){var s=F.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Gl=Bl;var Wl={createStreamingSocket(l){return this.createSocket(ql,l)},createPollingSocket(l){return this.createSocket(Fl,l)},createSocket(l,s){return new jl(l,s)},createXHR(l,s){return this.createRequest(Gl,l,s)},createRequest(l,s,c){return new Il(l,s,c)}};const pi=Wl;pi.createXDR=function(l,s){return this.createRequest(Ll,l,s)};var Jl={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:y,getDefaultStrategy:Cl,Transports:mt,transportConnectionInitializer:Pl,HTTPFactory:pi,TimelineTransport:Jt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():C.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:pt,jsonp:ur}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new zn(l,s)},createScriptRequest(l){return new Hr(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Xr},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const F=Jl;var os;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(os||(os={}));const eo=os;class Xl{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(we({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(eo.ERROR,s)}info(s){this.log(eo.INFO,s)}debug(s){this.log(eo.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=we({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(g,w)=>{g||this.sent++,c&&c(g,w)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Vl{constructor(s,c,f,g){this.name=s,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return hi(new de,c)}else return hi(new Y,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),w=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){w=Dt.createHandshake(g,function(xe){f=!0,te(),c(null,xe)})},q=function(xe){te(),c(xe)},V=function(){te();var xe;xe=He(g),c(new _e(xe))},te=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",q),g.unbind("closed",V)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",q),g.bind("closed",V),g.initialize(),{abort:()=>{f||(te(),w?w.close():g.close())},forceMinPriority:xe=>{f||this.priority<xe&&(w?w.close():g.close())}}}}function hi(l,s){return ee.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Yl}=F;var Kl=function(l,s,c,f,g,w){var E=Yl[c];if(!E)throw new qe(c);var $=(!l.enabledTransports||rt(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||rt(l.disabledTransports,s)===-1),q;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),q=new Vl(s,f,w?w.getAssistant(E):E,g)):q=Ql,q},Ql={isSupported:function(){return!1},connect:function(l,s){var c=ee.defer(function(){s(new Y)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function eu(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&le.warn("The disableStats option is deprecated in favor of enableStats")}const tu=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},nu=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=tu(s,l);F.getAuthorizers()[l.transport](F,f,l,T.UserAuthentication,c)}},ru=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},ou=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=ru(s,l);F.getAuthorizers()[l.transport](F,f,l,T.ChannelAuthorization,c)}},su=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(g,w)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,w)}};function fi(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:uu(l),httpHost:iu(l),useTLS:lu(l),wsHost:au(l),userAuthenticator:du(l),channelAuthorizer:hu(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function iu(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function au(l){return l.wsHost?l.wsHost:cu(l.cluster)}function cu(l){return`ws-${l}.pusher.com`}function lu(l){return F.getProtocol()==="https:"?!0:l.forceTLS!==!1}function uu(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const gi=l=>"customHandler"in l&&l.customHandler!=null;function du(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return gi(s)?s.customHandler:nu(s)}function pu(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:su(s,c,l.authorizer)};return c}function hu(l,s){const c=pu(l,s);return gi(c)?c.customHandler:ou(c)}class fu extends gt{constructor(s){super(function(c,f){le.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function gu(){let l,s;return{promise:new Promise((f,g)=>{l=f,s=g}),resolve:l,reject:s}}const mu=gu;class bu extends gt{constructor(s){super(function(c,f){le.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){le.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new fu(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch{le.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){le.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=mu();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Ne{static ready(){Ne.isReady=!0;for(var s=0,c=Ne.instances.length;s<c;s++)Ne.instances[s].connect()}static getClientFeatures(){return ot(dn({ws:F.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){ku(s),eu(c),this.key=s,this.options=c,this.config=fi(this.options,this),this.channels=Dt.createChannels(),this.global_emitter=new gt,this.sessionID=F.randomInt(1e9),this.timeline=new Xl(this.key,this.sessionID,{cluster:this.config.cluster,features:Ne.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:eo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Dt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var f=g=>F.getDefaultStrategy(this.config,g,Kl);this.connection=Dt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var w=g.event,E=w.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{le.warn(g)}),Ne.instances.push(this),this.timeline.info({instances:Ne.instances.length}),this.user=new bu(this),Ne.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=fi(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Ce(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Ne.instances=[],Ne.isReady=!1,Ne.logToConsole=!1,Ne.Runtime=F,Ne.ScriptReceivers=F.ScriptReceivers,Ne.DependenciesReceivers=F.DependenciesReceivers,Ne.auth_callbacks=F.auth_callbacks;const to=Ne;function ku(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(Ne)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var i=o(721);return i})())})(vc);var Yg=vc.exports;const Kg=Vg(Yg),ao={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};let xt=null,Dn=null;async function Qg(e){return Dn||(Dn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();xt=new Kg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),Dn.catch(()=>{Dn=null}),Dn)}function em(e){if(!e||!xt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return xt.connection.bind("state_change",n),()=>xt==null?void 0:xt.connection.unbind("state_change",n)}async function tm(e,t,n){if(await Qg(e),!xt)return()=>{};const r=xt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(ao.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(ao.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(ao.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(ao.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=em(n.onReconnect);return()=>{r.unbind_all(),xt==null||xt.unsubscribe(`private-task-${t}`),o==null||o()}}const Zs="ap-sdk-active-automation";function nm(){try{const e=sessionStorage.getItem(Zs);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function yc(e){try{sessionStorage.setItem(Zs,JSON.stringify(e))}catch{}}function wc(){try{sessionStorage.removeItem(Zs)}catch{}}async function rm(e){var i;try{(i=e.focus)==null||i.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await om(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()}function om(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const qs="shared",xc="ap-sdk-panel-size:",Qi=280,ea=200;function sm(e){try{const t=sessionStorage.getItem(xc+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function im(e,t){try{sessionStorage.setItem(xc+e,JSON.stringify(t))}catch{}}function co(e,t,n){return Math.min(Math.max(e,t),n)}function ta(){return window.innerWidth-32}function na(){return window.innerHeight-64}function Hs(e,t){const n=sm(t);n&&(e.style.width=`${co(n.width,Qi,ta())}px`,e.style.height=`${co(n.height,ea,na())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,u=0,d=0,h=0,p=0;const b=_=>{o&&(h=co(u+(_.clientX-i),Qi,ta()),p=co(d+(_.clientY-a),ea,na()),e.style.width=`${h}px`,e.style.height=`${p}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),im(t,{width:h,height:p}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,i=_.clientX,a=_.clientY;const y=e.getBoundingClientRect();u=y.width,d=y.height,h=u,p=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function Fs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rn=Fs();function Sc(e){Rn=e}var _n={exec:()=>null};function Mn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var am=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Mn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Mn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}>`))},cm=/^(?:[ \t]*(?:\n|$))+/,lm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,um=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ur=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,dm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Bs=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Tc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ec=G(Tc).replace(/bull/g,Bs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),pm=G(Tc).replace(/bull/g,Bs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Gs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,hm=/^[^\n]+/,Ws=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,fm=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ws).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gm=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Bs).getRegex(),Xo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Js=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mm=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Js).replace("tag",Xo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ac=e=>G(Gs).replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex(),bm=Ac(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),km=Ac(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),_m=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",km).getRegex(),Xs={blockquote:_m,code:lm,def:fm,fences:um,heading:dm,hr:Ur,html:mm,lheading:Ec,list:gm,newline:cm,paragraph:bm,table:_n,text:hm},ra=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex(),vm={...Xs,lheading:pm,table:ra,paragraph:G(Gs).replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ra).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex()},ym={...Xs,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Js).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(Gs).replace("hr",Ur).replace("heading",` *#{1,6} *[^
|
|
1393
|
-
]`).replace("lheading",
|
|
1364
|
+
*/var ta;function gm(){return ta||(ta=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||(function(){var P=function(T,x){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var de in D)D.hasOwnProperty(de)&&(R[de]=D[de])},P(T,x)};return function(T,x){P(T,x);function R(){this.constructor=T}T.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}})();Object.defineProperty(u,"__esModule",{value:!0});var h=256,p=(function(){function P(T){T===void 0&&(T="="),this._paddingCharacter=T}return P.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},P.prototype.encode=function(T){for(var x="",R=0;R<T.length-2;R+=3){var D=T[R]<<16|T[R+1]<<8|T[R+2];x+=this._encodeByte(D>>>18&63),x+=this._encodeByte(D>>>12&63),x+=this._encodeByte(D>>>6&63),x+=this._encodeByte(D>>>0&63)}var de=T.length-R;if(de>0){var D=T[R]<<16|(de===2?T[R+1]<<8:0);x+=this._encodeByte(D>>>18&63),x+=this._encodeByte(D>>>12&63),de===2?x+=this._encodeByte(D>>>6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},P.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},P.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},P.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(T),R=T.length-x,D=new Uint8Array(this.maxDecodedLength(R)),de=0,_e=0,Ee=0,qe=0,V=0,Ae=0,Me=0;_e<R-4;_e+=4)qe=this._decodeChar(T.charCodeAt(_e+0)),V=this._decodeChar(T.charCodeAt(_e+1)),Ae=this._decodeChar(T.charCodeAt(_e+2)),Me=this._decodeChar(T.charCodeAt(_e+3)),D[de++]=qe<<2|V>>>4,D[de++]=V<<4|Ae>>>2,D[de++]=Ae<<6|Me,Ee|=qe&h,Ee|=V&h,Ee|=Ae&h,Ee|=Me&h;if(_e<R-1&&(qe=this._decodeChar(T.charCodeAt(_e)),V=this._decodeChar(T.charCodeAt(_e+1)),D[de++]=qe<<2|V>>>4,Ee|=qe&h,Ee|=V&h),_e<R-2&&(Ae=this._decodeChar(T.charCodeAt(_e+2)),D[de++]=V<<4|Ae>>>2,Ee|=Ae&h),_e<R-3&&(Me=this._decodeChar(T.charCodeAt(_e+3)),D[de++]=Ae<<6|Me,Ee|=Me&h),Ee!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},P.prototype._encodeByte=function(T){var x=T;return x+=65,x+=25-T>>>8&6,x+=51-T>>>8&-75,x+=61-T>>>8&-15,x+=62-T>>>8&3,String.fromCharCode(x)},P.prototype._decodeChar=function(T){var x=h;return x+=(42-T&T-44)>>>8&-h+T-43+62,x+=(46-T&T-48)>>>8&-h+T-47+63,x+=(47-T&T-58)>>>8&-h+T-48+52,x+=(64-T&T-91)>>>8&-h+T-65+0,x+=(96-T&T-123)>>>8&-h+T-97+26,x},P.prototype._getPaddingLength=function(T){var x=0;if(this._paddingCharacter){for(var R=T.length-1;R>=0&&T[R]===this._paddingCharacter;R--)x++;if(T.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},P})();u.Coder=p;var b=new p;function m(P){return b.encode(P)}u.encode=m;function _(P){return b.decode(P)}u.decode=_;var v=(function(P){d(T,P);function T(){return P!==null&&P.apply(this,arguments)||this}return T.prototype._encodeByte=function(x){var R=x;return R+=65,R+=25-x>>>8&6,R+=51-x>>>8&-75,R+=61-x>>>8&-13,R+=62-x>>>8&49,String.fromCharCode(R)},T.prototype._decodeChar=function(x){var R=h;return R+=(44-x&x-46)>>>8&-h+x-45+62,R+=(94-x&x-96)>>>8&-h+x-95+63,R+=(47-x&x-58)>>>8&-h+x-48+52,R+=(64-x&x-91)>>>8&-h+x-65+0,R+=(96-x&x-123)>>>8&-h+x-97+26,R},T})(p);u.URLSafeCoder=v;var C=new v;function M(P){return C.encode(P)}u.encodeURLSafe=M;function J(P){return C.decode(P)}u.decodeURLSafe=J,u.encodedLength=function(P){return b.encodedLength(P)},u.maxDecodedLength=function(P){return b.maxDecodedLength(P)},u.decodedLength=function(P){return b.decodedLength(P)}},978(a,u){var d="utf8: invalid source encoding";function h(p){for(var b=[],m=0;m<p.length;m++){var _=p[m];if(_&128){var v=void 0;if(_<224){if(m>=p.length)throw new Error(d);var C=p[++m];if((C&192)!==128)throw new Error(d);_=(_&31)<<6|C&63,v=128}else if(_<240){if(m>=p.length-1)throw new Error(d);var C=p[++m],M=p[++m];if((C&192)!==128||(M&192)!==128)throw new Error(d);_=(_&15)<<12|(C&63)<<6|M&63,v=2048}else if(_<248){if(m>=p.length-2)throw new Error(d);var C=p[++m],M=p[++m],J=p[++m];if((C&192)!==128||(M&192)!==128||(J&192)!==128)throw new Error(d);_=(_&15)<<18|(C&63)<<12|(M&63)<<6|J&63,v=65536}else throw new Error(d);if(_<v||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=h},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>to});class h{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",w=!1,E=function(){w||(s.apply(null,arguments),w=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(s){delete this[s.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=b;class _{constructor(s){this.options=s,this.receivers=s.receivers||p,this.loading={}}load(s,c,f){var g=this;if(g.loading[s]&&g.loading[s].length>0)g.loading[s].push(f);else{g.loading[s]=[f];var w=F.createScriptRequest(g.getPath(s,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[s]){var q=g.loading[s];delete g.loading[s];for(var X=function(xe){xe||w.cleanup()},te=0;te<q.length;te++)q[te]($,X)}});w.send(E)}}getRoot(s){var c,f=F.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var v=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),C=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:v});const M={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},P={buildLogSuffix:function(l){const s="See:",c=M.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=M.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class x extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class de extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class qe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ae extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const pt=function(l,s,c,f,g){const w=F.createXHR();w.open("POST",c.endpoint,!0),w.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)w.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)w.setRequestHeader(E,$[E])}return w.onreadystatechange=function(){if(w.readyState===4)if(w.status===200){let $,q=!1;try{$=JSON.parse(w.responseText),q=!0}catch{g(new Ae(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${w.responseText}`),null)}q&&g(null,$)}else{let $="";switch(f){case T.UserAuthentication:$=P.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${P.buildLogSuffix("authorizationEndpoint")}`;break}g(new Ae(w.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${w.status} from ${c.endpoint}. ${$}`),null)}},w.send(s),w};function Gt(l){return Y(K(l))}var et=String.fromCharCode,zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?et(192|s>>>6)+et(128|s&63):et(224|s>>>12&15)+et(128|s>>>6&63)+et(128|s&63)},K=function(l){return l.replace(/[^\x00-\x7F]/g,j)},$e=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[zt.charAt(c>>>18),zt.charAt(c>>>12&63),s>=2?"=":zt.charAt(c>>>6&63),s>=1?"=":zt.charAt(c&63)];return f.join("")},Y=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,$e)};class ht{constructor(s,c,f,g){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const ne=ht;function ln(l){window.clearTimeout(l)}function ce(l){window.clearInterval(l)}class re extends ne{constructor(s,c){super(setTimeout,ln,s,function(f){return c(),null})}}class Ce extends ne{constructor(s,c){super(setInterval,ce,s,function(f){return c(),f})}}var Pe={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new re(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Pe;function we(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=we(l[g]||{},f[g]):l[g]=f[g]}return l}function Ve(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(He(arguments[s]));return l.join(" : ")}function nt(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,g=l.length;f<g;f++)if(l[f]===s)return f;return-1}function Re(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function rt(l){var s=[];return Re(l,function(c,f){s.push(f)}),s}function $t(l){var s=[];return Re(l,function(c){s.push(c)}),s}function Ot(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function Ln(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function Wt(l,s){var c={};return Re(l,function(f,g){c[g]=s(f)}),c}function un(l,s){s=s||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function dn(l,s){var c={};return Re(l,function(f,g){(s&&s(f,g,l,c)||f)&&(c[g]=f)}),c}function Zr(l){var s=[];return Re(l,function(c,f){s.push([f,c])}),s}function ar(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function Vo(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function cr(l){return Wt(l,function(s){return typeof s=="object"&&(s=He(s)),encodeURIComponent(Gt(s.toString()))})}function pn(l){var s=dn(l,function(f){return f!==void 0}),c=Ln(Zr(cr(s)),ee.method("join","=")).join("&");return c}function Jt(l){var s=[],c=[];return(function f(g,w){var E,$,q;switch(typeof g){case"object":if(!g)return null;for(E=0;E<s.length;E+=1)if(s[E]===g)return{$ref:c[E]};if(s.push(g),c.push(w),Object.prototype.toString.apply(g)==="[object Array]")for(q=[],E=0;E<g.length;E+=1)q[E]=f(g[E],w+"["+E+"]");else{q={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(q[$]=f(g[$],w+"["+JSON.stringify($)+"]"))}return q;case"number":case"string":case"boolean":return g}})(l,"$")}function He(l){try{return JSON.stringify(l)}catch{return JSON.stringify(Jt(l))}}class lr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=Ve.apply(this,arguments);to.log?to.log(f):to.logToConsole&&s.bind(this)(f)}}const le=new lr;var qr=function(l,s,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&le.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var w=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[w]=function(te){g(null,te)};var q="Pusher.auth_callbacks['"+w+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(q)+"&"+s;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const ur=qr;class Hr{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class In{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=pn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=F.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var zn=function(l,s){return function(c,f){var g="http"+(s?"s":"")+"://",w=g+(l.host||l.options.host)+l.options.path,E=F.createJSONPRequest(w,c),$=F.ScriptReceivers.create(function(q,X){p.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(q,X)});E.send($)}},ft={name:"jsonp",getAgent:zn};const Yt=ft;function hn(l,s,c){var f=l+(s.useTLS?"s":""),g=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+g+c}function fn(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var Ko={getInitial:function(l,s){var c=(s.httpPath||"")+fn(l,"flash=false");return hn("ws",s,c)}},$n={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+fn(l);return hn("http",s,c)}},On={getInitial:function(l,s){return hn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return fn(l)}};class Qo{constructor(){this._callbacks={}}get(s){return this._callbacks[Nt(s)]}add(s,c,f){var g=Nt(s);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var g=s?[Nt(s)]:rt(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(s,c,f){Ot(s,function(g){this._callbacks[g]=un(this._callbacks[g]||[],function(w){return c&&c!==w.fn||f&&f!==w.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(s){Ot(s,function(c){delete this._callbacks[c]},this)}}function Nt(l){return"_"+l}class gt{constructor(s){this.callbacks=new Qo,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=un(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](s,c);var w=this.callbacks.get(s),E=[];if(f?E.push(c,f):c&&E.push(c),w&&w.length>0)for(var g=0;g<w.length;g++)w[g].fn.apply(w[g].context||window,E);else this.failThrough&&this.failThrough(s,c);return this}}class es extends gt{constructor(s,c,f,g,w){super(),this.initialize=F.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=g,this.options=w,this.state="new",this.timeline=w.timeline,this.activityTimeout=w.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),le.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return we({cid:this.id},s)}}class ue{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,g){return new es(this.hooks,s,c,f,g)}}var Xt=new ue({urls:Ko,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(l){return F.createWebSocket(l)}}),Fr={urls:$n,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},dr=we({getSocket:function(l){return F.HTTPFactory.createStreamingSocket(l)}},Fr),Nn=we({getSocket:function(l){return F.HTTPFactory.createPollingSocket(l)}},Fr),pr={isSupported:function(){return F.isXHRSupported()}},Br=new ue(we({},dr,pr)),ts=new ue(we({},Nn,pr)),ot={ws:Xt,xhr_streaming:Br,xhr_polling:ts};const st=ot;var Gr=new ue({file:"sockjs",urls:On,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:C.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),hr={isSupported:function(l){var s=F.isXDRSupported(l.useTLS);return s}},fr=new ue(we({},dr,hr)),Wr=new ue(we({},Nn,hr));st.xdr_streaming=fr,st.xdr_polling=Wr,st.sockjs=Gr;const mt=st;class Jr extends gt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Yr=new Jr;class Xr{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,g){g=we({},g,{activityTimeout:this.pingDelay});var w=this.transport.createConnection(s,c,f,g),E=null,$=function(){w.unbind("open",$),w.bind("closed",q),E=ee.now()},q=X=>{if(w.unbind("closed",q),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var te=ee.now()-E;te<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(te/2,this.minPingDelay))}};return w.bind("open",$),w}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const gr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch{}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=gr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Dt=gr;class O extends gt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var g={event:s,data:c};return f&&(g.channel=f),le.debug("Event sent",g),this.send(Dt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var g;try{g=Dt.decodeMessage(f)}catch(w){this.emit("error",{type:"MessageParseError",error:w,data:f.data})}if(g!==void 0){switch(le.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Re(s,(f,g)=>{this.transport.unbind(g,f)})};Re(s,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(s){var c=Dt.getCloseAction(s),f=Dt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class k{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Dt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new O(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Dt.getCloseAction(s)||"backoff",f=Dt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(we({transport:this.transport,action:s},c))}}class S{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,s),c)}}class L extends gt{constructor(s,c){super(function(f,g){le.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new x("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=P.buildLogSuffix("triggeringClientEvents");le.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,le.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ae?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class oe extends L{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class ze{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Re(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,s,c,f){function g(w){return w instanceof c?w:new c(function(E){E(w)})}return new(c||(c=Promise))(function(w,E){function $(te){try{X(f.next(te))}catch(xe){E(xe)}}function q(te){try{X(f.throw(te))}catch(xe){E(xe)}}function X(te){te.done?w(te.value):g(te.value).then($,q)}X((f=f.apply(l,s||[])).next())})};class Ue extends oe{constructor(s,c){super(s,c),this.members=new ze}authorize(s,c){super.authorize(s,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var w=JSON.parse(g.channel_data);this.members.setMyID(w.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=P.buildLogSuffix("authorizationEndpoint");le.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,g={};s.user_id&&(g.user_id=s.user_id),this.emit(c,f,g)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var w=this.members.removeMember(f);w&&this.emit("pusher:member_removed",w);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var bt=d(978),St=d(594);class mr extends oe{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,g)=>{if(f){c(f,g);return}let w=g.shared_secret;if(!w){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,St.decode)(w),delete g.shared_secret,c(null,g)})}trigger(s,c){throw new Ee("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){le.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){le.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,St.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){le.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,St.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){le.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let w=this.nacl.secretbox.open(f,g,this.key);if(w===null){le.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){le.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(w=this.nacl.secretbox.open(f,g,this.key),w===null){le.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(w))});return}this.emit(s,this.getDataToEmit(w))}getDataToEmit(s){let c=(0,bt.D4)(s);try{return JSON.parse(c)}catch{return c}}}class Le extends gt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=F.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new re(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return we({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return we({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var g=s;g==="connected"&&(g+=" with new socket ID "+c.socket_id),le.debug("State changed",f+" -> "+g),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Vr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=Kr(s,c)),this.channels[s]}all(){return $t(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Re(this.channels,function(s){s.disconnect()})}}function Kr(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Mt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=P.buildLogSuffix("encryptedChannelSupport");throw new Ee(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Mt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Mt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new R('Cannot create a channel with name "'+l+'".');return Mt.createChannel(l,s)}}var yl={createChannels(){return new Vr},createConnectionManager(l,s){return new Le(l,s)},createChannel(l,s){return new L(l,s)},createPrivateChannel(l,s){return new oe(l,s)},createPresenceChannel(l,s){return new Ue(l,s)},createEncryptedChannel(l,s,c){return new mr(l,s,c)},createTimelineSender(l,s){return new S(l,s)},createHandshake(l,s){return new k(l,s)},createAssistantToTheTransportManager(l,s,c){return new Xr(l,s,c)}};const Mt=yl;class ui{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Mt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class gn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return ar(this.strategies,ee.method("isSupported"))}connect(s,c){var f=this.strategies,g=0,w=this.timeout,E=null,$=(q,X)=>{X?c(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(w&&(w=w*2,this.timeoutLimit&&(w=Math.min(w,this.timeoutLimit))),E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(q){s=q,E&&E.forceMinPriority(q)}}}tryStrategy(s,c,f,g){var w=null,E=null;return f.timeout>0&&(w=new re(f.timeout,function(){E.abort(),g(!0)})),E=s.connect(c,function($,q){$&&w&&w.isRunning()&&!f.failFast||(w&&w.ensureAborted(),g($,q))}),{abort:function(){w&&w.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class ns{constructor(s){this.strategies=s}isSupported(){return ar(this.strategies,ee.method("isSupported"))}connect(s,c){return wl(this.strategies,s,function(f,g){return function(w,E){if(g[f].error=w,w){xl(g)&&c(!0);return}Ot(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function wl(l,s,c){var f=Ln(l,function(g,w,E,$){return g.connect(s,c(w,$))});return{abort:function(){Ot(f,Sl)},forceMinPriority:function(g){Ot(f,function(w){w.forceMinPriority(g)})}}}function xl(l){return Vo(l,function(s){return!!s.error})}function Sl(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Tl{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,g=El(f),w=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ee.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||w>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new gn([$],{timeout:g.latency*2+1e3,failFast:!0}))):w++)}var q=ee.now(),X=E.pop().connect(s,function te(xe,no){xe?(di(f),E.length>0?(q=ee.now(),X=E.pop().connect(s,te)):c(xe)):(Al(f,no.transport.name,ee.now()-q,w),c(null,no))});return{abort:function(){X.abort()},forceMinPriority:function(te){s=te,X&&X.forceMinPriority(te)}}}}function rs(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function El(l){var s=F.getLocalStorage();if(s)try{var c=s[rs(l)];if(c)return JSON.parse(c)}catch{di(l)}return null}function Al(l,s,c,f){var g=F.getLocalStorage();if(g)try{g[rs(l)]=He({timestamp:ee.now(),transport:s,latency:c,cacheSkipCount:f})}catch{}}function di(l){var s=F.getLocalStorage();if(s)try{delete s[rs(l)]}catch{}}class Qr{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,g,w=new re(this.options.delay,function(){g=f.connect(s,c)});return{abort:function(){w.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){s=E,g&&g.forceMinPriority(E)}}}}class br{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class Cl{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(g,w){w&&f.abort(),c(g,w)});return f}}function kr(l){return function(){return l.isSupported()}}var Pl=function(l,s,c){var f={};function g(Si,Eu,Au,Cu,Pu){var Ti=c(l,Si,Eu,Au,Cu,Pu);return f[Si]=Ti,Ti}var w=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},w,{useTLS:!0}),$=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),q={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new ui({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),te=new ui({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),xe=g("ws","ws",3,w,X),no=g("wss","ws",3,E,X),yu=g("sockjs","sockjs",1,$),ki=g("xhr_streaming","xhr_streaming",1,$,te),wu=g("xdr_streaming","xdr_streaming",1,$,te),_i=g("xhr_polling","xhr_polling",1,$),xu=g("xdr_polling","xdr_polling",1,$),vi=new gn([xe],q),Su=new gn([no],q),Tu=new gn([yu],q),yi=new gn([new br(kr(ki),ki,wu)],q),wi=new gn([new br(kr(_i),_i,xu)],q),xi=new gn([new br(kr(yi),new ns([yi,new Qr(wi,{delay:4e3})]),wi)],q),is=new br(kr(xi),xi,Tu),as;return s.useTLS?as=new ns([vi,new Qr(is,{delay:2e3})]):as=new ns([vi,new Qr(Su,{delay:2e3}),new Qr(is,{delay:5e3})]),new Tl(new Cl(new br(kr(xe),as,is)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Rl=Pl;function Ll(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),C.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var Il={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new D),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const zl=Il,$l=256*1024;class Ol extends gt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
|
|
1365
|
+
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>$l}}var os;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(os||(os={}));const mn=os;var Nl=1;class Dl{constructor(s,c){this.hooks=s,this.session=hi(1e3)+"/"+Zl(8),this.location=Ml(c),this.readyState=mn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===mn.OPEN)try{return F.createSocketRequest("POST",pi(Ul(this.location,this.session))).start(s),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=mn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===mn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===mn.CONNECTING?(s&&s.hostname&&(this.location.base=jl(this.location.base,s.hostname)),this.readyState=mn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===mn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=F.createSocketRequest("POST",pi(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ee.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Ml(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function Ul(l,s){return l.base+"/"+s+"/xhr_send"}function pi(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+Nl++}function jl(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function hi(l){return F.randomInt(l)}function Zl(l){for(var s=[],c=0;c<l;c++)s.push(hi(32).toString(32));return s.join("")}const ql=Dl;var Hl={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Fl=Hl;var Bl={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Gl=Bl;var Wl={getRequest:function(l){var s=F.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Jl=Wl;var Yl={createStreamingSocket(l){return this.createSocket(Fl,l)},createPollingSocket(l){return this.createSocket(Gl,l)},createSocket(l,s){return new ql(l,s)},createXHR(l,s){return this.createRequest(Jl,l,s)},createRequest(l,s,c){return new Ol(l,s,c)}};const fi=Yl;fi.createXDR=function(l,s){return this.createRequest(zl,l,s)};var Xl={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:v,getDefaultStrategy:Rl,Transports:mt,transportConnectionInitializer:Ll,HTTPFactory:fi,TimelineTransport:Yt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():C.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:pt,jsonp:ur}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new In(l,s)},createScriptRequest(l){return new Hr(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Yr},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const F=Xl;var ss;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(ss||(ss={}));const eo=ss;class Vl{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(we({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(eo.ERROR,s)}info(s){this.log(eo.INFO,s)}debug(s){this.log(eo.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=we({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(g,w)=>{g||this.sent++,c&&c(g,w)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Kl{constructor(s,c,f,g){this.name=s,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return gi(new de,c)}else return gi(new V,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),w=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){w=Mt.createHandshake(g,function(xe){f=!0,te(),c(null,xe)})},q=function(xe){te(),c(xe)},X=function(){te();var xe;xe=He(g),c(new _e(xe))},te=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",q),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",q),g.bind("closed",X),g.initialize(),{abort:()=>{f||(te(),w?w.close():g.close())},forceMinPriority:xe=>{f||this.priority<xe&&(w?w.close():g.close())}}}}function gi(l,s){return ee.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Ql}=F;var eu=function(l,s,c,f,g,w){var E=Ql[c];if(!E)throw new qe(c);var $=(!l.enabledTransports||nt(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||nt(l.disabledTransports,s)===-1),q;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),q=new Kl(s,f,w?w.getAssistant(E):E,g)):q=tu,q},tu={isSupported:function(){return!1},connect:function(l,s){var c=ee.defer(function(){s(new V)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function nu(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&le.warn("The disableStats option is deprecated in favor of enableStats")}const ru=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},ou=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=ru(s,l);F.getAuthorizers()[l.transport](F,f,l,T.UserAuthentication,c)}},su=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},iu=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=su(s,l);F.getAuthorizers()[l.transport](F,f,l,T.ChannelAuthorization,c)}},au=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(g,w)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,w)}};function mi(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:pu(l),httpHost:cu(l),useTLS:du(l),wsHost:lu(l),userAuthenticator:hu(l),channelAuthorizer:gu(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function cu(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function lu(l){return l.wsHost?l.wsHost:uu(l.cluster)}function uu(l){return`ws-${l}.pusher.com`}function du(l){return F.getProtocol()==="https:"?!0:l.forceTLS!==!1}function pu(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const bi=l=>"customHandler"in l&&l.customHandler!=null;function hu(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return bi(s)?s.customHandler:ou(s)}function fu(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:au(s,c,l.authorizer)};return c}function gu(l,s){const c=fu(l,s);return bi(c)?c.customHandler:iu(c)}class mu extends gt{constructor(s){super(function(c,f){le.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function bu(){let l,s;return{promise:new Promise((f,g)=>{l=f,s=g}),resolve:l,reject:s}}const ku=bu;class _u extends gt{constructor(s){super(function(c,f){le.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){le.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new mu(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch{le.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){le.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=ku();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Oe{static ready(){Oe.isReady=!0;for(var s=0,c=Oe.instances.length;s<c;s++)Oe.instances[s].connect()}static getClientFeatures(){return rt(dn({ws:F.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){vu(s),nu(c),this.key=s,this.options=c,this.config=mi(this.options,this),this.channels=Mt.createChannels(),this.global_emitter=new gt,this.sessionID=F.randomInt(1e9),this.timeline=new Vl(this.key,this.sessionID,{cluster:this.config.cluster,features:Oe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:eo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Mt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var f=g=>F.getDefaultStrategy(this.config,g,eu);this.connection=Mt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var w=g.event,E=w.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{le.warn(g)}),Oe.instances.push(this),this.timeline.info({instances:Oe.instances.length}),this.user=new _u(this),Oe.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=mi(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Ce(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Oe.instances=[],Oe.isReady=!1,Oe.logToConsole=!1,Oe.Runtime=F,Oe.ScriptReceivers=F.ScriptReceivers,Oe.DependenciesReceivers=F.DependenciesReceivers,Oe.auth_callbacks=F.auth_callbacks;const to=Oe;function vu(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(Oe)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var i=o(721);return i})())})(ps)),ps.exports}var mm=gm();const bm=fm(mm);let xt=null,Dn=null;async function km(e){return Dn||(Dn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await zo(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();xt=new bm(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{zo(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),Dn.catch(()=>{Dn=null}),Dn)}function _m(e){if(!e||!xt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return xt.connection.bind("state_change",n),()=>xt==null?void 0:xt.connection.unbind("state_change",n)}async function vm(e,t,n){if(await km(e),!xt)return()=>{};const r=xt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(oo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(oo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(oo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(oo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=_m(n.onReconnect);return()=>{r.unbind_all(),xt==null||xt.unsubscribe(`private-task-${t}`),o==null||o()}}const Hs="ap-sdk-active-automation";function ym(){try{const e=sessionStorage.getItem(Hs);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function xc(e){try{sessionStorage.setItem(Hs,JSON.stringify(e))}catch{}}function Sc(){try{sessionStorage.removeItem(Hs)}catch{}}async function wm(e){var i;try{(i=e.focus)==null||i.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await xm(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()}function xm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Fs="shared",Tc="ap-sdk-panel-size:",na=280,ra=200;function Sm(e){try{const t=sessionStorage.getItem(Tc+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function Tm(e,t){try{sessionStorage.setItem(Tc+e,JSON.stringify(t))}catch{}}function co(e,t,n){return Math.min(Math.max(e,t),n)}function oa(){return window.innerWidth-32}function sa(){return window.innerHeight-64}function Bs(e,t){const n=Sm(t);n&&(e.style.width=`${co(n.width,na,oa())}px`,e.style.height=`${co(n.height,ra,sa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,u=0,d=0,h=0,p=0;const b=_=>{o&&(h=co(u+(_.clientX-i),na,oa()),p=co(d+(_.clientY-a),ra,sa()),e.style.width=`${h}px`,e.style.height=`${p}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),Tm(t,{width:h,height:p}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,i=_.clientX,a=_.clientY;const v=e.getBoundingClientRect();u=v.width,d=v.height,h=u,p=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function Gs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rn=Gs();function Ec(e){Rn=e}var _n={exec:()=>null};function Mn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Em=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Mn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Mn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Mn(e=>new RegExp(`^ {0,${e}}>`))},Am=/^(?:[ \t]*(?:\n|$))+/,Cm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ur=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ws=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ac=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Cc=G(Ac).replace(/bull/g,Ws).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Lm=G(Ac).replace(/bull/g,Ws).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Js=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Im=/^[^\n]+/,Ys=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zm=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ys).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$m=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ws).getRegex(),Xo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Xs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Om=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Xs).replace("tag",Xo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pc=e=>G(Js).replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex(),Nm=Pc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Dm=Pc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Mm=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Dm).getRegex(),Vs={blockquote:Mm,code:Cm,def:zm,fences:Pm,heading:Rm,hr:Ur,html:Om,lheading:Cc,list:$m,newline:Am,paragraph:Nm,table:_n,text:Im},ia=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex(),Um={...Vs,lheading:Lm,table:ia,paragraph:G(Js).replace("hr",Ur).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ia).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xo).getRegex()},jm={...Vs,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(Js).replace("hr",Ur).replace("heading",` *#{1,6} *[^
|
|
1366
|
+
]`).replace("lheading",Cc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Zm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Rc=/^( {2,}|\\)\n(?!\s*$)/,Hm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Bt=/[\p{P}\p{S}]/u,sr=/[\s\p{P}\p{S}]/u,jr=/[^\s\p{P}\p{S}]/u,Fm=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sr).getRegex(),Bm=/[\p{Pi}\p{Ps}"']/u,Lc=/(?!~)[\p{P}\p{S}]/u,Gm=/(?!~)[\s\p{P}\p{S}]/u,Wm=/(?:[^\s\p{P}\p{S}]|~)/u,Jm=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Em?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ic=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ym=G(Ic,"u").replace(/punct/g,Bt).getRegex(),Xm=G(Ic,"u").replace(/punct/g,Lc).getRegex(),Vm=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Km=G(Vm,"u").replace(/openQuote/g,Bm).replace(/punct/g,Bt).getRegex(),zc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qm=G(zc,"gu").replace(/notPunctSpace/g,jr).replace(/punctSpace/g,sr).replace(/punct/g,Bt).getRegex(),eb=G(zc,"gu").replace(/notPunctSpace/g,Wm).replace(/punctSpace/g,Gm).replace(/punct/g,Lc).getRegex(),tb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",nb=G(tb,"gu").replace(/notPunctSpace/g,jr).replace(/punctSpace/g,sr).replace(/punct/g,Bt).getRegex(),rb=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jr).replace(/punctSpace/g,sr).replace(/punct/g,Bt).getRegex(),ob="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",sb=G(ob,"gu").replace(/notPunctSpace/g,jr).replace(/punctSpace/g,sr).replace(/punct/g,Bt).getRegex(),ib=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Bt).getRegex(),ab="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",cb=G(ab,"gu").replace(/notPunctSpace/g,jr).replace(/punctSpace/g,sr).replace(/punct/g,Bt).getRegex(),lb=G(/\\(punct)/,"gu").replace(/punct/g,Bt).getRegex(),ub=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),db=G(Xs).replace("(?:-->|$)","-->").getRegex(),pb=G("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",db).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Oo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hb=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Oo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$c=G(/^!?\[(label)\]\[(ref)\]/).replace("label",Oo).replace("ref",Ys).getRegex(),Oc=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ys).getRegex(),fb=G("reflink|nolink(?!\\()","g").replace("reflink",$c).replace("nolink",Oc).getRegex(),aa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ks={_backpedal:_n,anyPunctuation:lb,autolink:ub,blockSkip:Jm,br:Rc,code:qm,del:_n,delLDelim:_n,delRDelim:_n,emStrongLDelim:Ym,emStrongRDelimAst:Qm,emStrongRDelimUnd:rb,escape:Zm,link:hb,nolink:Oc,punctuation:Fm,reflink:$c,reflinkSearch:fb,tag:pb,text:Hm,url:_n},gb={...Ks,emStrongLDelim:Km,emStrongRDelimAst:nb,emStrongRDelimUnd:sb,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",Oo).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oo).getRegex()},Es={...Ks,emStrongRDelimAst:eb,emStrongLDelim:Xm,delLDelim:ib,delRDelim:cb,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",aa).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",aa).getRegex()},mb={...Es,br:G(Rc).replace("{2,}","*").getRegex(),text:G(Es.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lo={normal:Vs,gfm:Um,pedantic:jm},vr={normal:Ks,gfm:Es,breaks:mb,pedantic:gb},bb={"&":"&","<":"<",">":">",'"':""","'":"'"},ca=e=>bb[e];function Tt(e,t){if(t){if(je.escapeTest.test(e))return e.replace(je.escapeReplace,ca)}else if(je.escapeTestNoEncode.test(e))return e.replace(je.escapeReplaceNoEncode,ca);return e}function la(e){try{e=encodeURI(e).replace(je.percentDecode,"%")}catch{return null}return e}function ua(e,t){var i;let n=e.replace(je.findPipe,(a,u,d)=>{let h=!1,p=u;for(;--p>=0&&d[p]==="\\";)h=!h;return h?"|":" |"}),r=n.split(je.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(je.slashPipe,"|");return r}function Vt(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function da(e){let t=e.split(`
|
|
1394
1367
|
`),n=t.length-1;for(;n>=0&&je.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
1395
|
-
`)}function
|
|
1368
|
+
`)}function kb(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function _b(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function pa(e,t,n,r,o){let i=t.href,a=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function vb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
|
|
1396
1369
|
`).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[u]=a;return u.length>=o.length?i.slice(o.length):i}).join(`
|
|
1397
|
-
`)}var No=class{constructor(e){se(this,"options");se(this,"rules");se(this,"lexer");this.options=e||Rn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:
|
|
1370
|
+
`)}var No=class{constructor(e){se(this,"options");se(this,"rules");se(this,"lexer");this.options=e||Rn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:da(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=vb(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Vt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Vt(t[0],`
|
|
1398
1371
|
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Vt(t[0],`
|
|
1399
1372
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Vt(t[0],`
|
|
1400
1373
|
`).split(`
|
|
@@ -1402,25 +1375,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1402
1375
|
`),p=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
1403
1376
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
1404
1377
|
${h}`:h,o=o?`${o}
|
|
1405
|
-
${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=b,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,
|
|
1378
|
+
${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=b,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,v=n.join(`
|
|
1406
1379
|
`),C=_.raw+`
|
|
1407
|
-
`+
|
|
1408
|
-
${
|
|
1380
|
+
`+v.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(C);i[i.length-1]=M,r=`${r}
|
|
1381
|
+
${v}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,v=_.raw+`
|
|
1409
1382
|
`+n.join(`
|
|
1410
|
-
`),C=this.list(
|
|
1411
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,h="",p="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let b=
|
|
1383
|
+
`),C=this.list(v);i[i.length-1]=C,r=r.substring(0,r.length-m.raw.length)+C.raw,o=o.substring(0,o.length-_.raw.length)+C.raw,n=v.substring(i.at(-1).raw.length).split(`
|
|
1384
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,h="",p="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let b=_b(t[2].split(`
|
|
1412
1385
|
`,1)[0],t[1].length),m=e.split(`
|
|
1413
|
-
`,1)[0],_=!b.trim(),
|
|
1414
|
-
`,e=e.substring(m.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(
|
|
1415
|
-
`,1)[0],D;if(m=R,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),J.test(m)||P.test(m)||T.test(m)||x.test(m)||C.test(m)||M.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=
|
|
1416
|
-
`+D.slice(
|
|
1386
|
+
`,1)[0],_=!b.trim(),v=0;if(this.options.pedantic?(v=2,p=b.trimStart()):_?v=t[1].length+1:(v=b.search(this.rules.other.nonSpaceChar),v=v>4?1:v,p=b.slice(v),v+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
1387
|
+
`,e=e.substring(m.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(v),M=this.rules.other.hrRegex(v),J=this.rules.other.fencesBeginRegex(v),P=this.rules.other.headingBeginRegex(v),T=this.rules.other.htmlBeginRegex(v),x=this.rules.other.blockquoteBeginRegex(v);for(;e;){let R=e.split(`
|
|
1388
|
+
`,1)[0],D;if(m=R,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),J.test(m)||P.test(m)||T.test(m)||x.test(m)||C.test(m)||M.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=v||!m.trim())p+=`
|
|
1389
|
+
`+D.slice(v);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||J.test(b)||P.test(b)||M.test(b))break;p+=`
|
|
1417
1390
|
`+m}_=!m.trim(),h+=R+`
|
|
1418
|
-
`,e=e.substring(R.length+1),b=D.slice(
|
|
1419
|
-
`),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=
|
|
1391
|
+
`,e=e.substring(R.length+1),b=D.slice(v)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=h}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let h=d.tokens[0];if(d.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=b.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=b.raw+d.tokens[0].raw,d.tokens[0].text=b.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(b)):d.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):d.tokens.unshift(b)}}else d.task&&(d.task=!1);if(!o.loose){let p=d.tokens.filter(m=>m.type==="space"),b=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=b}}if(o.loose)for(let d of o.items){d.loose=!0;for(let h of d.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=da(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Vt(t[0],`
|
|
1392
|
+
`),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ua(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1420
1393
|
`):[],i={type:"table",raw:Vt(t[0],`
|
|
1421
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?i.align.push("right"):this.rules.other.tableAlignCenter.test(u)?i.align.push("center"):this.rules.other.tableAlignLeft.test(u)?i.align.push("left"):i.align.push(null);for(let u=0;u<n.length;u++)i.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:i.align[u]});for(let u of o)i.rows.push(
|
|
1394
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?i.align.push("right"):this.rules.other.tableAlignCenter.test(u)?i.align.push("center"):this.rules.other.tableAlignLeft.test(u)?i.align.push("left"):i.align.push(null);for(let u=0;u<n.length;u++)i.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:i.align[u]});for(let u of o)i.rows.push(ua(u,i.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:i.align[h]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Vt(t[0],`
|
|
1422
1395
|
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
1423
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Vt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=
|
|
1396
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Vt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=kb(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),pa(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return pa(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,u=o,d=0,h=r[0][0],p=n===h,b=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,t=t.slice(-1*e.length+o);(r=b.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){u+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){d+=a;continue}if(p)break}if(u-=a,u>0)continue;a=Math.min(a,a+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let C=_.slice(1,-1);return{type:"em",raw:_,text:C,tokens:this.lexer.inlineTokens(C)}}let v=_.slice(2,-2);return{type:"strong",raw:_,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){u+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u);let h=[...r[0]][0].length,p=e.slice(0,o+r.index+h+a),b=p.slice(o,-o);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},yt=class As{constructor(t){se(this,"tokens");se(this,"options");se(this,"state");se(this,"inlineQueue");se(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Rn,this.options.tokenizer=this.options.tokenizer||new No,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:je,block:lo.normal,inline:vr.normal};this.options.pedantic?(n.block=lo.pedantic,n.inline=vr.pedantic):this.options.gfm&&(n.block=lo.gfm,this.options.breaks?n.inline=vr.breaks:n.inline=vr.gfm),this.tokenizer.rules=n}static get rules(){return{block:lo,inline:vr}}static lex(t,n){return new As(n).lex(t)}static lexInline(t,n){return new As(n).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
|
|
1424
1397
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(je.tabCharGlobal," ").replace(je.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(p=>(d=p.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let p=n.at(-1);d.raw.length===1&&p!==void 0?p.raw+=`
|
|
1425
1398
|
`:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
1426
1399
|
`)?"":`
|
|
@@ -1434,7 +1407,7 @@ ${y}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void
|
|
|
1434
1407
|
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d),r=h.length!==t.length,t=t.substring(d.raw.length);continue}if(d=this.tokenizer.text(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
1435
1408
|
`)?"":`
|
|
1436
1409
|
`)+d.raw,p.text+=`
|
|
1437
|
-
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,h,p,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,
|
|
1410
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,h,p,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,v)=>{let C=v?v.length:0;return m.slice(0,C)+"["+"a".repeat(m.length-C-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(v=>(m=v.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let v=n.at(-1);m.type==="text"&&(v==null?void 0:v.type)==="text"?(v.raw+=m.raw,v.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,i)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,i)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((b=this.options.extensions)!=null&&b.startInline){let v=1/0,C=t.slice(1),M;this.options.extensions.startInline.forEach(J=>{M=J.call({lexer:this},C),typeof M=="number"&&M>=0&&(v=Math.min(v,M))}),v<1/0&&v>=0&&(_=t.substring(0,v+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(i=m.raw.slice(-1)),o=!0;let v=n.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=m.raw,v.text+=m.text):n.push(m);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},Do=class{constructor(e){se(this,"options");se(this,"parser");this.options=e||Rn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(je.notSpaceStart))==null?void 0:i[0],o=e.replace(je.endingNewline,"")+`
|
|
1438
1411
|
`;return r?'<pre><code class="language-'+Tt(r)+'">'+(n?o:Tt(o,!0))+`</code></pre>
|
|
1439
1412
|
`:"<pre><code>"+(n?o:Tt(o,!0))+`</code></pre>
|
|
1440
1413
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -1452,9 +1425,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1452
1425
|
`}tablerow({text:e}){return`<tr>
|
|
1453
1426
|
${e}</tr>
|
|
1454
1427
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1455
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Tt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=
|
|
1456
|
-
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Tt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Tn=new nb;function ae(e,t){return Tn.parse(e,t)}ae.options=ae.setOptions=function(e){return Tn.setOptions(e),ae.defaults=Tn.defaults,Sc(ae.defaults),ae};ae.getDefaults=Fs;ae.defaults=Rn;function rb(...e){return Tn.use(...e),ae.defaults=Tn.defaults,Sc(ae.defaults),ae}ae.use=rb;ae.walkTokens=function(e,t){return Tn.walkTokens(e,t)};ae.parseInline=Tn.parseInline;ae.Parser=wt;ae.parser=wt.parse;ae.Renderer=Oo;ae.TextRenderer=Ys;ae.Lexer=yt;ae.lexer=yt.lex;ae.Tokenizer=No;ae.Hooks=Cr;ae.parse=ae;ae.options;ae.setOptions;ae.walkTokens;ae.parseInline;wt.parse;yt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:$c,setPrototypeOf:ua,isFrozen:ob,getPrototypeOf:sb,getOwnPropertyDescriptor:ib}=Object;let{freeze:Xe,seal:ut,create:As}=Object,{apply:Cs,construct:Ps}=typeof Reflect<"u"&&Reflect;Xe||(Xe=function(t){return t});ut||(ut=function(t){return t});Cs||(Cs=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)});Ps||(Ps=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const uo=Ve(Array.prototype.forEach),ab=Ve(Array.prototype.lastIndexOf),da=Ve(Array.prototype.pop),yr=Ve(Array.prototype.push),cb=Ve(Array.prototype.splice),ko=Ve(String.prototype.toLowerCase),ds=Ve(String.prototype.toString),ps=Ve(String.prototype.match),wr=Ve(String.prototype.replace),lb=Ve(String.prototype.indexOf),ub=Ve(String.prototype.trim),kt=Ve(Object.prototype.hasOwnProperty),Fe=Ve(RegExp.prototype.test),xr=db(TypeError);function Ve(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Cs(e,t,r)}}function db(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ps(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ko;ua&&ua(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(ob(t)||(t[r]=i),o=i)}e[o]=!0}return e}function pb(e){for(let t=0;t<e.length;t++)kt(e,t)||(e[t]=null);return e}function Et(e){const t=As(null);for(const[n,r]of $c(e))kt(e,n)&&(Array.isArray(r)?t[n]=pb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Et(r):t[n]=r);return t}function Sr(e,t){for(;e!==null;){const r=ib(e,t);if(r){if(r.get)return Ve(r.get);if(typeof r.value=="function")return Ve(r.value)}e=sb(e)}function n(){return null}return n}const pa=Xe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),hs=Xe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fs=Xe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),hb=Xe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),gs=Xe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),fb=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ha=Xe(["#text"]),fa=Xe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ms=Xe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ga=Xe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),po=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),gb=ut(/\{\{[\w\W]*|[\w\W]*\}\}/gm),mb=ut(/<%[\w\W]*|[\w\W]*%>/gm),bb=ut(/\$\{[\w\W]*/gm),kb=ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),_b=ut(/^aria-[\-\w]+$/),Nc=ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vb=ut(/^(?:\w+script|data):/i),yb=ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Oc=ut(/^html$/i),wb=ut(/^[a-z][.\w]*(-[.\w]+)+$/i);var ma=Object.freeze({__proto__:null,ARIA_ATTR:_b,ATTR_WHITESPACE:yb,CUSTOM_ELEMENT:wb,DATA_ATTR:kb,DOCTYPE_NAME:Oc,ERB_EXPR:mb,IS_ALLOWED_URI:Nc,IS_SCRIPT_OR_DATA:vb,MUSTACHE_EXPR:gb,TMPLIT_EXPR:bb});const Tr={element:1,text:3,progressingInstruction:7,comment:8,document:9},xb=function(){return typeof window>"u"?null:window},Sb=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},ba=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Dc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xb();const t=N=>Dc(N);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Tr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,y=d.prototype,C=Sr(y,"cloneNode"),M=Sr(y,"remove"),J=Sr(y,"nextSibling"),P=Sr(y,"childNodes"),T=Sr(y,"parentNode");if(typeof a=="function"){const N=n.createElement("template");N.content&&N.content.ownerDocument&&(n=N.content.ownerDocument)}let x,R="";const{implementation:D,createNodeIterator:de,createDocumentFragment:_e,getElementsByTagName:Ee}=n,{importNode:qe}=r;let Y=ba();t.isSupported=typeof $c=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:Me,TMPLIT_EXPR:pt,DATA_ATTR:Bt,ARIA_ATTR:tt,IS_SCRIPT_OR_DATA:zt,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:K}=ma;let{IS_ALLOWED_URI:$e}=ma,X=null;const ht=B({},[...pa,...hs,...fs,...gs,...ha]);let ne=null;const ln=B({},[...fa,...ms,...ga,...po]);let ce=Object.seal(As(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,Ce=null;const Pe=Object.seal(As(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,we=!0,Ye=!1,rt=!0,Re=!1,ot=!0,It=!1,$t=!1,Ln=!1,Gt=!1,un=!1,dn=!1,Zr=!0,ar=!1;const Vo="user-content-";let cr=!0,pn=!1,Wt={},He=null;const lr=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const qr=B({},["audio","video","img","source","image","track"]);let ur=null;const Hr=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),zn="http://www.w3.org/1998/Math/MathML",In="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Jt=ft,hn=!1,fn=null;const Yo=B({},[zn,In,ft],ds);let $n=B({},["mi","mo","mn","ms","mtext"]),Nn=B({},["annotation-xml"]);const Ko=B({},["title","style","font","a","script"]);let Nt=null;const gt=["application/xhtml+xml","text/html"],Qo="text/html";let ue=null,Xt=null;const Fr=n.createElement("form"),dr=function(k){return k instanceof RegExp||k instanceof Function},On=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xt&&Xt===k)){if((!k||typeof k!="object")&&(k={}),k=Et(k),Nt=gt.indexOf(k.PARSER_MEDIA_TYPE)===-1?Qo:k.PARSER_MEDIA_TYPE,ue=Nt==="application/xhtml+xml"?ds:ko,X=kt(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,ue):ht,ne=kt(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,ue):ln,fn=kt(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,ds):Yo,ur=kt(k,"ADD_URI_SAFE_ATTR")?B(Et(Hr),k.ADD_URI_SAFE_ATTR,ue):Hr,le=kt(k,"ADD_DATA_URI_TAGS")?B(Et(qr),k.ADD_DATA_URI_TAGS,ue):qr,He=kt(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,ue):lr,re=kt(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,ue):Et({}),Ce=kt(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,ue):Et({}),Wt=kt(k,"USE_PROFILES")?k.USE_PROFILES:!1,ee=k.ALLOW_ARIA_ATTR!==!1,we=k.ALLOW_DATA_ATTR!==!1,Ye=k.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Re=k.SAFE_FOR_TEMPLATES||!1,ot=k.SAFE_FOR_XML!==!1,It=k.WHOLE_DOCUMENT||!1,Gt=k.RETURN_DOM||!1,un=k.RETURN_DOM_FRAGMENT||!1,dn=k.RETURN_TRUSTED_TYPE||!1,Ln=k.FORCE_BODY||!1,Zr=k.SANITIZE_DOM!==!1,ar=k.SANITIZE_NAMED_PROPS||!1,cr=k.KEEP_CONTENT!==!1,pn=k.IN_PLACE||!1,$e=k.ALLOWED_URI_REGEXP||Nc,Jt=k.NAMESPACE||ft,$n=k.MATHML_TEXT_INTEGRATION_POINTS||$n,Nn=k.HTML_INTEGRATION_POINTS||Nn,ce=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&dr(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&dr(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Re&&(we=!1),un&&(Gt=!0),Wt&&(X=B({},ha),ne=[],Wt.html===!0&&(B(X,pa),B(ne,fa)),Wt.svg===!0&&(B(X,hs),B(ne,ms),B(ne,po)),Wt.svgFilters===!0&&(B(X,fs),B(ne,ms),B(ne,po)),Wt.mathMl===!0&&(B(X,gs),B(ne,ga),B(ne,po))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Pe.tagCheck=k.ADD_TAGS:(X===ht&&(X=Et(X)),B(X,k.ADD_TAGS,ue))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Pe.attributeCheck=k.ADD_ATTR:(ne===ln&&(ne=Et(ne)),B(ne,k.ADD_ATTR,ue))),k.ADD_URI_SAFE_ATTR&&B(ur,k.ADD_URI_SAFE_ATTR,ue),k.FORBID_CONTENTS&&(He===lr&&(He=Et(He)),B(He,k.FORBID_CONTENTS,ue)),k.ADD_FORBID_CONTENTS&&(He===lr&&(He=Et(He)),B(He,k.ADD_FORBID_CONTENTS,ue)),cr&&(X["#text"]=!0),It&&B(X,["html","head","body"]),X.table&&(B(X,["tbody"]),delete re.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw xr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=k.TRUSTED_TYPES_POLICY,R=x.createHTML("")}else x===void 0&&(x=Sb(_,o)),x!==null&&typeof R=="string"&&(R=x.createHTML(""));Xe&&Xe(k),Xt=k}},pr=B({},[...hs,...fs,...hb]),Br=B({},[...gs,...fb]),es=function(k){let S=T(k);(!S||!S.tagName)&&(S={namespaceURI:Jt,tagName:"template"});const L=ko(k.tagName),oe=ko(S.tagName);return fn[k.namespaceURI]?k.namespaceURI===In?S.namespaceURI===ft?L==="svg":S.namespaceURI===zn?L==="svg"&&(oe==="annotation-xml"||$n[oe]):!!pr[L]:k.namespaceURI===zn?S.namespaceURI===ft?L==="math":S.namespaceURI===In?L==="math"&&Nn[oe]:!!Br[L]:k.namespaceURI===ft?S.namespaceURI===In&&!Nn[oe]||S.namespaceURI===zn&&!$n[oe]?!1:!Br[L]&&(Ko[L]||!pr[L]):!!(Nt==="application/xhtml+xml"&&fn[k.namespaceURI]):!1},st=function(k){yr(t.removed,{element:k});try{T(k).removeChild(k)}catch{M(k)}},it=function(k,S){try{yr(t.removed,{attribute:S.getAttributeNode(k),from:S})}catch{yr(t.removed,{attribute:null,from:S})}if(S.removeAttribute(k),k==="is")if(Gt||un)try{st(S)}catch{}else try{S.setAttribute(k,"")}catch{}},Gr=function(k){let S=null,L=null;if(Ln)k="<remove></remove>"+k;else{const ve=ps(k,/^[\r\n\t ]+/);L=ve&&ve[0]}Nt==="application/xhtml+xml"&&Jt===ft&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const oe=x?x.createHTML(k):k;if(Jt===ft)try{S=new m().parseFromString(oe,Nt)}catch{}if(!S||!S.documentElement){S=D.createDocument(Jt,"template",null);try{S.documentElement.innerHTML=hn?R:oe}catch{}}const Ie=S.body||S.documentElement;return k&&L&&Ie.insertBefore(n.createTextNode(L),Ie.childNodes[0]||null),Jt===ft?Ee.call(S,It?"html":"body")[0]:It?S.documentElement:Ie},hr=function(k){return de.call(k.ownerDocument||k,k,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},fr=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof p)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Wr=function(k){return typeof u=="function"&&k instanceof u};function mt(N,k,S){uo(N,L=>{L.call(t,k,S,Xt)})}const Jr=function(k){let S=null;if(mt(Y.beforeSanitizeElements,k,null),fr(k))return st(k),!0;const L=ue(k.nodeName);if(mt(Y.uponSanitizeElement,k,{tagName:L,allowedTags:X}),ot&&k.hasChildNodes()&&!Wr(k.firstElementChild)&&Fe(/<[/\w!]/g,k.innerHTML)&&Fe(/<[/\w!]/g,k.textContent)||k.nodeType===Tr.progressingInstruction||ot&&k.nodeType===Tr.comment&&Fe(/<[/\w]/g,k.data))return st(k),!0;if(!(Pe.tagCheck instanceof Function&&Pe.tagCheck(L))&&(!X[L]||re[L])){if(!re[L]&&Vr(L)&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L)))return!1;if(cr&&!He[L]){const oe=T(k)||k.parentNode,Ie=P(k)||k.childNodes;if(Ie&&oe){const ve=Ie.length;for(let Ue=ve-1;Ue>=0;--Ue){const bt=C(Ie[Ue],!0);bt.__removalCount=(k.__removalCount||0)+1,oe.insertBefore(bt,J(k))}}}return st(k),!0}return k instanceof d&&!es(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Fe(/<\/no(script|embed|frames)/i,k.innerHTML)?(st(k),!0):(Re&&k.nodeType===Tr.text&&(S=k.textContent,uo([Ae,Me,pt],oe=>{S=wr(S,oe," ")}),k.textContent!==S&&(yr(t.removed,{element:k.cloneNode()}),k.textContent=S)),mt(Y.afterSanitizeElements,k,null),!1)},Xr=function(k,S,L){if(Zr&&(S==="id"||S==="name")&&(L in n||L in Fr))return!1;if(!(we&&!Ce[S]&&Fe(Bt,S))){if(!(ee&&Fe(tt,S))){if(!(Pe.attributeCheck instanceof Function&&Pe.attributeCheck(S,k))){if(!ne[S]||Ce[S]){if(!(Vr(k)&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,k)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(k))&&(ce.attributeNameCheck instanceof RegExp&&Fe(ce.attributeNameCheck,S)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(S,k))||S==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L))))return!1}else if(!ur[S]){if(!Fe($e,wr(L,j,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&k!=="script"&&lb(L,"data:")===0&&le[k])){if(!(Ye&&!Fe(zt,wr(L,j,"")))){if(L)return!1}}}}}}}return!0},Vr=function(k){return k!=="annotation-xml"&&ps(k,K)},gr=function(k){mt(Y.beforeSanitizeAttributes,k,null);const{attributes:S}=k;if(!S||fr(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let oe=S.length;for(;oe--;){const Ie=S[oe],{name:ve,namespaceURI:Ue,value:bt}=Ie,St=ue(ve),mr=bt;let Le=ve==="value"?mr:ub(mr);if(L.attrName=St,L.attrValue=Le,L.keepAttr=!0,L.forceKeepAttr=void 0,mt(Y.uponSanitizeAttribute,k,L),Le=L.attrValue,ar&&(St==="id"||St==="name")&&(it(ve,k),Le=Vo+Le),ot&&Fe(/((--!?|])>)|<\/(style|title|textarea)/i,Le)){it(ve,k);continue}if(St==="attributename"&&ps(Le,"href")){it(ve,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){it(ve,k);continue}if(!rt&&Fe(/\/>/i,Le)){it(ve,k);continue}Re&&uo([Ae,Me,pt],Kr=>{Le=wr(Le,Kr," ")});const Yr=ue(k.nodeName);if(!Xr(Yr,St,Le)){it(ve,k);continue}if(x&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Ue)switch(_.getAttributeType(Yr,St)){case"TrustedHTML":{Le=x.createHTML(Le);break}case"TrustedScriptURL":{Le=x.createScriptURL(Le);break}}if(Le!==mr)try{Ue?k.setAttributeNS(Ue,ve,Le):k.setAttribute(ve,Le),fr(k)?st(k):da(t.removed)}catch{it(ve,k)}}mt(Y.afterSanitizeAttributes,k,null)},Ot=function N(k){let S=null;const L=hr(k);for(mt(Y.beforeSanitizeShadowDOM,k,null);S=L.nextNode();)mt(Y.uponSanitizeShadowNode,S,null),Jr(S),gr(S),S.content instanceof i&&N(S.content);mt(Y.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(N){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,oe=null,Ie=null;if(hn=!N,hn&&(N="<!-->"),typeof N!="string"&&!Wr(N))if(typeof N.toString=="function"){if(N=N.toString(),typeof N!="string")throw xr("dirty is not a string, aborting")}else throw xr("toString is not a function");if(!t.isSupported)return N;if($t||On(k),t.removed=[],typeof N=="string"&&(pn=!1),pn){if(N.nodeName){const bt=ue(N.nodeName);if(!X[bt]||re[bt])throw xr("root node is forbidden and cannot be sanitized in-place")}}else if(N instanceof u)S=Gr("<!---->"),L=S.ownerDocument.importNode(N,!0),L.nodeType===Tr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!Gt&&!Re&&!It&&N.indexOf("<")===-1)return x&&dn?x.createHTML(N):N;if(S=Gr(N),!S)return Gt?null:dn?R:""}S&&Ln&&st(S.firstChild);const ve=hr(pn?N:S);for(;oe=ve.nextNode();)Jr(oe),gr(oe),oe.content instanceof i&&Ot(oe.content);if(pn)return N;if(Gt){if(un)for(Ie=_e.call(S.ownerDocument);S.firstChild;)Ie.appendChild(S.firstChild);else Ie=S;return(ne.shadowroot||ne.shadowrootmode)&&(Ie=qe.call(r,Ie,!0)),Ie}let Ue=It?S.outerHTML:S.innerHTML;return It&&X["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Fe(Oc,S.ownerDocument.doctype.name)&&(Ue="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
1457
|
-
`+Ue),Re&&uo([Ae,Me,pt],bt=>{Ue=wr(Ue,bt," ")}),x&&dn?x.createHTML(Ue):Ue},t.setConfig=function(){let
|
|
1428
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Tt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=la(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Tt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=la(e);if(o===null)return Tt(n);e=o;let i=`<img src="${e}" alt="${Tt(n)}"`;return t&&(i+=` title="${Tt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Tt(e.text)}},Qs=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}},wt=class Cs{constructor(t){se(this,"options");se(this,"renderer");se(this,"textRenderer");this.options=t||Rn,this.options.renderer=this.options.renderer||new Do,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qs}static parse(t,n){return new Cs(n).parse(t)}static parseInline(t,n){return new Cs(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let d=a,h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=h||"";continue}}let u=a;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let u=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[u.type]){let h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=h||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},go,Cr=(go=class{constructor(e){se(this,"options");se(this,"block");this.options=e||Rn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?yt.lex:yt.lexInline}provideParser(e=this.block){return e?wt.parse:wt.parseInline}},se(go,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),se(go,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),go),yb=class{constructor(...e){se(this,"defaults",Gs());se(this,"options",this.setOptions);se(this,"parse",this.parseMarkdown(!0));se(this,"parseInline",this.parseMarkdown(!1));se(this,"Parser",wt);se(this,"Renderer",Do);se(this,"TextRenderer",Qs);se(this,"Lexer",yt);se(this,"Tokenizer",No);se(this,"Hooks",Cr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let u of a.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of a.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(u=>{let d=a[u].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let u=o.renderer.apply(this,a);return u===!1&&(u=i.apply(this,a)),u}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new Do(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,u=n.renderer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new No(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,u=n.tokenizer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Cr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,u=n.hooks[a],d=o[a];Cr.passThroughHooks.has(i)?o[a]=h=>{if(this.defaults.async&&Cr.passThroughHooksRespectAsync.has(i))return(async()=>{let b=await u.call(o,h);return d.call(o,b)})();let p=u.call(o,h);return d.call(o,p)}:o[a]=(...h)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(o,h);return b===!1&&(b=await d.apply(o,h)),b})();let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let u=[];return u.push(i.call(this,a)),o&&(u=u.concat(o.call(this,a))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return yt.lex(e,t??this.defaults)}parser(e,t){return wt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(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 i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let h=await(o.hooks?await o.hooks.provideParser(e):e?wt.parse:wt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(h):h})().catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?wt.parse:wt.parseInline)(a,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1429
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Tt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Tn=new yb;function ae(e,t){return Tn.parse(e,t)}ae.options=ae.setOptions=function(e){return Tn.setOptions(e),ae.defaults=Tn.defaults,Ec(ae.defaults),ae};ae.getDefaults=Gs;ae.defaults=Rn;function wb(...e){return Tn.use(...e),ae.defaults=Tn.defaults,Ec(ae.defaults),ae}ae.use=wb;ae.walkTokens=function(e,t){return Tn.walkTokens(e,t)};ae.parseInline=Tn.parseInline;ae.Parser=wt;ae.parser=wt.parse;ae.Renderer=Do;ae.TextRenderer=Qs;ae.Lexer=yt;ae.lexer=yt.lex;ae.Tokenizer=No;ae.Hooks=Cr;ae.parse=ae;ae.options;ae.setOptions;ae.walkTokens;ae.parseInline;wt.parse;yt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Nc,setPrototypeOf:ha,isFrozen:xb,getPrototypeOf:Sb,getOwnPropertyDescriptor:Tb}=Object;let{freeze:Ye,seal:ut,create:Ps}=Object,{apply:Rs,construct:Ls}=typeof Reflect<"u"&&Reflect;Ye||(Ye=function(t){return t});ut||(ut=function(t){return t});Rs||(Rs=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)});Ls||(Ls=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const uo=Xe(Array.prototype.forEach),Eb=Xe(Array.prototype.lastIndexOf),fa=Xe(Array.prototype.pop),yr=Xe(Array.prototype.push),Ab=Xe(Array.prototype.splice),ko=Xe(String.prototype.toLowerCase),hs=Xe(String.prototype.toString),fs=Xe(String.prototype.match),wr=Xe(String.prototype.replace),Cb=Xe(String.prototype.indexOf),Pb=Xe(String.prototype.trim),kt=Xe(Object.prototype.hasOwnProperty),Fe=Xe(RegExp.prototype.test),xr=Rb(TypeError);function Xe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Rs(e,t,r)}}function Rb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ls(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ko;ha&&ha(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(xb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Lb(e){for(let t=0;t<e.length;t++)kt(e,t)||(e[t]=null);return e}function Et(e){const t=Ps(null);for(const[n,r]of Nc(e))kt(e,n)&&(Array.isArray(r)?t[n]=Lb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Et(r):t[n]=r);return t}function Sr(e,t){for(;e!==null;){const r=Tb(e,t);if(r){if(r.get)return Xe(r.get);if(typeof r.value=="function")return Xe(r.value)}e=Sb(e)}function n(){return null}return n}const ga=Ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gs=Ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ms=Ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ib=Ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),bs=Ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),zb=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ma=Ye(["#text"]),ba=Ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ks=Ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ka=Ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),po=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$b=ut(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ob=ut(/<%[\w\W]*|[\w\W]*%>/gm),Nb=ut(/\$\{[\w\W]*/gm),Db=ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mb=ut(/^aria-[\-\w]+$/),Dc=ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ub=ut(/^(?:\w+script|data):/i),jb=ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Mc=ut(/^html$/i),Zb=ut(/^[a-z][.\w]*(-[.\w]+)+$/i);var _a=Object.freeze({__proto__:null,ARIA_ATTR:Mb,ATTR_WHITESPACE:jb,CUSTOM_ELEMENT:Zb,DATA_ATTR:Db,DOCTYPE_NAME:Mc,ERB_EXPR:Ob,IS_ALLOWED_URI:Dc,IS_SCRIPT_OR_DATA:Ub,MUSTACHE_EXPR:$b,TMPLIT_EXPR:Nb});const Tr={element:1,text:3,progressingInstruction:7,comment:8,document:9},qb=function(){return typeof window>"u"?null:window},Hb=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},va=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Uc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qb();const t=O=>Uc(O);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Tr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,v=d.prototype,C=Sr(v,"cloneNode"),M=Sr(v,"remove"),J=Sr(v,"nextSibling"),P=Sr(v,"childNodes"),T=Sr(v,"parentNode");if(typeof a=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let x,R="";const{implementation:D,createNodeIterator:de,createDocumentFragment:_e,getElementsByTagName:Ee}=n,{importNode:qe}=r;let V=va();t.isSupported=typeof Nc=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:Me,TMPLIT_EXPR:pt,DATA_ATTR:Gt,ARIA_ATTR:et,IS_SCRIPT_OR_DATA:zt,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:K}=_a;let{IS_ALLOWED_URI:$e}=_a,Y=null;const ht=B({},[...ga,...gs,...ms,...bs,...ma]);let ne=null;const ln=B({},[...ba,...ks,...ka,...po]);let ce=Object.seal(Ps(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,Ce=null;const Pe=Object.seal(Ps(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,we=!0,Ve=!1,nt=!0,Re=!1,rt=!0,$t=!1,Ot=!1,Ln=!1,Wt=!1,un=!1,dn=!1,Zr=!0,ar=!1;const Vo="user-content-";let cr=!0,pn=!1,Jt={},He=null;const lr=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const qr=B({},["audio","video","img","source","image","track"]);let ur=null;const Hr=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),In="http://www.w3.org/1998/Math/MathML",zn="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Yt=ft,hn=!1,fn=null;const Ko=B({},[In,zn,ft],hs);let $n=B({},["mi","mo","mn","ms","mtext"]),On=B({},["annotation-xml"]);const Qo=B({},["title","style","font","a","script"]);let Nt=null;const gt=["application/xhtml+xml","text/html"],es="text/html";let ue=null,Xt=null;const Fr=n.createElement("form"),dr=function(k){return k instanceof RegExp||k instanceof Function},Nn=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xt&&Xt===k)){if((!k||typeof k!="object")&&(k={}),k=Et(k),Nt=gt.indexOf(k.PARSER_MEDIA_TYPE)===-1?es:k.PARSER_MEDIA_TYPE,ue=Nt==="application/xhtml+xml"?hs:ko,Y=kt(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,ue):ht,ne=kt(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,ue):ln,fn=kt(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,hs):Ko,ur=kt(k,"ADD_URI_SAFE_ATTR")?B(Et(Hr),k.ADD_URI_SAFE_ATTR,ue):Hr,le=kt(k,"ADD_DATA_URI_TAGS")?B(Et(qr),k.ADD_DATA_URI_TAGS,ue):qr,He=kt(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,ue):lr,re=kt(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,ue):Et({}),Ce=kt(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,ue):Et({}),Jt=kt(k,"USE_PROFILES")?k.USE_PROFILES:!1,ee=k.ALLOW_ARIA_ATTR!==!1,we=k.ALLOW_DATA_ATTR!==!1,Ve=k.ALLOW_UNKNOWN_PROTOCOLS||!1,nt=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Re=k.SAFE_FOR_TEMPLATES||!1,rt=k.SAFE_FOR_XML!==!1,$t=k.WHOLE_DOCUMENT||!1,Wt=k.RETURN_DOM||!1,un=k.RETURN_DOM_FRAGMENT||!1,dn=k.RETURN_TRUSTED_TYPE||!1,Ln=k.FORCE_BODY||!1,Zr=k.SANITIZE_DOM!==!1,ar=k.SANITIZE_NAMED_PROPS||!1,cr=k.KEEP_CONTENT!==!1,pn=k.IN_PLACE||!1,$e=k.ALLOWED_URI_REGEXP||Dc,Yt=k.NAMESPACE||ft,$n=k.MATHML_TEXT_INTEGRATION_POINTS||$n,On=k.HTML_INTEGRATION_POINTS||On,ce=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&dr(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&dr(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Re&&(we=!1),un&&(Wt=!0),Jt&&(Y=B({},ma),ne=[],Jt.html===!0&&(B(Y,ga),B(ne,ba)),Jt.svg===!0&&(B(Y,gs),B(ne,ks),B(ne,po)),Jt.svgFilters===!0&&(B(Y,ms),B(ne,ks),B(ne,po)),Jt.mathMl===!0&&(B(Y,bs),B(ne,ka),B(ne,po))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Pe.tagCheck=k.ADD_TAGS:(Y===ht&&(Y=Et(Y)),B(Y,k.ADD_TAGS,ue))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Pe.attributeCheck=k.ADD_ATTR:(ne===ln&&(ne=Et(ne)),B(ne,k.ADD_ATTR,ue))),k.ADD_URI_SAFE_ATTR&&B(ur,k.ADD_URI_SAFE_ATTR,ue),k.FORBID_CONTENTS&&(He===lr&&(He=Et(He)),B(He,k.FORBID_CONTENTS,ue)),k.ADD_FORBID_CONTENTS&&(He===lr&&(He=Et(He)),B(He,k.ADD_FORBID_CONTENTS,ue)),cr&&(Y["#text"]=!0),$t&&B(Y,["html","head","body"]),Y.table&&(B(Y,["tbody"]),delete re.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw xr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=k.TRUSTED_TYPES_POLICY,R=x.createHTML("")}else x===void 0&&(x=Hb(_,o)),x!==null&&typeof R=="string"&&(R=x.createHTML(""));Ye&&Ye(k),Xt=k}},pr=B({},[...gs,...ms,...Ib]),Br=B({},[...bs,...zb]),ts=function(k){let S=T(k);(!S||!S.tagName)&&(S={namespaceURI:Yt,tagName:"template"});const L=ko(k.tagName),oe=ko(S.tagName);return fn[k.namespaceURI]?k.namespaceURI===zn?S.namespaceURI===ft?L==="svg":S.namespaceURI===In?L==="svg"&&(oe==="annotation-xml"||$n[oe]):!!pr[L]:k.namespaceURI===In?S.namespaceURI===ft?L==="math":S.namespaceURI===zn?L==="math"&&On[oe]:!!Br[L]:k.namespaceURI===ft?S.namespaceURI===zn&&!On[oe]||S.namespaceURI===In&&!$n[oe]?!1:!Br[L]&&(Qo[L]||!pr[L]):!!(Nt==="application/xhtml+xml"&&fn[k.namespaceURI]):!1},ot=function(k){yr(t.removed,{element:k});try{T(k).removeChild(k)}catch{M(k)}},st=function(k,S){try{yr(t.removed,{attribute:S.getAttributeNode(k),from:S})}catch{yr(t.removed,{attribute:null,from:S})}if(S.removeAttribute(k),k==="is")if(Wt||un)try{ot(S)}catch{}else try{S.setAttribute(k,"")}catch{}},Gr=function(k){let S=null,L=null;if(Ln)k="<remove></remove>"+k;else{const ve=fs(k,/^[\r\n\t ]+/);L=ve&&ve[0]}Nt==="application/xhtml+xml"&&Yt===ft&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const oe=x?x.createHTML(k):k;if(Yt===ft)try{S=new m().parseFromString(oe,Nt)}catch{}if(!S||!S.documentElement){S=D.createDocument(Yt,"template",null);try{S.documentElement.innerHTML=hn?R:oe}catch{}}const ze=S.body||S.documentElement;return k&&L&&ze.insertBefore(n.createTextNode(L),ze.childNodes[0]||null),Yt===ft?Ee.call(S,$t?"html":"body")[0]:$t?S.documentElement:ze},hr=function(k){return de.call(k.ownerDocument||k,k,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},fr=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof p)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Wr=function(k){return typeof u=="function"&&k instanceof u};function mt(O,k,S){uo(O,L=>{L.call(t,k,S,Xt)})}const Jr=function(k){let S=null;if(mt(V.beforeSanitizeElements,k,null),fr(k))return ot(k),!0;const L=ue(k.nodeName);if(mt(V.uponSanitizeElement,k,{tagName:L,allowedTags:Y}),rt&&k.hasChildNodes()&&!Wr(k.firstElementChild)&&Fe(/<[/\w!]/g,k.innerHTML)&&Fe(/<[/\w!]/g,k.textContent)||k.nodeType===Tr.progressingInstruction||rt&&k.nodeType===Tr.comment&&Fe(/<[/\w]/g,k.data))return ot(k),!0;if(!(Pe.tagCheck instanceof Function&&Pe.tagCheck(L))&&(!Y[L]||re[L])){if(!re[L]&&Xr(L)&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L)))return!1;if(cr&&!He[L]){const oe=T(k)||k.parentNode,ze=P(k)||k.childNodes;if(ze&&oe){const ve=ze.length;for(let Ue=ve-1;Ue>=0;--Ue){const bt=C(ze[Ue],!0);bt.__removalCount=(k.__removalCount||0)+1,oe.insertBefore(bt,J(k))}}}return ot(k),!0}return k instanceof d&&!ts(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Fe(/<\/no(script|embed|frames)/i,k.innerHTML)?(ot(k),!0):(Re&&k.nodeType===Tr.text&&(S=k.textContent,uo([Ae,Me,pt],oe=>{S=wr(S,oe," ")}),k.textContent!==S&&(yr(t.removed,{element:k.cloneNode()}),k.textContent=S)),mt(V.afterSanitizeElements,k,null),!1)},Yr=function(k,S,L){if(Zr&&(S==="id"||S==="name")&&(L in n||L in Fr))return!1;if(!(we&&!Ce[S]&&Fe(Gt,S))){if(!(ee&&Fe(et,S))){if(!(Pe.attributeCheck instanceof Function&&Pe.attributeCheck(S,k))){if(!ne[S]||Ce[S]){if(!(Xr(k)&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,k)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(k))&&(ce.attributeNameCheck instanceof RegExp&&Fe(ce.attributeNameCheck,S)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(S,k))||S==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Fe(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L))))return!1}else if(!ur[S]){if(!Fe($e,wr(L,j,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&k!=="script"&&Cb(L,"data:")===0&&le[k])){if(!(Ve&&!Fe(zt,wr(L,j,"")))){if(L)return!1}}}}}}}return!0},Xr=function(k){return k!=="annotation-xml"&&fs(k,K)},gr=function(k){mt(V.beforeSanitizeAttributes,k,null);const{attributes:S}=k;if(!S||fr(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let oe=S.length;for(;oe--;){const ze=S[oe],{name:ve,namespaceURI:Ue,value:bt}=ze,St=ue(ve),mr=bt;let Le=ve==="value"?mr:Pb(mr);if(L.attrName=St,L.attrValue=Le,L.keepAttr=!0,L.forceKeepAttr=void 0,mt(V.uponSanitizeAttribute,k,L),Le=L.attrValue,ar&&(St==="id"||St==="name")&&(st(ve,k),Le=Vo+Le),rt&&Fe(/((--!?|])>)|<\/(style|title|textarea)/i,Le)){st(ve,k);continue}if(St==="attributename"&&fs(Le,"href")){st(ve,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){st(ve,k);continue}if(!nt&&Fe(/\/>/i,Le)){st(ve,k);continue}Re&&uo([Ae,Me,pt],Kr=>{Le=wr(Le,Kr," ")});const Vr=ue(k.nodeName);if(!Yr(Vr,St,Le)){st(ve,k);continue}if(x&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Ue)switch(_.getAttributeType(Vr,St)){case"TrustedHTML":{Le=x.createHTML(Le);break}case"TrustedScriptURL":{Le=x.createScriptURL(Le);break}}if(Le!==mr)try{Ue?k.setAttributeNS(Ue,ve,Le):k.setAttribute(ve,Le),fr(k)?ot(k):fa(t.removed)}catch{st(ve,k)}}mt(V.afterSanitizeAttributes,k,null)},Dt=function O(k){let S=null;const L=hr(k);for(mt(V.beforeSanitizeShadowDOM,k,null);S=L.nextNode();)mt(V.uponSanitizeShadowNode,S,null),Jr(S),gr(S),S.content instanceof i&&O(S.content);mt(V.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(O){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,oe=null,ze=null;if(hn=!O,hn&&(O="<!-->"),typeof O!="string"&&!Wr(O))if(typeof O.toString=="function"){if(O=O.toString(),typeof O!="string")throw xr("dirty is not a string, aborting")}else throw xr("toString is not a function");if(!t.isSupported)return O;if(Ot||Nn(k),t.removed=[],typeof O=="string"&&(pn=!1),pn){if(O.nodeName){const bt=ue(O.nodeName);if(!Y[bt]||re[bt])throw xr("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof u)S=Gr("<!---->"),L=S.ownerDocument.importNode(O,!0),L.nodeType===Tr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!Wt&&!Re&&!$t&&O.indexOf("<")===-1)return x&&dn?x.createHTML(O):O;if(S=Gr(O),!S)return Wt?null:dn?R:""}S&&Ln&&ot(S.firstChild);const ve=hr(pn?O:S);for(;oe=ve.nextNode();)Jr(oe),gr(oe),oe.content instanceof i&&Dt(oe.content);if(pn)return O;if(Wt){if(un)for(ze=_e.call(S.ownerDocument);S.firstChild;)ze.appendChild(S.firstChild);else ze=S;return(ne.shadowroot||ne.shadowrootmode)&&(ze=qe.call(r,ze,!0)),ze}let Ue=$t?S.outerHTML:S.innerHTML;return $t&&Y["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Fe(Mc,S.ownerDocument.doctype.name)&&(Ue="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
1430
|
+
`+Ue),Re&&uo([Ae,Me,pt],bt=>{Ue=wr(Ue,bt," ")}),x&&dn?x.createHTML(Ue):Ue},t.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nn(O),Ot=!0},t.clearConfig=function(){Xt=null,Ot=!1},t.isValidAttribute=function(O,k,S){Xt||Nn({});const L=ue(O),oe=ue(k);return Yr(L,oe,S)},t.addHook=function(O,k){typeof k=="function"&&yr(V[O],k)},t.removeHook=function(O,k){if(k!==void 0){const S=Eb(V[O],k);return S===-1?void 0:Ab(V[O],S,1)[0]}return fa(V[O])},t.removeHooks=function(O){V[O]=[]},t.removeAllHooks=function(){V=va()},t}var Fb=Uc();function jc(e){const t=ae.parse(e,{gfm:!0,breaks:!0,async:!1});return Fb.sanitize(t)}const Zc=1e3,qc=32,ya=15e3,Bb=new Set(["completed","failed","cancelled"]),Gb=4e3;let z=null,It=null,De=null,ei=null,Mo=null,Is=!1,_o=null,Rr=null,U={kind:"connecting"},Xn=[],tr=null,fe=null,nr=null,jt=null,Lr=-1,Je=null,qt=!1,Zt=null,yn=new Set;function zs(){vo(),Sc(),It&&clearInterval(It),It=null,Zt==null||Zt(),Zt=null,De==null||De.destroy(),De=null,z&&Ft(z),z==null||z.remove(),z=null,ei=null,U={kind:"connecting"},Xn=[],tr=null,fe=null,nr=null,jt=null,Mo=null,Lr=-1,Je=null,qt=!1,yn=new Set}function ti(e,t,n,r,o){z&&zs(),ei=o??null,U={kind:"connecting"},Xn=[],tr=null,Lr=-1,Je=null,qt=!1,yn=new Set,fe=e,nr=n,jt=t,Mo=r,xc({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
|
|
1458
1431
|
<div class="ap-sdk-panel__header">
|
|
1459
1432
|
<span class="ap-sdk-panel__title">
|
|
1460
1433
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1467,7 +1440,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1467
1440
|
<div class="ap-sdk-runner__meta">
|
|
1468
1441
|
<div class="ap-sdk-runner__meta-row">
|
|
1469
1442
|
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
|
|
1470
|
-
<span class="ap-sdk-runner__title" title="${
|
|
1443
|
+
<span class="ap-sdk-runner__title" title="${ok(r)}">${ri(i)}</span>
|
|
1471
1444
|
</div>
|
|
1472
1445
|
<div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
|
|
1473
1446
|
<span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
|
|
@@ -1493,17 +1466,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1493
1466
|
</div>
|
|
1494
1467
|
<div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
|
|
1495
1468
|
<div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
|
|
1496
|
-
`,
|
|
1497
|
-
<div class="ap-sdk-runner__question-label">${
|
|
1498
|
-
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${
|
|
1469
|
+
`,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),De=Os(),Ht(z),Bs(z,Fs),z.querySelector("[data-ap-close]").addEventListener("click",()=>{zs(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Yb(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const u=a.currentTarget;if(!Is){Is=!0,u.textContent="Confirm",_o=setTimeout(vo,Gb),Rr=d=>{d.target!==u&&vo()},document.addEventListener("click",Rr,!0);return}vo(),Wb(t,e)}),ni(),Hc(e,t)}function Hc(e,t){const n=async u=>{if(fe!==e||!z||U.kind!=="idle"&&U.kind!=="connecting"||yn.has(u.commandId))return;yn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};vn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await wa(d,t,e)},r=u=>{if(!(fe!==e||!z)&&Bb.has(u)){if(U.kind==="executing")vn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;vn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{fe!==e||!z||(u.outputChunk&&xa([u.outputChunk]),r(u.status))},i=async()=>{if(!(fe!==e||!z))try{const u=await $o(t,e);fe===e&&z&&(Je=u[0]??null,En())}catch{}},a=async()=>{try{const[u,d,h,p]=await Promise.all([yc(t,e),lm(t,e),$o(t,e),am(t,e)]);if(fe!==e||!z)return;xa(d),Je=h[0]??null,En(),r(u.status),p&&p.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!yn.has(p.id)?(yn.add(p.id),vn({kind:"executing",command:p,actionsRun:U.kind==="idle"?U.actionsRun:0}),await wa(p,t,e)):U.kind==="connecting"&&vn({kind:"idle",actionsRun:0})}catch{}};a(),vm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(u=>{if(fe!==e||U.kind==="finished"){u();return}Zt=u})}function vn(e){U=e,U.kind==="idle"&&tr===null&&(tr=Date.now(),Uo(),It=setInterval(Uo,Zc)),U.kind==="finished"&&(It&&(clearInterval(It),It=null),Zt==null||Zt(),Zt=null,De==null||De.hide(),Sc()),ni()}function vo(){Is=!1,_o&&(clearTimeout(_o),_o=null),Rr&&(document.removeEventListener("click",Rr,!0),Rr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function Wb(e,t){if(fe!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await dm(e,t)}catch{n&&(n.disabled=!1)}}function Fc(){if(!fe||!jt||!nr||!Mo)return;const e=fe,t=jt;xc({taskId:e,backendUrl:nr,title:Mo}),It&&clearInterval(It),Uo(),It=setInterval(Uo,Zc);const n=U.kind==="finished"?U.actionsRun:0;yn=new Set,U={kind:"idle",actionsRun:n},ni(),Hc(e,t)}function ni(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",nk(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Xn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!i){const p=document.createElement("div");p.className="ap-sdk-runner__placeholder",p.setAttribute("data-ap-runner-placeholder","1"),p.textContent="Waiting for the agent's first action…",n.appendChild(p)}}else i==null||i.remove();En();const a=z.querySelector("[data-ap-runner-chat-input]"),u=z.querySelector("[data-ap-runner-chat-send]");if(a&&u){const p=U.kind==="finished"&&U.status==="failed";a.disabled=p,u.disabled=p||qt,p&&(a.placeholder="This task failed — start a new automation to continue.")}const d=z.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const h=z.querySelector("[data-ap-runner-summary]");h&&U.kind!=="finished"&&(h.style.display="none",h.innerHTML="")}function En(){if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Je){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Je.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
|
|
1470
|
+
<div class="ap-sdk-runner__question-label">${ri((n==null?void 0:n.header)||"The agent has a question")}</div>
|
|
1471
|
+
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${jc((n==null?void 0:n.question)||Je.question)}</div>
|
|
1499
1472
|
${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
|
|
1500
|
-
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const i of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=i.label,a.addEventListener("click",()=>void
|
|
1473
|
+
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const i of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=i.label,a.addEventListener("click",()=>void Jb(i.label)),o.appendChild(a)}}}async function Jb(e){if(!z||!Je||!fe||qt)return;const t=fe,n=jt;if(n){qt=!0;try{const r={selectedOption:e};await wc(n,t,Je.id,r),Je=null,En();const o=await $o(n,t);fe===t&&z&&(Je=o[0]??null,En())}catch{const r=z.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{qt=!1}}}function Uo(){if(!z||tr===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-tr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function wa(e,t,n){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);De==null||De.update(a),o=Vb(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(De==null||De.update(a),e.action==="click")await wm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Kb(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(fe===n&&z&&Qb(r,e,o),await Xb(t,n,e.id,r,o),fe!==n||!z)return;De==null||De.hide();const i=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?vn({kind:"finished",status:U.status,actionsRun:i}):U.kind==="executing"&&vn({kind:"idle",actionsRun:i})}async function Yb(e,t){if(!z||qt||U.kind==="finished"&&U.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){qt=!0,o.disabled=!0,r.style.display="none";try{if(Je){await wc(e,t,Je.id,i),Je=null,En();try{const a=await $o(e,t);fe===t&&z&&(Je=a[0]??null,En())}catch{}}else await um(e,t,i),U.kind==="finished"&&Fc();n.value=""}catch(a){r.textContent=a instanceof Error?a.message:"Failed to send — try again.",r.style.display="block"}finally{qt=!1,o.disabled=!1}}}async function Xb(e,t,n,r,o){try{await cm(e,t,n,r,o)}catch{}}function Vb(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Na(t);let n=t.outerHTML,r=!1;return n.length>ya&&(n=n.slice(0,ya),r=!0),`URL: ${location.href}
|
|
1501
1474
|
Title: ${document.title}
|
|
1502
1475
|
|
|
1503
1476
|
${n}${r?`
|
|
1504
|
-
… (truncated)`:""}`}function
|
|
1477
|
+
… (truncated)`:""}`}function Kb(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Qb(e,t,n){var b;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=a?` — ${a}`:"";if(Xn.push({status:e,text:`${r} ${i}${u}`}),!z)return;const d=z.querySelector("[data-ap-runner-log]");if(!d)return;(b=d.querySelector("[data-ap-runner-placeholder]"))==null||b.remove();const h=d.scrollHeight-d.scrollTop-d.clientHeight<=qc,p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=Xn[Xn.length-1].text,d.appendChild(p),h&&(d.scrollTop=d.scrollHeight)}function ek(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function tk(e){const t=ek(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function xa(e){var r;const t=e.filter(o=>o.sequence>Lr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Lr=Math.max(Lr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=tk(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=qc,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=jc(i)):u.textContent=i,n.appendChild(u),a&&(n.scrollTop=n.scrollHeight)}}function nk(e){if(!z||!fe||!nr)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${nr.replace(/\/+$/,"")}/tasks/${fe}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
|
|
1505
1478
|
<div class="ap-sdk-success-card">
|
|
1506
|
-
<p class="ap-sdk-success-headline">${
|
|
1479
|
+
<p class="ap-sdk-success-headline">${ri(r)}</p>
|
|
1507
1480
|
${o?`
|
|
1508
1481
|
<div class="ap-sdk-runner__approval" data-ap-runner-approval>
|
|
1509
1482
|
<div class="ap-sdk-runner__approval-actions">
|
|
@@ -1521,7 +1494,7 @@ ${n}${r?`
|
|
|
1521
1494
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
|
|
1522
1495
|
</div>
|
|
1523
1496
|
</div>
|
|
1524
|
-
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=
|
|
1497
|
+
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=ei;zs(),i==null||i()}),o&&rk(t)}function rk(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=p=>{a.textContent=p,a.style.display="block"};t.addEventListener("click",async()=>{if(!fe||!jt)return;const p=fe,b=jt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{await pm(b,p),u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,d(m instanceof Error?m.message:"Failed to approve — try again.")}}),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const h=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",h),i.addEventListener("click",async()=>{if(!fe||!jt)return;const p=fe,b=jt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{await hm(b,p,m),m?Fc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){i.disabled=!1,t.disabled=!1,h(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function ok(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ri(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function sk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
|
|
1525
1498
|
<details class="ap-sdk-advanced__details">
|
|
1526
1499
|
<summary class="ap-sdk-advanced__summary">Advanced options</summary>
|
|
1527
1500
|
<div class="ap-sdk-advanced__body">
|
|
@@ -1540,12 +1513,12 @@ ${n}${r?`
|
|
|
1540
1513
|
</div>
|
|
1541
1514
|
</div>
|
|
1542
1515
|
</details>
|
|
1543
|
-
`,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};
|
|
1544
|
-
`)}const
|
|
1516
|
+
`,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};sm(h,n??void 0).then(p=>{if(d=p,p.length===0){i.style.display="none";return}const b=p.find(m=>m.isDefault&&m.scope==="project")??p.find(m=>m.isDefault&&m.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+p.map(m=>`<option value="${ik(m.id)}">${ak(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),a.value=(b==null?void 0:b.id)??""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const h=document.createElement("span");h.className="ap-sdk-advanced__hint",h.textContent="Connect credentials to enable template selection",i.appendChild(h)}return{getOptions(){var b,m,_,v,C,M,J;const h=a.value||null,p=h?((b=d.find(P=>P.id===h))==null?void 0:b.templateData)??{}:{};return{claudeTemplateId:h,quickMode:u.checked,...p.modelOverride!=null?{modelOverride:p.modelOverride}:{},...p.claudeProfileId!=null?{claudeProfileId:p.claudeProfileId}:{},...p.effort!=null?{effort:p.effort}:{},...p.executionMode!=null?{executionMode:p.executionMode}:{},...(m=p.selectedPluginIds)!=null&&m.length?{selectedPluginIds:p.selectedPluginIds}:{},...(_=p.selectedSkillIds)!=null&&_.length?{selectedSkillIds:p.selectedSkillIds}:{},...(v=p.selectedPluginSkillIds)!=null&&v.length?{selectedPluginSkillIds:p.selectedPluginSkillIds}:{},...(C=p.selectedMcpServerIds)!=null&&C.length?{selectedMcpServerIds:p.selectedMcpServerIds}:{},...(M=p.selectedSlashCommandIds)!=null&&M.length?{selectedSlashCommandIds:p.selectedSlashCommandIds}:{},...(J=p.selectedRemoteContextProviderIds)!=null&&J.length?{selectedRemoteContextProviderIds:p.selectedRemoteContextProviderIds}:{}}}}}function ik(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ak(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const oi="ap-sdk-captures",ck=50;function ir(){try{const e=localStorage.getItem(oi);return e?JSON.parse(e):[]}catch{return[]}}function lk(e){const t=ir(),n=[e,...t].slice(0,ck);try{localStorage.setItem(oi,JSON.stringify(n))}catch{}}function uk(){try{localStorage.removeItem(oi)}catch{}}function Bc(e){var a,u,d,h,p;if(e.id){const b=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=b==null?void 0:b.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(u=t==null?void 0:t.textContent)==null?void 0:u.trim();if(n)return n;const r=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(r)return r;const o=(h=e.placeholder)==null?void 0:h.trim();if(o)return o;const i=(p=e.getAttribute("name"))==null?void 0:p.trim();return i||e.tagName.toLowerCase()}function dk(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Gc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Sa(e,t){return`Scrolled to (${e}, ${t})`}function pk(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Wc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
|
|
1517
|
+
`)}const hk=400,fk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),gk=new Set(["Control","Meta","Alt","Shift"]);function mk(e){if(gk.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):fk.has(e.key)?e.key:null}function bk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Bc(e):Co(e)||e.tagName.toLowerCase()}let rr=[],Be=null,jo=null,Ke=null,Pt=null,Rt=null;function Jc(){jo&&(jo.textContent=`● Recording — ${rr.length} step${rr.length===1?"":"s"}`)}function $s(){Rt&&(clearTimeout(Rt),Rt=null),Pt&&(rr.push(Pt),Pt=null,Jc())}function _s(e){$s(),rr.push(e),Jc()}function kk(e){var t,n;return e instanceof HTMLSelectElement?((n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())??e.value:e.value}function _k(e,t){Ke&&Ke(),rr=[],Pt=null,Be=document.createElement("div"),Be.className="ap-sdk-recorder-bar",Be.setAttribute("data-ap-sdk","1"),Be.innerHTML=`
|
|
1545
1518
|
<span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
|
|
1546
1519
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
|
|
1547
1520
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
|
|
1548
|
-
`,document.body.appendChild(Be),
|
|
1521
|
+
`,document.body.appendChild(Be),Ht(Be),jo=Be.querySelector("[data-ap-recorder-counter]");const n=()=>{$s();const d=rr;Ke==null||Ke(),e(d)},r=()=>{Ke==null||Ke()};Be.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Be.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(Pr(d.target))return;const h=d.target;_s({action:"click",cssSelector:mo(h),elementText:Co(h),description:dk(Co(h),h.tagName),capturedAt:new Date().toISOString()})},i=d=>{if(Pr(d.target))return;const h=d.target;if(!(h instanceof HTMLInputElement)&&!(h instanceof HTMLTextAreaElement)&&!(h instanceof HTMLSelectElement))return;const p=Bc(h),b=ad(h),m=b?"[redacted]":kk(h);_s({action:"inputText",cssSelector:mo(h),elementText:p,value:m,...b?{redacted:!0}:{},description:Gc(p,m,b),capturedAt:new Date().toISOString()})},a=()=>{const d=Math.round(window.scrollX),h=Math.round(window.scrollY);Pt?(Pt.scrollX=d,Pt.scrollY=h,Pt.description=Sa(d,h)):Pt={action:"scroll",scrollX:d,scrollY:h,description:Sa(d,h),capturedAt:new Date().toISOString()},Rt&&clearTimeout(Rt),Rt=setTimeout(()=>{Rt=null,$s()},hk)},u=d=>{if(d.key==="Escape"){r();return}if(Pr(d.target))return;const h=mk(d);if(!h)return;const p=d.target instanceof Element?d.target:document.body,b=bk(p);_s({action:"keypress",cssSelector:mo(p),elementText:b,key:h,description:pk(h,b),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),Ke=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),Rt&&(clearTimeout(Rt),Rt=null),Pt=null,Be&&Ft(Be),Be==null||Be.remove(),Be=null,jo=null,Ke=null}}function vk(){Ke==null||Ke()}function yo(){return Ke!==null}const yk="data-ap-sdk",wk="ap-sdk-fab",Ta="ap-sdk-fab--dragging",si="ap-sdk-fab--open",Yc="ap-sdk-fab-pos",Zo="ap-sdk-fab--left-edge",xk='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',Sk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',Tk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',Ek='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let I=null,At=null,en=null,tn=null,it=null,Un=null,jn=null,Zn=null,wo=null,Ir=null,Vn=null,xo=null,So=null,To=null,Xc=0,Vc=0,Kc=0,Qc=0,Fn=!1,_t=!1,zr=null,wn=null;function Ak(){zr=e=>{if(!I){Eo();return}if(!Fn){if(Math.hypot(e.clientX-Kc,e.clientY-Qc)<5)return;Fn=!0,_t=!0,I.classList.add(Ta)}Ck(e.clientX-Xc,e.clientY-Vc)},wn=()=>{if(!I){Eo();return}Fn?(Fn=!1,I.classList.remove(Ta),I.style.transition="",Pk(I.getBoundingClientRect())):I.style.transition="",Eo()},window.addEventListener("pointermove",zr),window.addEventListener("pointerup",wn),window.addEventListener("pointercancel",wn)}function Eo(){zr&&(window.removeEventListener("pointermove",zr),zr=null),wn&&(window.removeEventListener("pointerup",wn),window.removeEventListener("pointercancel",wn),wn=null)}function Ck(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function Pk(e){if(!I)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Zo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Zo));try{localStorage.setItem(Yc,JSON.stringify({edge:r,bottom:n}))}catch{}}function Rk(){if(I)try{const e=localStorage.getItem(Yc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Zo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Zo))}catch{}}function Bn(){I==null||I.classList.remove(si),Vn&&(window.removeEventListener("pointerdown",Vn,{capture:!0}),Vn=null)}function Lk(){I&&(I.classList.add(si),Vn=e=>{!I||I.contains(e.target)||Bn()},requestAnimationFrame(()=>{Vn&&window.addEventListener("pointerdown",Vn,{capture:!0})}))}function ho(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function el(e,t,n){if(xo=e,So=t,To=n,I)return;I=document.createElement("div"),I.className=wk,I.setAttribute(yk,"1"),Un=document.createElement("div"),Un.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",it=document.createElement("button"),it.className="ap-sdk-fab__list ap-sdk-fab__sub",it.setAttribute("aria-label","My captures"),it.setAttribute("title","View my captures"),it.appendChild(ho(Ek));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",it.appendChild(o),Un.appendChild(r),Un.appendChild(it),jn=document.createElement("div"),jn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",en=document.createElement("button"),en.className="ap-sdk-fab__capture ap-sdk-fab__sub",en.setAttribute("aria-label","Capture element"),en.setAttribute("title","Capture element to Agent Platform"),en.appendChild(ho(Sk)),jn.appendChild(i),jn.appendChild(en),Zn=document.createElement("div"),Zn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",tn=document.createElement("button"),tn.className="ap-sdk-fab__record ap-sdk-fab__sub",tn.setAttribute("aria-label","Record interaction"),tn.setAttribute("title","Record a sequence of interactions"),tn.appendChild(ho(Tk)),Zn.appendChild(a),Zn.appendChild(tn),At=document.createElement("button"),At.className="ap-sdk-fab__main",At.setAttribute("aria-label","Agent Platform"),At.setAttribute("title","Agent Platform"),At.appendChild(ho(xk)),I.appendChild(Un),I.appendChild(jn),I.appendChild(Zn),I.appendChild(At),At.addEventListener("click",u=>{if(_t){_t=!1;return}u.preventDefault(),u.stopPropagation(),I!=null&&I.classList.contains(si)?Bn():Lk()}),en.addEventListener("click",u=>{if(_t){_t=!1;return}u.preventDefault(),u.stopPropagation(),Bn(),!Jn()&&!yo()&&xo&&xo()}),tn.addEventListener("click",u=>{if(_t){_t=!1;return}u.preventDefault(),u.stopPropagation(),Bn(),!Jn()&&!yo()&&So&&So()}),it.addEventListener("click",u=>{if(_t){_t=!1;return}u.preventDefault(),u.stopPropagation(),Bn(),To&&To()}),Ir=u=>{if(!I||!(I===u.target||I.contains(u.target)))return;const d=I.getBoundingClientRect();Xc=u.clientX-d.left,Vc=u.clientY-d.top,Kc=u.clientX,Qc=u.clientY,Fn=!1,_t=!1,I.style.transition="none",u.stopPropagation(),Ak()},window.addEventListener("pointerdown",Ir,{capture:!0}),(document.body??document.documentElement).appendChild(I),Ht(I),Rk(),wo=setInterval(()=>{At&&At.classList.toggle("ap-sdk-fab__main--active",Jn()||yo())},200)}function An(e){const t=it==null?void 0:it.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function tl(){Fn=!1,_t=!1,Eo(),Bn(),wo&&(clearInterval(wo),wo=null),Ir&&(window.removeEventListener("pointerdown",Ir,{capture:!0}),Ir=null),I&&Ft(I),I==null||I.remove(),I=null,At=null,en=null,tn=null,it=null,Un=null,jn=null,Zn=null,xo=null,So=null,To=null}async function nl(e,t){try{if(e.type==="planning"){const r=await im(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await yc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function rl(e){return e.filter(t=>!t.approved).length}async function ol(e){const t=ir();if(!e||t.length===0){An(t.length);return}const n=await Promise.all(t.map(r=>nl(r,e)));An(rl(n))}let H=null,We=null,Ut=null;function $r(){return H!==null}function Dr(){H&&Ft(H),H==null||H.remove(),H=null,Ut==null||Ut(),Ut=null,We==null||We.destroy(),We=null}function sl(e,t,n,r,o,i,a,u,d,h){H&&Dr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},b=!n.backendUrl||!n.token;H=document.createElement("div"),H.className="ap-sdk-panel",H.setAttribute("data-ap-sdk","1"),H.setAttribute("role","dialog"),H.setAttribute("aria-modal","true"),H.setAttribute("aria-label","Capture to Agent Platform"),H.innerHTML=`
|
|
1549
1522
|
<div class="ap-sdk-panel__header">
|
|
1550
1523
|
<span class="ap-sdk-panel__title">
|
|
1551
1524
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1558,7 +1531,7 @@ ${n}${r?`
|
|
|
1558
1531
|
</div>
|
|
1559
1532
|
<div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
|
|
1560
1533
|
<div class="ap-sdk-panel__context" data-ap-context>
|
|
1561
|
-
${
|
|
1534
|
+
${Ea(e)}
|
|
1562
1535
|
</div>
|
|
1563
1536
|
<div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
|
|
1564
1537
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
|
|
@@ -1609,41 +1582,41 @@ ${n}${r?`
|
|
|
1609
1582
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
|
|
1610
1583
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
|
|
1611
1584
|
</div>
|
|
1612
|
-
`,H.addEventListener("wheel",j=>{j.stopPropagation()},{passive:!0}),H.addEventListener("touchmove",j=>{j.stopPropagation()},{passive:!0});const m=H.querySelector(".ap-sdk-panel__body"),_=
|
|
1585
|
+
`,H.addEventListener("wheel",j=>{j.stopPropagation()},{passive:!0}),H.addEventListener("touchmove",j=>{j.stopPropagation()},{passive:!0});const m=H.querySelector(".ap-sdk-panel__body"),_=sk(m,n,(r==null?void 0:r.id)??null);document.body.appendChild(H),We=Os(),p.currentPickedEl&&We.update(p.currentPickedEl),Ht(H),Bs(H,Fs);const v=H.querySelector("[data-ap-close]"),C=H.querySelector("[data-ap-cancel]"),M=H.querySelector("[data-ap-submit]"),J=H.querySelector("[data-ap-note]"),P=H.querySelector("[data-ap-status]"),T=H.querySelectorAll("[data-ap-type]"),x=H.querySelector("[data-ap-pick-list]"),R=H.querySelector("[data-ap-context]"),D=H.querySelector("[data-ap-add-another]"),de=H.querySelector("[data-ap-pick-actions]"),_e=H.querySelector("[data-ap-select-parent]"),Ee=H.querySelector("[data-ap-reselect]"),qe=()=>{p.currentPickedEl&&(We==null||We.update(p.currentPickedEl))};window.addEventListener("scroll",qe,{capture:!0,passive:!0}),window.addEventListener("resize",qe),Ut=()=>{window.removeEventListener("scroll",qe,!0),window.removeEventListener("resize",qe)};const V=j=>{j?(R.innerHTML=Ea(j),J.disabled=!1,J.placeholder="Describe the task or planning session…",setTimeout(()=>J.focus(),50)):(R.innerHTML=`
|
|
1613
1586
|
<div class="ap-sdk-panel__context-label">Next element</div>
|
|
1614
1587
|
<div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
|
|
1615
1588
|
`,J.disabled=!0,J.placeholder="Pick an element to continue…")},Ae=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((j,K)=>`
|
|
1616
1589
|
<div class="ap-sdk-pick-entry" data-pick-index="${K}">
|
|
1617
1590
|
<div class="ap-sdk-pick-entry__header">
|
|
1618
1591
|
<span class="ap-sdk-pick-entry__number">${K+1}</span>
|
|
1619
|
-
<span class="ap-sdk-pick-entry__element" title="${
|
|
1592
|
+
<span class="ap-sdk-pick-entry__element" title="${tt(j.ctx.elementText??"")}">${tt(j.ctx.elementText||"(no text)")}</span>
|
|
1620
1593
|
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${K}" aria-label="Remove pick ${K+1}">×</button>
|
|
1621
1594
|
</div>
|
|
1622
|
-
<div class="ap-sdk-pick-entry__instruction">${
|
|
1595
|
+
<div class="ap-sdk-pick-entry__instruction">${tt(j.instruction)}</div>
|
|
1623
1596
|
</div>
|
|
1624
|
-
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(j=>{j.addEventListener("click",()=>{const K=parseInt(j.dataset.apRemove,10);p.completedPicks.splice(K,1),Ae()})})},Me=()=>{if(!p.currentPickedEl){de.style.display="none";return}de.style.display="",_e.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Ee&&(Ee.disabled=p.awaitingPick)},pt=()=>{D&&(D.disabled=!J.value.trim()||p.submitting||p.awaitingPick)},
|
|
1597
|
+
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(j=>{j.addEventListener("click",()=>{const K=parseInt(j.dataset.apRemove,10);p.completedPicks.splice(K,1),Ae()})})},Me=()=>{if(!p.currentPickedEl){de.style.display="none";return}de.style.display="",_e.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Ee&&(Ee.disabled=p.awaitingPick)},pt=()=>{D&&(D.disabled=!J.value.trim()||p.submitting||p.awaitingPick)},Gt=(j,K)=>{p.currentCtx=j,p.currentPickedEl=K,V(j),We==null||We.update(K),Me()};Me(),_e.addEventListener("click",()=>{var K;const j=(K=p.currentPickedEl)==null?void 0:K.parentElement;j&&Gt(Da(j),j)}),Ee&&d&&Ee.addEventListener("click",()=>{if(p.awaitingPick)return;const j=p.currentCtx,K=p.currentPickedEl;p.awaitingPick=!0,Me(),pt(),V(null),d(($e,Y)=>{p.awaitingPick=!1,Gt($e,Y),pt()},()=>{p.awaitingPick=!1,K&&Gt(j,K),pt()})});const et=()=>{Dr(),h==null||h()};v.addEventListener("click",et),C.addEventListener("click",et),T.forEach(j=>{j.addEventListener("click",()=>{p.captureType=j.dataset.apType,T.forEach(K=>K.classList.toggle("ap-sdk-active",K===j))})});const zt=H.querySelector("[data-ap-reconfigure]");a?zt.addEventListener("click",()=>{et(),a()}):zt.style.display="none",D&&u&&(J.addEventListener("input",pt),D.addEventListener("click",()=>{const j=J.value.trim();!j||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:j}),Ae(),J.value="",p.awaitingPick=!0,D.disabled=!0,Me(),V(null),u((K,$e)=>{p.awaitingPick=!1,Gt(K,$e),pt()}))})),M.addEventListener("click",async()=>{var ln,ce;if(p.submitting)return;let j=n.backendUrl??"",K=n.token??"";if(b){const re=H==null?void 0:H.querySelector("[data-ap-backend-url]"),Ce=H==null?void 0:H.querySelector("[data-ap-token]");if(re&&(j=re.value.trim()),Ce&&(K=Ce.value.trim()),!j){Er(P,"error","Backend URL is required.");return}if(!K){Er(P,"error","API Token is required.");return}}const $e=J.value.trim();if(!$e){Er(P,"error","Please enter an instruction.");return}p.submitting=!0,Aa(H,!0),Er(P,null,""),M.textContent="Submitting…";const Y={backendUrl:j,token:K},ht=_.getOptions(),ne=[...p.completedPicks,{ctx:p.currentCtx,instruction:$e}];try{let re=r;re||(re=await vc(Y,o),i({backendUrl:j,token:K}));let Ce,Pe,ee;if(ne.length===1)if(p.captureType==="task")Ce=(await Ts(Y,{projectId:re.id,note:$e,ctx:p.currentCtx,advancedOpts:ht})).id,Pe="task",ee=$e.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let Ve=nd($e,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(ln=p.currentCtx.innerTree)!=null&&ln.trim()&&(Ve+=`
|
|
1625
1598
|
|
|
1626
1599
|
Element tree:
|
|
1627
|
-
${p.currentCtx.innerTree}`),(ce=p.currentCtx.interactionSteps)!=null&&ce.length&&(
|
|
1600
|
+
${p.currentCtx.innerTree}`),(ce=p.currentCtx.interactionSteps)!=null&&ce.length&&(Ve+=`
|
|
1628
1601
|
|
|
1629
1602
|
Recorded steps:
|
|
1630
|
-
${
|
|
1603
|
+
${Wc(p.currentCtx.interactionSteps)}`),Ce=(await Ki(Y,re.id,Ve,ht)).id,Pe="planning",ee=$e.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else Ce=(await Vi(Y,{projectId:re.id,note:$e,ctx:p.currentCtx,advancedOpts:ht})).id,Pe="automate",ee=$e.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const Ve=zk(ne),nt=ne[0].instruction.slice(0,120)||ne[0].ctx.pageTitle||"Multi-element capture",Re=ne.map(rt=>rt.instruction).filter(Boolean).join(`
|
|
1631
1604
|
|
|
1632
|
-
`);p.captureType==="task"?(Ce=(await
|
|
1605
|
+
`);p.captureType==="task"?(Ce=(await Ts(Y,{projectId:re.id,note:Ve,ctx:ne[0].ctx,advancedOpts:ht,titleOverride:nt,type:kc,titleInstruction:Re})).id,Pe="task",ee=nt):p.captureType==="planning"?(Ce=(await Ki(Y,re.id,Ve,ht)).id,Pe="planning",ee=nt):(Ce=(await Vi(Y,{projectId:re.id,note:Ve,ctx:ne[0].ctx,advancedOpts:ht,titleOverride:nt,titleInstruction:Re})).id,Pe="automate",ee=nt)}if(lk({id:Ce,type:Pe,title:ee,backendUrl:j,createdAt:new Date().toISOString()}),ol(Y).catch(()=>{}),b&&i({backendUrl:j,token:K}),Pe==="automate"){et(),ti(Ce,Y,j,ee,h);return}const we=Pe==="task"?`${j.replace(/\/+$/,"")}/tasks/${Ce}`:`${j.replace(/\/+$/,"")}/planning/${Ce}`;$k(P,Pe,ee,we,et),H.classList.add("ap-sdk-panel--success"),Ut==null||Ut(),Ut=null,We==null||We.hide(),p.submitting=!1}catch(re){Er(P,"error",re instanceof Error?re.message:"An unexpected error occurred."),p.submitting=!1,Aa(H,!1),M.textContent="Submit"}}),setTimeout(()=>J.focus(),50)}const Ik={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Ea(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
|
|
1633
1606
|
<div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
|
|
1634
1607
|
<div class="ap-sdk-panel__context-steps">
|
|
1635
1608
|
${e.interactionSteps.map(n=>`
|
|
1636
1609
|
<div class="ap-sdk-panel__context-step">
|
|
1637
|
-
<span class="ap-sdk-panel__context-step-icon">${
|
|
1638
|
-
<span class="ap-sdk-panel__context-step-text">${
|
|
1610
|
+
<span class="ap-sdk-panel__context-step-icon">${Ik[n.action]}</span>
|
|
1611
|
+
<span class="ap-sdk-panel__context-step-text">${tt(n.description)}</span>
|
|
1639
1612
|
</div>
|
|
1640
1613
|
`).join("")}
|
|
1641
1614
|
</div>
|
|
1642
1615
|
`:`
|
|
1643
1616
|
<div class="ap-sdk-panel__context-label">Captured element</div>
|
|
1644
|
-
<div class="ap-sdk-panel__context-text" title="${
|
|
1645
|
-
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${
|
|
1646
|
-
`}function
|
|
1617
|
+
<div class="ap-sdk-panel__context-text" title="${tt(e.elementText??"")}">${tt(e.elementText||"(no text)")}</div>
|
|
1618
|
+
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${tt(e.cssSelector)}">${tt(e.cssSelector)}</div>`:""}
|
|
1619
|
+
`}function zk(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Wc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
|
|
1647
1620
|
Element tree:
|
|
1648
1621
|
${t.ctx.innerTree}`),r.push("",`Instruction:
|
|
1649
1622
|
${t.instruction}`),r.join(`
|
|
@@ -1651,23 +1624,23 @@ ${t.instruction}`),r.join(`
|
|
|
1651
1624
|
|
|
1652
1625
|
---
|
|
1653
1626
|
|
|
1654
|
-
`)}function Er(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function
|
|
1627
|
+
`)}function Er(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function $k(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
|
|
1655
1628
|
<div class="ap-sdk-success-card">
|
|
1656
1629
|
<svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
1657
1630
|
<circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
|
|
1658
1631
|
<path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
|
|
1659
1632
|
</svg>
|
|
1660
|
-
<p class="ap-sdk-success-headline">${
|
|
1633
|
+
<p class="ap-sdk-success-headline">${tt(a)}</p>
|
|
1661
1634
|
<div class="ap-sdk-success-meta">
|
|
1662
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${
|
|
1663
|
-
<span class="ap-sdk-success-title" title="${
|
|
1635
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${tt(i)}</span>
|
|
1636
|
+
<span class="ap-sdk-success-title" title="${tt(n)}">${tt(d)}</span>
|
|
1664
1637
|
</div>
|
|
1665
1638
|
<div class="ap-sdk-success-actions">
|
|
1666
|
-
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${
|
|
1639
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${tt(u)}</button>
|
|
1667
1640
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
|
|
1668
1641
|
</div>
|
|
1669
1642
|
</div>
|
|
1670
|
-
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function
|
|
1643
|
+
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Aa(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function tt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}let ie=null;function il(){return ie!==null}function Sn(){ie&&Ft(ie),ie==null||ie.remove(),ie=null}function Ok(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Nk(e){if(ie){Sn();return}ie=document.createElement("div"),ie.className="ap-sdk-panel",ie.setAttribute("data-ap-sdk","1"),ie.setAttribute("role","dialog"),ie.setAttribute("aria-modal","true"),ie.setAttribute("aria-label","My captures"),ie.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ie.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ie.innerHTML=`
|
|
1671
1644
|
<div class="ap-sdk-panel__header">
|
|
1672
1645
|
<span class="ap-sdk-panel__title">
|
|
1673
1646
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1680,18 +1653,18 @@ ${t.instruction}`),r.join(`
|
|
|
1680
1653
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
|
|
1681
1654
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
|
|
1682
1655
|
</div>
|
|
1683
|
-
`,document.body.appendChild(ie),
|
|
1656
|
+
`,document.body.appendChild(ie),Ht(ie),Bs(ie,Fs),ie.querySelector("[data-ap-close]").addEventListener("click",()=>{Sn()}),ie.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Sn()}),ie.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{uk(),An(0),Ca(e)}),Ca(e)}function Ca(e){if(!ie)return;const t=ie.querySelector("[data-ap-list-body]"),n=ir();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
|
|
1684
1657
|
<div class="ap-sdk-list-item">
|
|
1685
1658
|
<div class="ap-sdk-list-item__row">
|
|
1686
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${
|
|
1687
|
-
<span class="ap-sdk-list-item__title" title="${fo(r.title)}">${
|
|
1659
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Ok(r.type)}</span>
|
|
1660
|
+
<span class="ap-sdk-list-item__title" title="${fo(r.title)}">${Uk(r.title)}</span>
|
|
1688
1661
|
</div>
|
|
1689
1662
|
<div class="ap-sdk-list-item__row">
|
|
1690
1663
|
<span class="ap-sdk-status-badge" data-ap-status="${fo(r.id)}">${e?"…":"—"}</span>
|
|
1691
|
-
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${fo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${fo(
|
|
1664
|
+
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${fo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${fo(Mk(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
|
|
1692
1665
|
</div>
|
|
1693
1666
|
</div>
|
|
1694
|
-
`).join(""),e){const r=e;Promise.all(n.map(o=>
|
|
1667
|
+
`).join(""),e){const r=e;Promise.all(n.map(o=>Dk(o,r))).then(o=>{An(rl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(u=>u.id===i);a&&(Sn(),ti(a.id,r,a.backendUrl,a.title,()=>{}))})})}}async function Dk(e,t){const n=await nl(e,t),r=ie==null?void 0:ie.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n}function Mk(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function fo(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Uk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let Kt=null;function jk(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Pa(e){if(Kt){const u=Kt;u.cleanup(),u.popup.closed||u.popup.close(),Kt=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=jk(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((u,d)=>{let h=!1;function p(){window.removeEventListener("message",b),clearInterval(m),(Kt==null?void 0:Kt.popup)===a&&(Kt=null)}function b(_){if(_.origin!==n)return;const v=_.data;!v||v.type!=="ap-sdk-oauth"||v.state!==r||!v.code||(h=!0,p(),u({code:v.code}))}window.addEventListener("message",b);const m=window.setInterval(()=>{a.closed&&(p(),h||d(new Error("Connection cancelled.")))},500);Kt={popup:a,cleanup:p}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const ii="ap-sdk-config";function Zk(){try{const e=sessionStorage.getItem(ii);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(al(),null):t}catch{return null}}function qk(e){sessionStorage.setItem(ii,JSON.stringify(e)),Fk({backendUrl:e.backendUrl,projectCode:e.projectCode})}function al(){sessionStorage.removeItem(ii)}const cl="ap-sdk-last-connection";function Hk(){try{const e=localStorage.getItem(cl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch{return null}}function Fk(e){try{localStorage.setItem(cl,JSON.stringify(e))}catch{}}let W=null;function kn(){W&&Ft(W),W==null||W.remove(),W=null}function Bk(e){W&&kn(),W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Connect to Agent Platform");const t=Hk();t?n(t):r(""),document.body.appendChild(W),Ht(W);function n(i){if(!W)return;W.innerHTML=`
|
|
1695
1668
|
<div class="ap-sdk-panel__header">
|
|
1696
1669
|
<span class="ap-sdk-panel__title">
|
|
1697
1670
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1701,7 +1674,7 @@ ${t.instruction}`),r.join(`
|
|
|
1701
1674
|
</div>
|
|
1702
1675
|
<div class="ap-sdk-panel__body">
|
|
1703
1676
|
<p class="ap-sdk-config-hint">
|
|
1704
|
-
Reconnect to <strong>${
|
|
1677
|
+
Reconnect to <strong>${vs(i.backendUrl)}</strong>. You'll be asked to
|
|
1705
1678
|
approve this connection on Agent Platform's own sign-in page.
|
|
1706
1679
|
</p>
|
|
1707
1680
|
</div>
|
|
@@ -1710,7 +1683,7 @@ ${t.instruction}`),r.join(`
|
|
|
1710
1683
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
|
|
1711
1684
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
|
|
1712
1685
|
</div>
|
|
1713
|
-
`;const a=W.querySelector("[data-ap-cfg-status]"),u=W.querySelector("[data-ap-reconnect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),u.addEventListener("click",async()=>{u.disabled=!0,u.textContent="Connecting…",
|
|
1686
|
+
`;const a=W.querySelector("[data-ap-cfg-status]"),u=W.querySelector("[data-ap-reconnect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),u.addEventListener("click",async()=>{u.disabled=!0,u.textContent="Connecting…",Qt(a,null,"");try{const{code:d}=await Pa(i.backendUrl),{token:h,expiresAt:p}=await ea({backendUrl:i.backendUrl},d,window.location.origin),b={backendUrl:i.backendUrl,token:h},m=await Qi(b);if(m.length===0){Qt(a,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Reconnect";return}const _=m.find(v=>v.key===i.projectCode);_?(kn(),e({backendUrl:i.backendUrl,token:h,projectCode:_.key,expiresAt:p})):o(i.backendUrl,h,p,m)}catch(d){Qt(a,"error",`Could not connect — ${d instanceof Error?d.message:"please try again"}`),u.disabled=!1,u.textContent="Reconnect"}})}function r(i){if(!W)return;W.innerHTML=`
|
|
1714
1687
|
<div class="ap-sdk-panel__header">
|
|
1715
1688
|
<span class="ap-sdk-panel__title">
|
|
1716
1689
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1723,7 +1696,7 @@ ${t.instruction}`),r.join(`
|
|
|
1723
1696
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
|
|
1724
1697
|
<input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
|
|
1725
1698
|
placeholder="https://your-platform.example.com"
|
|
1726
|
-
value="${
|
|
1699
|
+
value="${Ra(i)}" autocomplete="off" data-ap-cfg-url />
|
|
1727
1700
|
</div>
|
|
1728
1701
|
<p class="ap-sdk-config-hint">
|
|
1729
1702
|
You'll be asked to approve this connection on Agent Platform's own sign-in page.
|
|
@@ -1734,7 +1707,7 @@ ${t.instruction}`),r.join(`
|
|
|
1734
1707
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
|
|
1735
1708
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
|
|
1736
1709
|
</div>
|
|
1737
|
-
`;const a=W.querySelector("[data-ap-cfg-url]"),u=W.querySelector("[data-ap-cfg-status]"),d=W.querySelector("[data-ap-connect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-cancel]").addEventListener("click",()=>{kn()}),d.addEventListener("click",async()=>{const h=a.value.trim();if(!h){
|
|
1710
|
+
`;const a=W.querySelector("[data-ap-cfg-url]"),u=W.querySelector("[data-ap-cfg-status]"),d=W.querySelector("[data-ap-connect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-cancel]").addEventListener("click",()=>{kn()}),d.addEventListener("click",async()=>{const h=a.value.trim();if(!h){Qt(u,"error","Backend URL is required.");return}d.disabled=!0,d.textContent="Connecting…",Qt(u,null,"");try{const{code:p}=await Pa(h),{token:b,expiresAt:m}=await ea({backendUrl:h},p,window.location.origin),v=await Qi({backendUrl:h,token:b});if(v.length===0){Qt(u,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Connect via Agent Platform";return}o(h,b,m,v)}catch(p){Qt(u,"error",`Could not connect — ${p instanceof Error?p.message:"please try again"}`),d.disabled=!1,d.textContent="Connect via Agent Platform"}}),setTimeout(()=>a.focus(),50)}function o(i,a,u,d){if(!W)return;const h=d.map(m=>`<option value="${Ra(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${vs(m.name)} (${vs(m.key)})</option>`).join("");W.innerHTML=`
|
|
1738
1711
|
<div class="ap-sdk-panel__header">
|
|
1739
1712
|
<span class="ap-sdk-panel__title">
|
|
1740
1713
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1756,7 +1729,7 @@ ${t.instruction}`),r.join(`
|
|
|
1756
1729
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
|
|
1757
1730
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
|
|
1758
1731
|
</div>
|
|
1759
|
-
`;const p=W.querySelector("[data-ap-cfg-project]"),b=W.querySelector("[data-ap-cfg-status]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),W.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=p.value;if(!m){
|
|
1732
|
+
`;const p=W.querySelector("[data-ap-cfg-project]"),b=W.querySelector("[data-ap-cfg-status]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{kn()}),W.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),W.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=p.value;if(!m){Qt(b,"error","Please select a project.");return}kn(),e({backendUrl:i,token:a,projectCode:m,expiresAt:u})})}}function Qt(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Ra(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let lt=null,qo=!1;function Gk(){lt==null||lt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),lt&<.observe(document.body,{childList:!0}),qo=!1}function ll(){lt||(lt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||qo||(qo=!0,queueMicrotask(Gk))}),lt.observe(document.body,{childList:!0}))}function Wk(){lt==null||lt.disconnect(),lt=null,qo=!1}const Jk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Se=null,nn=[];function Ao(){Se&&Ft(Se),Se==null||Se.remove(),Se=null,nn=[]}function Yk(e,t,n){Se&&Ao(),nn=[...e],Se=document.createElement("div"),Se.className="ap-sdk-panel ap-sdk-record-review",Se.setAttribute("data-ap-sdk","1"),Se.setAttribute("role","dialog"),Se.setAttribute("aria-modal","true"),Se.setAttribute("aria-label","Review recorded steps"),Se.innerHTML=`
|
|
1760
1733
|
<div class="ap-sdk-panel__header">
|
|
1761
1734
|
<span class="ap-sdk-panel__title">
|
|
1762
1735
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1771,11 +1744,11 @@ ${t.instruction}`),r.join(`
|
|
|
1771
1744
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
|
|
1772
1745
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
|
|
1773
1746
|
</div>
|
|
1774
|
-
`,document.body.appendChild(Se),
|
|
1747
|
+
`,document.body.appendChild(Se),Ht(Se);const r=Se.querySelector("[data-ap-review-list]"),o=Se.querySelector("[data-ap-review-continue]"),i=()=>{if(nn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=nn.map((u,d)=>`
|
|
1775
1748
|
<div class="ap-sdk-record-step" data-step-index="${d}">
|
|
1776
|
-
<span class="ap-sdk-record-step__icon">${
|
|
1777
|
-
${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${
|
|
1749
|
+
<span class="ap-sdk-record-step__icon">${Jk[u.action]}</span>
|
|
1750
|
+
${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${Xk(u.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${ul(u.description)}</span>`}
|
|
1778
1751
|
<button class="ap-sdk-record-step__remove" data-ap-step-remove="${d}" aria-label="Remove step ${d+1}">✕</button>
|
|
1779
1752
|
</div>
|
|
1780
|
-
`).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);nn.splice(d,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),h=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const p=nn[h];p.value=u.value,p.description=
|
|
1753
|
+
`).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);nn.splice(d,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),h=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const p=nn[h];p.value=u.value,p.description=Gc(p.elementText??"",u.value,!1)})})};i();const a=()=>{Ao()};Se.querySelector("[data-ap-review-close]").addEventListener("click",a),Se.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(nn.length===0)return;const u=nn,d={...za(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:u};Ao(),t(d)})}function ul(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Xk(e){return ul(e)}let Z=null,Ho=null,Fo=null,Bo=null;function ai(e,t,n){Ho=e,Fo=t,Bo=n,el(e,t,n)}const dl="#agent-platform-web-sdk",pl="ap-sdk-fab-unlocked";let xn=null;function hl(){try{if(localStorage.getItem(pl)==="1")return!0}catch{}return window.location.hash===dl}function La(){try{localStorage.setItem(pl,"1")}catch{}}async function fl(e){if(Mr(),!(Z&&Z.projectCode===e.projectCode&&Z.backendUrl===(e.backendUrl??null)&&Z.token===(e.token??null))){if(Z={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},ai(()=>gl(),()=>Kk(),()=>li()),An(ir().length),Z.backendUrl&&Z.token){const t=Z.backendUrl,n=Z.token;await vl(),ol({backendUrl:t,token:n}).catch(()=>{});const r=ym();r&&ti(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}ll()}}async function ci(e,t){if(!Z)throw new Error("AgentPlatformSDK: call init() first.");Z.backendUrl=e,Z.token=t,Z.project=null,await vl()}function gl(){if(!Z)throw new Error("AgentPlatformSDK: call init() first.");Jn()||(Mr(),ls(async(e,t)=>{il()&&Sn(),sl(e,t,{backendUrl:Z.backendUrl,token:Z.token},Z.project,Z.projectCode,async n=>{await ci(n.backendUrl,n.token)},Cn,n=>{ls((r,o)=>{$r()&&n(r,o)},()=>{ml()})},(n,r)=>{ls((o,i)=>{$r()&&n(o,i)},()=>{$r()&&r()})},()=>{Jn()&&Ns()})},()=>{}))}function Vk(){Ns()}function Kk(){if(!Z)throw new Error("AgentPlatformSDK: call init() first.");yo()||(Mr(),_k(e=>{Yk(e,t=>{sl(t,null,{backendUrl:Z.backendUrl,token:Z.token},Z.project,Z.projectCode,async n=>{await ci(n.backendUrl,n.token)},Cn,void 0,void 0,()=>{})})}))}function ml(){$r()&&Dr()}function Qk(){return Jn()}function bl(){Wk(),xn&&(window.removeEventListener("hashchange",xn),xn=null),Ns(),vk(),Ao(),Dr(),Sn(),tl(),Ho=null,Fo=null,Bo=null,Z=null}function kl(){if(typeof window>"u"||typeof document>"u")return;Mr();const e=Zk(),t=()=>{e?_l(e).catch(console.error):(ai(()=>Cn(),()=>Cn(),()=>li()),An(ir().length),ll())};if(hl()){La(),t();return}xn=()=>{window.location.hash===dl&&(La(),window.removeEventListener("hashchange",xn),xn=null,t())},window.addEventListener("hashchange",xn)}function e_(){Ho&&Fo&&Bo&&el(Ho,Fo,Bo)}function t_(){tl()}function Cn(){Bk(e=>{qk(e),_l(e).catch(console.error)})}function n_(){al(),bl(),Mr(),hl()&&(ai(()=>Cn(),()=>Cn(),()=>li()),An(ir().length))}async function _l(e){await fl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function li(){if(il()){Sn();return}$r()&&Dr();const e=Z!=null&&Z.backendUrl&&(Z!=null&&Z.token)?{backendUrl:Z.backendUrl,token:Z.token}:null;Nk(e)}async function vl(){if(!(!Z||!Z.backendUrl||!Z.token||Z.project||Z.resolvingProject)){Z.resolvingProject=!0;try{Z.project=await vc({backendUrl:Z.backendUrl,token:Z.token},Z.projectCode)}catch{}finally{Z&&(Z.resolvingProject=!1)}}}kl();exports.activateElementPicker=gl;exports.autoInit=kl;exports.clearConfig=n_;exports.closePanelIfOpen=ml;exports.configure=Cn;exports.deactivateElementPicker=Vk;exports.destroy=bl;exports.hideFab=t_;exports.init=fl;exports.isPickerRunning=Qk;exports.showFab=e_;exports.updateCredentials=ci;
|
|
1781
1754
|
//# sourceMappingURL=web-sdk.cjs.map
|