@midnight-owl/ui 1.0.0 → 1.0.1
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/assets/css/tailwind.css +346 -0
- package/dist/ui.es.js +1 -0
- package/dist/ui.umd.js +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@theme {
|
|
4
|
+
/* --- Raw Color Scales --- */
|
|
5
|
+
/* Brand Azure (logo #0192fe at 500) — keep in sync with primaryScale in theme/presets.ts */
|
|
6
|
+
--color-primary-50: #f0f8ff;
|
|
7
|
+
--color-primary-100: #dff0ff;
|
|
8
|
+
--color-primary-200: #b8e2ff;
|
|
9
|
+
--color-primary-300: #79c8ff;
|
|
10
|
+
--color-primary-400: #32abff;
|
|
11
|
+
--color-primary-500: #0192fe;
|
|
12
|
+
--color-primary-600: #0074d4;
|
|
13
|
+
--color-primary-700: #005caa;
|
|
14
|
+
--color-primary-800: #044e8c;
|
|
15
|
+
--color-primary-900: #0a4172;
|
|
16
|
+
--color-primary-950: #07294b;
|
|
17
|
+
|
|
18
|
+
/* Refined cool slate — keep in sync with secondaryScale in theme/presets.ts */
|
|
19
|
+
--color-secondary-50: #f8fafc;
|
|
20
|
+
--color-secondary-100: #f1f5f9;
|
|
21
|
+
--color-secondary-200: #e2e8f0;
|
|
22
|
+
--color-secondary-300: #cbd5e1;
|
|
23
|
+
--color-secondary-400: #94a3b8;
|
|
24
|
+
--color-secondary-500: #64748b;
|
|
25
|
+
--color-secondary-600: #475569;
|
|
26
|
+
--color-secondary-700: #26354d;
|
|
27
|
+
--color-secondary-800: #11213b;
|
|
28
|
+
--color-secondary-900: #0b1730;
|
|
29
|
+
--color-secondary-950: #060d1d;
|
|
30
|
+
|
|
31
|
+
/* Jewel emerald — keep in sync with successScale in theme/presets.ts */
|
|
32
|
+
--color-success-50: #ecfdf5;
|
|
33
|
+
--color-success-100: #d0f7e4;
|
|
34
|
+
--color-success-200: #a3efca;
|
|
35
|
+
--color-success-300: #6ce0ac;
|
|
36
|
+
--color-success-400: #2fcb8c;
|
|
37
|
+
--color-success-500: #059e6b;
|
|
38
|
+
--color-success-600: #058659;
|
|
39
|
+
--color-success-700: #066b49;
|
|
40
|
+
--color-success-800: #07543b;
|
|
41
|
+
--color-success-900: #074632;
|
|
42
|
+
--color-success-950: #02281c;
|
|
43
|
+
|
|
44
|
+
/* Rich amber — keep in sync with warningScale in theme/presets.ts */
|
|
45
|
+
--color-warning-50: #fff8eb;
|
|
46
|
+
--color-warning-100: #fdecc8;
|
|
47
|
+
--color-warning-200: #fbd88c;
|
|
48
|
+
--color-warning-300: #f8be4f;
|
|
49
|
+
--color-warning-400: #f0a121;
|
|
50
|
+
--color-warning-500: #e08a09;
|
|
51
|
+
--color-warning-600: #bd6e06;
|
|
52
|
+
--color-warning-700: #975209;
|
|
53
|
+
--color-warning-800: #7c420e;
|
|
54
|
+
--color-warning-900: #68370f;
|
|
55
|
+
--color-warning-950: #3c1c03;
|
|
56
|
+
|
|
57
|
+
/* Rose-crimson — keep in sync with dangerScale in theme/presets.ts */
|
|
58
|
+
--color-danger-50: #fff1f3;
|
|
59
|
+
--color-danger-100: #ffe0e6;
|
|
60
|
+
--color-danger-200: #fdc7d2;
|
|
61
|
+
--color-danger-300: #fa9fb2;
|
|
62
|
+
--color-danger-400: #f56b88;
|
|
63
|
+
--color-danger-500: #e11d48;
|
|
64
|
+
--color-danger-600: #c4143b;
|
|
65
|
+
--color-danger-700: #a31232;
|
|
66
|
+
--color-danger-800: #88142f;
|
|
67
|
+
--color-danger-900: #74152c;
|
|
68
|
+
--color-danger-950: #410814;
|
|
69
|
+
|
|
70
|
+
/* Clean cyan — keep in sync with infoScale in theme/presets.ts */
|
|
71
|
+
--color-info-50: #ecfeff;
|
|
72
|
+
--color-info-100: #cffafe;
|
|
73
|
+
--color-info-200: #a5f3fc;
|
|
74
|
+
--color-info-300: #67e8f9;
|
|
75
|
+
--color-info-400: #22d3ee;
|
|
76
|
+
--color-info-500: #06b6d4;
|
|
77
|
+
--color-info-600: #0891b2;
|
|
78
|
+
--color-info-700: #0e7490;
|
|
79
|
+
--color-info-800: #155e75;
|
|
80
|
+
--color-info-900: #164e63;
|
|
81
|
+
--color-info-950: #083344;
|
|
82
|
+
|
|
83
|
+
/* Refined cool slate — keep in sync with surfaceScale in theme/presets.ts */
|
|
84
|
+
--color-surface-50: #f8fafc;
|
|
85
|
+
--color-surface-100: #f1f5f9;
|
|
86
|
+
--color-surface-200: #e2e8f0;
|
|
87
|
+
--color-surface-300: #cbd5e1;
|
|
88
|
+
--color-surface-400: #94a3b8;
|
|
89
|
+
--color-surface-500: #64748b;
|
|
90
|
+
--color-surface-600: #475569;
|
|
91
|
+
--color-surface-700: #26354d;
|
|
92
|
+
--color-surface-800: #11213b;
|
|
93
|
+
--color-surface-900: #0b1730;
|
|
94
|
+
--color-surface-950: #060d1d;
|
|
95
|
+
|
|
96
|
+
/* --- UNIFIED BRAND PALETTE --- */
|
|
97
|
+
/* Tailwind natively creates bg, text, border, and ring classes for these */
|
|
98
|
+
--color-primary: var(--theme-primary);
|
|
99
|
+
--color-secondary: var(--theme-secondary);
|
|
100
|
+
--color-success: var(--theme-success);
|
|
101
|
+
--color-warning: var(--theme-warning);
|
|
102
|
+
--color-danger: var(--theme-danger);
|
|
103
|
+
--color-info: var(--theme-info);
|
|
104
|
+
|
|
105
|
+
/* --- Structural Mappings --- */
|
|
106
|
+
--background-color-main: var(--bg-main);
|
|
107
|
+
--background-color-content: var(--bg-content);
|
|
108
|
+
--background-color-surface: var(--bg-surface);
|
|
109
|
+
--background-color-muted: var(--bg-muted);
|
|
110
|
+
--background-color-inverse: var(--bg-inverse);
|
|
111
|
+
|
|
112
|
+
--text-color-main: var(--text-main);
|
|
113
|
+
--text-color-content: var(--text-content);
|
|
114
|
+
--text-color-surface: var(--text-surface);
|
|
115
|
+
--text-color-muted: var(--text-muted);
|
|
116
|
+
--text-color-inverse: var(--text-inverse);
|
|
117
|
+
|
|
118
|
+
--text-color-on-primary: var(--text-on-primary);
|
|
119
|
+
--text-color-on-secondary: var(--text-on-secondary);
|
|
120
|
+
--text-color-on-success: var(--text-on-success);
|
|
121
|
+
--text-color-on-warning: var(--text-on-warning);
|
|
122
|
+
--text-color-on-danger: var(--text-on-danger);
|
|
123
|
+
--text-color-on-info: var(--text-on-info);
|
|
124
|
+
--text-color-on-surface: var(--text-on-surface);
|
|
125
|
+
|
|
126
|
+
--border-color-main: var(--border-main);
|
|
127
|
+
--border-color-content: var(--border-content);
|
|
128
|
+
--border-color-surface: var(--border-surface);
|
|
129
|
+
--border-color-muted: var(--border-muted);
|
|
130
|
+
--border-color-inverse: var(--border-inverse);
|
|
131
|
+
|
|
132
|
+
/* --- Architecture Scales --- */
|
|
133
|
+
--font-sans: var(--ow-font-sans), 'Inter', system-ui, sans-serif;
|
|
134
|
+
--font-mono: var(--ow-font-mono), ui-monospace, monospace;
|
|
135
|
+
|
|
136
|
+
/* Tailwind v4 font-size utilities live in the --text-* namespace (and line-height
|
|
137
|
+
in --leading-*) — aliasing them here is what lets Theme Studio's font-scale
|
|
138
|
+
tokens drive every text-* and leading-* utility, not just the body base size. */
|
|
139
|
+
--text-xs: var(--fs-xs);
|
|
140
|
+
--text-sm: var(--fs-sm);
|
|
141
|
+
--text-base: var(--fs-base);
|
|
142
|
+
--text-lg: var(--fs-lg);
|
|
143
|
+
--text-xl: var(--fs-xl);
|
|
144
|
+
--text-2xl: var(--fs-2xl);
|
|
145
|
+
--text-3xl: var(--fs-3xl);
|
|
146
|
+
|
|
147
|
+
--leading-none: var(--lh-none);
|
|
148
|
+
--leading-tight: var(--lh-tight);
|
|
149
|
+
--leading-normal: var(--lh-normal);
|
|
150
|
+
--leading-loose: var(--lh-loose);
|
|
151
|
+
|
|
152
|
+
--font-weight-light: var(--fw-light);
|
|
153
|
+
--font-weight-regular: var(--fw-regular);
|
|
154
|
+
--font-weight-medium: var(--fw-medium);
|
|
155
|
+
--font-weight-semibold: var(--fw-semibold);
|
|
156
|
+
--font-weight-bold: var(--fw-bold);
|
|
157
|
+
|
|
158
|
+
--spacing-xs: var(--space-xs);
|
|
159
|
+
--spacing-sm: var(--space-sm);
|
|
160
|
+
--spacing-md: var(--space-md);
|
|
161
|
+
--spacing-lg: var(--space-lg);
|
|
162
|
+
--spacing-xl: var(--space-xl);
|
|
163
|
+
--spacing-2xl: var(--space-2xl);
|
|
164
|
+
|
|
165
|
+
--radius-none: var(--ow-radius-none);
|
|
166
|
+
--radius-sm: var(--ow-radius-sm);
|
|
167
|
+
--radius-md: var(--ow-radius-md);
|
|
168
|
+
--radius-lg: var(--ow-radius-lg);
|
|
169
|
+
--radius-xl: var(--ow-radius-xl);
|
|
170
|
+
--radius-full: var(--ow-radius-full);
|
|
171
|
+
|
|
172
|
+
--border-width-base: var(--bw-default);
|
|
173
|
+
--border-width-marker: var(--bw-marker);
|
|
174
|
+
--border-width-thick: var(--bw-thick);
|
|
175
|
+
|
|
176
|
+
--shadow-none: var(--ow-shadow-none);
|
|
177
|
+
--shadow-xs: var(--ow-shadow-xs);
|
|
178
|
+
--shadow-sm: var(--ow-shadow-sm);
|
|
179
|
+
--shadow-md: var(--ow-shadow-md);
|
|
180
|
+
--shadow-lg: var(--ow-shadow-lg);
|
|
181
|
+
--shadow-xl: var(--ow-shadow-xl);
|
|
182
|
+
|
|
183
|
+
/* --- Core Keyframes --- */
|
|
184
|
+
--animate-fade-in: fadeIn 0.3s ease-out;
|
|
185
|
+
--animate-fade-in-up: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
186
|
+
--animate-shimmer: shimmer 1.6s ease-in-out infinite;
|
|
187
|
+
--animate-float: float 6s ease-in-out infinite;
|
|
188
|
+
|
|
189
|
+
@keyframes fadeIn {
|
|
190
|
+
from {
|
|
191
|
+
opacity: 0;
|
|
192
|
+
}
|
|
193
|
+
to {
|
|
194
|
+
opacity: 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
@keyframes fadeInUp {
|
|
198
|
+
from {
|
|
199
|
+
opacity: 0;
|
|
200
|
+
transform: translateY(15px);
|
|
201
|
+
}
|
|
202
|
+
to {
|
|
203
|
+
opacity: 1;
|
|
204
|
+
transform: translateY(0);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
@keyframes shimmer {
|
|
208
|
+
0% {
|
|
209
|
+
background-position: 200% 0;
|
|
210
|
+
}
|
|
211
|
+
100% {
|
|
212
|
+
background-position: -200% 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
@keyframes float {
|
|
216
|
+
0%,
|
|
217
|
+
100% {
|
|
218
|
+
transform: translateY(0);
|
|
219
|
+
}
|
|
220
|
+
50% {
|
|
221
|
+
transform: translateY(-16px);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* --- Base Styles Layer --- */
|
|
227
|
+
@layer base {
|
|
228
|
+
body {
|
|
229
|
+
background-color: var(--bg-main);
|
|
230
|
+
color: var(--text-main);
|
|
231
|
+
font-family: var(--font-sans);
|
|
232
|
+
font-weight: var(--fw-regular);
|
|
233
|
+
font-size: var(--fs-base);
|
|
234
|
+
-webkit-font-smoothing: antialiased;
|
|
235
|
+
-moz-osx-font-smoothing: grayscale;
|
|
236
|
+
transition:
|
|
237
|
+
background-color 0.2s ease,
|
|
238
|
+
color 0.2s ease;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
::selection {
|
|
242
|
+
background-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
|
|
243
|
+
color: var(--color-primary);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
* {
|
|
247
|
+
-webkit-tap-highlight-color: transparent;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
button:focus-visible,
|
|
251
|
+
a:focus-visible,
|
|
252
|
+
input:focus-visible,
|
|
253
|
+
select:focus-visible,
|
|
254
|
+
textarea:focus-visible {
|
|
255
|
+
outline: none;
|
|
256
|
+
box-shadow:
|
|
257
|
+
0 0 0 2px var(--bg-main),
|
|
258
|
+
0 0 0 4px var(--color-primary);
|
|
259
|
+
border-color: var(--color-primary);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@utility max-w-xs {
|
|
264
|
+
max-width: var(--container-xs) !important;
|
|
265
|
+
}
|
|
266
|
+
@utility max-w-sm {
|
|
267
|
+
max-width: var(--container-sm) !important;
|
|
268
|
+
}
|
|
269
|
+
@utility max-w-md {
|
|
270
|
+
max-width: var(--container-md) !important;
|
|
271
|
+
}
|
|
272
|
+
@utility max-w-lg {
|
|
273
|
+
max-width: var(--container-lg) !important;
|
|
274
|
+
}
|
|
275
|
+
@utility max-w-xl {
|
|
276
|
+
max-width: var(--container-xl) !important;
|
|
277
|
+
}
|
|
278
|
+
@utility max-w-2xl {
|
|
279
|
+
max-width: var(--container-2xl) !important;
|
|
280
|
+
}
|
|
281
|
+
@utility max-w-3xl {
|
|
282
|
+
max-width: var(--container-3xl) !important;
|
|
283
|
+
}
|
|
284
|
+
@utility max-w-4xl {
|
|
285
|
+
max-width: var(--container-4xl) !important;
|
|
286
|
+
}
|
|
287
|
+
@utility max-w-5xl {
|
|
288
|
+
max-width: var(--container-5xl) !important;
|
|
289
|
+
}
|
|
290
|
+
@utility max-w-6xl {
|
|
291
|
+
max-width: var(--container-6xl) !important;
|
|
292
|
+
}
|
|
293
|
+
@utility max-w-7xl {
|
|
294
|
+
max-width: var(--container-7xl) !important;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@utility fade-up-enter-active {
|
|
298
|
+
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
299
|
+
}
|
|
300
|
+
@utility fade-up-leave-active {
|
|
301
|
+
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
302
|
+
}
|
|
303
|
+
@utility fade-up-enter-from {
|
|
304
|
+
opacity: 0;
|
|
305
|
+
transform: translateY(15px);
|
|
306
|
+
}
|
|
307
|
+
@utility fade-up-leave-to {
|
|
308
|
+
opacity: 0;
|
|
309
|
+
transform: translateY(15px);
|
|
310
|
+
}
|
|
311
|
+
@utility fade-up-enter-to {
|
|
312
|
+
opacity: 1;
|
|
313
|
+
transform: translateY(0);
|
|
314
|
+
}
|
|
315
|
+
@utility fade-up-leave-from {
|
|
316
|
+
opacity: 1;
|
|
317
|
+
transform: translateY(0);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.custom-scrollbar::-webkit-scrollbar {
|
|
321
|
+
width: 8px;
|
|
322
|
+
height: 8px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.custom-scrollbar::-webkit-scrollbar-track {
|
|
326
|
+
background: transparent;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@supports (scrollbar-width: thin) {
|
|
330
|
+
.custom-scrollbar {
|
|
331
|
+
scrollbar-width: thin;
|
|
332
|
+
scrollbar-color: var(--border-main) transparent;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.custom-scrollbar:hover {
|
|
336
|
+
scrollbar-color: var(--content-muted) transparent;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.custom-scrollbar-hide::-webkit-scrollbar {
|
|
341
|
+
display: none;
|
|
342
|
+
}
|
|
343
|
+
.custom-scrollbar-hide {
|
|
344
|
+
-ms-overflow-style: none;
|
|
345
|
+
scrollbar-width: none;
|
|
346
|
+
}
|
package/dist/ui.es.js
CHANGED
package/dist/ui.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue"),require("@iconify/vue"),require("maska/vue"),require("@floating-ui/vue"),require("date-fns")):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@iconify/vue`,`maska/vue`,`@floating-ui/vue`,`date-fns`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MidnightOwlUI={},e.Vue,e.IconifyVue,e.MaskaVue,e.FloatingVue,e.dateFns))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=[`disabled`],s={key:2,class:`truncate`},c=(0,t.defineComponent)({__name:`Button`,props:{label:{default:void 0},icon:{default:void 0},iconPos:{default:`left`},badge:{default:void 0},badgeSeverity:{default:`danger`},variant:{default:`solid`},severity:{default:`primary`},size:{default:`sm`},rounded:{type:Boolean,default:!1},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},raised:{type:Boolean,default:!1}},setup(e){let r=e,i=(0,t.useSlots)(),a=(0,t.computed)(()=>!r.label&&!i.default),c=(0,t.computed)(()=>{let e=r.block?`w-full flex`:`inline-flex`,t=r.rounded?`rounded-full`:`rounded-md`,n={xs:a.value?`w-7 h-7 text-[11px]`:`px-2.5 py-1 text-[11px]`,sm:a.value?`w-8 h-8 text-xs`:`px-3 py-1.5 text-xs`,md:a.value?`w-10 h-10 text-sm`:`px-4 py-2 text-sm`,lg:a.value?`w-12 h-12 text-base`:`px-6 py-3 text-base`,xl:a.value?`w-14 h-14 text-lg`:`px-8 py-4 text-lg`},i={left:`flex-row`,right:`flex-row-reverse`,top:`flex-col`,bottom:`flex-col-reverse`},o=r.raised?`shadow-md hover:shadow-lg`:r.variant===`solid`?`shadow-sm hover:shadow-md`:``;return[`inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-main disabled:opacity-50 disabled:cursor-not-allowed select-none cursor-pointer`,e,t,n[r.size],i[r.iconPos],o]}),l=(0,t.computed)(()=>{let e=`active:scale-[0.98] transition-all disabled:pointer-events-none disabled:active:scale-100`;return r.variant===`solid`?{primary:`bg-primary text-on-primary hover:brightness-110 focus-visible:ring-primary ${e}`,secondary:`bg-muted text-main border border-main hover:brightness-110 focus-visible:ring-primary ${e}`,success:`bg-success text-on-success hover:brightness-110 focus-visible:ring-success ${e}`,warning:`bg-warning text-on-warning hover:brightness-110 focus-visible:ring-warning ${e}`,danger:`bg-danger text-on-danger hover:brightness-110 focus-visible:ring-danger ${e}`,info:`bg-info text-on-info hover:brightness-110 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`soft`?{primary:`bg-primary/10 text-primary border border-primary/10 hover:bg-primary/20 focus-visible:ring-primary ${e}`,secondary:`bg-muted/20 text-main border border-muted/20 hover:bg-muted/30 focus-visible:ring-primary ${e}`,success:`bg-success/10 text-success border border-success/10 hover:bg-success/20 focus-visible:ring-success ${e}`,warning:`bg-warning/10 text-warning border border-warning/10 hover:bg-warning/20 focus-visible:ring-warning ${e}`,danger:`bg-danger/10 text-danger border border-danger/10 hover:bg-danger/20 focus-visible:ring-danger ${e}`,info:`bg-info/10 text-info border border-info/10 hover:bg-info/20 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`outline`?{primary:`border-2 border-primary text-primary hover:bg-current/10 focus-visible:ring-primary ${e}`,secondary:`border-2 border-main text-main hover:bg-current/10 focus-visible:ring-primary ${e}`,success:`border-2 border-success text-success hover:bg-current/10 focus-visible:ring-success ${e}`,warning:`border-2 border-warning text-warning hover:bg-current/10 focus-visible:ring-warning ${e}`,danger:`border-2 border-danger text-danger hover:bg-current/10 focus-visible:ring-danger ${e}`,info:`border-2 border-info text-info hover:bg-current/10 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`text`?{primary:`text-primary hover:bg-current/10 focus-visible:ring-primary bg-transparent ${e}`,secondary:`text-muted hover:text-main hover:bg-current/10 focus-visible:ring-primary bg-transparent ${e}`,success:`text-success hover:bg-current/10 focus-visible:ring-success bg-transparent ${e}`,warning:`text-warning hover:bg-current/10 focus-visible:ring-warning bg-transparent ${e}`,danger:`text-danger hover:bg-current/10 focus-visible:ring-danger bg-transparent ${e}`,info:`text-info hover:bg-current/10 focus-visible:ring-info bg-transparent ${e}`}[r.severity]:r.variant===`link`?`p-0 h-auto w-auto text-primary hover:underline hover:opacity-80 focus-visible:ring-primary shadow-none bg-transparent ${e}`:``}),u=(0,t.computed)(()=>{let e=`inline-flex items-center justify-center min-w-5 h-5 px-1.5 rounded-full text-[10px] font-bold`,t={primary:`bg-primary text-on-primary`,secondary:`bg-secondary text-on-secondary`,danger:`bg-danger text-on-danger`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,info:`bg-info text-on-info`}[r.badgeSeverity||`danger`];return r.variant===`solid`&&r.severity===`primary`?[e,`bg-(--text-on-primary) text-primary`]:[e,t]});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,(0,t.mergeProps)({class:[c.value,l.value],disabled:e.disabled||e.loading},r.$attrs),[e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:loader-2`,class:`h-4 w-4 shrink-0 animate-spin`})):e.icon||r.$slots.icon?(0,t.renderSlot)(r.$slots,`icon`,{key:1},()=>[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:`h-4 w-4 shrink-0`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0)]):(0,t.createCommentVNode)(``,!0),e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,s,(0,t.toDisplayString)(e.label),1)):(0,t.renderSlot)(r.$slots,`default`,{key:3}),e.badge?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:4,class:(0,t.normalizeClass)(u.value)},(0,t.toDisplayString)(e.badge),3)):(0,t.createCommentVNode)(``,!0)],16,o))}}),l=[`aria-label`],u=(0,t.defineComponent)({__name:`ButtonGroup`,props:{orientation:{default:`horizontal`},size:{}},setup(e){let n=e,r={xs:`[&>button]:!h-7 [&>button]:!px-2.5 [&>button]:!text-[11px]`,sm:`[&>button]:!h-8 [&>button]:!px-3 [&>button]:!text-xs`,md:`[&>button]:!h-10 [&>button]:!px-4 [&>button]:!text-sm`,lg:`[&>button]:!h-12 [&>button]:!px-6 [&>button]:!text-base`,xl:`[&>button]:!h-14 [&>button]:!px-8 [&>button]:!text-lg`},i=(0,t.computed)(()=>{let e=`inline-flex [&>button]:relative [&>button:hover]:z-10 [&>button:focus-visible]:z-10`,t=n.size?r[n.size]:``;return n.orientation===`vertical`?[e,t,`flex-col items-stretch`,`[&>button:not(:first-child)]:-mt-px`,`[&>button:not(:first-child)]:!rounded-t-none`,`[&>button:not(:last-child)]:!rounded-b-none`]:[e,t,`flex-row items-stretch`,`[&>button:not(:first-child)]:-ml-px`,`[&>button:not(:first-child)]:!rounded-l-none`,`[&>button:not(:last-child)]:!rounded-r-none`]});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(i.value),role:`group`,"aria-label":`${e.orientation} button group`},[(0,t.renderSlot)(n.$slots,`default`)],10,l))}}),d=[`for`],f={key:0,class:`text-danger`},p={class:`flex w-full min-w-0 flex-col gap-1.5`},m=[`disabled`],h=[`id`,`min`,`max`,`step`,`disabled`,`placeholder`,`aria-invalid`,`value`],g={key:3,class:`flex shrink-0 flex-col`},_=[`disabled`],v=[`disabled`],y=[`disabled`],b={key:0,class:`mt-0.5 flex flex-col gap-1`},x={class:`min-w-0`},S=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputNumber`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},min:{},max:{},step:{default:1},showButtons:{type:Boolean,default:!0},orientation:{default:`vertical`},incrementIcon:{},decrementIcon:{},prefix:{},suffix:{},size:{default:`sm`},keyfilter:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-num-${(0,t.useId)()}`,c=e=>{if(!i.keyfilter||e.ctrlKey||e.metaKey||[`Backspace`,`Tab`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,`Delete`,`Escape`].includes(e.key))return;let t=typeof i.keyfilter==`string`?{int:/[\d\-]/,num:/[\d\-\.]/,alpha:/[a-zA-Z\s]/,alphanum:/[a-zA-Z0-9\s]/}[i.keyfilter]:i.keyfilter;t&&!t.test(e.key)&&e.preventDefault()},l=e=>{if(i.disabled)return;let t=e;i.max!==void 0&&t>i.max&&(t=i.max),i.min!==void 0&&t<i.min&&(t=i.min);let n=i.step.toString().split(`.`)[1]?.length||0;o.value=Number(t.toFixed(n))},u=()=>{l((o.value??0)+i.step),a(`input`,o.value),a(`change`,o.value)},S=()=>{l((o.value??0)-i.step),a(`input`,o.value),a(`change`,o.value)},C=e=>{let t=e.target,n=parseFloat(t.value);isNaN(n)?o.value=null:o.value=n},w=()=>{o.value!==null&&o.value!==void 0&&l(o.value)},T=null,E=null,D=e=>{i.disabled||(e===`inc`?u():S(),T=setTimeout(()=>{E=setInterval(()=>{e===`inc`?u():S()},50)},400))},O=()=>{T&&clearTimeout(T),E&&clearInterval(E),T=null,E=null},k=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),A=(0,t.computed)(()=>[`flex items-stretch w-full bg-content border rounded-md transition-all duration-200 overflow-hidden group outline-none focus-within:ring-4 focus-within:ring-offset-0`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,{xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`}[i.size]]),j=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium text-left`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),M=(0,t.computed)(()=>[`flex items-center justify-center font-semibold text-muted px-3 select-none`,{xs:`text-[10px]`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`}[i.size],i.disabled?`opacity-50`:``].join(` `)),N=(0,t.computed)(()=>[`flex items-center justify-center bg-transparent text-muted transition-colors select-none`,i.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:text-primary active:brightness-95`,{xs:`w-6`,sm:`w-6`,md:`w-8`,lg:`w-8`,xl:`w-10`}[i.size]].join(` `)),P=(0,t.computed)(()=>i.incrementIcon||(i.orientation===`horizontal`?`lucide:plus`:`lucide:chevron-up`)),F=(0,t.computed)(()=>i.decrementIcon||(i.orientation===`horizontal`?`lucide:minus`:`lucide:chevron-down`)),ee=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${k.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,f,`*`)):(0,t.createCommentVNode)(``,!0)],10,d)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,p,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(A.value)},[e.showButtons&&e.orientation===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Decrease value`,class:(0,t.normalizeClass)([N.value,`h-full`]),onMousedown:i[0]||=e=>D(`dec`),onMouseup:O,onMouseleave:O,onTouchstart:i[1]||=(0,t.withModifiers)(e=>D(`dec`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:F.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,m)):(0,t.createCommentVNode)(``,!0),e.prefix?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([M.value,`border-r border-main bg-muted/50`])},(0,t.toDisplayString)(e.prefix),3)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:`number`,min:e.min,max:e.max,step:e.step,disabled:e.disabled,placeholder:e.placeholder,class:[j.value,e.prefix?`pl-3`:e.orientation===`horizontal`&&e.showButtons?`pl-2`:`pl-3`,e.suffix||e.showButtons?`pr-2`:`pr-3`],"aria-invalid":!!e.error,value:o.value,onInput:i[2]||=e=>{C(e),a(`input`,o.value)},onChange:i[3]||=e=>a(`change`,o.value),onBlur:i[4]||=e=>{w(),a(`blur`,e)},onFocus:i[5]||=e=>a(`focus`,e),onKeydown:c},r.$attrs),null,16,h),e.suffix?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)(M.value)},(0,t.toDisplayString)(e.suffix),3)):(0,t.createCommentVNode)(``,!0),e.showButtons&&e.orientation===`vertical`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,g,[(0,t.createElementVNode)(`button`,{type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Increase value`,class:(0,t.normalizeClass)([N.value,`flex-1`]),onMousedown:i[6]||=e=>D(`inc`),onMouseup:O,onMouseleave:O,onTouchstart:i[7]||=(0,t.withModifiers)(e=>D(`inc`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:P.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,_),(0,t.createElementVNode)(`button`,{type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Decrease value`,class:(0,t.normalizeClass)([N.value,`flex-1`]),onMousedown:i[8]||=e=>D(`dec`),onMouseup:O,onMouseleave:O,onTouchstart:i[9]||=(0,t.withModifiers)(e=>D(`dec`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:F.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,v)])):(0,t.createCommentVNode)(``,!0),e.showButtons&&e.orientation===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:4,type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Increase value`,class:(0,t.normalizeClass)([N.value,`h-full`]),onMousedown:i[10]||=e=>D(`inc`),onMouseup:O,onMouseleave:O,onTouchstart:i[11]||=(0,t.withModifiers)(e=>D(`inc`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:P.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,y)):(0,t.createCommentVNode)(``,!0)],2),ee.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,b,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ee.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,x,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),C=[`for`],w={key:0,class:`text-danger`},T={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},E=[`id`,`type`,`disabled`,`placeholder`,`aria-invalid`],D={key:0,class:`mt-0.5 flex flex-col gap-1`},O={class:`min-w-0`},k=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputText`,props:(0,t.mergeModels)({type:{default:`text`},id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},iconEnd:{},size:{default:`sm`},keyfilter:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-${(0,t.useId)()}`,c=e=>{if(!i.keyfilter||e.ctrlKey||e.metaKey||[`Backspace`,`Tab`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,`Delete`,`Escape`].includes(e.key))return;let t=typeof i.keyfilter==`string`?{int:/[\d\-]/,num:/[\d\-\.]/,alpha:/[a-zA-Z\s]/,alphanum:/[a-zA-Z0-9\s]/}[i.keyfilter]:i.keyfilter;t&&!t.test(e.key)&&e.preventDefault()},l=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),u=(0,t.computed)(()=>{let e=i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=i.size===`xs`?`px-2`:`px-3`,r=i.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[i.size],n,r]}),d=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-search-decoration]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),f=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${l.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,w,`*`)):(0,t.createCommentVNode)(``,!0)],10,C)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,T,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(u.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,f.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:e.type,disabled:e.disabled,placeholder:e.placeholder,class:d.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>{let t=e.target.value;o.value=t,a(`input`,t)},onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e),onKeydown:c},r.$attrs),null,16,E),[[t.vModelDynamic,o.value]]),e.iconEnd?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconEnd,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,f.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)],2),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,D,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,O,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),A=[`for`],j={key:0,class:`text-danger`},M={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},N=[`id`,`type`,`disabled`,`placeholder`,`aria-invalid`],P=[`disabled`,`aria-label`,`aria-pressed`],F={key:0,class:`mt-0.5 flex flex-col gap-1`},ee={class:`min-w-0`},I=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputPassword`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},toggleable:{type:Boolean,default:!0},iconOn:{default:`lucide:eye-off`},iconOff:{default:`lucide:eye`},size:{default:`sm`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-${(0,t.useId)()}`,c=(0,t.ref)(!1),l=(0,t.computed)(()=>c.value?`text`:`password`),u=()=>{i.disabled||(c.value=!c.value)},d=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),f=(0,t.computed)(()=>{let e=i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=i.size===`xs`?`px-2`:`px-3`,r=i.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[i.size],n,r]}),p=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),m=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),h=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${d.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,j,`*`)):(0,t.createCommentVNode)(``,!0)],10,A)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,M,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(f.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,m.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:l.value,disabled:e.disabled,placeholder:e.placeholder,class:p.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>{let t=e.target.value;o.value=t,a(`input`,t)},onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e)},r.$attrs),null,16,N),[[t.vModelDynamic,o.value]]),e.toggleable?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,type:`button`,disabled:e.disabled,"aria-label":c.value?`Hide password`:`Show password`,"aria-pressed":c.value,tabindex:`-1`,class:`flex shrink-0 cursor-pointer items-center justify-center outline-none disabled:cursor-not-allowed`,onClick:u},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:c.value?e.iconOn:e.iconOff,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted hover:text-primary`,m.value])},null,8,[`icon`,`class`])],8,P)):(0,t.createCommentVNode)(``,!0)],2),h.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,F,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,ee,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),te=[`for`],ne={key:0,class:`text-danger`},re={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},L=[`aria-label`],R=[`id`,`type`,`inputmode`,`pattern`,`disabled`,`value`,`aria-label`,`aria-invalid`,`onInput`,`onKeydown`],z={key:0,class:`mt-0.5 flex flex-col gap-1`},ie={class:`min-w-0`},ae=(0,t.defineComponent)({__name:`InputOtp`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},length:{default:6},mask:{type:Boolean,default:!1},integerOnly:{type:Boolean,default:!0},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`,`complete`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-otp-${(0,t.useId)()}`,c=(0,t.ref)([]),l=(e,t)=>{c.value[t]=e},u=(0,t.computed)(()=>{let e=o.value.split(``);return Array.from({length:i.length},(t,n)=>e[n]??``)}),d=e=>i.integerOnly?/^[0-9]$/.test(e):e.length===1,f=e=>{let t=e.join(``);o.value=t,a(`input`,t),a(`change`,t),t.length===i.length&&!e.includes(``)&&a(`complete`,t)},p=e=>{c.value[e]?.focus(),c.value[e]?.select()},m=(e,t)=>{let n=e.target,r=n.value.slice(-1);if(r&&!d(r)){n.value=u.value[t];return}let a=[...u.value];a[t]=r,f(a),r&&t<i.length-1&&p(t+1)},h=(e,t)=>{if(e.key===`Backspace`&&!u.value[t]&&t>0){e.preventDefault(),p(t-1);let n=[...u.value];n[t-1]=``,f(n);return}e.key===`ArrowLeft`&&t>0&&(e.preventDefault(),p(t-1)),e.key===`ArrowRight`&&t<i.length-1&&(e.preventDefault(),p(t+1))},g=e=>{e.preventDefault();let t=(e.clipboardData?.getData(`text`)??``).split(``).filter(d).slice(0,i.length);t.length&&(f(Array.from({length:i.length},(e,n)=>t[n]??``)),p(Math.min(t.length,i.length-1)))},_=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),v=(0,t.computed)(()=>({xs:`gap-1.5`,sm:`gap-2`,md:`gap-2`,lg:`gap-3`,xl:`gap-3`})[i.size]),y=(0,t.computed)(()=>[`flex items-center justify-center bg-content border rounded-md text-center font-bold transition-all duration-200 outline-none focus:ring-4 focus:ring-offset-0`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed text-muted`:i.error?`border-danger focus:border-danger focus:ring-danger/20 text-danger`:`border-main hover:border-primary/50 focus:border-primary focus:ring-primary/20 text-main`,{xs:`h-7 w-7 text-sm`,sm:`h-8 w-8 text-base`,md:`h-10 w-10 text-lg`,lg:`h-12 w-12 text-xl`,xl:`h-14 w-14 text-2xl`}[i.size]]),b=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:`${(0,t.unref)(s)}-0`,class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${_.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,ne,`*`)):(0,t.createCommentVNode)(``,!0)],10,te)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,re,[(0,t.createElementVNode)(`div`,{role:`group`,"aria-label":e.label||`One-time passcode`,class:(0,t.normalizeClass)([`flex`,v.value])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{key:r,ref_for:!0,ref:e=>l(e,r),id:`${(0,t.unref)(s)}-${r}`,type:e.mask?`password`:`text`,inputmode:e.integerOnly?`numeric`:`text`,pattern:e.integerOnly?`[0-9]*`:void 0,autocomplete:`one-time-code`,maxlength:`1`,disabled:e.disabled,value:n,"aria-label":`Digit ${r+1} of ${e.length}`,"aria-invalid":!!e.error,class:(0,t.normalizeClass)(y.value),onInput:e=>m(e,r),onKeydown:e=>h(e,r),onPaste:g,onFocus:i[0]||=e=>a(`focus`,e),onBlur:i[1]||=e=>a(`blur`,e)},null,42,R))),128))],10,L),b.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,z,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(b.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,ie,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),oe=[`for`],se={key:0,class:`text-danger`},ce={class:`flex w-full min-w-0 flex-col gap-1.5`},le=[`id`,`disabled`,`placeholder`,`aria-invalid`],ue={key:0,class:`mt-0.5 flex flex-col gap-1`},de={class:`min-w-0`},fe=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputMask`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},iconEnd:{},size:{default:`sm`},mask:{},tokens:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`,`maska`],[`update:modelValue`]),setup(e,{emit:i}){let a=e,o=i,s=(0,t.useModel)(e,`modelValue`),c=a.id||`input-${(0,t.useId)()}`,l=(0,t.computed)(()=>({mask:a.mask,tokens:a.tokens,onMaska:e=>o(`maska`,e)})),u=(0,t.computed)(()=>a.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[a.size]),d=(0,t.computed)(()=>{let e=a.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:a.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=a.size===`xs`?`px-2`:`px-3`,r=a.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[a.size],n,r]}),f=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-search-decoration]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=a.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:a.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[a.size],n]}),p=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[a.size]),m=(0,t.computed)(()=>!a.error||typeof a.error==`boolean`?[]:Array.isArray(a.error)?a.error:[a.error]);return(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(c),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${u.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,se,`*`)):(0,t.createCommentVNode)(``,!0)],10,oe)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,ce,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,p.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(c),type:`text`,disabled:e.disabled,placeholder:e.placeholder,class:f.value,"aria-invalid":!!e.error,"onUpdate:modelValue":a[0]||=e=>s.value=e,onInput:a[1]||=e=>{let t=e.target.value;s.value=t,o(`input`,t)},onChange:a[2]||=e=>o(`change`,e.target.value),onFocus:a[3]||=e=>o(`focus`,e),onBlur:a[4]||=e=>o(`blur`,e)},i.$attrs),null,16,le),[[t.vModelText,s.value],[(0,t.unref)(r.vMaska),l.value]]),e.iconEnd?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconEnd,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,p.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)],2),m.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ue,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,de,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),pe=(0,t.defineComponent)({inheritAttrs:!1,__name:`Popover`,props:(0,t.mergeModels)({placement:{default:`bottom`},trigger:{default:`click`},offset:{default:12},disabled:{type:Boolean,default:!1},size:{default:`md`},widthClass:{default:void 0},showArrow:{type:Boolean,default:!0},matchWidth:{type:Boolean,default:!1},triggerClass:{default:`inline-block`},reference:{default:null},autoPlacement:{type:Boolean,default:!1},boundary:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r={xs:`w-56`,sm:`w-64`,md:`w-72`,lg:`w-96`,xl:`w-[32rem]`},a=(0,t.computed)(()=>n.widthClass||r[n.size]),o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(``),{floatingStyles:d,middlewareData:f,placement:p}=(0,i.useFloating)((0,t.computed)(()=>n.reference??s.value),c,{placement:()=>n.placement,whileElementsMounted:i.autoUpdate,middleware:[(0,i.offset)(n.offset),n.autoPlacement?(0,i.autoPlacement)({allowedPlacements:[`top`,`bottom`,`left`,`right`],padding:12,boundary:n.boundary}):(0,i.flip)({fallbackPlacements:[`bottom`,`top`,`left`,`right`],boundary:n.boundary}),(0,i.shift)({padding:12,boundary:n.boundary}),...n.matchWidth?[(0,i.size)({apply({rects:e,elements:t}){let n=`${Math.round(e.reference.width)}px`;Object.assign(t.floating.style,{width:n}),u.value!==n&&(u.value=n)}})]:[],...n.showArrow?[(0,i.arrow)({element:l,padding:12})]:[],(0,i.hide)()]}),m=(0,t.computed)(()=>({...d.value,...n.matchWidth&&u.value?{width:u.value}:{}})),h,g=(0,t.computed)(()=>p.value.split(`-`)[0]),_=(0,t.computed)(()=>!!f.value.hide?.referenceHidden),v=(0,t.computed)(()=>{let e=f.value.arrow;if(!e)return{};let{x:t,y:n}=e,r={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[g.value];return{left:t==null?``:`${t}px`,top:n==null?``:`${n}px`,right:``,bottom:``,[r]:`-6px`}}),y=()=>{n.disabled||(o.value=!0)},b=()=>{o.value=!1},x=()=>{n.disabled||(o.value=!o.value)},S=()=>{n.trigger!==`hover`||n.disabled||(clearTimeout(h),y())},C=()=>{n.trigger===`hover`&&(h=setTimeout(b,150))},w=e=>{if(!o.value||n.trigger!==`click`)return;let t=e.target,r=(n.reference?.contextElement??s.value)?.contains(t),i=c.value?.contains(t);!r&&!i&&b()},T=e=>{e.key===`Escape`&&o.value&&b()};return(0,t.onMounted)(()=>{document.addEventListener(`mousedown`,w),document.addEventListener(`keydown`,T)}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,w),document.removeEventListener(`keydown`,T),clearTimeout(h)}),(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,(0,t.mergeProps)({ref_key:`referenceRef`,ref:s},r.$attrs,{class:e.triggerClass,onClick:i[0]||=e=>n.trigger===`click`?x():void 0,onMouseenter:S,onMouseleave:C}),[(0,t.renderSlot)(r.$slots,`trigger`,{isOpen:o.value})],16),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{"leave-active-class":`transition duration-150 ease-in`,"leave-from-class":`opacity-100 scale-100`,"leave-to-class":`opacity-0 scale-95`},{default:(0,t.withCtx)(()=>[o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`floatingRef`,ref:c,style:(0,t.normalizeStyle)(m.value),class:(0,t.normalizeClass)([`relative z-[10000] flex flex-col rounded-md border border-main bg-content shadow-lg focus:outline-none`,e.matchWidth?``:a.value,e.matchWidth?``:`max-w-[calc(100vw-24px)]`,{"pointer-events-none invisible opacity-0":_.value}]),onMouseenter:S,onMouseleave:C},[e.showArrow?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`arrowRef`,ref:l,class:(0,t.normalizeClass)([`absolute z-10 h-3 w-3 border-t border-l border-main bg-content`,{"rotate-45":g.value===`bottom`,"rotate-[225deg]":g.value===`top`,"rotate-[135deg]":g.value===`left`,"-rotate-45":g.value===`right`}]),style:(0,t.normalizeStyle)(v.value)},null,6)):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`default`,{close:b})],38)):(0,t.createCommentVNode)(``,!0)]),_:3})]))],64))}}),me={class:`flex w-full min-w-0`},he={key:0,class:`flex-1 overflow-y-auto p-1.5 custom-scrollbar`},ge=[`onClick`],_e={class:`flex-1 break-words text-pretty leading-snug truncate`},ve={key:1,class:`flex flex-col items-center justify-center p-8 gap-3 text-center shrink-0`},ye={class:`text-sm text-muted`},be={class:`font-bold text-main`},xe=(0,t.defineComponent)({__name:`Autocomplete`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},placeholder:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},options:{},optionLabel:{type:[String,Function],default:`label`},optionValue:{type:[String,Function],default:`value`},filter:{type:Boolean,default:!0},openOnFocus:{type:Boolean,default:!1},maxHeight:{default:320},debounce:{default:300},iconStart:{},iconEnd:{}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`select`,`search`,`create-new`,`focus`,`blur`,`open`,`close`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(!1),l=(0,t.ref)(-1),u=(0,t.useId)(),d=(0,t.computed)(()=>i.id||`adv-autocomplete-${u}`),f=e=>typeof e==`string`||typeof e==`number`?String(e):typeof i.optionLabel==`function`?i.optionLabel(e):e[i.optionLabel],p=e=>typeof e==`string`||typeof e==`number`?e:typeof i.optionValue==`function`?i.optionValue(e):e[i.optionValue],m=(0,t.computed)(()=>{if(!i.filter||!o.value)return i.options;let e=o.value.toLowerCase();return i.options.filter(t=>f(t).toLowerCase().includes(e))}),h=null;(0,t.watch)(o,e=>{l.value=-1,h&&clearTimeout(h),i.debounce>0?h=setTimeout(()=>{a(`search`,e)},i.debounce):a(`search`,e)}),(0,t.onBeforeUnmount)(()=>{h&&clearTimeout(h)}),(0,t.watch)(s,e=>{e?a(`open`):(a(`close`),l.value=-1)});let g=e=>{i.disabled||i.loading||(o.value=f(e),a(`select`,e),s.value=!1)},_=e=>{i.disabled||i.loading||(e.key===`ArrowDown`?(e.preventDefault(),s.value?l.value=Math.min(l.value+1,m.value.length-1):s.value=!0):e.key===`ArrowUp`?(e.preventDefault(),s.value?l.value=Math.max(l.value-1,0):s.value=!0):e.key===`Enter`?s.value&&l.value>=0&&m.value[l.value]?(e.preventDefault(),g(m.value[l.value])):s.value&&m.value.length===0&&o.value&&(e.preventDefault(),a(`create-new`,o.value),s.value=!1):e.key===`Escape`&&(e.preventDefault(),s.value=!1))},v=e=>{i.openOnFocus&&(s.value=!0),a(`focus`,e)},y=e=>{a(`blur`,e)},b=(0,t.computed)(()=>{let e={xs:{padding:`px-1.5 py-1`,text:`text-[11px]`},sm:{padding:`px-2 py-1`,text:`text-xs`},md:{padding:`px-2.5 py-1.5`,text:`text-sm`},lg:{padding:`px-3 py-2`,text:`text-base`},xl:{padding:`px-3.5 py-2.5`,text:`text-lg`}};return e[i.size]||e.sm});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,me,[(0,t.createVNode)(pe,{modelValue:s.value,"onUpdate:modelValue":i[4]||=e=>s.value=e,placement:`bottom-start`,disabled:e.disabled||e.loading,"show-arrow":!1,matchWidth:``,triggerClass:`w-full`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(k,{modelValue:o.value,"onUpdate:modelValue":i[0]||=e=>o.value=e,id:d.value,label:e.label,labelPosition:e.labelPosition,placeholder:e.placeholder,required:e.required,disabled:e.disabled,error:e.error,size:e.size,iconStart:e.iconStart,iconEnd:e.loading?`lucide:loader-2`:e.iconEnd,class:(0,t.normalizeClass)({"is-loading":e.loading}),autocomplete:`off`,onInput:i[1]||=e=>s.value=!0,onKeydown:_,onFocus:v,onBlur:y,onClick:i[2]||=(0,t.withModifiers)(e=>s.value=!0,[`stop`])},null,8,[`modelValue`,`id`,`label`,`labelPosition`,`placeholder`,`required`,`disabled`,`error`,`size`,`iconStart`,`iconEnd`,`class`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex flex-col overflow-hidden bg-content rounded-md shadow-xl border border-main w-full`,style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight})},[m.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,he,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:p(e),onClick:t=>g(e),class:(0,t.normalizeClass)([`cursor-pointer group relative transition-colors duration-150 flex items-center w-full rounded-md`,[b.value.padding,b.value.text,l.value===n?`bg-main/5 ring-2 ring-primary ring-offset-1 text-primary font-medium`:`text-main hover:bg-main/5`]])},[(0,t.createElementVNode)(`div`,_e,[(0,t.renderSlot)(r.$slots,`option`,{option:e,index:n,active:l.value===n},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(f(e)),1)],!0)])],10,ge))),128))])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ve,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`w-8 h-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,ye,[i[5]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,be,`"`+(0,t.toDisplayString)(o.value)+`"`,1)])],!0),(0,t.renderSlot)(r.$slots,`action`,{},()=>[o.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${o.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[3]||=e=>{a(`create-new`,o.value),s.value=!1}},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)],!0)]))],4)]),_:3},8,[`modelValue`,`disabled`])]))}}),Se=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ce=Se(xe,[[`__scopeId`,`data-v-b854acf7`]]),we={key:0,class:`flex items-center justify-center px-3 bg-surface border-r border-main text-muted shrink-0 text-sm font-medium`},Te={key:1,class:`flex items-stretch shrink-0 border-l border-main [&_button]:rounded-none [&_button]:border-transparent [&_button]:shadow-none [&_button]:h-full [&_button]:m-0`},Ee=(0,t.defineComponent)({__name:`InputGroup`,props:{size:{default:`sm`},disabled:{type:Boolean,default:!1},error:{type:Boolean,default:!1}},setup(e){let n=e,r=(0,t.computed)(()=>[`flex items-stretch w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,n.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:n.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,{xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`}[n.size]]),i=(0,t.computed)(()=>{let e=[`[&>input]:flex-1 [&>input]:w-full [&>input]:min-w-0 [&>input]:h-full [&>input]:bg-transparent [&>input]:p-0 [&>input]:border-transparent [&>input]:outline-none [&>input]:ring-0 [&>input]:shadow-none`,`[&_.bg-content]:!border-transparent [&_.bg-content]:!shadow-none [&_.bg-content]:!ring-0 [&_.bg-content]:!bg-transparent [&_.bg-content]:!rounded-none [&_.bg-content]:!px-0`].join(` `),t=n.size===`xs`?`px-2`:`px-3`,r={xs:`[&>input]:text-xs`,sm:`[&>input]:text-xs`,md:`[&>input]:text-sm`,lg:`[&>input]:text-base`,xl:`[&>input]:text-lg`},i=n.disabled?`[&>input]:text-muted [&>input]:placeholder:text-muted [&>input]:placeholder:opacity-50 [&>input]:cursor-not-allowed`:n.error?`[&>input]:text-danger [&>input]:placeholder:text-danger [&>input]:placeholder:opacity-50`:`[&>input]:text-main [&>input]:placeholder:text-muted [&>input]:placeholder:opacity-70`;return[e,t,r[n.size],i].join(` `)});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(r.value)},[e.$slots.prepend?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,we,[(0,t.renderSlot)(e.$slots,`prepend`)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex-1 min-w-0 flex items-center`,i.value])},[(0,t.renderSlot)(e.$slots,`default`)],2),e.$slots.append?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Te,[(0,t.renderSlot)(e.$slots,`append`)])):(0,t.createCommentVNode)(``,!0)],2))}}),De=[`aria-checked`],Oe=(0,t.defineComponent)({__name:`Toggle`,props:(0,t.mergeModels)({size:{default:`sm`},severity:{default:`primary`},disabled:{type:Boolean,default:!1},iconOn:{default:void 0},iconOff:{default:void 0}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s={xs:{track:`w-8 h-4`,thumb:`w-3 h-3`,translate:`translate-x-4`},sm:{track:`w-10 h-5`,thumb:`w-4 h-4`,translate:`translate-x-5`},md:{track:`w-12 h-6`,thumb:`w-5 h-5`,translate:`translate-x-6`},lg:{track:`w-14 h-7`,thumb:`w-6 h-6`,translate:`translate-x-7`},xl:{track:`w-16 h-8`,thumb:`w-7 h-7`,translate:`translate-x-8`}},c={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`},l={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},u=(0,t.computed)(()=>[`relative rounded-full transition-colors duration-300 flex items-center px-1`,o.value?c[i.severity]:`bg-muted`,i.disabled?`opacity-50 cursor-not-allowed`:`cursor-pointer`,s[i.size].track]),d=(0,t.computed)(()=>[`absolute bg-content rounded-full transition-transform duration-300 shadow-sm flex items-center justify-center`,o.value?s[i.size].translate:`translate-x-0`,s[i.size].thumb]),f=()=>{i.disabled||(o.value=!o.value,a(`change`,o.value))};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(u.value),onClick:f,role:`switch`,"aria-checked":o.value},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[o.value&&e.iconOn?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconOn,class:(0,t.normalizeClass)([`w-3 h-3`,l[e.severity]])},null,8,[`icon`,`class`])):!o.value&&e.iconOff?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconOff,class:`w-3 h-3 text-muted`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0)],2)],10,De))}}),ke=`relative inline-flex items-center justify-center gap-1 font-bold z-10 box-border`,Ae=(0,t.defineComponent)({__name:`Badge`,props:{value:{default:void 0},severity:{default:`primary`},variant:{default:`solid`},size:{default:`sm`},rounded:{type:Boolean,default:!0},dot:{type:Boolean,default:!1},ping:{type:Boolean,default:!1},position:{default:void 0}},setup(e){let n=e,r={xs:`w-1.5 h-1.5`,sm:`w-2 h-2`,md:`w-2.5 h-2.5`,lg:`w-3 h-3`,xl:`w-3.5 h-3.5`},i={xs:`min-w-4 h-4 px-1 text-[10px] leading-none`,sm:`min-w-5 h-5 px-1.5 text-xs leading-none`,md:`min-w-6 h-6 px-2 text-sm leading-none`,lg:`min-w-7 h-7 px-2.5 text-base leading-none`,xl:`min-w-8 h-8 px-3 text-lg leading-none`},a={"top-right":`top-0 right-0 translate-x-1/2 -translate-y-1/2`,"top-left":`top-0 left-0 -translate-x-1/2 -translate-y-1/2`,"bottom-right":`bottom-0 right-0 translate-x-1/2 translate-y-1/2`,"bottom-left":`bottom-0 left-0 -translate-x-1/2 translate-y-1/2`},o={solid:{primary:`bg-primary text-on-primary border border-primary`,secondary:`bg-muted text-main border border-muted`,success:`bg-success text-on-success border border-success`,warning:`bg-warning text-on-warning border border-warning`,danger:`bg-danger text-on-danger border border-danger`,info:`bg-info text-on-info border border-info`,contrast:`bg-main text-content border border-main`},soft:{primary:`bg-primary/10 text-primary border border-primary/10`,secondary:`bg-muted/20 text-main border border-muted/20`,success:`bg-success/10 text-success border border-success/10`,warning:`bg-warning/10 text-warning border border-warning/10`,danger:`bg-danger/10 text-danger border border-danger/10`,info:`bg-info/10 text-info border border-info/10`,contrast:`bg-main/5 text-main border border-main/5`},outline:{primary:`bg-content text-primary border border-primary`,secondary:`bg-content text-muted border border-muted`,success:`bg-content text-success border border-success`,warning:`bg-content text-warning border border-warning`,danger:`bg-content text-danger border border-danger`,info:`bg-content text-info border border-info`,contrast:`bg-content text-main border border-main`}},s={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`,contrast:`bg-main`},c=(0,t.computed)(()=>n.dot?r[n.size]:i[n.size]),l=(0,t.computed)(()=>n.dot||n.rounded?`rounded-full`:`rounded-md`),u=(0,t.computed)(()=>n.position?`!absolute transform shadow-sm ${a[n.position]}`:``),d=(0,t.computed)(()=>o[n.variant][n.severity]||``),f=(0,t.computed)(()=>s[n.severity]||``);return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,(0,t.mergeProps)({class:[ke,c.value,l.value,u.value,d.value]},n.$attrs),[e.ping?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`absolute inset-0 rounded-full opacity-75 animate-ping -z-10`,f.value])},null,2)):(0,t.createCommentVNode)(``,!0),e.dot?(0,t.createCommentVNode)(``,!0):(0,t.renderSlot)(n.$slots,`icon`,{key:1}),e.dot?(0,t.createCommentVNode)(``,!0):(0,t.renderSlot)(n.$slots,`default`,{key:2},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.value),1)])],16))}}),je={class:`flex inline-flex flex-col gap-1`},Me=[`for`],Ne=[`id`,`value`,`true-value`,`false-value`,`disabled`,`required`,`indeterminate`],Pe={key:0,class:`ml-0.5 text-danger`},Fe={key:0,class:`mt-0.5 ml-1 flex flex-col`},Ie={class:`min-w-0`},Le=(0,t.defineComponent)({__name:`Checkbox`,props:(0,t.mergeModels)({id:{},value:{},trueValue:{default:!0},falseValue:{default:!1},label:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},variant:{default:`primary`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useId)(),c=(0,t.computed)(()=>i.id||`adv-checkbox-${s}`),l=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),u=(0,t.computed)(()=>Array.isArray(o.value)?o.value.includes(i.value):o.value===i.trueValue),d=(0,t.computed)(()=>{let e={xs:{icon:`w-[14px] h-[14px]`,text:`text-[11px] leading-[14px]`,gap:`gap-1.5`,mt:`mt-0`},sm:{icon:`w-4 h-4`,text:`text-xs leading-4`,gap:`gap-2`,mt:`mt-[1px]`},md:{icon:`w-5 h-5`,text:`text-sm leading-5`,gap:`gap-2`,mt:`mt-[1px]`},lg:{icon:`w-6 h-6`,text:`text-base leading-6`,gap:`gap-2.5`,mt:`mt-[2px]`},xl:{icon:`w-7 h-7`,text:`text-lg leading-7`,gap:`gap-3`,mt:`mt-[2px]`}};return e[i.size]||e.sm}),f={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},p=(0,t.computed)(()=>f[i.variant]||f.primary),m=e=>{a(`change`,o.value,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,je,[(0,t.createElementVNode)(`label`,{for:c.value,class:(0,t.normalizeClass)([`group relative inline-flex items-start transition-colors duration-150`,[e.disabled?`cursor-not-allowed opacity-50`:`-ml-1 cursor-pointer rounded-md px-1 py-0.5 hover:bg-main/5`,d.value.gap]])},[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`checkbox`,id:c.value,value:e.value,"true-value":e.trueValue,"false-value":e.falseValue,disabled:e.disabled,required:e.required,indeterminate:e.indeterminate,"onUpdate:modelValue":i[0]||=e=>o.value=e,class:`peer sr-only`,onChange:m},null,40,Ne),[[t.vModelCheckbox,o.value]]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-[3px] bg-content transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1`,[d.value.icon,d.value.mt,e.error?`peer-focus-visible:ring-danger/50`:`peer-focus-visible:ring-${e.variant}/50`]])},[e.indeterminate&&!u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:minus-square`,class:(0,t.normalizeClass)([`h-full w-full opacity-80`,[e.error?`text-danger`:p.value]])},null,8,[`class`])):u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check-square`,class:(0,t.normalizeClass)([`h-full w-full`,[e.error?`text-danger`:p.value]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:`lucide:square`,class:(0,t.normalizeClass)([`h-full w-full transition-colors`,[e.error?`text-danger hover:text-danger/80`:`text-muted/30 group-hover:text-muted`]])},null,8,[`class`]))],2),e.label||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex-1 text-pretty break-words select-none`,[d.value.text,e.error?`text-danger`:`text-main`]])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Pe,`*`)):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)],10,Me),l.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fe,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(l.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,Ie,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)]))}}),Re={class:`z-10 flex-1 leading-snug text-pretty break-words`},ze={class:`z-10 flex shrink-0 items-center gap-2`},Be={key:1,class:`pointer-events-none flex shrink-0 items-center justify-center`},Ve=(0,t.defineComponent)({__name:`SelectOption`,props:{node:{},level:{default:0}},setup(e){let r=e,i=(0,t.inject)(`ADVANCED_SELECT_CONTEXT`);if(!i)throw Error(`SelectOption must be used within a Select component`);let a=(0,t.computed)(()=>r.node.childrenValues.length>0),o=(0,t.computed)(()=>!i.searchQuery.value||i.visibleNodeValues.value.has(r.node.value)),s=(0,t.computed)(()=>{if(i.isMultiple.value&&!i.parentSelectable.value&&a.value){let e=r.node.leafDescendantValues;return e.length===0?!1:e.every(e=>i.selectedValues.value.has(e))}return i.selectedValues.value.has(r.node.value)}),c=(0,t.computed)(()=>i.expandedNodes.value.has(r.node.value)),l=(0,t.computed)(()=>i.activeValue.value===r.node.value),u=(0,t.computed)(()=>{if(!i.isMultiple.value||!a.value)return!1;let e=i.parentSelectable.value?r.node.descendantValues:r.node.leafDescendantValues,t=e.length;if(t===0)return!1;let n=!1,o=!1,s=i.selectedValues.value;for(let r=0;r<t;r++)if(s.has(e[r])?n=!0:o=!0,n&&o)return!0;return!1}),d={primary:{bg:`bg-primary/10`,text:`text-primary`},secondary:{bg:`bg-surface/50`,text:`text-main`},success:{bg:`bg-success/10`,text:`text-success`},warning:{bg:`bg-warning/10`,text:`text-warning`},danger:{bg:`bg-danger/10`,text:`text-danger`},info:{bg:`bg-info/10`,text:`text-info`}},f=(0,t.computed)(()=>d[i.highlightVariant.value]||d.primary),p=(0,t.computed)(()=>a.value&&!i.parentSelectable.value),m=(0,t.computed)(()=>{let e=`cursor-pointer group relative transition-colors duration-150`,t=l.value?`ring-2 ring-primary ring-offset-1 bg-main/5`:``;return r.node.isDisabled?`${e} opacity-50 cursor-not-allowed ${t}`:p.value?`${e} text-main font-semibold hover:bg-main/5 ${t}`:s.value&&i.selectionVariant.value===`highlight`?`${e} ${f.value.text} ${f.value.bg} font-semibold shadow-sm ${t}`:u.value&&i.selectionVariant.value===`highlight`?`${e} bg-surface/50 text-main font-medium border border-dashed border-main ${t}`:`${e} text-main hover:bg-main/5 ${t}`}),h=(0,t.computed)(()=>i.selectionVariant.value===`checkbox`&&!p.value),g=(0,t.computed)(()=>i.parentSelectable.value?r.node.descendantValues:r.node.leafDescendantValues),_=(0,t.computed)(()=>{if(!a.value)return 0;let e=i.selectedValues.value;return g.value.reduce((t,n)=>t+ +!!e.has(n),0)}),v=(0,t.computed)(()=>g.value.length),y=(0,t.computed)(()=>i.isMultiple.value&&a.value&&_.value>0),b=e=>{e.stopPropagation(),a.value&&i.toggleExpand(r.node.value)},x=e=>{if(e.stopPropagation(),!r.node.isDisabled){if(!i.isMultiple.value&&!i.parentSelectable.value&&a.value){i.toggleExpand(r.node.value);return}i.toggleSelection(r.node.value)}};return(l,d)=>{let f=(0,t.resolveComponent)(`SelectOption`,!0);return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`relative flex w-full flex-col`,(0,t.unref)(i).sizeConfig.value.rowGap])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative z-10 flex w-full items-center`,(0,t.unref)(i).sizeConfig.value.rowMinHeight])},[(0,t.unref)(i).hasHierarchy.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,{style:(0,t.normalizeStyle)({width:`${e.level*(0,t.unref)(i).sizeConfig.value.indentStep}px`}),class:`h-full shrink-0`},null,4),(0,t.unref)(i).treeLineStyle.value!==`none`&&e.level>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute top-1/2 h-px -translate-y-1/2 border-t border-main`,style:(0,t.normalizeStyle)({left:`${(e.level-1)*(0,t.unref)(i).sizeConfig.value.indentStep+(0,t.unref)(i).sizeConfig.value.chevronCenter}px`,width:`${(0,t.unref)(i).sizeConfig.value.indentStep}px`,borderTopStyle:(0,t.unref)(i).treeLineStyle.value})},null,4)):(0,t.createCommentVNode)(``,!0),a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,class:`relative z-20 flex shrink-0 cursor-pointer items-center justify-center rounded transition-colors hover:bg-main/10`,style:(0,t.normalizeStyle)({width:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`,height:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`}),tabindex:`-1`,onClick:(0,t.withModifiers)(b,[`stop`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-right`,class:(0,t.normalizeClass)([`cursor-pointer transition-transform duration-200`,[(0,t.unref)(i).sizeConfig.value.icon,c.value?`rotate-90 text-primary`:`text-muted`]])},null,8,[`class`])],4)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:`shrink-0`,style:(0,t.normalizeStyle)({width:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`,height:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`})},null,4))],64)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-1 flex flex-1 items-center justify-between gap-2 self-stretch rounded-md transition-all duration-200`,[m.value,(0,t.unref)(i).sizeConfig.value.contentPadding]]),onClick:x},[(0,t.createElementVNode)(`div`,Re,[(0,t.renderSlot)(l.$slots,`option`,{option:e.node.original,selected:s.value,indeterminate:u.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.node.label),1)])]),(0,t.createElementVNode)(`div`,ze,[y.value?((0,t.openBlock)(),(0,t.createBlock)(Ae,{key:0,variant:`soft`,severity:(0,t.unref)(i).highlightVariant.value,size:(0,t.unref)(i).sizeConfig.value.badge,class:`pointer-events-none`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(_.value)+`/`+(0,t.toDisplayString)(v.value),1)]),_:1},8,[`severity`,`size`])):(0,t.createCommentVNode)(``,!0),h.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Be,[(0,t.createVNode)(Le,{modelValue:s.value,indeterminate:u.value,variant:(0,t.unref)(i).highlightVariant.value,size:(0,t.unref)(i).size.value,disabled:r.node.isDisabled,tabindex:`-1`},null,8,[`modelValue`,`indeterminate`,`variant`,`size`,`disabled`])])):(0,t.createCommentVNode)(``,!0)])],2)],2),a.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`relative flex w-full flex-col`,(0,t.unref)(i).sizeConfig.value.rowGap])},[(0,t.unref)(i).treeLineStyle.value===`none`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute border-l border-main`,style:(0,t.normalizeStyle)({left:`${e.level*(0,t.unref)(i).sizeConfig.value.indentStep+(0,t.unref)(i).sizeConfig.value.chevronCenter}px`,top:`0px`,bottom:(0,t.unref)(i).sizeConfig.value.halfRow,borderLeftStyle:(0,t.unref)(i).treeLineStyle.value})},null,4)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.node.childrenValues,n=>((0,t.openBlock)(),(0,t.createBlock)(f,{key:String(n),node:(0,t.unref)(i).nodeMap.value.get(n),level:e.level+1},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(l.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`,`level`]))),128))],2)),[[t.vShow,c.value]]):(0,t.createCommentVNode)(``,!0)],2)),[[t.vShow,o.value]])}}}),He=[`for`],Ue={key:0,class:`text-danger`},We=[`id`,`tabindex`],Ge={key:0,class:`shrink-0 border-b border-main/50 bg-surface/30 p-2`},Ke={key:1,class:`flex shrink-0 items-center justify-between border-b border-main/30 bg-surface/10 p-2`},qe={key:3,class:`flex shrink-0 flex-col items-center justify-center gap-3 p-8 text-center`},Je={class:`text-sm text-muted`},Ye={class:`font-bold text-main`},Xe=[`id`,`tabindex`],Ze={key:0,class:`block w-full truncate`},Qe={key:1,class:`block w-full truncate font-medium`},$e={key:0,class:`inline-flex items-center align-middle text-danger opacity-80`},et={class:`line-through`},tt={key:1},nt={key:2},rt={class:`flex max-w-[250px] flex-col gap-1 rounded-md border border-main bg-content p-3 shadow-lg`},it={class:`truncate pr-4`},at={class:`flex max-w-[250px] flex-col gap-1 rounded-md border border-main bg-content p-3 shadow-lg`},ot={class:`truncate pr-4`},st={class:`ml-auto flex h-full shrink-0 items-center gap-1 pl-2 text-muted`},ct={key:0,class:`shrink-0 border-b border-main/50 bg-surface/30 p-2`},lt={key:1,class:`flex shrink-0 items-center justify-between border-b border-main/30 bg-surface/10 p-2`},ut={key:3,class:`flex shrink-0 flex-col items-center justify-center gap-3 p-8 text-center`},dt={class:`text-sm text-muted`},ft={class:`font-bold text-main`},pt={key:2,class:`mt-0.5 flex flex-col gap-1`},mt={class:`min-w-0`},ht=(0,t.defineComponent)({__name:`Select`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},rounded:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},options:{},optionLabel:{type:[String,Function],default:`label`},optionValue:{type:[String,Function],default:`value`},optionChildren:{default:`children`},optionDisabled:{type:[String,Function],default:`disabled`},inline:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},canDeselect:{type:Boolean,default:!0},closeOnSelect:{type:Boolean},displayMode:{default:`text`},selectionVariant:{default:`highlight`},searchable:{type:Boolean,default:!0},parentSelectable:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},showExpandCollapse:{type:Boolean,default:!1},treeLineStyle:{default:`none`},highlightVariant:{default:`primary`},placeholder:{default:`Select an option...`},maxHeight:{default:320},maxVisibleTextItems:{default:3}},{modelValue:{default:void 0},modelModifiers:{},search:{default:``},searchModifiers:{}}),emits:(0,t.mergeModels)([`search`,`create-new`,`change`,`focus`,`blur`,`open`,`close`],[`update:modelValue`,`update:search`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useModel)(e,`search`),l=(0,t.ref)(!1),u=(0,t.ref)(new Set),d=(0,t.ref)(null),f=(0,t.computed)(()=>i.closeOnSelect??!i.multiple),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),m={xs:40,sm:50,md:65,lg:85,xl:110},h={xs:{wrapHeight:`h-7`,text:`text-xs`,badge:`xs`,rowMinHeight:`min-h-[28px]`,rowGap:`gap-1`,contentPadding:`py-0.5 px-1.5 text-[11px]`,indentStep:20,chevronSize:20,chevronCenter:10,halfRow:`14px`,icon:`w-3 h-3`},sm:{wrapHeight:`h-8`,text:`text-sm`,badge:`sm`,rowMinHeight:`min-h-[32px]`,rowGap:`gap-1.5`,contentPadding:`py-1 px-2 text-xs`,indentStep:24,chevronSize:24,chevronCenter:12,halfRow:`16px`,icon:`w-4 h-4`},md:{wrapHeight:`h-10`,text:`text-sm`,badge:`md`,rowMinHeight:`min-h-[40px]`,rowGap:`gap-2`,contentPadding:`py-1.5 px-2.5 text-sm`,indentStep:28,chevronSize:28,chevronCenter:14,halfRow:`20px`,icon:`w-4 h-4`},lg:{wrapHeight:`h-12`,text:`text-base`,badge:`lg`,rowMinHeight:`min-h-[48px]`,rowGap:`gap-2`,contentPadding:`py-2 px-3 text-base`,indentStep:32,chevronSize:32,chevronCenter:16,halfRow:`24px`,icon:`w-5 h-5`},xl:{wrapHeight:`h-14`,text:`text-lg`,badge:`lg`,rowMinHeight:`min-h-[56px]`,rowGap:`gap-2.5`,contentPadding:`py-2.5 px-3.5 text-base`,indentStep:36,chevronSize:36,chevronCenter:18,halfRow:`28px`,icon:`w-6 h-6`}},g=(0,t.computed)(()=>h[i.size]||h.sm),_=(0,t.shallowRef)(new Map),v=(0,t.shallowRef)([]),y=e=>typeof i.optionValue==`function`?i.optionValue(e):e[i.optionValue],b=e=>typeof i.optionLabel==`function`?i.optionLabel(e):e[i.optionLabel],x=e=>typeof i.optionDisabled==`function`?i.optionDisabled(e):!!e[i.optionDisabled];(0,t.watch)(()=>i.options,()=>{let e=new Map,t=[],n=(t,r,a)=>{let o=[],s=t.length;for(let c=0;c<s;c++){let s=t[c],l=y(s),u=b(s),d=a.concat(u),f=s[i.optionChildren]||[],p={value:l,label:u,searchLabel:u.toLowerCase(),original:s,parentValue:r,childrenValues:[],descendantValues:[],leafDescendantValues:[],pathLabels:d,isDisabled:x(s)};if(e.set(l,p),o.push(l),f.length){let t=n(f,l,d);p.childrenValues=t;let r=[...t],i=[];for(let n=0;n<t.length;n++){let a=e.get(t[n]);r.push(...a.descendantValues),a.childrenValues.length===0?i.push(t[n]):i.push(...a.leafDescendantValues)}p.descendantValues=r,p.leafDescendantValues=i}}return o};t.push(...n(i.options,null,[])),_.value=e,v.value=t},{deep:!0,immediate:!0});let S=(0,t.computed)(()=>{let e=o.value;if(i.multiple){let t=Array.isArray(e)?e.flat(1/0):e==null?[]:[e];return new Set(t)}return Array.isArray(e)?new Set(e.length>0?[e[0]]:[]):new Set(e==null?[]:[e])}),C=e=>{let t=i.multiple?Array.from(e):e.size>0?Array.from(e)[0]:null;o.value=t,a(`change`,t)},w=e=>{let t=_.value.get(e);if(!t||t.isDisabled)return;if(!i.multiple){i.canDeselect&&S.value.has(e)?C(new Set):C(new Set([e])),f.value&&!i.inline&&(l.value=!1);return}let n=new Set(S.value),r=t.descendantValues.length>0,a=(e,t)=>{t?n.add(e):n.delete(e)};if(r&&!i.parentSelectable){let e=t.leafDescendantValues,r=e.every(e=>_.value.get(e)?.isDisabled?!0:n.has(e));e.forEach(e=>{let t=_.value.get(e);t&&!t.isDisabled&&a(e,!r)})}else{let r=n.has(e);a(e,!r),t.descendantValues.forEach(e=>{let t=_.value.get(e);t&&!t.isDisabled&&a(e,!r)})}C(n),f.value&&!i.inline&&(l.value=!1)},T=e=>{if(!i.multiple)C(new Set);else{let t=new Set(S.value);t.delete(e);let n=_.value.get(e);n&&n.descendantValues.forEach(e=>t.delete(e)),C(t)}},E=e=>e.length===0?``:e.join(` → `),D=(0,t.computed)(()=>Array.from(S.value).map(e=>{let t=_.value.get(e),n=typeof i.optionValue==`string`?i.optionValue:`value`,r=typeof i.optionLabel==`string`?i.optionLabel:`label`,a={[n]:e,[r]:String(e)};return{value:e,label:t&&!i.multiple?E(t.pathLabels):t?t.label:String(e),original:t?.original||a,isUnavailable:!t}})),O=(0,t.shallowRef)(new Set);(0,t.watch)(s,e=>{if(a(`search`,e),!e.trim()){O.value=new Set(_.value.keys());return}let t=e.toLowerCase(),n=new Set,r=new Set(u.value);for(let[e,i]of _.value)if(i.searchLabel.includes(t)){n.add(e);let t=i.parentValue;for(;t&&!n.has(t);)n.add(t),r.add(t),t=_.value.get(t)?.parentValue;let a=i.descendantValues;for(let e=0;e<a.length;e++)n.add(a[e])}O.value=n,u.value=r},{immediate:!0});let A=(0,t.ref)(-1),j=(0,t.computed)(()=>{let e=[],t=O.value,n=u.value,r=_.value,i=a=>{for(let o=0;o<a.length;o++){let s=a[o];if(t.has(s)&&(e.push(s),n.has(s))){let e=r.get(s);e&&e.childrenValues.length>0&&i(e.childrenValues)}}};return i(v.value),e}),M=(0,t.computed)(()=>j.value[A.value]??null);(0,t.watch)(l,e=>{e||(A.value=-1)}),(0,t.watch)([s,u],()=>{A.value=-1});let N=e=>{if(i.disabled||i.loading)return;let t=i.inline||l.value;e.key===`Enter`?(e.preventDefault(),t?M.value!==null&&w(M.value):l.value=!0):e.key===`ArrowDown`?(e.preventDefault(),t?A.value=Math.min(A.value+1,j.value.length-1):l.value=!0):e.key===`ArrowUp`?(e.preventDefault(),t&&(A.value=Math.max(A.value-1,0))):e.key===`Escape`?(e.preventDefault(),i.inline||(l.value=!1)):e.key===` `&&!t&&(e.preventDefault(),l.value=!0)},P=(0,t.ref)(null),F=(0,t.ref)(999),ee=()=>{if(d.value)if(i.displayMode===`chips`&&P.value){let e=P.value,t=e.children,n=t.length;if(n<=1){F.value=D.value.length;return}let r=m[i.size]||50,a=e.clientWidth-r,o=0,s=0;for(let e=0;e<n;e++){let n=t[e];if(!n.classList.contains(`overflow-badge`)){if(o+=n.offsetWidth+6,o>a&&s>0)break;s++}}F.value=Math.min(s,D.value.length)}else F.value=i.maxVisibleTextItems},I=null;(0,t.onMounted)(()=>{I=new ResizeObserver(()=>window.requestAnimationFrame(ee)),d.value&&I.observe(d.value),i.autofocus&&d.value&&d.value.focus()}),(0,t.onBeforeUnmount)(()=>{I&&I.disconnect()}),(0,t.watch)(D,()=>{F.value=D.value.length,(0,t.nextTick)(ee)});let te=(0,t.computed)(()=>D.value.slice(0,F.value)),ne=(0,t.computed)(()=>D.value.slice(F.value)),re=()=>{let e=new Set;_.value.forEach((t,n)=>{t.childrenValues.length>0&&e.add(n)}),u.value=e},L=()=>u.value.clear(),R=(0,t.computed)(()=>{for(let e of _.value.values())if(e.childrenValues.length>0)return!0;return!1});(0,t.provide)(`ADVANCED_SELECT_CONTEXT`,{nodeMap:_,isMultiple:(0,t.computed)(()=>i.multiple),parentSelectable:(0,t.computed)(()=>i.parentSelectable),searchQuery:s,selectedValues:S,expandedNodes:u,visibleNodeValues:O,treeLineStyle:(0,t.computed)(()=>i.treeLineStyle),selectionVariant:(0,t.computed)(()=>i.selectionVariant),highlightVariant:(0,t.computed)(()=>i.highlightVariant),activeValue:M,sizeConfig:g,size:(0,t.computed)(()=>i.size),hasHierarchy:R,toggleSelection:w,toggleExpand:e=>{u.value.has(e)?u.value.delete(e):u.value.add(e)}});let z=i.id||`adv-select-${(0,t.useId)()}`,ie=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2`,lg:`sm:pt-2.5`,xl:`sm:pt-3`}[i.size]),ae=(0,t.computed)(()=>{let e=i.rounded?`rounded-full`:`rounded-md`,t=``;t=i.disabled||i.loading?`bg-muted border-main opacity-70 cursor-not-allowed pointer-events-none`:i.error?l.value?`border-danger ring-4 ring-danger/20`:`border-danger hover:border-danger/80 focus:border-danger focus:ring-danger/20`:l.value?`border-primary ring-4 ring-primary/20`:`border-main hover:border-primary/50 focus:border-primary focus:ring-primary/20`;let n=i.size===`xs`?`px-2`:`px-3`;return[`flex items-center justify-between w-full min-w-0 bg-content border transition-all duration-200 outline-none cursor-pointer group focus:ring-4 focus:ring-offset-0 relative overflow-hidden`,e,t,g.value.wrapHeight,n]}),oe=(0,t.computed)(()=>[`flex flex-col overflow-hidden bg-content rounded-md shadow-sm border transition-all duration-200 outline-none w-full focus-within:ring-4 focus-within:ring-offset-0`,i.disabled||i.loading?`bg-muted border-main opacity-70 cursor-not-allowed pointer-events-none`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`]),se=(0,t.computed)(()=>[`flex-1 flex items-center gap-1.5 min-w-0 h-full`,g.value.text,i.disabled||i.loading?`text-muted`:i.error?D.value.length?`text-danger`:`text-danger opacity-70`:D.value.length?`text-main`:`text-muted opacity-70`]);(0,t.watch)(l,e=>{a(e?`open`:`close`)});let ce=e=>a(`focus`,e),le=e=>a(`blur`,e);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full min-w-0`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(z),class:(0,t.normalizeClass)([`flex shrink-0 cursor-pointer items-center gap-1 text-[10px] font-bold tracking-wider text-muted`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${ie.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ue,`*`)):(0,t.createCommentVNode)(``,!0)],10,He)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`,ref_key:`wrapperRef`,ref:d},[e.inline?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,id:(0,t.unref)(z),class:(0,t.normalizeClass)(oe.value),style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight}),tabindex:e.disabled||e.loading?-1:0,onKeydown:(0,t.withModifiers)(N,[`stop`]),onFocus:ce,onBlur:le},[e.searchable?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ge,[(0,t.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":i[0]||=e=>s.value=e,size:e.size,placeholder:`Search...`,"icon-start":`lucide:search`},null,8,[`modelValue`,`size`])])):(0,t.createCommentVNode)(``,!0),e.showExpandCollapse&&v.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ke,[(0,t.createVNode)(c,{label:`Expand All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-down`,class:`!px-2`,onClick:re},null,8,[`size`]),(0,t.createVNode)(c,{label:`Collapse All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-up`,class:`!px-2`,onClick:L},null,8,[`size`])])):(0,t.createCommentVNode)(``,!0),O.value.size>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`custom-scrollbar flex flex-1 flex-col overflow-y-auto p-1.5`,g.value.rowGap])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(v.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Ve,{key:String(e),node:_.value.get(e)},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`]))),128))],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qe,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`h-8 w-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,Je,[i[9]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,Ye,`"`+(0,t.toDisplayString)(s.value)+`"`,1)])]),(0,t.renderSlot)(r.$slots,`action`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${s.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[1]||=e=>a(`create-new`,s.value)},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)])]))],46,We)):((0,t.openBlock)(),(0,t.createBlock)(pe,{key:1,modelValue:l.value,"onUpdate:modelValue":i[8]||=e=>l.value=e,placement:`bottom-start`,disabled:e.disabled||e.loading,"show-arrow":!1,matchWidth:``,triggerClass:`w-full min-w-0`},{trigger:(0,t.withCtx)(({isOpen:a})=>[(0,t.createElementVNode)(`div`,{id:(0,t.unref)(z),tabindex:e.disabled||e.loading?-1:0,class:(0,t.normalizeClass)(ae.value),onKeydown:N,onFocus:ce,onBlur:le},[(0,t.renderSlot)(r.$slots,`trigger`,{},()=>[e.displayMode===`text`||D.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)(se.value)},[D.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ze,(0,t.toDisplayString)(e.placeholder),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Qe,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(te.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:e.value},[e.isUnavailable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,$e,[(0,t.createElementVNode)(`span`,et,(0,t.toDisplayString)(e.label),1),i[10]||=(0,t.createElementVNode)(`span`,{class:`mx-1 text-[10px] !no-underline`},`(Unavailable)`,-1),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`h-3.5 w-3.5 shrink-0 cursor-pointer text-danger transition-colors hover:text-danger/70`,onClick:(0,t.withModifiers)(t=>T(e.value),[`stop`])},null,8,[`onClick`])])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,tt,(0,t.toDisplayString)(e.label),1)),r<te.value.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nt,`, `)):(0,t.createCommentVNode)(``,!0)],64))),128))])),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{onClick:i[2]||=(0,t.withModifiers)(()=>{},[`stop`]),class:`ml-1 flex shrink-0 items-center`},[(0,t.createVNode)(pe,{placement:`top`,trigger:`click`,widthClass:`w-auto`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(Ae,{variant:`soft`,severity:e.highlightVariant,size:g.value.badge,class:`cursor-pointer`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` +`+(0,t.toDisplayString)(ne.value.length)+` Selected `,1)]),_:1},8,[`severity`,`size`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,rt,[i[11]||=(0,t.createElementVNode)(`span`,{class:`mb-1 text-[10px] font-black tracking-wider text-muted uppercase`},`Hidden Selections`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ne.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.value,class:`flex items-center justify-between gap-3 border-b border-main/10 py-1.5 text-sm text-main last:border-0`},[(0,t.createElementVNode)(`span`,it,(0,t.toDisplayString)(e.label),1),(0,t.createVNode)(c,{icon:`lucide:x`,variant:`text`,severity:`danger`,size:`xs`,class:`shrink-0 !p-1`,onClick:t=>T(e.value)},null,8,[`onClick`])]))),128))])]),_:1})],512),[[t.vShow,e.multiple&&ne.value.length>0]])],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,ref_key:`chipsContainerRef`,ref:P,class:`flex h-full min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-hidden`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(te.value,i=>((0,t.openBlock)(),(0,t.createBlock)(Ae,{key:i.value,variant:`soft`,severity:i.isUnavailable?`danger`:e.highlightVariant,size:g.value.badge,class:`group/chip flex max-w-[140px] shrink-0 items-center`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`chip`,{option:i.original,remove:()=>T(i.value)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`block truncate`,i.isUnavailable?`line-through opacity-80`:``])},(0,t.toDisplayString)(i.label),3),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`ml-1 h-3.5 w-3.5 shrink-0 cursor-pointer transition-colors hover:text-danger`,onClick:(0,t.withModifiers)(e=>T(i.value),[`stop`])},null,8,[`onClick`])])]),_:2},1032,[`severity`,`size`]))),128)),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{onClick:i[3]||=(0,t.withModifiers)(()=>{},[`stop`]),class:`overflow-badge flex shrink-0 items-center`},[(0,t.createVNode)(pe,{placement:`top`,trigger:`click`,widthClass:`w-auto`,triggerClass:`flex items-center justify-center`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(Ae,{variant:`solid`,severity:e.highlightVariant,size:g.value.badge,class:`cursor-pointer`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` +`+(0,t.toDisplayString)(ne.value.length),1)]),_:1},8,[`severity`,`size`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,at,[i[12]||=(0,t.createElementVNode)(`span`,{class:`mb-1 text-[10px] font-black tracking-wider text-muted uppercase`},`Hidden Selections`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ne.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.value,class:`flex items-center justify-between gap-1 border-b border-main/10 text-sm text-main last:border-0`},[(0,t.createElementVNode)(`span`,ot,(0,t.toDisplayString)(e.label),1),(0,t.createVNode)(c,{icon:`lucide:x`,variant:`text`,severity:`danger`,size:`xs`,class:`shrink-0 !p-1`,onClick:t=>T(e.value)},null,8,[`onClick`])]))),128))])]),_:1})],512),[[t.vShow,ne.value.length>0]])],512)),(0,t.createElementVNode)(`div`,st,[e.showClear&&D.value.length>0&&!e.disabled&&!e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`shrink-0 cursor-pointer transition-transform duration-200 hover:text-danger`,onClick:i[4]||=(0,t.withModifiers)(e=>C(new Set),[`stop`])})):(0,t.createCommentVNode)(``,!0),e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:loader-2`,class:(0,t.normalizeClass)([`shrink-0 animate-spin text-primary`,[e.size===`xs`?`h-3.5 w-3.5`:`h-4 w-4`]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:`lucide:chevron-right`,class:(0,t.normalizeClass)([`shrink-0 cursor-pointer transition-transform duration-200 hover:text-primary`,[a?`rotate-90 text-primary`:``,e.size===`xs`?`h-3.5 w-3.5`:`h-4 w-4`]])},null,8,[`class`]))])])],42,Xe)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex w-full flex-col overflow-hidden rounded-md border border-main bg-content shadow-xl`,style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight}),onKeydown:i[7]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.searchable?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ct,[(0,t.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":i[5]||=e=>s.value=e,size:e.size,placeholder:`Search...`,"icon-start":`lucide:search`,autofocus:``},null,8,[`modelValue`,`size`])])):(0,t.createCommentVNode)(``,!0),e.showExpandCollapse&&v.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,lt,[(0,t.createVNode)(c,{label:`Expand All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-down`,class:`!px-2`,onClick:re},null,8,[`size`]),(0,t.createVNode)(c,{label:`Collapse All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-up`,class:`!px-2`,onClick:L},null,8,[`size`])])):(0,t.createCommentVNode)(``,!0),O.value.size>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`custom-scrollbar flex flex-1 flex-col overflow-y-auto p-1.5`,g.value.rowGap])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(v.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Ve,{key:String(e),node:_.value.get(e)},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`]))),128))],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ut,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`h-8 w-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,dt,[i[13]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,ft,`"`+(0,t.toDisplayString)(s.value)+`"`,1)])]),(0,t.renderSlot)(r.$slots,`action`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${s.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[6]||=e=>a(`create-new`,s.value)},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)])]))],36)]),_:3},8,[`modelValue`,`disabled`])),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,mt,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)],512)],2))}}),gt={class:`flex inline-flex flex-col gap-1`},_t=[`for`],vt=[`id`,`name`,`value`,`disabled`,`required`],yt={key:0,class:`ml-0.5 text-danger`},bt={key:0,class:`mt-0.5 ml-1 flex flex-col`},xt={class:`min-w-0`},St=(0,t.defineComponent)({__name:`Radio`,props:(0,t.mergeModels)({id:{},name:{},value:{},label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},variant:{default:`primary`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useId)(),c=(0,t.computed)(()=>i.id||`adv-radio-${s}`),l=(0,t.computed)(()=>i.name||`radio-group-${s}`),u=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),d=(0,t.computed)(()=>o.value===i.value),f=(0,t.computed)(()=>{let e={xs:{icon:`w-[14px] h-[14px]`,text:`text-[11px] leading-[14px]`,gap:`gap-1.5`,mt:`mt-0`},sm:{icon:`w-4 h-4`,text:`text-xs leading-4`,gap:`gap-2`,mt:`mt-[1px]`},md:{icon:`w-5 h-5`,text:`text-sm leading-5`,gap:`gap-2`,mt:`mt-[1px]`},lg:{icon:`w-6 h-6`,text:`text-base leading-6`,gap:`gap-2.5`,mt:`mt-[2px]`},xl:{icon:`w-7 h-7`,text:`text-lg leading-7`,gap:`gap-3`,mt:`mt-[2px]`}};return e[i.size]||e.sm}),p={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},m=(0,t.computed)(()=>p[i.variant]||p.primary),h=e=>{a(`change`,i.value,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gt,[(0,t.createElementVNode)(`label`,{for:c.value,class:(0,t.normalizeClass)([`group relative inline-flex items-start transition-colors duration-150`,[e.disabled?`cursor-not-allowed opacity-50`:`-ml-1 cursor-pointer rounded-md px-1 py-0.5 hover:bg-main/5`,f.value.gap]])},[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`radio`,id:c.value,name:l.value,value:e.value,disabled:e.disabled,required:e.required,"onUpdate:modelValue":i[0]||=e=>o.value=e,class:`peer sr-only`,onChange:h},null,40,vt),[[t.vModelRadio,o.value]]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1`,[f.value.icon,f.value.mt,e.error?`peer-focus-visible:ring-danger/50`:`peer-focus-visible:ring-${e.variant}/50`]])},[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:circle-dot`,class:(0,t.normalizeClass)([`h-full w-full`,[e.error?`text-danger`:m.value]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:circle`,class:(0,t.normalizeClass)([`h-full w-full transition-colors`,[e.error?`text-danger hover:text-danger/80`:`text-muted/30 group-hover:text-muted`]])},null,8,[`class`]))],2),e.label||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex-1 text-pretty break-words select-none`,[f.value.text,e.error?`text-danger`:`text-main`]])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,yt,`*`)):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)],10,_t),u.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,xt,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)]))}}),Ct=[`for`],wt={key:0,class:`text-danger`},Tt={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},Et=[`id`,`disabled`,`placeholder`,`rows`,`maxlength`,`aria-invalid`],Dt={key:0,class:`pointer-events-none absolute right-1 bottom-1 p-0.5 text-main/30 transition-colors duration-200 group-focus-within:text-primary/60 group-hover:text-main/50`},Ot={key:0},kt={key:0,class:`mt-0.5 flex flex-col gap-1`},At={class:`min-w-0`},jt=Se((0,t.defineComponent)({inheritAttrs:!1,__name:`Textarea`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},placeholder:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},rows:{default:3},autoResize:{type:Boolean,default:!1},resize:{default:`vertical`},maxLength:{},showCount:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(null),c=i.id||`textarea-${(0,t.useId)()}`,l=()=>{if(!i.autoResize||!s.value)return;s.value.style.height=`auto`;let e=s.value.scrollHeight;s.value.style.height=`${e}px`};(0,t.watch)(o,()=>{i.autoResize&&(0,t.nextTick)(l)}),(0,t.onMounted)(()=>{i.autoResize&&(0,t.nextTick)(l)});let u=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),d=(0,t.computed)(()=>[`flex flex-col w-full bg-content border rounded-md transition-colors duration-200 focus-within:ring-4 focus-within:ring-offset-0 relative group`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`]),f=(0,t.computed)(()=>{let e=[`min-w-full w-full bg-transparent font-medium custom-scrollbar min-h-full rounded-md`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`].join(` `),t={xs:`text-xs px-2 pt-2 ${m.value?`pb-6`:`pb-2`}`,sm:`text-xs px-3 pt-3 ${m.value?`pb-7`:`pb-3`}`,md:`text-sm px-3.5 pt-3.5 ${m.value?`pb-8`:`pb-3.5`}`,lg:`text-base px-4 pt-4 ${m.value?`pb-8`:`pb-4`}`,xl:`text-lg px-5 pt-5 ${m.value?`pb-9`:`pb-5`}`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`,r=`resize-none`;return i.autoResize?r=`resize-none overflow-hidden`:i.resize===`vertical`&&(r=`resize-y`),[e,t[i.size],n,r]}),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),m=(0,t.computed)(()=>i.showCount||!!i.maxLength),h=(0,t.computed)(()=>o.value?.length||0),g=(0,t.computed)(()=>i.maxLength&&h.value>=i.maxLength*.9),_=(0,t.computed)(()=>i.maxLength&&h.value>=i.maxLength);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(c),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${u.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,wt,`*`)):(0,t.createCommentVNode)(``,!0)],10,Ct)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Tt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[(0,t.withDirectives)((0,t.createElementVNode)(`textarea`,(0,t.mergeProps)({ref_key:`textareaRef`,ref:s,id:(0,t.unref)(c),disabled:e.disabled,placeholder:e.placeholder,rows:e.rows,maxlength:e.maxLength,class:f.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>a(`input`,e.target.value),onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e)},r.$attrs),null,16,Et),[[t.vModelText,o.value]]),!e.autoResize&&e.resize!==`none`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Dt,[...i[5]||=[(0,t.createElementVNode)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[(0,t.createElementVNode)(`path`,{d:`M8 2L2 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),(0,t.createElementVNode)(`path`,{d:`M8 6L6 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`})],-1)]])):(0,t.createCommentVNode)(``,!0),m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`pointer-events-none absolute flex justify-end select-none`,[e.resize!==`none`&&!e.autoResize?`right-3.5 bottom-2.5`:`right-2 bottom-2`]])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`rounded-sm bg-content/80 px-1 text-[10px] font-bold tracking-wider backdrop-blur-sm transition-colors`,[_.value?`text-danger`:g.value?`text-warning`:`text-muted/60`,e.disabled?`opacity-50`:``]])},[(0,t.createTextVNode)((0,t.toDisplayString)(h.value)+` `,1),e.maxLength?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ot,` / `+(0,t.toDisplayString)(e.maxLength),1)):(0,t.createCommentVNode)(``,!0)],2)],2)):(0,t.createCommentVNode)(``,!0)],2),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,At,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),[[`__scopeId`,`data-v-cc936ae2`]]),Mt={class:`leading-none tracking-tight`},Nt=[`role`,`tabindex`,`aria-label`],Pt=[`src`,`alt`],Ft=[`src`,`alt`,`loading`,`fetchpriority`,`crossorigin`,`srcset`],It={class:`absolute top-4 right-4 z-10 flex items-center gap-2 rounded-full border border-main/20 bg-surface/50 p-1 shadow-lg backdrop-blur-md`},Lt={class:`min-w-[3ch] text-center font-mono text-xs font-bold text-main`},Rt=[`src`,`alt`],zt=Se((0,t.defineComponent)({name:`Image`,inheritAttrs:!1,__name:`Image`,props:{src:{},alt:{default:`Image`},fallback:{},lazy:{type:Boolean,default:!0},fetchpriority:{default:`auto`},crossorigin:{},srcset:{},previewable:{type:Boolean,default:!0},fit:{default:`cover`},shape:{default:`rounded`},width:{},height:{},skeletonClass:{},max:{default:4},stacked:{type:Boolean,default:!0},borderColor:{default:`border-surface`}},emits:[`load`,`error`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>Array.isArray(i.src)),s=(0,t.computed)(()=>{let e=i.width||(o.value?48:void 0);if(e)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e}),c=(0,t.computed)(()=>{if(i.shape===`circle`)return s.value;let e=i.height||(o.value?48:void 0);if(e)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e}),l=(0,t.computed)(()=>{let e=parseInt(String(i.width||48));return e<=24?`text-[9px]`:e<=32?`text-[10px]`:`text-xs`}),u=(0,t.computed)(()=>o.value?i.src.slice(0,i.max).map(e=>typeof e==`object`&&e&&`src`in e&&!(e instanceof Blob)&&!(e instanceof File)?e:{src:e}):[]),d=(0,t.computed)(()=>o.value?Math.max(0,i.src.length-i.max):0),f=(0,t.ref)(`loading`),p=(0,t.ref)(null),m=(0,t.ref)(!1),h=(0,t.ref)(!1),g=(0,t.shallowRef)(null);(0,t.onMounted)(()=>{h.value=!0,o.value||y()});let _=(0,t.computed)(()=>o.value||!i.src?``:typeof i.src==`string`?i.src:(p.value||=URL.createObjectURL(i.src),p.value)),v=()=>{p.value&&=(URL.revokeObjectURL(p.value),null)},y=()=>{!g.value||o.value||g.value.complete&&(g.value.naturalWidth>0?f.value!==`loaded`&&(f.value=`loaded`,a(`load`,new Event(`load`))):_.value&&f.value!==`error`&&(f.value=`error`,a(`error`,new Event(`error`))))};(0,t.watch)(()=>i.src,(e,t)=>{o.value||e!==t&&v()}),(0,t.watch)(()=>_.value,e=>{if(!o.value){if(!e){f.value=`error`;return}f.value=`loading`,(0,t.nextTick)(()=>y())}},{immediate:!0}),(0,t.onBeforeUnmount)(()=>v());let b=e=>{f.value!==`loaded`&&(f.value=`loaded`,a(`load`,e))},x=e=>{f.value!==`error`&&(f.value=`error`,a(`error`,e))},S=(0,t.ref)(1),C=(0,t.ref)(0),w=(0,t.ref)(0),T=(0,t.ref)(!1),E=0,D=0,O=()=>{i.previewable&&f.value===`loaded`&&(m.value=!0,document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,A))},k=()=>{m.value=!1,S.value=1,C.value=0,w.value=0,document.body.style.overflow=``,document.removeEventListener(`keydown`,A)},A=e=>{e.key===`Escape`&&k(),(e.key===`=`||e.key===`+`)&&j(),e.key===`-`&&M()},j=()=>S.value=Math.min(S.value+.25,4),M=()=>S.value=Math.max(S.value-.25,.5),N=e=>{e.preventDefault(),S.value+=e.deltaY*-.005,S.value=Math.min(Math.max(.5,S.value),4)},P=e=>{T.value=!0;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=`touches`in e?e.touches[0].clientY:e.clientY;E=t-C.value,D=n-w.value},F=e=>{if(!T.value)return;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=`touches`in e?e.touches[0].clientY:e.clientY;C.value=t-E,w.value=n-D},ee=()=>T.value=!1,I=(0,t.computed)(()=>({rounded:`rounded-3xl`,circle:`rounded-full aspect-square`,square:`rounded-none`})[i.shape]),te=(0,t.computed)(()=>[`relative overflow-hidden isolate flex items-center justify-center bg-surface shrink-0 transition-opacity max-w-full`,I.value,i.previewable&&f.value===`loaded`?`cursor-zoom-in hover:opacity-90`:``]),ne=(0,t.computed)(()=>({width:s.value,height:c.value}));return(r,i)=>{let a=(0,t.resolveComponent)(`Image`,!0);return o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({key:0,class:[`flex max-w-full items-center`,[e.stacked?`-space-x-3`:`gap-2`]]},r.$attrs),[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(a,{key:r,src:n.src,alt:n.alt||e.alt,fallback:n.fallback||e.fallback,shape:e.shape,width:e.width,height:e.height,lazy:e.lazy,previewable:e.previewable,fit:e.fit,skeletonClass:e.skeletonClass,class:(0,t.normalizeClass)([`border-2 transition-transform duration-200`,[e.borderColor,e.stacked?`relative z-0 shadow-sm hover:z-10 hover:scale-110`:``]])},null,8,[`src`,`alt`,`fallback`,`shape`,`width`,`height`,`lazy`,`previewable`,`fit`,`skeletonClass`,`class`]))),128)),d.value>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`relative z-0 flex shrink-0 cursor-default items-center justify-center border-2 bg-surface font-bold text-main transition-transform duration-200 hover:z-10`,[I.value,e.borderColor,l.value]]),style:(0,t.normalizeStyle)({width:s.value||`48px`,height:c.value||`48px`})},[(0,t.createElementVNode)(`span`,Mt,`+`+(0,t.toDisplayString)(d.value),1)],6)):(0,t.createCommentVNode)(``,!0)],16)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({key:1,class:te.value,style:ne.value},r.$attrs,{onClick:O,role:e.previewable?`button`:`img`,tabindex:e.previewable&&f.value===`loaded`?0:void 0,onKeydown:(0,t.withKeys)(O,[`enter`]),"aria-label":e.alt}),[f.value===`loading`?(0,t.renderSlot)(r.$slots,`loading`,{key:0},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute inset-0 z-10 flex h-full w-full items-center justify-center overflow-hidden bg-main/5`,e.skeletonClass])},[i[0]||=(0,t.createElementVNode)(`div`,{class:`shimmer-effect absolute inset-0 h-full w-[200%]`},null,-1),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:image`,class:`relative z-10 h-8 w-8 text-main/20`})],2)],!0):f.value===`error`||!_.value?(0,t.renderSlot)(r.$slots,`error`,{key:1},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`z-10 flex h-full w-full shrink-0 items-center justify-center border border-main bg-surface text-muted/50`,[I.value,e.fallback?`border-transparent`:`border-dashed`,!e.width&&!e.height?`min-h-[80px] min-w-[80px]`:``]])},[e.fallback?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,src:e.fallback,alt:e.alt,class:(0,t.normalizeClass)([`block h-full w-full shrink-0`,I.value]),style:(0,t.normalizeStyle)({objectFit:e.fit})},null,14,Pt)):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:image-off`,class:`h-8 w-8`}))],2)],!0):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`img`,{ref_key:`imgRef`,ref:g,src:_.value,alt:e.alt,loading:e.lazy?`lazy`:`eager`,decoding:`async`,fetchpriority:e.fetchpriority,crossorigin:e.crossorigin||void 0,srcset:e.srcset,onLoad:b,onError:x,class:(0,t.normalizeClass)([`z-0 block h-full w-full max-w-full shrink-0 transition-opacity duration-300`,[f.value===`loaded`?`opacity-100`:`opacity-0`,I.value]]),style:(0,t.normalizeStyle)({objectFit:e.fit})},null,46,Ft),[[t.vShow,f.value!==`error`&&_.value]]),h.value&&m.value?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:2,to:`body`},[(0,t.createElementVNode)(`div`,{class:`bg-background/95 fixed inset-0 z-[9999] flex animate-[fadeIn_0.2s_ease-out] touch-none items-center justify-center backdrop-blur-sm`,onClick:(0,t.withModifiers)(k,[`self`])},[(0,t.createElementVNode)(`div`,It,[(0,t.renderSlot)(r.$slots,`preview-actions`,{},void 0,!0),(0,t.createElementVNode)(`button`,{onClick:M,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-main/10`,title:`Zoom Out (-)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:zoom-out`,class:`h-5 w-5`})]),(0,t.createElementVNode)(`span`,Lt,(0,t.toDisplayString)(Math.round(S.value*100))+`%`,1),(0,t.createElementVNode)(`button`,{onClick:j,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-main/10`,title:`Zoom In (+)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:zoom-in`,class:`h-5 w-5`})]),i[1]||=(0,t.createElementVNode)(`div`,{class:`mx-1 h-5 w-px bg-main/20`},null,-1),(0,t.createElementVNode)(`button`,{onClick:k,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-danger hover:text-on-danger`,title:`Close (Esc)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`h-5 w-5`})])]),(0,t.createElementVNode)(`div`,{class:`relative flex h-full w-full items-center justify-center overflow-hidden`,onWheelPassive:N,onMousedown:P,onMousemove:F,onMouseup:ee,onMouseleave:ee,onTouchstartPassive:P,onTouchmovePassive:F,onTouchendPassive:ee},[(0,t.createElementVNode)(`img`,{src:_.value,alt:e.alt,draggable:`false`,class:(0,t.normalizeClass)([`max-h-[90vh] max-w-[90vw] object-contain shadow-xl transition-transform ease-out will-change-transform select-none`,{"cursor-grab":!T.value,"cursor-grabbing":T.value,"duration-100":!T.value,"duration-0":T.value}]),style:(0,t.normalizeStyle)({transform:`translate3d(${C.value}px, ${w.value}px, 0) scale(${S.value})`})},null,14,Rt)],32)])])):(0,t.createCommentVNode)(``,!0)],16,Nt))}}}),[[`__scopeId`,`data-v-177a7564`]]),Bt=[`aria-label`],Vt={key:0,class:`flex w-full items-end justify-between`},Ht=[`id`],Ut={key:1},Wt={class:`flex w-full items-center gap-3`},Gt=[`aria-labelledby`,`aria-valuenow`,`aria-valuemax`],Kt={key:1,class:`flex w-full justify-end`},qt=Se((0,t.defineComponent)({__name:`ProgressBar`,props:(0,t.mergeModels)({id:{},max:{default:100},label:{},showValue:{type:Boolean,default:!1},valuePosition:{default:`top`},valueFormatter:{},size:{default:`sm`},variant:{default:`primary`},striped:{type:Boolean,default:!1},animated:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1}},{modelValue:{default:0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r=(0,t.useModel)(e,`modelValue`),i=(0,t.useId)(),a=(0,t.computed)(()=>n.id||`adv-progress-${i}`),o=(0,t.computed)(()=>{if(n.max<=0)return 0;let e=r.value/n.max*100;return Math.min(Math.max(e,0),100)}),s=(0,t.computed)(()=>n.valueFormatter?n.valueFormatter(r.value,n.max):`${Math.round(o.value)}%`),c=(0,t.computed)(()=>{let e={xs:{height:`h-1.5`,label:`text-[10px]`,insideText:`text-[8px] px-1`},sm:{height:`h-2.5`,label:`text-xs`,insideText:`text-[10px] px-1.5`},md:{height:`h-4`,label:`text-sm`,insideText:`text-xs px-2`},lg:{height:`h-6`,label:`text-base`,insideText:`text-sm px-3`},xl:{height:`h-8`,label:`text-lg`,insideText:`text-base px-3.5`}};return e[n.size]||e.sm}),l={primary:`bg-primary text-on-primary`,secondary:`bg-secondary text-on-secondary`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,danger:`bg-danger text-on-danger`,info:`bg-info text-on-info`},u=(0,t.computed)(()=>l[n.variant]||l.primary),d=(0,t.computed)(()=>{let e=[u.value,`shadow-[inset_0_1px_rgba(255,255,255,0.25)] rounded-full transition-all duration-500 ease-out flex items-center justify-end overflow-hidden`];return n.indeterminate?[...e,`absolute top-0 bottom-0 indeterminate-slide`]:[...e,`h-full`,n.striped?`progress-striped`:``,n.striped&&n.animated?`progress-animated`:``]});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`flex w-full flex-col gap-1`,"aria-label":e.label,"aria-live":`polite`},[e.label||e.showValue&&e.valuePosition===`top`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Vt,[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,id:`${a.value}-label`,class:(0,t.normalizeClass)([`truncate pr-4 font-bold tracking-wider text-muted uppercase`,c.value.label])},(0,t.toDisplayString)(e.label),11,Ht)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ut)),e.showValue&&e.valuePosition===`top`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`shrink-0 font-semibold text-main`,c.value.label])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Wt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative flex-1 overflow-hidden rounded-full bg-surface shadow-inner`,c.value.height]),role:`progressbar`,"aria-labelledby":e.label?`${a.value}-label`:void 0,"aria-valuenow":e.indeterminate?void 0:r.value,"aria-valuemin":0,"aria-valuemax":e.max},[e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)(d.value)},null,2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)(d.value),style:(0,t.normalizeStyle)({width:`${o.value}%`})},[e.showValue&&e.valuePosition===`inside`&&o.value>8?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`font-bold tracking-wide whitespace-nowrap drop-shadow-md select-none`,c.value.insideText])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)],6))],10,Gt),e.showValue&&e.valuePosition===`right`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`w-12 shrink-0 text-right font-semibold text-main`,c.value.label])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)]),e.showValue&&e.valuePosition===`bottom`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Kt,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`shrink-0 font-semibold text-muted`,c.value.label])},(0,t.toDisplayString)(s.value),3)])):(0,t.createCommentVNode)(``,!0)],8,Bt))}}),[[`__scopeId`,`data-v-d6082f33`]]),Jt=[`aria-disabled`],Yt={key:0,class:`flex items-baseline justify-between pb-1 pl-1`},Xt=[`for`],Zt={key:0,class:`text-[11px] font-medium tracking-wider text-muted uppercase`},Qt=[`onKeydown`],$t={class:`pointer-events-none flex flex-col items-center justify-center gap-3`},en={class:`text-center`},tn=[`onKeydown`],nn={key:1,class:`mt-0.5 flex flex-col gap-1.5 pl-1`},rn={class:`break-words`},an={key:0,class:`mr-1 font-bold`},on=[`id`,`multiple`,`accept`,`disabled`],sn={key:0,class:`mt-2 flex flex-col gap-2.5`},cn={class:`relative h-11 w-11 shrink-0`},ln={key:1,class:`relative flex h-full w-full flex-col items-center justify-center overflow-hidden rounded-lg border border-main/40 bg-content text-muted shadow-sm`},un={class:`absolute bottom-0 w-full border-t border-main/20 bg-main/5 py-[1px] text-center`},dn={class:`text-[8px] font-black tracking-wider text-main/70 uppercase`},fn={key:0,class:`absolute -top-1.5 -right-1.5 z-10 rounded-full border border-success/20 bg-content p-0.5 shadow-sm`},pn={class:`flex min-w-0 flex-1 flex-col justify-center gap-1.5`},mn={class:`flex items-center justify-between gap-3`},hn=[`title`],gn={class:`shrink-0 font-mono text-[11px] leading-none text-muted`},_n={key:0,class:`flex h-3 w-full items-center`},vn={key:0,class:`flex w-full items-center gap-2`},yn={class:`w-8 text-right font-mono text-[10px] font-bold text-primary`},bn={key:1,class:`flex items-center gap-1 text-[11px] font-medium text-success opacity-80`},xn=(0,t.defineComponent)({__name:`FileUpload`,props:(0,t.mergeModels)({id:{},accept:{},multiple:{type:Boolean,default:!1},maxSize:{default:1/0},maxFiles:{default:1/0},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},isShowProgressBar:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},layout:{default:`dropzone`},label:{default:`Upload Files`},hint:{default:`Drag and drop files here or click to browse.`},validator:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`,`error`,`remove`,`exceed-limit`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=(0,t.useModel)(e,`modelValue`),l=a.id||`adv-upload-${(0,t.useId)()}`,u=(0,t.ref)(null),d=(0,t.ref)(!1),f=0,p=(0,t.ref)(new Map),m=(0,t.ref)([]),h=(0,t.computed)(()=>{let e=[...m.value];return a.error&&(typeof a.error==`string`?e.push({message:a.error}):Array.isArray(a.error)&&a.error.forEach(t=>e.push({message:t}))),e}),g=(0,t.computed)(()=>h.value.length>0),_=e=>{e&&URL.revokeObjectURL(e)};(0,t.onBeforeUnmount)(()=>{p.value.forEach(e=>_(e.previewUrl))});let v=(e,t)=>{if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=e.type.toLowerCase(),i=e.name.toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.replace(`/*`,``)):r===e)},y=async e=>{if(a.accept&&!v(e,a.accept))return`Invalid file type. Allowed: ${a.accept}`;if(e.size>a.maxSize)return`File exceeds maximum size of ${(a.maxSize/(1024*1024)).toFixed(2)}MB.`;if(a.validator){let t=await a.validator(e);if(typeof t==`string`)return t;if(t===!1)return`File validation failed.`}return null},b=async e=>{if(a.disabled||a.loading||!e.length)return;m.value=[];let n=a.multiple?Array.from(e):[e[0]],r=a.multiple?s.value.length:0;if(n.length+r>a.maxFiles){o(`exceed-limit`);let e=`Maximum of ${a.maxFiles} files allowed.`;o(`error`,e),m.value.push({message:e});return}let i=a.multiple?[...s.value]:[],c=new Map(a.multiple?p.value:[]);a.multiple||(c.forEach(e=>_(e.previewUrl)),c.clear());let l=n.map(async e=>({file:e,errorMsg:await y(e),id:`${e.name}-${e.lastModified}-${e.size}`})),u=await Promise.all(l),d=!1;for(let e=0;e<u.length;e++){let{file:n,errorMsg:r,id:a}=u[e];if(!c.has(a))if(r)o(`error`,r,n),m.value.push({fileName:n.name,message:r});else{let e=n.type.startsWith(`image/`),r=n.name.split(`.`).pop()?.substring(0,4).toUpperCase()||`FILE`;i.push(n),c.set(a,{id:a,file:(0,t.markRaw)(n),status:`pending`,progress:0,previewUrl:e?URL.createObjectURL(n):void 0,isImage:e,extension:r}),d=!0}}(d||!a.multiple)&&(p.value=c,s.value=i,o(`change`,i))},x=e=>{e.preventDefault(),!a.disabled&&(f++,d.value=!0)},S=e=>{e.preventDefault(),!a.disabled&&(f--,f===0&&(d.value=!1))},C=e=>e.preventDefault(),w=e=>{e.preventDefault(),f=0,d.value=!1,!(a.disabled||!e.dataTransfer?.files.length)&&b(e.dataTransfer.files)},T=e=>{let t=e.target;t.files?.length&&b(t.files),u.value&&(u.value.value=``)},E=e=>{let t=p.value.get(e);if(!t)return;_(t.previewUrl),p.value.delete(e);let n=s.value.filter(e=>e!==t.file);s.value=n,o(`remove`,t.file),o(`change`,n),n.length===0&&(m.value=[])},D=()=>{!a.disabled&&!a.loading&&u.value?.click()},O=e=>{if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**r).toFixed(2))+` `+n[r]},k=(0,t.computed)(()=>Array.from(p.value.values()));return r({triggerSelect:D,updateProgressBar:(e,t,n)=>{let r=p.value.get(e);r&&(r.progress=Math.min(100,Math.max(0,t)),n&&(r.status=n))}}),(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`flex w-full flex-col gap-3`,"aria-disabled":e.disabled},[e.label&&e.layout===`dropzone`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Yt,[(0,t.createElementVNode)(`label`,{for:(0,t.unref)(l),class:(0,t.normalizeClass)([`text-sm font-bold tracking-wide`,g.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.label),11,Xt),e.maxFiles>1&&e.maxFiles!==1/0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Zt,` Max: `+(0,t.toDisplayString)(e.maxFiles)+` Files `,1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`trigger`,{trigger:D,isDragging:d.value,disabled:e.disabled,hasError:g.value},()=>[e.layout===`dropzone`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,onDragenter:x,onDragleave:S,onDragover:C,onDrop:w,onClick:D,onKeydown:[(0,t.withKeys)(D,[`enter`]),(0,t.withKeys)((0,t.withModifiers)(D,[`prevent`]),[`space`])],tabindex:`0`,class:(0,t.normalizeClass)([`group relative flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-10 transition-all duration-300 outline-none focus-visible:border-primary focus-visible:ring-4 focus-visible:ring-primary/20`,[e.disabled||e.loading?`cursor-not-allowed border-main bg-muted opacity-60`:d.value?`scale-[1.01] border-primary bg-primary/5 shadow-inner`:g.value?`border-danger bg-danger/5 hover:border-danger/60`:`border-main/40 bg-surface/30 hover:border-primary/50 hover:bg-surface/80`]])},[(0,t.createElementVNode)(`div`,$t,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`rounded-full p-3 transition-colors duration-300`,g.value&&!d.value?`bg-danger/10`:d.value?`bg-primary/10`:`bg-main/5 group-hover:bg-primary/5`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.loading?`lucide:loader-2`:g.value&&!d.value?`lucide:alert-circle`:`lucide:cloud-upload`,class:(0,t.normalizeClass)([`h-8 w-8 transition-colors duration-300`,[e.loading?`animate-spin text-primary`:d.value?`text-primary`:g.value?`text-danger group-hover:text-danger/70`:`text-muted group-hover:text-primary`]])},null,8,[`icon`,`class`])],2),(0,t.createElementVNode)(`div`,en,[(0,t.createElementVNode)(`p`,{class:(0,t.normalizeClass)([`text-sm font-bold`,g.value&&!d.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.loading?`Processing...`:d.value?`Drop files now`:`Click or drag files to upload`),3),e.hint&&!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:0,class:(0,t.normalizeClass)([`mt-1 max-w-xs text-xs leading-relaxed`,g.value?`text-danger/70`:`text-muted`])},(0,t.toDisplayString)(e.hint),3)):(0,t.createCommentVNode)(``,!0),e.accept&&!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:1,class:(0,t.normalizeClass)([`mt-3 text-[10px] font-semibold tracking-wider uppercase`,g.value?`text-danger/60`:`text-muted/60`])},(0,t.toDisplayString)(e.accept.replace(/,/g,` • `)),3)):(0,t.createCommentVNode)(``,!0)])])],42,Qt)):e.layout===`button`?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,label:e.label,icon:`lucide:upload`,variant:g.value?`solid`:`outline`,severity:g.value?`danger`:`secondary`,loading:e.loading,disabled:e.disabled,onClick:D},null,8,[`label`,`variant`,`severity`,`loading`,`disabled`])):e.layout===`compact`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,onDragenter:x,onDragleave:S,onDragover:C,onDrop:w,onClick:D,onKeydown:[(0,t.withKeys)(D,[`enter`]),(0,t.withKeys)((0,t.withModifiers)(D,[`prevent`]),[`space`])],tabindex:`0`,class:(0,t.normalizeClass)([`group relative flex w-full cursor-pointer items-center rounded-lg border border-dashed px-4 py-2.5 transition-all duration-200 outline-none focus-visible:ring-4 focus-visible:ring-primary/20`,[e.disabled||e.loading?`cursor-not-allowed border-main/50 bg-muted opacity-60`:d.value?`border-primary bg-primary/5`:g.value?`border-danger bg-danger/5 hover:border-danger/60`:`border-main/50 bg-surface/30 hover:border-primary/50 hover:bg-surface/80`]])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.loading?`lucide:loader-2`:g.value&&!d.value?`lucide:alert-circle`:`lucide:paperclip`,class:(0,t.normalizeClass)([`mr-3 h-4 w-4 shrink-0 transition-colors duration-200`,[e.loading?`animate-spin text-primary`:d.value?`text-primary`:g.value?`text-danger`:`text-muted group-hover:text-primary`]])},null,8,[`icon`,`class`]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex-1 truncate text-sm font-semibold`,g.value&&!d.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.loading?`Processing...`:d.value?`Drop files here`:e.label||`Choose file...`),3),!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-3 shrink-0 rounded border bg-content px-2 py-1 text-[11px] font-bold shadow-sm transition-colors`,g.value?`border-danger/30 text-danger group-hover:border-danger/60`:`border-main/30 text-main/70 group-hover:border-main/60`])},` Browse `,2)):(0,t.createCommentVNode)(``,!0)],42,tn)):(0,t.createCommentVNode)(``,!0)]),h.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,nn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,rn,[e.fileName?((0,t.openBlock)(),(0,t.createElementBlock)(`strong`,an,(0,t.toDisplayString)(e.fileName)+`:`,1)):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.message),1)])]))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,{id:(0,t.unref)(l),ref_key:`fileInputRef`,ref:u,type:`file`,multiple:e.multiple,accept:e.accept,disabled:e.disabled||e.loading,class:`hidden`,onChange:T},null,40,on),(0,t.renderSlot)(r.$slots,`file-list`,{files:k.value,remove:E},()=>[k.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,sn,[(0,t.createVNode)(t.TransitionGroup,{"enter-active-class":`transition-all duration-300 ease-out`,"enter-from-class":`opacity-0 translate-y-2`,"enter-to-class":`opacity-100 translate-y-0`,"leave-active-class":`transition-all duration-200 ease-in`,"leave-from-class":`opacity-100 scale-100`,"leave-to-class":`opacity-0 scale-95`,"move-class":`transition-transform duration-300`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(k.value,i=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:i.id,class:`group relative flex items-center gap-4 rounded-xl border border-main/30 bg-surface/50 p-3 shadow-sm transition-all duration-200 hover:border-main/60 hover:bg-surface hover:shadow`},[(0,t.createElementVNode)(`div`,cn,[(0,t.renderSlot)(r.$slots,`preview`,{item:i},()=>[i.isImage&&i.previewUrl?((0,t.openBlock)(),(0,t.createBlock)(zt,{key:0,src:i.previewUrl,alt:i.file.name,shape:`rounded`,class:`h-full w-full border border-main/20 object-cover shadow-sm`},null,8,[`src`,`alt`])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ln,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:file`,class:`mb-2 h-4 w-4 opacity-60`}),(0,t.createElementVNode)(`div`,un,[(0,t.createElementVNode)(`span`,dn,(0,t.toDisplayString)(i.extension),1)])]))]),i.status===`success`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fn,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:check-circle-2`,class:`h-3.5 w-3.5 text-success`})])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,pn,[(0,t.createElementVNode)(`div`,mn,[(0,t.createElementVNode)(`span`,{class:`truncate text-sm leading-none font-semibold text-main`,title:i.file.name},(0,t.toDisplayString)(i.file.name),9,hn),(0,t.createElementVNode)(`span`,gn,(0,t.toDisplayString)(O(i.file.size)),1)]),e.isShowProgressBar?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_n,[i.status===`uploading`||i.status===`pending`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vn,[(0,t.createVNode)(qt,{"model-value":i.progress,size:`xs`,variant:`primary`,animated:i.status===`uploading`,class:`flex-1`},null,8,[`model-value`,`animated`]),(0,t.createElementVNode)(`span`,yn,(0,t.toDisplayString)(Math.round(i.progress))+`%`,1)])):i.status===`success`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bn,` Ready `)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:trash-2`,variant:`text`,severity:`secondary`,size:`sm`,class:`shrink-0 opacity-40 transition-all group-hover:opacity-100 hover:!bg-danger/10 hover:!text-danger`,title:`Remove file`,onClick:e=>E(i.id)},null,8,[`onClick`])]))),128))]),_:3})])):(0,t.createCommentVNode)(``,!0)])],8,Jt))}}),Sn=[`for`],Cn={key:0,class:`text-danger`},wn={class:`relative flex w-full min-w-0 flex-1 flex-col gap-1.5`},Tn={key:0,class:`custom-scrollbar flex w-full shrink-0 flex-row items-center gap-1.5 overflow-x-auto border-b border-main/30 bg-surface/10 p-2`},En=[`onClick`],Dn={class:`flex w-full flex-col p-3 md:p-4`},On={key:0,class:`mb-3 flex w-full flex-row items-center gap-2 border-b border-main/30 pb-3 sm:mb-4 sm:gap-3 sm:pb-4`},kn={class:`flex w-full flex-col items-center gap-6 md:flex-row md:items-start`},An={class:`mb-4 flex w-full items-center justify-between`},jn={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},Mn={class:`mb-2 grid w-full grid-cols-7`},Nn={class:`grid w-full grid-cols-7 gap-y-1`},Pn=[`disabled`,`onMouseenter`,`onClick`],Fn={key:1,class:`grid w-full grid-cols-3 gap-2`},In=[`onClick`],Ln={key:2,class:`grid w-full grid-cols-3 gap-2`},Rn=[`onClick`],zn={class:`mb-4 flex w-full items-center justify-between`},Bn={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},Vn={class:`mb-2 grid w-full grid-cols-7`},Hn={class:`grid w-full grid-cols-7 gap-y-1`},Un=[`disabled`,`onMouseenter`,`onClick`],Wn={key:1,class:`grid w-full grid-cols-3 gap-2`},Gn=[`onClick`],Kn={key:2,class:`grid w-full grid-cols-3 gap-2`},qn=[`onClick`],Jn={key:1,class:`mt-3 flex w-full items-center justify-between border-t border-main/30 px-1 pt-3`},Yn={class:`flex items-center gap-1.5 text-muted`},Xn={class:`flex items-center gap-2`},Zn={key:2,class:`mt-3 flex w-full items-center justify-end gap-2 border-t border-main/30 pt-3 sm:mt-4 sm:pt-4`},Qn={key:0,class:`custom-scrollbar flex w-full shrink-0 flex-row items-center gap-1.5 overflow-x-auto border-b border-main/30 bg-surface/10 p-2 sm:p-3`},$n=[`onClick`],er={class:`flex w-max min-w-full flex-col p-3 md:p-4`},tr={key:0,class:`mb-3 flex w-full flex-row items-center gap-2 border-b border-main/30 pb-3 sm:mb-4 sm:gap-3 sm:pb-4`},nr={class:`flex w-full flex-col items-center gap-6 md:flex-row md:items-start`},rr={class:`mb-4 flex w-full items-center justify-between`},ir={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},ar={class:`mb-2 grid w-full grid-cols-7`},or={class:`grid w-full grid-cols-7 gap-y-1`},sr=[`disabled`,`onMouseenter`,`onClick`],cr={key:1,class:`grid w-full grid-cols-3 gap-2`},lr=[`onClick`],ur={key:2,class:`grid w-full grid-cols-3 gap-2`},dr=[`onClick`],fr={class:`mb-4 flex w-full items-center justify-between`},pr={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},mr={class:`mb-2 grid w-full grid-cols-7`},hr={class:`grid w-full grid-cols-7 gap-y-1`},gr=[`disabled`,`onMouseenter`,`onClick`],_r={key:1,class:`grid w-full grid-cols-3 gap-2`},vr=[`onClick`],yr={key:2,class:`grid w-full grid-cols-3 gap-2`},br=[`onClick`],xr={key:1,class:`mt-3 flex w-full items-center justify-between border-t border-main/30 px-1 pt-3`},Sr={class:`flex items-center gap-1.5 text-muted`},Cr={class:`flex items-center gap-2`},wr={key:2,class:`mt-3 flex w-full items-center justify-end gap-2 border-t border-main/30 pt-3 sm:mt-4 sm:pt-4`},Tr={key:2,class:`mt-0.5 flex flex-col gap-1`},Er={class:`min-w-0`},Dr=(0,t.defineComponent)({inheritAttrs:!1,__name:`DatePicker`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},mode:{default:`single`},pickerType:{default:`date`},inline:{type:Boolean,default:!1},enableTime:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},autoApply:{type:Boolean,default:!0},showPresets:{type:Boolean,default:!1},presetRanges:{},displayFormat:{default:`MM/dd/yyyy`},modelFormat:{default:`Date`},rangeKeys:{default:()=>({start:`start`,end:`end`})},minDate:{},maxDate:{},showClear:{type:Boolean,default:!0}},{modelValue:{default:null},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`change`,`clear`,`apply`,`cancel`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,o=r,s=(0,t.useModel)(e,`modelValue`),l=i.id||`datepicker-${(0,t.useId)()}`,u=(0,t.ref)(!1),d=(0,t.ref)(``),f=(0,t.ref)(!1),p=(0,t.ref)(i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`),m=(0,t.ref)(i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`),h=(0,t.ref)(new Date),g=(0,t.ref)((0,a.addMonths)(new Date,1)),_=(0,t.ref)(null),v=(0,t.ref)({start:null,end:null}),y=(0,t.ref)(null),b=(0,t.ref)(`start`),x=(0,t.computed)(()=>{if(!i.displayFormat||/(MMM|MMMM|EEE|EEEE)/.test(i.displayFormat))return``;let e=i.displayFormat.replace(/[MdyHms]/g,`#`);return i.mode===`range`?`${e} - ${e}`:e}),C=(0,t.computed)(()=>{if(i.presetRanges)return i.presetRanges;let e=(0,a.startOfDay)(new Date);return[{label:`Today`,range:[e,e]},{label:`Yesterday`,range:[(0,a.subDays)(e,1),(0,a.subDays)(e,1)]},{label:`Last 7 Days`,range:[(0,a.subDays)(e,6),e]},{label:`This Month`,range:[(0,a.startOfMonth)(e),(0,a.endOfMonth)(e)]},{label:`Last Month`,range:[(0,a.startOfMonth)((0,a.subMonths)(e,1)),(0,a.endOfMonth)((0,a.subMonths)(e,1))]}]}),w=e=>i.mode!==`range`||!v.value.start||!v.value.end?!1:(0,a.isSameDay)(v.value.start,e[0])&&(0,a.isSameDay)(v.value.end,e[1]),T=e=>{f.value=!1,v.value.start=e[0],v.value.end=e[1],(0,a.isSameMonth)(e[0],e[1])?(h.value=(0,a.subMonths)(e[0],1),g.value=e[0]):(h.value=e[0],g.value=e[1]),i.autoApply?(N(!0),i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)):(f.value=!1,k())},E=e=>{if(!e)return null;if(e instanceof Date)return(0,a.isValid)(e)?e:null;if(typeof e==`number`)return new Date(e);if(typeof e==`string`){if(i.modelFormat===`ISO`)return new Date(e);let t=(0,a.parse)(e,i.modelFormat===`Date`||i.modelFormat===`timestamp`?`yyyy-MM-dd`:i.modelFormat,new Date);return(0,a.isValid)(t)?t:new Date(e)}return null},D=e=>e?i.modelFormat===`Date`?new Date(e):i.modelFormat===`ISO`?e.toISOString():i.modelFormat===`timestamp`?e.getTime():(0,a.format)(e,i.modelFormat):null,O=()=>{if(i.mode===`single`)_.value=E(s.value),_.value&&(h.value=new Date(_.value));else{let e=s.value?.[i.rangeKeys.start],t=s.value?.[i.rangeKeys.end];v.value.start=E(e),v.value.end=E(t),v.value.start&&(h.value=new Date(v.value.start)),v.value.end&&!(0,a.isSameMonth)(v.value.start||new Date,v.value.end)?g.value=new Date(v.value.end):g.value=(0,a.addMonths)(h.value,1)}k()},k=()=>{if(!f.value)if(i.mode===`single`)d.value=_.value?(0,a.format)(_.value,i.displayFormat):``;else{let e=v.value.start?(0,a.format)(v.value.start,i.displayFormat):``,t=v.value.end?(0,a.format)(v.value.end,i.displayFormat):``;d.value=e&&t?`${e} - ${t}`:e?`${e} - `:``}};(0,t.watch)(()=>s.value,O,{immediate:!0,deep:!0}),(0,t.watch)(u,e=>{if(e&&!i.inline){let e=i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`;p.value=e,m.value=e,b.value=`start`,O()}else !e&&!i.inline&&(f.value=!1,i.autoApply?k():O())});let A=null,j=()=>{f.value=!0,A&&clearTimeout(A),A=setTimeout(()=>{let e=d.value.trim();if(!e||e===`-`||e.includes(`_`)||e.includes(`#`)){e===``&&P(!1);return}if(i.mode===`single`){let t=(0,a.parse)(e,i.displayFormat,new Date);(0,a.isValid)(t)&&(0,a.getYear)(t)>1e3&&!L(t)&&(ye(t,!1,!1,!1),h.value=t)}else{let t=e.split(` - `);if(t.length===2){let e=(0,a.parse)(t[0].trim(),i.displayFormat,new Date),n=(0,a.parse)(t[1].trim(),i.displayFormat,new Date),r=!1;if((0,a.isValid)(e)&&(0,a.getYear)(e)>1e3&&!L(e)&&(v.value.start=e,h.value=e,r=!0),(0,a.isValid)(n)&&(0,a.getYear)(n)>1e3&&!L(n)&&(v.value.end=n,g.value=n,r=!0),r){if(v.value.start&&v.value.end&&(0,a.isBefore)(v.value.end,v.value.start)){let e=v.value.start;v.value.start=v.value.end,v.value.end=e}i.autoApply&&N(!1)}}}},150)},M=e=>{f.value=!1,k(),o(`blur`,e)},N=(e=!0)=>{let t={[i.rangeKeys.start]:D(v.value.start),[i.rangeKeys.end]:D(v.value.end)};s.value=t,o(`change`,t),e&&(f.value=!1,k())},P=(e=!0)=>{i.disabled||(s.value=i.mode===`range`?{[i.rangeKeys.start]:null,[i.rangeKeys.end]:null}:null,_.value=null,v.value={start:null,end:null},o(`clear`),o(`change`,s.value),b.value=`start`,e&&(f.value=!1,d.value=``))},F=()=>{v.value.start=null,b.value=`start`,i.autoApply?N(!0):k()},ee=()=>{v.value.end=null,b.value=`end`,i.autoApply?N(!0):k()},I=()=>{if(i.mode===`single`){let e=D(_.value);s.value=e,o(`change`,e),o(`apply`,e)}else{let e={[i.rangeKeys.start]:D(v.value.start),[i.rangeKeys.end]:D(v.value.end)};s.value=e,o(`change`,e),o(`apply`,e)}f.value=!1,k(),i.inline||(u.value=!1)},te=()=>{O(),o(`cancel`),i.inline||(u.value=!1)},ne=(0,t.computed)(()=>i.minDate?(0,a.startOfDay)(E(i.minDate)):null),re=(0,t.computed)(()=>i.maxDate?(0,a.startOfDay)(E(i.maxDate)):null),L=e=>{let t=(0,a.startOfDay)(e);return!!(ne.value&&(0,a.isBefore)(t,ne.value)||re.value&&(0,a.isAfter)(t,re.value))},R=Array.from({length:7}).map((e,t)=>(0,a.format)((0,a.addMonths)((0,a.startOfWeek)(new Date),0).setDate((0,a.startOfWeek)(new Date).getDate()+t),`EE`)),z=Array.from({length:12}).map((e,t)=>(0,a.format)((0,a.setMonth)(new Date,t),`MMM`)),ie=e=>(0,a.eachDayOfInterval)({start:(0,a.startOfWeek)((0,a.startOfMonth)(e)),end:(0,a.endOfWeek)((0,a.endOfMonth)(e))}),ae=(0,t.computed)(()=>ie(h.value)),oe=(0,t.computed)(()=>ie(g.value)),se=(0,t.computed)(()=>Math.floor((0,a.getYear)(h.value)/10)*10),ce=(0,t.computed)(()=>Math.floor((0,a.getYear)(g.value)/10)*10),le=(0,t.computed)(()=>Array.from({length:12}).map((e,t)=>se.value-1+t)),ue=(0,t.computed)(()=>Array.from({length:12}).map((e,t)=>ce.value-1+t)),de=()=>{p.value===`days`?h.value=(0,a.addMonths)(h.value,1):p.value===`years`?h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)+10):h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)+1)},me=()=>{p.value===`days`?h.value=(0,a.subMonths)(h.value,1):p.value===`years`?h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)-10):h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)-1)},he=()=>{i.pickerType===`date`&&(p.value===`days`?p.value=`months`:p.value===`months`&&(p.value=`years`))},ge=()=>{m.value===`days`?g.value=(0,a.addMonths)(g.value,1):m.value===`years`?g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)+10):g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)+1)},_e=()=>{m.value===`days`?g.value=(0,a.subMonths)(g.value,1):m.value===`years`?g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)-10):g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)-1)},ve=()=>{i.pickerType===`date`&&(m.value===`days`?m.value=`months`:m.value===`months`&&(m.value=`years`))},ye=(e,t=!0,n=!0,r=!0)=>{if(L(e))return;let c=new Date(e);if(r&&i.enableTime&&i.mode===`single`&&_.value&&(c=(0,a.setHours)(c,(0,a.getHours)(_.value)),c=(0,a.setMinutes)(c,(0,a.getMinutes)(_.value))),i.mode===`single`){if(_.value=c,i.autoApply){let e=D(c);s.value=e,o(`change`,e)}n&&(f.value=!1,k()),i.autoApply&&t&&i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)}else b.value===`start`?(v.value.start=c,v.value.end&&(0,a.isAfter)(c,v.value.end)&&(v.value.end=null),b.value=`end`):v.value.start&&(0,a.isBefore)(c,v.value.start)?(v.value.start=c,b.value=`end`):(v.value.end=c,b.value=`start`),i.autoApply?(N(n),t&&v.value.start&&v.value.end&&i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)):n&&(f.value=!1,k())},be=e=>{h.value=(0,a.setMonth)(h.value,e),i.pickerType===`month`?ye(h.value):p.value=`days`},xe=e=>{h.value=(0,a.setYear)(h.value,e),i.pickerType===`year`?ye(h.value):p.value=i.pickerType===`month`?`months`:`days`},Se=e=>{g.value=(0,a.setMonth)(g.value,e),i.pickerType===`month`?ye(g.value):m.value=`days`},Ce=e=>{g.value=(0,a.setYear)(g.value,e),i.pickerType===`year`?ye(g.value):m.value=i.pickerType===`month`?`months`:`days`},we=(e,t)=>{let n=(0,a.setMonth)(t,e);return i.mode===`single`&&_.value?(0,a.isSameMonth)(n,_.value):i.mode===`range`?v.value.start&&(0,a.isSameMonth)(n,v.value.start)||v.value.end&&(0,a.isSameMonth)(n,v.value.end):!1},Te=e=>i.mode===`single`&&_.value?(0,a.getYear)(_.value)===e:i.mode===`range`?v.value.start&&(0,a.getYear)(v.value.start)===e||v.value.end&&(0,a.getYear)(v.value.end)===e:!1,Ee=e=>i.mode===`range`&&v.value.start&&(0,a.isSameDay)(e,v.value.start),De=e=>i.mode===`range`&&v.value.end&&(0,a.isSameDay)(e,v.value.end),Oe=e=>i.mode===`single`&&_.value&&(0,a.isSameDay)(e,_.value),ke=e=>{if(i.mode!==`range`)return!1;let t=v.value.start,n=v.value.end;if(t&&n)return(0,a.isWithinInterval)(e,{start:t,end:n})&&!(0,a.isSameDay)(e,t)&&!(0,a.isSameDay)(e,n);if(t&&!n&&y.value&&b.value===`end`){let n=(0,a.isBefore)(t,y.value)?t:y.value,r=(0,a.isBefore)(t,y.value)?y.value:t;return(0,a.isWithinInterval)(e,{start:n,end:r})&&!(0,a.isSameDay)(e,n)&&!(0,a.isSameDay)(e,r)}if(!t&&n&&y.value&&b.value===`start`){let t=(0,a.isBefore)(y.value,n)?y.value:n,r=(0,a.isBefore)(y.value,n)?n:y.value;return(0,a.isWithinInterval)(e,{start:t,end:r})&&!(0,a.isSameDay)(e,t)&&!(0,a.isSameDay)(e,r)}return!1},Ae=(e,t)=>e.map(e=>{let n=L(e),r=!!Oe(e),i=!!Ee(e),o=!!De(e);return{date:e,key:e.toISOString(),label:(0,a.format)(e,`d`),sameMonth:(0,a.isSameMonth)(e,t),disabled:n,inRange:ke(e),rangeStartGradient:i&&!!(v.value.end||y.value),rangeEndGradient:o&&!!v.value.start,today:(0,a.isToday)(e)&&!r&&!i&&!o,edgeSelected:r||i||o}}),je=(0,t.computed)(()=>Ae(ae.value,h.value)),Me=(0,t.computed)(()=>Ae(oe.value,g.value)),Ne=(0,t.computed)({get:()=>_.value?(0,a.getHours)(_.value):0,set:e=>{f.value=!1;let t=Math.max(0,Math.min(23,Number(e)));_.value?ye((0,a.setHours)(_.value,t),!1,!0,!1):ye((0,a.setHours)(new Date,t),!1,!0,!1)}}),Pe=(0,t.computed)({get:()=>_.value?(0,a.getMinutes)(_.value):0,set:e=>{f.value=!1;let t=Math.max(0,Math.min(59,Number(e)));_.value?ye((0,a.setMinutes)(_.value,t),!1,!0,!1):ye((0,a.setMinutes)(new Date,t),!1,!0,!1)}}),Fe=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),Ie=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),Le=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(l),class:(0,t.normalizeClass)([`flex shrink-0 cursor-pointer items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${Fe.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Cn,`*`)):(0,t.createCommentVNode)(``,!0)],10,Sn)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,wn,[e.inline?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`flex w-full flex-col overflow-x-auto overflow-y-hidden rounded-md border border-main bg-content shadow-sm select-none`,onClick:i[23]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.mode===`range`&&e.showPresets?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qn,[i[29]||=(0,t.createElementVNode)(`span`,{class:`hidden shrink-0 px-2 text-[10px] font-bold tracking-wider text-muted uppercase sm:inline`},`Presets`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.label,onClick:(0,t.withModifiers)(t=>T(e.range),[`stop`]),class:(0,t.normalizeClass)([`shrink-0 cursor-pointer rounded px-3 py-1.5 text-xs whitespace-nowrap transition-colors`,w(e.range)?`bg-primary/10 font-bold text-primary`:`font-medium text-main hover:bg-primary/10 hover:text-primary`])},(0,t.toDisplayString)(e.label),11,$n))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,er,[e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,tr,[(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[15]||=e=>b.value=`start`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`start`?`text-primary`:`text-muted`])},`Start Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`start`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.start?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.start?(0,t.unref)(a.format)(v.value.start,e.displayFormat):`Start...`),3),v.value.start?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(F,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:arrow-right`,class:`mt-4 h-4 w-4 shrink-0 text-muted`}),(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[16]||=e=>b.value=`end`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`end`?`text-primary`:`text-muted`])},`End Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`end`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.end?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.end?(0,t.unref)(a.format)(v.value.end,e.displayFormat):`End...`),3),v.value.end?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(ee,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,nr,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([e.mode===`range`?`w-full md:min-w-0 md:flex-1`:`w-full min-w-[260px]`,e.mode===`range`&&b.value===`end`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,rr,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:me}),(0,t.createElementVNode)(`div`,ir,[p.value===`days`||p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:he},[p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[17]||=e=>p.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:de})]),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[18]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,ar,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,or,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(je.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[n.inRange?`bg-primary/10`:``,n.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,n.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:n.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[n.sameMonth?`text-main`:`text-muted/40`,n.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,n.today?`border border-primary text-primary`:``,n.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>e.mode===`range`?y.value=n.date:null,onClick:(0,t.withModifiers)(e=>ye(n.date),[`stop`])},(0,t.toDisplayString)(n.label),43,sr)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,cr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,h.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>be(n),[`stop`])},(0,t.toDisplayString)(e),11,lr))),128))])):(0,t.createCommentVNode)(``,!0),p.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ur,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(le.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===se.value-1||e===se.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>xe(e),[`stop`])},(0,t.toDisplayString)(e),11,dr))),128))])):(0,t.createCommentVNode)(``,!0)],2),e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`w-full min-w-0 border-main/30 md:flex-1 md:border-l md:pl-6`,b.value===`start`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,fr,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:_e}),(0,t.createElementVNode)(`div`,pr,[(0,t.createElementVNode)(`span`,{class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:ve},[m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),m.value===`months`||m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[19]||=e=>m.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:ge})]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[20]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,mr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,hr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Me.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[e.inRange?`bg-primary/10`:``,e.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,e.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:e.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[e.sameMonth?`text-main`:`text-muted/40`,e.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,e.today?`border border-primary text-primary`:``,e.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>y.value=e.date,onClick:(0,t.withModifiers)(t=>ye(e.date),[`stop`])},(0,t.toDisplayString)(e.label),43,gr)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),m.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_r,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,g.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>Se(n),[`stop`])},(0,t.toDisplayString)(e),11,vr))),128))])):(0,t.createCommentVNode)(``,!0),m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,yr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ue.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===ce.value-1||e===ce.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>Ce(e),[`stop`])},(0,t.toDisplayString)(e),11,br))),128))])):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)]),e.enableTime&&e.mode===`single`&&e.pickerType===`date`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,xr,[(0,t.createElementVNode)(`div`,Sr,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:clock`,class:`h-4 w-4 text-primary`}),i[30]||=(0,t.createElementVNode)(`span`,{class:`mt-0.5 text-[10px] font-bold tracking-wider uppercase`},`Time`,-1)]),(0,t.createElementVNode)(`div`,Cr,[(0,t.createVNode)(S,{modelValue:Ne.value,"onUpdate:modelValue":i[21]||=e=>Ne.value=e,min:0,max:23,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`]),i[31]||=(0,t.createElementVNode)(`span`,{class:`pb-0.5 font-bold text-main`},`:`,-1),(0,t.createVNode)(S,{modelValue:Pe.value,"onUpdate:modelValue":i[22]||=e=>Pe.value=e,min:0,max:59,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`])])])):(0,t.createCommentVNode)(``,!0),e.autoApply?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wr,[(0,t.createVNode)(c,{variant:`outline`,severity:`secondary`,size:`sm`,onClick:(0,t.withModifiers)(te,[`stop`])},{default:(0,t.withCtx)(()=>[...i[32]||=[(0,t.createTextVNode)(`Cancel`,-1)]]),_:1}),(0,t.createVNode)(c,{variant:`solid`,severity:`primary`,size:`sm`,onClick:(0,t.withModifiers)(I,[`stop`])},{default:(0,t.withCtx)(()=>[...i[33]||=[(0,t.createTextVNode)(`Apply`,-1)]]),_:1})]))])])):((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,modelValue:u.value,"onUpdate:modelValue":i[14]||=e=>u.value=e,placement:`bottom-start`,matchWidth:!1,widthClass:`w-max max-w-[95vw]`,disabled:e.disabled,triggerClass:`w-full`},{trigger:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`group relative w-full`,onClick:i[4]||=(0,t.withModifiers)(t=>e.disabled?null:u.value=!0,[`stop`,`prevent`])},[(0,t.createVNode)(fe,(0,t.mergeProps)({id:(0,t.unref)(l),disabled:e.disabled,placeholder:e.placeholder||(e.mode===`range`?`${e.displayFormat} - ${e.displayFormat}`:e.displayFormat),size:e.size,error:!!e.error,mask:x.value,iconEnd:`lucide:calendar`,modelValue:d.value,"onUpdate:modelValue":i[0]||=e=>d.value=e,onMaska:j,onKeydown:(0,t.withKeys)((0,t.withModifiers)(j,[`prevent`]),[`enter`]),onFocus:i[1]||=e=>{u.value=!0,o(`focus`,e)},onBlur:M},r.$attrs),null,16,[`id`,`disabled`,`placeholder`,`size`,`error`,`mask`,`modelValue`,`onKeydown`]),e.showClear&&(_.value||v.value.start||v.value.end)&&!e.disabled?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`absolute top-0 bottom-0 z-10 flex items-center justify-center bg-transparent px-1.5`,[{xs:`right-6`,sm:`right-7`,md:`right-9`,lg:`right-11`,xl:`right-13`}[e.size]]]),onMousedown:i[2]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`]),onClick:i[3]||=(0,t.withModifiers)(e=>P(!0),[`stop`,`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:(0,t.normalizeClass)([`cursor-pointer rounded-full bg-content p-0.5 text-muted opacity-0 transition-colors group-hover:opacity-100 hover:text-danger`,Ie.value])},null,8,[`class`])],34)):(0,t.createCommentVNode)(``,!0)])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex w-max max-w-[95vw] flex-col overflow-hidden rounded-md border border-main bg-content shadow-xl select-none`,onClick:i[13]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.mode===`range`&&e.showPresets?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tn,[i[24]||=(0,t.createElementVNode)(`span`,{class:`hidden shrink-0 px-2 text-[10px] font-bold tracking-wider text-muted uppercase sm:inline`},`Presets`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.label,onClick:(0,t.withModifiers)(t=>T(e.range),[`stop`]),class:(0,t.normalizeClass)([`shrink-0 cursor-pointer rounded px-3 py-1.5 text-xs whitespace-nowrap transition-colors`,w(e.range)?`bg-primary/10 font-bold text-primary`:`font-medium text-main hover:bg-primary/10 hover:text-primary`])},(0,t.toDisplayString)(e.label),11,En))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Dn,[e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,On,[(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[5]||=e=>b.value=`start`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`start`?`text-primary`:`text-muted`])},`Start Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`start`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.start?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.start?(0,t.unref)(a.format)(v.value.start,e.displayFormat):`Select start...`),3),v.value.start?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(F,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:arrow-right`,class:`mt-4 h-4 w-4 shrink-0 text-muted`}),(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[6]||=e=>b.value=`end`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`end`?`text-primary`:`text-muted`])},`End Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`end`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.end?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.end?(0,t.unref)(a.format)(v.value.end,e.displayFormat):`Select end...`),3),v.value.end?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(ee,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,kn,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`w-full`,e.mode===`range`?`md:min-w-0 md:flex-1`:`shrink-0 md:w-[260px]`,e.mode===`range`&&b.value===`end`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,An,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:me}),(0,t.createElementVNode)(`div`,jn,[p.value===`days`||p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:he},[p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[7]||=e=>p.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:de})]),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[8]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,Mn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,Nn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(je.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[n.inRange?`bg-primary/10`:``,n.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,n.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:n.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[n.sameMonth?`text-main`:`text-muted/40`,n.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,n.today?`border border-primary text-primary`:``,n.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>e.mode===`range`?y.value=n.date:null,onClick:(0,t.withModifiers)(e=>ye(n.date),[`stop`])},(0,t.toDisplayString)(n.label),43,Pn)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,h.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>be(n),[`stop`])},(0,t.toDisplayString)(e),11,In))),128))])):(0,t.createCommentVNode)(``,!0),p.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ln,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(le.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===se.value-1||e===se.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>xe(e),[`stop`])},(0,t.toDisplayString)(e),11,Rn))),128))])):(0,t.createCommentVNode)(``,!0)],2),e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`w-full min-w-0 border-main/30 md:flex-1 md:border-l md:pl-6`,b.value===`start`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,zn,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:_e}),(0,t.createElementVNode)(`div`,Bn,[(0,t.createElementVNode)(`span`,{class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:ve},[m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),m.value===`months`||m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[9]||=e=>m.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:ge})]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[10]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,Vn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,Hn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Me.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[e.inRange?`bg-primary/10`:``,e.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,e.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:e.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[e.sameMonth?`text-main`:`text-muted/40`,e.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,e.today?`border border-primary text-primary`:``,e.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>y.value=e.date,onClick:(0,t.withModifiers)(t=>ye(e.date),[`stop`])},(0,t.toDisplayString)(e.label),43,Un)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),m.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Wn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,g.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>Se(n),[`stop`])},(0,t.toDisplayString)(e),11,Gn))),128))])):(0,t.createCommentVNode)(``,!0),m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Kn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ue.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===ce.value-1||e===ce.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>Ce(e),[`stop`])},(0,t.toDisplayString)(e),11,qn))),128))])):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)]),e.enableTime&&e.mode===`single`&&e.pickerType===`date`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Jn,[(0,t.createElementVNode)(`div`,Yn,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:clock`,class:`h-4 w-4`}),i[25]||=(0,t.createElementVNode)(`span`,{class:`mt-0.5 text-[10px] font-bold tracking-wider uppercase`},`Time`,-1)]),(0,t.createElementVNode)(`div`,Xn,[(0,t.createVNode)(S,{modelValue:Ne.value,"onUpdate:modelValue":i[11]||=e=>Ne.value=e,min:0,max:23,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`]),i[26]||=(0,t.createElementVNode)(`span`,{class:`pb-0.5 font-bold text-main/50`},`:`,-1),(0,t.createVNode)(S,{modelValue:Pe.value,"onUpdate:modelValue":i[12]||=e=>Pe.value=e,min:0,max:59,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`])])])):(0,t.createCommentVNode)(``,!0),e.autoApply?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Zn,[(0,t.createVNode)(c,{variant:`outline`,severity:`secondary`,size:`sm`,onClick:(0,t.withModifiers)(te,[`stop`])},{default:(0,t.withCtx)(()=>[...i[27]||=[(0,t.createTextVNode)(`Cancel`,-1)]]),_:1}),(0,t.createVNode)(c,{variant:`solid`,severity:`primary`,size:`sm`,onClick:(0,t.withModifiers)(I,[`stop`])},{default:(0,t.withCtx)(()=>[...i[28]||=[(0,t.createTextVNode)(`Apply`,-1)]]),_:1})]))])])]),_:1},8,[`modelValue`,`disabled`])),Le.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Le.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,Er,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}});function Or(e){this.content=e}Or.prototype={constructor:Or,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Or(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Or(n)},addToStart:function(e,t){return new Or([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Or(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Or(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Or.from(e),e.size?new Or(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Or.from(e),e.size?new Or(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Or.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Or.from=function(e){if(e instanceof Or)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Or(t)};function kr(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Mr(e.charCodeAt(r-1))&&jr(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=kr(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ar(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Mr(e.charCodeAt(i-1))&&jr(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ar(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function jr(e){return e>=56320&&e<57344}function Mr(e){return e>=55296&&e<56320}var B=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return kr(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ar(this,e,t,n)}findIndex(e){if(e==0)return Pr(0,e);if(e==this.size)return Pr(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Pr(t+1,i):Pr(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};B.empty=new B([],0);var Nr={index:0,offset:0};function Pr(e,t){return Nr.index=e,Nr.offset=t,Nr}function Fr(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Fr(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Fr(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var V=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};V.none=[];var Ir=class extends Error{},H=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Rr(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Lr(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(B.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};H.empty=new H(B.empty,0,0);function Lr(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Lr(a.content,t-i-1,n-i-1)))}function Rr(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Rr(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function zr(e,t,n){if(n.openStart>e.depth)throw new Ir(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ir(`Inconsistent open depths`);return Br(e,t,n,0)}function Br(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Br(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Gr(a,qr(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Gr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Jr(n,e);return Gr(a,Kr(e,i,o,t,r))}}function Vr(e,t){if(!t.type.compatibleContent(e.type))throw new Ir(`Cannot join `+t.type.name+` onto `+e.type.name)}function Hr(e,t,n){let r=e.node(n);return Vr(r,t.node(n)),r}function Ur(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Wr(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ur(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ur(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ur(t.nodeBefore,r)}function Gr(e,t){if(!e.type.validContent(t))throw new Ir(`Invalid content for node `+e.type.name);return e.copy(t)}function Kr(e,t,n,r,i){let a=e.depth>i&&Hr(e,t,i+1),o=r.depth>i&&Hr(n,r,i+1),s=[];return Wr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Vr(a,o),Ur(Gr(a,Kr(e,t,n,r,i+1)),s)):(a&&Ur(Gr(a,qr(e,t,i+1)),s),Wr(t,n,i,s),o&&Ur(Gr(o,qr(n,r,i+1)),s)),Wr(r,null,i,s),new B(s)}function qr(e,t,n){let r=[];return Wr(null,e,n,r),e.depth>n&&Ur(Gr(Hr(e,t,n+1),qr(e,t,n+1)),r),Wr(t,null,n,r),new B(r)}function Jr(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(B.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Yr=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return V.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new $r(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Qr.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Qr.set(t,r=new Xr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Zr,i}},Xr=class{constructor(){this.elts=[],this.i=0}},Zr=12,Qr=new WeakMap,$r=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ei=Object.create(null),ti=class e{constructor(e,t,n,r=V.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||B.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Fr(this.attrs,t||e.defaultAttrs||ei)&&V.sameSet(this.marks,n||V.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return H.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new H(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return zr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Yr.resolveCached(this,e)}resolveNoCache(e){return Yr.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),ri(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=B.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=V.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!V.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=B.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ti.prototype.text=void 0;var ni=class e extends ti{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ri(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function ri(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ii=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ai(t,n);if(r.next==null)return e.empty;let i=oi(r);r.next&&r.err(`Unexpected trailing text`);let a=gi(pi(i));return _i(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return B.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
|
-
`)}};ii.empty=new ii(!0);var ai=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function oi(e){let t=[];do t.push(si(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function si(e){let t=[];do t.push(ci(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ci(e){let t=fi(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ui(e,t);else break;return t}function li(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ui(e,t){let n=li(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:li(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function di(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function fi(e){if(e.eat(`(`)){let t=oi(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=di(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pi(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mi(e,t){return t-e}function hi(e,t){let n=[];return r(t),n.sort(mi);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gi(e){let t=Object.create(null);return n(hi(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);hi(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ii(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mi);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _i(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function vi(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function yi(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function bi(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function xi(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new wi(e,r,t[r]);return n}var Si=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=xi(e,n.attrs),this.defaultAttrs=vi(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ii.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:yi(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new ti(this,this.computeAttrs(e),B.from(t),V.setFrom(n))}createChecked(e=null,t,n){return t=B.from(t),this.checkContent(t),new ti(this,this.computeAttrs(e),t,V.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=B.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(B.empty,!0);return i?new ti(this,e,t.append(i),V.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bi(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:V.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ci(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var wi=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ci(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ti=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=xi(e,r.attrs),this.excluded=null;let i=vi(this.attrs);this.instance=i?new V(this,i):null}create(e=null){return!e&&this.instance?this.instance:new V(this,yi(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){bi(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ei=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Or.from(e.nodes),t.marks=Or.from(e.marks||{}),this.nodes=Si.compile(this.spec.nodes,this),this.marks=Ti.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ii.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Di(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Di(this,n.split(` `))}this.nodeFromJSON=e=>ti.fromJSON(this,e),this.markFromJSON=e=>V.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Si))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ni(n,n.defaultAttrs,e,V.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Di(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Oi(e){return e.tag!=null}function ki(e){return e.style!=null}var Ai=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Oi(e))this.tags.push(e);else if(ki(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new zi(this,t,!1);return n.addAll(e,V.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new zi(this,t,!0);return n.addAll(e,V.none,t.from,t.to),H.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Vi(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ji={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Mi={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ni={ol:!0,ul:!0},Pi=1,Fi=2,Ii=4;function Li(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Pi:0)|(t===`full`?Fi:0)}var Ri=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=V.none,this.match=i||(a&Ii?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(B.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pi)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=B.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(B.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ji.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},zi=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Li(null,t.preserveWhitespace,0)|(n?Ii:0);i=r?new Ri(r.type,r.attrs,V.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ri(null,null,V.none,!0,null,a):new Ri(e.schema.topNodeType,null,V.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Fi?`full`:this.localPreserveWS||(r.options&Pi)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
2
|
+
`)}};ii.empty=new ii(!0);var ai=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function oi(e){let t=[];do t.push(si(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function si(e){let t=[];do t.push(ci(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ci(e){let t=fi(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ui(e,t);else break;return t}function li(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ui(e,t){let n=li(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:li(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function di(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function fi(e){if(e.eat(`(`)){let t=oi(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=di(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pi(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mi(e,t){return t-e}function hi(e,t){let n=[];return r(t),n.sort(mi);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gi(e){let t=Object.create(null);return n(hi(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);hi(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ii(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mi);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _i(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function vi(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function yi(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function bi(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function xi(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new wi(e,r,t[r]);return n}var Si=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=xi(e,n.attrs),this.defaultAttrs=vi(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ii.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:yi(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new ti(this,this.computeAttrs(e),B.from(t),V.setFrom(n))}createChecked(e=null,t,n){return t=B.from(t),this.checkContent(t),new ti(this,this.computeAttrs(e),t,V.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=B.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(B.empty,!0);return i?new ti(this,e,t.append(i),V.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bi(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:V.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ci(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var wi=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ci(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ti=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=xi(e,r.attrs),this.excluded=null;let i=vi(this.attrs);this.instance=i?new V(this,i):null}create(e=null){return!e&&this.instance?this.instance:new V(this,yi(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){bi(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ei=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Or.from(e.nodes),t.marks=Or.from(e.marks||{}),this.nodes=Si.compile(this.spec.nodes,this),this.marks=Ti.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ii.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Di(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Di(this,n.split(` `))}this.nodeFromJSON=e=>ti.fromJSON(this,e),this.markFromJSON=e=>V.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Si))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ni(n,n.defaultAttrs,e,V.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Di(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Oi(e){return e.tag!=null}function ki(e){return e.style!=null}var Ai=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Oi(e))this.tags.push(e);else if(ki(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new zi(this,t,!1);return n.addAll(e,V.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new zi(this,t,!0);return n.addAll(e,V.none,t.from,t.to),H.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Vi(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ji={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Mi={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ni={ol:!0,ul:!0},Pi=1,Fi=2,Ii=4;function Li(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Pi:0)|(t===`full`?Fi:0)}var Ri=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=V.none,this.match=i||(a&Ii?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(B.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pi)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=B.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(B.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ji.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},zi=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Li(null,t.preserveWhitespace,0)|(n?Ii:0);i=r?new Ri(r.type,r.attrs,V.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ri(null,null,V.none,!0,null,a):new Ri(e.schema.topNodeType,null,V.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Fi?`full`:this.localPreserveWS||(r.options&Pi)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Ni.hasOwnProperty(a)&&this.parser.normalizeLists&&Bi(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Mi.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(ji.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=V.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Ui(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Li(e,i,a.options);a.options&Ii&&a.content.length==0&&(o|=Ii);let s=V.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Ui(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Ri(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Pi);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Bi(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Ni.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Vi(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Hi(e){let t={};for(let n in e)t[n]=e[n];return t}function Ui(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Wi=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ki(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Ki(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Xi(Ki(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Xi(Ki(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Xi(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Gi(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Gi(e.marks)}};function Gi(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ki(e){return e.document||window.document}var qi=new WeakMap;function Ji(e){let t=qi.get(e);return t===void 0&&qi.set(e,t=Yi(e)),t}function Yi(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Xi(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Ji(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Xi(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Zi=65535,Qi=2**16;function $i(e,t){return e+t*Qi}function ea(e){return e&Zi}function ta(e){return(e-(e&Zi))/Qi}var na=1,ra=2,ia=4,aa=8,oa=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&aa)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&ia)>0}},sa=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=ea(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+ta(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:$i(o/3,e-s),f=e==s?ra:e==u?na:ia;return(t<0?e!=s:e!=u)&&(f|=aa),new oa(a,f,d)}r+=l-c}return n?e+r:new oa(e+r,0,null)}touches(e,t){let n=0,r=ea(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};sa.empty=new sa([]);var ca=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new oa(e,r,null)}},la=Object.create(null),ua=class{getMap(){return sa.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=la[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in la)throw RangeError(`Duplicate use of step JSON ID `+e);return la[e]=t,t.prototype.jsonID=e,t}},da=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ir)return e.fail(t.message);throw t}}};function fa(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(fa(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return B.fromArray(r)}var pa=class e extends ua{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new H(fa(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return da.fromReplace(e,this.from,this.to,i)}invert(){return new ma(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};ua.jsonID(`addMark`,pa);var ma=class e extends ua{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new H(fa(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return da.fromReplace(e,this.from,this.to,n)}invert(){return new pa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};ua.jsonID(`removeMark`,ma);var ha=class e extends ua{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new ga(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};ua.jsonID(`addNodeMark`,ha);var ga=class e extends ua{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ha(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};ua.jsonID(`removeNodeMark`,ga);var _a=class e extends ua{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ya(e,this.from,this.to)?da.fail(`Structure replace would overwrite content`):da.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new sa([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?H.empty:new H(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?H.empty:new H(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,H.fromJSON(t,n.slice),!!n.structure)}};_a.MAP_BIAS=1,ua.jsonID(`replace`,_a);var va=class e extends ua{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(ya(e,this.from,this.gapFrom)||ya(e,this.gapTo,this.to)))return da.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return da.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?da.fromReplace(e,this.from,this.to,n):da.fail(`Content does not fit in gap`)}getMap(){return new sa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(t,n.slice),n.insert,!!n.structure)}};ua.jsonID(`replaceAround`,va);function ya(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ba(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new ma(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new pa(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function xa(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Ti){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new ma(t.from,t.to,t.style)))}function Sa(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new _a(s,l,H.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new ma(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new H(B.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new _a(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(B.empty,!0);e.replace(s,s,new H(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Ca(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function wa(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Ca(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Ta(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=B.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=B.from(r.node(e).copy(u)),d++):c--;let f=B.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=B.from(i.node(e).copy(f)),p++):l++;e.step(new va(c,l,o,s,new H(u.append(f),d,p),u.size-d,!0))}function Ea(e,t,n=null,r=e){let i=Oa(e,t),a=i&&ka(r,t);return a?i.map(Da).concat({type:t,attrs:n}).concat(a.map(Da)):null}function Da(e){return{type:e,attrs:null}}function Oa(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function ka(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Aa(e,t,n){let r=B.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=B.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new va(i,a,i,a,new H(r,0,0),n.length,!0))}function ja(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Pa(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Na(e,t,n,a),Sa(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new va(c,l,c+1,l-1,new H(B.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Ma(e,t,n,a),!1}})}function Ma(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Na(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
5
5
|
`))}})}function Pa(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Fa(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new va(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new H(B.from(o),0,0),1,!0))}function Ia(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function La(e,t,n=1,r){let i=e.doc.resolve(t),a=B.empty,o=B.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=B.from(i.node(e).copy(a));let t=r&&r[s];o=B.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new _a(t,t,new H(a.append(o),n,n),!0))}function Ra(e,t){let n=e.resolve(t),r=n.index();return Ba(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function za(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Ba(e,t){return!!(e&&t&&!e.isLeaf&&za(e,t))}function Va(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Ba(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Ha(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Na(e,r.node(),r.before(),s)}o.inlineContent&&Sa(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new _a(l,c.map(t+n,-1),H.empty,!0)),r===!0){let t=e.doc.resolve(l);Ma(e,t.node(),t.before(),e.steps.length)}return e}function Ua(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Wa(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Ga(e,t,n=t,r=H.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Ka(i,a,r)?new _a(t,n,r):new qa(i,a,r).fit()}function Ka(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var qa=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=B.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=B.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new H(i,a,o);return e>-1?new va(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new _a(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Xa(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(B.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Xa(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Xa(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new H(Ja(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new H(Ja(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Za(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Ya(this.placed,t,B.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?H.empty:new H(Ja(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new H(Ja(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Qa(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Qa(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ya(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Ya(this.placed,this.depth,B.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(B.empty,!0);e.childCount&&(this.placed=Ya(this.placed,this.frontier.length,e))}};function Ja(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Ja(e.firstChild.content,t-1,n)))}function Ya(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ya(e.lastChild.content,t-1,n)))}function Xa(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Za(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Za(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(B.empty,!0)))),e.copy(r)}function Qa(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!$a(n,a.content,o)?s:null}function $a(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function eo(e){return e.spec.defining||e.spec.definingForContent}function to(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Ka(i,a,r))return e.step(new _a(t,n,r));let o=ao(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=eo(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new H(no(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function no(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(no(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(B.empty,!0))}return e}function ro(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Ua(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new H(B.from(r),0,0))}function io(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=ao(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function ao(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var oo=class e extends ua{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(r),0,+!t.isLeaf))}getMap(){return sa.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};ua.jsonID(`attr`,oo);var so=class e extends ua{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return da.ok(n)}getMap(){return sa.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};ua.jsonID(`docAttr`,so);var co=class extends Error{};co=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},co.prototype=Object.create(Error.prototype),co.prototype.constructor=co,co.prototype.name=`TransformError`;var lo=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ca}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new co(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=H.empty){let r=Ga(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new H(B.from(n),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return to(this,e,t,n),this}replaceRangeWith(e,t,n){return ro(this,e,t,n),this}deleteRange(e,t){return io(this,e,t),this}lift(e,t){return Ta(this,e,t),this}join(e,t=1){return Ha(this,e,t),this}wrap(e,t){return Aa(this,e,t),this}setBlockType(e,t=e,n,r=null){return ja(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Fa(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new oo(e,t,n)),this}setDocAttribute(e,t){return this.step(new so(e,t)),this}addNodeMark(e,t){return this.step(new ha(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof V)t.isInSet(n.marks)&&this.step(new ga(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new ga(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return La(this,e,t,n),this}addMark(e,t,n){return ba(this,e,t,n),this}removeMark(e,t,n){return xa(this,e,t,n),this}clearIncompatible(e,t,n){return Sa(this,e,t,n),this}},uo=Object.create(null),U=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new fo(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=H.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?H.empty:t),o==0&&bo(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),bo(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new W(e):yo(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?yo(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):yo(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new _o(e.node(0))}static atStart(e){return yo(e,e,0,0,1)||new _o(e)}static atEnd(e){return yo(e,e,e.content.size,e.childCount,-1)||new _o(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=uo[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in uo)throw RangeError(`Duplicate use of selection JSON ID `+e);return uo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return W.between(this.$anchor,this.$head).getBookmark()}};U.prototype.visible=!0;var fo=class{constructor(e,t){this.$from=e,this.$to=t}},po=!1;function mo(e){!po&&!e.parent.inlineContent&&(po=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var W=class e extends U{constructor(e,t=e){mo(e),mo(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return U.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ho(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=U.findFrom(n,r,!0)||U.findFrom(n,-r,!0);if(e)n=e.$head;else return U.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(U.findFrom(t,-r,!0)||U.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};U.jsonID(`text`,W);var ho=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return W.between(e.resolve(this.anchor),e.resolve(this.head))}},G=class e extends U{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?U.near(a):new e(a)}content(){return new H(B.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new go(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};G.prototype.visible=!1,U.jsonID(`node`,G);var go=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new ho(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&G.isSelectable(n)?new G(t):U.near(t)}},_o=class e extends U{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let t=U.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return vo}};U.jsonID(`all`,_o);var vo={map(){return this},resolve(e){return new _o(e)}};function yo(e,t,n,r,i,a=!1){if(t.inlineContent)return W.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=yo(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&G.isSelectable(r))return G.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function bo(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof _a||i instanceof va))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(U.near(e.doc.resolve(o),n))}var xo=1,So=2,Co=4,wo=class extends lo{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|xo)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&xo)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=So,this}ensureMarks(e){return V.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&So)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||V.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(U.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Co,this}get scrolledIntoView(){return(this.updated&Co)>0}};function To(e,t){return!t||!e?e:e.bind(t)}var Eo=class{constructor(e,t,n){this.name=e,this.init=To(t.init,n),this.apply=To(t.apply,n)}},Do=[new Eo(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Eo(`selection`,{init(e,t){return e.selection||U.atStart(t.doc)},apply(e){return e.selection}}),new Eo(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Eo(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Oo=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Do.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Eo(e.key,e.spec.state,e))})}},ko=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new wo(this)}static create(t){let n=new Oo(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Oo(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Oo(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=ti.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=U.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Ao(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Ao(i,t,{})),n[r]=i}return n}var K=class{constructor(e){this.spec=e,this.props={},e.props&&Ao(e.props,this,this.props),this.key=e.key?e.key.key:Mo(`plugin`)}getState(e){return e[this.key]}},jo=Object.create(null);function Mo(e){return e in jo?e+`$`+ ++jo[e]:(jo[e]=0,e+`$`)}var q=class{constructor(e=`key`){this.key=Mo(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},No=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Po(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Fo=(e,t,n)=>{let r=Po(e,n);if(!r)return!1;let i=Vo(r);if(!i){let n=r.blockRange(),i=n&&wa(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(as(e,i,t,-1))return!0;if(r.parent.content.size==0&&(zo(a,`end`)||G.isSelectable(a)))for(let n=r.depth;;n--){let o=Ga(e.doc,r.before(n),r.after(n),H.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(zo(a,`end`)?U.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):G.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Io=(e,t,n)=>{let r=Po(e,n);if(!r)return!1;let i=Vo(r);return i?Ro(e,i,t):!1},Lo=(e,t,n)=>{let r=Ho(e,n);if(!r)return!1;let i=Go(r);return i?Ro(e,i,t):!1};function Ro(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Ga(e.doc,i,o,H.empty);if(!s||s.from!=i||s instanceof _a&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(W.create(t.doc,i)),n(t.scrollIntoView())}return!0}function zo(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Bo=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Vo(r)}let o=a&&a.nodeBefore;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Vo(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Ho(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Uo=(e,t,n)=>{let r=Ho(e,n);if(!r)return!1;let i=Go(r);if(!i)return!1;let a=i.nodeAfter;if(as(e,i,t,1))return!0;if(r.parent.content.size==0&&(zo(a,`start`)||G.isSelectable(a))){let n=Ga(e.doc,r.before(),r.after(),H.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(zo(a,`start`)?U.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):G.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Wo=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Go(r)}let o=a&&a.nodeAfter;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos)).scrollIntoView()),!0)};function Go(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Ko=(e,t)=>{let n=e.selection,r=n instanceof G,i;if(r){if(n.node.isTextblock||!Ra(e.doc,n.from))return!1;i=n.from}else if(i=Va(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(G.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},qo=(e,t)=>{let n=e.selection,r;if(n instanceof G){if(n.node.isTextblock||!Ra(e.doc,n.to))return!1;r=n.to}else if(r=Va(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Jo=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&wa(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Yo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-owl/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Free, MIT-licensed Vue 3 component library with Tailwind v4 theming, an auto-mounting toast system, and accessible, fully-typed components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -33,13 +33,15 @@
|
|
|
33
33
|
"import": "./dist/ui.es.js",
|
|
34
34
|
"require": "./dist/ui.umd.js"
|
|
35
35
|
},
|
|
36
|
-
"./style.css": "./dist/ui.css"
|
|
36
|
+
"./style.css": "./dist/ui.css",
|
|
37
|
+
"./tailwind.css": "./assets/css/tailwind.css"
|
|
37
38
|
},
|
|
38
39
|
"sideEffects": [
|
|
39
40
|
"**/*.css"
|
|
40
41
|
],
|
|
41
42
|
"files": [
|
|
42
|
-
"dist"
|
|
43
|
+
"dist",
|
|
44
|
+
"assets"
|
|
43
45
|
],
|
|
44
46
|
"publishConfig": {
|
|
45
47
|
"access": "public"
|