@kupola/kupola 1.9.6 → 1.9.8

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.
@@ -0,0 +1,368 @@
1
+ /* ===== Dashboard Layout ===== */
2
+
3
+ html.ds-dashboard-page,
4
+ body.ds-dashboard-page {
5
+ height: 100vh;
6
+ overflow: hidden;
7
+ margin: 0;
8
+ padding: 0;
9
+ }
10
+
11
+ .ds-dashboard {
12
+ display: flex;
13
+ flex-direction: column;
14
+ height: 100%;
15
+ width: 100%;
16
+ overflow: hidden;
17
+ }
18
+
19
+ /* Header */
20
+ .ds-dashboard__header {
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: space-between;
24
+ height: var(--dashboard-header-height, 48px);
25
+ padding: 0 var(--spacer-12);
26
+ background: var(--bg-base-secondary);
27
+ border-bottom: 1px solid var(--border-neutral-l1);
28
+ flex-shrink: 0;
29
+ z-index: 100;
30
+ }
31
+
32
+ .ds-dashboard__header-left {
33
+ display: flex;
34
+ align-items: center;
35
+ gap: var(--spacer-12);
36
+ }
37
+
38
+ .ds-dashboard__logo {
39
+ display: flex;
40
+ align-items: center;
41
+ gap: var(--spacer-6);
42
+ font-weight: var(--font-weight-strong);
43
+ font-size: var(--heading-md-font-size);
44
+ color: var(--text-default);
45
+ }
46
+
47
+ .ds-dashboard__logo-icon {
48
+ width: 24px;
49
+ height: 24px;
50
+ background: var(--bg-brand);
51
+ border-radius: var(--radius-4);
52
+ }
53
+
54
+ .ds-dashboard__header-center {
55
+ display: flex;
56
+ align-items: center;
57
+ gap: var(--spacer-4);
58
+ }
59
+
60
+ .ds-dashboard__header-right {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: var(--spacer-8);
64
+ }
65
+
66
+ /* Main Content Area */
67
+ .ds-dashboard__main {
68
+ display: flex;
69
+ flex: 1;
70
+ overflow: visible;
71
+ position: relative;
72
+ }
73
+
74
+ /* Sidebar */
75
+ .ds-dashboard__sidebar {
76
+ width: var(--dashboard-sidebar-width, 48px);
77
+ background: var(--bg-base-secondary);
78
+ border-right: 1px solid var(--border-neutral-l1);
79
+ display: flex;
80
+ flex-direction: column;
81
+ flex-shrink: 0;
82
+ padding: var(--spacer-8) 0;
83
+ position: relative;
84
+ z-index: 10;
85
+ overflow: visible;
86
+ }
87
+
88
+ .ds-dashboard__sidebar-nav {
89
+ display: flex;
90
+ flex-direction: column;
91
+ gap: var(--spacer-4);
92
+ padding: 0 var(--spacer-4);
93
+ }
94
+
95
+ .ds-dashboard__sidebar-item {
96
+ display: flex;
97
+ align-items: center;
98
+ justify-content: center;
99
+ width: 36px;
100
+ height: 36px;
101
+ margin: 0 auto;
102
+ border-radius: var(--radius-4);
103
+ color: var(--icon-secondary);
104
+ cursor: pointer;
105
+ transition: all 0.15s ease;
106
+ position: relative;
107
+ }
108
+
109
+ .ds-dashboard__sidebar-item:hover {
110
+ background: var(--bg-overlay-l1);
111
+ color: var(--icon-default);
112
+ }
113
+
114
+ .ds-dashboard__sidebar-item.is-active {
115
+ background: var(--bg-brand-popup);
116
+ color: var(--icon-brand);
117
+ }
118
+
119
+ .ds-dashboard__sidebar-item.is-active::before {
120
+ content: '';
121
+ position: absolute;
122
+ left: 0;
123
+ top: 50%;
124
+ transform: translateY(-50%);
125
+ width: 2px;
126
+ height: 16px;
127
+ background: var(--bg-brand);
128
+ border-radius: 0 var(--radius-2) var(--radius-2) 0;
129
+ }
130
+
131
+ .ds-dashboard__sidebar-item img {
132
+ width: 18px;
133
+ height: 18px;
134
+ opacity: 1;
135
+ filter: var(--icon-filter, none);
136
+ }
137
+
138
+ /* BUG-004 fix: sidebar tooltip via ::after + data-title */
139
+ .ds-dashboard__sidebar-item::after {
140
+ content: attr(data-title);
141
+ position: absolute;
142
+ left: calc(100% + 8px);
143
+ top: 50%;
144
+ transform: translateY(-50%);
145
+ padding: 4px 10px;
146
+ background: var(--bg-tooltip, var(--bg-base-secondary));
147
+ border: 1px solid var(--border-neutral-l2);
148
+ border-radius: var(--radius-4);
149
+ color: var(--text-default);
150
+ font-size: var(--body-xs-font-size, 11px);
151
+ white-space: nowrap;
152
+ pointer-events: none;
153
+ opacity: 0;
154
+ visibility: hidden;
155
+ transition: opacity 0.15s ease, visibility 0.15s ease;
156
+ z-index: 9999;
157
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
158
+ }
159
+
160
+ .ds-dashboard__sidebar-item:hover::after {
161
+ opacity: 1;
162
+ visibility: visible;
163
+ }
164
+
165
+ .ds-dashboard .icon {
166
+ opacity: 1;
167
+ filter: var(--icon-filter, none);
168
+ }
169
+
170
+ .ds-dashboard .theme-icon {
171
+ width: 16px;
172
+ height: 16px;
173
+ opacity: 1;
174
+ filter: var(--icon-filter, none);
175
+ }
176
+
177
+ .ds-dashboard__sidebar-divider {
178
+ height: 1px;
179
+ background: var(--border-neutral-l1);
180
+ margin: var(--spacer-8) var(--spacer-8);
181
+ }
182
+
183
+ .ds-dashboard__sidebar-bottom {
184
+ margin-top: auto;
185
+ display: flex;
186
+ flex-direction: column;
187
+ gap: var(--spacer-4);
188
+ padding: 0 var(--spacer-4);
189
+ }
190
+
191
+ /* Content Area */
192
+ .ds-dashboard__content {
193
+ flex: 1;
194
+ overflow-y: auto;
195
+ background: var(--bg-base-default);
196
+ padding: var(--spacer-16);
197
+ }
198
+
199
+ /* Status Bar */
200
+ .ds-dashboard__footer {
201
+ height: var(--dashboard-footer-height, 24px);
202
+ background: var(--bg-base-secondary);
203
+ border-top: 1px solid var(--border-neutral-l1);
204
+ display: flex;
205
+ align-items: center;
206
+ justify-content: space-between;
207
+ padding: 0 var(--spacer-12);
208
+ flex-shrink: 0;
209
+ font-size: var(--body-xs-font-size);
210
+ color: var(--text-tertiary);
211
+ }
212
+
213
+ .ds-dashboard__footer-left {
214
+ display: flex;
215
+ align-items: center;
216
+ gap: var(--spacer-12);
217
+ }
218
+
219
+ .ds-dashboard__footer-right {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: var(--spacer-12);
223
+ }
224
+
225
+ .ds-dashboard__status-item {
226
+ display: flex;
227
+ align-items: center;
228
+ gap: var(--spacer-4);
229
+ }
230
+
231
+ .ds-dashboard__status-dot {
232
+ width: 6px;
233
+ height: 6px;
234
+ border-radius: 50%;
235
+ background: var(--status-success-default);
236
+ }
237
+
238
+ .ds-dashboard__status-dot.is-warning {
239
+ background: var(--status-warning-default);
240
+ }
241
+
242
+ .ds-dashboard__status-dot.is-error {
243
+ background: var(--status-error-default);
244
+ }
245
+
246
+ /* Scrollbar styling */
247
+ .ds-dashboard__content::-webkit-scrollbar {
248
+ width: 8px;
249
+ height: 8px;
250
+ }
251
+
252
+ .ds-dashboard__content::-webkit-scrollbar-track {
253
+ background: transparent;
254
+ }
255
+
256
+ .ds-dashboard__content::-webkit-scrollbar-thumb {
257
+ background: var(--border-neutral-l2);
258
+ border-radius: var(--radius-4);
259
+ }
260
+
261
+ .ds-dashboard__content::-webkit-scrollbar-thumb:hover {
262
+ background: var(--border-neutral-l3);
263
+ }
264
+
265
+ /* Responsive adjustments for tablet */
266
+ @media (max-width: 1024px) and (min-width: 769px) {
267
+ .ds-dashboard__sidebar {
268
+ width: 44px;
269
+ }
270
+
271
+ .ds-dashboard__sidebar-item {
272
+ width: 34px;
273
+ height: 34px;
274
+ }
275
+
276
+ .ds-dashboard__sidebar-item img {
277
+ width: 16px;
278
+ height: 16px;
279
+ }
280
+
281
+ .ds-dashboard__header-center {
282
+ display: none;
283
+ }
284
+
285
+ .ds-dashboard__content {
286
+ padding: var(--spacer-12);
287
+ }
288
+ }
289
+
290
+ /* Responsive adjustments for phone */
291
+ @media (max-width: 768px) {
292
+ .ds-dashboard__header-left .logo-text {
293
+ display: none;
294
+ }
295
+
296
+ .ds-dashboard__header-center {
297
+ display: none;
298
+ }
299
+
300
+ .ds-dashboard__content {
301
+ padding: var(--spacer-8);
302
+ padding-bottom: calc(var(--spacer-8) + 56px + var(--dashboard-footer-height, 24px));
303
+ }
304
+
305
+ .ds-dashboard__sidebar {
306
+ position: fixed;
307
+ bottom: var(--dashboard-footer-height, 24px);
308
+ left: 0;
309
+ right: 0;
310
+ width: 100%;
311
+ height: 56px;
312
+ flex-direction: row;
313
+ justify-content: space-around;
314
+ align-items: center;
315
+ padding: 0;
316
+ border-right: none;
317
+ border-top: 1px solid var(--border-neutral-l1);
318
+ z-index: 100;
319
+ background: var(--bg-base-secondary);
320
+ backdrop-filter: blur(10px);
321
+ }
322
+
323
+ .ds-dashboard__sidebar-nav {
324
+ flex-direction: row;
325
+ width: 100%;
326
+ justify-content: space-around;
327
+ padding: 0;
328
+ }
329
+
330
+ .ds-dashboard__sidebar-item {
331
+ width: 48px;
332
+ height: 48px;
333
+ margin: 0;
334
+ flex-direction: column;
335
+ gap: 2px;
336
+ }
337
+
338
+ .ds-dashboard__sidebar-item img {
339
+ width: 20px;
340
+ height: 20px;
341
+ }
342
+
343
+ .ds-dashboard__sidebar-item::before {
344
+ display: none;
345
+ }
346
+
347
+ .ds-dashboard__sidebar-item span {
348
+ display: block;
349
+ font-size: 10px;
350
+ color: inherit;
351
+ }
352
+
353
+ .ds-dashboard__sidebar-divider {
354
+ display: none;
355
+ }
356
+
357
+ .ds-dashboard__sidebar-bottom {
358
+ display: none;
359
+ }
360
+
361
+ .ds-dashboard__body {
362
+ flex-direction: column;
363
+ }
364
+
365
+ .ds-dashboard__footer {
366
+ padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
367
+ }
368
+ }
package/css/kupola.css CHANGED
@@ -1,13 +1,14 @@
1
- @import url('colors-and-type.css');
2
- @import url('theme-dark.css');
3
- @import url('theme-light.css');
4
- @import url('brand-themes.css');
5
- @import url('scaffold.css');
6
- @import url('components.css');
7
- @import url('components-ext.css');
8
- @import url('states.css');
9
- @import url('utilities.css');
10
- @import url('responsive.css');
11
- @import url('accessibility.css');
12
- @import url('animations.css');
13
- @import url('table.css');
1
+ @import url('colors-and-type.css');
2
+ @import url('theme-dark.css');
3
+ @import url('theme-light.css');
4
+ @import url('brand-themes.css');
5
+ @import url('scaffold.css');
6
+ @import url('dashboard.css');
7
+ @import url('components.css');
8
+ @import url('components-ext.css');
9
+ @import url('states.css');
10
+ @import url('utilities.css');
11
+ @import url('responsive.css');
12
+ @import url('accessibility.css');
13
+ @import url('animations.css');
14
+ @import url('table.css');
package/dist/core.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";class t{constructor(t="app"){this.scope=t,this.hooks=new Map,this.state="created",this.stateHistory=["created"],this.transitions=new Map([["created",["bootstrapped","destroyed"]],["bootstrapped",["mounted","destroyed"]],["mounted",["updated","unmounted","destroyed"]],["updated",["updated","unmounted","destroyed"]],["unmounted",["mounted","destroyed"]],["destroyed",[]]]),this.phaseStateMap={bootstrap:{from:"created",to:"bootstrapped"},mount:{from:["bootstrapped","unmounted"],to:"mounted"},update:{from:["mounted","updated"],to:"updated"},unmount:{from:["mounted","updated"],to:"unmounted"},destroy:{from:["bootstrapped","mounted","updated","unmounted"],to:"destroyed"}},this.basePhases=["bootstrap","mount","update","unmount","destroy"],this.allPhases=["error","errorBoundary"],this.basePhases.forEach(t=>{this.allPhases.push(`before${t.charAt(0).toUpperCase()+t.slice(1)}`),this.allPhases.push(t),this.allPhases.push(`after${t.charAt(0).toUpperCase()+t.slice(1)}`)}),this.allPhases.forEach(t=>{this.hooks.set(t,[])}),this.pendingHooks=new Set,this.trace=[],this.errorHandler=null,this.errorBoundary=null,this.lastError=null,this.errorCount=0,this.maxErrors=10,this.i=null}o(t){const n=this.transitions.get(this.state);if(!n||!n.includes(t))throw new Error(`Invalid state transition: ${this.state} -> ${t}`);return!0}u(t){this.o(t),this.state=t,this.stateHistory.push(t)}h(t){const n=this.hooks.get(t);n&&n.forEach(t=>{t.resolved=!1})}on(t,n,e={}){if(!this.allPhases.includes(t))throw new Error(`Unknown lifecycle phase: ${t}`);const r=this.hooks.get(t);return r.push({handler:n,priority:e.priority||0,depends:e.depends||[],name:e.name||n.name||`anonymous_${r.length}`}),r.sort((t,n)=>n.priority-t.priority),()=>{const t=r.findIndex(t=>t.handler===n);t>-1&&r.splice(t,1)}}async l(t,n){if(t&&0!==t.length)for(const e of t){const t=this.hooks.get(n).find(t=>t.name===e);t&&!t.resolved&&(await t.handler(),t.resolved=!0)}}async emit(t,...n){if("destroyed"===this.state&&"error"!==t)return;const e=this.hooks.get(t);if(!e||0===e.length)return;const r=`${t}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;this.pendingHooks.add(r);const s=performance.now();try{for(const s of e){await this.l(s.depends,t);const e=performance.now();let i,o;try{i=s.handler(...n),i instanceof Promise&&await i,s.resolved=!0}catch(e){o=e,"error"!==t&&await this.p({phase:t,hook:s.name,error:e,args:n})}const c=performance.now()-e;this.trace.push({emitId:r,phase:t,hookName:s.name,duration:c,status:o?"error":"success",error:o?o.message:null,timestamp:Date.now()})}performance.now()}finally{this.pendingHooks.delete(r)}}async runPhase(t,...n){if(!this.basePhases.includes(t))throw new Error(`Unknown base phase: ${t}`);const e=this.phaseStateMap[t];if(e)if(Array.isArray(e.from)){if(!e.from.includes(this.state))throw new Error(`Cannot ${t} from state ${this.state}, expected one of: ${e.from.join(", ")}`)}else if(this.state!==e.from)throw new Error(`Cannot ${t} from state ${this.state}, expected ${e.from}`);const r=`before${t.charAt(0).toUpperCase()+t.slice(1)}`,s=`after${t.charAt(0).toUpperCase()+t.slice(1)}`;this.h(r),this.h(t),this.h(s),this.allPhases.includes(r)&&await this.emit(r,...n),await this.emit(t,...n),e&&this.u(e.to),this.allPhases.includes(s)&&await this.emit(s,...n)}async bootstrap(...t){await this.runPhase("bootstrap",...t)}async m(){return new Promise(t=>{if("complete"===document.readyState||"interactive"===document.readyState)return void t();const n=()=>{document.removeEventListener("DOMContentLoaded",n),window.removeEventListener("load",n),t()};document.addEventListener("DOMContentLoaded",n),window.addEventListener("load",n)})}async mount(...t){await this.runPhase("mount",...t)}async mountWithDOMReady(...t){await this.m(),await this.runPhase("mount",...t)}async update(...t){await this.runPhase("update",...t)}async unmount(...t){await this.runPhase("unmount",...t)}async destroy(...t){await this.runPhase("destroy",...t),this.hooks.forEach(t=>{t.length=0})}getPhaseHandlers(t){return this.hooks.get(t)||[]}hasHandlers(t){const n=this.hooks.get(t);return n&&n.length>0}getTrace(){return[...this.trace]}clearTrace(){this.trace=[]}getState(){return this.state}getStateHistory(){return[...this.stateHistory]}isInState(t){return this.state===t}onError(t){return this.i=t,this.on("error",t)}setErrorBoundary(t){return this.errorBoundary=t,this.on("errorBoundary",n=>"function"==typeof t?t(n):null)}setMaxErrors(t){this.maxErrors=t}getErrorCount(){return this.errorCount}getLastError(){return this.lastError}resetErrorCount(){this.errorCount=0,this.lastError=null}async p(t){if(this.errorCount++,this.lastError=t.error,this.errorCount>=this.maxErrors)return;if(await this.emit("error",t),"function"==typeof this.i)try{await this.i(t)}catch(t){}const n=this.hooks.get("errorBoundary");if(n&&n.length>0)for(const e of n)try{const n=e.handler(t);if(n instanceof Promise&&await n,"handled"===n)return}catch(t){}}}const n=new t("app");const e=new Set(["__proto__","prototype","constructor"]);function r(t){return e.has(t)}const s={trim:function(t){return t?t.trim():""},trimLeft:function(t){return t?t.replace(/^\s+/,""):""},trimRight:function(t){return t?t.replace(/\s+$/,""):""},toUpperCase:function(t){return t?t.toUpperCase():""},toLowerCase:function(t){return t?t.toLowerCase():""},capitalize:function(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""},camelize:function(t){return t?t.replace(/-(\w)/g,(t,n)=>n?n.toUpperCase():""):""},hyphenate:function(t){return t?t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):""},padStart:function(t,n,e=" "){return(String(t)||"").padStart(n,e)},padEnd:function(t,n,e=" "){return(String(t)||"").padEnd(n,e)},truncate:function(t,n,e="..."){return!t||t.length<=n?t||"":t.slice(0,n)+e},replaceAll:function(t,n,e){return t?t.split(n).join(e):""},format:function(t,n){return t?t.replace(/\{\{(\w+)\}\}/g,(t,e)=>void 0!==n[e]?n[e]:`{{${e}}}`):""},startsWith:function(t,n){return(t||"").startsWith(n)},endsWith:function(t,n){return(t||"").endsWith(n)},includes:function(t,n){return(t||"").includes(n)},repeat:function(t,n){return(t||"").repeat(n)},reverse:function(t){return(t||"").split("").reverse().join("")},countOccurrences:function(t,n){return t&&n?t.split(n).length-1:0},escapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.textContent=t,n.innerHTML},unescapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.innerHTML=t,n.textContent},generateRandom:function(t=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let r=0;r<t;r++)e+=n.charAt(Math.floor(62*Math.random()));return e},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}};function i(t){return t?t.reduce((t,n)=>t+(Number(n)||0),0):0}const o={isArray:function(t){return Array.isArray(t)},isEmpty:function(t){return!t||0===t.length},size:function(t){return t?t.length:0},first:function(t,n){return t&&t.length>0?t[0]:n},last:function(t,n){return t&&t.length>0?t[t.length-1]:n},get:function(t,n,e){return t&&void 0!==t[n]?t[n]:e},slice:function(t,n,e){return t?t.slice(n,e):[]},concat:function(...t){return t.reduce((t,n)=>t.concat(n||[]),[])},join:function(t,n=","){return t?t.join(n):""},indexOf:function(t,n,e=0){if(!t)return-1;if(Number.isNaN(n)){for(let n=e;n<t.length;n++)if(Number.isNaN(t[n]))return n;return-1}return t.indexOf(n,e)},lastIndexOf:function(t,n,e){if(!t)return-1;if(Number.isNaN(n)){for(let n=void 0!==e?e:t.length-1;n>=0;n--)if(Number.isNaN(t[n]))return n;return-1}return t.lastIndexOf(n,e)},includes:function(t,n){return!!t&&t.includes(n)},push:function(t,...n){return t&&t.push(...n),t},pop:function(t){return t?t.pop():void 0},shift:function(t){return t?t.shift():void 0},unshift:function(t,...n){return t&&t.unshift(...n),t},remove:function(t,n){if(!t)return t;const e=Number.isNaN(n)?t.findIndex(t=>Number.isNaN(t)):t.indexOf(n);return e>-1&&t.splice(e,1),t},removeAt:function(t,n){return!t||n<0||n>=t.length||t.splice(n,1),t},insert:function(t,n,e){return t?(t.splice(n,0,e),t):t},reverse:function(t){return t?t.slice().reverse():[]},sort:function(t,n){return t?t.slice().sort(n):[]},sortBy:function(t,n,e="asc"){return t?t.slice().sort((t,r)=>{const s="object"==typeof t?t[n]:t,i="object"==typeof r?r[n]:r;return s<i?"asc"===e?-1:1:s>i?"asc"===e?1:-1:0}):[]},filter:function(t,n){return t?t.filter(n):[]},map:function(t,n){return t?t.map(n):[]},reduce:function(t,n,e){return t?t.reduce(n,e):e},forEach:function(t,n){t&&t.forEach(n)},every:function(t,n){return!t||t.every(n)},some:function(t,n){return!!t&&t.some(n)},find:function(t,n){return t?t.find(n):void 0},findIndex:function(t,n){return t?t.findIndex(n):-1},flat:function(t,n=1){return t?t.flat(n):[]},flattenDeep:function t(n){return n?n.reduce((n,e)=>Array.isArray(e)?n.concat(t(e)):n.concat(e),[]):[]},unique:function(t){return t?[...new Set(t)]:[]},uniqueBy:function(t,n){if(!t)return[];const e=new Set;return t.filter(t=>{const r="object"==typeof t?t[n]:t;return!e.has(r)&&(e.add(r),!0)})},chunk:function(t,n){if(!t||n<=0)return[];const e=[];for(let r=0;r<t.length;r+=n)e.push(t.slice(r,r+n));return e},shuffle:function(t){if(!t)return[];const n=t.slice();for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},sum:i,average:function(t){return t&&0!==t.length?i(t)/t.length:0},max:function(t){return t&&t.length>0?Math.max(...t):-1/0},min:function(t){return t&&t.length>0?Math.min(...t):1/0},intersection:function(...t){return 0===t.length?[]:t.reduce((t,n)=>t.filter(t=>n&&n.includes(t)))},union:function(...t){return[...new Set(t.flat().filter(Boolean))]},difference:function(t,n){return t?t.filter(t=>!n||!n.includes(t)):[]},zip:function(...t){if(0===t.length)return[];const n=Math.max(...t.map(t=>t?t.length:0));return Array.from({length:n},(n,e)=>t.map(t=>t&&t[e]))}};function c(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}const a={isObject:c,isEmpty:function(t){return!t||"object"!=typeof t||0===Object.keys(t).length},keys:function(t){return t?Object.keys(t):[]},values:function(t){return t?Object.values(t):[]},entries:function(t){return t?Object.entries(t):[]},has:function(t,n){return!!t&&Object.prototype.hasOwnProperty.call(t,n)},get:function(t,n,e){if(!t)return e;const s=n.split(".");return s.some(r)?e:s.reduce((t,n)=>t&&t[n],t)??e},set:function(t,n,e){if(!t||"object"!=typeof t)return t;const s=n.split(".");if(s.some(r))return t;const i=s.pop();let o=t;return s.forEach(t=>{o[t]&&"object"==typeof o[t]||(o[t]={}),o=o[t]}),o[i]=e,t},pick:function(t,n){return t?n.reduce((n,e)=>(void 0!==t[e]&&(n[e]=t[e]),n),{}):{}},omit:function(t,n){return t?Object.keys(t).reduce((e,r)=>(n.includes(r)||(e[r]=t[r]),e),{}):{}},merge:function t(...n){return n.reduce((n,e)=>(e&&"object"==typeof e&&Object.keys(e).forEach(s=>{r(s)||(c(e[s])&&c(n[s])?n[s]=t(n[s],e[s]):n[s]=e[s])}),n),{})},clone:function(t){return t?JSON.parse(JSON.stringify(t)):t},deepClone:function t(n,e=new WeakMap){if(!n||"object"!=typeof n)return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n);if(n instanceof RegExp)return new RegExp(n);if(n instanceof Map){const r=new Map;return e.set(n,r),n.forEach((n,s)=>r.set(s,t(n,e))),r}if(n instanceof Set){const r=new Set;return e.set(n,r),n.forEach(n=>r.add(t(n,e))),r}if(Array.isArray(n)){const r=[];return e.set(n,r),n.forEach(n=>r.push(t(n,e))),r}const s={};return e.set(n,s),Object.keys(n).forEach(i=>{r(i)||(s[i]=t(n[i],e))}),s},forEach:function(t,n){t&&Object.keys(t).forEach(e=>n(t[e],e,t))},map:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{e[r]=n(t[r],r,t)}),e},filter:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{n(t[r],r,t)&&(e[r]=t[r])}),e},reduce:function(t,n,e){return t?Object.keys(t).reduce((e,r)=>n(e,t[r],r,t),e):e},toArray:function(t){return t?Object.keys(t).map(n=>({key:n,value:t[n]})):[]},fromArray:function(t,n,e){return t?t.reduce((t,r)=>{const s="object"==typeof r?r[n]:r,i=e?r[e]:r;return void 0!==s&&(t[s]=i),t},{}):{}},size:function(t){return t?Object.keys(t).length:0},invert:function(t){if(!t)return{};const n={};return Object.keys(t).forEach(e=>{n[t[e]]=e}),n},isEqual:function t(n,e){if(n===e)return!0;if(!n||!e||"object"!=typeof n||"object"!=typeof e)return!1;const r=Object.keys(n),s=Object.keys(e);return r.length===s.length&&r.every(r=>t(n[r],e[r]))},freeze:function t(n){return n?(Object.freeze(n),Object.keys(n).forEach(e=>{"object"==typeof n[e]&&t(n[e])}),n):n},seal:function(t){return t?Object.seal(t):t}};function u(t){return"number"==typeof t&&!isNaN(t)}function h(...t){return t.flat().filter(u).reduce((t,n)=>t+n,0)}function f(t=0,n=1){return Math.random()*(n-t)+t}const d={isNumber:u,isInteger:function(t){return Number.isInteger(t)},isFloat:function(t){return u(t)&&!Number.isInteger(t)},isPositive:function(t){return u(t)&&t>0},isNegative:function(t){return u(t)&&t<0},isZero:function(t){return u(t)&&0===t},clamp:function(t,n,e){return u(t)?Math.min(Math.max(t,n),e):t},round:function(t,n=0){if(!u(t))return t;const e=Math.pow(10,n);return Math.round(t*e)/e},floor:function(t){return u(t)?Math.floor(t):t},ceil:function(t){return u(t)?Math.ceil(t):t},abs:function(t){return u(t)?Math.abs(t):t},min:function(...t){const n=t.filter(u);return n.length>0?Math.min(...n):void 0},max:function(...t){const n=t.filter(u);return n.length>0?Math.max(...n):void 0},sum:h,average:function(...t){const n=t.flat().filter(u);return n.length>0?h(n)/n.length:0},random:f,randomInt:function(t,n){return Math.floor(f(t,n+1))},format:function(t,n=2){return u(t)?t.toFixed(n):String(t)},formatCurrency:function(t,n="CNY",e=2){return u(t)?new Intl.NumberFormat("zh-CN",{style:"currency",currency:n,minimumFractionDigits:e,maximumFractionDigits:e}).format(t):String(t)},formatPercent:function(t,n=0){return u(t)?`${(100*t).toFixed(n)}%`:String(t)},toFixed:function(t,n=0){return u(t)?t.toFixed(n):String(t)},toPrecision:function(t,n=6){return u(t)?t.toPrecision(n):String(t)},isNaN:function(t){return Number.isNaN(t)},isFinite:function(t){return Number.isFinite(t)},parseInt:function(t,n=10){return Number.parseInt(t,n)},parseFloat:function(t){return Number.parseFloat(t)},toNumber:function(t,n=0){const e=Number(t);return isNaN(e)?n:e},safeDivide:function(t,n,e=0){return u(t)&&u(n)&&0!==n?t/n:e},safeMultiply:function(...t){return t.reduce((t,n)=>u(t)&&u(n)?t*n:0,1)}};function l(){return Date.now()}function p(){const t=new Date;return t.setHours(0,0,0,0),t}function m(t){return t instanceof Date&&!isNaN(t.getTime())}function y(t){return m(t)}function w(t,n){if(!m(t)||!m(n))return 0;const e=new Date(t);e.setHours(0,0,0,0);const r=new Date(n);return r.setHours(0,0,0,0),Math.floor((e.getTime()-r.getTime())/864e5)}function b(t,n=1){if(!m(t))return t;const e=new Date(t),r=e.getDay(),s=r>=n?r-n:r+(7-n);return e.setDate(e.getDate()-s),e.setHours(0,0,0,0),e}const g={now:l,today:p,tomorrow:function(){const t=p();return t.setDate(t.getDate()+1),t},yesterday:function(){const t=p();return t.setDate(t.getDate()-1),t},isDate:m,isValid:y,parse:function(t){const n=new Date(t);return y(n)?n:null},format:function(t,n="YYYY-MM-DD HH:mm:ss"){if(!m(t))return"";const e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),a=String(t.getMilliseconds()).padStart(3,"0"),u=["日","一","二","三","四","五","六"][t.getDay()];return n.replace("YYYY",e).replace("MM",r).replace("DD",s).replace("HH",i).replace("mm",o).replace("ss",c).replace("SSS",a).replace("D",t.getDate()).replace("M",t.getMonth()+1).replace("H",t.getHours()).replace("m",t.getMinutes()).replace("s",t.getSeconds()).replace("W",u)},toISO:function(t){return m(t)?t.toISOString():""},toUTC:function(t){return m(t)?new Date(t.toUTCString()):null},addDays:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setDate(e.getDate()+n),e},addHours:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setHours(e.getHours()+n),e},addMinutes:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setMinutes(e.getMinutes()+n),e},addSeconds:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setSeconds(e.getSeconds()+n),e},diffDays:w,diffHours:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/36e5):0},diffMinutes:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/6e4):0},diffSeconds:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/1e3):0},isToday:function(t){return!!m(t)&&0===w(t,p())},isYesterday:function(t){return!!m(t)&&-1===w(t,p())},isTomorrow:function(t){return!!m(t)&&1===w(t,p())},isFuture:function(t){return!!m(t)&&t.getTime()>l()},isPast:function(t){return!!m(t)&&t.getTime()<l()},isLeapYear:function(t){if(!m(t))return!1;const n=t.getFullYear();return n%4==0&&(n%100!=0||n%400==0)},getDaysInMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth()+1,0).getDate():0},getWeekOfYear:function(t){if(!m(t))return 0;const n=new Date(t.getFullYear(),0,1),e=t.getTime()-n.getTime();return Math.ceil(e/6048e5)},getQuarter:function(t){return m(t)?Math.ceil((t.getMonth()+1)/3):0},startOfDay:function(t){if(!m(t))return t;const n=new Date(t);return n.setHours(0,0,0,0),n},endOfDay:function(t){if(!m(t))return t;const n=new Date(t);return n.setHours(23,59,59,999),n},startOfMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth(),1):t},endOfMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59,999):t},startOfWeek:b,endOfWeek:function(t,n=1){if(!m(t))return t;const e=b(t,n),r=new Date(e);return r.setDate(r.getDate()+6),r.setHours(23,59,59,999),r},getAge:function(t){if(!m(t))return 0;const n=new Date;let e=n.getFullYear()-t.getFullYear();return(n.getMonth()<t.getMonth()||n.getMonth()===t.getMonth()&&n.getDate()<t.getDate())&&e--,Math.max(0,e)},fromNow:function(t){if(!m(t))return"";const n=l()-t.getTime(),e=6e4,r=36e5,s=24*r,i=7*s,o=30*s,c=365*s;return n<e?"刚刚":n<r?`${Math.floor(n/e)}分钟前`:n<s?`${Math.floor(n/r)}小时前`:n<i?`${Math.floor(n/s)}天前`:n<o?`${Math.floor(n/i)}周前`:n<c?`${Math.floor(n/o)}个月前`:`${Math.floor(n/c)}年前`}};function x(t,n,e={}){let r=null,s=null,i=null,o=0;const c=e.leading||!1,a=!1!==e.trailing;function u(){t.apply(i,s)}function h(){r=null,a&&s&&u(),s=null,i=null}return function(...t){s=t,i=this,o=Date.now(),r?(clearTimeout(r),r=setTimeout(h,Math.max(0,n-(Date.now()-o)))):(o=Date.now(),c?(r=setTimeout(h,n),u()):r=setTimeout(h,n))}}function _(t,n,e={}){let r=!1;const s=e.trailing||!1;let i=null,o=null;function c(){t.apply(o,i),i=null,o=null}return function(...t){r?s&&(i=t,o=this):(r=!0,i=t,o=this,c(),setTimeout(()=>{r=!1,s&&i&&c()},n))}}function v(t){return/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(t||"")}function S(t){return/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(t||"")}function $(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t||"")}function O(t){const n=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(t||"");return!!n&&n.slice(1).every(t=>parseInt(t)>=0&&parseInt(t)<=255)}function k(t){const n=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*([01]|0\.\d+)\)$/.exec(t||"");if(!n)return!1;const[,e,r,s,i]=n;return parseInt(e)>=0&&parseInt(e)<=255&&parseInt(r)>=0&&parseInt(r)<=255&&parseInt(s)>=0&&parseInt(s)<=255&&parseFloat(i)>=0&&parseFloat(i)<=1}function M(t,n){return(t||"").includes(n)}const j={isEmail:function(t){return/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t||"")},isPhone:function(t){return/^1[3-9]\d{9}$/.test(t||"")},isURL:function(t){return/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w.-]*)*\/?$/.test(t||"")},isIPv4:v,isIPv6:S,isIP:function(t){return v(t)||S(t)},isIDCard:function(t){return/^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(t||"")},isPassport:function(t){return/^[A-Z][0-9]{8}$|^[A-Z]{2}[0-9]{7}$/.test(t||"")},isCreditCard:function(t){const n=t.replace(/\s/g,"");if(!/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9]{2})[0-9]{12}|3[47][0-9]{13})$/.test(n))return!1;let e=0,r=!1;for(let t=n.length-1;t>=0;t--){let s=parseInt(n[t],10);r&&(s*=2,s>9&&(s-=9)),e+=s,r=!r}return e%10==0},isHexColor:$,isRGB:O,isRGBA:k,isColor:function(t){return $(t)||O(t)||k(t)},isDate:function(t){return!isNaN(new Date(t).getTime())},isJSON:function(t){try{return JSON.parse(t),!0}catch{return!1}},isEmpty:function(t){return!t||""===t.trim()},isWhitespace:function(t){return/^\s+$/.test(t||"")},isNumber:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},isInteger:function(t){return/^-?\d+$/.test(t||"")},isFloat:function(t){return/^-?\d+\.\d+$/.test(t||"")},isPositive:function(t){const n=parseFloat(t);return!isNaN(n)&&n>0},isNegative:function(t){const n=parseFloat(t);return!isNaN(n)&&n<0},isAlpha:function(t){return/^[a-zA-Z]+$/.test(t||"")},isAlphaNumeric:function(t){return/^[a-zA-Z0-9]+$/.test(t||"")},isChinese:function(t){return/^[\u4e00-\u9fa5]+$/.test(t||"")},isLength:function(t,n,e){const r=(t||"").length;return r>=n&&(void 0===e||r<=e)},minLength:function(t,n){return(t||"").length>=n},maxLength:function(t,n){return(t||"").length<=n},matches:function(t,n){return n instanceof RegExp&&n.test(t||"")},equals:function(t,n){return String(t)===String(n)},contains:M,notContains:function(t,n){return!M(t,n)},isArray:function(t){return Array.isArray(t)},arrayLength:function(t,n,e){const r=t?t.length:0;return r>=n&&(void 0===e||r<=e)},arrayMinLength:function(t,n){return!!t&&t.length>=n},arrayMaxLength:function(t,n){return!!t&&t.length<=n},isObject:function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},hasKeys:function(t,n){return!!(t&&n&&Array.isArray(n))&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n))},validate:function(t,n){const e={};return Object.keys(n).forEach(r=>{const s=t[r],i=n[r],o=[];i.forEach(n=>{if("string"==typeof n){const[t,...e]=n.split(":");j[t](s,...e)||o.push(t)}else if("function"==typeof n){const e=n(s,t);!0!==e&&o.push(e||"validation_failed")}}),o.length>0&&(e[r]=o)}),{valid:0===Object.keys(e).length,errors:e}}};const C={md5:function(t){const n=t?String(t):"",e=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745],r=[[7,12,17,22],[5,9,14,20],[4,11,16,23],[6,10,15,21]];function s(t,n){return t<<n|t>>>32-n}function i(t,n){const[i,o,c,a]=n,u=[];for(let n=0;n<16;n++)u[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;let h=i,f=o,d=c,l=a;for(let t=0;t<64;t++){let n,i;const o=Math.floor(t/16),c=t%16;0===o?(n=f&d|~f&l,i=c):1===o?(n=l&f|~l&d,i=(5*c+1)%16):2===o?(n=f^d^l,i=(3*c+5)%16):(n=d^(f|~l),i=7*c%16);const a=l;l=d,d=f,f+=s(h+n+e[t]+u[i]&4294967295,r[o][t%4]),h=a}return[i+h&4294967295,o+f&4294967295,c+d&4294967295,a+l&4294967295]}const o=function(t){const n=8*t.length;for(t+="€";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);return t}(n);let c=[1732584193,4023233417,2562383102,271733878];for(let t=0;t<o.length;t+=64)c=i(o.substring(t,t+64),c);let a="";return c.forEach(t=>{for(let n=0;n<4;n++)a+=(t>>>8*n&255).toString(16).padStart(2,"0")}),a},sha256:function(t){const n=t?String(t):"",e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function r(t,n){return t>>>n|t<<32-n}function s(t,n){const s=[];for(let n=0;n<16;n++)s[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;for(let t=16;t<64;t++){const n=r(s[t-15],7)^r(s[t-15],18)^s[t-15]>>>3,e=r(s[t-2],17)^r(s[t-2],19)^s[t-2]>>>10;s[t]=s[t-16]+n+s[t-7]+e&4294967295}let[i,o,c,a,u,h,f,d]=n;for(let t=0;t<64;t++){const n=d+(r(u,6)^r(u,11)^r(u,25))+(u&h^~u&f)+e[t]+s[t]&4294967295,l=i&o^i&c^o&c;d=f,f=h,h=u,u=a+n&4294967295,a=c,c=o,o=i,i=n+((r(i,2)^r(i,13)^r(i,22))+l&4294967295)&4294967295}return[n[0]+i&4294967295,n[1]+o&4294967295,n[2]+c&4294967295,n[3]+a&4294967295,n[4]+u&4294967295,n[5]+h&4294967295,n[6]+f&4294967295,n[7]+d&4294967295]}const i=function(t){const n=8*t.length;for(t+="€";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);return t}(n);let o=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];for(let t=0;t<i.length;t+=64)o=s(i.substring(t,t+64),o);let c="";return o.forEach(t=>{for(let n=3;n>=0;n--)c+=(t>>>8*n&255).toString(16).padStart(2,"0")}),c},base64Encode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;const s=t?t.split("").map(t=>t.charCodeAt(0)):[];for(;r<s.length;){const t=s[r++],i=s[r++]||0,o=s[r++]||0,c=(15&i)<<2|o>>6,a=63&o;e+=n[t>>2]+n[(3&t)<<4|i>>4]+(r>s.length+1?"=":n[c])+(r>s.length?"=":n[a])}return e},base64Decode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");r<t.length;){const s=n.indexOf(t.charAt(r++)),i=n.indexOf(t.charAt(r++)),o=n.indexOf(t.charAt(r++)),c=n.indexOf(t.charAt(r++)),a=s<<2|i>>4,u=(15&i)<<4|o>>2,h=(3&o)<<6|c;e+=String.fromCharCode(a),64!==o&&(e+=String.fromCharCode(u)),64!==c&&(e+=String.fromCharCode(h))}return e},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}},E=new Map;async function D(t,n={}){const{crossOrigin:e="anonymous"}=n;return E.has(t)?E.get(t):new Promise((n,r)=>{const s=new Image;s.crossOrigin=e,s.onload=()=>{E.set(t,s),n(s)},s.onerror=()=>{r(new Error(`Failed to load image: ${t}`))},s.src=t})}async function N(t,n={}){const{type:e="text/javascript",async:r=!0,defer:s=!1}=n;return E.has(t)?E.get(t):new Promise((n,i)=>{const o=document.createElement("script");o.type=e,o.async=r,o.defer=s,o.onload=()=>{E.set(t,o),n(o)},o.onerror=()=>{o.remove(),i(new Error(`Failed to load script: ${t}`))},o.src=t,document.head.appendChild(o)})}async function R(t,n={}){const{media:e="all"}=n;return E.has(t)?E.get(t):new Promise((n,r)=>{const s=document.createElement("link");s.rel="stylesheet",s.href=t,s.media=e,s.onload=()=>{E.set(t,s),n(s)},s.onerror=()=>{s.remove(),r(new Error(`Failed to load stylesheet: ${t}`))},document.head.appendChild(s)})}const A={loadImage:D,loadImages:async function(t,n={}){const{parallel:e=!0}=n;if(e)return Promise.all(t.map(t=>D(t,n)));const r=[];for(const e of t)r.push(await D(e,n));return r},loadScript:N,loadStylesheet:R,loadFont:async function(t,n,e={}){const{weight:r="normal",style:s="normal"}=e,i=new FontFace(t,`url(${n})`,{weight:r,style:s});try{return await i.load(),document.fonts.add(i),i}catch(n){throw new Error(`Failed to load font: ${t}`)}},preload:async function(t,n="image"){switch(n){case"image":return D(t);case"script":return N(t);case"stylesheet":case"style":return R(t);default:throw new Error(`Unsupported preload type: ${n}`)}},isLoaded:function(t){return E.has(t)},clearCache:function(){E.clear()},clearCacheByUrl:function(t){E.delete(t)}},F={string:s,array:o,object:a,number:d,date:g,debounce:x,throttle:_,validator:j,crypto:C,preload:A};class T{constructor(){this.children={},this.keys=[]}}class P{constructor(){this.root=new T}insert(t){let n=this.root;const e=t.split(".");e.forEach((r,s)=>{n.children[r]||(n.children[r]=new T),n=n.children[r],s===e.length-1&&n.keys.push(t)})}getSubKeys(t){let n=this.root;const e=t.split("."),r=[];for(let t=0;t<e.length;t++){const s=e[t];if(!n.children[s])break;n=n.children[s];const i=t=>{t.keys.length>0&&r.push(...t.keys),Object.values(t.children).forEach(t=>i(t))};i(n)}return[...new Set(r)]}getParentKeys(t){const n=t.split("."),e=[];for(let t=1;t<=n.length;t++){const r=n.slice(0,t).join(".");e.push(r)}return e}}const I=Symbol("reactive_parent"),L=Symbol("reactive_path"),U=Symbol("reactive_is_reactive");class z{constructor(){this.rawData={},this.data=null,this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue=new Map,this.isProcessing=!1,this.pendingComputed=new Set,this.persistedKeys=new Map,this.snapshots=[],this.snapshotLimit=10,this._=new WeakMap,this.createReactiveData()}createReactiveData(){const t={get:(t,n,e)=>{if("__raw__"===n)return t;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,n):r},set:(t,n,e,r)=>{const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=this.resolvePath(t,n);return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{const e=Reflect.get(t,n,receiver),r=Reflect.deleteProperty(t,n),s=this.resolvePath(t,n);return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r}};this.data=new Proxy(this.rawData,t),this.data.v=null,this.data.S=""}wrapReactive(t,n){if(t[U])return t;if(this._.has(t))return this._.get(t);const e=new Proxy(t,{get:(t,n,e)=>{if("__raw__"===n)return t;if(n===I||"__parent__"===n)return t[I];if(n===L||"__path__"===n)return t[L];if(n===U||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[L]}${t[L]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=`${t[L]}${t[L]?".":""}${n}`;return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{if(n===I||n===L||n===U)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),s=`${t[L]}${t[L]?".":""}${n}`;return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r},has:(t,n)=>"__raw__"===n||n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==I&&t!==L&&t!==U),getOwnPropertyDescriptor:(t,n)=>n===I||n===L||n===U?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)});return t[I]=t,t[L]=n,t[U]=!0,this._.set(t,e),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),e}resolvePath(t,n){return t[L]?`${t[L]}.${n}`:n}queueUpdate(t,n){this.updateQueue.set(t,n),this.isProcessing||(this.isProcessing=!0,requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){const t=new Set;this.updateQueue.forEach((n,e)=>{t.add(e),this.updateElementsDirect(e,n);this.pathTrie.getSubKeys(e).forEach(n=>{if(!t.has(n)){const e=this.get(n);this.updateElementsDirect(n,e),t.add(n)}})}),this.updateQueue.clear(),this.processComputed(),this.isProcessing=!1}updateElementsDirect(t,n){this.elements[t]&&this.elements[t].forEach(t=>{this.updateElement(t,n)})}processComputed(){Object.keys(this.computedProperties).forEach(t=>{this.computedProperties[t].deps.some(t=>this.updateQueue.has(t)||this.pathTrie.getSubKeys(t).some(t=>this.updateQueue.has(t)))&&this.updateComputedProperty(t)})}set(t,n,e=!1){const r=this.get(t);"object"==typeof t?(Object.assign(this.rawData,t),Object.keys(t).forEach(n=>{e||(this.notify(n,t[n],r?.[n]),this.queueUpdate(n,t[n]))})):(t.includes(".")?this.setNested(t,n):this.rawData[t]=n,e||(this.notify(t,n,r),this.queueUpdate(t,n))),e||this.processComputed()}get(t){if(t)return t.includes(".")?this.getNested(t):this.rawData[t]}getNested(t){if(t)return t.split(".").reduce((t,n)=>t?.[n],this.rawData)}setNested(t,n){const e=t.split("."),r=e.pop(),s=e.reduce((t,n)=>(t[n]||(t[n]={}),t[n]),this.rawData),i=s[r];s[r]=n,this.notify(t,n,i),this.queueUpdate(t,n)}observe(t,n){this.observers[t]||(this.observers[t]=[]),this.observers[t].push(n)}unobserve(t,n){this.observers[t]&&(this.observers[t]=this.observers[t].filter(t=>t!==n))}notify(t,n,e){this.observers[t]&&this.observers[t].forEach(t=>{try{t(n,e)}catch(t){}}),this.observers["*"]?.forEach(r=>{try{r(t,n,e)}catch(t){}})}updateElement(t,n){const e=t.getAttribute("data-bind");if(!e)return;e.split("|").forEach(e=>{const r=e.split(":"),s=r[0].trim(),i=r[1]?.trim();switch(s){case"text":t.textContent!==String(n??"")&&(t.textContent=n??"");break;case"html":const e=function(t){if(!t)return"";let n=String(t);const e=/<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>|<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*\/?>/gi;let r;do{r=n,n=n.replace(e,"")}while(n!==r);return n=n.replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),n=n.replace(/(href|src|action|background)\s*=\s*(?:"[^"]*(?:javascript|vbscript|data)\s*:[^"]*"|'[^']*(?:javascript|vbscript|data)\s*:[^']*'|[^\s>]*(?:javascript|vbscript|data)\s*:[^\s>]*)/gi,'$1=""'),n=n.replace(/expression\s*\([^)]*\)/gi,""),n}(n);t.innerHTML!==e&&(t.innerHTML=e);break;case"value":"checkbox"===t.type?t.checked!==!!n&&(t.checked=!!n):t.value!==String(n??"")&&(t.value=n??"");break;case"checked":t.checked!==!!n&&(t.checked=!!n);break;case"disabled":t.disabled!==!!n&&(t.disabled=!!n);break;case"hidden":const r=n?"none":"";t.style.display!==r&&(t.style.display=r);break;case"class":i&&(n?t.classList.add(i):t.classList.remove(i));break;case"style":i&&t.style[i]!==String(n??"")&&(t.style[i]=n??"");break;case"attr":if(i){t.getAttribute(i)!==String(n??"")&&t.setAttribute(i,n??"")}break;case"src":t.src!==String(n??"")&&(t.src=n??"");break;case"href":t.href!==String(n??"")&&(t.href=n??"");break;case"placeholder":t.placeholder!==String(n??"")&&(t.placeholder=n??"")}})}computed(t,n,e){this.computedProperties[t]={deps:n,callback:e},n.forEach(t=>{this.pathTrie.insert(t)}),this.updateComputedProperty(t)}updateComputedProperty(t){const n=this.computedProperties[t];if(n)try{const e=n.deps.map(t=>this.get(t)),r=n.callback(...e);this.set(t,r,!0)}catch(t){}}load(t){Object.keys(t).forEach(n=>{t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])?this.rawData[n]=this.wrapReactive(t[n],n):this.rawData[n]=t[n],this.queueUpdate(n,this.rawData[n])}),this.processComputed()}reset(){this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue.clear(),this.snapshots=[],this.createReactiveData(),this.bind()}persist(t,n={}){const{storage:e="local",debounce:r=0,version:s=1,encrypt:i=!1,encryptionKey:o=null}=n,c="session"===e?sessionStorage:localStorage;this.persistedKeys.set(t,{storage:c,debounce:r,timeout:null,version:s,encrypt:i,encryptionKey:o});const a=this.get(t);void 0!==a&&this.$(t,a,c,{version:s,encrypt:i,encryptionKey:o}),this.observe(t,n=>{const e=this.persistedKeys.get(t);e&&(e.debounce>0?(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(()=>{this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey})},e.debounce)):this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey}))})}$(t,n,e,r={}){try{const{version:s=1,encrypt:i=!1,encryptionKey:o=null}=r,c={value:n,version:s,timestamp:Date.now()};let a=JSON.stringify(c);i&&o&&(a=this.O(a,o)),this.k(e),e.setItem(`kupola:${t}`,a)}catch(r){if("QuotaExceededError"===r.name&&e===localStorage)try{sessionStorage.setItem(`kupola:${t}`,JSON.stringify({value:n,version:1}))}catch(t){}}}k(t){try{const n="kupola:__storage_test__";t.setItem(n,"test"),t.removeItem(n)}catch(n){"QuotaExceededError"===n.name&&this.M(t)}}M(t){const n=Date.now();for(let e=0;e<t.length;e++){const r=t.key(e);if(r?.startsWith("kupola:"))try{const e=JSON.parse(t.getItem(r));e.timestamp&&n-e.timestamp>2592e6&&t.removeItem(r)}catch(n){t.removeItem(r)}}}O(t,n){return window.CryptoJS?window.CryptoJS.AES.encrypt(t,n).toString():t}j(t,n){if(!window.CryptoJS)return t;try{return window.CryptoJS.AES.decrypt(t,n).toString(window.CryptoJS.enc.Utf8)}catch(n){return t}}unpersist(t){const n=this.persistedKeys.get(t);n&&(n.timeout&&clearTimeout(n.timeout),n.storage.removeItem(`kupola:${t}`),this.persistedKeys.delete(t))}loadPersisted(t={}){const n={},{encryptionKey:e=null}=t;for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);if(s?.startsWith("kupola:")){const r=s.replace("kupola:","");try{const i=localStorage.getItem(s);let o;if(e){const t=this.j(i,e);o=JSON.parse(t)}else o=JSON.parse(i);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}for(let r=0;r<sessionStorage.length;r++){const s=sessionStorage.key(r);if(s?.startsWith("kupola:")){const r=s.replace("kupola:","");try{const i=sessionStorage.getItem(s);let o;if(e){const t=this.j(i,e);o=JSON.parse(t)}else o=JSON.parse(i);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}return Object.keys(n).length>0&&this.load(n),n}C(t){if("function"==typeof structuredClone)try{return structuredClone(t)}catch(t){}return JSON.parse(JSON.stringify(t))}snapshot(){const t=this.C(this.rawData);return this.snapshots.push(t),this.snapshots.length>this.snapshotLimit&&this.snapshots.shift(),this.snapshots.length-1}rollback(t=-1){if(0===this.snapshots.length)return!1;const n=t>=0?t:this.snapshots.length-1,e=this.snapshots[n];return!!e&&(this.rawData=this.C(e),this.createReactiveData(),Object.keys(this.rawData).forEach(t=>{this.queueUpdate(t,this.rawData[t])}),this.processComputed(),!0)}getSnapshotCount(){return this.snapshots.length}clearSnapshots(){this.snapshots=[]}serializeForm(t){const n={};return t.querySelectorAll("input, select, textarea").forEach(t=>{const e=t.getAttribute("data-bind");if(!e)return;const r=e.split(":"),s=r[1]?.trim();s&&("checkbox"===t.type?(n[s]||(n[s]=[]),t.checked&&n[s].push(t.value)):"radio"===t.type?t.checked&&(n[s]=t.value):n[s]=t.value)}),n}fillForm(t,n){Object.keys(n).forEach(e=>{t.querySelectorAll('[data-bind*=":'+e+'"]').forEach(t=>{"checkbox"===t.type?t.checked=Array.isArray(n[e])?n[e].includes(t.value):!!n[e]:"radio"===t.type?t.checked=t.value===n[e]:t.value=n[e]??""})})}createReactive(t,n=""){if(t[U])return t;if(this._.has(t))return this._.get(t);const e={get:(t,n,e)=>{if("__raw__"===n)return t;if(n===I||"__parent__"===n)return t[I];if(n===L||"__path__"===n)return t[L];if(n===U||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[L]}${t[L]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=`${t[L]}${t[L]?".":""}${n}`;return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{if(n===I||n===L||n===U)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),s=`${t[L]}${t[L]?".":""}${n}`;return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r},has:(t,n)=>"__raw__"===n||n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==I&&t!==L&&t!==U),getOwnPropertyDescriptor:(t,n)=>n===I||n===L||n===U?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)},r=new Proxy(t,e);return t[I]=t,t[L]=n,t[U]=!0,this._.set(t,r),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),r}bind(){document.querySelectorAll("[data-bind]").forEach(t=>{this.D(t)}),this.N||(this.R=!1,this.N=new MutationObserver(t=>{if(!this.R){this.R=!0;try{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.querySelectorAll("[data-bind]").forEach(t=>this.D(t)),t.hasAttribute&&t.hasAttribute("data-bind")&&this.D(t)}})})}finally{this.R=!1}}}),this.N.observe(document.body,{childList:!0,subtree:!0}))}D(t){const n=t.getAttribute("data-bind").split(":");n[0].split("|")[0].trim();const e=n[1]?.trim();if(e){if(this.pathTrie.insert(e),this.elements[e]||(this.elements[e]=[]),this.elements[e].includes(t)||this.elements[e].push(t),"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName){const n=t.A;n&&t.removeEventListener("input",n);const r=()=>{const n="checkbox"===t.type?t.checked:t.value;e.includes(".")?this.setNested(e,n):this.set(e,n)};t.A=r,t.addEventListener("input",r)}void 0!==this.rawData[e]&&this.updateElement(t,this.rawData[e])}}destroy(){this.N&&(this.N.disconnect(),this.N=null),Object.values(this.elements).forEach(t=>{t.forEach(t=>{const n=t.A;n&&(t.removeEventListener("input",n),delete t.A)})}),this.persistedKeys.forEach((t,n)=>{t.timeout&&clearTimeout(t.timeout)}),this.persistedKeys.clear(),this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue.clear(),this.snapshots=[]}}class H{constructor(t,n={}){this.name=t,this.F=`__store_${t}__`;const e=n.state?n.state():{};this.getters=n.getters||{},this.actions=n.actions||{},this.mutations=n.mutations||{},this.observers={},K?(K.set(this.F,e),this.state=K.data?.[this.F]||K.createReactive(e,this.F),K.observe(this.F,t=>{this.notify(t)})):this.state=e,this.T(),this.P()}T(){Object.keys(this.getters).forEach(t=>{Object.defineProperty(this,t,{get:()=>this.getters[t](this.state),enumerable:!0})})}P(){Object.keys(this.actions).forEach(t=>{this[t]=(...n)=>this.actions[t]({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},...n)})}commit(t,n){const e=this.mutations[t];e&&e(this.state,n)}dispatch(t,n){const e=this.actions[t];if(e)return e({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},n)}observe(t){return this.observers["*"]||(this.observers["*"]=[]),this.observers["*"].push(t),t}unobserve(t){this.observers["*"]&&(this.observers["*"]=this.observers["*"].filter(n=>n!==t))}notify(t){this.observers["*"]&&this.observers["*"].forEach(n=>{try{n(t)}catch(t){}}),K&&K.set(this.name,t)}toJSON(){return{name:this.name,state:this.state,getters:Object.keys(this.getters).reduce((t,n)=>(t[n]=this[n],t),{})}}}class B{constructor(){this.stores=new Map}createStore(t,n){const e=new H(t,n);return this.stores.set(t,e),e}getStore(t){return this.stores.get(t)}registerStore(t){t instanceof H&&this.stores.set(t.name,t)}dispose(){this.stores.clear()}}class J{constructor(){this.events={},this.delegatedEvents={},this.eventListeners={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),n}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(t=>t!==n))}emit(t,n){this.events[t]&&this.events[t].forEach(t=>{try{t(n)}catch(t){}}),this.events["*"]?.forEach(e=>{try{e(t,n)}catch(t){}})}once(t,n){const e=r=>{n(r),this.off(t,e)};return this.on(t,e),e}delegate(t,n,e){if(!this.delegatedEvents[n]){this.delegatedEvents[n]=[];const t=t=>{this.delegatedEvents[n].forEach(({selector:n,cb:e})=>{(t.target.matches(n)||t.target.closest(n))&&e(t)})};document.addEventListener(n,t),this.eventListeners[n]=t}return this.delegatedEvents[n].push({selector:t,cb:e}),e}undelegate(t,n){if(this.delegatedEvents[n]&&(this.delegatedEvents[n]=this.delegatedEvents[n].filter(n=>n.selector!==t),0===this.delegatedEvents[n].length)){const t=this.eventListeners[n];t&&(document.removeEventListener(n,t),delete this.eventListeners[n]),delete this.delegatedEvents[n]}}destroy(){Object.entries(this.eventListeners).forEach(([t,n])=>{document.removeEventListener(t,n)}),this.events={},this.delegatedEvents={},this.eventListeners={}}}function W(t=null){const n={I:t,L:new Set};return Object.defineProperty(n,"value",{configurable:!0,enumerable:!0,get:()=>n.I,set(t){t!==n.I&&(n.I=t,n.L.forEach(n=>n(t)))}}),n.subscribe=t=>(n.L.add(t),{unsubscribe(){n.L.delete(t)}}),n}const K=new z,q=new J,Y=new B;const Z={paths:{icons:"/icons/",base:"/"},theme:{default:"dark",brand:"zengqing"},i18n:{locale:"zh-CN",fallbackLocale:"en-US"},http:{baseURL:"",timeout:1e4,headers:{},withCredentials:!1},zIndex:{modal:1e3,dropdown:2e3,tooltip:2100,popover:2200,datepicker:2300,message:3e3,notification:3100,loading:5e3},ui:{defaultSize:"md",modal:{backdropClick:!0},dropdown:{closeOnClick:!0},datepicker:{weekStart:1},tooltip:{delay:300}},performance:{lazyLoad:!1,debounceDelay:200,throttleDelay:100,animationEnabled:!0},security:{xssProtection:!0,sanitizeHtml:{enabled:!0,allowedTags:["b","i","u","em","strong","a","br","p","span","div","img"],allowedAttributes:{a:["href","target","rel"],img:["src","alt","width","height"],span:["class","style"],div:["class","style"]}},maskData:{enabled:!0,patterns:{phone:{regex:"^(\\d{3})\\d{4}(\\d{4})$",replace:"$1****$2"},email:{regex:"^(.)(.*)(@.*)$",replace:"$1***$3"},idCard:{regex:"^(\\d{6})\\d{8}(\\d{4})$",replace:"$1********$2"},bankCard:{regex:"^(\\d{4})\\d{8}(\\d{4})$",replace:"$1 **** **** $2"}}},secureId:{length:16,charset:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}},message:{duration:3e3,position:"top-right",maxCount:5},notification:{duration:4500,position:"top-right"},validation:{defaultRules:[],showErrors:!0,trigger:"blur"},components:{autoInit:!0,silentErrors:!1}},X=[];function G(){if("undefined"!=typeof window&&window.kupolaConfig)try{it(Z,window.kupolaConfig),Q()}catch(t){}}function Q(){X.forEach(t=>{try{t(Z)}catch(t){}})}function V(t){"function"==typeof t&&X.push(t)}function tt(t){return t?function(t,n){return n.split(".").reduce((t,n)=>void 0!==(t&&t[n])?t[n]:void 0,t)}(Z,t):Z}function nt(){return Z.paths.base+Z.paths.icons.replace(/^\//,"")}function et(){return Z.theme.default}function rt(){return Z.theme.brand}function st(){return Z.security}function it(t,n){for(const e in n)n[e]instanceof Object&&e in t&&t[e]instanceof Object?it(t[e],n[e]):t[e]=n[e];return t}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",G):G());const ot="kupola-theme",ct="kupola-brand";V(t=>{const n=document.querySelector("[data-theme-toggle]");if(n){const t=ut();lt(n),ht(t)}});const at=[{id:"green",name:"翠绿",color:"#32F08C"},{id:"xionghuang",name:"雄黄",color:"#FF9900"},{id:"jianghuang",name:"姜黄",color:"#E2C027"},{id:"lanlv",name:"蓝绿",color:"#12A182"},{id:"kongquelan",name:"孔雀蓝",color:"#0EB0C9"},{id:"meiguizi",name:"玫瑰紫",color:"#BA2F7B"},{id:"shihong",name:"柿红",color:"#F2481B"},{id:"quhong",name:"紫云",color:"#B1A6CC"},{id:"shanchahong",name:"山茶红",color:"#F05A46"},{id:"zengqing",name:"曾青",color:"#535164"},{id:"roulan",name:"柔蓝",color:"#106898"}];function ut(){return localStorage.getItem(ot)||et()}function ht(t){if("dark"!==t&&"light"!==t)return;var n=document.documentElement;n.hasAttribute("data-kupola-theme-preloaded")&&(n.style.removeProperty("--bg-base-default"),n.style.removeProperty("--text-default"),n.removeAttribute("data-kupola-theme-preloaded")),n.setAttribute("data-theme",t),localStorage.setItem(ot,t);const e=document.querySelector("[data-theme-toggle]");e&&(e.setAttribute("data-current-theme",t),lt(e))}function ft(){return localStorage.getItem(ct)||rt()}function dt(t){const n=at.find(n=>n.id===t);if(!n)return;document.documentElement.setAttribute("data-brand",t),localStorage.setItem(ct,t);const e=document.querySelector("[data-brand-toggle]");if(e){e.setAttribute("data-current-brand",t);const r=e.querySelector(".brand-icon");r&&(r.style.backgroundColor=n.color);const s=e.querySelector(".brand-name");s&&(s.textContent=n.name)}document.querySelectorAll("[data-brand-btn]").forEach(n=>{n.getAttribute("data-brand-btn")===t?n.classList.add("is-active"):n.classList.remove("is-active")})}function lt(t){const n=t.querySelector(".theme-icon");if(n){const t=ut(),e=nt();n.src="dark"===t?e+"sun.svg":e+"moon.svg"}}function pt(t){t.preventDefault();ht("dark"===ut()?"light":"dark")}function mt(){var t=document.documentElement;t.hasAttribute("data-kupola-theme-preloaded")&&(t.style.removeProperty("--bg-base-default"),t.style.removeProperty("--text-default"),t.removeAttribute("data-kupola-theme-preloaded"));const n=document.querySelector("[data-theme-toggle]");ht(ut());dt(ft()),n&&(lt(n),n.removeEventListener("click",pt),n.addEventListener("click",pt));let e=document.getElementById("brand-picker");e||(e=document.createElement("div"),e.id="brand-picker",e.style.position="fixed",e.style.top="64px",e.style.right="16px",e.style.zIndex="9998",e.style.display="none",e.style.padding="12px",e.style.width="200px",e.style.gridTemplateColumns="repeat(3, 1fr)",e.style.gap="6px",e.style.backgroundColor="var(--bg-base-secondary)",e.style.border="1px solid var(--border-neutral-l1)",e.style.borderRadius="8px",e.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",e.style.overflow="hidden",at.forEach(t=>{const n=document.createElement("button");n.setAttribute("data-brand-btn",t.id),n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.height="60px",n.style.backgroundColor=t.color,n.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(t.color)?"#0C0C0D":"#FFFFFF",n.style.fontWeight="500",n.style.borderRadius="4px",n.style.border="none",n.style.cursor="pointer",n.style.margin="0",n.style.padding="0",n.textContent=t.name,e.appendChild(n)}),document.body.appendChild(e));const r=document.querySelector("[data-brand-toggle]");function s(t){e&&r&&(e.contains(t.target)||r.contains(t.target)||(e.style.display="none",document.removeEventListener("click",s,!0)))}r&&e&&(r.onclick=function(t){t.stopPropagation(),t.preventDefault();const n="none"===e.style.display;e.style.display=n?"grid":"none",n?setTimeout(()=>{document.addEventListener("click",s,!0)},0):document.removeEventListener("click",s,!0)},e.onclick=function(t){t.stopPropagation()});document.querySelectorAll("[data-brand-btn]").forEach(t=>{t.addEventListener("click",n=>{n.stopPropagation();dt(t.getAttribute("data-brand-btn")),e&&(e.style.display="none")})})}class yt{constructor(){this.initializers=new Map,this.cleanupFunctions=new Map,this.processedElements=new WeakSet,this.U=["data-component"],this.H=[],this.B=null}register(t,n,e=null,r={}){this.initializers.set(t,n),e&&this.cleanupFunctions.set(t,e),r.dataAttribute&&!this.U.includes(r.dataAttribute)&&(this.U.push(r.dataAttribute),this.B=null),r.cssClass&&!this.H.includes(r.cssClass)&&(this.H.push(r.cssClass),this.B=null)}unregister(t){this.initializers.delete(t),this.cleanupFunctions.delete(t)}has(t){return this.initializers.has(t)}get(t){return this.initializers.get(t)}J(){if(null!==this.B)return this.B;const t=this.U.map(t=>`[${t}]`);for(const n of this.H)t.push(`.${n}`);return this.B=t.join(", "),this.B}async initialize(t){if(this.processedElements.has(t))return;for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),s=this.initializers.get(r)||this.initializers.get(n.replace("data-",""));if(s){try{await s(t),this.processedElements.add(t)}catch(t){}return}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.initializers.get(n)||this.initializers.get(e);if(r){try{await r(t),this.processedElements.add(t)}catch(t){}return}}}}cleanup(t){for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),s=this.cleanupFunctions.get(r)||this.cleanupFunctions.get(n.replace("data-",""));if(s){try{s(t)}catch(t){}return void this.processedElements.delete(t)}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.cleanupFunctions.get(n)||this.cleanupFunctions.get(e);if(r){try{r(t)}catch(t){}return void this.processedElements.delete(t)}}}}async initializeAll(t=document){const n=this.J();if(!n)return;const e=t.querySelectorAll(n),r=[];e.forEach(t=>{this.processedElements.has(t)||r.push(this.initialize(t))}),await Promise.all(r)}}const wt=new yt,bt=[{attr:"data-dropdown",cls:"ds-dropdown"},{attr:"data-select",cls:"ds-select"},{attr:"data-datepicker",cls:"ds-datepicker"},{attr:"data-timepicker",cls:"ds-timepicker"},{attr:"data-slider",cls:"ds-slider"},{attr:"data-carousel",cls:"ds-carousel"},{attr:"data-drawer",cls:"ds-drawer"},{attr:"data-modal",cls:"ds-modal"},{attr:"data-dialog",cls:"ds-dialog"},{attr:"data-color-picker",cls:"ds-color-picker"},{attr:"data-calendar",cls:"ds-calendar"},{attr:"data-slide-captcha",cls:"ds-slide-captcha"},{attr:"data-heatmap",cls:"ds-heatmap"},{cls:"ds-tooltip"},{cls:"ds-tag"},{cls:"ds-statcard"},{cls:"ds-collapse"},{cls:"ds-fileupload"},{cls:"ds-notification"},{cls:"ds-message"}];for(const t of bt)t.attr&&!wt.U.includes(t.attr)&&wt.U.push(t.attr),t.cls&&!wt.H.includes(t.cls)&&wt.H.push(t.cls);class gt{constructor(n){this.element=n,this.isMounted=!1,this.isDestroyed=!1,this.props=this.W(),this.state={},this.slots=this.K(),this.q={},this.Y=[],this.lifecycle=new t,this.setupContext=null}W(){const t={};for(const n of this.element.attributes)if(n.name.startsWith("data-prop-")){const e=n.name.replace("data-prop-","");let r=n.value;try{r=JSON.parse(r)}catch(t){}t[e]=r}return t}K(){const t={};return this.element.querySelectorAll("[data-slot]").forEach(n=>{const e=n.getAttribute("data-slot")||"default";t[e]=n.innerHTML.trim(),n.remove()}),!t.default&&this.element.children.length>0&&(t.default=this.element.innerHTML.trim()),t}$slot(t="default"){return this.slots[t]||""}$emit(t,n){if((this.q[t]||[]).forEach(t=>{try{t(n)}catch(t){}}),this.element){const e=new CustomEvent(`kupola:${t}`,{detail:n,bubbles:!0,cancelable:!0});this.element.dispatchEvent(e)}}$on(t,n){return this.q[t]||(this.q[t]=[]),this.q[t].push(n),n}$off(t,n){this.q[t]&&(this.q[t]=this.q[t].filter(t=>t!==n))}async setProps(t){try{this.props={...this.props,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setProps",error:n,args:[t]})}}async setState(t){try{this.state={...this.state,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setState",error:n,args:[t]})}}async mount(){if(!this.isMounted&&!this.isDestroyed)try{if(this.X(),await this.lifecycle.bootstrap(),"function"==typeof this.setup){const t=this.setup();t instanceof Promise&&await t}this.isMounted=!0,await this.lifecycle.mount(),this.setupContext?.G()}catch(t){if(this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"mount",hook:"component",error:t,args:[]}),"function"==typeof this.renderError)try{this.renderError(t)}catch(t){}else this.element.innerHTML=`\n <div style="padding: 16px; background: #fee2e2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b;">\n <div style="font-weight: bold; margin-bottom: 8px;">Component Error</div>\n <div style="font-size: 12px; white-space: pre-wrap;">${t.message}</div>\n </div>\n `}}X(){if(this.V)return;const t={beforeMount:"beforeMount",render:["mount","update"],afterMount:"afterMount",updated:"afterUpdate",beforeUnmount:"beforeUnmount",afterUnmount:"afterUnmount",renderError:"errorBoundary"};let n=Object.getPrototypeOf(this);const e=new Set;for(;n&&n.constructor!==Object&&n.constructor!==gt;){for(const[r,s]of Object.entries(t))e.has(r)||n.hasOwnProperty(r)&&(Array.isArray(s)?s.forEach(t=>{"render"===r&&this.lifecycle.on(t,()=>this.render?.())}):"renderError"===r?this.lifecycle.on(s,t=>(this.renderError(t.error),"handled")):this.lifecycle.on(s,()=>this[r]?.()),e.add(r));n=Object.getPrototypeOf(n)}this.V=!0}async unmount(){if(this.isMounted&&!this.isDestroyed)try{this.setupContext?.tt(),await this.lifecycle.unmount(),this.isMounted=!1,this.isDestroyed=!0,await this.lifecycle.destroy()}catch(t){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"unmount",hook:"component",error:t,args:[]}),this.isMounted=!1,this.isDestroyed=!0}}beforeMount(){}afterMount(){}beforeUnmount(){}afterUnmount(){}render(){}renderError(t){}updated(){}setup(){}}function xt(t,n){Object.keys(n).forEach(e=>{if("constructor"!==e)if("function"==typeof n[e]){const r=t.prototype[e];t.prototype[e]=r?function(...t){return n[e].apply(this,t),r.apply(this,t)}:n[e]}else t.prototype[e]=n[e]})}class _t{constructor(){this.components=new Map,this.lazyComponents=new Map,this.loadedComponents=new Map,this.instances=new Map,this.observer=null,this.mixins=new Map,this.loadingPromises=new Map}register(t,n){if(!(n.prototype instanceof gt))throw new Error(`Component ${t} must extend KupolaComponent`);this.components.set(t,n)}registerLazy(t,n){this.lazyComponents.set(t,n)}unregister(t){this.components.delete(t),this.lazyComponents.delete(t),this.loadedComponents.delete(t),this.loadingPromises.delete(t)}get(t){return this.components.get(t)||this.loadedComponents.get(t)}async getAsync(t){const n=this.components.get(t)||this.loadedComponents.get(t);if(n)return n;if(this.loadingPromises.has(t))return this.loadingPromises.get(t);const e=this.lazyComponents.get(t);if(!e)throw new Error(`Component ${t} not found`);const r=(async()=>{try{const n=await e(),r=n.default||n;if(!(r.prototype instanceof gt))throw new Error(`Component ${t} must extend KupolaComponent`);return this.loadedComponents.set(t,r),r}catch(n){throw this.loadingPromises.delete(t),n}})();return this.loadingPromises.set(t,r),r}defineMixin(t,n){this.mixins.set(t,n)}useMixin(t,...n){n.forEach(n=>{const e=this.mixins.get(n);e&&xt(t,e)})}async bootstrap(t=document){await this.nt(t),this.et(t)}async nt(t){const n=t.querySelectorAll("[data-component]"),e=[];n.forEach(t=>{e.push(this.rt(t))}),await Promise.all(e)}async rt(t){if(!t.st&&!t.it){t.it=!0;try{const n=t.getAttribute("data-component");if(n){const e=wt.get(n);if(e)try{return void await e(t)}catch(t){}}let e=this.components.get(n);if(!e){try{e=await this.getAsync(n)}catch(t){return}if(!t.isConnected)return}const r=t.getAttribute("data-mixins"),s=e;r&&r.split(",").forEach(t=>{const n=this.mixins.get(t.trim());n&&xt(s,n)});const i=new s(t);t.st=i,this.instances.set(t,i),i.mount()}finally{t.it=!1}}}et(t){this.observer||(this.observer=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.hasAttribute("data-component")&&this.rt(t).catch(t=>{}),this.nt(t).catch(t=>{}),wt.initialize(t).catch(()=>{});const n=wt.J();n&&t.querySelectorAll?.(n).forEach(t=>{wt.initialize(t).catch(()=>{})})}}),t.removedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t)),t.querySelectorAll("[data-component]").forEach(t=>{const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t))}),wt.cleanup(t),t.querySelectorAll?.("*").forEach(t=>{wt.cleanup(t)})}})})}),this.observer.observe(t,{childList:!0,subtree:!0}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.instances.forEach(t=>{t.unmount()}),this.instances.clear(),this.components.clear(),this.mixins.clear()}}async function vt(){if("undefined"!=typeof window){!function(){if(st().xssProtection&&"undefined"!=typeof document){let t=document.querySelector('meta[http-equiv="X-XSS-Protection"]');t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-XSS-Protection"),t.setAttribute("content","1; mode=block"),document.head.insertBefore(t,document.head.firstChild)),t=document.querySelector('meta[http-equiv="X-Content-Type-Options"]'),t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-Content-Type-Options"),t.setAttribute("content","nosniff"),document.head.insertBefore(t,document.head.firstChild))}}();const t=tt();K.loadPersisted(),K.bind(),mt(),!1!==t.components?.autoInit&&(await wt.initializeAll(),exports.kupolaRegistry&&await exports.kupolaRegistry.bootstrap())}}exports.kupolaRegistry=null,"undefined"!=typeof window&&(exports.kupolaRegistry=new _t),"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",vt):"undefined"!=typeof window&&setTimeout(vt,0);class St{constructor(t={}){const n=tt();this.locales=t.locales||{},this.currentLocale=t.defaultLocale||n.i18n?.locale||"zh-CN",this.fallbackLocale=t.fallbackLocale||n.i18n?.fallbackLocale||"en-US",this.delimiter=t.delimiter||".",this.missingHandler=t.missingHandler||(t=>t),this.ot()}ot(){document.querySelectorAll('script[type="application/json"][data-kupola-i18n]').forEach(t=>{const n=t.dataset.kupolaI18n;if(n)try{const e=JSON.parse(t.textContent);this.addLocale(n,e)}catch(t){}});const t=document.documentElement.lang;t&&this.locales[t]&&(this.currentLocale=t)}addLocale(t,n){this.locales[t]||(this.locales[t]={}),this.ct(this.locales[t],n)}ct(t,n){for(const e of Object.keys(n))n[e]instanceof Object&&e in t?this.ct(t[e],n[e]):t[e]=n[e]}setLocale(t){return!!this.locales[t]&&(this.currentLocale=t,document.documentElement.lang=t,this.ut(),!0)}getLocale(){return this.currentLocale}t(t,n={}){let e=this.ht(t,this.currentLocale);return e||(e=this.ht(t,this.fallbackLocale)),e?this.ft(e,n):this.missingHandler(t)}ht(t,n){if(!this.locales[n])return null;const e=t.split(this.delimiter);let r=this.locales[n];for(const t of e){if(!r||"object"!=typeof r||!(t in r))return null;r=r[t]}return"string"==typeof r?r:null}ft(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>void 0!==n[e]?n[e]:t)}n(t,n,e={}){const r=this.t(t,{...e,count:n});if(!r)return r;const s=r.split("|");return 1===s.length?r.replace("{count}",n):2===s.length?1===n?s[0]:s[1]:s.length>=3?0===n?s[0]:1===n?s[1]:s[2]:r}ut(){const t=new CustomEvent("kupola:i18n:change",{detail:{locale:this.currentLocale},bubbles:!0});document.dispatchEvent(t)}async loadLocale(t,n){try{const e=await fetch(n),r=await e.json();return this.addLocale(t,r),!0}catch(t){return!1}}getAvailableLocales(){return Object.keys(this.locales)}hasLocale(t){return!!this.locales[t]}formatDate(t,n={}){const e=n.locale||this.currentLocale,r="string"==typeof t?new Date(t):t;return new Intl.DateTimeFormat(e,n).format(r)}formatNumber(t,n={}){const e=n.locale||this.currentLocale;return new Intl.NumberFormat(e,n).format(t)}formatCurrency(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.NumberFormat(r,{style:"currency",currency:n,...e}).format(t)}formatRelativeTime(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.RelativeTimeFormat(r,e).format(t,n)}}const $t=new St;class Ot{constructor(){this.dt=new Map,this.lt=new Map}on(t,n,e,r={}){const{scope:s=null,once:i=!1,passive:o=!1,capture:c=!1}=r,a=this.yt(),u={id:a,target:t,eventName:n,handler:e,scope:s,once:i,wrappedHandler:null};u.wrappedHandler=n=>{i&&this.offById(a),e.call(t,n)};const h=this.wt(t,n);return this.dt.has(h)||this.dt.set(h,[]),this.dt.get(h).push(u),s&&(this.lt.has(s)||this.lt.set(s,[]),this.lt.get(s).push(a)),t.addEventListener(n,u.wrappedHandler,{passive:o,capture:c}),{unsubscribe:()=>this.offById(a)}}once(t,n,e,r={}){return this.on(t,n,e,{...r,once:!0})}off(t,n,e){const r=this.wt(t,n);if(!this.dt.has(r))return;const s=this.dt.get(r),i=s.filter(t=>t.handler!==e);s.forEach(r=>{r.handler===e&&(t.removeEventListener(n,r.wrappedHandler),this.bt(r))}),0===i.length?this.dt.delete(r):this.dt.set(r,i)}offById(t){for(const[n,e]of this.dt){const r=e.findIndex(n=>n.id===t);if(-1!==r){const t=e[r];return t.target.removeEventListener(t.eventName,t.wrappedHandler),e.splice(r,1),0===e.length&&this.dt.delete(n),this.bt(t),!0}}return!1}offByScope(t){if(!this.lt.has(t))return;this.lt.get(t).forEach(t=>{this.offById(t)}),this.lt.delete(t)}offAll(t,n=null){if(n){const e=this.wt(t,n);if(!this.dt.has(e))return;this.dt.get(e).forEach(e=>{t.removeEventListener(n,e.wrappedHandler),this.bt(e)}),this.dt.delete(e)}else for(const[n,e]of this.dt){const[r]=n.split(":");this.gt(t)===r&&(e.forEach(n=>{t.removeEventListener(n.eventName,n.wrappedHandler),this.bt(n)}),this.dt.delete(n))}}emit(t,n,e={}){const r=new CustomEvent(n,{detail:e,bubbles:!0,cancelable:!0});return t.dispatchEvent(r),r}emitGlobal(t,n={}){return this.emit(document,t,n)}emitToScope(t,n,e={}){if(!this.lt.has(t))return;const r=this.lt.get(t),s=new Set;for(const[t,n]of this.dt)n.forEach(t=>{r.includes(t.id)&&s.add(t.target)});s.forEach(t=>{this.emit(t,n,e)})}getListenerCount(t,n=null){if(n){const e=this.wt(t,n);return this.dt.has(e)?this.dt.get(e).length:0}let e=0;const r=this.gt(t);for(const[t,n]of this.dt){const[s]=t.split(":");s===r&&(e+=n.length)}return e}getScopeListenerCount(t){return this.lt.has(t)?this.lt.get(t).length:0}hasListeners(t,n=null){return this.getListenerCount(t,n)>0}wt(t,n){return`${this.gt(t)}:${n}`}gt(t){return t===document?"document":t===window?"window":t===document.body?"body":(t.xt||(t.xt=this.yt()),t.xt)}yt(){return`ge-${Math.random().toString(36).substr(2,9)}-${Date.now()}`}bt(t){if(!t.scope||!this.lt.has(t.scope))return;const n=this.lt.get(t.scope),e=n.indexOf(t.id);-1!==e&&(n.splice(e,1),0===n.length&&this.lt.delete(t.scope))}destroy(){for(const[t,n]of this.dt)n.forEach(t=>{t.target.removeEventListener(t.eventName,t.wrappedHandler)});this.dt.clear(),this.lt.clear()}}const kt=new Ot;class Mt{constructor(){this._t=new Set,this.vt=!1,this.St=0,this.$t=10}schedule(t){this._t.add(t),this.vt||(this.vt=!0,queueMicrotask(()=>this.Ot()))}Ot(){if(this.St>=this.$t)return this._t.clear(),void(this.vt=!1);const t=Array.from(this._t);this._t.clear(),this.vt=!1,this.St++;const n=new Set;for(const e of t)if(!n.has(e)){n.add(e);try{e()}catch(t){}}this.St--}}const jt=new Mt;class Ct{constructor(t,n){this.data=t,this.createdAt=Date.now(),this.ttl=n}get isFresh(){return Date.now()-this.createdAt<this.ttl}get isStale(){return!this.isFresh}}class Et{constructor(){this.kt=new Map}get(t){const n=this.kt.get(t);return n||null}set(t,n,e=6e4){this.kt.set(t,new Ct(n,e))}has(t){return this.kt.has(t)}delete(t){this.kt.delete(t)}clear(){this.kt.clear()}getStale(t){const n=this.kt.get(t);return n?n.data:null}}class Dt extends Error{constructor(t,n,e){super(t),this.name="DependsError",this.code=n,this.cause=e,this.timestamp=Date.now()}}let Nt="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null;class Rt{constructor(t,n){this.config=t,this.cacheKey=t.cacheKey||String(t.source),this.staleTime=t.staleTime??6e4,this.cache=n,this.subscribers=[],this.pending=null,this.retryCount=t.retry??0,this.retryDelay=t.retryDelay??1e3,this.onError=t.onError||null}subscribe(t){return this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);n>-1&&this.subscribers.splice(n,1)}}notify(){jt.schedule(()=>{this.subscribers.forEach(t=>{try{t()}catch(t){}})})}async fetch(t){throw new Dt("Source fetch not implemented","NOT_IMPLEMENTED")}async getValue(t){const n=this.cache.get(this.cacheKey);return n&&n.isFresh?n.data:n&&n.isStale?(this.Mt(t),n.data):this.jt(t)}async jt(t,n=0){try{const n=await this.fetch(t);return this.cache.set(this.cacheKey,n,this.staleTime),this.notify(),n}catch(e){if(n<this.retryCount){const e=this.retryDelay*Math.pow(2,n),r=e+Math.random()*e*.5;return await new Promise(t=>setTimeout(t,r)),this.jt(t,n+1)}const r=e instanceof Dt?e:new Dt(e.message||"Fetch failed","FETCH_ERROR",e);if(this.onError)try{this.onError(r)}catch(t){}throw r}}async Mt(t){try{await this.jt(t)}catch(t){}}invalidate(){this.cache.delete(this.cacheKey),this.pending=null}destroy(){this.subscribers=[],this.pending=null}}class At extends Rt{constructor(t,n){super(t,n),this.method=t.method||"GET",this.headers=t.headers||{},this.queryParams=t.query||{}}async fetch(t){let n=this.config.source;const e=tt("http");!e?.baseURL||n.startsWith("http://")||n.startsWith("https://")||(n=e.baseURL+n.replace(/^\//,""));for(const e in t)n=n.replace(`:${e}`,encodeURIComponent(t[e]));const r=[];for(const[t,n]of Object.entries(this.queryParams||{}))r.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);for(const n in t)this.config.source.includes(`:${n}`)||r.push(`${encodeURIComponent(n)}=${encodeURIComponent(t[n])}`);r.length>0&&(n+=(n.includes("?")?"&":"?")+r.join("&"));const s=e?.headers||{},i={method:this.method.toUpperCase(),headers:{"Content-Type":"application/json",...s,...this.headers}};e?.withCredentials&&(i.credentials="include"),["POST","PUT","PATCH"].includes(i.method)&&(i.body=JSON.stringify(t));const o=Nt;if(!o)throw new Dt("No HTTP client available. Use configureHttpClient() to set one.","NO_HTTP_CLIENT");const c=await o(n,i),a="boolean"==typeof c.ok?c.ok:c.status>=200&&c.status<300,u="number"==typeof c.status?c.status:0;if(!a)throw new Dt(`HTTP ${u}`,"HTTP_ERROR");return"function"==typeof c.json?await c.json():void 0!==c.data?c.data:c}}class Ft extends Rt{constructor(t,n){super(t,n),this.storageKey=t.source.replace("localStorage:",""),this.defaultValue=t.default,this.sync=!1!==t.sync,this.sync&&"undefined"!=typeof window&&(this.Ct=t=>{t.key===this.storageKey&&(this.cache.delete(this.cacheKey),this.notify())},window.addEventListener("storage",this.Ct))}async fetch(){try{const t=localStorage.getItem(this.storageKey);if(null===t)return this.defaultValue;try{return JSON.parse(t)}catch(n){return t}}catch(t){return this.defaultValue}}setValue(t){const n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(this.storageKey,n),this.cache.delete(this.cacheKey),this.notify()}destroy(){super.destroy(),this.Ct&&window.removeEventListener("storage",this.Ct)}}class Tt extends Rt{constructor(t,n){super(t,n),this.paramName=t.source.replace("route:","")}async fetch(){if("undefined"==typeof window)return"";const t=location.hash.slice(1).match(new RegExp(`/${this.paramName}/([^/]+)`));if(t)return decodeURIComponent(t[1]);return new URLSearchParams(location.search).get(this.paramName)||""}}class Pt extends Rt{async fetch(t){return await this.config.source(t)}}class It extends Rt{async fetch(){return this.config.source}}class Lt extends Rt{constructor(t,n){super(t,n),this.ws=null,this.reconnect=!1!==t.reconnect,this.reconnectDelay=t.reconnectDelay||3e3,this.Et=0,this.Dt=t.maxReconnectDelay||3e4,this.messageHandler=null,this.Nt=!1,this.Rt=!1}async fetch(){return new Promise((t,n)=>{try{this.ws=new WebSocket(this.config.source),this.ws.onopen=()=>{this.Nt=!0,this.Et=0,t(this.cache.getStale(this.cacheKey))},this.messageHandler=t=>{let n;try{n=JSON.parse(t.data)}catch(e){n=t.data}this.cache.set(this.cacheKey,n,this.staleTime),this.notify()},this.ws.onmessage=this.messageHandler,this.ws.onerror=t=>{this.Nt||n(new Dt("WebSocket connection failed","WS_ERROR",t))},this.ws.onclose=()=>{if(this.Nt=!1,this.reconnect&&!this.Rt){const t=this.reconnectDelay*Math.pow(2,this.Et),n=Math.random()*t*.3,e=Math.min(t+n,this.Dt);this.Et++,setTimeout(()=>{this.Rt||this.fetch().catch(()=>{})},e)}}}catch(t){n(new Dt("WebSocket creation failed","WS_ERROR",t))}})}send(t){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send("string"==typeof t?t:JSON.stringify(t))}destroy(){this.Rt=!0,super.destroy(),this.ws&&(this.ws.onmessage=null,this.ws.onclose=null,this.ws.close(),this.ws=null)}}function Ut(t,n){const e=t.source;return"function"==typeof e?new Pt(t,n):"string"==typeof e&&(e.startsWith("ws://")||e.startsWith("wss://"))?new Lt(t,n):"string"==typeof e&&(e.startsWith("/")||e.startsWith("http"))?new At(t,n):"string"==typeof e&&e.startsWith("localStorage:")?new Ft(t,n):"string"==typeof e&&e.startsWith("route:")?new Tt(t,n):new It(t,n)}function zt(t){const n={};for(const e in t){const r=t[e];n[e]=r&&"object"==typeof r&&"value"in r?r.value:r}return n}exports.BRAND_OPTIONS=at,exports.CacheEntry=Ct,exports.CacheManager=Et,exports.ComponentInitializerRegistry=yt,exports.DependsError=Dt,exports.DependsSource=Rt,exports.FetchedSource=At,exports.FunctionSource=Pt,exports.GlobalEvents=Ot,exports.KupolaComponent=gt,exports.KupolaComponentRegistry=_t,exports.KupolaDataBind=z,exports.KupolaEventBus=J,exports.KupolaI18n=St,exports.KupolaLifecycle=t,exports.KupolaStore=H,exports.KupolaStoreManager=B,exports.KupolaUtils=F,exports.RouteSource=Tt,exports.Scheduler=Mt,exports.StaticSource=It,exports.StorageSource=Ft,exports.WebSocketSource=Lt,exports.applyMixin=xt,exports.arrayUtils=o,exports.bootstrapComponents=function(t){return exports.kupolaRegistry?exports.kupolaRegistry.bootstrap(t):Promise.resolve()},exports.clearCache=function(){},exports.configureHttpClient=function(t){if(!t||"function"!=typeof t.fetch)throw new TypeError("[Kupola] configureHttpClient: client must provide a fetch function");Nt=t.fetch.bind(t)},exports.createBrandPicker=function(){const t=document.createElement("div");t.id="brand-picker-auto",t.style.position="fixed",t.style.top="56px",t.style.right="16px",t.style.zIndex="9998",t.style.display="none",t.style.padding="12px",t.style.width="200px",t.style.gridTemplateColumns="repeat(3, 1fr)",t.style.gap="6px",t.style.backgroundColor="var(--bg-base-secondary)",t.style.border="1px solid var(--border-neutral-l1)",t.style.borderRadius="8px",t.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",t.style.overflow="hidden",at.forEach(n=>{const e=document.createElement("button");e.setAttribute("data-brand-btn",n.id),e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.height="60px",e.style.backgroundColor=n.color,e.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(n.color)?"#0C0C0D":"#FFFFFF",e.style.fontWeight="500",e.style.borderRadius="4px",e.style.border="none",e.style.cursor="pointer",e.style.margin="0",e.style.padding="0",e.textContent=n.name,t.appendChild(e)}),document.body.appendChild(t);const n=document.createElement("button");n.setAttribute("data-brand-toggle",""),n.setAttribute("data-current-brand",ft()),n.className="ds-btn ds-btn--ghost ds-btn--sm",n.style.position="fixed",n.style.top="16px",n.style.right="56px",n.style.zIndex="9999",n.style.display="flex",n.style.alignItems="center",n.style.gap="6px";const e=document.createElement("span");e.className="brand-icon",e.style.width="12px",e.style.height="12px",e.style.borderRadius="50%",e.style.backgroundColor=at.find(t=>t.id===ft()).color;const r=document.createElement("span");function s(e){t.contains(e.target)||n.contains(e.target)||(t.style.display="none",document.removeEventListener("click",s,!0))}return r.className="brand-name",r.style.fontSize="11px",r.textContent=at.find(t=>t.id===ft()).name,n.appendChild(e),n.appendChild(r),document.body.appendChild(n),n.onclick=function(n){n.stopPropagation(),n.preventDefault();const e="none"===t.style.display;t.style.display=e?"grid":"none",e?setTimeout(()=>{document.addEventListener("click",s,!0)},0):document.removeEventListener("click",s,!0)},t.onclick=function(t){t.stopPropagation()},t.querySelectorAll("[data-brand-btn]").forEach(n=>{n.addEventListener("click",e=>{e.stopPropagation();dt(n.getAttribute("data-brand-btn")),t.style.display="none"})}),{toggleBtn:n,container:t}},exports.createI18n=function(t){return new St(t)},exports.createLifecycle=function(n="app"){return new t(n)},exports.createSource=Ut,exports.createStore=function(t,n){return Y.createStore(t,n)},exports.createThemeToggle=function(){const t=document.createElement("button");t.setAttribute("data-theme-toggle",""),t.setAttribute("data-current-theme",ut()),t.className="ds-btn ds-btn--ghost ds-btn--sm ds-btn--icon",t.style.position="fixed",t.style.top="16px",t.style.right="16px",t.style.zIndex="9999";const n=document.createElement("img");n.className="theme-icon";const e=nt();return n.src="dark"===ut()?e+"sun.svg":e+"moon.svg",n.width=14,n.height=14,n.alt="Toggle theme",t.appendChild(n),document.body.appendChild(t),t.onclick=function(t){t.preventDefault();ht("dark"===ut()?"light":"dark")},t},exports.cryptoUtils=C,exports.dateUtils=g,exports.debounce=x,exports.defineComponent=function(t,n){if(!n||"object"!=typeof n)throw new Error(`defineComponent("${t}"): options must be an object`);n.componentClass?exports.kupolaRegistry&&exports.kupolaRegistry.register(t,n.componentClass):n.lazy&&exports.kupolaRegistry&&exports.kupolaRegistry.registerLazy(t,n.lazy),n.init?wt.register(t,n.init,n.cleanup||null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass}):(n.dataAttribute||n.cssClass)&&wt.register(t,()=>{},null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass})},exports.defineMixin=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.defineMixin(t,n)},exports.emit=function(t,n,e){return kt.emit(t,n,e)},exports.emitGlobal=function(t,n){return kt.emitGlobal(t,n)},exports.escapeHtml=function(t){if("string"!=typeof t)return t;const n=document.createElement("div");return n.textContent=t,n.innerHTML},exports.formatCurrency=function(t,n,e={}){return $t.formatCurrency(t,n,e)},exports.formatDate=function(t,n={}){return $t.formatDate(t,n)},exports.formatNumber=function(t,n={}){return $t.formatNumber(t,n)},exports.generateSecureId=function(t,n){const e=st(),r=e?.secureId||{},s=t||r.length||16,i=r.charset||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";if("undefined"==typeof crypto||!crypto.getRandomValues){let t="";for(let n=0;n<s;n++)t+=i[Math.floor(Math.random()*i.length)];return n?`${n}_${t}`:t}const o=new Uint32Array(s);crypto.getRandomValues(o);let c="";for(let t=0;t<s;t++)c+=i[o[t]%i.length];return n?`${n}_${c}`:c},exports.getBasePath=function(){return Z.paths.base},exports.getBrand=ft,exports.getConfig=tt,exports.getDefaultBrand=rt,exports.getDefaultTheme=et,exports.getHttpClient=function(){return Nt},exports.getHttpConfig=function(){return Z.http},exports.getIconsPath=nt,exports.getListenerCount=function(t,n){return kt.getListenerCount(t,n)},exports.getLocale=function(){return $t.getLocale()},exports.getMessageConfig=function(){return Z.message},exports.getNotificationConfig=function(){return Z.notification},exports.getPerformanceConfig=function(){return Z.performance},exports.getSecurityConfig=st,exports.getStore=function(t){return Y.getStore(t)},exports.getTheme=ut,exports.getUiConfig=function(){return Z.ui},exports.getValidationConfig=function(){return Z.validation},exports.globalEvents=kt,exports.initTheme=mt,exports.kupolaBootstrap=vt,exports.kupolaData=K,exports.kupolaEvents=q,exports.kupolaI18n=$t,exports.kupolaInitializer=wt,exports.kupolaLifecycle=n,exports.kupolaStoreManager=Y,exports.maskData=function(t,n,e={}){const r=st(),s=r?.maskData||{};if(!s.enabled&&!e.force)return t;if(null==t)return t;const i=(e.patterns||s.patterns||{})[n];if(!i)return t;const o="string"==typeof i.regex?new RegExp(i.regex):i.regex;return String(t).replace(o,i.replace)},exports.n=function(t,n,e={}){return $t.n(t,n,e)},exports.numberUtils=d,exports.objectUtils=a,exports.off=function(t,n,e){kt.off(t,n,e)},exports.offAll=function(t,n){kt.offAll(t,n)},exports.offByScope=function(t){kt.offByScope(t)},exports.offConfigChange=function(t){const n=X.indexOf(t);n>-1&&X.splice(n,1)},exports.on=function(t,n,e,r){return kt.on(t,n,e,r)},exports.onConfigChange=V,exports.once=function(t,n,e,r){return kt.once(t,n,e,r)},exports.preloadUtils=A,exports.ref=W,exports.registerComponent=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.register(t,n)},exports.registerLazyComponent=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.registerLazy(t,n)},exports.resetHttpClient=function(){Nt="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null},exports.sanitizeHtml=function(t,n={}){const e=st(),r=e?.sanitizeHtml||{};if(!r.enabled&&!n.force)return t;const s=n.allowedTags||r.allowedTags||[],i=n.allowedAttributes||r.allowedAttributes||{};if("string"!=typeof t)return t;const o=(new DOMParser).parseFromString(t,"text/html");return o.body.querySelectorAll("*").forEach(t=>{const n=t.tagName.toLowerCase();s.includes(n)?Array.from(t.attributes).forEach(e=>{const r=e.name.toLowerCase();(i[n]||[]).includes(r)||t.removeAttribute(e.name)}):t.remove()}),o.body.innerHTML},exports.setBrand=dt,exports.setConfig=function(t){it(Z,t),Q()},exports.setLocale=function(t){return $t.setLocale(t)},exports.setTheme=ht,exports.stringUtils=s,exports.stripHtml=function(t){return"string"!=typeof t?t:(new DOMParser).parseFromString(t,"text/html").body.textContent||""},exports.t=function(t,n={}){return $t.t(t,n)},exports.throttle=_,exports.useDeps=function(t,n){const e={},r=new Et,s=[];for(const i in n){let o=n[i];"string"==typeof o&&(o={source:o});const c=Ut({...o,cacheKey:o.cacheKey||`${i}-${JSON.stringify(zt(t))}`},r),a=W(null),u=W(!0),h=W(null),f=W(null);let d=0;async function l(){const n=++d;u.value=!0,h.value=null;try{const e=await c.getValue(zt(t));if(n!==d)return;a.value=e,f.value=Date.now()}catch(t){if(n!==d)return;h.value=t.message||"Unknown error"}finally{n===d&&(u.value=!1)}}l();const p=c.subscribe(()=>{const t=r.getStale(c.cacheKey);null!=t&&(a.value=t,f.value=Date.now())});s.push(p);const m=Object.keys(t);m.length>0&&m.forEach(n=>{const e=t[n];if(e&&"object"==typeof e&&"value"in e&&e.L){const t=()=>{c.invalidate(),l()};e.L.add(t),s.push(()=>e.L.delete(t))}}),e[i]={data:a,loading:u,error:h,lastUpdated:f,refresh:()=>(c.invalidate(),l()),setValue(t){c instanceof Ft&&(c.setValue(t),a.value=t)},send(t){c instanceof Lt&&c.send(t)},At:c}}return e.Ft=()=>{if(s.forEach(t=>t()),window.__kupolaDepInstances){const t=window.__kupolaDepInstances.indexOf(e);-1!==t&&window.__kupolaDepInstances.splice(t,1)}},window.__kupolaDepInstances||(window.__kupolaDepInstances=[]),window.__kupolaDepInstances.push(e),e},exports.useMixin=function(t,...n){exports.kupolaRegistry&&exports.kupolaRegistry.useMixin(t,...n)},exports.useQuery=function(t){const n=new Et,e=Ut(t,n),r=W(null),s=W(!0),i=W(null);let o=0;async function c(){const n=++o;s.value=!0,i.value=null;try{const s=await e.getValue(t.params||{});if(n!==o)return;r.value=s}catch(t){if(n!==o)return;i.value=t.message||"Unknown error"}finally{n===o&&(s.value=!1)}}return c(),e.subscribe(()=>{const t=n.getStale(e.cacheKey);null!=t&&(r.value=t)}),{data:r,loading:s,error:i,refresh:()=>(e.invalidate(),c())}},exports.validatorUtils=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core-Dfj-u6qC.cjs");exports.BRAND_OPTIONS=e.BRAND_OPTIONS,exports.CacheEntry=e.CacheEntry,exports.CacheManager=e.CacheManager,exports.ComponentInitializerRegistry=e.ComponentInitializerRegistry,exports.DependsError=e.DependsError,exports.DependsSource=e.DependsSource,exports.FetchedSource=e.FetchedSource,exports.FunctionSource=e.FunctionSource,exports.GlobalEvents=e.GlobalEvents,exports.KupolaComponent=e.KupolaComponent,exports.KupolaComponentRegistry=e.KupolaComponentRegistry,exports.KupolaDataBind=e.KupolaDataBind,exports.KupolaEventBus=e.KupolaEventBus,exports.KupolaI18n=e.KupolaI18n,exports.KupolaLifecycle=e.KupolaLifecycle,exports.KupolaStore=e.KupolaStore,exports.KupolaStoreManager=e.KupolaStoreManager,exports.KupolaUtils=e.KupolaUtils,exports.RouteSource=e.RouteSource,exports.Scheduler=e.Scheduler,exports.StaticSource=e.StaticSource,exports.StorageSource=e.StorageSource,exports.WebSocketSource=e.WebSocketSource,exports.applyMixin=e.applyMixin,exports.arrayUtils=e.arrayUtils,exports.bootstrapComponents=e.bootstrapComponents,exports.clearCache=e.clearCache,exports.configureHttpClient=e.configureHttpClient,exports.createBrandPicker=e.createBrandPicker,exports.createI18n=e.createI18n,exports.createLifecycle=e.createLifecycle,exports.createSource=e.createSource,exports.createStore=e.createStore,exports.createThemeToggle=e.createThemeToggle,exports.cryptoUtils=e.cryptoUtils,exports.dateUtils=e.dateUtils,exports.debounce=e.debounce,exports.defineComponent=e.defineComponent,exports.defineMixin=e.defineMixin,exports.emit=e.emit,exports.emitGlobal=e.emitGlobal,exports.escapeHtml=e.escapeHtml,exports.formatCurrency=e.formatCurrency,exports.formatDate=e.formatDate,exports.formatNumber=e.formatNumber,exports.generateSecureId=e.generateSecureId,exports.getBasePath=e.getBasePath,exports.getBrand=e.getBrand,exports.getConfig=e.getConfig,exports.getDefaultBrand=e.getDefaultBrand,exports.getDefaultTheme=e.getDefaultTheme,exports.getHttpClient=e.getHttpClient,exports.getHttpConfig=e.getHttpConfig,exports.getIconsPath=e.getIconsPath,exports.getListenerCount=e.getListenerCount,exports.getLocale=e.getLocale,exports.getMessageConfig=e.getMessageConfig,exports.getNotificationConfig=e.getNotificationConfig,exports.getPerformanceConfig=e.getPerformanceConfig,exports.getSecurityConfig=e.getSecurityConfig,exports.getStore=e.getStore,exports.getTheme=e.getTheme,exports.getUiConfig=e.getUiConfig,exports.getValidationConfig=e.getValidationConfig,exports.globalEvents=e.globalEvents,exports.initTheme=e.initTheme,exports.kupolaBootstrap=e.kupolaBootstrap,exports.kupolaData=e.kupolaData,exports.kupolaEvents=e.kupolaEvents,exports.kupolaI18n=e.kupolaI18n,exports.kupolaInitializer=e.kupolaInitializer,exports.kupolaLifecycle=e.kupolaLifecycle,Object.defineProperty(exports,"kupolaRegistry",{enumerable:!0,get:()=>e.kupolaRegistry}),exports.kupolaStoreManager=e.kupolaStoreManager,exports.maskData=e.maskData,exports.n=e.n,exports.numberUtils=e.numberUtils,exports.objectUtils=e.objectUtils,exports.off=e.off,exports.offAll=e.offAll,exports.offByScope=e.offByScope,exports.offConfigChange=e.offConfigChange,exports.on=e.on,exports.onConfigChange=e.onConfigChange,exports.once=e.once,exports.preloadUtils=e.preloadUtils,exports.ref=e.ref,exports.registerComponent=e.registerComponent,exports.registerLazyComponent=e.registerLazyComponent,exports.resetHttpClient=e.resetHttpClient,exports.sanitizeHtml=e.sanitizeHtml,exports.setBrand=e.setBrand,exports.setConfig=e.setConfig,exports.setLocale=e.setLocale,exports.setTheme=e.setTheme,exports.stringUtils=e.stringUtils,exports.stripHtml=e.stripHtml,exports.t=e.t,exports.throttle=e.throttle,exports.useDeps=e.useDeps,exports.useMixin=e.useMixin,exports.useQuery=e.useQuery,exports.validatorUtils=e.validatorUtils;