@aevantec/litevue 0.5.3 → 0.5.5

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.
Files changed (73) hide show
  1. package/dist/litevue-devtools.iife.js +1 -1
  2. package/dist/litevue-devtools.mjs +1 -853
  3. package/dist/litevue-devtools.umd.js +1 -1
  4. package/dist/litevue-plugins.iife.js +1 -1
  5. package/dist/litevue-plugins.mjs +1 -493
  6. package/dist/litevue-plugins.umd.js +1 -1
  7. package/dist/litevue.iife.js +1 -12
  8. package/dist/litevue.mjs +1 -1861
  9. package/dist/litevue.umd.js +1 -12
  10. package/dist/plugins/collapse.iife.js +1 -0
  11. package/dist/plugins/collapse.mjs +1 -0
  12. package/dist/plugins/collapse.umd.js +1 -0
  13. package/dist/plugins/focus.iife.js +1 -0
  14. package/dist/plugins/focus.mjs +1 -0
  15. package/dist/plugins/focus.umd.js +1 -0
  16. package/dist/plugins/intersect.iife.js +1 -0
  17. package/dist/plugins/intersect.mjs +1 -0
  18. package/dist/plugins/intersect.umd.js +1 -0
  19. package/dist/plugins/mask.iife.js +1 -0
  20. package/dist/plugins/mask.mjs +1 -0
  21. package/dist/plugins/mask.umd.js +1 -0
  22. package/dist/plugins/media.iife.js +1 -0
  23. package/dist/plugins/media.mjs +1 -0
  24. package/dist/plugins/media.umd.js +1 -0
  25. package/dist/plugins/morph.iife.js +1 -0
  26. package/dist/plugins/morph.mjs +1 -0
  27. package/dist/plugins/morph.umd.js +1 -0
  28. package/dist/plugins/persist.iife.js +1 -0
  29. package/dist/plugins/persist.mjs +1 -0
  30. package/dist/plugins/persist.umd.js +1 -0
  31. package/dist/plugins/resize.iife.js +1 -0
  32. package/dist/plugins/resize.mjs +1 -0
  33. package/dist/plugins/resize.umd.js +1 -0
  34. package/dist/plugins/transition.iife.js +1 -0
  35. package/dist/plugins/transition.mjs +1 -0
  36. package/dist/plugins/transition.umd.js +1 -0
  37. package/dist/types/app.d.mts +35 -3
  38. package/dist/types/app.d.ts +35 -3
  39. package/dist/types/block.d.mts +7 -0
  40. package/dist/types/block.d.ts +7 -0
  41. package/dist/types/context.d.mts +7 -0
  42. package/dist/types/context.d.ts +7 -0
  43. package/dist/types/index.d.mts +1 -1
  44. package/dist/types/index.d.ts +1 -1
  45. package/dist/types/ownership.d.mts +30 -0
  46. package/dist/types/ownership.d.ts +30 -0
  47. package/dist/types/plugins/{collapse.d.mts → collapse/index.d.mts} +1 -1
  48. package/dist/types/plugins/{collapse.d.ts → collapse/index.d.ts} +1 -1
  49. package/dist/types/plugins/{focus.d.mts → focus/index.d.mts} +1 -1
  50. package/dist/types/plugins/{focus.d.ts → focus/index.d.ts} +1 -1
  51. package/dist/types/plugins/index.d.mts +12 -9
  52. package/dist/types/plugins/index.d.ts +3 -0
  53. package/dist/types/plugins/{intersect.d.mts → intersect/index.d.mts} +1 -1
  54. package/dist/types/plugins/{intersect.d.ts → intersect/index.d.ts} +1 -1
  55. package/dist/types/plugins/{mask.d.mts → mask/index.d.mts} +1 -1
  56. package/dist/types/plugins/{mask.d.ts → mask/index.d.ts} +1 -1
  57. package/dist/types/plugins/media/index.d.mts +42 -0
  58. package/dist/types/plugins/media/index.d.ts +42 -0
  59. package/dist/types/plugins/{morph.d.mts → morph/index.d.mts} +1 -1
  60. package/dist/types/plugins/{morph.d.ts → morph/index.d.ts} +1 -1
  61. package/dist/types/plugins/{persist.d.mts → persist/index.d.mts} +1 -1
  62. package/dist/types/plugins/{persist.d.ts → persist/index.d.ts} +1 -1
  63. package/dist/types/plugins/resize/index.d.mts +12 -0
  64. package/dist/types/plugins/resize/index.d.ts +12 -0
  65. package/dist/types/plugins/{transition.d.mts → transition/index.d.mts} +1 -1
  66. package/dist/types/plugins/{transition.d.ts → transition/index.d.ts} +1 -1
  67. package/dist/types/scheduler.d.mts +3 -0
  68. package/dist/types/scheduler.d.ts +3 -0
  69. package/dist/types/utils.d.mts +6 -1
  70. package/dist/types/utils.d.ts +6 -1
  71. package/dist/types/warn.d.mts +16 -0
  72. package/dist/types/warn.d.ts +16 -0
  73. package/package.json +134 -11
