@leaflink/stash 53.4.3 → 53.4.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.
@@ -0,0 +1,424 @@
1
+ import { isRef as Z, shallowRef as h, toValue as S, onMounted as ee, nextTick as re, getCurrentScope as se, onScopeDispose as ue, watch as j, getCurrentInstance as te, computed as P, reactive as K, unref as ie } from "vue";
2
+ function V(e, o) {
3
+ return se() ? (ue(e, o), !0) : !1;
4
+ }
5
+ const ce = typeof window < "u" && typeof document < "u";
6
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
7
+ const oe = (e) => e != null, ae = Object.prototype.toString, fe = (e) => ae.call(e) === "[object Object]", H = () => {
8
+ };
9
+ function ne(e, o) {
10
+ function l(...n) {
11
+ return new Promise((r, t) => {
12
+ Promise.resolve(e(() => o.apply(this, n), {
13
+ fn: o,
14
+ thisArg: this,
15
+ args: n
16
+ })).then(r).catch(t);
17
+ });
18
+ }
19
+ return l;
20
+ }
21
+ function ve(e, o = {}) {
22
+ let l, n, r = H;
23
+ const t = (i) => {
24
+ clearTimeout(i), r(), r = H;
25
+ };
26
+ let u;
27
+ return (i) => {
28
+ const p = S(e), s = S(o.maxWait);
29
+ return l && t(l), p <= 0 || s !== void 0 && s <= 0 ? (n && (t(n), n = void 0), Promise.resolve(i())) : new Promise((a, m) => {
30
+ r = o.rejectOnCancel ? m : a, u = i, s && !n && (n = setTimeout(() => {
31
+ l && t(l), n = void 0, a(u());
32
+ }, s)), l = setTimeout(() => {
33
+ n && t(n), n = void 0, a(i());
34
+ }, p);
35
+ });
36
+ };
37
+ }
38
+ function de(...e) {
39
+ let o = 0, l, n = !0, r = H, t, u, v, i, p;
40
+ !Z(e[0]) && typeof e[0] == "object" ? { delay: u, trailing: v = !0, leading: i = !0, rejectOnCancel: p = !1 } = e[0] : [u, v = !0, i = !0, p = !1] = e;
41
+ const s = () => {
42
+ l && (clearTimeout(l), l = void 0, r(), r = H);
43
+ };
44
+ return (m) => {
45
+ const d = S(u), b = Date.now() - o, E = () => t = m();
46
+ return s(), d <= 0 ? (o = Date.now(), E()) : (b > d ? (o = Date.now(), (i || !n) && E()) : v && (t = new Promise((g, w) => {
47
+ r = p ? w : g, l = setTimeout(() => {
48
+ o = Date.now(), n = !0, g(E()), s();
49
+ }, Math.max(0, d - b));
50
+ })), !i && !l && (l = setTimeout(() => n = !0, d)), n = !1, t);
51
+ };
52
+ }
53
+ function $(e) {
54
+ return Array.isArray(e) ? e : [e];
55
+ }
56
+ function pe(e) {
57
+ return te();
58
+ }
59
+ // @__NO_SIDE_EFFECTS__
60
+ function me(e, o = 200, l = {}) {
61
+ return ne(ve(o, l), e);
62
+ }
63
+ // @__NO_SIDE_EFFECTS__
64
+ function he(e, o = 200, l = !1, n = !0, r = !1) {
65
+ return ne(de(o, l, n, r), e);
66
+ }
67
+ function k(e, o = !0, l) {
68
+ pe() ? ee(e, l) : o ? e() : re(e);
69
+ }
70
+ // @__NO_SIDE_EFFECTS__
71
+ function Se(e = !1, o = {}) {
72
+ const { truthyValue: l = !0, falsyValue: n = !1 } = o, r = Z(e), t = h(e);
73
+ function u(v) {
74
+ if (arguments.length)
75
+ return t.value = v, t.value;
76
+ {
77
+ const i = S(l);
78
+ return t.value = t.value === i ? S(n) : i, t.value;
79
+ }
80
+ }
81
+ return r ? u : [t, u];
82
+ }
83
+ function be(e, o, l) {
84
+ return j(e, o, {
85
+ ...l,
86
+ immediate: !0
87
+ });
88
+ }
89
+ const F = ce ? window : void 0;
90
+ function D(e) {
91
+ var o;
92
+ const l = S(e);
93
+ return (o = l == null ? void 0 : l.$el) !== null && o !== void 0 ? o : l;
94
+ }
95
+ function _(...e) {
96
+ const o = (n, r, t, u) => (n.addEventListener(r, t, u), () => n.removeEventListener(r, t, u)), l = P(() => {
97
+ const n = $(S(e[0])).filter((r) => r != null);
98
+ return n.every((r) => typeof r != "string") ? n : void 0;
99
+ });
100
+ return be(() => {
101
+ var n, r;
102
+ return [
103
+ (n = (r = l.value) === null || r === void 0 ? void 0 : r.map((t) => D(t))) !== null && n !== void 0 ? n : [F].filter((t) => t != null),
104
+ $(S(l.value ? e[1] : e[0])),
105
+ $(ie(l.value ? e[2] : e[1])),
106
+ S(l.value ? e[3] : e[2])
107
+ ];
108
+ }, ([n, r, t, u], v, i) => {
109
+ if (!(n != null && n.length) || !(r != null && r.length) || !(t != null && t.length)) return;
110
+ const p = fe(u) ? { ...u } : u, s = n.flatMap((a) => r.flatMap((m) => t.map((d) => o(a, m, d, p))));
111
+ i(() => {
112
+ s.forEach((a) => a());
113
+ });
114
+ }, { flush: "post" });
115
+ }
116
+ // @__NO_SIDE_EFFECTS__
117
+ function ge() {
118
+ const e = h(!1), o = te();
119
+ return o && ee(() => {
120
+ e.value = !0;
121
+ }, o), e;
122
+ }
123
+ // @__NO_SIDE_EFFECTS__
124
+ function B(e) {
125
+ const o = /* @__PURE__ */ ge();
126
+ return P(() => (o.value, !!e()));
127
+ }
128
+ function G(e, o, l = {}) {
129
+ const { window: n = F, ...r } = l;
130
+ let t;
131
+ const u = /* @__PURE__ */ B(() => n && "MutationObserver" in n), v = () => {
132
+ t && (t.disconnect(), t = void 0);
133
+ }, i = j(P(() => {
134
+ const a = $(S(e)).map(D).filter(oe);
135
+ return new Set(a);
136
+ }), (a) => {
137
+ v(), u.value && a.size && (t = new MutationObserver(o), a.forEach((m) => t.observe(m, r)));
138
+ }, {
139
+ immediate: !0,
140
+ flush: "post"
141
+ }), p = () => t == null ? void 0 : t.takeRecords(), s = () => {
142
+ i(), v();
143
+ };
144
+ return V(s), {
145
+ isSupported: u,
146
+ stop: s,
147
+ takeRecords: p
148
+ };
149
+ }
150
+ function le(e, o, l = {}) {
151
+ const { window: n = F, ...r } = l;
152
+ let t;
153
+ const u = /* @__PURE__ */ B(() => n && "ResizeObserver" in n), v = () => {
154
+ t && (t.disconnect(), t = void 0);
155
+ }, i = j(P(() => {
156
+ const s = S(e);
157
+ return Array.isArray(s) ? s.map((a) => D(a)) : [D(s)];
158
+ }), (s) => {
159
+ if (v(), u.value && n) {
160
+ t = new ResizeObserver(o);
161
+ for (const a of s) a && t.observe(a, r);
162
+ }
163
+ }, {
164
+ immediate: !0,
165
+ flush: "post"
166
+ }), p = () => {
167
+ v(), i();
168
+ };
169
+ return V(p), {
170
+ isSupported: u,
171
+ stop: p
172
+ };
173
+ }
174
+ function Oe(e, o = {}) {
175
+ const { reset: l = !0, windowResize: n = !0, windowScroll: r = !0, immediate: t = !0, updateTiming: u = "sync" } = o, v = h(0), i = h(0), p = h(0), s = h(0), a = h(0), m = h(0), d = h(0), b = h(0);
176
+ function E() {
177
+ const w = D(e);
178
+ if (!w) {
179
+ l && (v.value = 0, i.value = 0, p.value = 0, s.value = 0, a.value = 0, m.value = 0, d.value = 0, b.value = 0);
180
+ return;
181
+ }
182
+ const y = w.getBoundingClientRect();
183
+ v.value = y.height, i.value = y.bottom, p.value = y.left, s.value = y.right, a.value = y.top, m.value = y.width, d.value = y.x, b.value = y.y;
184
+ }
185
+ function g() {
186
+ u === "sync" ? E() : u === "next-frame" && requestAnimationFrame(() => E());
187
+ }
188
+ return le(e, g), j(() => D(e), (w) => !w && g()), G(e, g, { attributeFilter: ["style", "class"] }), r && _("scroll", g, {
189
+ capture: !0,
190
+ passive: !0
191
+ }), n && _("resize", g, { passive: !0 }), k(() => {
192
+ t && g();
193
+ }), {
194
+ height: v,
195
+ bottom: i,
196
+ left: p,
197
+ right: s,
198
+ top: a,
199
+ width: m,
200
+ x: d,
201
+ y: b,
202
+ update: g
203
+ };
204
+ }
205
+ function Te(e, o, l = {}) {
206
+ const { root: n, rootMargin: r = "0px", threshold: t = 0, window: u = F, immediate: v = !0 } = l, i = /* @__PURE__ */ B(() => u && "IntersectionObserver" in u), p = P(() => $(S(e)).map(D).filter(oe));
207
+ let s = H;
208
+ const a = h(v), m = i.value ? j(() => [
209
+ p.value,
210
+ D(n),
211
+ a.value
212
+ ], ([b, E]) => {
213
+ if (s(), !a.value || !b.length) return;
214
+ const g = new IntersectionObserver(o, {
215
+ root: D(E),
216
+ rootMargin: r,
217
+ threshold: t
218
+ });
219
+ b.forEach((w) => w && g.observe(w)), s = () => {
220
+ g.disconnect(), s = H;
221
+ };
222
+ }, {
223
+ immediate: v,
224
+ flush: "post"
225
+ }) : H, d = () => {
226
+ s(), m(), a.value = !1;
227
+ };
228
+ return V(d), {
229
+ isSupported: i,
230
+ isActive: a,
231
+ pause() {
232
+ s(), a.value = !1;
233
+ },
234
+ resume() {
235
+ a.value = !0;
236
+ },
237
+ stop: d
238
+ };
239
+ }
240
+ const Q = 1;
241
+ function Me(e, o = {}) {
242
+ const { throttle: l = 0, idle: n = 200, onStop: r = H, onScroll: t = H, offset: u = {
243
+ left: 0,
244
+ right: 0,
245
+ top: 0,
246
+ bottom: 0
247
+ }, observe: v = { mutation: !1 }, eventListenerOptions: i = {
248
+ capture: !1,
249
+ passive: !0
250
+ }, behavior: p = "auto", window: s = F, onError: a = (c) => {
251
+ console.error(c);
252
+ } } = o, m = typeof v == "boolean" ? { mutation: v } : v, d = h(0), b = h(0), E = P({
253
+ get() {
254
+ return d.value;
255
+ },
256
+ set(c) {
257
+ w(c, void 0);
258
+ }
259
+ }), g = P({
260
+ get() {
261
+ return b.value;
262
+ },
263
+ set(c) {
264
+ w(void 0, c);
265
+ }
266
+ });
267
+ function w(c, x) {
268
+ var T, X, I, z;
269
+ if (!s) return;
270
+ const R = S(e);
271
+ if (!R) return;
272
+ (T = R instanceof Document ? s.document.body : R) === null || T === void 0 || T.scrollTo({
273
+ top: (X = S(x)) !== null && X !== void 0 ? X : g.value,
274
+ left: (I = S(c)) !== null && I !== void 0 ? I : E.value,
275
+ behavior: S(p)
276
+ });
277
+ const Y = (R == null || (z = R.document) === null || z === void 0 ? void 0 : z.documentElement) || (R == null ? void 0 : R.documentElement) || R;
278
+ E != null && (d.value = Y.scrollLeft), g != null && (b.value = Y.scrollTop);
279
+ }
280
+ const y = h(!1), O = K({
281
+ left: !0,
282
+ right: !1,
283
+ top: !0,
284
+ bottom: !1
285
+ }), M = K({
286
+ left: !1,
287
+ right: !1,
288
+ top: !1,
289
+ bottom: !1
290
+ }), W = (c) => {
291
+ y.value && (y.value = !1, M.left = !1, M.right = !1, M.top = !1, M.bottom = !1, r(c));
292
+ }, A = /* @__PURE__ */ me(W, l + n), f = (c) => {
293
+ var x;
294
+ if (!s) return;
295
+ const T = (c == null || (x = c.document) === null || x === void 0 ? void 0 : x.documentElement) || (c == null ? void 0 : c.documentElement) || D(c), { display: X, flexDirection: I, direction: z } = s.getComputedStyle(T), R = z === "rtl" ? -1 : 1, Y = T.scrollLeft;
296
+ M.left = Y < d.value, M.right = Y > d.value;
297
+ const q = Math.abs(Y * R) <= (u.left || 0), N = Math.abs(Y * R) + T.clientWidth >= T.scrollWidth - (u.right || 0) - Q;
298
+ X === "flex" && I === "row-reverse" ? (O.left = N, O.right = q) : (O.left = q, O.right = N), d.value = Y;
299
+ let C = T.scrollTop;
300
+ c === s.document && !C && (C = s.document.body.scrollTop), M.top = C < b.value, M.bottom = C > b.value;
301
+ const U = Math.abs(C) <= (u.top || 0), J = Math.abs(C) + T.clientHeight >= T.scrollHeight - (u.bottom || 0) - Q;
302
+ X === "flex" && I === "column-reverse" ? (O.top = J, O.bottom = U) : (O.top = U, O.bottom = J), b.value = C;
303
+ }, L = (c) => {
304
+ var x;
305
+ s && (f((x = c.target.documentElement) !== null && x !== void 0 ? x : c.target), y.value = !0, A(c), t(c));
306
+ };
307
+ return _(e, "scroll", l ? /* @__PURE__ */ he(L, l, !0, !1) : L, i), k(() => {
308
+ try {
309
+ const c = S(e);
310
+ if (!c) return;
311
+ f(c);
312
+ } catch (c) {
313
+ a(c);
314
+ }
315
+ }), m != null && m.mutation && e != null && e !== s && e !== document && G(e, () => {
316
+ const c = S(e);
317
+ c && f(c);
318
+ }, {
319
+ attributes: !0,
320
+ childList: !0,
321
+ subtree: !0
322
+ }), _(e, "scrollend", W, i), {
323
+ x: E,
324
+ y: g,
325
+ isScrolling: y,
326
+ arrivedState: O,
327
+ directions: M,
328
+ measure() {
329
+ const c = S(e);
330
+ s && c && f(c);
331
+ }
332
+ };
333
+ }
334
+ const ye = {
335
+ page: (e) => [e.pageX, e.pageY],
336
+ client: (e) => [e.clientX, e.clientY],
337
+ screen: (e) => [e.screenX, e.screenY],
338
+ movement: (e) => e instanceof MouseEvent ? [e.movementX, e.movementY] : null
339
+ };
340
+ function we(e = {}) {
341
+ const { type: o = "page", touch: l = !0, resetOnTouchEnds: n = !1, initialValue: r = {
342
+ x: 0,
343
+ y: 0
344
+ }, window: t = F, target: u = t, scroll: v = !0, eventFilter: i } = e;
345
+ let p = null, s = 0, a = 0;
346
+ const m = h(r.x), d = h(r.y), b = h(null), E = typeof o == "function" ? o : ye[o], g = (f) => {
347
+ const L = E(f);
348
+ p = f, L && ([m.value, d.value] = L, b.value = "mouse"), t && (s = t.scrollX, a = t.scrollY);
349
+ }, w = (f) => {
350
+ if (f.touches.length > 0) {
351
+ const L = E(f.touches[0]);
352
+ L && ([m.value, d.value] = L, b.value = "touch");
353
+ }
354
+ }, y = () => {
355
+ if (!p || !t) return;
356
+ const f = E(p);
357
+ p instanceof MouseEvent && f && (m.value = f[0] + t.scrollX - s, d.value = f[1] + t.scrollY - a);
358
+ }, O = () => {
359
+ m.value = r.x, d.value = r.y;
360
+ }, M = i ? (f) => i(() => g(f), {}) : (f) => g(f), W = i ? (f) => i(() => w(f), {}) : (f) => w(f), A = i ? () => i(() => y(), {}) : () => y();
361
+ if (u) {
362
+ const f = { passive: !0 };
363
+ _(u, ["mousemove", "dragover"], M, f), l && o !== "movement" && (_(u, ["touchstart", "touchmove"], W, f), n && _(u, "touchend", O, f)), v && o === "page" && _(t, "scroll", A, f);
364
+ }
365
+ return {
366
+ x: m,
367
+ y: d,
368
+ sourceType: b
369
+ };
370
+ }
371
+ function xe(e, o = {}) {
372
+ const { windowResize: l = !0, windowScroll: n = !0, handleOutside: r = !0, window: t = F } = o, u = o.type || "page", { x: v, y: i, sourceType: p } = we(o), s = h(e ?? (t == null ? void 0 : t.document.body)), a = h(0), m = h(0), d = h(0), b = h(0), E = h(0), g = h(0), w = h(!0);
373
+ function y() {
374
+ if (!t) return;
375
+ const W = D(s);
376
+ if (!(!W || !(W instanceof Element)))
377
+ for (const A of W.getClientRects()) {
378
+ const { left: f, top: L, width: c, height: x } = A;
379
+ d.value = f + (u === "page" ? t.pageXOffset : 0), b.value = L + (u === "page" ? t.pageYOffset : 0), E.value = x, g.value = c;
380
+ const T = v.value - d.value, X = i.value - b.value;
381
+ if (w.value = c === 0 || x === 0 || T < 0 || X < 0 || T > c || X > x, (r || !w.value) && (a.value = T, m.value = X), !w.value) break;
382
+ }
383
+ }
384
+ const O = [];
385
+ function M() {
386
+ O.forEach((W) => W()), O.length = 0;
387
+ }
388
+ if (k(() => {
389
+ y();
390
+ }), t) {
391
+ const { stop: W } = le(s, y), { stop: A } = G(s, y, { attributeFilter: ["style", "class"] }), f = j([
392
+ s,
393
+ v,
394
+ i
395
+ ], y);
396
+ O.push(W, A, f), _(document, "mouseleave", () => w.value = !0, { passive: !0 }), n && O.push(_("scroll", y, {
397
+ capture: !0,
398
+ passive: !0
399
+ })), l && O.push(_("resize", y, { passive: !0 }));
400
+ }
401
+ return {
402
+ x: v,
403
+ y: i,
404
+ sourceType: p,
405
+ elementX: a,
406
+ elementY: m,
407
+ elementPositionX: d,
408
+ elementPositionY: b,
409
+ elementHeight: E,
410
+ elementWidth: g,
411
+ isOutside: w,
412
+ stop: M
413
+ };
414
+ }
415
+ export {
416
+ D as a,
417
+ Me as b,
418
+ le as c,
419
+ Te as d,
420
+ Se as e,
421
+ Oe as f,
422
+ xe as u
423
+ };
424
+ //# sourceMappingURL=index-DA70nQCT.js.map