woby-tooltip 1.0.5 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -212
- package/build/index.es.js +2756 -0
- package/build/index.html +21 -0
- package/{dist → build}/style.css +246 -691
- package/dist/index.es.js +211 -389
- package/dist/index.es.js.map +1 -1
- package/dist/output.css +246 -691
- package/dist/types/Tooltip.d.ts +8 -47
- package/dist/types/Tooltip.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -13
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.web.mts +2 -2
- package/dist/types/Arrow.d.ts +0 -8
- package/dist/types/Arrow.d.ts.map +0 -1
- package/dist/types/AutoTooltip.d.ts +0 -7
- package/dist/types/AutoTooltip.d.ts.map +0 -1
- package/dist/types/TextBox.d.ts +0 -49
- package/dist/types/TextBox.d.ts.map +0 -1
- package/dist/types/assets/arrow-down.d.ts +0 -4
- package/dist/types/assets/arrow-down.d.ts.map +0 -1
- package/dist/types/assets/arrow-up.d.ts +0 -4
- package/dist/types/assets/arrow-up.d.ts.map +0 -1
- package/dist/types/assets/logo.d.ts +0 -4
- package/dist/types/assets/logo.d.ts.map +0 -1
@@ -0,0 +1,2756 @@
|
|
1
|
+
(function polyfill() {
|
2
|
+
const relList = document.createElement("link").relList;
|
3
|
+
if (relList && relList.supports && relList.supports("modulepreload")) {
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
for (const link of document.querySelectorAll('link[rel="modulepreload"]')) {
|
7
|
+
processPreload(link);
|
8
|
+
}
|
9
|
+
new MutationObserver((mutations) => {
|
10
|
+
for (const mutation of mutations) {
|
11
|
+
if (mutation.type !== "childList") {
|
12
|
+
continue;
|
13
|
+
}
|
14
|
+
for (const node of mutation.addedNodes) {
|
15
|
+
if (node.tagName === "LINK" && node.rel === "modulepreload")
|
16
|
+
processPreload(node);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}).observe(document, { childList: true, subtree: true });
|
20
|
+
function getFetchOpts(link) {
|
21
|
+
const fetchOpts = {};
|
22
|
+
if (link.integrity) fetchOpts.integrity = link.integrity;
|
23
|
+
if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy;
|
24
|
+
if (link.crossOrigin === "use-credentials")
|
25
|
+
fetchOpts.credentials = "include";
|
26
|
+
else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit";
|
27
|
+
else fetchOpts.credentials = "same-origin";
|
28
|
+
return fetchOpts;
|
29
|
+
}
|
30
|
+
function processPreload(link) {
|
31
|
+
if (link.ep)
|
32
|
+
return;
|
33
|
+
link.ep = true;
|
34
|
+
const fetchOpts = getFetchOpts(link);
|
35
|
+
fetch(link.href, fetchOpts);
|
36
|
+
}
|
37
|
+
})();
|
38
|
+
const SYMBOL_OBSERVABLE = Symbol("Observable");
|
39
|
+
const SYMBOL_OBSERVABLE_FROZEN = Symbol("Observable.Frozen");
|
40
|
+
const SYMBOL_OBSERVABLE_READABLE = Symbol("Observable.Readable");
|
41
|
+
const SYMBOL_OBSERVABLE_WRITABLE = Symbol("Observable.Writable");
|
42
|
+
const SYMBOL_STORE = Symbol("Store");
|
43
|
+
const SYMBOL_STORE_KEYS = Symbol("Store.Keys");
|
44
|
+
const SYMBOL_STORE_OBSERVABLE = Symbol("Store.Observable");
|
45
|
+
const SYMBOL_STORE_TARGET = Symbol("Store.Target");
|
46
|
+
const SYMBOL_STORE_VALUES = Symbol("Store.Values");
|
47
|
+
const SYMBOL_STORE_UNTRACKED = Symbol("Store.Untracked");
|
48
|
+
const SYMBOL_SUSPENSE$1 = Symbol("Suspense");
|
49
|
+
const SYMBOL_UNCACHED = Symbol("Uncached");
|
50
|
+
const SYMBOL_UNTRACKED = Symbol("Untracked");
|
51
|
+
const SYMBOL_UNTRACKED_UNWRAPPED = Symbol("Untracked.Unwrapped");
|
52
|
+
const castArray$1 = (value) => {
|
53
|
+
return isArray$1(value) ? value : [value];
|
54
|
+
};
|
55
|
+
const castError$1 = (error) => {
|
56
|
+
if (error instanceof Error)
|
57
|
+
return error;
|
58
|
+
if (typeof error === "string")
|
59
|
+
return new Error(error);
|
60
|
+
return new Error("Unknown error");
|
61
|
+
};
|
62
|
+
const { is } = Object;
|
63
|
+
const { isArray: isArray$1 } = Array;
|
64
|
+
const isFunction$1 = (value) => {
|
65
|
+
return typeof value === "function";
|
66
|
+
};
|
67
|
+
const isObject$1 = (value) => {
|
68
|
+
return value !== null && typeof value === "object";
|
69
|
+
};
|
70
|
+
const isSymbol = (value) => {
|
71
|
+
return typeof value === "symbol";
|
72
|
+
};
|
73
|
+
const noop$1 = () => {
|
74
|
+
return;
|
75
|
+
};
|
76
|
+
const nope = () => {
|
77
|
+
return false;
|
78
|
+
};
|
79
|
+
function frozenFunction() {
|
80
|
+
if (arguments.length) {
|
81
|
+
throw new Error("A readonly Observable can not be updated");
|
82
|
+
} else {
|
83
|
+
return this;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
function readableFunction() {
|
87
|
+
if (arguments.length) {
|
88
|
+
throw new Error("A readonly Observable can not be updated");
|
89
|
+
} else {
|
90
|
+
return this.get();
|
91
|
+
}
|
92
|
+
}
|
93
|
+
function writableFunction(fn) {
|
94
|
+
if (arguments.length) {
|
95
|
+
if (isFunction$1(fn)) {
|
96
|
+
return this.update(fn);
|
97
|
+
} else {
|
98
|
+
return this.set(fn);
|
99
|
+
}
|
100
|
+
} else {
|
101
|
+
return this.get();
|
102
|
+
}
|
103
|
+
}
|
104
|
+
const frozen = (value) => {
|
105
|
+
const fn = frozenFunction.bind(value);
|
106
|
+
fn[SYMBOL_OBSERVABLE] = true;
|
107
|
+
fn[SYMBOL_OBSERVABLE_FROZEN] = true;
|
108
|
+
return fn;
|
109
|
+
};
|
110
|
+
const readable = (value) => {
|
111
|
+
const fn = readableFunction.bind(value);
|
112
|
+
fn[SYMBOL_OBSERVABLE] = true;
|
113
|
+
fn[SYMBOL_OBSERVABLE_READABLE] = value;
|
114
|
+
return fn;
|
115
|
+
};
|
116
|
+
const writable = (value) => {
|
117
|
+
const fn = writableFunction.bind(value);
|
118
|
+
fn[SYMBOL_OBSERVABLE] = true;
|
119
|
+
fn[SYMBOL_OBSERVABLE_WRITABLE] = value;
|
120
|
+
return fn;
|
121
|
+
};
|
122
|
+
const DIRTY_NO = 0;
|
123
|
+
const DIRTY_MAYBE_NO = 1;
|
124
|
+
const DIRTY_MAYBE_YES = 2;
|
125
|
+
const DIRTY_YES = 3;
|
126
|
+
frozen(false);
|
127
|
+
frozen(true);
|
128
|
+
const UNAVAILABLE = new Proxy({}, new Proxy({}, { get() {
|
129
|
+
throw new Error("Unavailable value");
|
130
|
+
} }));
|
131
|
+
const UNINITIALIZED = function() {
|
132
|
+
};
|
133
|
+
const lazyArrayEachRight = (arr, fn) => {
|
134
|
+
if (arr instanceof Array) {
|
135
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
136
|
+
fn(arr[i]);
|
137
|
+
}
|
138
|
+
} else if (arr) {
|
139
|
+
fn(arr);
|
140
|
+
}
|
141
|
+
};
|
142
|
+
const lazyArrayPush = (obj, key, value) => {
|
143
|
+
const arr = obj[key];
|
144
|
+
if (arr instanceof Array) {
|
145
|
+
arr.push(value);
|
146
|
+
} else if (arr) {
|
147
|
+
obj[key] = [arr, value];
|
148
|
+
} else {
|
149
|
+
obj[key] = value;
|
150
|
+
}
|
151
|
+
};
|
152
|
+
const lazySetAdd = (obj, key, value) => {
|
153
|
+
const set = obj[key];
|
154
|
+
if (set instanceof Set) {
|
155
|
+
set.add(value);
|
156
|
+
} else if (set) {
|
157
|
+
if (value !== set) {
|
158
|
+
const s = /* @__PURE__ */ new Set();
|
159
|
+
s.add(set);
|
160
|
+
s.add(value);
|
161
|
+
obj[key] = s;
|
162
|
+
}
|
163
|
+
} else {
|
164
|
+
obj[key] = value;
|
165
|
+
}
|
166
|
+
};
|
167
|
+
const lazySetDelete = (obj, key, value) => {
|
168
|
+
const set = obj[key];
|
169
|
+
if (set instanceof Set) {
|
170
|
+
set.delete(value);
|
171
|
+
} else if (set === value) {
|
172
|
+
obj[key] = void 0;
|
173
|
+
}
|
174
|
+
};
|
175
|
+
const lazySetEach = (set, fn) => {
|
176
|
+
if (set instanceof Set) {
|
177
|
+
for (const value of set) {
|
178
|
+
fn(value);
|
179
|
+
}
|
180
|
+
} else if (set) {
|
181
|
+
fn(set);
|
182
|
+
}
|
183
|
+
};
|
184
|
+
const onCleanup = (cleanup2) => cleanup2.call(cleanup2);
|
185
|
+
const onDispose = (owner) => owner.dispose(true);
|
186
|
+
class Owner {
|
187
|
+
constructor() {
|
188
|
+
this.disposed = false;
|
189
|
+
this.cleanups = void 0;
|
190
|
+
this.errorHandler = void 0;
|
191
|
+
this.contexts = void 0;
|
192
|
+
this.observers = void 0;
|
193
|
+
this.roots = void 0;
|
194
|
+
this.suspenses = void 0;
|
195
|
+
}
|
196
|
+
/* API */
|
197
|
+
catch(error, silent) {
|
198
|
+
var _a2;
|
199
|
+
const { errorHandler } = this;
|
200
|
+
if (errorHandler) {
|
201
|
+
errorHandler(error);
|
202
|
+
return true;
|
203
|
+
} else {
|
204
|
+
if ((_a2 = this.parent) == null ? void 0 : _a2.catch(error, true))
|
205
|
+
return true;
|
206
|
+
if (silent)
|
207
|
+
return false;
|
208
|
+
throw error;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
dispose(deep) {
|
212
|
+
lazyArrayEachRight(this.contexts, onDispose);
|
213
|
+
lazyArrayEachRight(this.observers, onDispose);
|
214
|
+
lazyArrayEachRight(this.suspenses, onDispose);
|
215
|
+
lazyArrayEachRight(this.cleanups, onCleanup);
|
216
|
+
this.cleanups = void 0;
|
217
|
+
this.disposed = deep;
|
218
|
+
this.errorHandler = void 0;
|
219
|
+
this.observers = void 0;
|
220
|
+
this.suspenses = void 0;
|
221
|
+
}
|
222
|
+
get(symbol) {
|
223
|
+
var _a2;
|
224
|
+
return (_a2 = this.context) == null ? void 0 : _a2[symbol];
|
225
|
+
}
|
226
|
+
wrap(fn, owner, observer) {
|
227
|
+
const ownerPrev = OWNER;
|
228
|
+
const observerPrev = OBSERVER;
|
229
|
+
setOwner(owner);
|
230
|
+
setObserver(observer);
|
231
|
+
try {
|
232
|
+
return fn();
|
233
|
+
} catch (error) {
|
234
|
+
this.catch(castError$1(error), false);
|
235
|
+
return UNAVAILABLE;
|
236
|
+
} finally {
|
237
|
+
setOwner(ownerPrev);
|
238
|
+
setObserver(observerPrev);
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
class SuperRoot extends Owner {
|
243
|
+
constructor() {
|
244
|
+
super(...arguments);
|
245
|
+
this.context = {};
|
246
|
+
}
|
247
|
+
}
|
248
|
+
let SUPER_OWNER = new SuperRoot();
|
249
|
+
let OBSERVER;
|
250
|
+
let OWNER = SUPER_OWNER;
|
251
|
+
const setObserver = (value) => OBSERVER = value;
|
252
|
+
const setOwner = (value) => OWNER = value;
|
253
|
+
let Scheduler$2 = class Scheduler {
|
254
|
+
constructor() {
|
255
|
+
this.waiting = [];
|
256
|
+
this.counter = 0;
|
257
|
+
this.locked = false;
|
258
|
+
this.flush = () => {
|
259
|
+
if (this.locked)
|
260
|
+
return;
|
261
|
+
if (this.counter)
|
262
|
+
return;
|
263
|
+
if (!this.waiting.length)
|
264
|
+
return;
|
265
|
+
try {
|
266
|
+
this.locked = true;
|
267
|
+
while (true) {
|
268
|
+
const queue = this.waiting;
|
269
|
+
if (!queue.length)
|
270
|
+
break;
|
271
|
+
this.waiting = [];
|
272
|
+
for (let i = 0, l = queue.length; i < l; i++) {
|
273
|
+
queue[i].update();
|
274
|
+
}
|
275
|
+
}
|
276
|
+
} finally {
|
277
|
+
this.locked = false;
|
278
|
+
}
|
279
|
+
};
|
280
|
+
this.wrap = (fn) => {
|
281
|
+
this.counter += 1;
|
282
|
+
fn();
|
283
|
+
this.counter -= 1;
|
284
|
+
this.flush();
|
285
|
+
};
|
286
|
+
this.schedule = (observer) => {
|
287
|
+
this.waiting.push(observer);
|
288
|
+
};
|
289
|
+
}
|
290
|
+
};
|
291
|
+
const SchedulerSync = new Scheduler$2();
|
292
|
+
class Observable {
|
293
|
+
/* CONSTRUCTOR */
|
294
|
+
constructor(value, options2, parent) {
|
295
|
+
this.observers = /* @__PURE__ */ new Set();
|
296
|
+
this.value = value;
|
297
|
+
if (parent) {
|
298
|
+
this.parent = parent;
|
299
|
+
}
|
300
|
+
if ((options2 == null ? void 0 : options2.equals) !== void 0) {
|
301
|
+
this.equals = options2.equals || nope;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
/* API */
|
305
|
+
get() {
|
306
|
+
var _a2, _b2;
|
307
|
+
if (!((_a2 = this.parent) == null ? void 0 : _a2.disposed)) {
|
308
|
+
(_b2 = this.parent) == null ? void 0 : _b2.update();
|
309
|
+
OBSERVER == null ? void 0 : OBSERVER.observables.link(this);
|
310
|
+
}
|
311
|
+
return this.value;
|
312
|
+
}
|
313
|
+
set(value) {
|
314
|
+
const equals = this.equals || is;
|
315
|
+
const fresh = this.value === UNINITIALIZED || !equals(value, this.value);
|
316
|
+
if (!fresh)
|
317
|
+
return value;
|
318
|
+
this.value = value;
|
319
|
+
SchedulerSync.counter += 1;
|
320
|
+
this.stale(DIRTY_YES);
|
321
|
+
SchedulerSync.counter -= 1;
|
322
|
+
SchedulerSync.flush();
|
323
|
+
return value;
|
324
|
+
}
|
325
|
+
stale(status) {
|
326
|
+
for (const observer of this.observers) {
|
327
|
+
if (observer.status !== DIRTY_MAYBE_NO || observer.observables.has(this)) {
|
328
|
+
if (observer.sync) {
|
329
|
+
observer.status = Math.max(observer.status, status);
|
330
|
+
SchedulerSync.schedule(observer);
|
331
|
+
} else {
|
332
|
+
observer.stale(status);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
update(fn) {
|
338
|
+
const value = fn(this.value);
|
339
|
+
return this.set(value);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
class ObservablesArray {
|
343
|
+
/* CONSTRUCTOR */
|
344
|
+
constructor(observer) {
|
345
|
+
this.observer = observer;
|
346
|
+
this.observables = [];
|
347
|
+
this.observablesIndex = 0;
|
348
|
+
}
|
349
|
+
/* API */
|
350
|
+
dispose(deep) {
|
351
|
+
if (deep) {
|
352
|
+
const { observer, observables } = this;
|
353
|
+
for (let i = 0; i < observables.length; i++) {
|
354
|
+
observables[i].observers.delete(observer);
|
355
|
+
}
|
356
|
+
}
|
357
|
+
this.observablesIndex = 0;
|
358
|
+
}
|
359
|
+
postdispose() {
|
360
|
+
const { observer, observables, observablesIndex } = this;
|
361
|
+
const observablesLength = observables.length;
|
362
|
+
if (observablesIndex < observablesLength) {
|
363
|
+
for (let i = observablesIndex; i < observablesLength; i++) {
|
364
|
+
observables[i].observers.delete(observer);
|
365
|
+
}
|
366
|
+
observables.length = observablesIndex;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
empty() {
|
370
|
+
return !this.observables.length;
|
371
|
+
}
|
372
|
+
has(observable2) {
|
373
|
+
const index = this.observables.indexOf(observable2);
|
374
|
+
return index >= 0 && index < this.observablesIndex;
|
375
|
+
}
|
376
|
+
link(observable2) {
|
377
|
+
const { observer, observables, observablesIndex } = this;
|
378
|
+
const observablesLength = observables.length;
|
379
|
+
if (observablesLength > 0) {
|
380
|
+
if (observables[observablesIndex] === observable2) {
|
381
|
+
this.observablesIndex += 1;
|
382
|
+
return;
|
383
|
+
}
|
384
|
+
const index = observables.indexOf(observable2);
|
385
|
+
if (index >= 0 && index < observablesIndex) {
|
386
|
+
return;
|
387
|
+
}
|
388
|
+
if (observablesIndex < observablesLength - 1) {
|
389
|
+
this.postdispose();
|
390
|
+
} else if (observablesIndex === observablesLength - 1) {
|
391
|
+
observables[observablesIndex].observers.delete(observer);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
observable2.observers.add(observer);
|
395
|
+
observables[this.observablesIndex++] = observable2;
|
396
|
+
if (observablesIndex === 128) {
|
397
|
+
observer.observables = new ObservablesSet(observer, observables);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
update() {
|
401
|
+
var _a2;
|
402
|
+
const { observables } = this;
|
403
|
+
for (let i = 0, l = observables.length; i < l; i++) {
|
404
|
+
(_a2 = observables[i].parent) == null ? void 0 : _a2.update();
|
405
|
+
}
|
406
|
+
}
|
407
|
+
}
|
408
|
+
class ObservablesSet {
|
409
|
+
/* CONSTRUCTOR */
|
410
|
+
constructor(observer, observables) {
|
411
|
+
this.observer = observer;
|
412
|
+
this.observables = new Set(observables);
|
413
|
+
}
|
414
|
+
/* API */
|
415
|
+
dispose(deep) {
|
416
|
+
for (const observable2 of this.observables) {
|
417
|
+
observable2.observers.delete(this.observer);
|
418
|
+
}
|
419
|
+
}
|
420
|
+
postdispose() {
|
421
|
+
return;
|
422
|
+
}
|
423
|
+
empty() {
|
424
|
+
return !this.observables.size;
|
425
|
+
}
|
426
|
+
has(observable2) {
|
427
|
+
return this.observables.has(observable2);
|
428
|
+
}
|
429
|
+
link(observable2) {
|
430
|
+
const { observer, observables } = this;
|
431
|
+
const sizePrev = observables.size;
|
432
|
+
observable2.observers.add(observer);
|
433
|
+
const sizeNext = observables.size;
|
434
|
+
if (sizePrev === sizeNext)
|
435
|
+
return;
|
436
|
+
observables.add(observable2);
|
437
|
+
}
|
438
|
+
update() {
|
439
|
+
var _a2;
|
440
|
+
for (const observable2 of this.observables) {
|
441
|
+
(_a2 = observable2.parent) == null ? void 0 : _a2.update();
|
442
|
+
}
|
443
|
+
}
|
444
|
+
}
|
445
|
+
class Observer extends Owner {
|
446
|
+
/* CONSTRUCTOR */
|
447
|
+
constructor() {
|
448
|
+
super();
|
449
|
+
this.parent = OWNER;
|
450
|
+
this.context = OWNER.context;
|
451
|
+
this.status = DIRTY_YES;
|
452
|
+
this.observables = new ObservablesArray(this);
|
453
|
+
if (OWNER !== SUPER_OWNER) {
|
454
|
+
lazyArrayPush(this.parent, "observers", this);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
/* API */
|
458
|
+
dispose(deep) {
|
459
|
+
this.observables.dispose(deep);
|
460
|
+
super.dispose(deep);
|
461
|
+
}
|
462
|
+
refresh(fn) {
|
463
|
+
this.dispose(false);
|
464
|
+
this.status = DIRTY_MAYBE_NO;
|
465
|
+
try {
|
466
|
+
return this.wrap(fn, this, this);
|
467
|
+
} finally {
|
468
|
+
this.observables.postdispose();
|
469
|
+
}
|
470
|
+
}
|
471
|
+
run() {
|
472
|
+
throw new Error("Abstract method");
|
473
|
+
}
|
474
|
+
stale(status) {
|
475
|
+
throw new Error("Abstract method");
|
476
|
+
}
|
477
|
+
update() {
|
478
|
+
if (this.disposed)
|
479
|
+
return;
|
480
|
+
if (this.status === DIRTY_MAYBE_YES) {
|
481
|
+
this.observables.update();
|
482
|
+
}
|
483
|
+
if (this.status === DIRTY_YES) {
|
484
|
+
this.status = DIRTY_MAYBE_NO;
|
485
|
+
this.run();
|
486
|
+
if (this.status === DIRTY_MAYBE_NO) {
|
487
|
+
this.status = DIRTY_NO;
|
488
|
+
} else {
|
489
|
+
this.update();
|
490
|
+
}
|
491
|
+
} else {
|
492
|
+
this.status = DIRTY_NO;
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
const cleanup = (fn) => {
|
497
|
+
lazyArrayPush(OWNER, "cleanups", fn);
|
498
|
+
};
|
499
|
+
class Context extends Owner {
|
500
|
+
/* CONSTRUCTOR */
|
501
|
+
constructor(context2) {
|
502
|
+
super();
|
503
|
+
this.parent = OWNER;
|
504
|
+
this.context = { ...OWNER.context, ...context2 };
|
505
|
+
lazyArrayPush(this.parent, "contexts", this);
|
506
|
+
}
|
507
|
+
/* API */
|
508
|
+
wrap(fn) {
|
509
|
+
return super.wrap(fn, this, void 0);
|
510
|
+
}
|
511
|
+
}
|
512
|
+
function context(symbolOrContext, fn) {
|
513
|
+
if (isSymbol(symbolOrContext)) {
|
514
|
+
return OWNER.context[symbolOrContext];
|
515
|
+
} else {
|
516
|
+
return new Context(symbolOrContext).wrap(fn || noop$1);
|
517
|
+
}
|
518
|
+
}
|
519
|
+
class Scheduler2 {
|
520
|
+
constructor() {
|
521
|
+
this.waiting = [];
|
522
|
+
this.locked = false;
|
523
|
+
this.queued = false;
|
524
|
+
this.flush = () => {
|
525
|
+
if (this.locked)
|
526
|
+
return;
|
527
|
+
if (!this.waiting.length)
|
528
|
+
return;
|
529
|
+
try {
|
530
|
+
this.locked = true;
|
531
|
+
while (true) {
|
532
|
+
const queue = this.waiting;
|
533
|
+
if (!queue.length)
|
534
|
+
break;
|
535
|
+
this.waiting = [];
|
536
|
+
for (let i = 0, l = queue.length; i < l; i++) {
|
537
|
+
queue[i].update();
|
538
|
+
}
|
539
|
+
}
|
540
|
+
} finally {
|
541
|
+
this.locked = false;
|
542
|
+
}
|
543
|
+
};
|
544
|
+
this.queue = () => {
|
545
|
+
if (this.queued)
|
546
|
+
return;
|
547
|
+
this.queued = true;
|
548
|
+
this.resolve();
|
549
|
+
};
|
550
|
+
this.resolve = () => {
|
551
|
+
queueMicrotask(() => {
|
552
|
+
queueMicrotask(() => {
|
553
|
+
{
|
554
|
+
this.queued = false;
|
555
|
+
this.flush();
|
556
|
+
}
|
557
|
+
});
|
558
|
+
});
|
559
|
+
};
|
560
|
+
this.schedule = (effect2) => {
|
561
|
+
this.waiting.push(effect2);
|
562
|
+
this.queue();
|
563
|
+
};
|
564
|
+
}
|
565
|
+
}
|
566
|
+
const Scheduler$1 = new Scheduler2();
|
567
|
+
class Effect extends Observer {
|
568
|
+
/* CONSTRUCTOR */
|
569
|
+
constructor(fn, options2) {
|
570
|
+
super();
|
571
|
+
this.fn = fn;
|
572
|
+
if ((options2 == null ? void 0 : options2.suspense) !== false) {
|
573
|
+
const suspense = this.get(SYMBOL_SUSPENSE$1);
|
574
|
+
if (suspense) {
|
575
|
+
this.suspense = suspense;
|
576
|
+
}
|
577
|
+
}
|
578
|
+
if ((options2 == null ? void 0 : options2.sync) === true) {
|
579
|
+
this.sync = true;
|
580
|
+
}
|
581
|
+
if ((options2 == null ? void 0 : options2.sync) === "init") {
|
582
|
+
this.init = true;
|
583
|
+
this.update();
|
584
|
+
} else {
|
585
|
+
this.schedule();
|
586
|
+
}
|
587
|
+
}
|
588
|
+
/* API */
|
589
|
+
run() {
|
590
|
+
const result = super.refresh(this.fn);
|
591
|
+
if (isFunction$1(result)) {
|
592
|
+
lazyArrayPush(this, "cleanups", result);
|
593
|
+
}
|
594
|
+
}
|
595
|
+
schedule() {
|
596
|
+
var _a2;
|
597
|
+
if ((_a2 = this.suspense) == null ? void 0 : _a2.suspended)
|
598
|
+
return;
|
599
|
+
if (this.sync) {
|
600
|
+
this.update();
|
601
|
+
} else {
|
602
|
+
Scheduler$1.schedule(this);
|
603
|
+
}
|
604
|
+
}
|
605
|
+
stale(status) {
|
606
|
+
const statusPrev = this.status;
|
607
|
+
if (statusPrev >= status)
|
608
|
+
return;
|
609
|
+
this.status = status;
|
610
|
+
if (!this.sync || statusPrev !== 2 && statusPrev !== 3) {
|
611
|
+
this.schedule();
|
612
|
+
}
|
613
|
+
}
|
614
|
+
update() {
|
615
|
+
var _a2;
|
616
|
+
if ((_a2 = this.suspense) == null ? void 0 : _a2.suspended)
|
617
|
+
return;
|
618
|
+
super.update();
|
619
|
+
}
|
620
|
+
}
|
621
|
+
const effect = (fn, options2) => {
|
622
|
+
const effect2 = new Effect(fn, options2);
|
623
|
+
const dispose = () => effect2.dispose(true);
|
624
|
+
return dispose;
|
625
|
+
};
|
626
|
+
const isObservable = (value) => {
|
627
|
+
return isFunction$1(value) && SYMBOL_OBSERVABLE in value;
|
628
|
+
};
|
629
|
+
function get(value, getFunction = true) {
|
630
|
+
const is2 = getFunction ? isFunction$1 : isObservable;
|
631
|
+
if (is2(value)) {
|
632
|
+
return value();
|
633
|
+
} else {
|
634
|
+
return value;
|
635
|
+
}
|
636
|
+
}
|
637
|
+
const isStore = (value) => {
|
638
|
+
return isObject$1(value) && SYMBOL_STORE in value;
|
639
|
+
};
|
640
|
+
function untrack(fn) {
|
641
|
+
if (isFunction$1(fn)) {
|
642
|
+
const observerPrev = OBSERVER;
|
643
|
+
if (observerPrev) {
|
644
|
+
try {
|
645
|
+
setObserver(void 0);
|
646
|
+
return fn();
|
647
|
+
} finally {
|
648
|
+
setObserver(observerPrev);
|
649
|
+
}
|
650
|
+
} else {
|
651
|
+
return fn();
|
652
|
+
}
|
653
|
+
} else {
|
654
|
+
return fn;
|
655
|
+
}
|
656
|
+
}
|
657
|
+
const isBatching = () => {
|
658
|
+
return Scheduler$1.queued || Scheduler$1.locked || SchedulerSync.locked;
|
659
|
+
};
|
660
|
+
class StoreMap extends Map {
|
661
|
+
insert(key, value) {
|
662
|
+
super.set(key, value);
|
663
|
+
return value;
|
664
|
+
}
|
665
|
+
}
|
666
|
+
class StoreCleanable {
|
667
|
+
constructor() {
|
668
|
+
this.count = 0;
|
669
|
+
}
|
670
|
+
listen() {
|
671
|
+
this.count += 1;
|
672
|
+
cleanup(this);
|
673
|
+
}
|
674
|
+
call() {
|
675
|
+
this.count -= 1;
|
676
|
+
if (this.count)
|
677
|
+
return;
|
678
|
+
this.dispose();
|
679
|
+
}
|
680
|
+
dispose() {
|
681
|
+
}
|
682
|
+
}
|
683
|
+
class StoreKeys extends StoreCleanable {
|
684
|
+
constructor(parent, observable2) {
|
685
|
+
super();
|
686
|
+
this.parent = parent;
|
687
|
+
this.observable = observable2;
|
688
|
+
}
|
689
|
+
dispose() {
|
690
|
+
this.parent.keys = void 0;
|
691
|
+
}
|
692
|
+
}
|
693
|
+
class StoreValues extends StoreCleanable {
|
694
|
+
constructor(parent, observable2) {
|
695
|
+
super();
|
696
|
+
this.parent = parent;
|
697
|
+
this.observable = observable2;
|
698
|
+
}
|
699
|
+
dispose() {
|
700
|
+
this.parent.values = void 0;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
class StoreHas extends StoreCleanable {
|
704
|
+
constructor(parent, key, observable2) {
|
705
|
+
super();
|
706
|
+
this.parent = parent;
|
707
|
+
this.key = key;
|
708
|
+
this.observable = observable2;
|
709
|
+
}
|
710
|
+
dispose() {
|
711
|
+
var _a2;
|
712
|
+
(_a2 = this.parent.has) == null ? void 0 : _a2.delete(this.key);
|
713
|
+
}
|
714
|
+
}
|
715
|
+
class StoreProperty extends StoreCleanable {
|
716
|
+
constructor(parent, key, observable2, node) {
|
717
|
+
super();
|
718
|
+
this.parent = parent;
|
719
|
+
this.key = key;
|
720
|
+
this.observable = observable2;
|
721
|
+
this.node = node;
|
722
|
+
}
|
723
|
+
dispose() {
|
724
|
+
var _a2;
|
725
|
+
(_a2 = this.parent.properties) == null ? void 0 : _a2.delete(this.key);
|
726
|
+
}
|
727
|
+
}
|
728
|
+
const StoreListenersRegular = {
|
729
|
+
/* VARIABLES */
|
730
|
+
active: 0,
|
731
|
+
listeners: /* @__PURE__ */ new Set(),
|
732
|
+
nodes: /* @__PURE__ */ new Set(),
|
733
|
+
/* API */
|
734
|
+
prepare: () => {
|
735
|
+
const { listeners, nodes } = StoreListenersRegular;
|
736
|
+
const traversed = /* @__PURE__ */ new Set();
|
737
|
+
const traverse = (node) => {
|
738
|
+
if (traversed.has(node))
|
739
|
+
return;
|
740
|
+
traversed.add(node);
|
741
|
+
lazySetEach(node.parents, traverse);
|
742
|
+
lazySetEach(node.listenersRegular, (listener) => {
|
743
|
+
listeners.add(listener);
|
744
|
+
});
|
745
|
+
};
|
746
|
+
nodes.forEach(traverse);
|
747
|
+
return () => {
|
748
|
+
listeners.forEach((listener) => {
|
749
|
+
listener();
|
750
|
+
});
|
751
|
+
};
|
752
|
+
},
|
753
|
+
register: (node) => {
|
754
|
+
StoreListenersRegular.nodes.add(node);
|
755
|
+
StoreScheduler.schedule();
|
756
|
+
},
|
757
|
+
reset: () => {
|
758
|
+
StoreListenersRegular.listeners = /* @__PURE__ */ new Set();
|
759
|
+
StoreListenersRegular.nodes = /* @__PURE__ */ new Set();
|
760
|
+
}
|
761
|
+
};
|
762
|
+
const StoreListenersRoots = {
|
763
|
+
/* VARIABLES */
|
764
|
+
active: 0,
|
765
|
+
nodes: /* @__PURE__ */ new Map(),
|
766
|
+
/* API */
|
767
|
+
prepare: () => {
|
768
|
+
const { nodes } = StoreListenersRoots;
|
769
|
+
return () => {
|
770
|
+
nodes.forEach((rootsSet, store2) => {
|
771
|
+
const roots = Array.from(rootsSet);
|
772
|
+
lazySetEach(store2.listenersRoots, (listener) => {
|
773
|
+
listener(roots);
|
774
|
+
});
|
775
|
+
});
|
776
|
+
};
|
777
|
+
},
|
778
|
+
register: (store2, root2) => {
|
779
|
+
const roots = StoreListenersRoots.nodes.get(store2) || /* @__PURE__ */ new Set();
|
780
|
+
roots.add(root2);
|
781
|
+
StoreListenersRoots.nodes.set(store2, roots);
|
782
|
+
StoreScheduler.schedule();
|
783
|
+
},
|
784
|
+
registerWith: (current, parent, key) => {
|
785
|
+
if (!parent.parents) {
|
786
|
+
const root2 = (current == null ? void 0 : current.store) || untrack(() => parent.store[key]);
|
787
|
+
StoreListenersRoots.register(parent, root2);
|
788
|
+
} else {
|
789
|
+
const traversed = /* @__PURE__ */ new Set();
|
790
|
+
const traverse = (node) => {
|
791
|
+
if (traversed.has(node))
|
792
|
+
return;
|
793
|
+
traversed.add(node);
|
794
|
+
lazySetEach(node.parents, (parent2) => {
|
795
|
+
if (!parent2.parents) {
|
796
|
+
StoreListenersRoots.register(parent2, node.store);
|
797
|
+
}
|
798
|
+
traverse(parent2);
|
799
|
+
});
|
800
|
+
};
|
801
|
+
traverse(current || parent);
|
802
|
+
}
|
803
|
+
},
|
804
|
+
reset: () => {
|
805
|
+
StoreListenersRoots.nodes = /* @__PURE__ */ new Map();
|
806
|
+
}
|
807
|
+
};
|
808
|
+
const StoreScheduler = {
|
809
|
+
/* VARIABLES */
|
810
|
+
active: false,
|
811
|
+
/* API */
|
812
|
+
flush: () => {
|
813
|
+
const flushRegular = StoreListenersRegular.prepare();
|
814
|
+
const flushRoots = StoreListenersRoots.prepare();
|
815
|
+
StoreScheduler.reset();
|
816
|
+
flushRegular();
|
817
|
+
flushRoots();
|
818
|
+
},
|
819
|
+
flushIfNotBatching: () => {
|
820
|
+
if (isBatching()) {
|
821
|
+
{
|
822
|
+
setTimeout(StoreScheduler.flushIfNotBatching, 0);
|
823
|
+
}
|
824
|
+
} else {
|
825
|
+
StoreScheduler.flush();
|
826
|
+
}
|
827
|
+
},
|
828
|
+
reset: () => {
|
829
|
+
StoreScheduler.active = false;
|
830
|
+
StoreListenersRegular.reset();
|
831
|
+
StoreListenersRoots.reset();
|
832
|
+
},
|
833
|
+
schedule: () => {
|
834
|
+
if (StoreScheduler.active)
|
835
|
+
return;
|
836
|
+
StoreScheduler.active = true;
|
837
|
+
queueMicrotask(StoreScheduler.flushIfNotBatching);
|
838
|
+
}
|
839
|
+
};
|
840
|
+
const NODES = /* @__PURE__ */ new WeakMap();
|
841
|
+
const SPECIAL_SYMBOLS = /* @__PURE__ */ new Set([SYMBOL_STORE, SYMBOL_STORE_KEYS, SYMBOL_STORE_OBSERVABLE, SYMBOL_STORE_TARGET, SYMBOL_STORE_VALUES]);
|
842
|
+
const UNREACTIVE_KEYS = /* @__PURE__ */ new Set(["__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__", "prototype", "constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toSource", "toString", "valueOf"]);
|
843
|
+
const STORE_TRAPS = {
|
844
|
+
/* API */
|
845
|
+
get: (target, key) => {
|
846
|
+
var _a2, _b2;
|
847
|
+
if (SPECIAL_SYMBOLS.has(key)) {
|
848
|
+
if (key === SYMBOL_STORE)
|
849
|
+
return true;
|
850
|
+
if (key === SYMBOL_STORE_TARGET)
|
851
|
+
return target;
|
852
|
+
if (key === SYMBOL_STORE_KEYS) {
|
853
|
+
if (isListenable()) {
|
854
|
+
const node2 = getNodeExisting(target);
|
855
|
+
node2.keys || (node2.keys = getNodeKeys(node2));
|
856
|
+
node2.keys.listen();
|
857
|
+
node2.keys.observable.get();
|
858
|
+
}
|
859
|
+
return;
|
860
|
+
}
|
861
|
+
if (key === SYMBOL_STORE_VALUES) {
|
862
|
+
if (isListenable()) {
|
863
|
+
const node2 = getNodeExisting(target);
|
864
|
+
node2.values || (node2.values = getNodeValues(node2));
|
865
|
+
node2.values.listen();
|
866
|
+
node2.values.observable.get();
|
867
|
+
}
|
868
|
+
return;
|
869
|
+
}
|
870
|
+
if (key === SYMBOL_STORE_OBSERVABLE) {
|
871
|
+
return (key2) => {
|
872
|
+
var _a22;
|
873
|
+
key2 = typeof key2 === "number" ? String(key2) : key2;
|
874
|
+
const node2 = getNodeExisting(target);
|
875
|
+
const getter2 = (_a22 = node2.getters) == null ? void 0 : _a22.get(key2);
|
876
|
+
if (getter2)
|
877
|
+
return getter2.bind(node2.store);
|
878
|
+
node2.properties || (node2.properties = new StoreMap());
|
879
|
+
const value2 = target[key2];
|
880
|
+
const property2 = node2.properties.get(key2) || node2.properties.insert(key2, getNodeProperty(node2, key2, value2));
|
881
|
+
const options2 = node2.equals ? { equals: node2.equals } : void 0;
|
882
|
+
property2.observable || (property2.observable = getNodeObservable(node2, value2, options2));
|
883
|
+
const observable2 = readable(property2.observable);
|
884
|
+
return observable2;
|
885
|
+
};
|
886
|
+
}
|
887
|
+
}
|
888
|
+
if (UNREACTIVE_KEYS.has(key))
|
889
|
+
return target[key];
|
890
|
+
const node = getNodeExisting(target);
|
891
|
+
const getter = (_a2 = node.getters) == null ? void 0 : _a2.get(key);
|
892
|
+
const value = getter || target[key];
|
893
|
+
node.properties || (node.properties = new StoreMap());
|
894
|
+
const listenable = isListenable();
|
895
|
+
const proxiable = isProxiable(value);
|
896
|
+
const property = listenable || proxiable ? node.properties.get(key) || node.properties.insert(key, getNodeProperty(node, key, value)) : void 0;
|
897
|
+
if (property == null ? void 0 : property.node) {
|
898
|
+
lazySetAdd(property.node, "parents", node);
|
899
|
+
}
|
900
|
+
if (property && listenable) {
|
901
|
+
const options2 = node.equals ? { equals: node.equals } : void 0;
|
902
|
+
property.listen();
|
903
|
+
property.observable || (property.observable = getNodeObservable(node, value, options2));
|
904
|
+
property.observable.get();
|
905
|
+
}
|
906
|
+
if (getter) {
|
907
|
+
return getter.call(node.store);
|
908
|
+
} else {
|
909
|
+
if (typeof value === "function" && value === Array.prototype[key]) {
|
910
|
+
return function() {
|
911
|
+
return value.apply(node.store, arguments);
|
912
|
+
};
|
913
|
+
}
|
914
|
+
return ((_b2 = property == null ? void 0 : property.node) == null ? void 0 : _b2.store) || value;
|
915
|
+
}
|
916
|
+
},
|
917
|
+
set: (target, key, value) => {
|
918
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
919
|
+
value = getTarget(value);
|
920
|
+
const node = getNodeExisting(target);
|
921
|
+
const setter = (_a2 = node.setters) == null ? void 0 : _a2.get(key);
|
922
|
+
if (setter) {
|
923
|
+
setter.call(node.store, value);
|
924
|
+
} else {
|
925
|
+
const targetIsArray = isArray$1(target);
|
926
|
+
const valuePrev = target[key];
|
927
|
+
const hadProperty = !!valuePrev || key in target;
|
928
|
+
const equals = node.equals || is;
|
929
|
+
if (hadProperty && equals(value, valuePrev) && (key !== "length" || !targetIsArray))
|
930
|
+
return true;
|
931
|
+
const lengthPrev = targetIsArray && target["length"];
|
932
|
+
target[key] = value;
|
933
|
+
const lengthNext = targetIsArray && target["length"];
|
934
|
+
if (targetIsArray && key !== "length" && lengthPrev !== lengthNext) {
|
935
|
+
(_d = (_c = (_b2 = node.properties) == null ? void 0 : _b2.get("length")) == null ? void 0 : _c.observable) == null ? void 0 : _d.set(lengthNext);
|
936
|
+
}
|
937
|
+
(_e = node.values) == null ? void 0 : _e.observable.set(0);
|
938
|
+
if (!hadProperty) {
|
939
|
+
(_f = node.keys) == null ? void 0 : _f.observable.set(0);
|
940
|
+
(_h = (_g = node.has) == null ? void 0 : _g.get(key)) == null ? void 0 : _h.observable.set(true);
|
941
|
+
}
|
942
|
+
const property = (_i = node.properties) == null ? void 0 : _i.get(key);
|
943
|
+
if (property == null ? void 0 : property.node) {
|
944
|
+
lazySetDelete(property.node, "parents", node);
|
945
|
+
}
|
946
|
+
if (property) {
|
947
|
+
(_j = property.observable) == null ? void 0 : _j.set(value);
|
948
|
+
property.node = isProxiable(value) ? NODES.get(value) || getNode(value, key, node) : void 0;
|
949
|
+
}
|
950
|
+
if (property == null ? void 0 : property.node) {
|
951
|
+
lazySetAdd(property.node, "parents", node);
|
952
|
+
}
|
953
|
+
if (StoreListenersRoots.active) {
|
954
|
+
StoreListenersRoots.registerWith(property == null ? void 0 : property.node, node, key);
|
955
|
+
}
|
956
|
+
if (StoreListenersRegular.active) {
|
957
|
+
StoreListenersRegular.register(node);
|
958
|
+
}
|
959
|
+
if (targetIsArray && key === "length") {
|
960
|
+
const lengthPrev2 = Number(valuePrev);
|
961
|
+
const lengthNext2 = Number(value);
|
962
|
+
for (let i = lengthNext2; i < lengthPrev2; i++) {
|
963
|
+
if (i in target)
|
964
|
+
continue;
|
965
|
+
STORE_TRAPS.deleteProperty(target, `${i}`, true);
|
966
|
+
}
|
967
|
+
}
|
968
|
+
}
|
969
|
+
return true;
|
970
|
+
},
|
971
|
+
deleteProperty: (target, key, _force) => {
|
972
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
973
|
+
const hasProperty = key in target;
|
974
|
+
if (!_force && !hasProperty)
|
975
|
+
return true;
|
976
|
+
const deleted = Reflect.deleteProperty(target, key);
|
977
|
+
if (!deleted)
|
978
|
+
return false;
|
979
|
+
const node = getNodeExisting(target);
|
980
|
+
(_a2 = node.getters) == null ? void 0 : _a2.delete(key);
|
981
|
+
(_b2 = node.setters) == null ? void 0 : _b2.delete(key);
|
982
|
+
(_c = node.keys) == null ? void 0 : _c.observable.set(0);
|
983
|
+
(_d = node.values) == null ? void 0 : _d.observable.set(0);
|
984
|
+
(_f = (_e = node.has) == null ? void 0 : _e.get(key)) == null ? void 0 : _f.observable.set(false);
|
985
|
+
const property = (_g = node.properties) == null ? void 0 : _g.get(key);
|
986
|
+
if (StoreListenersRoots.active) {
|
987
|
+
StoreListenersRoots.registerWith(property == null ? void 0 : property.node, node, key);
|
988
|
+
}
|
989
|
+
if (property == null ? void 0 : property.node) {
|
990
|
+
lazySetDelete(property.node, "parents", node);
|
991
|
+
}
|
992
|
+
if (property) {
|
993
|
+
(_h = property.observable) == null ? void 0 : _h.set(void 0);
|
994
|
+
property.node = void 0;
|
995
|
+
}
|
996
|
+
if (StoreListenersRegular.active) {
|
997
|
+
StoreListenersRegular.register(node);
|
998
|
+
}
|
999
|
+
return true;
|
1000
|
+
},
|
1001
|
+
defineProperty: (target, key, descriptor) => {
|
1002
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
1003
|
+
const node = getNodeExisting(target);
|
1004
|
+
const equals = node.equals || is;
|
1005
|
+
const hadProperty = key in target;
|
1006
|
+
const descriptorPrev = Reflect.getOwnPropertyDescriptor(target, key);
|
1007
|
+
if ("value" in descriptor && isStore(descriptor.value)) {
|
1008
|
+
descriptor = { ...descriptor, value: getTarget(descriptor.value) };
|
1009
|
+
}
|
1010
|
+
if (descriptorPrev && isEqualDescriptor(descriptorPrev, descriptor, equals))
|
1011
|
+
return true;
|
1012
|
+
const defined = Reflect.defineProperty(target, key, descriptor);
|
1013
|
+
if (!defined)
|
1014
|
+
return false;
|
1015
|
+
if (!descriptor.get) {
|
1016
|
+
(_a2 = node.getters) == null ? void 0 : _a2.delete(key);
|
1017
|
+
} else if (descriptor.get) {
|
1018
|
+
node.getters || (node.getters = new StoreMap());
|
1019
|
+
node.getters.set(key, descriptor.get);
|
1020
|
+
}
|
1021
|
+
if (!descriptor.set) {
|
1022
|
+
(_b2 = node.setters) == null ? void 0 : _b2.delete(key);
|
1023
|
+
} else if (descriptor.set) {
|
1024
|
+
node.setters || (node.setters = new StoreMap());
|
1025
|
+
node.setters.set(key, descriptor.set);
|
1026
|
+
}
|
1027
|
+
if (hadProperty !== !!descriptor.enumerable) {
|
1028
|
+
(_c = node.keys) == null ? void 0 : _c.observable.set(0);
|
1029
|
+
}
|
1030
|
+
(_e = (_d = node.has) == null ? void 0 : _d.get(key)) == null ? void 0 : _e.observable.set(true);
|
1031
|
+
const property = (_f = node.properties) == null ? void 0 : _f.get(key);
|
1032
|
+
if (StoreListenersRoots.active) {
|
1033
|
+
StoreListenersRoots.registerWith(property == null ? void 0 : property.node, node, key);
|
1034
|
+
}
|
1035
|
+
if (property == null ? void 0 : property.node) {
|
1036
|
+
lazySetDelete(property.node, "parents", node);
|
1037
|
+
}
|
1038
|
+
if (property) {
|
1039
|
+
if ("get" in descriptor) {
|
1040
|
+
(_g = property.observable) == null ? void 0 : _g.set(descriptor.get);
|
1041
|
+
property.node = void 0;
|
1042
|
+
} else {
|
1043
|
+
const value = descriptor.value;
|
1044
|
+
(_h = property.observable) == null ? void 0 : _h.set(value);
|
1045
|
+
property.node = isProxiable(value) ? NODES.get(value) || getNode(value, key, node) : void 0;
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
if (property == null ? void 0 : property.node) {
|
1049
|
+
lazySetAdd(property.node, "parents", node);
|
1050
|
+
}
|
1051
|
+
if (StoreListenersRoots.active) {
|
1052
|
+
StoreListenersRoots.registerWith(property == null ? void 0 : property.node, node, key);
|
1053
|
+
}
|
1054
|
+
if (StoreListenersRegular.active) {
|
1055
|
+
StoreListenersRegular.register(node);
|
1056
|
+
}
|
1057
|
+
return true;
|
1058
|
+
},
|
1059
|
+
has: (target, key) => {
|
1060
|
+
if (key === SYMBOL_STORE)
|
1061
|
+
return true;
|
1062
|
+
if (key === SYMBOL_STORE_TARGET)
|
1063
|
+
return true;
|
1064
|
+
const value = key in target;
|
1065
|
+
if (isListenable()) {
|
1066
|
+
const node = getNodeExisting(target);
|
1067
|
+
node.has || (node.has = new StoreMap());
|
1068
|
+
const has = node.has.get(key) || node.has.insert(key, getNodeHas(node, key, value));
|
1069
|
+
has.listen();
|
1070
|
+
has.observable.get();
|
1071
|
+
}
|
1072
|
+
return value;
|
1073
|
+
},
|
1074
|
+
ownKeys: (target) => {
|
1075
|
+
const keys = Reflect.ownKeys(target);
|
1076
|
+
if (isListenable()) {
|
1077
|
+
const node = getNodeExisting(target);
|
1078
|
+
node.keys || (node.keys = getNodeKeys(node));
|
1079
|
+
node.keys.listen();
|
1080
|
+
node.keys.observable.get();
|
1081
|
+
}
|
1082
|
+
return keys;
|
1083
|
+
}
|
1084
|
+
};
|
1085
|
+
const STORE_UNTRACK_TRAPS = {
|
1086
|
+
/* API */
|
1087
|
+
has: (target, key) => {
|
1088
|
+
if (key === SYMBOL_STORE_UNTRACKED)
|
1089
|
+
return true;
|
1090
|
+
return key in target;
|
1091
|
+
}
|
1092
|
+
};
|
1093
|
+
const getNode = (value, key, parent, equals) => {
|
1094
|
+
if (isStore(value))
|
1095
|
+
return getNodeExisting(getTarget(value));
|
1096
|
+
const store2 = isFrozenLike(value, key, parent) ? value : new Proxy(value, STORE_TRAPS);
|
1097
|
+
const gettersAndSetters = getGettersAndSetters(value);
|
1098
|
+
const node = { parents: parent, store: store2 };
|
1099
|
+
if (gettersAndSetters) {
|
1100
|
+
const { getters, setters } = gettersAndSetters;
|
1101
|
+
if (getters)
|
1102
|
+
node.getters = getters;
|
1103
|
+
if (setters)
|
1104
|
+
node.setters = setters;
|
1105
|
+
}
|
1106
|
+
if (equals === false) {
|
1107
|
+
node.equals = nope;
|
1108
|
+
} else if (equals) {
|
1109
|
+
node.equals = equals;
|
1110
|
+
} else if (parent == null ? void 0 : parent.equals) {
|
1111
|
+
node.equals = parent.equals;
|
1112
|
+
}
|
1113
|
+
NODES.set(value, node);
|
1114
|
+
return node;
|
1115
|
+
};
|
1116
|
+
const getNodeExisting = (value) => {
|
1117
|
+
const node = NODES.get(value);
|
1118
|
+
if (!node)
|
1119
|
+
throw new Error("Impossible");
|
1120
|
+
return node;
|
1121
|
+
};
|
1122
|
+
const getNodeFromStore = (store2) => {
|
1123
|
+
return getNodeExisting(getTarget(store2));
|
1124
|
+
};
|
1125
|
+
const getNodeKeys = (node) => {
|
1126
|
+
const observable2 = getNodeObservable(node, 0, { equals: false });
|
1127
|
+
const keys = new StoreKeys(node, observable2);
|
1128
|
+
return keys;
|
1129
|
+
};
|
1130
|
+
const getNodeValues = (node) => {
|
1131
|
+
const observable2 = getNodeObservable(node, 0, { equals: false });
|
1132
|
+
const values = new StoreValues(node, observable2);
|
1133
|
+
return values;
|
1134
|
+
};
|
1135
|
+
const getNodeHas = (node, key, value) => {
|
1136
|
+
const observable2 = getNodeObservable(node, value);
|
1137
|
+
const has = new StoreHas(node, key, observable2);
|
1138
|
+
return has;
|
1139
|
+
};
|
1140
|
+
const getNodeObservable = (node, value, options2) => {
|
1141
|
+
return new Observable(value, options2);
|
1142
|
+
};
|
1143
|
+
const getNodeProperty = (node, key, value) => {
|
1144
|
+
const observable2 = void 0;
|
1145
|
+
const propertyNode = isProxiable(value) ? NODES.get(value) || getNode(value, key, node) : void 0;
|
1146
|
+
const property = new StoreProperty(node, key, observable2, propertyNode);
|
1147
|
+
node.properties || (node.properties = new StoreMap());
|
1148
|
+
node.properties.set(key, property);
|
1149
|
+
return property;
|
1150
|
+
};
|
1151
|
+
const getGettersAndSetters = (value) => {
|
1152
|
+
if (isArray$1(value))
|
1153
|
+
return;
|
1154
|
+
let getters;
|
1155
|
+
let setters;
|
1156
|
+
const keys = Object.keys(value);
|
1157
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
1158
|
+
const key = keys[i];
|
1159
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
1160
|
+
if (!descriptor)
|
1161
|
+
continue;
|
1162
|
+
const { get: get2, set } = descriptor;
|
1163
|
+
if (get2) {
|
1164
|
+
getters || (getters = new StoreMap());
|
1165
|
+
getters.set(key, get2);
|
1166
|
+
}
|
1167
|
+
if (set) {
|
1168
|
+
setters || (setters = new StoreMap());
|
1169
|
+
setters.set(key, set);
|
1170
|
+
}
|
1171
|
+
if (get2 && !set) {
|
1172
|
+
setters || (setters = new StoreMap());
|
1173
|
+
setters.set(key, throwNoSetterError);
|
1174
|
+
}
|
1175
|
+
}
|
1176
|
+
if (!getters && !setters)
|
1177
|
+
return;
|
1178
|
+
return { getters, setters };
|
1179
|
+
};
|
1180
|
+
const getStore = (value, options2) => {
|
1181
|
+
if (isStore(value))
|
1182
|
+
return value;
|
1183
|
+
const node = NODES.get(value) || getNode(value, void 0, void 0, options2 == null ? void 0 : options2.equals);
|
1184
|
+
return node.store;
|
1185
|
+
};
|
1186
|
+
const getTarget = (value) => {
|
1187
|
+
if (isStore(value))
|
1188
|
+
return value[SYMBOL_STORE_TARGET];
|
1189
|
+
return value;
|
1190
|
+
};
|
1191
|
+
const getUntracked = (value) => {
|
1192
|
+
if (!isObject$1(value))
|
1193
|
+
return value;
|
1194
|
+
if (isUntracked$1(value))
|
1195
|
+
return value;
|
1196
|
+
return new Proxy(value, STORE_UNTRACK_TRAPS);
|
1197
|
+
};
|
1198
|
+
const isEqualDescriptor = (a, b, equals) => {
|
1199
|
+
return !!a.configurable === !!b.configurable && !!a.enumerable === !!b.enumerable && !!a.writable === !!b.writable && equals(a.value, b.value) && a.get === b.get && a.set === b.set;
|
1200
|
+
};
|
1201
|
+
const isFrozenLike = (value, key, parent) => {
|
1202
|
+
if (Object.isFrozen(value))
|
1203
|
+
return true;
|
1204
|
+
if (!parent || key === void 0)
|
1205
|
+
return false;
|
1206
|
+
const target = store.unwrap(parent.store);
|
1207
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, key);
|
1208
|
+
if ((descriptor == null ? void 0 : descriptor.configurable) || (descriptor == null ? void 0 : descriptor.writable))
|
1209
|
+
return false;
|
1210
|
+
return true;
|
1211
|
+
};
|
1212
|
+
const isListenable = () => {
|
1213
|
+
return !!OBSERVER;
|
1214
|
+
};
|
1215
|
+
const isProxiable = (value) => {
|
1216
|
+
if (value === null || typeof value !== "object")
|
1217
|
+
return false;
|
1218
|
+
if (SYMBOL_STORE in value)
|
1219
|
+
return true;
|
1220
|
+
if (SYMBOL_STORE_UNTRACKED in value)
|
1221
|
+
return false;
|
1222
|
+
if (isArray$1(value))
|
1223
|
+
return true;
|
1224
|
+
const prototype = Object.getPrototypeOf(value);
|
1225
|
+
if (prototype === null)
|
1226
|
+
return true;
|
1227
|
+
return Object.getPrototypeOf(prototype) === null;
|
1228
|
+
};
|
1229
|
+
const isUntracked$1 = (value) => {
|
1230
|
+
if (value === null || typeof value !== "object")
|
1231
|
+
return false;
|
1232
|
+
return SYMBOL_STORE_UNTRACKED in value;
|
1233
|
+
};
|
1234
|
+
const throwNoSetterError = () => {
|
1235
|
+
throw new TypeError("Cannot set property value of #<Object> which has only a getter");
|
1236
|
+
};
|
1237
|
+
const store = (value, options2) => {
|
1238
|
+
if (!isObject$1(value))
|
1239
|
+
return value;
|
1240
|
+
if (isUntracked$1(value))
|
1241
|
+
return value;
|
1242
|
+
return getStore(value, options2);
|
1243
|
+
};
|
1244
|
+
store.on = (target, listener) => {
|
1245
|
+
const targets = isStore(target) ? [target] : castArray$1(target);
|
1246
|
+
const selectors = targets.filter(isFunction$1);
|
1247
|
+
const nodes = targets.filter(isStore).map(getNodeFromStore);
|
1248
|
+
StoreListenersRegular.active += 1;
|
1249
|
+
const disposers = selectors.map((selector) => {
|
1250
|
+
let inited = false;
|
1251
|
+
return effect(() => {
|
1252
|
+
if (inited) {
|
1253
|
+
StoreListenersRegular.listeners.add(listener);
|
1254
|
+
StoreScheduler.schedule();
|
1255
|
+
}
|
1256
|
+
inited = true;
|
1257
|
+
selector();
|
1258
|
+
}, { suspense: false, sync: true });
|
1259
|
+
});
|
1260
|
+
nodes.forEach((node) => {
|
1261
|
+
lazySetAdd(node, "listenersRegular", listener);
|
1262
|
+
});
|
1263
|
+
return () => {
|
1264
|
+
StoreListenersRegular.active -= 1;
|
1265
|
+
disposers.forEach((disposer) => {
|
1266
|
+
disposer();
|
1267
|
+
});
|
1268
|
+
nodes.forEach((node) => {
|
1269
|
+
lazySetDelete(node, "listenersRegular", listener);
|
1270
|
+
});
|
1271
|
+
};
|
1272
|
+
};
|
1273
|
+
store._onRoots = (target, listener) => {
|
1274
|
+
if (!isStore(target))
|
1275
|
+
return noop$1;
|
1276
|
+
const node = getNodeFromStore(target);
|
1277
|
+
if (node.parents)
|
1278
|
+
throw new Error("Only top-level stores are supported");
|
1279
|
+
StoreListenersRoots.active += 1;
|
1280
|
+
lazySetAdd(node, "listenersRoots", listener);
|
1281
|
+
return () => {
|
1282
|
+
StoreListenersRoots.active -= 1;
|
1283
|
+
lazySetDelete(node, "listenersRoots", listener);
|
1284
|
+
};
|
1285
|
+
};
|
1286
|
+
store.reconcile = /* @__PURE__ */ (() => {
|
1287
|
+
const getType = (value) => {
|
1288
|
+
if (isArray$1(value))
|
1289
|
+
return 1;
|
1290
|
+
if (isProxiable(value))
|
1291
|
+
return 2;
|
1292
|
+
return 0;
|
1293
|
+
};
|
1294
|
+
const reconcileOuter = (prev, next) => {
|
1295
|
+
const uprev = getTarget(prev);
|
1296
|
+
const unext = getTarget(next);
|
1297
|
+
reconcileInner(prev, next);
|
1298
|
+
const prevType = getType(uprev);
|
1299
|
+
const nextType = getType(unext);
|
1300
|
+
if (prevType === 1 || nextType === 1) {
|
1301
|
+
prev.length = next.length;
|
1302
|
+
}
|
1303
|
+
return prev;
|
1304
|
+
};
|
1305
|
+
const reconcileInner = (prev, next) => {
|
1306
|
+
const uprev = getTarget(prev);
|
1307
|
+
const unext = getTarget(next);
|
1308
|
+
const prevKeys = Object.keys(uprev);
|
1309
|
+
const nextKeys = Object.keys(unext);
|
1310
|
+
for (let i = 0, l = nextKeys.length; i < l; i++) {
|
1311
|
+
const key = nextKeys[i];
|
1312
|
+
const prevValue = uprev[key];
|
1313
|
+
const nextValue = unext[key];
|
1314
|
+
if (!is(prevValue, nextValue)) {
|
1315
|
+
const prevType = getType(prevValue);
|
1316
|
+
const nextType = getType(nextValue);
|
1317
|
+
if (prevType && prevType === nextType) {
|
1318
|
+
reconcileInner(prev[key], nextValue);
|
1319
|
+
if (prevType === 1) {
|
1320
|
+
prev[key].length = nextValue.length;
|
1321
|
+
}
|
1322
|
+
} else {
|
1323
|
+
prev[key] = nextValue;
|
1324
|
+
}
|
1325
|
+
} else if (prevValue === void 0 && !(key in uprev)) {
|
1326
|
+
prev[key] = void 0;
|
1327
|
+
}
|
1328
|
+
}
|
1329
|
+
for (let i = 0, l = prevKeys.length; i < l; i++) {
|
1330
|
+
const key = prevKeys[i];
|
1331
|
+
if (!(key in unext)) {
|
1332
|
+
delete prev[key];
|
1333
|
+
}
|
1334
|
+
}
|
1335
|
+
return prev;
|
1336
|
+
};
|
1337
|
+
const reconcile = (prev, next) => {
|
1338
|
+
return untrack(() => {
|
1339
|
+
return reconcileOuter(prev, next);
|
1340
|
+
});
|
1341
|
+
};
|
1342
|
+
return reconcile;
|
1343
|
+
})();
|
1344
|
+
store.untrack = (value) => {
|
1345
|
+
return getUntracked(value);
|
1346
|
+
};
|
1347
|
+
store.unwrap = (value) => {
|
1348
|
+
return getTarget(value);
|
1349
|
+
};
|
1350
|
+
const _with = () => {
|
1351
|
+
const owner = OWNER;
|
1352
|
+
const observer = OBSERVER;
|
1353
|
+
return (fn) => {
|
1354
|
+
return owner.wrap(() => fn(), owner, observer);
|
1355
|
+
};
|
1356
|
+
};
|
1357
|
+
const CONTEXTS_DATA = /* @__PURE__ */ new WeakMap();
|
1358
|
+
const DIRECTIVES = {};
|
1359
|
+
const SYMBOL_TEMPLATE_ACCESSOR = Symbol("Template.Accessor");
|
1360
|
+
const SYMBOLS_DIRECTIVES = {};
|
1361
|
+
const SYMBOL_CLONE = Symbol("CloneElement");
|
1362
|
+
const { createComment, createHTMLNode, createSVGNode, createText, createDocumentFragment } = (() => {
|
1363
|
+
if (typeof via !== "undefined") {
|
1364
|
+
const document2 = via.document;
|
1365
|
+
const createComment2 = document2.createComment;
|
1366
|
+
const createHTMLNode2 = document2.createElement;
|
1367
|
+
const createSVGNode2 = (name) => document2.createElementNS("http://www.w3.org/2000/svg", name);
|
1368
|
+
const createText2 = document2.createTextNode;
|
1369
|
+
const createDocumentFragment2 = document2.createDocumentFragment;
|
1370
|
+
return { createComment: createComment2, createHTMLNode: createHTMLNode2, createSVGNode: createSVGNode2, createText: createText2, createDocumentFragment: createDocumentFragment2 };
|
1371
|
+
} else {
|
1372
|
+
const createComment2 = document.createComment.bind(document, "");
|
1373
|
+
const createHTMLNode2 = document.createElement.bind(document);
|
1374
|
+
const createSVGNode2 = document.createElementNS.bind(document, "http://www.w3.org/2000/svg");
|
1375
|
+
const createText2 = document.createTextNode.bind(document);
|
1376
|
+
const createDocumentFragment2 = document.createDocumentFragment.bind(document);
|
1377
|
+
return { createComment: createComment2, createHTMLNode: createHTMLNode2, createSVGNode: createSVGNode2, createText: createText2, createDocumentFragment: createDocumentFragment2 };
|
1378
|
+
}
|
1379
|
+
})();
|
1380
|
+
const { assign } = Object;
|
1381
|
+
const castArray = (value) => {
|
1382
|
+
return isArray(value) ? value : [value];
|
1383
|
+
};
|
1384
|
+
const flatten = (arr) => {
|
1385
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
1386
|
+
if (!isArray(arr[i])) continue;
|
1387
|
+
return arr.flat(Infinity);
|
1388
|
+
}
|
1389
|
+
return arr;
|
1390
|
+
};
|
1391
|
+
const { isArray } = Array;
|
1392
|
+
const isBoolean = (value) => {
|
1393
|
+
return typeof value === "boolean";
|
1394
|
+
};
|
1395
|
+
const isFunction = (value) => {
|
1396
|
+
return typeof value === "function";
|
1397
|
+
};
|
1398
|
+
const isFunctionReactive = (value) => {
|
1399
|
+
var _a2, _b2;
|
1400
|
+
return !(SYMBOL_UNTRACKED in value || SYMBOL_UNTRACKED_UNWRAPPED in value || SYMBOL_OBSERVABLE_FROZEN in value || ((_b2 = (_a2 = value[SYMBOL_OBSERVABLE_READABLE]) == null ? void 0 : _a2.parent) == null ? void 0 : _b2.disposed));
|
1401
|
+
};
|
1402
|
+
const isNil = (value) => {
|
1403
|
+
return value === null || value === void 0;
|
1404
|
+
};
|
1405
|
+
const isNode = (value) => {
|
1406
|
+
return value instanceof Node;
|
1407
|
+
};
|
1408
|
+
const isObject = (value) => {
|
1409
|
+
return typeof value === "object" && value !== null;
|
1410
|
+
};
|
1411
|
+
const isString = (value) => {
|
1412
|
+
return typeof value === "string";
|
1413
|
+
};
|
1414
|
+
const isSVG = (value) => {
|
1415
|
+
return !!value["isSVG"];
|
1416
|
+
};
|
1417
|
+
const isSVGElement = /* @__PURE__ */ (() => {
|
1418
|
+
const svgRe = /^(t(ext$|s)|s[vwy]|g)|^set|tad|ker|p(at|s)|s(to|c$|ca|k)|r(ec|cl)|ew|us|f($|e|s)|cu|n[ei]|l[ty]|[GOP]/;
|
1419
|
+
const svgCache = {};
|
1420
|
+
return (element) => {
|
1421
|
+
const cached = svgCache[element];
|
1422
|
+
return cached !== void 0 ? cached : svgCache[element] = !element.includes("-") && svgRe.test(element);
|
1423
|
+
};
|
1424
|
+
})();
|
1425
|
+
const isTemplateAccessor = (value) => {
|
1426
|
+
return isFunction(value) && SYMBOL_TEMPLATE_ACCESSOR in value;
|
1427
|
+
};
|
1428
|
+
const isVoidChild = (value) => {
|
1429
|
+
return value === null || value === void 0 || typeof value === "boolean" || typeof value === "symbol";
|
1430
|
+
};
|
1431
|
+
const options = {
|
1432
|
+
sync: "init"
|
1433
|
+
};
|
1434
|
+
const useRenderEffect = (fn) => {
|
1435
|
+
return effect(fn, options);
|
1436
|
+
};
|
1437
|
+
const useCheapDisposed = () => {
|
1438
|
+
let disposed = false;
|
1439
|
+
const get2 = () => disposed;
|
1440
|
+
const set = () => disposed = true;
|
1441
|
+
cleanup(set);
|
1442
|
+
return get2;
|
1443
|
+
};
|
1444
|
+
const useMicrotask = (fn) => {
|
1445
|
+
const disposed = useCheapDisposed();
|
1446
|
+
const runWithOwner = _with();
|
1447
|
+
queueMicrotask(() => {
|
1448
|
+
if (disposed()) return;
|
1449
|
+
runWithOwner(fn);
|
1450
|
+
});
|
1451
|
+
};
|
1452
|
+
const classesToggle = (element, classes, force) => {
|
1453
|
+
const { className } = element;
|
1454
|
+
if (isString(className)) {
|
1455
|
+
if (!className) {
|
1456
|
+
if (force) {
|
1457
|
+
element.className = classes;
|
1458
|
+
return;
|
1459
|
+
} else {
|
1460
|
+
return;
|
1461
|
+
}
|
1462
|
+
} else if (!force && className === classes) {
|
1463
|
+
element.className = "";
|
1464
|
+
return;
|
1465
|
+
}
|
1466
|
+
}
|
1467
|
+
if (classes.includes(" ")) {
|
1468
|
+
classes.split(" ").forEach((cls) => {
|
1469
|
+
if (!cls.length) return;
|
1470
|
+
element.classList.toggle(cls, !!force);
|
1471
|
+
});
|
1472
|
+
} else {
|
1473
|
+
element.classList.toggle(classes, !!force);
|
1474
|
+
}
|
1475
|
+
};
|
1476
|
+
const dummyNode = createComment("");
|
1477
|
+
const beforeDummyWrapper = [dummyNode];
|
1478
|
+
const afterDummyWrapper = [dummyNode];
|
1479
|
+
const diff = (parent, before, after, nextSibling) => {
|
1480
|
+
if (before === after) return;
|
1481
|
+
if (before instanceof Node) {
|
1482
|
+
if (after instanceof Node) {
|
1483
|
+
if (before.parentNode === parent) {
|
1484
|
+
parent.replaceChild(after, before);
|
1485
|
+
return;
|
1486
|
+
}
|
1487
|
+
}
|
1488
|
+
beforeDummyWrapper[0] = before;
|
1489
|
+
before = beforeDummyWrapper;
|
1490
|
+
}
|
1491
|
+
if (after instanceof Node) {
|
1492
|
+
afterDummyWrapper[0] = after;
|
1493
|
+
after = afterDummyWrapper;
|
1494
|
+
}
|
1495
|
+
const bLength = after.length;
|
1496
|
+
let aEnd = before.length;
|
1497
|
+
let bEnd = bLength;
|
1498
|
+
let aStart = 0;
|
1499
|
+
let bStart = 0;
|
1500
|
+
let map = null;
|
1501
|
+
let removable;
|
1502
|
+
while (aStart < aEnd || bStart < bEnd) {
|
1503
|
+
if (aEnd === aStart) {
|
1504
|
+
const node = bEnd < bLength ? bStart ? after[bStart - 1].nextSibling : after[bEnd - bStart] : nextSibling;
|
1505
|
+
if (bStart < bEnd) {
|
1506
|
+
if (node) {
|
1507
|
+
node.before.apply(node, after.slice(bStart, bEnd));
|
1508
|
+
} else {
|
1509
|
+
parent.append.apply(parent, after.slice(bStart, bEnd));
|
1510
|
+
}
|
1511
|
+
bStart = bEnd;
|
1512
|
+
}
|
1513
|
+
} else if (bEnd === bStart) {
|
1514
|
+
while (aStart < aEnd) {
|
1515
|
+
if (!map || !map.has(before[aStart])) {
|
1516
|
+
removable = before[aStart];
|
1517
|
+
if (removable.parentNode === parent) {
|
1518
|
+
parent.removeChild(removable);
|
1519
|
+
}
|
1520
|
+
}
|
1521
|
+
aStart++;
|
1522
|
+
}
|
1523
|
+
} else if (before[aStart] === after[bStart]) {
|
1524
|
+
aStart++;
|
1525
|
+
bStart++;
|
1526
|
+
} else if (before[aEnd - 1] === after[bEnd - 1]) {
|
1527
|
+
aEnd--;
|
1528
|
+
bEnd--;
|
1529
|
+
} else if (before[aStart] === after[bEnd - 1] && after[bStart] === before[aEnd - 1]) {
|
1530
|
+
const node = before[--aEnd].nextSibling;
|
1531
|
+
parent.insertBefore(
|
1532
|
+
after[bStart++],
|
1533
|
+
before[aStart++].nextSibling
|
1534
|
+
);
|
1535
|
+
parent.insertBefore(after[--bEnd], node);
|
1536
|
+
before[aEnd] = after[bEnd];
|
1537
|
+
} else {
|
1538
|
+
if (!map) {
|
1539
|
+
map = /* @__PURE__ */ new Map();
|
1540
|
+
let i = bStart;
|
1541
|
+
while (i < bEnd)
|
1542
|
+
map.set(after[i], i++);
|
1543
|
+
}
|
1544
|
+
if (map.has(before[aStart])) {
|
1545
|
+
const index = map.get(before[aStart]);
|
1546
|
+
if (bStart < index && index < bEnd) {
|
1547
|
+
let i = aStart;
|
1548
|
+
let sequence = 1;
|
1549
|
+
while (++i < aEnd && i < bEnd && map.get(before[i]) === index + sequence)
|
1550
|
+
sequence++;
|
1551
|
+
if (sequence > index - bStart) {
|
1552
|
+
const node = before[aStart];
|
1553
|
+
if (bStart < index) {
|
1554
|
+
if (node) {
|
1555
|
+
node.before.apply(node, after.slice(bStart, index));
|
1556
|
+
} else {
|
1557
|
+
parent.append.apply(parent, after.slice(bStart, index));
|
1558
|
+
}
|
1559
|
+
bStart = index;
|
1560
|
+
}
|
1561
|
+
} else {
|
1562
|
+
parent.replaceChild(
|
1563
|
+
after[bStart++],
|
1564
|
+
before[aStart++]
|
1565
|
+
);
|
1566
|
+
}
|
1567
|
+
} else
|
1568
|
+
aStart++;
|
1569
|
+
} else {
|
1570
|
+
removable = before[aStart++];
|
1571
|
+
if (removable.parentNode === parent) {
|
1572
|
+
parent.removeChild(removable);
|
1573
|
+
}
|
1574
|
+
}
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
beforeDummyWrapper[0] = dummyNode;
|
1578
|
+
afterDummyWrapper[0] = dummyNode;
|
1579
|
+
};
|
1580
|
+
const NOOP_CHILDREN = [];
|
1581
|
+
const FragmentUtils = {
|
1582
|
+
make: () => {
|
1583
|
+
return {
|
1584
|
+
values: void 0,
|
1585
|
+
length: 0
|
1586
|
+
};
|
1587
|
+
},
|
1588
|
+
makeWithNode: (node) => {
|
1589
|
+
return {
|
1590
|
+
values: node,
|
1591
|
+
length: 1
|
1592
|
+
};
|
1593
|
+
},
|
1594
|
+
makeWithFragment: (fragment) => {
|
1595
|
+
return {
|
1596
|
+
values: fragment,
|
1597
|
+
fragmented: true,
|
1598
|
+
length: 1
|
1599
|
+
};
|
1600
|
+
},
|
1601
|
+
getChildrenFragmented: (thiz, children = []) => {
|
1602
|
+
const { values, length } = thiz;
|
1603
|
+
if (!length) return children;
|
1604
|
+
if (values instanceof Array) {
|
1605
|
+
for (let i = 0, l = values.length; i < l; i++) {
|
1606
|
+
const value = values[i];
|
1607
|
+
if (value instanceof Node) {
|
1608
|
+
children.push(value);
|
1609
|
+
} else {
|
1610
|
+
FragmentUtils.getChildrenFragmented(value, children);
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
} else {
|
1614
|
+
if (values instanceof Node) {
|
1615
|
+
children.push(values);
|
1616
|
+
} else {
|
1617
|
+
FragmentUtils.getChildrenFragmented(values, children);
|
1618
|
+
}
|
1619
|
+
}
|
1620
|
+
return children;
|
1621
|
+
},
|
1622
|
+
getChildren: (thiz) => {
|
1623
|
+
if (!thiz.length) return NOOP_CHILDREN;
|
1624
|
+
if (!thiz.fragmented) return thiz.values;
|
1625
|
+
if (thiz.length === 1) return FragmentUtils.getChildren(thiz.values);
|
1626
|
+
return FragmentUtils.getChildrenFragmented(thiz);
|
1627
|
+
},
|
1628
|
+
pushFragment: (thiz, fragment) => {
|
1629
|
+
FragmentUtils.pushValue(thiz, fragment);
|
1630
|
+
thiz.fragmented = true;
|
1631
|
+
},
|
1632
|
+
pushNode: (thiz, node) => {
|
1633
|
+
FragmentUtils.pushValue(thiz, node);
|
1634
|
+
},
|
1635
|
+
pushValue: (thiz, value) => {
|
1636
|
+
const { values, length } = thiz;
|
1637
|
+
if (length === 0) {
|
1638
|
+
thiz.values = value;
|
1639
|
+
} else if (length === 1) {
|
1640
|
+
thiz.values = [values, value];
|
1641
|
+
} else {
|
1642
|
+
values.push(value);
|
1643
|
+
}
|
1644
|
+
thiz.length += 1;
|
1645
|
+
},
|
1646
|
+
replaceWithNode: (thiz, node) => {
|
1647
|
+
thiz.values = node;
|
1648
|
+
delete thiz.fragmented;
|
1649
|
+
thiz.length = 1;
|
1650
|
+
},
|
1651
|
+
replaceWithFragment: (thiz, fragment) => {
|
1652
|
+
thiz.values = fragment.values;
|
1653
|
+
thiz.fragmented = fragment.fragmented;
|
1654
|
+
thiz.length = fragment.length;
|
1655
|
+
}
|
1656
|
+
};
|
1657
|
+
const resolveChild = (value, setter, _dynamic = false) => {
|
1658
|
+
if (isFunction(value)) {
|
1659
|
+
if (!isFunctionReactive(value)) {
|
1660
|
+
resolveChild(value(), setter, _dynamic);
|
1661
|
+
} else {
|
1662
|
+
useRenderEffect(() => {
|
1663
|
+
resolveChild(value(), setter, true);
|
1664
|
+
});
|
1665
|
+
}
|
1666
|
+
} else if (isArray(value)) {
|
1667
|
+
const [values, hasObservables] = resolveArraysAndStatics(value);
|
1668
|
+
values[SYMBOL_UNCACHED] = value[SYMBOL_UNCACHED];
|
1669
|
+
setter(values, hasObservables || _dynamic);
|
1670
|
+
} else {
|
1671
|
+
setter(value, _dynamic);
|
1672
|
+
}
|
1673
|
+
};
|
1674
|
+
const resolveClass = (classes, resolved = {}) => {
|
1675
|
+
if (isString(classes)) {
|
1676
|
+
classes.split(/\s+/g).filter(Boolean).filter((cls) => {
|
1677
|
+
resolved[cls] = true;
|
1678
|
+
});
|
1679
|
+
} else if (isFunction(classes)) {
|
1680
|
+
resolveClass(classes(), resolved);
|
1681
|
+
} else if (isArray(classes)) {
|
1682
|
+
classes.forEach((cls) => {
|
1683
|
+
resolveClass(cls, resolved);
|
1684
|
+
});
|
1685
|
+
} else if (classes) {
|
1686
|
+
for (const key in classes) {
|
1687
|
+
const value = classes[key];
|
1688
|
+
const isActive = !!get(value);
|
1689
|
+
if (!isActive) continue;
|
1690
|
+
resolved[key] = true;
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
return resolved;
|
1694
|
+
};
|
1695
|
+
const resolveStyle = (styles, resolved = {}) => {
|
1696
|
+
if (isString(styles)) {
|
1697
|
+
return styles;
|
1698
|
+
} else if (isFunction(styles)) {
|
1699
|
+
return resolveStyle(styles(), resolved);
|
1700
|
+
} else if (isArray(styles)) {
|
1701
|
+
styles.forEach((style) => {
|
1702
|
+
resolveStyle(style, resolved);
|
1703
|
+
});
|
1704
|
+
} else if (styles) {
|
1705
|
+
for (const key in styles) {
|
1706
|
+
const value = styles[key];
|
1707
|
+
resolved[key] = get(value);
|
1708
|
+
}
|
1709
|
+
}
|
1710
|
+
return resolved;
|
1711
|
+
};
|
1712
|
+
const resolveArraysAndStatics = /* @__PURE__ */ (() => {
|
1713
|
+
const DUMMY_RESOLVED = [];
|
1714
|
+
const resolveArraysAndStaticsInner = (values, resolved, hasObservables) => {
|
1715
|
+
for (let i = 0, l = values.length; i < l; i++) {
|
1716
|
+
const value = values[i];
|
1717
|
+
const type = typeof value;
|
1718
|
+
if (type === "string" || type === "number" || type === "bigint") {
|
1719
|
+
if (resolved === DUMMY_RESOLVED) resolved = values.slice(0, i);
|
1720
|
+
resolved.push(createText(value));
|
1721
|
+
} else if (type === "object" && isArray(value)) {
|
1722
|
+
if (resolved === DUMMY_RESOLVED) resolved = values.slice(0, i);
|
1723
|
+
hasObservables = resolveArraysAndStaticsInner(value, resolved, hasObservables)[1];
|
1724
|
+
} else if (type === "function" && isObservable(value)) {
|
1725
|
+
if (resolved !== DUMMY_RESOLVED) resolved.push(value);
|
1726
|
+
hasObservables = true;
|
1727
|
+
} else {
|
1728
|
+
if (resolved !== DUMMY_RESOLVED) resolved.push(value);
|
1729
|
+
}
|
1730
|
+
}
|
1731
|
+
if (resolved === DUMMY_RESOLVED) resolved = values;
|
1732
|
+
return [resolved, hasObservables];
|
1733
|
+
};
|
1734
|
+
return (values) => {
|
1735
|
+
return resolveArraysAndStaticsInner(values, DUMMY_RESOLVED, false);
|
1736
|
+
};
|
1737
|
+
})();
|
1738
|
+
const setAttributeStatic = /* @__PURE__ */ (() => {
|
1739
|
+
const attributesBoolean = /* @__PURE__ */ new Set(["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"]);
|
1740
|
+
const attributeCamelCasedRe = /e(r[HRWrv]|[Vawy])|Con|l(e[Tcs]|c)|s(eP|y)|a(t[rt]|u|v)|Of|Ex|f[XYa]|gt|hR|d[Pg]|t[TXYd]|[UZq]/;
|
1741
|
+
const attributesCache = {};
|
1742
|
+
const uppercaseRe = /[A-Z]/g;
|
1743
|
+
const normalizeKeySvg = (key) => {
|
1744
|
+
return attributesCache[key] || (attributesCache[key] = attributeCamelCasedRe.test(key) ? key : key.replace(uppercaseRe, (char) => `-${char.toLowerCase()}`));
|
1745
|
+
};
|
1746
|
+
return (element, key, value) => {
|
1747
|
+
if (isSVG(element)) {
|
1748
|
+
key = key === "xlinkHref" || key === "xlink:href" ? "href" : normalizeKeySvg(key);
|
1749
|
+
if (isNil(value) || value === false && attributesBoolean.has(key)) {
|
1750
|
+
element.removeAttribute(key);
|
1751
|
+
} else {
|
1752
|
+
element.setAttribute(key, String(value));
|
1753
|
+
}
|
1754
|
+
} else {
|
1755
|
+
if (isNil(value) || value === false && attributesBoolean.has(key)) {
|
1756
|
+
element.removeAttribute(key);
|
1757
|
+
} else {
|
1758
|
+
value = value === true ? "" : String(value);
|
1759
|
+
element.setAttribute(key, value);
|
1760
|
+
}
|
1761
|
+
}
|
1762
|
+
};
|
1763
|
+
})();
|
1764
|
+
const setAttribute = (element, key, value) => {
|
1765
|
+
if (isFunction(value) && isFunctionReactive(value)) {
|
1766
|
+
useRenderEffect(() => {
|
1767
|
+
setAttributeStatic(element, key, value());
|
1768
|
+
});
|
1769
|
+
} else {
|
1770
|
+
setAttributeStatic(element, key, get(value));
|
1771
|
+
}
|
1772
|
+
};
|
1773
|
+
const setChildReplacementText = (child, childPrev) => {
|
1774
|
+
if (childPrev.nodeType === 3) {
|
1775
|
+
childPrev.nodeValue = child;
|
1776
|
+
return childPrev;
|
1777
|
+
} else {
|
1778
|
+
const parent = childPrev.parentElement;
|
1779
|
+
if (!parent) throw new Error("Invalid child replacement");
|
1780
|
+
const textNode = createText(child);
|
1781
|
+
parent.replaceChild(textNode, childPrev);
|
1782
|
+
return textNode;
|
1783
|
+
}
|
1784
|
+
};
|
1785
|
+
const setChildStatic = (parent, fragment, fragmentOnly, child, dynamic) => {
|
1786
|
+
if (!dynamic && isVoidChild(child)) return;
|
1787
|
+
const prev = FragmentUtils.getChildren(fragment);
|
1788
|
+
const prevIsArray = prev instanceof Array;
|
1789
|
+
const prevLength = prevIsArray ? prev.length : 1;
|
1790
|
+
const prevFirst = prevIsArray ? prev[0] : prev;
|
1791
|
+
const prevLast = prevIsArray ? prev[prevLength - 1] : prev;
|
1792
|
+
const prevSibling = (prevLast == null ? void 0 : prevLast.nextSibling) || null;
|
1793
|
+
if (prevLength === 0) {
|
1794
|
+
const type = typeof child;
|
1795
|
+
if (type === "string" || type === "number" || type === "bigint") {
|
1796
|
+
const textNode = createText(child);
|
1797
|
+
if (!fragmentOnly) {
|
1798
|
+
parent.appendChild(textNode);
|
1799
|
+
}
|
1800
|
+
FragmentUtils.replaceWithNode(fragment, textNode);
|
1801
|
+
return;
|
1802
|
+
} else if (type === "object" && child !== null && typeof child.nodeType === "number") {
|
1803
|
+
const node = child;
|
1804
|
+
if (!fragmentOnly) {
|
1805
|
+
parent.insertBefore(node, null);
|
1806
|
+
}
|
1807
|
+
FragmentUtils.replaceWithNode(fragment, node);
|
1808
|
+
return;
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
if (prevLength === 1) {
|
1812
|
+
const type = typeof child;
|
1813
|
+
if (type === "string" || type === "number" || type === "bigint") {
|
1814
|
+
const node = setChildReplacementText(String(child), prevFirst);
|
1815
|
+
FragmentUtils.replaceWithNode(fragment, node);
|
1816
|
+
return;
|
1817
|
+
}
|
1818
|
+
}
|
1819
|
+
const fragmentNext = FragmentUtils.make();
|
1820
|
+
const children = Array.isArray(child) ? child : [child];
|
1821
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
1822
|
+
const child2 = children[i];
|
1823
|
+
const type = typeof child2;
|
1824
|
+
if (type === "string" || type === "number" || type === "bigint") {
|
1825
|
+
FragmentUtils.pushNode(fragmentNext, createText(child2));
|
1826
|
+
} else if (type === "object" && child2 !== null && typeof child2.nodeType === "number") {
|
1827
|
+
FragmentUtils.pushNode(fragmentNext, child2);
|
1828
|
+
} else if (type === "function") {
|
1829
|
+
const fragment2 = FragmentUtils.make();
|
1830
|
+
let childFragmentOnly = !fragmentOnly;
|
1831
|
+
FragmentUtils.pushFragment(fragmentNext, fragment2);
|
1832
|
+
resolveChild(child2, (child3, dynamic2) => {
|
1833
|
+
const fragmentOnly2 = childFragmentOnly;
|
1834
|
+
childFragmentOnly = false;
|
1835
|
+
setChildStatic(parent, fragment2, fragmentOnly2, child3, dynamic2);
|
1836
|
+
});
|
1837
|
+
}
|
1838
|
+
}
|
1839
|
+
let next = FragmentUtils.getChildren(fragmentNext);
|
1840
|
+
let nextLength = fragmentNext.length;
|
1841
|
+
if (nextLength === 0 && prevLength === 1 && prevFirst.nodeType === 8) {
|
1842
|
+
return;
|
1843
|
+
}
|
1844
|
+
if (!fragmentOnly && (nextLength === 0 || prevLength === 1 && prevFirst.nodeType === 8 || children[SYMBOL_UNCACHED])) {
|
1845
|
+
const { childNodes } = parent;
|
1846
|
+
if (childNodes.length === prevLength) {
|
1847
|
+
parent.textContent = "";
|
1848
|
+
if (nextLength === 0) {
|
1849
|
+
const placeholder = createComment("");
|
1850
|
+
FragmentUtils.pushNode(fragmentNext, placeholder);
|
1851
|
+
if (next !== fragmentNext.values) {
|
1852
|
+
next = placeholder;
|
1853
|
+
nextLength += 1;
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
if (prevSibling) {
|
1857
|
+
if (next instanceof Array) {
|
1858
|
+
prevSibling.before.apply(prevSibling, next);
|
1859
|
+
} else {
|
1860
|
+
parent.insertBefore(next, prevSibling);
|
1861
|
+
}
|
1862
|
+
} else {
|
1863
|
+
if (next instanceof Array) {
|
1864
|
+
parent.append.apply(parent, next);
|
1865
|
+
} else {
|
1866
|
+
parent.append(next);
|
1867
|
+
}
|
1868
|
+
}
|
1869
|
+
FragmentUtils.replaceWithFragment(fragment, fragmentNext);
|
1870
|
+
return;
|
1871
|
+
}
|
1872
|
+
}
|
1873
|
+
if (nextLength === 0) {
|
1874
|
+
const placeholder = createComment("");
|
1875
|
+
FragmentUtils.pushNode(fragmentNext, placeholder);
|
1876
|
+
if (next !== fragmentNext.values) {
|
1877
|
+
next = placeholder;
|
1878
|
+
nextLength += 1;
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
if (!fragmentOnly) {
|
1882
|
+
diff(parent, prev, next, prevSibling);
|
1883
|
+
}
|
1884
|
+
FragmentUtils.replaceWithFragment(fragment, fragmentNext);
|
1885
|
+
};
|
1886
|
+
const setChild = (parent, child, fragment = FragmentUtils.make()) => {
|
1887
|
+
resolveChild(child, setChildStatic.bind(void 0, parent, fragment, false));
|
1888
|
+
};
|
1889
|
+
const setClassStatic = classesToggle;
|
1890
|
+
const setClass = (element, key, value) => {
|
1891
|
+
if (isFunction(value) && isFunctionReactive(value)) {
|
1892
|
+
useRenderEffect(() => {
|
1893
|
+
setClassStatic(element, key, value());
|
1894
|
+
});
|
1895
|
+
} else {
|
1896
|
+
setClassStatic(element, key, get(value));
|
1897
|
+
}
|
1898
|
+
};
|
1899
|
+
const setClassBooleanStatic = (element, value, key, keyPrev) => {
|
1900
|
+
if (keyPrev && keyPrev !== true) {
|
1901
|
+
setClassStatic(element, keyPrev, false);
|
1902
|
+
}
|
1903
|
+
if (key && key !== true) {
|
1904
|
+
setClassStatic(element, key, value);
|
1905
|
+
}
|
1906
|
+
};
|
1907
|
+
const setClassBoolean = (element, value, key) => {
|
1908
|
+
if (isFunction(key) && isFunctionReactive(key)) {
|
1909
|
+
let keyPrev;
|
1910
|
+
useRenderEffect(() => {
|
1911
|
+
const keyNext = key();
|
1912
|
+
setClassBooleanStatic(element, value, keyNext, keyPrev);
|
1913
|
+
keyPrev = keyNext;
|
1914
|
+
});
|
1915
|
+
} else {
|
1916
|
+
setClassBooleanStatic(element, value, get(key));
|
1917
|
+
}
|
1918
|
+
};
|
1919
|
+
const setClassesStatic = (element, object, objectPrev) => {
|
1920
|
+
if (isString(object)) {
|
1921
|
+
if (isSVG(element)) {
|
1922
|
+
element.setAttribute("class", object);
|
1923
|
+
} else {
|
1924
|
+
element.className = object;
|
1925
|
+
}
|
1926
|
+
} else {
|
1927
|
+
if (objectPrev) {
|
1928
|
+
if (isString(objectPrev)) {
|
1929
|
+
if (objectPrev) {
|
1930
|
+
if (isSVG(element)) {
|
1931
|
+
element.setAttribute("class", "");
|
1932
|
+
} else {
|
1933
|
+
element.className = "";
|
1934
|
+
}
|
1935
|
+
}
|
1936
|
+
} else if (isArray(objectPrev)) {
|
1937
|
+
objectPrev = store.unwrap(objectPrev);
|
1938
|
+
for (let i = 0, l = objectPrev.length; i < l; i++) {
|
1939
|
+
if (!objectPrev[i]) continue;
|
1940
|
+
setClassBoolean(element, false, objectPrev[i]);
|
1941
|
+
}
|
1942
|
+
} else {
|
1943
|
+
objectPrev = store.unwrap(objectPrev);
|
1944
|
+
for (const key in objectPrev) {
|
1945
|
+
if (object && key in object) continue;
|
1946
|
+
setClass(element, key, false);
|
1947
|
+
}
|
1948
|
+
}
|
1949
|
+
}
|
1950
|
+
if (isArray(object)) {
|
1951
|
+
if (isStore(object)) {
|
1952
|
+
for (let i = 0, l = object.length; i < l; i++) {
|
1953
|
+
const fn = untrack(() => isFunction(object[i]) ? object[i] : object[SYMBOL_STORE_OBSERVABLE](String(i)));
|
1954
|
+
setClassBoolean(element, true, fn);
|
1955
|
+
}
|
1956
|
+
} else {
|
1957
|
+
for (let i = 0, l = object.length; i < l; i++) {
|
1958
|
+
if (!object[i]) continue;
|
1959
|
+
setClassBoolean(element, true, object[i]);
|
1960
|
+
}
|
1961
|
+
}
|
1962
|
+
} else {
|
1963
|
+
if (isStore(object)) {
|
1964
|
+
for (const key in object) {
|
1965
|
+
const fn = untrack(() => isFunction(object[key]) ? object[key] : object[SYMBOL_STORE_OBSERVABLE](key));
|
1966
|
+
setClass(element, key, fn);
|
1967
|
+
}
|
1968
|
+
} else {
|
1969
|
+
for (const key in object) {
|
1970
|
+
setClass(element, key, object[key]);
|
1971
|
+
}
|
1972
|
+
}
|
1973
|
+
}
|
1974
|
+
}
|
1975
|
+
};
|
1976
|
+
const setClasses = (element, object) => {
|
1977
|
+
if (isFunction(object) || isArray(object)) {
|
1978
|
+
let objectPrev;
|
1979
|
+
useRenderEffect(() => {
|
1980
|
+
const objectNext = resolveClass(object);
|
1981
|
+
setClassesStatic(element, objectNext, objectPrev);
|
1982
|
+
objectPrev = objectNext;
|
1983
|
+
});
|
1984
|
+
} else {
|
1985
|
+
setClassesStatic(element, object);
|
1986
|
+
}
|
1987
|
+
};
|
1988
|
+
const setDirective = (element, directive, args) => {
|
1989
|
+
const symbol = SYMBOLS_DIRECTIVES[directive] || Symbol();
|
1990
|
+
const data = context(symbol) || DIRECTIVES[symbol];
|
1991
|
+
if (!data) throw new Error(`Directive "${directive}" not found`);
|
1992
|
+
const call = () => data.fn(element, ...castArray(args));
|
1993
|
+
if (data.immediate) {
|
1994
|
+
call();
|
1995
|
+
} else {
|
1996
|
+
useMicrotask(call);
|
1997
|
+
}
|
1998
|
+
};
|
1999
|
+
const setEventStatic = /* @__PURE__ */ (() => {
|
2000
|
+
const delegatedEvents = {
|
2001
|
+
onauxclick: ["_onauxclick", false],
|
2002
|
+
onbeforeinput: ["_onbeforeinput", false],
|
2003
|
+
onclick: ["_onclick", false],
|
2004
|
+
ondblclick: ["_ondblclick", false],
|
2005
|
+
onfocusin: ["_onfocusin", false],
|
2006
|
+
onfocusout: ["_onfocusout", false],
|
2007
|
+
oninput: ["_oninput", false],
|
2008
|
+
onkeydown: ["_onkeydown", false],
|
2009
|
+
onkeyup: ["_onkeyup", false],
|
2010
|
+
onmousedown: ["_onmousedown", false],
|
2011
|
+
onmouseup: ["_onmouseup", false]
|
2012
|
+
};
|
2013
|
+
const delegate = (event) => {
|
2014
|
+
const key = `_${event}`;
|
2015
|
+
document.addEventListener(event.slice(2), (event2) => {
|
2016
|
+
const targets = event2.composedPath();
|
2017
|
+
let target = null;
|
2018
|
+
Object.defineProperty(event2, "currentTarget", {
|
2019
|
+
configurable: true,
|
2020
|
+
get() {
|
2021
|
+
return target;
|
2022
|
+
}
|
2023
|
+
});
|
2024
|
+
for (let i = 0, l = targets.length; i < l; i++) {
|
2025
|
+
target = targets[i];
|
2026
|
+
const handler = target[key];
|
2027
|
+
if (!handler) continue;
|
2028
|
+
handler(event2);
|
2029
|
+
if (event2.cancelBubble) break;
|
2030
|
+
}
|
2031
|
+
target = null;
|
2032
|
+
});
|
2033
|
+
};
|
2034
|
+
return (element, event, value) => {
|
2035
|
+
if (event.startsWith("onmiddleclick")) {
|
2036
|
+
const _value = value;
|
2037
|
+
event = `onauxclick${event.slice(13)}`;
|
2038
|
+
value = _value && ((event2) => event2["button"] === 1 && _value(event2));
|
2039
|
+
}
|
2040
|
+
const delegated = delegatedEvents[event];
|
2041
|
+
if (delegated) {
|
2042
|
+
if (!delegated[1]) {
|
2043
|
+
delegated[1] = true;
|
2044
|
+
delegate(event);
|
2045
|
+
}
|
2046
|
+
element[delegated[0]] = value;
|
2047
|
+
} else if (event.endsWith("passive")) {
|
2048
|
+
const isCapture = event.endsWith("capturepassive");
|
2049
|
+
const type = event.slice(2, -7 - (isCapture ? 7 : 0));
|
2050
|
+
const key = `_${event}`;
|
2051
|
+
const valuePrev = element[key];
|
2052
|
+
if (valuePrev) element.removeEventListener(type, valuePrev, { capture: isCapture });
|
2053
|
+
if (value) element.addEventListener(type, value, { passive: true, capture: isCapture });
|
2054
|
+
element[key] = value;
|
2055
|
+
} else if (event.endsWith("capture")) {
|
2056
|
+
const type = event.slice(2, -7);
|
2057
|
+
const key = `_${event}`;
|
2058
|
+
const valuePrev = element[key];
|
2059
|
+
if (valuePrev) element.removeEventListener(type, valuePrev, { capture: true });
|
2060
|
+
if (value) element.addEventListener(type, value, { capture: true });
|
2061
|
+
element[key] = value;
|
2062
|
+
} else {
|
2063
|
+
element[event] = value;
|
2064
|
+
}
|
2065
|
+
};
|
2066
|
+
})();
|
2067
|
+
const setEvent = (element, event, value) => {
|
2068
|
+
setEventStatic(element, event, value);
|
2069
|
+
};
|
2070
|
+
const setHTMLStatic = (element, value) => {
|
2071
|
+
element.innerHTML = String(isNil(value) ? "" : value);
|
2072
|
+
};
|
2073
|
+
const setHTML = (element, value) => {
|
2074
|
+
useRenderEffect(() => {
|
2075
|
+
setHTMLStatic(element, get(get(value).__html));
|
2076
|
+
});
|
2077
|
+
};
|
2078
|
+
const setPropertyStatic = (element, key, value) => {
|
2079
|
+
if (key === "tabIndex" && isBoolean(value)) {
|
2080
|
+
value = value ? 0 : void 0;
|
2081
|
+
}
|
2082
|
+
if (key === "value") {
|
2083
|
+
if (element.tagName === "PROGRESS") {
|
2084
|
+
value ?? (value = null);
|
2085
|
+
} else if (element.tagName === "SELECT" && !element["_$inited"]) {
|
2086
|
+
element["_$inited"] = true;
|
2087
|
+
queueMicrotask(() => element[key] = value);
|
2088
|
+
}
|
2089
|
+
}
|
2090
|
+
try {
|
2091
|
+
element[key] = value;
|
2092
|
+
if (isNil(value)) {
|
2093
|
+
setAttributeStatic(element, key, null);
|
2094
|
+
}
|
2095
|
+
} catch {
|
2096
|
+
setAttributeStatic(element, key, value);
|
2097
|
+
}
|
2098
|
+
};
|
2099
|
+
const setProperty = (element, key, value) => {
|
2100
|
+
if (isFunction(value) && isFunctionReactive(value)) {
|
2101
|
+
useRenderEffect(() => {
|
2102
|
+
setPropertyStatic(element, key, value());
|
2103
|
+
});
|
2104
|
+
} else {
|
2105
|
+
setPropertyStatic(element, key, get(value));
|
2106
|
+
}
|
2107
|
+
};
|
2108
|
+
const setRef = (element, value) => {
|
2109
|
+
if (isNil(value)) return;
|
2110
|
+
const values = flatten(castArray(value)).filter(Boolean);
|
2111
|
+
if (!values.length) return;
|
2112
|
+
useMicrotask(() => untrack(() => values.forEach((value2) => value2 == null ? void 0 : value2(element))));
|
2113
|
+
};
|
2114
|
+
const setStyleStatic = /* @__PURE__ */ (() => {
|
2115
|
+
const propertyNonDimensionalRe = /^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/i;
|
2116
|
+
const propertyNonDimensionalCache = {};
|
2117
|
+
return (element, key, value) => {
|
2118
|
+
if (key.charCodeAt(0) === 45) {
|
2119
|
+
if (isNil(value)) {
|
2120
|
+
element.style.removeProperty(key);
|
2121
|
+
} else {
|
2122
|
+
element.style.setProperty(key, String(value));
|
2123
|
+
}
|
2124
|
+
} else if (isNil(value)) {
|
2125
|
+
element.style[key] = null;
|
2126
|
+
} else {
|
2127
|
+
element.style[key] = isString(value) || (propertyNonDimensionalCache[key] || (propertyNonDimensionalCache[key] = propertyNonDimensionalRe.test(key))) ? value : `${value}px`;
|
2128
|
+
}
|
2129
|
+
};
|
2130
|
+
})();
|
2131
|
+
const setStyle = (element, key, value) => {
|
2132
|
+
if (isFunction(value) && isFunctionReactive(value)) {
|
2133
|
+
useRenderEffect(() => {
|
2134
|
+
setStyleStatic(element, key, value());
|
2135
|
+
});
|
2136
|
+
} else {
|
2137
|
+
setStyleStatic(element, key, get(value));
|
2138
|
+
}
|
2139
|
+
};
|
2140
|
+
const setStylesStatic = (element, object, objectPrev) => {
|
2141
|
+
if (isString(object)) {
|
2142
|
+
element.setAttribute("style", object);
|
2143
|
+
} else {
|
2144
|
+
if (objectPrev) {
|
2145
|
+
if (isString(objectPrev)) {
|
2146
|
+
if (objectPrev) {
|
2147
|
+
element.style.cssText = "";
|
2148
|
+
}
|
2149
|
+
} else {
|
2150
|
+
objectPrev = store.unwrap(objectPrev);
|
2151
|
+
for (const key in objectPrev) {
|
2152
|
+
if (object && key in object) continue;
|
2153
|
+
setStyleStatic(element, key, null);
|
2154
|
+
}
|
2155
|
+
}
|
2156
|
+
}
|
2157
|
+
if (isStore(object)) {
|
2158
|
+
for (const key in object) {
|
2159
|
+
const fn = untrack(() => isFunction(object[key]) ? object[key] : object[SYMBOL_STORE_OBSERVABLE](key));
|
2160
|
+
setStyle(element, key, fn);
|
2161
|
+
}
|
2162
|
+
} else {
|
2163
|
+
for (const key in object) {
|
2164
|
+
setStyle(element, key, object[key]);
|
2165
|
+
}
|
2166
|
+
}
|
2167
|
+
}
|
2168
|
+
};
|
2169
|
+
const setStyles = (element, object) => {
|
2170
|
+
if (isFunction(object) || isArray(object)) {
|
2171
|
+
let objectPrev;
|
2172
|
+
useRenderEffect(() => {
|
2173
|
+
const objectNext = resolveStyle(object);
|
2174
|
+
setStylesStatic(element, objectNext, objectPrev);
|
2175
|
+
objectPrev = objectNext;
|
2176
|
+
});
|
2177
|
+
} else {
|
2178
|
+
setStylesStatic(element, get(object));
|
2179
|
+
}
|
2180
|
+
};
|
2181
|
+
const setTemplateAccessor = (element, key, value) => {
|
2182
|
+
if (key === "children") {
|
2183
|
+
const placeholder = createText("");
|
2184
|
+
element.insertBefore(placeholder, null);
|
2185
|
+
value(element, "setChildReplacement", void 0, placeholder);
|
2186
|
+
} else if (key === "ref") {
|
2187
|
+
value(element, "setRef");
|
2188
|
+
} else if (key === "style") {
|
2189
|
+
value(element, "setStyles");
|
2190
|
+
} else if (key === "class" || key === "className") {
|
2191
|
+
if (!isSVG(element)) {
|
2192
|
+
element.className = "";
|
2193
|
+
}
|
2194
|
+
value(element, "setClasses");
|
2195
|
+
} else if (key === "dangerouslySetInnerHTML") {
|
2196
|
+
value(element, "setHTML");
|
2197
|
+
} else if (key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110) {
|
2198
|
+
value(element, "setEvent", key.toLowerCase());
|
2199
|
+
} else if (key.charCodeAt(0) === 117 && key.charCodeAt(3) === 58) {
|
2200
|
+
value(element, "setDirective", key.slice(4));
|
2201
|
+
} else if (key === "innerHTML" || key === "outerHTML" || key === "textContent" || key === "className") ;
|
2202
|
+
else if (key in element && !isSVG(element)) {
|
2203
|
+
value(element, "setProperty", key);
|
2204
|
+
} else {
|
2205
|
+
element.setAttribute(key, "");
|
2206
|
+
value(element, "setAttribute", key);
|
2207
|
+
}
|
2208
|
+
};
|
2209
|
+
const setProp = (element, key, value) => {
|
2210
|
+
if (value === void 0) return;
|
2211
|
+
if (isTemplateAccessor(value)) {
|
2212
|
+
setTemplateAccessor(element, key, value);
|
2213
|
+
} else if (key === "children") {
|
2214
|
+
setChild(element, value);
|
2215
|
+
} else if (key === "ref") {
|
2216
|
+
setRef(element, value);
|
2217
|
+
} else if (key === "style") {
|
2218
|
+
setStyles(element, value);
|
2219
|
+
} else if (key === "class" || key === "className") {
|
2220
|
+
setClasses(element, value);
|
2221
|
+
} else if (key === "dangerouslySetInnerHTML") {
|
2222
|
+
setHTML(element, value);
|
2223
|
+
} else if (key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110) {
|
2224
|
+
setEvent(element, key.toLowerCase(), value);
|
2225
|
+
} else if (key.charCodeAt(0) === 117 && key.charCodeAt(3) === 58) {
|
2226
|
+
setDirective(element, key.slice(4), value);
|
2227
|
+
} else if (key === "innerHTML" || key === "outerHTML" || key === "textContent" || key === "className") ;
|
2228
|
+
else if (key in element && !isSVG(element)) {
|
2229
|
+
setProperty(element, key, value);
|
2230
|
+
} else {
|
2231
|
+
setAttribute(element, key, value);
|
2232
|
+
}
|
2233
|
+
};
|
2234
|
+
const setProps = (element, object) => {
|
2235
|
+
for (const key in object) {
|
2236
|
+
setProp(element, key, object[key]);
|
2237
|
+
}
|
2238
|
+
};
|
2239
|
+
const wrapElement = (element) => {
|
2240
|
+
element[SYMBOL_UNTRACKED_UNWRAPPED] = true;
|
2241
|
+
return element;
|
2242
|
+
};
|
2243
|
+
const wrapCloneElement = (target, component, props) => {
|
2244
|
+
target[SYMBOL_CLONE] = { Component: component, props };
|
2245
|
+
return target;
|
2246
|
+
};
|
2247
|
+
const createElement = (component, _props, ..._children) => {
|
2248
|
+
const children = _children.length > 1 ? _children : _children.length > 0 ? _children[0] : void 0;
|
2249
|
+
const hasChildren = !isVoidChild(children);
|
2250
|
+
if (hasChildren && isObject(_props) && "children" in _props) {
|
2251
|
+
throw new Error('Providing "children" both as a prop and as rest arguments is forbidden');
|
2252
|
+
}
|
2253
|
+
if (isFunction(component)) {
|
2254
|
+
const props = hasChildren ? { ..._props, children } : _props;
|
2255
|
+
return wrapElement(() => {
|
2256
|
+
return untrack(() => component.call(component, props));
|
2257
|
+
});
|
2258
|
+
} else if (isString(component)) {
|
2259
|
+
const isSVG2 = isSVGElement(component);
|
2260
|
+
const createNode = isSVG2 ? createSVGNode : createHTMLNode;
|
2261
|
+
return wrapElement(() => {
|
2262
|
+
const child = createNode(component);
|
2263
|
+
if (isSVG2) child["isSVG"] = true;
|
2264
|
+
untrack(() => {
|
2265
|
+
if (_props) {
|
2266
|
+
setProps(child, _props);
|
2267
|
+
}
|
2268
|
+
if (hasChildren) {
|
2269
|
+
setChild(child, children);
|
2270
|
+
}
|
2271
|
+
});
|
2272
|
+
return child;
|
2273
|
+
});
|
2274
|
+
} else if (isNode(component)) {
|
2275
|
+
return wrapElement(() => component);
|
2276
|
+
} else {
|
2277
|
+
throw new Error("Invalid component");
|
2278
|
+
}
|
2279
|
+
};
|
2280
|
+
function jsx(component, props, ...children) {
|
2281
|
+
if (typeof children === "string")
|
2282
|
+
return wrapCloneElement(createElement(component, props ?? {}, children), component, props);
|
2283
|
+
if (!props) props = {};
|
2284
|
+
if (typeof children === "string")
|
2285
|
+
Object.assign(props, { children });
|
2286
|
+
return wrapCloneElement(createElement(component, props, props == null ? void 0 : props.key), component, props);
|
2287
|
+
}
|
2288
|
+
class Root extends Owner {
|
2289
|
+
/* CONSTRUCTOR */
|
2290
|
+
constructor(register2) {
|
2291
|
+
super();
|
2292
|
+
this.parent = OWNER;
|
2293
|
+
this.context = OWNER.context;
|
2294
|
+
if (register2) {
|
2295
|
+
const suspense = this.get(SYMBOL_SUSPENSE$1);
|
2296
|
+
if (suspense) {
|
2297
|
+
this.registered = true;
|
2298
|
+
lazySetAdd(this.parent, "roots", this);
|
2299
|
+
}
|
2300
|
+
}
|
2301
|
+
}
|
2302
|
+
/* API */
|
2303
|
+
dispose(deep) {
|
2304
|
+
if (this.registered) {
|
2305
|
+
lazySetDelete(this.parent, "roots", this);
|
2306
|
+
}
|
2307
|
+
super.dispose(deep);
|
2308
|
+
}
|
2309
|
+
wrap(fn) {
|
2310
|
+
const dispose = () => this.dispose(true);
|
2311
|
+
const fnWithDispose = () => fn(dispose);
|
2312
|
+
return super.wrap(fnWithDispose, this, void 0);
|
2313
|
+
}
|
2314
|
+
}
|
2315
|
+
const root = (fn) => {
|
2316
|
+
return new Root(true).wrap(fn);
|
2317
|
+
};
|
2318
|
+
const isObservableFrozen = (value) => {
|
2319
|
+
var _a2, _b2;
|
2320
|
+
return isFunction$1(value) && (SYMBOL_OBSERVABLE_FROZEN in value || !!((_b2 = (_a2 = value[SYMBOL_OBSERVABLE_READABLE]) == null ? void 0 : _a2.parent) == null ? void 0 : _b2.disposed));
|
2321
|
+
};
|
2322
|
+
const isUntracked = (value) => {
|
2323
|
+
return isFunction$1(value) && (SYMBOL_UNTRACKED in value || SYMBOL_UNTRACKED_UNWRAPPED in value);
|
2324
|
+
};
|
2325
|
+
class Memo extends Observer {
|
2326
|
+
/* CONSTRUCTOR */
|
2327
|
+
constructor(fn, options2) {
|
2328
|
+
super();
|
2329
|
+
this.fn = fn;
|
2330
|
+
this.observable = new Observable(UNINITIALIZED, options2, this);
|
2331
|
+
if ((options2 == null ? void 0 : options2.sync) === true) {
|
2332
|
+
this.sync = true;
|
2333
|
+
this.update();
|
2334
|
+
}
|
2335
|
+
}
|
2336
|
+
/* API */
|
2337
|
+
run() {
|
2338
|
+
const result = super.refresh(this.fn);
|
2339
|
+
if (!this.disposed && this.observables.empty()) {
|
2340
|
+
this.disposed = true;
|
2341
|
+
}
|
2342
|
+
if (result !== UNAVAILABLE) {
|
2343
|
+
this.observable.set(result);
|
2344
|
+
}
|
2345
|
+
}
|
2346
|
+
stale(status) {
|
2347
|
+
const statusPrev = this.status;
|
2348
|
+
if (statusPrev >= status)
|
2349
|
+
return;
|
2350
|
+
this.status = status;
|
2351
|
+
if (statusPrev === DIRTY_MAYBE_YES)
|
2352
|
+
return;
|
2353
|
+
this.observable.stale(DIRTY_MAYBE_YES);
|
2354
|
+
}
|
2355
|
+
}
|
2356
|
+
const memo = (fn, options2) => {
|
2357
|
+
if (isObservableFrozen(fn)) {
|
2358
|
+
return fn;
|
2359
|
+
} else if (isUntracked(fn)) {
|
2360
|
+
return frozen(fn());
|
2361
|
+
} else {
|
2362
|
+
const memo2 = new Memo(fn, options2);
|
2363
|
+
const observable2 = readable(memo2.observable);
|
2364
|
+
return observable2;
|
2365
|
+
}
|
2366
|
+
};
|
2367
|
+
function resolve(value) {
|
2368
|
+
if (isFunction$1(value)) {
|
2369
|
+
if (SYMBOL_UNTRACKED_UNWRAPPED in value) {
|
2370
|
+
return resolve(value());
|
2371
|
+
} else if (SYMBOL_UNTRACKED in value) {
|
2372
|
+
return frozen(resolve(value()));
|
2373
|
+
} else if (SYMBOL_OBSERVABLE in value) {
|
2374
|
+
return value;
|
2375
|
+
} else {
|
2376
|
+
return memo(() => resolve(value()));
|
2377
|
+
}
|
2378
|
+
}
|
2379
|
+
if (value instanceof Array) {
|
2380
|
+
const resolved = new Array(value.length);
|
2381
|
+
for (let i = 0, l = resolved.length; i < l; i++) {
|
2382
|
+
resolved[i] = resolve(value[i]);
|
2383
|
+
}
|
2384
|
+
return resolved;
|
2385
|
+
} else {
|
2386
|
+
return value;
|
2387
|
+
}
|
2388
|
+
}
|
2389
|
+
frozen(-1);
|
2390
|
+
frozen(-1);
|
2391
|
+
function observable(value, options2) {
|
2392
|
+
return writable(new Observable(value, options2));
|
2393
|
+
}
|
2394
|
+
function createContext(defaultValue) {
|
2395
|
+
const symbol = Symbol();
|
2396
|
+
const Provider = ({ value, children }) => {
|
2397
|
+
return context({ [symbol]: value }, () => {
|
2398
|
+
return resolve(children);
|
2399
|
+
});
|
2400
|
+
};
|
2401
|
+
const Context2 = { Provider };
|
2402
|
+
CONTEXTS_DATA.set(Context2, { symbol, defaultValue });
|
2403
|
+
return Context2;
|
2404
|
+
}
|
2405
|
+
var n = function(t2, s, r, e) {
|
2406
|
+
var u;
|
2407
|
+
s[0] = 0;
|
2408
|
+
for (var h = 1; h < s.length; h++) {
|
2409
|
+
var p = s[h++], a = s[h] ? (s[0] |= p ? 1 : 2, r[s[h++]]) : s[++h];
|
2410
|
+
3 === p ? e[0] = a : 4 === p ? e[1] = Object.assign(e[1] || {}, a) : 5 === p ? (e[1] = e[1] || {})[s[++h]] = a : 6 === p ? e[1][s[++h]] += a + "" : p ? (u = t2.apply(a, n(t2, a, r, ["", null])), e.push(u), a[0] ? s[0] |= 2 : (s[h - 2] = 0, s[h] = u)) : e.push(a);
|
2411
|
+
}
|
2412
|
+
return e;
|
2413
|
+
}, t = /* @__PURE__ */ new Map();
|
2414
|
+
function htm(s) {
|
2415
|
+
var r = t.get(this);
|
2416
|
+
return r || (r = /* @__PURE__ */ new Map(), t.set(this, r)), (r = n(this, r.get(s) || (r.set(s, r = function(n2) {
|
2417
|
+
for (var t2, s2, r2 = 1, e = "", u = "", h = [0], p = function(n3) {
|
2418
|
+
1 === r2 && (n3 || (e = e.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? h.push(0, n3, e) : 3 === r2 && (n3 || e) ? (h.push(3, n3, e), r2 = 2) : 2 === r2 && "..." === e && n3 ? h.push(4, n3, 0) : 2 === r2 && e && !n3 ? h.push(5, 0, true, e) : r2 >= 5 && ((e || !n3 && 5 === r2) && (h.push(r2, 0, e, s2), r2 = 6), n3 && (h.push(r2, n3, 0, s2), r2 = 6)), e = "";
|
2419
|
+
}, a = 0; a < n2.length; a++) {
|
2420
|
+
a && (1 === r2 && p(), p(a));
|
2421
|
+
for (var l = 0; l < n2[a].length; l++) t2 = n2[a][l], 1 === r2 ? "<" === t2 ? (p(), h = [h], r2 = 3) : e += t2 : 4 === r2 ? "--" === e && ">" === t2 ? (r2 = 1, e = "") : e = t2 + e[0] : u ? t2 === u ? u = "" : e += t2 : '"' === t2 || "'" === t2 ? u = t2 : ">" === t2 ? (p(), r2 = 1) : r2 && ("=" === t2 ? (r2 = 5, s2 = e, e = "") : "/" === t2 && (r2 < 5 || ">" === n2[a][l + 1]) ? (p(), 3 === r2 && (h = h[0]), r2 = h, (h = h[0]).push(2, 0, r2), r2 = 0) : " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2 ? (p(), r2 = 2) : e += t2), 3 === r2 && "!--" === e && (r2 = 4, h = h[0]);
|
2422
|
+
}
|
2423
|
+
return p(), h;
|
2424
|
+
}(s)), r), arguments, [])).length > 1 ? r : r[0];
|
2425
|
+
}
|
2426
|
+
const render = (child, parent) => {
|
2427
|
+
if (!parent || !(parent instanceof HTMLElement)) throw new Error("Invalid parent node");
|
2428
|
+
parent.textContent = "";
|
2429
|
+
return root((dispose) => {
|
2430
|
+
setChild(parent, child);
|
2431
|
+
return () => {
|
2432
|
+
dispose();
|
2433
|
+
parent.textContent = "";
|
2434
|
+
};
|
2435
|
+
});
|
2436
|
+
};
|
2437
|
+
var _a, _b;
|
2438
|
+
!!((_b = (_a = globalThis.CDATASection) == null ? void 0 : _a.toString) == null ? void 0 : _b.call(_a).match(/^\s*function\s+CDATASection\s*\(\s*\)\s*\{\s*\[native code\]\s*\}\s*$/));
|
2439
|
+
const registry = {};
|
2440
|
+
const h2 = (type, props, ...children) => createElement(registry[type] || type, props, ...children);
|
2441
|
+
const register = (components) => void assign(registry, components);
|
2442
|
+
assign(htm.bind(h2), { register });
|
2443
|
+
let nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
2444
|
+
byte &= 63;
|
2445
|
+
if (byte < 36) {
|
2446
|
+
id += byte.toString(36);
|
2447
|
+
} else if (byte < 62) {
|
2448
|
+
id += (byte - 26).toString(36).toUpperCase();
|
2449
|
+
} else if (byte > 62) {
|
2450
|
+
id += "-";
|
2451
|
+
} else {
|
2452
|
+
id += "_";
|
2453
|
+
}
|
2454
|
+
return id;
|
2455
|
+
}, "");
|
2456
|
+
const isTemp = (s) => !!s.raw;
|
2457
|
+
const extract = (C, props, classNames) => {
|
2458
|
+
const { className, ...p } = props;
|
2459
|
+
const cls = p.class;
|
2460
|
+
delete p.class;
|
2461
|
+
return /* @__PURE__ */ jsx(C, { class: [classNames, cls, className], ...p });
|
2462
|
+
};
|
2463
|
+
const append = (child, parent) => {
|
2464
|
+
return effect(() => {
|
2465
|
+
const [c, p] = [get(get(child)), get(get(parent))];
|
2466
|
+
p.appendChild(c);
|
2467
|
+
const um = () => p.removeChild(c);
|
2468
|
+
return um;
|
2469
|
+
});
|
2470
|
+
};
|
2471
|
+
function Styled(comp) {
|
2472
|
+
function styled2(strings, ...values) {
|
2473
|
+
if (isTemp(strings)) {
|
2474
|
+
const C = comp;
|
2475
|
+
const N = "_" + nanoid(10);
|
2476
|
+
effect(() => {
|
2477
|
+
const r = `.${N} {
|
2478
|
+
${strings.map((str, i) => i < values.length ? str + get(values[i]) : str).join("")}
|
2479
|
+
}`;
|
2480
|
+
return append(/* @__PURE__ */ jsx("style", { id: N, children: r }), document.head);
|
2481
|
+
});
|
2482
|
+
return C ? (props) => extract(C, props, N) : N;
|
2483
|
+
}
|
2484
|
+
return Styled(strings).styled;
|
2485
|
+
}
|
2486
|
+
return { comp, styled: styled2 };
|
2487
|
+
}
|
2488
|
+
const styled = Styled().styled;
|
2489
|
+
createContext();
|
2490
|
+
function useComputedStyle(target, patterns = []) {
|
2491
|
+
const styles = observable({});
|
2492
|
+
effect(() => {
|
2493
|
+
if (!get(target)) return () => {
|
2494
|
+
};
|
2495
|
+
const getMatchingStyles = () => {
|
2496
|
+
const computedStyle = window.getComputedStyle(get(target));
|
2497
|
+
const matchedStyles = {};
|
2498
|
+
for (const property of computedStyle) {
|
2499
|
+
if (patterns.some(
|
2500
|
+
(pattern) => typeof pattern === "string" ? property === pattern : pattern.test(property)
|
2501
|
+
)) {
|
2502
|
+
matchedStyles[property] = computedStyle.getPropertyValue(property);
|
2503
|
+
}
|
2504
|
+
}
|
2505
|
+
return matchedStyles;
|
2506
|
+
};
|
2507
|
+
styles(getMatchingStyles());
|
2508
|
+
const observer = new MutationObserver(() => {
|
2509
|
+
const updatedStyles = getMatchingStyles();
|
2510
|
+
styles((prevStyles) => {
|
2511
|
+
const hasChanges = Object.keys(updatedStyles).some(
|
2512
|
+
(key) => updatedStyles[key] !== prevStyles[key]
|
2513
|
+
);
|
2514
|
+
return hasChanges ? updatedStyles : prevStyles;
|
2515
|
+
});
|
2516
|
+
});
|
2517
|
+
observer.observe(get(target), {
|
2518
|
+
attributes: true,
|
2519
|
+
attributeFilter: ["style", "class"],
|
2520
|
+
subtree: false
|
2521
|
+
});
|
2522
|
+
return () => observer.disconnect();
|
2523
|
+
});
|
2524
|
+
return styles;
|
2525
|
+
}
|
2526
|
+
const tooltipDef = `text-left border-b-[#666] border-b border-dotted
|
2527
|
+
[&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
|
2528
|
+
`;
|
2529
|
+
const tooltip = `inline-block relative
|
2530
|
+
[&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
|
2531
|
+
`;
|
2532
|
+
const topDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
2533
|
+
const top = `absolute z-[99999999] left-2/4 -top-5 `;
|
2534
|
+
const top_i = `absolute overflow-hidden top-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:rotate-45 after:left-2/4 `;
|
2535
|
+
const rightDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
2536
|
+
const right = `absolute z-[99999999] ml-5 left-full top-2/4 `;
|
2537
|
+
const right_i = `absolute overflow-hidden right-full after:content-[''] after:absolute after:translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
|
2538
|
+
const bottomDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
2539
|
+
const bottom = `absolute z-[99999999] left-2/4 top-10 `;
|
2540
|
+
const bottom_i = `absolute overflow-hidden bottom-full after:content-[''] after:absolute after:-translate-x-2/4 after:translate-y-2/4 after:rotate-45 after:left-2/4 `;
|
2541
|
+
const leftDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
2542
|
+
const left = `absolute z-[99999999] mr-5 right-full top-2/4 `;
|
2543
|
+
const left_i = `absolute overflow-hidden left-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
|
2544
|
+
const Tooltip = ({ children, class: cls = tooltipDef, className, ...props }) => {
|
2545
|
+
return /* @__PURE__ */ jsx("div", { class: [tooltip, cls, className], children });
|
2546
|
+
};
|
2547
|
+
function cssMultiply(value, multiplier) {
|
2548
|
+
const match = (get(value) + "").match(/^(-?\d*\.?\d+)([a-z%]*)$/);
|
2549
|
+
if (!match)
|
2550
|
+
throw new Error(`Invalid CSS unit: ${get(value)}`);
|
2551
|
+
const [, numericValue, unit] = match;
|
2552
|
+
const result = +numericValue * multiplier;
|
2553
|
+
return `${result}${unit}`;
|
2554
|
+
}
|
2555
|
+
const x2 = (value) => cssMultiply(value, 2);
|
2556
|
+
const translate = (x, y) => `translate(${get(x)}, ${get(y)})`;
|
2557
|
+
const TooltipContent = ({ children, style, class: cls = observable(), className, static: st, position = "top", arrowLocation = "50%", arrowSize = "12px", ...props }) => {
|
2558
|
+
const setDef = () => {
|
2559
|
+
if (!get(cls))
|
2560
|
+
switch (get(position)) {
|
2561
|
+
case "top":
|
2562
|
+
cls(topDef);
|
2563
|
+
case "left":
|
2564
|
+
cls(leftDef);
|
2565
|
+
case "right":
|
2566
|
+
cls(rightDef);
|
2567
|
+
case "bottom":
|
2568
|
+
cls(bottomDef);
|
2569
|
+
}
|
2570
|
+
};
|
2571
|
+
effect(setDef);
|
2572
|
+
setDef();
|
2573
|
+
const pos = memo(() => {
|
2574
|
+
switch (get(position)) {
|
2575
|
+
case "top":
|
2576
|
+
return top;
|
2577
|
+
case "right":
|
2578
|
+
return right;
|
2579
|
+
case "bottom":
|
2580
|
+
return bottom;
|
2581
|
+
case "left":
|
2582
|
+
return left;
|
2583
|
+
}
|
2584
|
+
});
|
2585
|
+
const transform = memo(() => {
|
2586
|
+
switch (get(position)) {
|
2587
|
+
case "top":
|
2588
|
+
return translate("-" + get(arrowLocation), "-100%");
|
2589
|
+
case "left":
|
2590
|
+
case "right":
|
2591
|
+
return translate("0", "-" + get(arrowLocation));
|
2592
|
+
case "bottom":
|
2593
|
+
return translate("-" + get(arrowLocation), "0");
|
2594
|
+
}
|
2595
|
+
});
|
2596
|
+
const ali = memo(() => {
|
2597
|
+
switch (get(position)) {
|
2598
|
+
case "bottom":
|
2599
|
+
case "top":
|
2600
|
+
return { left: arrowLocation };
|
2601
|
+
case "left":
|
2602
|
+
case "right":
|
2603
|
+
return { top: arrowLocation };
|
2604
|
+
}
|
2605
|
+
});
|
2606
|
+
const ii = memo(() => {
|
2607
|
+
switch (get(position)) {
|
2608
|
+
case "top":
|
2609
|
+
return top_i + styled`
|
2610
|
+
margin-left:-${get(arrowSize)};
|
2611
|
+
width:${x2(arrowSize)};
|
2612
|
+
height:${get(arrowSize)};
|
2613
|
+
|
2614
|
+
&::after{
|
2615
|
+
width:${get(arrowSize)};
|
2616
|
+
height:${get(arrowSize)};
|
2617
|
+
}
|
2618
|
+
`;
|
2619
|
+
case "right":
|
2620
|
+
return right_i + styled`
|
2621
|
+
margin-top:-${get(arrowSize)};
|
2622
|
+
width:${get(arrowSize)};
|
2623
|
+
height:${x2(arrowSize)};
|
2624
|
+
|
2625
|
+
&::after{
|
2626
|
+
width:${get(arrowSize)};
|
2627
|
+
height:${get(arrowSize)};
|
2628
|
+
}
|
2629
|
+
`;
|
2630
|
+
case "bottom":
|
2631
|
+
return bottom_i + styled`
|
2632
|
+
margin-left:-${get(arrowSize)};
|
2633
|
+
width:${x2(arrowSize)};
|
2634
|
+
height:${get(arrowSize)};
|
2635
|
+
|
2636
|
+
&::after{
|
2637
|
+
width:${get(arrowSize)};
|
2638
|
+
height:${get(arrowSize)};
|
2639
|
+
}
|
2640
|
+
`;
|
2641
|
+
case "left":
|
2642
|
+
return left_i + styled`
|
2643
|
+
margin-top:-${get(arrowSize)};
|
2644
|
+
width:${get(arrowSize)};
|
2645
|
+
height:${x2(arrowSize)};
|
2646
|
+
|
2647
|
+
&::after{
|
2648
|
+
width:${get(arrowSize)};
|
2649
|
+
height:${get(arrowSize)};
|
2650
|
+
}
|
2651
|
+
`;
|
2652
|
+
}
|
2653
|
+
});
|
2654
|
+
const tp = observable();
|
2655
|
+
const ir = observable();
|
2656
|
+
const sty = useComputedStyle(tp, ["background-color", /^border-(?!.*-radius$)/, "box-shadow"]);
|
2657
|
+
return /* @__PURE__ */ jsx("div", { ref: tp, class: [pos, cls, () => get(st) ? "" : "invisible opacity-0", className, "tpcontents"], style: [style, { transform }], ...props, children: [
|
2658
|
+
children,
|
2659
|
+
() => /* @__PURE__ */ jsx("i", { ref: ir, class: [ii, styled`
|
2660
|
+
&::after{
|
2661
|
+
${Object.keys(get(sty)).map((k) => `${k}:${get(sty)[k]};
|
2662
|
+
`).join("")}
|
2663
|
+
}
|
2664
|
+
`], style: ali })
|
2665
|
+
] });
|
2666
|
+
};
|
2667
|
+
const Demo = () => {
|
2668
|
+
observable();
|
2669
|
+
return /* @__PURE__ */ jsx("div", { class: "place-items-center h-screen bg-gray-100", children: [
|
2670
|
+
"DEMO",
|
2671
|
+
/* @__PURE__ */ jsx("br", {}),
|
2672
|
+
/* @__PURE__ */ jsx("br", {}),
|
2673
|
+
/* @__PURE__ */ jsx("br", {}),
|
2674
|
+
/* @__PURE__ */ jsx("br", {}),
|
2675
|
+
/* @__PURE__ */ jsx("br", {}),
|
2676
|
+
/* @__PURE__ */ jsx("table", { class: "[&_td]:h-[7rem] [&_td]:w-[7rem] [&_td]:text-center ", children: /* @__PURE__ */ jsx("tbody", { children: [
|
2677
|
+
/* @__PURE__ */ jsx("tr", { children: [
|
2678
|
+
/* @__PURE__ */ jsx("td", {}),
|
2679
|
+
/* @__PURE__ */ jsx("td", { children: [
|
2680
|
+
" ",
|
2681
|
+
/* @__PURE__ */ jsx("div", { class: "top", children: /* @__PURE__ */ jsx(Tooltip, { children: [
|
2682
|
+
"Top",
|
2683
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "top", class: `bg-[#009cdc] text-[white] min-w-[300px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `, children: [
|
2684
|
+
/* @__PURE__ */ jsx("h3", { class: "font-[22px] font-bold", children: "Lorem Ipsum" }),
|
2685
|
+
/* @__PURE__ */ jsx("ul", { children: [
|
2686
|
+
/* @__PURE__ */ jsx("li", { children: "Aliquam ac odio ut est" }),
|
2687
|
+
/* @__PURE__ */ jsx("li", { children: "Cras porttitor orci" })
|
2688
|
+
] })
|
2689
|
+
] })
|
2690
|
+
] }) })
|
2691
|
+
] }),
|
2692
|
+
/* @__PURE__ */ jsx("td", {})
|
2693
|
+
] }),
|
2694
|
+
/* @__PURE__ */ jsx("tr", { children: [
|
2695
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(Tooltip, { children: [
|
2696
|
+
"Left",
|
2697
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "left", children: [
|
2698
|
+
/* @__PURE__ */ jsx("h3", { children: "Lorem Ipsum" }),
|
2699
|
+
/* @__PURE__ */ jsx("ul", { children: [
|
2700
|
+
/* @__PURE__ */ jsx("li", { children: "Aliquam ac odio ut est aliquet tempor vitae sed arcu" }),
|
2701
|
+
/* @__PURE__ */ jsx("li", { children: "Cras porttitor orci ac porta gravida" })
|
2702
|
+
] })
|
2703
|
+
] })
|
2704
|
+
] }) }),
|
2705
|
+
/* @__PURE__ */ jsx("td", {}),
|
2706
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(Tooltip, { children: [
|
2707
|
+
"Right",
|
2708
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "right", class: "min-w-[200px] w-[400px] translate-x-0 -translate-y-2/4 text-[#EEEEEE] bg-[#444444] box-border shadow-[0_1px_8px_rgba(0,0,0,0.5)] transition-opacity duration-[0.8s] p-5 rounded-lg left-full top-2/4", children: [
|
2709
|
+
/* @__PURE__ */ jsx("img", { src: "https://www.menucool.com/tooltip/cssttp/tooltip-head.jpg" }),
|
2710
|
+
/* @__PURE__ */ jsx("h3", { class: "font-[22px] font-bold", children: "Fade in Effect" }),
|
2711
|
+
/* @__PURE__ */ jsx("ul", { children: [
|
2712
|
+
/* @__PURE__ */ jsx("li", { children: "This demo has fade in/out effect." }),
|
2713
|
+
/* @__PURE__ */ jsx("li", { children: "It is using CSS opacity, visibility, and transition property to toggle the tooltip." }),
|
2714
|
+
/* @__PURE__ */ jsx("li", { children: [
|
2715
|
+
"Other demos are using display property",
|
2716
|
+
/* @__PURE__ */ jsx("em", { children: "(none or block)" }),
|
2717
|
+
" for the toggle."
|
2718
|
+
] })
|
2719
|
+
] })
|
2720
|
+
] })
|
2721
|
+
] }) })
|
2722
|
+
] }),
|
2723
|
+
/* @__PURE__ */ jsx("tr", { children: [
|
2724
|
+
/* @__PURE__ */ jsx("td", {}),
|
2725
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(Tooltip, { children: [
|
2726
|
+
"Bottom",
|
2727
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "bottom", class: `bg-[#eeeeee] min-w-[400px] box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `, children: [
|
2728
|
+
/* @__PURE__ */ jsx("img", { class: "w-[400px]", src: "https://www.menucool.com/tooltip/cssttp/css-tooltip-image.jpg" }),
|
2729
|
+
/* @__PURE__ */ jsx("h3", { class: "font-[22px] font-bold", children: "CSS Tooltip" }),
|
2730
|
+
/* @__PURE__ */ jsx("p", { children: "The CSS tooltip appears when user moves the mouse over an element, or when user tap the element with a mobile device." })
|
2731
|
+
] })
|
2732
|
+
] }) }),
|
2733
|
+
/* @__PURE__ */ jsx("td", {})
|
2734
|
+
] })
|
2735
|
+
] }) }),
|
2736
|
+
/* @__PURE__ */ jsx("br", {}),
|
2737
|
+
/* @__PURE__ */ jsx("br", {}),
|
2738
|
+
/* @__PURE__ */ jsx("br", {}),
|
2739
|
+
/* @__PURE__ */ jsx("br", {}),
|
2740
|
+
/* @__PURE__ */ jsx("br", {}),
|
2741
|
+
/* @__PURE__ */ jsx("br", {}),
|
2742
|
+
/* @__PURE__ */ jsx("br", {}),
|
2743
|
+
/* @__PURE__ */ jsx("br", {}),
|
2744
|
+
/* @__PURE__ */ jsx("br", {}),
|
2745
|
+
/* @__PURE__ */ jsx("br", {}),
|
2746
|
+
/* @__PURE__ */ jsx("br", {}),
|
2747
|
+
/* @__PURE__ */ jsx(Tooltip, { children: [
|
2748
|
+
"Static & Multiple",
|
2749
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "top", static: true, children: "Top" }),
|
2750
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "bottom", static: true, children: "Bottom" }),
|
2751
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "left", children: "Left" }),
|
2752
|
+
/* @__PURE__ */ jsx(TooltipContent, { position: "right", children: "Right" })
|
2753
|
+
] })
|
2754
|
+
] });
|
2755
|
+
};
|
2756
|
+
render(/* @__PURE__ */ jsx(Demo, {}), document.getElementById("app"));
|