@@ -1,493 +1 @@
1
- import { store, watchEffect } from '@aevantec/litevue';
2
-
3
- const intersect = (app) => {
4
- app.directive("intersect", ({ el, get, modifiers }) => {
5
- const observer = new IntersectionObserver(
6
- (entries) => {
7
- for (const entry of entries) {
8
- const hit = modifiers?.leave ? !entry.isIntersecting : entry.isIntersecting;
9
- if (hit) {
10
- get();
11
- if (modifiers?.once) observer.disconnect();
12
- }
13
- }
14
- },
15
- { threshold: modifiers?.full ? 1 : 0 }
16
- );
17
- observer.observe(el);
18
- return () => observer.disconnect();
19
- });
20
- };
21
-
22
- const tokens = {
23
- "9": /\d/,
24
- a: /[a-zA-Z]/,
25
- "*": /[a-zA-Z0-9]/
26
- };
27
- const format = (value, mask2) => {
28
- let out = "";
29
- let literals = "";
30
- let vi = 0;
31
- for (let mi = 0; mi < mask2.length; mi++) {
32
- const re = tokens[mask2[mi]];
33
- if (re) {
34
- while (vi < value.length && !re.test(value[vi])) vi++;
35
- if (vi >= value.length) break;
36
- out += literals + value[vi++];
37
- literals = "";
38
- } else {
39
- literals += mask2[mi];
40
- if (value[vi] === mask2[mi]) vi++;
41
- }
42
- }
43
- return out;
44
- };
45
- const mask = (app) => {
46
- app.directive("mask", ({ el, exp }) => {
47
- const input = el;
48
- const apply = () => {
49
- const masked = format(input.value, exp);
50
- if (masked !== input.value) input.value = masked;
51
- };
52
- el.addEventListener("input", apply);
53
- apply();
54
- return () => el.removeEventListener("input", apply);
55
- });
56
- };
57
-
58
- const toMs = (v) => (parseFloat(v) || 0) * (v.includes("ms") ? 1 : 1e3);
59
- const maxOf = (durations, delays) => {
60
- const ds = durations.split(",");
61
- const dl = delays.split(",");
62
- let max = 0;
63
- for (let i = 0; i < ds.length; i++) {
64
- max = Math.max(max, toMs(ds[i]) + toMs(dl[i % dl.length]));
65
- }
66
- return max;
67
- };
68
- const durationOf = (el) => {
69
- const s = getComputedStyle(el);
70
- return Math.max(
71
- maxOf(s.transitionDuration, s.transitionDelay),
72
- maxOf(s.animationDuration, s.animationDelay)
73
- );
74
- };
75
- const transition = (app) => {
76
- app.directive("transition", ({ el, get, effect, arg, modifiers, exp }) => {
77
- const elem = el;
78
- const name = arg || "v";
79
- const cls = (phase) => `${name}-${phase}`;
80
- let seq = 0;
81
- let first = true;
82
- const clear = () => {
83
- elem.classList.remove(
84
- cls("enter-from"),
85
- cls("enter-active"),
86
- cls("enter-to"),
87
- cls("leave-from"),
88
- cls("leave-active"),
89
- cls("leave-to")
90
- );
91
- };
92
- const run = (phase, done) => {
93
- const id = ++seq;
94
- clear();
95
- elem.classList.add(cls(phase + "-from"), cls(phase + "-active"));
96
- void elem.offsetWidth;
97
- elem.classList.remove(cls(phase + "-from"));
98
- elem.classList.add(cls(phase + "-to"));
99
- setTimeout(() => {
100
- if (id === seq) {
101
- clear();
102
- if (done) done();
103
- }
104
- }, durationOf(elem));
105
- };
106
- if (!exp) {
107
- Promise.resolve().then(() => run("enter"));
108
- elem.__leave = () => new Promise((resolve) => run("leave", resolve));
109
- return () => {
110
- delete elem.__leave;
111
- };
112
- }
113
- effect(() => {
114
- const show = !!get();
115
- if (first) {
116
- first = false;
117
- elem.style.display = show ? "" : "none";
118
- if (show && modifiers?.appear) run("enter");
119
- return;
120
- }
121
- if (show) {
122
- elem.style.display = "";
123
- run("enter");
124
- } else {
125
- run("leave", () => {
126
- elem.style.display = "none";
127
- });
128
- }
129
- });
130
- });
131
- };
132
-
133
- const PREFIX = "litevue:";
134
- const registry = /* @__PURE__ */ Object.create(null);
135
- let defaultStorage = "local";
136
- const builtin = (name) => {
137
- try {
138
- if (name === "local" || name === "localStorage") return localStorage;
139
- if (name === "session" || name === "sessionStorage") return sessionStorage;
140
- } catch {
141
- }
142
- };
143
- const resolve = (storage) => {
144
- const target = storage ?? defaultStorage;
145
- if (typeof target !== "string") return target;
146
- return registry[target] ?? builtin(target);
147
- };
148
- const registerStorage = (name, storage) => {
149
- registry[name] = storage;
150
- };
151
- const setDefaultStorage = (storage) => {
152
- defaultStorage = storage;
153
- };
154
- const persistable = (target, keys) => (keys ?? Object.keys(target)).filter((k) => {
155
- if (k[0] === "$") return false;
156
- const desc = Object.getOwnPropertyDescriptor(target, k);
157
- if (desc && desc.get && !desc.set) return false;
158
- const raw = desc && desc.value;
159
- if (raw && raw.__v_isRef === true && raw.__v_isReadonly === true) {
160
- return false;
161
- }
162
- return typeof target[k] !== "function";
163
- });
164
- const sync = (target, key, keys, storage, run) => {
165
- if (!storage) return run(() => {
166
- });
167
- const fields = persistable(target, keys);
168
- try {
169
- const saved = JSON.parse(storage.getItem(key) || "null");
170
- if (saved) {
171
- for (const k of fields) {
172
- if (k in saved) target[k] = saved[k];
173
- }
174
- }
175
- } catch {
176
- }
177
- return run(() => {
178
- const snapshot = {};
179
- for (const k of fields) snapshot[k] = target[k];
180
- try {
181
- storage.setItem(key, JSON.stringify(snapshot));
182
- } catch {
183
- }
184
- });
185
- };
186
- const persist = (app) => {
187
- app.directive("persist", ({ ctx, el, exp, arg, modifiers, effect }) => {
188
- const key = PREFIX + (exp || el.id);
189
- let storage;
190
- for (const name in modifiers || {}) {
191
- if (resolve(name)) {
192
- storage = name;
193
- break;
194
- }
195
- }
196
- const keys = arg ? arg.split(",").map((k) => k.trim()).filter(Boolean) : void 0;
197
- sync(ctx.scope, key, keys, resolve(storage), effect);
198
- });
199
- };
200
- const persistStore = (name, options = {}) => {
201
- const target = store(name);
202
- if (!target) {
203
- return () => {
204
- };
205
- }
206
- const storage = resolve(options.storage);
207
- return sync(
208
- target,
209
- PREFIX + (options.key ?? name),
210
- options.keys,
211
- storage,
212
- watchEffect
213
- );
214
- };
215
-
216
- const FOCUSABLE = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
217
- const focus = (app) => {
218
- app.directive("focus", ({ el, get, effect, modifiers }) => {
219
- effect(() => {
220
- const on = !!get();
221
- Promise.resolve().then(() => {
222
- if (on) {
223
- el.focus();
224
- if (modifiers?.select && el.select) {
225
- el.select();
226
- }
227
- }
228
- });
229
- });
230
- });
231
- app.directive("trap", ({ el, get, effect }) => {
232
- let active = false;
233
- let prevFocus = null;
234
- const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter(
235
- (e) => !e.hasAttribute("disabled")
236
- );
237
- const onKeydown = (e) => {
238
- if (e.key !== "Tab") return;
239
- const els = focusables();
240
- if (!els.length) {
241
- e.preventDefault();
242
- return;
243
- }
244
- const first = els[0];
245
- const last = els[els.length - 1];
246
- const current = document.activeElement;
247
- if (!el.contains(current)) {
248
- e.preventDefault();
249
- first.focus();
250
- } else if (e.shiftKey && current === first) {
251
- e.preventDefault();
252
- last.focus();
253
- } else if (!e.shiftKey && current === last) {
254
- e.preventDefault();
255
- first.focus();
256
- }
257
- };
258
- const release = () => {
259
- active = false;
260
- document.removeEventListener("keydown", onKeydown, true);
261
- if (prevFocus && prevFocus.focus) {
262
- prevFocus.focus();
263
- }
264
- };
265
- effect(() => {
266
- const on = !!get();
267
- if (on && !active) {
268
- active = true;
269
- prevFocus = document.activeElement;
270
- document.addEventListener("keydown", onKeydown, true);
271
- Promise.resolve().then(() => {
272
- if (active) (focusables()[0] || el).focus();
273
- });
274
- } else if (!on && active) {
275
- release();
276
- }
277
- });
278
- return () => {
279
- if (active) release();
280
- };
281
- });
282
- };
283
-
284
- const collapse = (app) => {
285
- app.directive("collapse", ({ el, get, effect, modifiers }) => {
286
- const elem = el;
287
- let duration = 250;
288
- for (const m in modifiers || {}) {
289
- const match = /^duration-(\d+)$/.exec(m);
290
- if (match) duration = +match[1];
291
- }
292
- elem.style.overflow = "hidden";
293
- let first = true;
294
- let seq = 0;
295
- effect(() => {
296
- const show = !!get();
297
- const id = ++seq;
298
- if (first) {
299
- first = false;
300
- if (!show) elem.style.height = "0px";
301
- setTimeout(() => {
302
- elem.style.transition = `height ${duration}ms ease`;
303
- });
304
- return;
305
- }
306
- if (show) {
307
- elem.style.height = elem.scrollHeight + "px";
308
- setTimeout(() => {
309
- if (id === seq) elem.style.height = "";
310
- }, duration);
311
- } else {
312
- elem.style.height = elem.scrollHeight + "px";
313
- void elem.offsetHeight;
314
- elem.style.height = "0px";
315
- }
316
- });
317
- });
318
- };
319
-
320
- const dirRE = /^(?:v-|:|@)/;
321
- const bindRE = /^(?::|v-bind:)/;
322
- const KEY_ATTRS = ["id", "data-key", "data-id"];
323
- const defaultKey = (el) => {
324
- for (const attr of KEY_ATTRS) {
325
- const value = el.getAttribute(attr);
326
- if (value != null) return attr + "=" + value;
327
- }
328
- return null;
329
- };
330
- const nearestCtx = (node) => {
331
- for (let el = node; el; el = el.parentElement) {
332
- if (el.__ctx) return el.__ctx;
333
- }
334
- };
335
- const boundAttrs = (to) => {
336
- const owned = /* @__PURE__ */ new Set();
337
- for (const { name } of to.attributes) {
338
- if (bindRE.test(name)) {
339
- owned.add(name.replace(bindRE, "").split(".")[0]);
340
- } else if (name === "v-model") {
341
- owned.add("value");
342
- owned.add("checked");
343
- }
344
- }
345
- return owned;
346
- };
347
- const isBlockRoot = (el) => el.hasAttribute("v-for") || el.hasAttribute("v-if") || el.hasAttribute("v-else") || el.hasAttribute("v-else-if");
348
- const ownsChildren = (to) => {
349
- if (to.hasAttribute("v-text") || to.hasAttribute("v-html") || to.hasAttribute("v-pre") || to.hasAttribute("v-once") || isBlockRoot(to)) {
350
- return true;
351
- }
352
- for (let c = to.firstElementChild; c; c = c.nextElementSibling) {
353
- if (isBlockRoot(c)) return true;
354
- }
355
- return false;
356
- };
357
- const patchAttrs = (from, to) => {
358
- const owned = boundAttrs(to);
359
- for (const { name, value } of [...to.attributes]) {
360
- if (dirRE.test(name) || owned.has(name)) continue;
361
- if (from.getAttribute(name) !== value) from.setAttribute(name, value);
362
- }
363
- for (const { name } of [...from.attributes]) {
364
- if (owned.has(name) || to.hasAttribute(name)) continue;
365
- from.removeAttribute(name);
366
- }
367
- };
368
- const isInterpolation = (data, ctx) => data.includes(ctx ? ctx.delimiters[0] : "{{");
369
- const patchNode = (from, to, ctx, opts) => {
370
- if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx);
371
- if (from.nodeType === 3 || from.nodeType === 8) {
372
- const data = to.data;
373
- if (isInterpolation(data, ctx)) return;
374
- if (from.data !== data) from.data = data;
375
- return;
376
- }
377
- if (from.nodeType !== 1) return;
378
- const a = from;
379
- const b = to;
380
- if (a.tagName !== b.tagName) return replaceNode(from, to, ctx);
381
- if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
382
- patchAttrs(a, b);
383
- if (!ownsChildren(b)) {
384
- patchChildren(a, b, a.__ctx || ctx, opts);
385
- }
386
- };
387
- const replaceNode = (from, to, ctx) => {
388
- const fresh = to.cloneNode(true);
389
- from.parentNode.replaceChild(fresh, from);
390
- mountNew(fresh, ctx);
391
- };
392
- const mountNew = (node, ctx) => {
393
- const target = ctx || nearestCtx(node.parentNode);
394
- target?.walk?.(node, target);
395
- };
396
- const patchChildren = (from, to, ctx, opts) => {
397
- const key = opts.key || defaultKey;
398
- const keyed = /* @__PURE__ */ new Map();
399
- for (let n = from.firstChild; n; n = n.nextSibling) {
400
- if (n.nodeType === 1) {
401
- const k = key(n);
402
- if (k == null) continue;
403
- keyed.set(k, n);
404
- }
405
- }
406
- const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
407
- let oldChild = from.firstChild;
408
- let newChild = to.firstChild;
409
- const insert = (node) => {
410
- const fresh = node.cloneNode(true);
411
- from.insertBefore(fresh, oldChild);
412
- mountNew(fresh, ctx);
413
- };
414
- while (newChild) {
415
- const nextNew = newChild.nextSibling;
416
- const wantKey = keyOf(newChild);
417
- if (wantKey != null) {
418
- const match = keyed.get(wantKey);
419
- if (match) {
420
- if (match === oldChild) {
421
- oldChild = oldChild.nextSibling;
422
- } else {
423
- from.insertBefore(match, oldChild);
424
- }
425
- keyed.delete(wantKey);
426
- patchNode(match, newChild, ctx, opts);
427
- } else {
428
- insert(newChild);
429
- }
430
- } else if (oldChild && keyOf(oldChild) == null) {
431
- const nextOld = oldChild.nextSibling;
432
- patchNode(oldChild, newChild, ctx, opts);
433
- oldChild = nextOld;
434
- } else {
435
- insert(newChild);
436
- }
437
- newChild = nextNew;
438
- }
439
- while (oldChild) {
440
- const next = oldChild.nextSibling;
441
- from.removeChild(oldChild);
442
- oldChild = next;
443
- }
444
- };
445
- const morph = (from, to, opts = {}) => {
446
- let target;
447
- if (typeof to === "string") {
448
- const holder = document.createElement("template");
449
- holder.innerHTML = to.trim();
450
- const content = holder.content;
451
- target = content.childElementCount === 1 ? content.firstElementChild : (() => {
452
- const wrapper = from.cloneNode(false);
453
- wrapper.appendChild(content);
454
- return wrapper;
455
- })();
456
- } else {
457
- target = to;
458
- }
459
- if (target) {
460
- const restore = captureFocus();
461
- patchNode(from, target, nearestCtx(from), opts);
462
- restore();
463
- }
464
- return from;
465
- };
466
- const captureFocus = () => {
467
- const active = document.activeElement;
468
- if (!active || active === document.body) return () => {
469
- };
470
- const field = active;
471
- let start = null;
472
- let end = null;
473
- try {
474
- start = field.selectionStart;
475
- end = field.selectionEnd;
476
- } catch {
477
- }
478
- return () => {
479
- if (active === document.activeElement || !active.isConnected) return;
480
- active.focus();
481
- if (start !== null) {
482
- try {
483
- field.setSelectionRange(start, end);
484
- } catch {
485
- }
486
- }
487
- };
488
- };
489
- const morphPlugin = (app) => {
490
- app.scope.$morph = morph;
491
- };
492
-
493
- export { collapse, focus, intersect, mask, morph, morphPlugin, persist, persistStore, registerStorage, setDefaultStorage, transition };
1
+ import{reactive as e,store as t,watchEffect as n}from"@aevantec/litevue";var r=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},o={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,r=()=>{const e=((e,t)=>{let n="",r="",i=0;for(let s=0;s<t.length;s++){const c=o[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;n+=r+e[i++],r=""}else r+=t[s],e[i]===t[s]&&i++}return n})(n.value,t);e!==n.value&&(n.value=e)};return e.addEventListener("input",r),r(),()=>e.removeEventListener("input",r)})},s=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),c=(e,t)=>{const n=e.split(","),r=t.split(",");let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,s(n[i])+s(r[i%r.length]));return o},l=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:o,exp:i})=>{const s=e,l=r||"v",a=e=>`${l}-${e}`;let f,u=0,d=!0;const m=()=>{s.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},p=(e,t)=>{const n=++u;m(),s.classList.add(a(e+"-from"),a(e+"-active")),s.offsetWidth,s.classList.remove(a(e+"-from")),s.classList.add(a(e+"-to")),clearTimeout(f),f=setTimeout(()=>{n===u&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(c(t.transitionDuration,t.transitionDelay),c(t.animationDuration,t.animationDelay))})(s))};if(!i){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(f),delete s.__leave}}return n(()=>{const e=!!t();if(d)return d=!1,s.style.display=e?"":"none",void(e&&o?.appear&&p("enter"));e?(s.style.display="",p("enter")):p("leave",()=>{s.style.display="none"})}),()=>clearTimeout(f)})},a="litevue:",f=Object.create(null),u="local",d=e=>{const t=e??u;return"string"!=typeof t?t:f[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},m=(e,t)=>{f[e]=t},p=e=>{u=e},v=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},h=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:i})=>{const s=a+(n||t.id);let c;for(const a in o||{})if(d(a)){c=a;break}const l=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;v(e.scope,s,l,d(c),i)})},b=(e,r={})=>{const o=t(e);if(!o)return()=>{};const i=d(r.storage);return v(o,a+(r.key??e),r.keys,i,n)},g=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},y=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const f in r||{}){const e=/^duration-(\d+)$/.exec(f);e&&(i=+e[1])}o.style.overflow="hidden";let s=!0,c=0;const l=/* @__PURE__ */new Set,a=(e,t)=>{const n=setTimeout(()=>{l.delete(n),e()},t);l.add(n)};return n(()=>{const e=!!t(),n=++c;if(s)return s=!1,e||(o.style.height="0px"),void a(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",a(()=>{n===c&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>l.forEach(clearTimeout)})},k=/^(?:v-|:|@)/,x=/^(?::|v-bind:)/,w=["id","data-key","data-id"],E=e=>{for(const t of w){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},S=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},A=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),O=(e,t)=>{const n=(e=>{const t=/* @__PURE__ */new Set;for(const{name:n}of e.attributes)x.test(n)?t.add(n.replace(x,"").split(".")[0]):"v-model"===n&&(t.add("value"),t.add("checked"));return t})(t);for(const{name:r,value:o}of[...t.attributes])k.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},$=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return L(e,t,n);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return L(e,t,n);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(O(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||A(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(A(t))return!0;return!1})(i)||T(o,i,o.__ctx||n,r))},L=(e,t,n)=>{const r=t.cloneNode(!0);n?.dispose?.(e),e.parentNode.replaceChild(r,e),_(r,n)},_=(e,t)=>{const n=t||S(e.parentNode);n?.walk?.(e,n)},T=(e,t,n,r)=>{const o=r.key||E,i=/* @__PURE__ */new Map;for(let f=e.firstChild;f;f=f.nextSibling)if(1===f.nodeType){const e=o(f);if(null==e)continue;i.set(e,f)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,l=t.firstChild;const a=t=>{const r=t.cloneNode(!0);e.insertBefore(r,c),_(r,n)};for(;l;){const t=l.nextSibling,o=s(l);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),$(t,l,n,r)):a(l)}else if(c&&null==s(c)){const e=c.nextSibling;$(c,l,n,r),c=e}else a(l);l=t}for(;c;){const t=c.nextSibling;n?.dispose?.(c),e.removeChild(c),c=t}},j=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=q();$(e,r,S(e),n),t()}return e},q=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},C=e=>{e.scope.$morph=j},N={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},D=Object.freeze({...N}),M={mobile:"base",tablet:"md",desktop:"lg"},P=/^\d+$/,I=e({bp:"base",tick:0}),z={...N},R=["base"],B=!1,H=[],J=/* @__PURE__ */new Map,K=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,Z=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),F=()=>{for(let e=H.length-1;e>=0;e--)if(H[e].mql.matches)return R[e+1];return"base"},W=()=>{H.forEach(e=>e.off()),H=[];const e=Object.keys(z).filter(e=>z[e]>0).sort((e,t)=>z[e]-z[t]);R=["base",...e],K()&&(H=e.map(e=>{const t=window.matchMedia(`(min-width: ${z[e]}px)`);return Z(t,()=>{I.bp=F()})}),I.bp=F())},G=()=>{B||(B=!0,W()),I.tick},Q=e=>{if(!K())return!1;let t=J.get(e);if(!t){const n=window.matchMedia(e);t=Z(n,()=>I.tick++),J.set(e,t)}return t.mql.matches},U=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(P.test(e))return Number(e);const t=M[e];return void 0!==t?"base"===t?0:z[t]:z[e]},V=e=>{if(e<=0)return!0;const t=R.findIndex(t=>"base"!==t&&z[t]===e);return-1!==t?R.indexOf(I.bp)>=t:(I.tick,Q(`(min-width: ${e}px)`))},X=/* @__PURE__ */new Set,Y=(e,t)=>{let n;G();let r=-1;for(const o of Object.keys(e)){const t=U(o);void 0!==t?t>=r&&V(t)&&(r=t,n=e[o]):(R.join(", "),Object.keys(M).join(", "))}return void 0!==n?n:t},ee=e=>{const t=M[e],n=z[t];return void 0!==n?n:N[t]},te=Object.defineProperties((e,t)=>Y(e,t),{props:{value:e=>{G();const t={};for(const n of Object.keys(e))t[n]=Y(e[n]);return t}},breakpoint:{get:()=>(G(),I.bp),enumerable:!0},device:{get:()=>(G(),V(ee("tablet"))?V(ee("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{G();const t=U(e);return void 0!==t&&V(t)}},match:{value:e=>(G(),Q(e))},configure:{value:({breakpoints:e})=>{e&&(z={...e},B&&(W(),I.tick++))}}}),ne=()=>{H.forEach(e=>e.off()),J.forEach(e=>e.off()),H=[],J.clear(),B=!1},re=()=>{ne(),z={...N},R=["base",...Object.keys(z).sort((e,t)=>z[e]-z[t])],B=!1,X.clear(),I.bp="base",I.tick=0},oe=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&te.configure(t),e.scope.$mq=te,e.scope.$mqProps=te.props,e.scope.$mqAtLeast=te.atLeast,e.scope.$mqMatch=te.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>te.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>te.device,enumerable:!0,configurable:!0}),ne),ie=e=>{e.directive("resize",({el:e,get:t,exp:n})=>{const r=t(`(($width, $height) => { ${n} })`),o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})};export{y as collapse,D as defaultBreakpoints,g as focus,r as intersect,i as mask,oe as media,j as morph,C as morphPlugin,te as mq,h as persist,b as persistStore,m as registerStorage,re as resetMedia,ie as resize,p as setDefaultStorage,l as transition};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePlugins={},e.LiteVue)}(this,function(e,t){"use strict";const n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),o=t.split(",");let i=0;for(let s=0;s<n.length;s++)i=Math.max(i,r(n[s])+r(o[s%o.length]));return i},i="litevue:",s=Object.create(null);let l="local";const c=e=>{const t=e??l;return"string"!=typeof t?t:s[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},a=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},f=/^(?:v-|:|@)/,u=/^(?::|v-bind:)/,d=["id","data-key","data-id"],v=e=>{for(const t of d){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},h=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},p=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),m=(e,t)=>{const n=(e=>{const t=new Set;for(const{name:n}of e.attributes)u.test(n)?t.add(n.replace(u,"").split(".")[0]):"v-model"===n&&(t.add("value"),t.add("checked"));return t})(t);for(const{name:r,value:o}of[...t.attributes])f.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},g=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return y(e,t,n);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return y(e,t,n);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(m(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||p(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(p(t))return!0;return!1})(i)||x(o,i,o.__ctx||n,r))},y=(e,t,n)=>{const r=t.cloneNode(!0);e.parentNode.replaceChild(r,e),b(r,n)},b=(e,t)=>{const n=t||h(e.parentNode);n?.walk?.(e,n)},x=(e,t,n,r)=>{const o=r.key||v,i=new Map;for(let f=e.firstChild;f;f=f.nextSibling)if(1===f.nodeType){const e=o(f);if(null==e)continue;i.set(e,f)}const s=e=>e&&1===e.nodeType?o(e):null;let l=e.firstChild,c=t.firstChild;const a=t=>{const r=t.cloneNode(!0);e.insertBefore(r,l),b(r,n)};for(;c;){const t=c.nextSibling,o=s(c);if(null!=o){const t=i.get(o);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),i.delete(o),g(t,c,n,r)):a(c)}else if(l&&null==s(l)){const e=l.nextSibling;g(l,c,n,r),l=e}else a(c);c=t}for(;l;){const t=l.nextSibling;e.removeChild(l),l=t}},S=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=A();g(e,r,h(e),n),t()}return e},A=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}};e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const c in r||{}){const e=/^duration-(\d+)$/.exec(c);e&&(i=+e[1])}o.style.overflow="hidden";let s=!0,l=0;n(()=>{const e=!!t(),n=++l;if(s)return s=!1,e||(o.style.height="0px"),void setTimeout(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",setTimeout(()=>{n===l&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")})})},e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{n(()=>{const n=!!t();Promise.resolve().then(()=>{n&&(e.focus(),r?.select&&e.select&&e.select())})})}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},l=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&l()}),()=>{r&&l()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e){(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())}},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=()=>{const e=((e,t)=>{let r="",o="",i=0;for(let s=0;s<t.length;s++){const l=n[t[s]];if(l){for(;i<e.length&&!l.test(e[i]);)i++;if(i>=e.length)break;r+=o+e[i++],o=""}else o+=t[s],e[i]===t[s]&&i++}return r})(r.value,t);e!==r.value&&(r.value=e)};return e.addEventListener("input",o),o(),()=>e.removeEventListener("input",o)})},e.morph=S,e.morphPlugin=e=>{e.scope.$morph=S},e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:s})=>{const l=i+(n||t.id);let f;for(const i in o||{})if(c(i)){f=i;break}const u=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;a(e.scope,l,u,c(f),s)})},e.persistStore=(e,n={})=>{const r=t.store(e);if(!r)return()=>{};const o=c(n.storage);return a(r,i+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{s[e]=t},e.setDefaultStorage=e=>{l=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:i,exp:s})=>{const l=e,c=r||"v",a=e=>`${c}-${e}`;let f=0,u=!0;const d=()=>{l.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},v=(e,t)=>{const n=++f;d(),l.classList.add(a(e+"-from"),a(e+"-active")),l.offsetWidth,l.classList.remove(a(e+"-from")),l.classList.add(a(e+"-to")),setTimeout(()=>{n===f&&(d(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(l))};if(!s)return Promise.resolve().then(()=>v("enter")),l.__leave=()=>new Promise(e=>v("leave",e)),()=>{delete l.__leave};n(()=>{const e=!!t();if(u)return u=!1,l.style.display=e?"":"none",void(e&&i?.appear&&v("enter"));e?(l.style.display="",v("enter")):v("leave",()=>{l.style.display="none"})})})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePlugins={},e.LiteVue)}(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),o=t.split(",");let i=0;for(let s=0;s<n.length;s++)i=Math.max(i,r(n[s])+r(o[s%o.length]));return i},i="litevue:",s=Object.create(null),c="local",l=e=>{const t=e??c;return"string"!=typeof t?t:s[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},a=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},f=/^(?:v-|:|@)/,u=/^(?::|v-bind:)/,d=["id","data-key","data-id"],p=e=>{for(const t of d){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},m=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},v=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),h=(e,t)=>{const n=(e=>{const t=new Set;for(const{name:n}of e.attributes)u.test(n)?t.add(n.replace(u,"").split(".")[0]):"v-model"===n&&(t.add("value"),t.add("checked"));return t})(t);for(const{name:r,value:o}of[...t.attributes])f.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},b=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return g(e,t,n);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return g(e,t,n);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(h(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||v(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(v(t))return!0;return!1})(i)||k(o,i,o.__ctx||n,r))},g=(e,t,n)=>{const r=t.cloneNode(!0);n?.dispose?.(e),e.parentNode.replaceChild(r,e),y(r,n)},y=(e,t)=>{const n=t||m(e.parentNode);n?.walk?.(e,n)},k=(e,t,n,r)=>{const o=r.key||p,i=new Map;for(let f=e.firstChild;f;f=f.nextSibling)if(1===f.nodeType){const e=o(f);if(null==e)continue;i.set(e,f)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,l=t.firstChild;const a=t=>{const r=t.cloneNode(!0);e.insertBefore(r,c),y(r,n)};for(;l;){const t=l.nextSibling,o=s(l);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),b(t,l,n,r)):a(l)}else if(c&&null==s(c)){const e=c.nextSibling;b(c,l,n,r),c=e}else a(l);l=t}for(;c;){const t=c.nextSibling;n?.dispose?.(c),e.removeChild(c),c=t}},x=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=w();b(e,r,m(e),n),t()}return e},w=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},S={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},E=Object.freeze({...S}),O={mobile:"base",tablet:"md",desktop:"lg"},A=/^\d+$/,L=(0,t.reactive)({bp:"base",tick:0}),T={...S},$=["base"],j=!1,_=[],q=new Map,P=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,C=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),D=()=>{for(let e=_.length-1;e>=0;e--)if(_[e].mql.matches)return $[e+1];return"base"},M=()=>{_.forEach(e=>e.off()),_=[];const e=Object.keys(T).filter(e=>T[e]>0).sort((e,t)=>T[e]-T[t]);$=["base",...e],P()&&(_=e.map(e=>{const t=window.matchMedia(`(min-width: ${T[e]}px)`);return C(t,()=>{L.bp=D()})}),L.bp=D())},N=()=>{j||(j=!0,M()),L.tick},z=e=>{if(!P())return!1;let t=q.get(e);if(!t){const n=window.matchMedia(e);t=C(n,()=>L.tick++),q.set(e,t)}return t.mql.matches},I=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(A.test(e))return Number(e);const t=O[e];return void 0!==t?"base"===t?0:T[t]:T[e]},B=e=>{if(e<=0)return!0;const t=$.findIndex(t=>"base"!==t&&T[t]===e);return-1!==t?$.indexOf(L.bp)>=t:(L.tick,z(`(min-width: ${e}px)`))},R=new Set,H=(e,t)=>{let n;N();let r=-1;for(const o of Object.keys(e)){const t=I(o);void 0!==t?t>=r&&B(t)&&(r=t,n=e[o]):($.join(", "),Object.keys(O).join(", "))}return void 0!==n?n:t},J=e=>{const t=O[e],n=T[t];return void 0!==n?n:S[t]},K=Object.defineProperties((e,t)=>H(e,t),{props:{value:e=>{N();const t={};for(const n of Object.keys(e))t[n]=H(e[n]);return t}},breakpoint:{get:()=>(N(),L.bp),enumerable:!0},device:{get:()=>(N(),B(J("tablet"))?B(J("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{N();const t=I(e);return void 0!==t&&B(t)}},match:{value:e=>(N(),z(e))},configure:{value:({breakpoints:e})=>{e&&(T={...e},j&&(M(),L.tick++))}}}),V=()=>{_.forEach(e=>e.off()),q.forEach(e=>e.off()),_=[],q.clear(),j=!1};e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const f in r||{}){const e=/^duration-(\d+)$/.exec(f);e&&(i=+e[1])}o.style.overflow="hidden";let s=!0,c=0;const l=new Set,a=(e,t)=>{const n=setTimeout(()=>{l.delete(n),e()},t);l.add(n)};return n(()=>{const e=!!t(),n=++c;if(s)return s=!1,e||(o.style.height="0px"),void a(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",a(()=>{n===c&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>l.forEach(clearTimeout)})},e.defaultBreakpoints=E,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=()=>{const e=((e,t)=>{let r="",o="",i=0;for(let s=0;s<t.length;s++){const c=n[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;r+=o+e[i++],o=""}else o+=t[s],e[i]===t[s]&&i++}return r})(r.value,t);e!==r.value&&(r.value=e)};return e.addEventListener("input",o),o(),()=>e.removeEventListener("input",o)})},e.media=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&K.configure(t),e.scope.$mq=K,e.scope.$mqProps=K.props,e.scope.$mqAtLeast=K.atLeast,e.scope.$mqMatch=K.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>K.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>K.device,enumerable:!0,configurable:!0}),V),e.morph=x,e.morphPlugin=e=>{e.scope.$morph=x},e.mq=K,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:s})=>{const c=i+(n||t.id);let f;for(const i in o||{})if(l(i)){f=i;break}const u=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;a(e.scope,c,u,l(f),s)})},e.persistStore=(e,n={})=>{const r=(0,t.store)(e);if(!r)return()=>{};const o=l(n.storage);return a(r,i+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{s[e]=t},e.resetMedia=()=>{V(),T={...S},$=["base",...Object.keys(T).sort((e,t)=>T[e]-T[t])],j=!1,R.clear(),L.bp="base",L.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n})=>{const r=t(`(($width, $height) => { ${n} })`),o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:i,exp:s})=>{const c=e,l=r||"v",a=e=>`${l}-${e}`;let f,u=0,d=!0;const p=()=>{c.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},m=(e,t)=>{const n=++u;p(),c.classList.add(a(e+"-from"),a(e+"-active")),c.offsetWidth,c.classList.remove(a(e+"-from")),c.classList.add(a(e+"-to")),clearTimeout(f),f=setTimeout(()=>{n===u&&(p(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(c))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&m("enter")}),c.__leave=()=>new Promise(e=>m("leave",e)),()=>{e=!1,clearTimeout(f),delete c.__leave}}return n(()=>{const e=!!t();if(d)return d=!1,c.style.display=e?"":"none",void(e&&i?.appear&&m("enter"));e?(c.style.display="",m("enter")):m("leave",()=>{c.style.display="none"})}),()=>clearTimeout(f)})}});