@object-ui/plugin-kanban 3.1.3 → 3.1.4

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,817 @@
1
+ import { n as e, r as t, t as n } from "./plus-CAtTu4zt.js";
2
+ import { t as r } from "./chevron-down-DpXJN6OX.js";
3
+ import { a as i, d as a, f as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./sortable.esm-DzUCoMzQ.js";
4
+ import * as h from "react";
5
+ import { Badge as g, Button as _, Card as v, CardContent as y, CardDescription as b, CardHeader as x, CardTitle as S, Input as C } from "@object-ui/components";
6
+ import { flushSync as w } from "react-dom";
7
+ var T = e("chevron-right", [["path", {
8
+ d: "m9 18 6-6-6-6",
9
+ key: "mthhwq"
10
+ }]]), E = e("triangle-alert", [
11
+ ["path", {
12
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
13
+ key: "wmoenq"
14
+ }],
15
+ ["path", {
16
+ d: "M12 9v4",
17
+ key: "juzpu7"
18
+ }],
19
+ ["path", {
20
+ d: "M12 17h.01",
21
+ key: "p32p05"
22
+ }]
23
+ ]);
24
+ //#endregion
25
+ //#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.13.23/node_modules/@tanstack/virtual-core/dist/esm/utils.js
26
+ function D(e, t, n) {
27
+ let r = n.initialDeps ?? [], i, a = !0;
28
+ function o() {
29
+ let o;
30
+ n.key && n.debug?.call(n) && (o = Date.now());
31
+ let s = e();
32
+ if (!(s.length !== r.length || s.some((e, t) => r[t] !== e))) return i;
33
+ r = s;
34
+ let c;
35
+ if (n.key && n.debug?.call(n) && (c = Date.now()), i = t(...s), n.key && n.debug?.call(n)) {
36
+ let e = Math.round((Date.now() - o) * 100) / 100, t = Math.round((Date.now() - c) * 100) / 100, r = t / 16, i = (e, t) => {
37
+ for (e = String(e); e.length < t;) e = " " + e;
38
+ return e;
39
+ };
40
+ console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
41
+ font-size: .6rem;
42
+ font-weight: bold;
43
+ color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
44
+ }
45
+ return n?.onChange && !(a && n.skipInitialOnChange) && n.onChange(i), a = !1, i;
46
+ }
47
+ return o.updateDeps = (e) => {
48
+ r = e;
49
+ }, o;
50
+ }
51
+ function O(e, t) {
52
+ if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
53
+ return e;
54
+ }
55
+ var k = (e, t) => Math.abs(e - t) < 1.01, A = (e, t, n) => {
56
+ let r;
57
+ return function(...i) {
58
+ e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
59
+ };
60
+ }, j = (e) => {
61
+ let { offsetWidth: t, offsetHeight: n } = e;
62
+ return {
63
+ width: t,
64
+ height: n
65
+ };
66
+ }, M = (e) => e, N = (e) => {
67
+ let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
68
+ for (let e = t; e <= n; e++) r.push(e);
69
+ return r;
70
+ }, P = (e, t) => {
71
+ let n = e.scrollElement;
72
+ if (!n) return;
73
+ let r = e.targetWindow;
74
+ if (!r) return;
75
+ let i = (e) => {
76
+ let { width: n, height: r } = e;
77
+ t({
78
+ width: Math.round(n),
79
+ height: Math.round(r)
80
+ });
81
+ };
82
+ if (i(j(n)), !r.ResizeObserver) return () => {};
83
+ let a = new r.ResizeObserver((t) => {
84
+ let r = () => {
85
+ let e = t[0];
86
+ if (e?.borderBoxSize) {
87
+ let t = e.borderBoxSize[0];
88
+ if (t) {
89
+ i({
90
+ width: t.inlineSize,
91
+ height: t.blockSize
92
+ });
93
+ return;
94
+ }
95
+ }
96
+ i(j(n));
97
+ };
98
+ e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
99
+ });
100
+ return a.observe(n, { box: "border-box" }), () => {
101
+ a.unobserve(n);
102
+ };
103
+ }, F = { passive: !0 }, I = typeof window > "u" ? !0 : "onscrollend" in window, L = (e, t) => {
104
+ let n = e.scrollElement;
105
+ if (!n) return;
106
+ let r = e.targetWindow;
107
+ if (!r) return;
108
+ let i = 0, a = e.options.useScrollendEvent && I ? () => void 0 : A(r, () => {
109
+ t(i, !1);
110
+ }, e.options.isScrollingResetDelay), o = (r) => () => {
111
+ let { horizontal: o, isRtl: s } = e.options;
112
+ i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
113
+ }, s = o(!0), c = o(!1);
114
+ n.addEventListener("scroll", s, F);
115
+ let l = e.options.useScrollendEvent && I;
116
+ return l && n.addEventListener("scrollend", c, F), () => {
117
+ n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
118
+ };
119
+ }, R = (e, t, n) => {
120
+ if (t?.borderBoxSize) {
121
+ let e = t.borderBoxSize[0];
122
+ if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
123
+ }
124
+ return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
125
+ }, z = (e, { adjustments: t = 0, behavior: n }, r) => {
126
+ var i, a;
127
+ let o = e + t;
128
+ (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
129
+ [r.options.horizontal ? "left" : "top"]: o,
130
+ behavior: n
131
+ });
132
+ }, B = class {
133
+ constructor(e) {
134
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
135
+ var e;
136
+ return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
137
+ }, this.observer = /* @__PURE__ */ (() => {
138
+ let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
139
+ e.forEach((e) => {
140
+ let t = () => {
141
+ let t = e.target, n = this.indexFromElement(t);
142
+ if (!t.isConnected) {
143
+ this.observer.unobserve(t);
144
+ return;
145
+ }
146
+ this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
147
+ };
148
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
149
+ });
150
+ }));
151
+ return {
152
+ disconnect: () => {
153
+ var n;
154
+ (n = t()) == null || n.disconnect(), e = null;
155
+ },
156
+ observe: (e) => t()?.observe(e, { box: "border-box" }),
157
+ unobserve: (e) => t()?.unobserve(e)
158
+ };
159
+ })(), this.range = null, this.setOptions = (e) => {
160
+ Object.entries(e).forEach(([t, n]) => {
161
+ n === void 0 && delete e[t];
162
+ }), this.options = {
163
+ debug: !1,
164
+ initialOffset: 0,
165
+ overscan: 1,
166
+ paddingStart: 0,
167
+ paddingEnd: 0,
168
+ scrollPaddingStart: 0,
169
+ scrollPaddingEnd: 0,
170
+ horizontal: !1,
171
+ getItemKey: M,
172
+ rangeExtractor: N,
173
+ onChange: () => {},
174
+ measureElement: R,
175
+ initialRect: {
176
+ width: 0,
177
+ height: 0
178
+ },
179
+ scrollMargin: 0,
180
+ gap: 0,
181
+ indexAttribute: "data-index",
182
+ initialMeasurementsCache: [],
183
+ lanes: 1,
184
+ isScrollingResetDelay: 150,
185
+ enabled: !0,
186
+ isRtl: !1,
187
+ useScrollendEvent: !1,
188
+ useAnimationFrameWithResizeObserver: !1,
189
+ ...e
190
+ };
191
+ }, this.notify = (e) => {
192
+ var t, n;
193
+ (n = (t = this.options).onChange) == null || n.call(t, this, e);
194
+ }, this.maybeNotify = D(() => (this.calculateRange(), [
195
+ this.isScrolling,
196
+ this.range ? this.range.startIndex : null,
197
+ this.range ? this.range.endIndex : null
198
+ ]), (e) => {
199
+ this.notify(e);
200
+ }, {
201
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
202
+ debug: () => this.options.debug,
203
+ initialDeps: [
204
+ this.isScrolling,
205
+ this.range ? this.range.startIndex : null,
206
+ this.range ? this.range.endIndex : null
207
+ ]
208
+ }), this.cleanup = () => {
209
+ this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null;
210
+ }, this._didMount = () => () => {
211
+ this.cleanup();
212
+ }, this._willUpdate = () => {
213
+ let e = this.options.enabled ? this.options.getScrollElement() : null;
214
+ if (this.scrollElement !== e) {
215
+ if (this.cleanup(), !e) {
216
+ this.maybeNotify();
217
+ return;
218
+ }
219
+ this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
220
+ this.observer.observe(e);
221
+ }), this.unsubs.push(this.options.observeElementRect(this, (e) => {
222
+ this.scrollRect = e, this.maybeNotify();
223
+ })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
224
+ this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
225
+ })), this._scrollToOffset(this.getScrollOffset(), {
226
+ adjustments: void 0,
227
+ behavior: void 0
228
+ });
229
+ }
230
+ }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
231
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
232
+ for (let i = t - 1; i >= 0; i--) {
233
+ let t = e[i];
234
+ if (n.has(t.lane)) continue;
235
+ let a = r.get(t.lane);
236
+ if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
237
+ }
238
+ return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
239
+ }, this.getMeasurementOptions = D(() => [
240
+ this.options.count,
241
+ this.options.paddingStart,
242
+ this.options.scrollMargin,
243
+ this.options.getItemKey,
244
+ this.options.enabled,
245
+ this.options.lanes
246
+ ], (e, t, n, r, i, a) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
247
+ count: e,
248
+ paddingStart: t,
249
+ scrollMargin: n,
250
+ getItemKey: r,
251
+ enabled: i,
252
+ lanes: a
253
+ }), { key: !1 }), this.getMeasurements = D(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a }, o) => {
254
+ if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
255
+ if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
256
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
257
+ this.itemSizeCache.set(e.key, e.size);
258
+ }));
259
+ let s = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
260
+ this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
261
+ let c = this.measurementsCache.slice(0, s), l = Array(a).fill(void 0);
262
+ for (let e = 0; e < s; e++) {
263
+ let t = c[e];
264
+ t && (l[t.lane] = e);
265
+ }
266
+ for (let i = s; i < e; i++) {
267
+ let e = r(i), a = this.laneAssignments.get(i), s, u;
268
+ if (a !== void 0 && this.options.lanes > 1) {
269
+ s = a;
270
+ let e = l[s], r = e === void 0 ? void 0 : c[e];
271
+ u = r ? r.end + this.options.gap : t + n;
272
+ } else {
273
+ let e = this.options.lanes === 1 ? c[i - 1] : this.getFurthestMeasurement(c, i);
274
+ u = e ? e.end + this.options.gap : t + n, s = e ? e.lane : i % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(i, s);
275
+ }
276
+ let d = o.get(e), f = typeof d == "number" ? d : this.options.estimateSize(i), p = u + f;
277
+ c[i] = {
278
+ index: i,
279
+ start: u,
280
+ size: f,
281
+ end: p,
282
+ key: e,
283
+ lane: s
284
+ }, l[s] = i;
285
+ }
286
+ return this.measurementsCache = c, c;
287
+ }, {
288
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
289
+ debug: () => this.options.debug
290
+ }), this.calculateRange = D(() => [
291
+ this.getMeasurements(),
292
+ this.getSize(),
293
+ this.getScrollOffset(),
294
+ this.options.lanes
295
+ ], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? H({
296
+ measurements: e,
297
+ outerSize: t,
298
+ scrollOffset: n,
299
+ lanes: r
300
+ }) : null, {
301
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
302
+ debug: () => this.options.debug
303
+ }), this.getVirtualIndexes = D(() => {
304
+ let e = null, t = null, n = this.calculateRange();
305
+ return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
306
+ this.isScrolling,
307
+ e,
308
+ t
309
+ ]), [
310
+ this.options.rangeExtractor,
311
+ this.options.overscan,
312
+ this.options.count,
313
+ e,
314
+ t
315
+ ];
316
+ }, (e, t, n, r, i) => r === null || i === null ? [] : e({
317
+ startIndex: r,
318
+ endIndex: i,
319
+ overscan: t,
320
+ count: n
321
+ }), {
322
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
323
+ debug: () => this.options.debug
324
+ }), this.indexFromElement = (e) => {
325
+ let t = this.options.indexAttribute, n = e.getAttribute(t);
326
+ return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
327
+ }, this.shouldMeasureDuringScroll = (e) => {
328
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
329
+ let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
330
+ if (t !== void 0 && this.range) {
331
+ let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
332
+ return e >= r && e <= i;
333
+ }
334
+ return !0;
335
+ }, this.measureElement = (e) => {
336
+ if (!e) {
337
+ this.elementsCache.forEach((e, t) => {
338
+ e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
339
+ });
340
+ return;
341
+ }
342
+ let t = this.indexFromElement(e), n = this.options.getItemKey(t), r = this.elementsCache.get(n);
343
+ r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
344
+ }, this.resizeItem = (e, t) => {
345
+ let n = this.measurementsCache[e];
346
+ if (!n) return;
347
+ let r = t - (this.itemSizeCache.get(n.key) ?? n.size);
348
+ r !== 0 && (this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? n.start < this.getScrollOffset() + this.scrollAdjustments : this.shouldAdjustScrollPositionOnItemSizeChange(n, r, this)) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
349
+ adjustments: this.scrollAdjustments += r,
350
+ behavior: void 0
351
+ })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
352
+ }, this.getVirtualItems = D(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
353
+ let n = [];
354
+ for (let r = 0, i = e.length; r < i; r++) {
355
+ let i = t[e[r]];
356
+ n.push(i);
357
+ }
358
+ return n;
359
+ }, {
360
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
361
+ debug: () => this.options.debug
362
+ }), this.getVirtualItemForOffset = (e) => {
363
+ let t = this.getMeasurements();
364
+ if (t.length !== 0) return O(t[V(0, t.length - 1, (e) => O(t[e]).start, e)]);
365
+ }, this.getMaxScrollOffset = () => {
366
+ if (!this.scrollElement) return 0;
367
+ if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
368
+ {
369
+ let e = this.scrollElement.document.documentElement;
370
+ return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
371
+ }
372
+ }, this.getOffsetForAlignment = (e, t, n = 0) => {
373
+ if (!this.scrollElement) return 0;
374
+ let r = this.getSize(), i = this.getScrollOffset();
375
+ t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
376
+ let a = this.getMaxScrollOffset();
377
+ return Math.max(Math.min(a, e), 0);
378
+ }, this.getOffsetForIndex = (e, t = "auto") => {
379
+ e = Math.max(0, Math.min(e, this.options.count - 1));
380
+ let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
381
+ if (!i) return;
382
+ if (t === "auto") if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
383
+ else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
384
+ else return [r, t];
385
+ if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
386
+ let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
387
+ return [this.getOffsetForAlignment(a, t, i.size), t];
388
+ }, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
389
+ let r = this.getOffsetForAlignment(e, t);
390
+ this.scrollState = {
391
+ index: null,
392
+ align: t,
393
+ behavior: n,
394
+ startedAt: this.now(),
395
+ lastTargetOffset: r,
396
+ stableFrames: 0
397
+ }, this._scrollToOffset(r, {
398
+ adjustments: void 0,
399
+ behavior: n
400
+ }), this.scheduleScrollReconcile();
401
+ }, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
402
+ e = Math.max(0, Math.min(e, this.options.count - 1));
403
+ let r = this.getOffsetForIndex(e, t);
404
+ if (!r) return;
405
+ let [i, a] = r, o = this.now();
406
+ this.scrollState = {
407
+ index: e,
408
+ align: a,
409
+ behavior: n,
410
+ startedAt: o,
411
+ lastTargetOffset: i,
412
+ stableFrames: 0
413
+ }, this._scrollToOffset(i, {
414
+ adjustments: void 0,
415
+ behavior: n
416
+ }), this.scheduleScrollReconcile();
417
+ }, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
418
+ let n = this.getScrollOffset() + e;
419
+ this.scrollState = {
420
+ index: null,
421
+ align: "start",
422
+ behavior: t,
423
+ startedAt: this.now(),
424
+ lastTargetOffset: n,
425
+ stableFrames: 0
426
+ }, this._scrollToOffset(n, {
427
+ adjustments: void 0,
428
+ behavior: t
429
+ }), this.scheduleScrollReconcile();
430
+ }, this.getTotalSize = () => {
431
+ let e = this.getMeasurements(), t;
432
+ if (e.length === 0) t = this.options.paddingStart;
433
+ else if (this.options.lanes === 1) t = e[e.length - 1]?.end ?? 0;
434
+ else {
435
+ let n = Array(this.options.lanes).fill(null), r = e.length - 1;
436
+ for (; r >= 0 && n.some((e) => e === null);) {
437
+ let t = e[r];
438
+ n[t.lane] === null && (n[t.lane] = t.end), r--;
439
+ }
440
+ t = Math.max(...n.filter((e) => e !== null));
441
+ }
442
+ return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
443
+ }, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
444
+ this.options.scrollToFn(e, {
445
+ behavior: n,
446
+ adjustments: t
447
+ }, this);
448
+ }, this.measure = () => {
449
+ this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
450
+ }, this.setOptions(e);
451
+ }
452
+ scheduleScrollReconcile() {
453
+ if (!this.targetWindow) {
454
+ this.scrollState = null;
455
+ return;
456
+ }
457
+ this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
458
+ this.rafId = null, this.reconcileScroll();
459
+ });
460
+ }
461
+ reconcileScroll() {
462
+ if (!this.scrollState || !this.scrollElement) return;
463
+ if (this.now() - this.scrollState.startedAt > 5e3) {
464
+ this.scrollState = null;
465
+ return;
466
+ }
467
+ let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset;
468
+ if (!n && k(t, this.getScrollOffset())) {
469
+ if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
470
+ this.scrollState = null;
471
+ return;
472
+ }
473
+ } else this.scrollState.stableFrames = 0, n && (this.scrollState.lastTargetOffset = t, this.scrollState.behavior = "auto", this._scrollToOffset(t, {
474
+ adjustments: void 0,
475
+ behavior: "auto"
476
+ }));
477
+ this.scheduleScrollReconcile();
478
+ }
479
+ }, V = (e, t, n, r) => {
480
+ for (; e <= t;) {
481
+ let i = (e + t) / 2 | 0, a = n(i);
482
+ if (a < r) e = i + 1;
483
+ else if (a > r) t = i - 1;
484
+ else return i;
485
+ }
486
+ return e > 0 ? e - 1 : 0;
487
+ };
488
+ function H({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
489
+ let i = e.length - 1, a = (t) => e[t].start;
490
+ if (e.length <= r) return {
491
+ startIndex: 0,
492
+ endIndex: i
493
+ };
494
+ let o = V(0, i, a, n), s = o;
495
+ if (r === 1) for (; s < i && e[s].end < n + t;) s++;
496
+ else if (r > 1) {
497
+ let a = Array(r).fill(0);
498
+ for (; s < i && a.some((e) => e < n + t);) {
499
+ let t = e[s];
500
+ a[t.lane] = t.end, s++;
501
+ }
502
+ let c = Array(r).fill(n + t);
503
+ for (; o >= 0 && c.some((e) => e >= n);) {
504
+ let t = e[o];
505
+ c[t.lane] = t.start, o--;
506
+ }
507
+ o = Math.max(0, o - o % r), s = Math.min(i, s + (r - 1 - s % r));
508
+ }
509
+ return {
510
+ startIndex: o,
511
+ endIndex: s
512
+ };
513
+ }
514
+ //#endregion
515
+ //#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.23_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@tanstack/react-virtual/dist/esm/index.js
516
+ var U = typeof document < "u" ? h.useLayoutEffect : h.useEffect;
517
+ function W({ useFlushSync: e = !0, ...t }) {
518
+ let n = h.useReducer(() => ({}), {})[1], r = {
519
+ ...t,
520
+ onChange: (r, i) => {
521
+ var a;
522
+ e && i ? w(n) : n(), (a = t.onChange) == null || a.call(t, r, i);
523
+ }
524
+ }, [i] = h.useState(() => new B(r));
525
+ return i.setOptions(r), U(() => i._didMount(), []), U(() => i._willUpdate()), i;
526
+ }
527
+ function G(e) {
528
+ return W({
529
+ observeElementRect: P,
530
+ observeElementOffset: L,
531
+ scrollToFn: z,
532
+ ...e
533
+ });
534
+ }
535
+ //#endregion
536
+ //#region src/KanbanEnhanced.tsx
537
+ var K = t(), q = (...e) => e.filter(Boolean).join(" ");
538
+ function J(e, t) {
539
+ if (!t || t.length === 0) return {};
540
+ for (let n of t) {
541
+ let t = e[n.field];
542
+ if (t == null) continue;
543
+ let r = !1, i = String(t);
544
+ switch (n.operator) {
545
+ case "equals":
546
+ r = i === String(n.value);
547
+ break;
548
+ case "not_equals":
549
+ r = i !== String(n.value);
550
+ break;
551
+ case "contains":
552
+ r = i.toLowerCase().includes(String(n.value).toLowerCase());
553
+ break;
554
+ case "in":
555
+ r = Array.isArray(n.value) && n.value.includes(i);
556
+ break;
557
+ }
558
+ if (r) return {
559
+ ...n.backgroundColor ? { backgroundColor: n.backgroundColor } : {},
560
+ ...n.borderColor ? { borderColor: n.borderColor } : {}
561
+ };
562
+ }
563
+ return {};
564
+ }
565
+ function Y({ card: e, conditionalFormatting: t }) {
566
+ let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: s, isDragging: c } = d({ id: e.id }), l = {
567
+ transform: o.Transform.toString(a),
568
+ transition: s,
569
+ opacity: c ? .5 : void 0
570
+ }, u = J(e, t);
571
+ return /* @__PURE__ */ (0, K.jsx)("div", {
572
+ ref: i,
573
+ style: l,
574
+ ...n,
575
+ ...r,
576
+ children: /* @__PURE__ */ (0, K.jsxs)(v, {
577
+ className: "mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",
578
+ style: u,
579
+ children: [
580
+ e.coverImage && /* @__PURE__ */ (0, K.jsx)("div", {
581
+ className: "w-full h-32 overflow-hidden rounded-t-lg",
582
+ children: /* @__PURE__ */ (0, K.jsx)("img", {
583
+ src: e.coverImage,
584
+ alt: "",
585
+ className: "w-full h-full object-cover",
586
+ loading: "lazy"
587
+ })
588
+ }),
589
+ /* @__PURE__ */ (0, K.jsxs)(x, {
590
+ className: "p-4",
591
+ children: [/* @__PURE__ */ (0, K.jsx)(S, {
592
+ className: "text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",
593
+ children: e.title
594
+ }), e.description && /* @__PURE__ */ (0, K.jsx)(b, {
595
+ className: "text-xs text-muted-foreground font-mono",
596
+ children: e.description
597
+ })]
598
+ }),
599
+ e.badges && e.badges.length > 0 && /* @__PURE__ */ (0, K.jsx)(y, {
600
+ className: "p-4 pt-0",
601
+ children: /* @__PURE__ */ (0, K.jsx)("div", {
602
+ className: "flex flex-wrap gap-1",
603
+ children: e.badges.map((e, t) => /* @__PURE__ */ (0, K.jsx)(g, {
604
+ variant: e.variant || "default",
605
+ className: "text-xs",
606
+ children: e.label
607
+ }, t))
608
+ })
609
+ })
610
+ ]
611
+ })
612
+ });
613
+ }
614
+ function X({ cards: e, parentRef: t, conditionalFormatting: n }) {
615
+ let r = G({
616
+ count: e.length,
617
+ getScrollElement: () => t.current,
618
+ estimateSize: () => 120,
619
+ overscan: 5
620
+ });
621
+ return /* @__PURE__ */ (0, K.jsx)("div", {
622
+ style: {
623
+ height: `${r.getTotalSize()}px`,
624
+ width: "100%",
625
+ position: "relative"
626
+ },
627
+ children: r.getVirtualItems().map((t) => {
628
+ let r = e[t.index];
629
+ return /* @__PURE__ */ (0, K.jsx)("div", {
630
+ style: {
631
+ position: "absolute",
632
+ top: 0,
633
+ left: 0,
634
+ width: "100%",
635
+ transform: `translateY(${t.start}px)`
636
+ },
637
+ children: /* @__PURE__ */ (0, K.jsx)(Y, {
638
+ card: r,
639
+ conditionalFormatting: n
640
+ })
641
+ }, r.id);
642
+ })
643
+ });
644
+ }
645
+ function Z({ columnId: e, onAdd: t }) {
646
+ let [r, i] = h.useState(!1), [a, o] = h.useState(""), s = h.useRef(null), c = () => {
647
+ let n = a.trim();
648
+ n && (t(e, n), o("")), i(!1);
649
+ };
650
+ return r ? /* @__PURE__ */ (0, K.jsx)("div", {
651
+ className: "mt-2 space-y-2",
652
+ children: /* @__PURE__ */ (0, K.jsx)(C, {
653
+ ref: s,
654
+ value: a,
655
+ onChange: (e) => o(e.target.value),
656
+ onKeyDown: (e) => {
657
+ e.key === "Enter" ? (e.preventDefault(), c()) : e.key === "Escape" && (o(""), i(!1));
658
+ },
659
+ onBlur: c,
660
+ placeholder: "Enter card title...",
661
+ className: "text-sm",
662
+ autoFocus: !0
663
+ })
664
+ }) : /* @__PURE__ */ (0, K.jsxs)(_, {
665
+ variant: "ghost",
666
+ size: "sm",
667
+ className: "w-full mt-2 text-muted-foreground hover:text-foreground",
668
+ onClick: () => {
669
+ i(!0), setTimeout(() => s.current?.focus(), 0);
670
+ },
671
+ children: [/* @__PURE__ */ (0, K.jsx)(n, { className: "h-4 w-4 mr-1" }), "Add Card"]
672
+ });
673
+ }
674
+ function Q({ column: e, cards: t, onToggle: n, enableVirtual: i, quickAdd: a, onQuickAdd: o, conditionalFormatting: c }) {
675
+ let l = t || [], u = h.useRef(null), { setNodeRef: f } = d({
676
+ id: e.id,
677
+ data: { type: "column" }
678
+ }), m = e.limit && l.length >= e.limit, v = e.limit && l.length >= e.limit * .8;
679
+ return /* @__PURE__ */ (0, K.jsxs)("div", {
680
+ ref: f,
681
+ className: q("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all", e.collapsed ? "w-16" : "w-80", e.className),
682
+ children: [/* @__PURE__ */ (0, K.jsxs)("div", {
683
+ className: "p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",
684
+ children: [/* @__PURE__ */ (0, K.jsxs)("div", {
685
+ className: "flex items-center gap-2 flex-1 min-w-0",
686
+ children: [/* @__PURE__ */ (0, K.jsx)(_, {
687
+ variant: "ghost",
688
+ size: "sm",
689
+ className: "h-6 w-6 p-0",
690
+ onClick: () => n(!e.collapsed),
691
+ children: e.collapsed ? /* @__PURE__ */ (0, K.jsx)(T, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, K.jsx)(r, { className: "h-4 w-4" })
692
+ }), !e.collapsed && /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [/* @__PURE__ */ (0, K.jsx)("h3", {
693
+ className: "font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",
694
+ children: e.title
695
+ }), /* @__PURE__ */ (0, K.jsxs)("div", {
696
+ className: "flex items-center gap-2",
697
+ children: [
698
+ /* @__PURE__ */ (0, K.jsxs)("span", {
699
+ className: q("font-mono text-xs", m ? "text-destructive" : v ? "text-yellow-500" : "text-muted-foreground"),
700
+ children: [l.length, e.limit && ` / ${e.limit}`]
701
+ }),
702
+ m && /* @__PURE__ */ (0, K.jsx)(g, {
703
+ variant: "destructive",
704
+ className: "text-xs",
705
+ children: "Full"
706
+ }),
707
+ v && !m && /* @__PURE__ */ (0, K.jsx)(E, { className: "h-3 w-3 text-yellow-500" })
708
+ ]
709
+ })] })]
710
+ }), e.collapsed && /* @__PURE__ */ (0, K.jsxs)("div", {
711
+ className: "flex flex-col items-center gap-1",
712
+ children: [/* @__PURE__ */ (0, K.jsx)("span", {
713
+ className: "font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",
714
+ children: e.title
715
+ }), /* @__PURE__ */ (0, K.jsx)(g, {
716
+ variant: "secondary",
717
+ className: "text-xs",
718
+ children: l.length
719
+ })]
720
+ })]
721
+ }), !e.collapsed && /* @__PURE__ */ (0, K.jsxs)("div", {
722
+ ref: u,
723
+ className: "flex-1 p-4 overflow-y-auto",
724
+ style: { maxHeight: "600px" },
725
+ children: [/* @__PURE__ */ (0, K.jsx)(p, {
726
+ items: l.map((e) => e.id),
727
+ strategy: s,
728
+ children: i ? /* @__PURE__ */ (0, K.jsx)(X, {
729
+ cards: l,
730
+ parentRef: u,
731
+ conditionalFormatting: c
732
+ }) : /* @__PURE__ */ (0, K.jsx)("div", {
733
+ className: "space-y-2",
734
+ children: l.map((e) => /* @__PURE__ */ (0, K.jsx)(Y, {
735
+ card: e,
736
+ conditionalFormatting: c
737
+ }, e.id))
738
+ })
739
+ }), a && o && /* @__PURE__ */ (0, K.jsx)(Z, {
740
+ columnId: e.id,
741
+ onAdd: o
742
+ })]
743
+ })]
744
+ });
745
+ }
746
+ function $({ columns: e, onCardMove: t, onColumnToggle: n, enableVirtualScrolling: r = !1, virtualScrollThreshold: o = 50, className: s, quickAdd: d, onQuickAdd: p, conditionalFormatting: g }) {
747
+ let [_, v] = h.useState(null), y = h.useMemo(() => (e || []).map((e) => ({
748
+ ...e,
749
+ cards: e.cards || []
750
+ })), [e]), [b, x] = h.useState(y);
751
+ h.useEffect(() => {
752
+ x(y);
753
+ }, [y]);
754
+ let S = a(m(f, { activationConstraint: { distance: 8 } })), C = (e) => {
755
+ let { active: t } = e;
756
+ v(T(t.id));
757
+ }, w = (e) => {
758
+ let { active: n, over: r } = e;
759
+ if (v(null), !r) return;
760
+ let i = n.id, a = r.id;
761
+ if (i === a) return;
762
+ let o = E(i), s = E(a) || D(a);
763
+ if (!(!o || !s)) if (o.id === s.id) {
764
+ let e = [...o.cards], t = l(e, e.findIndex((e) => e.id === i), e.findIndex((e) => e.id === a));
765
+ x((e) => e.map((e) => e.id === o.id ? {
766
+ ...e,
767
+ cards: t
768
+ } : e));
769
+ } else {
770
+ let e = [...o.cards], n = [...s.cards], r = e.findIndex((e) => e.id === i), c = a === s.id ? n.length : n.findIndex((e) => e.id === a), [l] = e.splice(r, 1);
771
+ n.splice(c, 0, l), x((t) => t.map((t) => t.id === o.id ? {
772
+ ...t,
773
+ cards: e
774
+ } : t.id === s.id ? {
775
+ ...t,
776
+ cards: n
777
+ } : t)), t && t(i, o.id, s.id, c);
778
+ }
779
+ }, T = h.useCallback((e) => {
780
+ for (let t of b) {
781
+ let n = t.cards.find((t) => t.id === e);
782
+ if (n) return n;
783
+ }
784
+ return null;
785
+ }, [b]), E = h.useCallback((e) => b.find((t) => t.cards.some((t) => t.id === e)) || null, [b]), D = h.useCallback((e) => b.find((t) => t.id === e) || null, [b]), O = h.useCallback((e, t) => {
786
+ x((n) => n.map((n) => n.id === e ? {
787
+ ...n,
788
+ collapsed: t
789
+ } : n)), n?.(e, t);
790
+ }, [n]);
791
+ return /* @__PURE__ */ (0, K.jsxs)(i, {
792
+ sensors: S,
793
+ collisionDetection: c,
794
+ onDragStart: C,
795
+ onDragEnd: w,
796
+ children: [/* @__PURE__ */ (0, K.jsx)("div", {
797
+ className: q("flex gap-4 overflow-x-auto p-4", s),
798
+ children: b.map((e) => {
799
+ let t = r && e.cards.length > o;
800
+ return /* @__PURE__ */ (0, K.jsx)(Q, {
801
+ column: e,
802
+ cards: e.cards,
803
+ onToggle: (t) => O(e.id, t),
804
+ enableVirtual: t,
805
+ quickAdd: d,
806
+ onQuickAdd: p,
807
+ conditionalFormatting: g
808
+ }, e.id);
809
+ })
810
+ }), /* @__PURE__ */ (0, K.jsx)(u, { children: _ ? /* @__PURE__ */ (0, K.jsx)(Y, {
811
+ card: _,
812
+ conditionalFormatting: g
813
+ }) : null })]
814
+ });
815
+ }
816
+ //#endregion
817
+ export { $ as KanbanEnhanced, $ as default };