@aiquants/drag-drop-panels 0.2.0

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 (45) hide show
  1. package/README.md +186 -0
  2. package/dist/DragDropLayout.d.ts +31 -0
  3. package/dist/DragDropLayout.d.ts.map +1 -0
  4. package/dist/drag-drop/ColumnControlPanel.d.ts +36 -0
  5. package/dist/drag-drop/ColumnControlPanel.d.ts.map +1 -0
  6. package/dist/drag-drop/ColumnInsertPanel.d.ts +34 -0
  7. package/dist/drag-drop/ColumnInsertPanel.d.ts.map +1 -0
  8. package/dist/drag-drop/DebugComponents.d.ts +93 -0
  9. package/dist/drag-drop/DebugComponents.d.ts.map +1 -0
  10. package/dist/drag-drop/DebugControlPanel.d.ts +31 -0
  11. package/dist/drag-drop/DebugControlPanel.d.ts.map +1 -0
  12. package/dist/drag-drop/DebugOverlay.d.ts +71 -0
  13. package/dist/drag-drop/DebugOverlay.d.ts.map +1 -0
  14. package/dist/drag-drop/ResizeHandle.d.ts +30 -0
  15. package/dist/drag-drop/ResizeHandle.d.ts.map +1 -0
  16. package/dist/drag-drop/ResponsiveControl.d.ts +9 -0
  17. package/dist/drag-drop/ResponsiveControl.d.ts.map +1 -0
  18. package/dist/drag-drop/hooks/useColumnLayout.d.ts +47 -0
  19. package/dist/drag-drop/hooks/useColumnLayout.d.ts.map +1 -0
  20. package/dist/drag-drop/hooks/useCustomDragHandlers.d.ts +42 -0
  21. package/dist/drag-drop/hooks/useCustomDragHandlers.d.ts.map +1 -0
  22. package/dist/drag-drop/hooks/useDragDropColumns.d.ts +20 -0
  23. package/dist/drag-drop/hooks/useDragDropColumns.d.ts.map +1 -0
  24. package/dist/drag-drop/hooks/useDragDropState.d.ts +28 -0
  25. package/dist/drag-drop/hooks/useDragDropState.d.ts.map +1 -0
  26. package/dist/drag-drop/hooks/useMouseTracking.d.ts +23 -0
  27. package/dist/drag-drop/hooks/useMouseTracking.d.ts.map +1 -0
  28. package/dist/drag-drop/hooks/useNormalDragHandlers.d.ts +46 -0
  29. package/dist/drag-drop/hooks/useNormalDragHandlers.d.ts.map +1 -0
  30. package/dist/drag-drop/hooks/usePanelManagement.d.ts +24 -0
  31. package/dist/drag-drop/hooks/usePanelManagement.d.ts.map +1 -0
  32. package/dist/drag-drop/hooks/useResponsiveColumns.d.ts +41 -0
  33. package/dist/drag-drop/hooks/useResponsiveColumns.d.ts.map +1 -0
  34. package/dist/drag-drop/types.d.ts +184 -0
  35. package/dist/drag-drop/types.d.ts.map +1 -0
  36. package/dist/drag-drop/utils/columnIdUtils.d.ts +19 -0
  37. package/dist/drag-drop/utils/columnIdUtils.d.ts.map +1 -0
  38. package/dist/drag-drop/utils/edgeScrollUtils.d.ts +33 -0
  39. package/dist/drag-drop/utils/edgeScrollUtils.d.ts.map +1 -0
  40. package/dist/drag-drop-panels.css +1 -0
  41. package/dist/index.d.ts +34 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.es.js +2267 -0
  44. package/dist/index.umd.js +22 -0
  45. package/package.json +69 -0
@@ -0,0 +1,2267 @@
1
+ import be, { useRef as H, useState as ee, useEffect as G, useCallback as P, memo as Ne, useMemo as ve, useLayoutEffect as Ee, Fragment as Se } from "react";
2
+ import { Eye as ke, EyeOff as he, MousePointerClick as Ce, MousePointer as Oe, Minus as Te, Plus as de, Grid3X3 as Ae, RotateCcw as Me, X as $e, Smartphone as Re, Monitor as _e } from "lucide-react";
3
+ var ae = { exports: {} }, oe = {};
4
+ /**
5
+ * @license React
6
+ * react-jsx-runtime.production.js
7
+ *
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ var fe;
14
+ function We() {
15
+ if (fe) return oe;
16
+ fe = 1;
17
+ var t = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
18
+ function n(l, r, u) {
19
+ var d = null;
20
+ if (u !== void 0 && (d = "" + u), r.key !== void 0 && (d = "" + r.key), "key" in r) {
21
+ u = {};
22
+ for (var c in r)
23
+ c !== "key" && (u[c] = r[c]);
24
+ } else u = r;
25
+ return r = u.ref, {
26
+ $$typeof: t,
27
+ type: l,
28
+ key: d,
29
+ ref: r !== void 0 ? r : null,
30
+ props: u
31
+ };
32
+ }
33
+ return oe.Fragment = o, oe.jsx = n, oe.jsxs = n, oe;
34
+ }
35
+ var le = {};
36
+ /**
37
+ * @license React
38
+ * react-jsx-runtime.development.js
39
+ *
40
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ */
45
+ var xe;
46
+ function Le() {
47
+ return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() {
48
+ function t(a) {
49
+ if (a == null) return null;
50
+ if (typeof a == "function")
51
+ return a.$$typeof === v ? null : a.displayName || a.name || null;
52
+ if (typeof a == "string") return a;
53
+ switch (a) {
54
+ case m:
55
+ return "Fragment";
56
+ case F:
57
+ return "Profiler";
58
+ case O:
59
+ return "StrictMode";
60
+ case I:
61
+ return "Suspense";
62
+ case X:
63
+ return "SuspenseList";
64
+ case f:
65
+ return "Activity";
66
+ }
67
+ if (typeof a == "object")
68
+ switch (typeof a.tag == "number" && console.error(
69
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
+ ), a.$$typeof) {
71
+ case D:
72
+ return "Portal";
73
+ case B:
74
+ return a.displayName || "Context";
75
+ case U:
76
+ return (a._context.displayName || "Context") + ".Consumer";
77
+ case k:
78
+ var p = a.render;
79
+ return a = a.displayName, a || (a = p.displayName || p.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
80
+ case Q:
81
+ return p = a.displayName || null, p !== null ? p : t(a.type) || "Memo";
82
+ case h:
83
+ p = a._payload, a = a._init;
84
+ try {
85
+ return t(a(p));
86
+ } catch {
87
+ }
88
+ }
89
+ return null;
90
+ }
91
+ function o(a) {
92
+ return "" + a;
93
+ }
94
+ function n(a) {
95
+ try {
96
+ o(a);
97
+ var p = !1;
98
+ } catch {
99
+ p = !0;
100
+ }
101
+ if (p) {
102
+ p = console;
103
+ var A = p.error, q = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
104
+ return A.call(
105
+ p,
106
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
+ q
108
+ ), o(a);
109
+ }
110
+ }
111
+ function l(a) {
112
+ if (a === m) return "<>";
113
+ if (typeof a == "object" && a !== null && a.$$typeof === h)
114
+ return "<...>";
115
+ try {
116
+ var p = t(a);
117
+ return p ? "<" + p + ">" : "<...>";
118
+ } catch {
119
+ return "<...>";
120
+ }
121
+ }
122
+ function r() {
123
+ var a = N.A;
124
+ return a === null ? null : a.getOwner();
125
+ }
126
+ function u() {
127
+ return Error("react-stack-top-frame");
128
+ }
129
+ function d(a) {
130
+ if (j.call(a, "key")) {
131
+ var p = Object.getOwnPropertyDescriptor(a, "key").get;
132
+ if (p && p.isReactWarning) return !1;
133
+ }
134
+ return a.key !== void 0;
135
+ }
136
+ function c(a, p) {
137
+ function A() {
138
+ E || (E = !0, console.error(
139
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
140
+ p
141
+ ));
142
+ }
143
+ A.isReactWarning = !0, Object.defineProperty(a, "key", {
144
+ get: A,
145
+ configurable: !0
146
+ });
147
+ }
148
+ function b() {
149
+ var a = t(this.type);
150
+ return $[a] || ($[a] = !0, console.error(
151
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
152
+ )), a = this.props.ref, a !== void 0 ? a : null;
153
+ }
154
+ function C(a, p, A, q, x, z) {
155
+ var R = A.ref;
156
+ return a = {
157
+ $$typeof: y,
158
+ type: a,
159
+ key: p,
160
+ props: A,
161
+ _owner: q
162
+ }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(a, "ref", {
163
+ enumerable: !1,
164
+ get: b
165
+ }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
166
+ configurable: !1,
167
+ enumerable: !1,
168
+ writable: !0,
169
+ value: 0
170
+ }), Object.defineProperty(a, "_debugInfo", {
171
+ configurable: !1,
172
+ enumerable: !1,
173
+ writable: !0,
174
+ value: null
175
+ }), Object.defineProperty(a, "_debugStack", {
176
+ configurable: !1,
177
+ enumerable: !1,
178
+ writable: !0,
179
+ value: x
180
+ }), Object.defineProperty(a, "_debugTask", {
181
+ configurable: !1,
182
+ enumerable: !1,
183
+ writable: !0,
184
+ value: z
185
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
186
+ }
187
+ function w(a, p, A, q, x, z) {
188
+ var R = p.children;
189
+ if (R !== void 0)
190
+ if (q)
191
+ if (i(R)) {
192
+ for (q = 0; q < R.length; q++)
193
+ M(R[q]);
194
+ Object.freeze && Object.freeze(R);
195
+ } else
196
+ console.error(
197
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
+ );
199
+ else M(R);
200
+ if (j.call(p, "key")) {
201
+ R = t(a);
202
+ var Z = Object.keys(p).filter(function(W) {
203
+ return W !== "key";
204
+ });
205
+ q = 0 < Z.length ? "{key: someKey, " + Z.join(": ..., ") + ": ...}" : "{key: someKey}", V[R + q] || (Z = 0 < Z.length ? "{" + Z.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ `A props object containing a "key" prop is being spread into JSX:
207
+ let props = %s;
208
+ <%s {...props} />
209
+ React keys must be passed directly to JSX without using spread:
210
+ let props = %s;
211
+ <%s key={someKey} {...props} />`,
212
+ q,
213
+ R,
214
+ Z,
215
+ R
216
+ ), V[R + q] = !0);
217
+ }
218
+ if (R = null, A !== void 0 && (n(A), R = "" + A), d(p) && (n(p.key), R = "" + p.key), "key" in p) {
219
+ A = {};
220
+ for (var K in p)
221
+ K !== "key" && (A[K] = p[K]);
222
+ } else A = p;
223
+ return R && c(
224
+ A,
225
+ typeof a == "function" ? a.displayName || a.name || "Unknown" : a
226
+ ), C(
227
+ a,
228
+ R,
229
+ A,
230
+ r(),
231
+ x,
232
+ z
233
+ );
234
+ }
235
+ function M(a) {
236
+ T(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === h && (a._payload.status === "fulfilled" ? T(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
237
+ }
238
+ function T(a) {
239
+ return typeof a == "object" && a !== null && a.$$typeof === y;
240
+ }
241
+ var s = be, y = Symbol.for("react.transitional.element"), D = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), U = Symbol.for("react.consumer"), B = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), f = Symbol.for("react.activity"), v = Symbol.for("react.client.reference"), N = s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, i = Array.isArray, g = console.createTask ? console.createTask : function() {
242
+ return null;
243
+ };
244
+ s = {
245
+ react_stack_bottom_frame: function(a) {
246
+ return a();
247
+ }
248
+ };
249
+ var E, $ = {}, L = s.react_stack_bottom_frame.bind(
250
+ s,
251
+ u
252
+ )(), Y = g(l(u)), V = {};
253
+ le.Fragment = m, le.jsx = function(a, p, A) {
254
+ var q = 1e4 > N.recentlyCreatedOwnerStacks++;
255
+ return w(
256
+ a,
257
+ p,
258
+ A,
259
+ !1,
260
+ q ? Error("react-stack-top-frame") : L,
261
+ q ? g(l(a)) : Y
262
+ );
263
+ }, le.jsxs = function(a, p, A) {
264
+ var q = 1e4 > N.recentlyCreatedOwnerStacks++;
265
+ return w(
266
+ a,
267
+ p,
268
+ A,
269
+ !0,
270
+ q ? Error("react-stack-top-frame") : L,
271
+ q ? g(l(a)) : Y
272
+ );
273
+ };
274
+ })()), le;
275
+ }
276
+ var ge;
277
+ function ze() {
278
+ return ge || (ge = 1, process.env.NODE_ENV === "production" ? ae.exports = We() : ae.exports = Le()), ae.exports;
279
+ }
280
+ var e = ze();
281
+ const Ye = ({ config: t, panelId: o, sizeInfo: n, onSizeInfoClick: l }) => t.showPanelSizes && n ? (
282
+ // biome-ignore lint/a11y/noStaticElementInteractions: クリックイベントを持つ静的要素。デバッグ目的のため、インタラクティブ性は限定的。
283
+ // biome-ignore lint/a11y/useKeyWithClickEvents: キーボード操作はデバッグ機能では優先度が低い。
284
+ /* @__PURE__ */ e.jsxs(
285
+ "div",
286
+ {
287
+ className: "absolute top-1 right-24 z-10 cursor-default rounded-md bg-red-500/90 px-2 py-1 font-mono text-white text-xs leading-tight shadow-lg",
288
+ onClick: l,
289
+ onMouseDown: l,
290
+ onTouchStart: (r) => r instanceof TouchEvent && l(r),
291
+ onDragStart: l,
292
+ children: [
293
+ /* @__PURE__ */ e.jsxs("div", { className: "text-[10px] opacity-80", children: [
294
+ "ID:",
295
+ o
296
+ ] }),
297
+ /* @__PURE__ */ e.jsxs("div", { children: [
298
+ n.width,
299
+ "×",
300
+ n.height
301
+ ] }),
302
+ /* @__PURE__ */ e.jsxs("div", { children: [
303
+ "X:",
304
+ n.x,
305
+ " Y:",
306
+ n.y
307
+ ] }),
308
+ /* @__PURE__ */ e.jsxs("div", { className: "text-[10px] opacity-80", children: [
309
+ "min:",
310
+ n.minHeight,
311
+ " max:",
312
+ n.maxHeight
313
+ ] })
314
+ ]
315
+ }
316
+ )
317
+ ) : null, S = (t, o, ...n) => {
318
+ (t.logLevel ?? 0) >= o && console.log(...n);
319
+ }, ye = be.memo(({ index: t, columnIndex: o, isDragging: n, dragOverPosition: l, originalPosition: r, onDragEnter: u, onDragLeave: d, config: c, customDrag: b }) => {
320
+ const C = r && r.columnIndex === o && (r.panelIndex === t || r.panelIndex + 1 === t), w = !C && l?.columnIndex === o && l?.insertIndex === t, M = H(null), [T, s] = ee(null), y = n || (b?.isActive ?? !1);
321
+ return G(() => {
322
+ if (M.current) {
323
+ const D = M.current.getBoundingClientRect(), m = {
324
+ width: Math.round(D.width),
325
+ height: Math.round(D.height),
326
+ x: Math.round(D.left),
327
+ y: Math.round(D.top)
328
+ };
329
+ s(m), w && S(c, 1, `🎯 アクティブプレースホルダー ${t}-${o}:`, {
330
+ size: `${m.width}×${m.height}`,
331
+ position: `(${m.x}, ${m.y})`,
332
+ bottomRight: `(${m.x + m.width}, ${m.y + m.height})`,
333
+ center: `(${m.x + m.width / 2}, ${m.y + m.height / 2})`
334
+ });
335
+ }
336
+ }, [w, t, o, c]), S(c, 2, `プレースホルダー${t}-${o}: 表示中`, { isHighlighted: w, isDragging: n, dragOverPosition: l, shouldShow: y }), // biome-ignore lint/a11y/noStaticElementInteractions: ドラッグイベントを処理するための対話的な要素。デバッグ目的のため、キーボード操作は必須ではない。
337
+ /* @__PURE__ */ e.jsxs(
338
+ "div",
339
+ {
340
+ ref: M,
341
+ "data-placeholder-index": t,
342
+ "data-placeholder-column": o,
343
+ onDragEnter: () => u(o, t),
344
+ onDragLeave: (D) => d(D, o, t),
345
+ className: `relative flex w-full items-center justify-center transition-all duration-0 ${C ? "pointer-events-none h-0 overflow-hidden opacity-0" : y ? w ? "my-2 scale-[1.02] rounded-xl border-4 border-sky-500 border-dashed bg-sky-200 px-4 py-6 shadow-lg ring-2 ring-sky-400 ring-opacity-50" : "my-2 rounded-xl border-2 border-sky-300 border-dashed bg-sky-50/70 px-2 py-4 opacity-80" : "pointer-events-none h-0 overflow-hidden opacity-0"}`,
346
+ children: [
347
+ !C && y && c.showPlaceholderInfo && T && /* @__PURE__ */ e.jsxs("div", { className: "absolute top-1 right-1 z-10 rounded-md bg-blue-500/90 px-2 py-1 font-mono text-white text-xs leading-tight shadow-lg", children: [
348
+ /* @__PURE__ */ e.jsxs("div", { children: [
349
+ T.width,
350
+ "×",
351
+ T.height
352
+ ] }),
353
+ /* @__PURE__ */ e.jsxs("div", { children: [
354
+ "X:",
355
+ T.x,
356
+ " Y:",
357
+ T.y
358
+ ] }),
359
+ /* @__PURE__ */ e.jsx("div", { className: "text-[10px] opacity-80", children: "min:200px max:500px" }),
360
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-0.5 text-[10px] opacity-80", children: [
361
+ "PH-",
362
+ o,
363
+ "-",
364
+ t,
365
+ " ",
366
+ w ? "ACTIVE" : "IDLE"
367
+ ] })
368
+ ] }),
369
+ !C && y && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2 text-sky-600", children: [
370
+ /* @__PURE__ */ e.jsxs("svg", { className: "h-6 w-6", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
371
+ /* @__PURE__ */ e.jsx("title", { children: "パネルをここにドロップ" }),
372
+ /* @__PURE__ */ e.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 6v6m0 0v6m0-6h6m-6 0H6" })
373
+ ] }),
374
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: "パネルをここにドロップ" })
375
+ ] })
376
+ ]
377
+ }
378
+ );
379
+ });
380
+ ye.displayName = "InsertPlaceholder";
381
+ const we = ({ columnIndex: t, isDragging: o, dragOverPosition: n, children: l, config: r }) => {
382
+ const u = H(null), [d, c] = ee(null);
383
+ return G(() => {
384
+ if (u.current && o) {
385
+ const b = u.current.getBoundingClientRect(), C = n?.columnIndex === t, w = {
386
+ width: Math.round(b.width),
387
+ height: Math.round(b.height),
388
+ x: Math.round(b.left),
389
+ y: Math.round(b.top),
390
+ isActive: C
391
+ };
392
+ c(w), C && S(r, 1, `🎯 アクティブドロップゾーン ${t}:`, {
393
+ size: `${w.width}×${w.height}`,
394
+ position: `(${w.x}, ${w.y})`,
395
+ bottomRight: `(${w.x + w.width}, ${w.y + w.height})`,
396
+ center: `(${w.x + w.width / 2}, ${w.y + w.height / 2})`
397
+ });
398
+ }
399
+ }, [o, n, t, r]), /* @__PURE__ */ e.jsxs("div", { ref: u, className: "relative", children: [
400
+ l,
401
+ o && d && r.showDropZoneOutlines && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
402
+ /* @__PURE__ */ e.jsx("div", { className: `pointer-events-none absolute inset-0 rounded-lg border-2 border-dashed transition-all duration-200 ${d.isActive ? "border-red-500 bg-red-100/20 shadow-lg" : "border-gray-400 bg-gray-100/10"}` }),
403
+ /* @__PURE__ */ e.jsxs("div", { className: `absolute top-2 left-2 z-20 rounded-md px-2 py-1 font-mono text-xs leading-tight shadow-lg transition-all duration-200 ${d.isActive ? "bg-red-500/90 text-white" : "bg-gray-500/90 text-white"}`, children: [
404
+ /* @__PURE__ */ e.jsxs("div", { className: "font-bold", children: [
405
+ "DropZone-",
406
+ t
407
+ ] }),
408
+ /* @__PURE__ */ e.jsxs("div", { children: [
409
+ d.width,
410
+ "×",
411
+ d.height
412
+ ] }),
413
+ /* @__PURE__ */ e.jsxs("div", { children: [
414
+ "X:",
415
+ d.x,
416
+ " Y:",
417
+ d.y
418
+ ] }),
419
+ /* @__PURE__ */ e.jsx("div", { className: "mt-0.5 text-[10px] opacity-80", children: d.isActive ? "ACTIVE" : "IDLE" })
420
+ ] }),
421
+ /* @__PURE__ */ e.jsx(
422
+ "div",
423
+ {
424
+ className: `pointer-events-none absolute transition-all duration-200 ${d.isActive ? "opacity-100" : "opacity-50"}`,
425
+ style: {
426
+ left: `${d.width / 2 - 6}px`,
427
+ top: `${d.height / 2 - 6}px`
428
+ },
429
+ children: /* @__PURE__ */ e.jsx("div", { className: `h-3 w-3 rounded-full border-2 ${d.isActive ? "border-red-700 bg-red-500" : "border-gray-700 bg-gray-500"}` })
430
+ }
431
+ ),
432
+ d.isActive && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
433
+ /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none absolute top-0 left-0 h-2 w-2 rounded-full bg-red-500" }),
434
+ /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500" }),
435
+ /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 h-2 w-2 rounded-full bg-red-500" }),
436
+ /* @__PURE__ */ e.jsx("div", { className: "pointer-events-none absolute right-0 bottom-0 h-2 w-2 rounded-full bg-red-500" })
437
+ ] })
438
+ ] })
439
+ ] });
440
+ };
441
+ we.displayName = "DropZoneDebugOverlay";
442
+ const je = ({ columnId: t, onResizeStart: o, onResize: n, onResizeEnd: l, isResizing: r = !1, position: u = "right", className: d = "", debug: c = {} }) => {
443
+ const b = H(!1), C = H(null);
444
+ G(() => {
445
+ !r && b.current && (S(c, 1, "外部からのリサイズ解除を検出、ドラッグ状態を強制解除:", t), b.current = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.body.classList.remove("resizing-column"));
446
+ }, [r, t, c]);
447
+ const w = P(
448
+ (s) => {
449
+ s.preventDefault(), s.stopPropagation(), S(c, 2, "リサイズハンドル マウスダウン:", t), b.current = !0, o(t, s.clientX), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.body.classList.add("resizing-column");
450
+ },
451
+ [t, o, c]
452
+ );
453
+ G(() => {
454
+ const s = (D) => {
455
+ b.current && (D.preventDefault(), n(D.clientX));
456
+ }, y = () => {
457
+ b.current && (S(c, 2, "リサイズハンドル マウスアップ:", t), b.current = !1, l(), document.body.style.cursor = "", document.body.style.userSelect = "", document.body.classList.remove("resizing-column"));
458
+ };
459
+ return document.addEventListener("mousemove", s), document.addEventListener("mouseup", y), () => {
460
+ document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", y);
461
+ };
462
+ }, [t, n, l, c]);
463
+ const M = P(
464
+ (s) => {
465
+ s.preventDefault(), s.stopPropagation();
466
+ const y = s.touches[0];
467
+ S(c, 2, "リサイズハンドル タッチスタート:", t), b.current = !0, o(t, y.clientX), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.body.classList.add("resizing-column");
468
+ },
469
+ [t, o, c]
470
+ );
471
+ G(() => {
472
+ const s = (D) => {
473
+ if (!b.current) return;
474
+ D.preventDefault();
475
+ const m = D.touches[0];
476
+ n(m.clientX);
477
+ }, y = () => {
478
+ b.current && (S(c, 2, "リサイズハンドル タッチエンド:", t), b.current = !1, l(), document.body.style.cursor = "", document.body.style.userSelect = "", document.body.classList.remove("resizing-column"));
479
+ };
480
+ return document.addEventListener("touchmove", s, { passive: !1 }), document.addEventListener("touchend", y), () => {
481
+ document.removeEventListener("touchmove", s), document.removeEventListener("touchend", y);
482
+ };
483
+ }, [t, n, l, c]), G(() => () => {
484
+ b.current && (S(c, 1, "リサイズハンドルアンマウント時のクリーンアップ:", t), document.body.style.cursor = "", document.body.style.userSelect = "", document.body.classList.remove("resizing-column"));
485
+ }, [t, c]);
486
+ const T = ["resize-handle", u, r ? "resizing" : "", d].filter(Boolean).join(" ");
487
+ return (
488
+ // biome-ignore lint/a11y/useFocusableInteractive: リサイズハンドルとして機能するためインタラクティブである必要がある
489
+ // biome-ignore lint/a11y/useSemanticElements: divを使用するが、aria-roleでセマンティックな意味を提供している
490
+ /* @__PURE__ */ e.jsxs(
491
+ "div",
492
+ {
493
+ ref: C,
494
+ className: T,
495
+ onMouseDown: w,
496
+ onTouchStart: M,
497
+ "data-column-id": t,
498
+ "data-position": u,
499
+ "aria-label": `${t}のカラム幅を調整`,
500
+ role: "separator",
501
+ "aria-orientation": "vertical",
502
+ children: [
503
+ /* @__PURE__ */ e.jsx("div", { className: "resize-handle-bar" }),
504
+ c.showPanelSizes && /* @__PURE__ */ e.jsxs("div", { className: "resize-handle-debug-info", children: [
505
+ t,
506
+ r && " (resizing)"
507
+ ] })
508
+ ]
509
+ }
510
+ )
511
+ );
512
+ }, Je = ({ columnId: t, width: o, minWidth: n = 100, maxWidth: l = 800, onResizeStart: r, onResize: u, onResizeEnd: d, isResizing: c = !1, resizable: b = !0, className: C = "", debug: w = {}, children: M }) => {
513
+ const T = ["resizable-column", c ? "resizing" : "", C].filter(Boolean).join(" ");
514
+ return G(() => {
515
+ const s = document.querySelector(`[data-column-id="${t}"]`);
516
+ s && (s.style.setProperty("--column-width", `${o}px`), s.style.setProperty("--column-min-width", `${n}px`), s.style.setProperty("--column-max-width", `${l}px`));
517
+ }, [t, o, n, l]), /* @__PURE__ */ e.jsxs("div", { className: T, "data-column-id": t, "data-width": o, "data-min-width": n, "data-max-width": l, children: [
518
+ M,
519
+ b && /* @__PURE__ */ e.jsx(je, { columnId: t, onResizeStart: r, onResize: u, onResizeEnd: d, isResizing: c, position: "right", debug: w }),
520
+ w.showPanelSizes && /* @__PURE__ */ e.jsxs("div", { className: "column-debug-size", children: [
521
+ o,
522
+ "px",
523
+ c && " ↔"
524
+ ] })
525
+ ] });
526
+ }, me = Ne(
527
+ ({
528
+ index: t,
529
+ columnIndex: o,
530
+ isDragging: n,
531
+ dragOverPosition: l,
532
+ originalPosition: r,
533
+ onDragEnter: u,
534
+ onDragLeave: d,
535
+ debugConfig: c,
536
+ customDrag: b
537
+ }) => /* @__PURE__ */ e.jsx(ye, { index: t, columnIndex: o, isDragging: n, dragOverPosition: l, originalPosition: r, onDragEnter: u, onDragLeave: d, config: c, customDrag: b })
538
+ );
539
+ me.displayName = "LocalInsertPlaceholder";
540
+ const Qe = ({
541
+ columns: t,
542
+ panels: o,
543
+ columnPanels: n,
544
+ // onColumnPanelsChange,
545
+ panelVisibility: l,
546
+ onPanelVisibilityChange: r,
547
+ dragState: u,
548
+ dragOverPosition: d,
549
+ originalPanelPosition: c,
550
+ dragModes: b,
551
+ onDragStart: C,
552
+ onDragEnd: w,
553
+ onPlaceholderDragEnter: M,
554
+ onPlaceholderDragLeave: T,
555
+ onDragOverWithInsert: s,
556
+ onDropWithInsert: y,
557
+ onColumnDragLeave: D,
558
+ onPanelClick: m,
559
+ onPanelMouseDown: O,
560
+ onTouchStart: F,
561
+ onTouchMove: U,
562
+ onTouchEnd: B,
563
+ debugConfig: k,
564
+ panelSizes: I,
565
+ setPanelRef: X,
566
+ enableResize: Q = !1,
567
+ columnWidths: h,
568
+ // onColumnWidthChange,
569
+ onResizeStart: f,
570
+ onResize: v,
571
+ onResizeEnd: N,
572
+ isResizing: j = !1,
573
+ resizingColumn: i,
574
+ onPanelSizeInfoClick: g,
575
+ onToggleDragMode: E,
576
+ customDrag: $
577
+ }) => {
578
+ const L = H(k);
579
+ G(() => {
580
+ L.current = k;
581
+ }, [k]);
582
+ const Y = H({}), V = H(/* @__PURE__ */ new Map());
583
+ G(() => {
584
+ S(L.current, 1, "🎨 DragDropLayout - dragModes props changed:", {
585
+ dragModes: b,
586
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
587
+ keys: Object.keys(b),
588
+ values: Object.values(b)
589
+ });
590
+ }, [b]);
591
+ const a = ve(() => {
592
+ const x = {};
593
+ return o.forEach((z) => {
594
+ x[z.id] = z;
595
+ }), x;
596
+ }, [o]);
597
+ Ee(() => {
598
+ const x = /* @__PURE__ */ new Map();
599
+ Object.keys(Y.current).forEach((W) => {
600
+ const J = Y.current[W];
601
+ if (J) {
602
+ const re = J.getBoundingClientRect();
603
+ x.set(W, {
604
+ rect: re,
605
+ height: J.offsetHeight,
606
+ width: J.offsetWidth
607
+ });
608
+ }
609
+ });
610
+ const z = V.current, R = 300, Z = /* @__PURE__ */ new Set();
611
+ Object.values(n).forEach((W) => {
612
+ W.forEach((J) => Z.add(J));
613
+ }), new Set(z.keys()).forEach((W) => {
614
+ Z.has(W) || (S(L.current, 1, "パネル削除検出 - クリーンアップ:", W), z.delete(W), Y.current[W] && delete Y.current[W]);
615
+ }), x.forEach((W, J) => {
616
+ const re = z.get(J);
617
+ if (re) {
618
+ const _ = re.rect.left - W.rect.left, se = re.rect.top - W.rect.top;
619
+ if (_ !== 0 || se !== 0) {
620
+ S(L.current, 2, "パネル移動検出 - アニメーション開始:", J, { dx: _, dy: se });
621
+ const te = Y.current[J];
622
+ te && (te.style.transform = `translate(${_}px, ${se}px)`, te.style.transition = "none", te.classList.add("is-moving"), requestAnimationFrame(() => {
623
+ te.style.transition = `transform ${R}ms cubic-bezier(0.2, 0, 0.2, 1)`, te.style.transform = "translate(0, 0)", setTimeout(() => {
624
+ te.style.transition = "", te.style.transform = "", te.classList.remove("is-moving");
625
+ }, R);
626
+ }));
627
+ }
628
+ } else {
629
+ S(L.current, 1, "新規パネル検出 - フェードインアニメーション:", J);
630
+ const _ = Y.current[J];
631
+ _ && (_.style.opacity = "0", _.style.transition = "none", requestAnimationFrame(() => {
632
+ _.style.transition = `opacity ${R}ms ease-out`, _.style.opacity = "1", setTimeout(() => {
633
+ _.style.transition = "", _.style.opacity = "";
634
+ }, R);
635
+ }));
636
+ }
637
+ }), V.current = x;
638
+ }, [n]);
639
+ const p = (x) => {
640
+ if (!l[x]) return null;
641
+ const z = a[x];
642
+ if (!z)
643
+ return S(L.current, 1, `Panel config not found for panelId: ${x}`), null;
644
+ const R = z.component, Z = z.title, K = u.draggedPanel === x, W = b[x] || "normal";
645
+ S(L.current, 2, `🎨 renderPanel - ${x}:`, {
646
+ panelId: x,
647
+ dragMode: W,
648
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
649
+ });
650
+ const J = (_) => {
651
+ Y.current[x] = _, X && X(x, _), _ && k.showPanelSizes && requestAnimationFrame(() => {
652
+ const se = _.getBoundingClientRect(), te = window.getComputedStyle(_);
653
+ S(L.current, 1, `Panel ${x} mounted with size:`, {
654
+ width: se.width,
655
+ height: se.height,
656
+ x: se.left,
657
+ y: se.top,
658
+ minHeight: te.minHeight,
659
+ maxHeight: te.maxHeight
660
+ });
661
+ });
662
+ }, re = I[x];
663
+ return (
664
+ // biome-ignore lint/a11y/noStaticElementInteractions: クリックイベントを持つ静的要素
665
+ /* @__PURE__ */ e.jsxs(
666
+ "div",
667
+ {
668
+ ref: J,
669
+ "data-panel-id": x,
670
+ "data-dragging": K,
671
+ role: "presentation",
672
+ draggable: W === "normal",
673
+ onDragStart: (_) => W === "normal" && C(_, x),
674
+ onDragEnd: w,
675
+ onClick: (_) => m?.(_, x),
676
+ onMouseDown: (_) => O?.(_, x),
677
+ onTouchStart: (_) => F?.(_, x),
678
+ onTouchMove: U,
679
+ onTouchEnd: B,
680
+ className: `panel-draggable group relative flex min-h-[200px] max-h-[500px] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white/80 p-4 text-left shadow-lg backdrop-blur-lg transition-all duration-300 hover:-translate-y-1 hover:shadow-xl ${W === "custom" ? "select-none" : ""} ${K ? "cursor-grabbing" : "cursor-grab"}`,
681
+ children: [
682
+ /* @__PURE__ */ e.jsxs("div", { className: "group relative mb-3 flex items-center justify-between", children: [
683
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
684
+ /* @__PURE__ */ e.jsx("h3", { className: "font-semibold text-lg text-slate-700 transition-colors group-hover:text-slate-900", children: Z }),
685
+ W === "custom" && /* @__PURE__ */ e.jsx("span", { className: "rounded-md bg-orange-100 px-2 py-1 font-medium text-orange-600 text-xs", children: "Custom" })
686
+ ] }),
687
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-1 opacity-0 transition-opacity group-hover:opacity-100", children: [
688
+ /* @__PURE__ */ e.jsx(
689
+ "button",
690
+ {
691
+ type: "button",
692
+ onClick: (_) => {
693
+ _.stopPropagation(), E && E(x);
694
+ },
695
+ onKeyDown: (_) => {
696
+ (_.key === "Enter" || _.key === " ") && (_.preventDefault(), _.stopPropagation(), E && E(x));
697
+ },
698
+ tabIndex: 0,
699
+ className: `cursor-pointer rounded p-1 text-xs transition-colors ${W === "custom" ? "bg-orange-100 text-orange-600 hover:bg-orange-200" : "text-slate-400 hover:bg-slate-100 hover:text-slate-600"}`,
700
+ title: W === "custom" ? "通常ドラッグモードに戻す" : "カスタムドラッグモードに切り替え",
701
+ children: W === "custom" ? /* @__PURE__ */ e.jsx(Ce, { className: "h-4 w-4" }) : /* @__PURE__ */ e.jsx(Oe, { className: "h-4 w-4" })
702
+ }
703
+ ),
704
+ /* @__PURE__ */ e.jsx(
705
+ "button",
706
+ {
707
+ type: "button",
708
+ onClick: (_) => {
709
+ _.stopPropagation(), r({
710
+ ...l,
711
+ [x]: !1
712
+ });
713
+ },
714
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600",
715
+ title: "パネルを非表示",
716
+ children: /* @__PURE__ */ e.jsx(he, { className: "h-4 w-4" })
717
+ }
718
+ )
719
+ ] })
720
+ ] }),
721
+ /* @__PURE__ */ e.jsx("div", { className: "panel-scroll-area flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ e.jsx(R, { ...z.props || {} }) }),
722
+ /* @__PURE__ */ e.jsx(Ye, { config: k, panelId: x, sizeInfo: re, onSizeInfoClick: (_) => g?.(_, x) })
723
+ ]
724
+ },
725
+ x
726
+ )
727
+ );
728
+ }, A = (x, z) => {
729
+ const R = n[x] || [];
730
+ let Z = !1;
731
+ for (const W of R)
732
+ if (l[W]) {
733
+ Z = !0;
734
+ break;
735
+ }
736
+ const K = u.isDragging || ($?.isActive ?? !1);
737
+ return /* @__PURE__ */ e.jsx(we, { columnIndex: z, isDragging: K, dragOverPosition: d, config: k, children: /* @__PURE__ */ e.jsxs(
738
+ "section",
739
+ {
740
+ "data-drop-zone": "true",
741
+ "data-column-key": x,
742
+ "data-column-index": z,
743
+ "aria-label": `Drop zone for column ${z + 1}`,
744
+ onDragOver: (W) => s(W, z),
745
+ onDrop: (W) => y(W, x),
746
+ onDragLeave: D,
747
+ className: "relative flex h-full flex-col transition-all duration-200",
748
+ children: [
749
+ /* @__PURE__ */ e.jsx("div", { className: "placeholder-container", children: /* @__PURE__ */ e.jsx(
750
+ me,
751
+ {
752
+ index: 0,
753
+ columnIndex: z,
754
+ isDragging: K,
755
+ dragOverPosition: d,
756
+ originalPosition: c,
757
+ onDragEnter: M,
758
+ onDragLeave: T,
759
+ debugConfig: k,
760
+ customDrag: $
761
+ }
762
+ ) }),
763
+ R.map((W, J) => {
764
+ const re = l[W], _ = !re && !K;
765
+ return /* @__PURE__ */ e.jsxs(
766
+ "div",
767
+ {
768
+ className: `panel-with-placeholder ${_ ? "h-0 m-0 p-0 overflow-hidden" : ""}`,
769
+ "data-panel-hidden": _ ? "true" : void 0,
770
+ "aria-hidden": _ ? "true" : void 0,
771
+ children: [
772
+ re ? p(W) : K ? (
773
+ /* ドラッグ中のみ隠されたパネルのダミー表示 */
774
+ /* @__PURE__ */ e.jsxs("div", { className: "hidden-panel-placeholder relative h-[120px] rounded-2xl border-2 border-amber-300 border-dashed bg-gradient-to-br from-amber-50 to-orange-50 p-3 text-left shadow-lg backdrop-blur-lg", children: [
775
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex items-center space-x-2", children: [
776
+ /* @__PURE__ */ e.jsx("h3", { className: "font-semibold text-base text-amber-700", children: a[W]?.title || W }),
777
+ /* @__PURE__ */ e.jsx("span", { className: "rounded-md bg-amber-100 px-2 py-1 font-medium text-amber-600 text-xs", children: "非表示" })
778
+ ] }),
779
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center text-amber-600", children: [
780
+ /* @__PURE__ */ e.jsx(he, { className: "h-6 w-6 opacity-50 mx-auto" }),
781
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs mt-1", children: "このパネルは非表示です" })
782
+ ] }) }) })
783
+ ] })
784
+ ) : null,
785
+ /* @__PURE__ */ e.jsx(
786
+ me,
787
+ {
788
+ index: J + 1,
789
+ columnIndex: z,
790
+ isDragging: K,
791
+ dragOverPosition: d,
792
+ originalPosition: c,
793
+ onDragEnter: M,
794
+ onDragLeave: T,
795
+ debugConfig: k,
796
+ customDrag: $
797
+ }
798
+ )
799
+ ]
800
+ },
801
+ `panel-${W}`
802
+ );
803
+ }),
804
+ !Z && !K && /* @__PURE__ */ e.jsx("div", { className: "flex-shrink-0 rounded-xl border-2 border-slate-200 border-dashed bg-white/30 p-8 textcenter text-slate-400 transition-all duration-200", children: /* @__PURE__ */ e.jsx("div", { className: "text-sm", children: "このエリアは空です" }) })
805
+ ]
806
+ }
807
+ ) });
808
+ }, q = Object.keys(l).filter((x) => !l[x]);
809
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col", children: [
810
+ q.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border-slate-200 border-b bg-white/70 px-4 py-2 backdrop-blur-lg", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap gap-2", children: [
811
+ /* @__PURE__ */ e.jsx("span", { className: "mr-2 text-slate-600 text-sm", children: "非表示のパネル:" }),
812
+ q.map((x) => {
813
+ const R = a[x]?.title || x;
814
+ return /* @__PURE__ */ e.jsxs(
815
+ "button",
816
+ {
817
+ type: "button",
818
+ onClick: () => r({
819
+ ...l,
820
+ [x]: !0
821
+ }),
822
+ className: "flex items-center space-x-1 rounded-lg border border-sky-300 bg-gradient-to-r from-sky-500 to-indigo-500 px-3 py-1 text-sm text-white shadow-md transition-all duration-200 hover:from-sky-600 hover:to-indigo-600 hover:shadow-lg",
823
+ children: [
824
+ /* @__PURE__ */ e.jsx(ke, { className: "h-3 w-3" }),
825
+ /* @__PURE__ */ e.jsx("span", { children: R })
826
+ ]
827
+ },
828
+ x
829
+ );
830
+ })
831
+ ] }) }),
832
+ /* @__PURE__ */ e.jsx("main", { className: "max-w-full flex-1 overflow-auto px-4 py-6 sm:px-6 no-scrollbar", children: /* @__PURE__ */ e.jsx("div", { className: "relative flex h-full items-start gap-6 pr-4", children: t.map((x, z) => {
833
+ const R = h?.[x.id] || x.initialWidth || 350, Z = Q && (x.resizable ?? !0);
834
+ return /* @__PURE__ */ e.jsx(Se, { children: /* @__PURE__ */ e.jsxs(
835
+ "div",
836
+ {
837
+ className: `column relative ${x.className || ""} ${Q ? "resize-enabled-column" : "auto-width-column"} ${j && i === x.id ? "column-resizing-active" : ""}`,
838
+ "data-column": z,
839
+ "data-column-id": x.id,
840
+ "data-min-width": x.minWidth || 350,
841
+ "data-max-width": x.maxWidth,
842
+ "data-column-width": Q ? R : void 0,
843
+ ...Q && {
844
+ style: { "--column-width": `${R}px` }
845
+ },
846
+ children: [
847
+ A(x.key, z),
848
+ Z && f && v && N && /* @__PURE__ */ e.jsx(je, { columnId: x.id, onResizeStart: f, onResize: v, onResizeEnd: N, isResizing: j && i === x.id, position: "right", debug: k })
849
+ ]
850
+ }
851
+ ) }, x.id);
852
+ }) }) })
853
+ ] });
854
+ }, Ke = ({
855
+ columnCount: t,
856
+ onColumnCountChange: o,
857
+ onAutoBalance: n,
858
+ onResetWidths: l,
859
+ minColumns: r = 2,
860
+ maxColumns: u = 6,
861
+ isResizing: d = !1,
862
+ isResponsiveMode: c = !1,
863
+ responsiveColumnCount: b
864
+ }) => {
865
+ const C = t > r && !c, w = t < u && !c;
866
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3 rounded-lg border border-slate-200 bg-white/80 px-4 py-2 shadow-sm backdrop-blur-lg", children: [
867
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
868
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-700 text-sm", children: "カラム数:" }),
869
+ /* @__PURE__ */ e.jsx(
870
+ "button",
871
+ {
872
+ type: "button",
873
+ onClick: () => C && o(t - 1),
874
+ disabled: !C || d,
875
+ className: `rounded p-1 text-xs transition-colors ${C && !d ? "border border-slate-300 text-slate-600 hover:border-red-300 hover:bg-red-50 hover:text-red-600" : "cursor-not-allowed border border-slate-200 bg-slate-50 text-slate-300"}`,
876
+ title: c ? "レスポンシブモード中:カラム数は自動調整されます" : `カラムを削除 (最小: ${r}列)`,
877
+ children: /* @__PURE__ */ e.jsx(Te, { className: "h-3 w-3" })
878
+ }
879
+ ),
880
+ /* @__PURE__ */ e.jsxs("div", { className: `min-w-[2rem] rounded border px-3 py-1 text-center font-mono text-sm ${c ? "border-blue-300 bg-blue-50 text-blue-700" : "border-slate-300 bg-slate-100 text-slate-700"}`, children: [
881
+ c ? b ?? t : t,
882
+ c && /* @__PURE__ */ e.jsx("span", { className: "ml-1 text-xs", children: "自動" })
883
+ ] }),
884
+ /* @__PURE__ */ e.jsx(
885
+ "button",
886
+ {
887
+ type: "button",
888
+ onClick: () => w && o(t + 1),
889
+ disabled: !w || d,
890
+ className: `rounded p-1 text-xs transition-colors ${w && !d ? "border border-slate-300 text-slate-600 hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600" : "cursor-not-allowed border border-slate-200 bg-slate-50 text-slate-300"}`,
891
+ title: c ? "レスポンシブモード中:カラム数は自動調整されます" : `カラムを追加 (最大: ${u}列)`,
892
+ children: /* @__PURE__ */ e.jsx(de, { className: "h-3 w-3" })
893
+ }
894
+ )
895
+ ] }),
896
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 w-px bg-slate-300" }),
897
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
898
+ /* @__PURE__ */ e.jsxs(
899
+ "button",
900
+ {
901
+ type: "button",
902
+ onClick: n,
903
+ disabled: d,
904
+ className: `flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors ${d ? "cursor-not-allowed border border-slate-200 bg-slate-50 text-slate-300" : "border border-slate-300 text-slate-600 hover:border-green-300 hover:bg-green-50 hover:text-green-600"}`,
905
+ title: "パネルを全カラムに均等分散",
906
+ children: [
907
+ /* @__PURE__ */ e.jsx(Ae, { className: "h-3 w-3" }),
908
+ /* @__PURE__ */ e.jsx("span", { children: "バランス" })
909
+ ]
910
+ }
911
+ ),
912
+ /* @__PURE__ */ e.jsxs(
913
+ "button",
914
+ {
915
+ type: "button",
916
+ onClick: l,
917
+ disabled: d,
918
+ className: `flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors ${d ? "cursor-not-allowed border border-slate-200 bg-slate-50 text-slate-300" : "border border-slate-300 text-slate-600 hover:border-orange-300 hover:bg-orange-50 hover:text-orange-600"}`,
919
+ title: "カラム幅を初期値にリセット",
920
+ children: [
921
+ /* @__PURE__ */ e.jsx(Me, { className: "h-3 w-3" }),
922
+ /* @__PURE__ */ e.jsx("span", { children: "幅リセット" })
923
+ ]
924
+ }
925
+ )
926
+ ] }),
927
+ d && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-blue-600 text-xs", children: [
928
+ /* @__PURE__ */ e.jsx("div", { className: "h-2 w-2 animate-pulse rounded-full bg-blue-500" }),
929
+ /* @__PURE__ */ e.jsx("span", { children: "リサイズ中..." })
930
+ ] })
931
+ ] });
932
+ }, et = ({
933
+ columnCount: t,
934
+ onInsertColumn: o,
935
+ onDeleteColumn: n,
936
+ minColumns: l = 1,
937
+ maxColumns: r = 6,
938
+ isResizing: u = !1,
939
+ disabled: d = !1
940
+ }) => {
941
+ const c = t < r && !d, b = t > l && !d;
942
+ return /* @__PURE__ */ e.jsxs("div", { className: `flex items-center justify-center gap-1 rounded-lg border border-slate-200 px-4 py-2 shadow-sm backdrop-blur-lg ${d ? "bg-slate-100/80 opacity-60" : "bg-white/80"}`, children: [
943
+ d && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2 text-slate-500 text-xs", children: /* @__PURE__ */ e.jsx("span", { children: "レスポンシブモード有効中:カラム数は自動調整されます" }) }),
944
+ !d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
945
+ /* @__PURE__ */ e.jsx(
946
+ "button",
947
+ {
948
+ type: "button",
949
+ onClick: () => c && o(0),
950
+ disabled: !c || u,
951
+ className: `flex h-8 w-8 items-center justify-center rounded border-2 border-dashed text-xs transition-colors ${c && !u ? "border-blue-300 text-blue-600 hover:border-blue-500 hover:bg-blue-50" : "cursor-not-allowed border-slate-200 text-slate-300"}`,
952
+ title: "この位置に新しいカラムを挿入",
953
+ children: /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4" })
954
+ }
955
+ ),
956
+ Array.from({ length: t }, (C, w) => (
957
+ // biome-ignore lint/suspicious/noArrayIndexKey: 表示目的の単純なリスト
958
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
959
+ /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-8 w-12 items-center justify-center rounded border border-slate-300 bg-slate-100", children: [
960
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs font-medium text-slate-700", children: w + 1 }),
961
+ b && !u && /* @__PURE__ */ e.jsx(
962
+ "button",
963
+ {
964
+ type: "button",
965
+ onClick: () => n(w),
966
+ className: "absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full border border-red-300 bg-red-100 text-red-600 hover:bg-red-200",
967
+ title: `カラム ${w + 1} を削除`,
968
+ children: /* @__PURE__ */ e.jsx($e, { className: "h-2.5 w-2.5" })
969
+ }
970
+ )
971
+ ] }),
972
+ /* @__PURE__ */ e.jsx(
973
+ "button",
974
+ {
975
+ type: "button",
976
+ onClick: () => c && o(w + 1),
977
+ disabled: !c || u,
978
+ className: `flex h-8 w-8 items-center justify-center rounded border-2 border-dashed text-xs transition-colors ${c && !u ? "border-blue-300 text-blue-600 hover:border-blue-500 hover:bg-blue-50" : "cursor-not-allowed border-slate-200 text-slate-300"}`,
979
+ title: "この位置に新しいカラムを挿入",
980
+ children: /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4" })
981
+ }
982
+ )
983
+ ] }, `column-${w}`)
984
+ ))
985
+ ] })
986
+ ] });
987
+ }, tt = ({ config: t, onConfigChange: o, isVisible: n, onToggleVisibility: l }) => n ? /* @__PURE__ */ e.jsxs("div", { className: "fixed right-4 bottom-4 z-50 max-w-sm rounded-lg border border-gray-300 bg-white p-4 shadow-xl", children: [
988
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center justify-between", children: [
989
+ /* @__PURE__ */ e.jsx("h3", { className: "font-bold text-gray-800 text-sm", children: "🛠️ デバッグ設定" }),
990
+ /* @__PURE__ */ e.jsx("button", { type: "button", onClick: l, className: "text-gray-500 text-lg hover:text-gray-700", title: "閉じる", children: "✕" })
991
+ ] }),
992
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
993
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center space-x-2 text-sm", children: [
994
+ /* @__PURE__ */ e.jsx(
995
+ "input",
996
+ {
997
+ type: "checkbox",
998
+ checked: t.showDebugPanel ?? !1,
999
+ onChange: (r) => o({
1000
+ ...t,
1001
+ showDebugPanel: r.target.checked
1002
+ }),
1003
+ className: "rounded"
1004
+ }
1005
+ ),
1006
+ /* @__PURE__ */ e.jsx("span", { children: "デバッグパネル表示" })
1007
+ ] }),
1008
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center space-x-2 text-sm", children: [
1009
+ /* @__PURE__ */ e.jsx(
1010
+ "input",
1011
+ {
1012
+ type: "checkbox",
1013
+ checked: t.showMousePosition ?? !1,
1014
+ onChange: (r) => o({
1015
+ ...t,
1016
+ showMousePosition: r.target.checked
1017
+ }),
1018
+ className: "rounded"
1019
+ }
1020
+ ),
1021
+ /* @__PURE__ */ e.jsx("span", { children: "マウス位置表示" })
1022
+ ] }),
1023
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center space-x-2 text-sm", children: [
1024
+ /* @__PURE__ */ e.jsx(
1025
+ "input",
1026
+ {
1027
+ type: "checkbox",
1028
+ checked: t.showPanelSizes ?? !1,
1029
+ onChange: (r) => o({
1030
+ ...t,
1031
+ showPanelSizes: r.target.checked
1032
+ }),
1033
+ className: "rounded"
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ e.jsx("span", { children: "パネルサイズ情報" })
1037
+ ] }),
1038
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center space-x-2 text-sm", children: [
1039
+ /* @__PURE__ */ e.jsx(
1040
+ "input",
1041
+ {
1042
+ type: "checkbox",
1043
+ checked: t.showPlaceholderInfo ?? !1,
1044
+ onChange: (r) => o({
1045
+ ...t,
1046
+ showPlaceholderInfo: r.target.checked
1047
+ }),
1048
+ className: "rounded"
1049
+ }
1050
+ ),
1051
+ /* @__PURE__ */ e.jsx("span", { children: "プレースホルダー詳細" })
1052
+ ] }),
1053
+ /* @__PURE__ */ e.jsxs("label", { className: "flex items-center space-x-2 text-sm", children: [
1054
+ /* @__PURE__ */ e.jsx(
1055
+ "input",
1056
+ {
1057
+ type: "checkbox",
1058
+ checked: t.showDropZoneOutlines ?? !1,
1059
+ onChange: (r) => o({
1060
+ ...t,
1061
+ showDropZoneOutlines: r.target.checked
1062
+ }),
1063
+ className: "rounded"
1064
+ }
1065
+ ),
1066
+ /* @__PURE__ */ e.jsx("span", { children: "ドロップゾーン境界" })
1067
+ ] }),
1068
+ /* @__PURE__ */ e.jsxs("div", { className: "border-gray-200 border-t pt-2", children: [
1069
+ /* @__PURE__ */ e.jsxs("label", { htmlFor: "log-level-slider", className: "mb-1 block text-sm", children: [
1070
+ "ログレベル: ",
1071
+ t.logLevel ?? 0
1072
+ ] }),
1073
+ /* @__PURE__ */ e.jsx(
1074
+ "input",
1075
+ {
1076
+ id: "log-level-slider",
1077
+ type: "range",
1078
+ min: "0",
1079
+ max: "2",
1080
+ value: t.logLevel ?? 0,
1081
+ onChange: (r) => o({
1082
+ ...t,
1083
+ logLevel: parseInt(r.target.value)
1084
+ }),
1085
+ className: "w-full",
1086
+ "aria-label": "ログレベル設定"
1087
+ }
1088
+ ),
1089
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-1 flex justify-between text-gray-500 text-xs", children: [
1090
+ /* @__PURE__ */ e.jsx("span", { children: "無効" }),
1091
+ /* @__PURE__ */ e.jsx("span", { children: "基本" }),
1092
+ /* @__PURE__ */ e.jsx("span", { children: "詳細" })
1093
+ ] })
1094
+ ] }),
1095
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2 pt-2", children: [
1096
+ /* @__PURE__ */ e.jsx(
1097
+ "button",
1098
+ {
1099
+ type: "button",
1100
+ onClick: () => o({
1101
+ showDebugPanel: !0,
1102
+ showMousePosition: !0,
1103
+ showPanelSizes: !0,
1104
+ showPlaceholderInfo: !0,
1105
+ showDropZoneOutlines: !0,
1106
+ logLevel: 2
1107
+ }),
1108
+ className: "w-full rounded bg-blue-100 px-2 py-1 text-blue-700 text-sm transition-colors hover:bg-blue-200",
1109
+ children: "すべて有効"
1110
+ }
1111
+ ),
1112
+ /* @__PURE__ */ e.jsx(
1113
+ "button",
1114
+ {
1115
+ type: "button",
1116
+ onClick: () => o({
1117
+ showDebugPanel: !1,
1118
+ showMousePosition: !1,
1119
+ showPanelSizes: !1,
1120
+ showPlaceholderInfo: !1,
1121
+ showDropZoneOutlines: !1,
1122
+ logLevel: 0
1123
+ }),
1124
+ className: "w-full rounded bg-gray-100 px-2 py-1 text-gray-700 text-sm transition-colors hover:bg-gray-200",
1125
+ children: "すべて無効"
1126
+ }
1127
+ )
1128
+ ] })
1129
+ ] })
1130
+ ] }) : /* @__PURE__ */ e.jsx("button", { type: "button", onClick: l, className: "fixed right-4 bottom-4 z-50 rounded-lg bg-gray-800 p-2 text-white shadow-lg transition-colors hover:bg-gray-700", title: "デバッグ設定を開く", children: "🛠️" }), nt = ({ isResponsiveMode: t, responsiveColumnCount: o, currentColumnCount: n, screenWidth: l, onToggleResponsive: r }) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 rounded-lg border border-slate-300 bg-white/90 px-3 py-1", children: [
1131
+ /* @__PURE__ */ e.jsxs(
1132
+ "button",
1133
+ {
1134
+ type: "button",
1135
+ onClick: r,
1136
+ className: `flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors ${t ? "border border-blue-300 bg-blue-100 text-blue-700" : "border border-slate-300 text-slate-600 hover:bg-blue-50 hover:text-blue-600"}`,
1137
+ title: t ? "レスポンシブモードを無効化" : "レスポンシブモードを有効化",
1138
+ children: [
1139
+ t ? /* @__PURE__ */ e.jsx(Re, { className: "h-3 w-3" }) : /* @__PURE__ */ e.jsx(_e, { className: "h-3 w-3" }),
1140
+ /* @__PURE__ */ e.jsx("span", { children: t ? "レスポンシブ" : "固定" })
1141
+ ]
1142
+ }
1143
+ ),
1144
+ t && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-slate-600 text-xs", children: [
1145
+ /* @__PURE__ */ e.jsxs("span", { className: "font-mono", children: [
1146
+ l,
1147
+ "px"
1148
+ ] }),
1149
+ /* @__PURE__ */ e.jsx("span", { children: "→" }),
1150
+ /* @__PURE__ */ e.jsxs("span", { className: "font-semibold text-blue-600", children: [
1151
+ o,
1152
+ "列"
1153
+ ] }),
1154
+ o !== n && /* @__PURE__ */ e.jsx("span", { className: "text-orange-600", children: "(変更予定)" })
1155
+ ] })
1156
+ ] }), ne = {
1157
+ prefix: "column",
1158
+ startIndex: 1,
1159
+ separator: "_"
1160
+ }, ie = (t, o = ne) => {
1161
+ const { prefix: n, startIndex: l, separator: r } = o, u = t + l;
1162
+ return `${n}${r}${u}`;
1163
+ }, Pe = (t, o = ne) => Array.from({ length: t }, (n, l) => ie(l, o)), ce = (t, o = ne) => {
1164
+ const { prefix: n, startIndex: l, separator: r } = o, u = `${n}${r}`;
1165
+ if (!t.startsWith(u))
1166
+ return null;
1167
+ const d = t.slice(u.length), c = parseInt(d, 10);
1168
+ return Number.isNaN(c) || c < l ? null : c - l;
1169
+ }, rt = (t, o = ne) => ce(t, o) !== null, st = (t, o = ne) => {
1170
+ const n = t.map((l) => ce(l, o)).filter((l) => l !== null).sort((l, r) => l - r);
1171
+ for (let l = 0; l < n.length; l++)
1172
+ if (n[l] !== l)
1173
+ return ie(l, o);
1174
+ return ie(n.length, o);
1175
+ }, Xe = (t, o = ne) => t.sort((n, l) => {
1176
+ const r = ce(n, o) ?? -1, u = ce(l, o) ?? -1;
1177
+ return r - u;
1178
+ }), ot = (t, o = ne) => {
1179
+ const n = {};
1180
+ return t.forEach((l, r) => {
1181
+ const u = ie(r, o);
1182
+ n[l] = u;
1183
+ }), n;
1184
+ }, Fe = (t, o, n = ne) => {
1185
+ const l = [];
1186
+ Object.values(t).forEach((d) => {
1187
+ l.push(...d);
1188
+ });
1189
+ const r = {}, u = Pe(o, n);
1190
+ return u.forEach((d) => {
1191
+ r[d] = [];
1192
+ }), l.forEach((d, c) => {
1193
+ const b = c % o, C = u[b];
1194
+ r[C].push(d);
1195
+ }), r;
1196
+ }, lt = ({ initialColumns: t, initialPanels: o, debug: n = {}, onLayoutChange: l }) => {
1197
+ const [r, u] = ee(() => {
1198
+ const h = {};
1199
+ for (const f of t)
1200
+ h[f.id] = f.initialWidth || 400;
1201
+ return {
1202
+ columns: t,
1203
+ columnWidths: h,
1204
+ isResizing: !1,
1205
+ resizingColumn: null,
1206
+ columnPanels: o,
1207
+ showInsertPlaceholders: !1
1208
+ };
1209
+ }), d = H(0), c = H(0);
1210
+ G(() => {
1211
+ l?.(r);
1212
+ }, [r, l]);
1213
+ const b = P(
1214
+ (h, f) => {
1215
+ S(n, 1, "カラム追加:", h.id, "at position:", f), u((v) => {
1216
+ const N = [...v.columns], j = f ?? N.length;
1217
+ N.splice(j, 0, h);
1218
+ const i = {
1219
+ ...v.columnWidths,
1220
+ [h.id]: h.initialWidth || 400
1221
+ }, g = {
1222
+ ...v.columnPanels,
1223
+ [h.id]: []
1224
+ };
1225
+ return {
1226
+ ...v,
1227
+ columns: N,
1228
+ columnWidths: i,
1229
+ columnPanels: g
1230
+ };
1231
+ });
1232
+ },
1233
+ [n]
1234
+ ), C = P(
1235
+ (h) => {
1236
+ S(n, 1, "カラム削除:", h), u((f) => {
1237
+ const v = f.columnPanels[h] || [], N = f.columns.filter((E) => E.id !== h);
1238
+ if (N.length === 0)
1239
+ return S(n, 1, "警告: 最後のカラムを削除しようとしています"), f;
1240
+ const j = N[0].id, i = { ...f.columnPanels };
1241
+ v.length > 0 && (i[j] = [...i[j], ...v]), delete i[h];
1242
+ const g = { ...f.columnWidths };
1243
+ return delete g[h], {
1244
+ ...f,
1245
+ columns: N,
1246
+ columnWidths: g,
1247
+ columnPanels: i
1248
+ };
1249
+ });
1250
+ },
1251
+ [n]
1252
+ ), w = P(
1253
+ (h, f) => {
1254
+ S(n, 1, "カラム移動:", h, "->", f), u((v) => {
1255
+ const N = [...v.columns], [j] = N.splice(h, 1);
1256
+ return N.splice(f, 0, j), {
1257
+ ...v,
1258
+ columns: N
1259
+ };
1260
+ });
1261
+ },
1262
+ [n]
1263
+ ), M = P(
1264
+ (h, f) => {
1265
+ S(n, 2, "リサイズ開始:", h, "at X:", f), d.current = f, c.current = r.columnWidths[h] || 300, u((v) => ({
1266
+ ...v,
1267
+ isResizing: !0,
1268
+ resizingColumn: h
1269
+ }));
1270
+ },
1271
+ [n, r.columnWidths]
1272
+ ), T = P(
1273
+ (h) => {
1274
+ const { resizingColumn: f, isResizing: v } = r;
1275
+ if (!(v && f)) return;
1276
+ const N = h - d.current, j = Math.max(100, Math.min(800, c.current + N));
1277
+ S(n, 2, "リサイズ中:", f, "new width:", j), u((i) => ({
1278
+ ...i,
1279
+ columnWidths: {
1280
+ ...i.columnWidths,
1281
+ [f]: j
1282
+ }
1283
+ }));
1284
+ },
1285
+ [n, r]
1286
+ ), s = P(() => {
1287
+ S(n, 2, "リサイズ終了"), u((h) => ({
1288
+ ...h,
1289
+ isResizing: !1,
1290
+ resizingColumn: null
1291
+ }));
1292
+ }, [n]), y = P(
1293
+ (h, f) => {
1294
+ S(n, 2, "カラム幅設定:", h, f), u((v) => ({
1295
+ ...v,
1296
+ columnWidths: {
1297
+ ...v.columnWidths,
1298
+ [h]: Math.max(100, Math.min(800, f))
1299
+ }
1300
+ }));
1301
+ },
1302
+ [n]
1303
+ ), D = P(() => {
1304
+ S(n, 1, "カラム幅リセット"), u((h) => {
1305
+ const f = {};
1306
+ for (const v of h.columns)
1307
+ f[v.id] = v.initialWidth || 400;
1308
+ return {
1309
+ ...h,
1310
+ columnWidths: f
1311
+ };
1312
+ });
1313
+ }, [n]), m = P(
1314
+ (h, f, v, N) => {
1315
+ S(n, 1, "パネル移動:", h, "from", f, "to", v, "at", N), u((j) => {
1316
+ const i = { ...j.columnPanels };
1317
+ if (f in i && (i[f] = i[f].filter((g) => g !== h)), v in i) {
1318
+ const g = [...i[v]];
1319
+ g.splice(N, 0, h), i[v] = g;
1320
+ }
1321
+ return {
1322
+ ...j,
1323
+ columnPanels: i
1324
+ };
1325
+ });
1326
+ },
1327
+ [n]
1328
+ ), O = P(
1329
+ (h, f, v) => {
1330
+ S(n, 1, "パネル追加:", h, "to column:", f), u((N) => {
1331
+ const j = { ...N.columnPanels };
1332
+ f in j || (j[f] = []);
1333
+ const i = [...j[f]], g = v ?? i.length;
1334
+ return i.splice(g, 0, h), j[f] = i, {
1335
+ ...N,
1336
+ columnPanels: j
1337
+ };
1338
+ });
1339
+ },
1340
+ [n]
1341
+ ), F = P(
1342
+ (h) => {
1343
+ S(n, 1, "パネル削除:", h), u((f) => {
1344
+ const v = {};
1345
+ for (const [N, j] of Object.entries(f.columnPanels))
1346
+ v[N] = j.filter((i) => i !== h);
1347
+ return {
1348
+ ...f,
1349
+ columnPanels: v
1350
+ };
1351
+ });
1352
+ },
1353
+ [n]
1354
+ ), U = P(
1355
+ (h) => {
1356
+ S(n, 1, "カラム数更新:", h), u((f) => {
1357
+ const v = f.columns.length;
1358
+ if (h === v) return f;
1359
+ const N = Fe(
1360
+ f.columnPanels,
1361
+ h,
1362
+ ne
1363
+ ), j = Pe(h, ne), i = f.isResizing && f.resizingColumn && !j.includes(f.resizingColumn);
1364
+ i && S(n, 1, "リサイズ中のカラムが削除されるためリサイズを強制終了:", f.resizingColumn);
1365
+ const g = j.map((Y, V) => ({
1366
+ id: Y,
1367
+ title: `カラム ${V + 1}`,
1368
+ minWidth: 350,
1369
+ maxWidth: 800,
1370
+ initialWidth: 400,
1371
+ resizable: !(V === 1 && h === 3)
1372
+ })), E = {};
1373
+ if (Object.entries(f.columnWidths).some(([, Y]) => Y !== 400))
1374
+ j.forEach((Y) => {
1375
+ const V = f.columnWidths[Y];
1376
+ V && V !== 400 ? E[Y] = V : E[Y] = 400;
1377
+ });
1378
+ else {
1379
+ const Y = v > h ? Object.values(f.columnWidths).reduce((a, p) => a + p, 0) : h * 400, V = Math.max(Y / h, 350);
1380
+ j.forEach((a) => {
1381
+ E[a] = V;
1382
+ });
1383
+ }
1384
+ return {
1385
+ ...f,
1386
+ columns: g,
1387
+ columnPanels: N,
1388
+ columnWidths: E,
1389
+ isResizing: i ? !1 : f.isResizing,
1390
+ resizingColumn: i ? null : f.resizingColumn
1391
+ };
1392
+ });
1393
+ },
1394
+ [n]
1395
+ ), B = P(() => {
1396
+ S(n, 1, "カラム自動バランス調整"), u((h) => {
1397
+ const f = [];
1398
+ for (const j of Object.keys(h.columnPanels))
1399
+ for (const i of h.columnPanels[j])
1400
+ f.push(i);
1401
+ const v = {};
1402
+ for (const j of h.columns)
1403
+ v[j.id] = [];
1404
+ let N = 0;
1405
+ for (const j of f) {
1406
+ const i = h.columns[N % h.columns.length].id;
1407
+ v[i].push(j), N += 1;
1408
+ }
1409
+ return {
1410
+ ...h,
1411
+ columnPanels: v
1412
+ };
1413
+ });
1414
+ }, [n]), k = P(
1415
+ (h) => r.columns.find((f) => f.id === h),
1416
+ [r.columns]
1417
+ ), I = P(() => {
1418
+ let h = 0;
1419
+ for (const f of Object.values(r.columnWidths))
1420
+ h += f;
1421
+ return h;
1422
+ }, [r.columnWidths]), X = P((h) => document.querySelector(`[data-column-id="${h}"]`), []), Q = P((h) => {
1423
+ u((f) => ({
1424
+ ...f,
1425
+ showInsertPlaceholders: h
1426
+ }));
1427
+ }, []);
1428
+ return {
1429
+ layoutState: r,
1430
+ addColumn: b,
1431
+ removeColumn: C,
1432
+ moveColumn: w,
1433
+ startResize: M,
1434
+ handleResize: T,
1435
+ endResize: s,
1436
+ setColumnWidth: y,
1437
+ resetColumnWidths: D,
1438
+ movePanel: m,
1439
+ addPanel: O,
1440
+ removePanel: F,
1441
+ updateColumnCount: U,
1442
+ autoBalanceColumns: B,
1443
+ getColumnById: k,
1444
+ getTotalWidth: I,
1445
+ getColumnElement: X,
1446
+ setShowInsertPlaceholders: Q
1447
+ };
1448
+ }, ue = {
1449
+ triggerDistance: 80,
1450
+ scrollSpeed: 5,
1451
+ maxScrollSpeed: 20
1452
+ }, pe = (t, o, n = ue, l) => {
1453
+ const { triggerDistance: r, scrollSpeed: u, maxScrollSpeed: d } = n;
1454
+ let c;
1455
+ l ? c = l.getBoundingClientRect() : c = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
1456
+ const { left: b, top: C, right: w, bottom: M } = c;
1457
+ let T = 0, s = 0;
1458
+ if (t >= b && t <= w && o >= C && o <= M) {
1459
+ if (t < b + r) {
1460
+ const y = Math.max(0, (b + r - t) / r);
1461
+ T = -Math.min(d, u + y * (d - u));
1462
+ } else if (t > w - r) {
1463
+ const y = Math.max(0, (t - (w - r)) / r);
1464
+ T = Math.min(d, u + y * (d - u));
1465
+ }
1466
+ if (o < C + r) {
1467
+ const y = Math.max(0, (C + r - o) / r);
1468
+ s = -Math.min(d, u + y * (d - u));
1469
+ } else if (o > M - r) {
1470
+ const y = Math.max(0, (o - (M - r)) / r);
1471
+ s = Math.min(d, u + y * (d - u));
1472
+ }
1473
+ }
1474
+ return { x: T, y: s };
1475
+ }, He = (t, o) => {
1476
+ (t.x !== 0 || t.y !== 0) && (o ? o.scrollBy(t.x, t.y) : window.scrollBy(t.x, t.y));
1477
+ };
1478
+ class De {
1479
+ constructor(o = ue, n) {
1480
+ this.intervalId = null, this.isActive = !1, this.config = o, this.scrollElement = n;
1481
+ }
1482
+ setScrollElement(o) {
1483
+ this.scrollElement = o;
1484
+ }
1485
+ start(o, n) {
1486
+ this.isActive || (this.isActive = !0, this.intervalId = window.setInterval(() => {
1487
+ const l = pe(o, n, this.config, this.scrollElement);
1488
+ He(l, this.scrollElement);
1489
+ }, 16));
1490
+ }
1491
+ update(o, n) {
1492
+ const l = pe(o, n, this.config, this.scrollElement);
1493
+ (l.x !== 0 || l.y !== 0) && !this.isActive ? this.start(o, n) : l.x === 0 && l.y === 0 && this.isActive && this.stop();
1494
+ }
1495
+ stop() {
1496
+ this.intervalId !== null && (clearInterval(this.intervalId), this.intervalId = null), this.isActive = !1;
1497
+ }
1498
+ isScrolling() {
1499
+ return this.isActive;
1500
+ }
1501
+ updateConfig(o) {
1502
+ this.config = o;
1503
+ }
1504
+ }
1505
+ const qe = ({
1506
+ debugConfig: t,
1507
+ dragState: o,
1508
+ customDrag: n,
1509
+ clickState: l,
1510
+ dragModes: r,
1511
+ isMouseDown: u,
1512
+ dragOverPosition: d,
1513
+ setCustomDrag: c,
1514
+ setDragState: b,
1515
+ setDragOverPosition: C,
1516
+ setOriginalPanelPosition: w,
1517
+ setClickState: M,
1518
+ setIsMouseDown: T,
1519
+ findPanelPosition: s,
1520
+ performPanelMove: y,
1521
+ showMousePosition: D,
1522
+ updateMousePosition: m,
1523
+ recordMouseDown: O,
1524
+ recordClickPosition: F,
1525
+ isVirtualClick: U,
1526
+ calculateMoveDistance: B,
1527
+ clearMouseTracking: k,
1528
+ resetDragState: I,
1529
+ resetClickState: X,
1530
+ createDragImage: Q,
1531
+ updateDragImagePosition: h,
1532
+ removeDragImage: f,
1533
+ handlePlaceholderDragEnter: v,
1534
+ handlePlaceholderDragLeave: N
1535
+ }) => {
1536
+ const j = H(t);
1537
+ j.current = t;
1538
+ const i = H(null), g = H(null), E = H(0), $ = H(new De(ue));
1539
+ G(() => {
1540
+ const p = document.querySelector("main.max-w-full.flex-1.overflow-auto");
1541
+ p && $.current.setScrollElement(p);
1542
+ }, []);
1543
+ const L = H(d);
1544
+ G(() => {
1545
+ L.current = d, S(j.current, 2, "dragOverPositionRef更新:", d);
1546
+ }, [d]);
1547
+ const Y = P(
1548
+ (p) => {
1549
+ if (n.isActive || l.isClicked) {
1550
+ p.preventDefault();
1551
+ const A = window.getSelection();
1552
+ A && A.rangeCount > 0 && A.removeAllRanges();
1553
+ }
1554
+ if (n.isActive) {
1555
+ m(p.clientX, p.clientY), h(p.clientX, p.clientY), $.current.update(p.clientX, p.clientY);
1556
+ const A = document.elementFromPoint(p.clientX, p.clientY), q = A?.closest("[data-drop-zone]");
1557
+ if (q) {
1558
+ document.body.classList.add("droppable");
1559
+ const x = q.getAttribute("data-column-index"), z = x ? parseInt(x) : null;
1560
+ z !== null && z !== o.dragOverColumn && b((Z) => ({ ...Z, dragOverColumn: z }));
1561
+ const R = A?.closest("[data-placeholder-index]");
1562
+ if (R) {
1563
+ const Z = R.getAttribute("data-placeholder-index"), K = R.getAttribute("data-placeholder-column");
1564
+ if (Z && K) {
1565
+ const W = parseInt(Z), J = parseInt(K);
1566
+ v(J, W);
1567
+ }
1568
+ } else
1569
+ N();
1570
+ } else
1571
+ document.body.classList.remove("droppable"), C(null), b((x) => ({ ...x, dragOverColumn: null }));
1572
+ } else if (u && l.isClicked && l.panelId) {
1573
+ if (r[l.panelId] !== "custom" || B(p.clientX, p.clientY) < 10) return;
1574
+ S(j.current, 1, "🚀 カスタムドラッグ開始 -", l.panelId);
1575
+ const q = document.querySelector(`[data-panel-id="${l.panelId}"]`);
1576
+ if (q && g.current) {
1577
+ const x = q.getBoundingClientRect(), z = g.current.x - x.left, R = g.current.y - x.top;
1578
+ Q(l.panelId, z, R), document.body.classList.add("custom-dragging"), c({
1579
+ isActive: !0,
1580
+ panelId: l.panelId,
1581
+ startX: z,
1582
+ startY: R
1583
+ });
1584
+ }
1585
+ b({ isDragging: !0, draggedPanel: l.panelId, dragOverColumn: null }), w(s(l.panelId)), D(p.clientX, p.clientY), M({ isClicked: !1, panelId: null }), T(!1), k(), g.current = null, i.current && (clearTimeout(i.current), i.current = null);
1586
+ }
1587
+ },
1588
+ [
1589
+ n.isActive,
1590
+ l,
1591
+ o.dragOverColumn,
1592
+ r,
1593
+ u,
1594
+ m,
1595
+ b,
1596
+ C,
1597
+ B,
1598
+ s,
1599
+ c,
1600
+ w,
1601
+ D,
1602
+ M,
1603
+ T,
1604
+ k,
1605
+ Q,
1606
+ h,
1607
+ v,
1608
+ N
1609
+ ]
1610
+ ), V = P(
1611
+ (p) => {
1612
+ if (S(j.current, 1, "🐭 カスタムドラッグハンドラー - グローバルマウスアップ", {
1613
+ isActive: n.isActive,
1614
+ panelId: n.panelId,
1615
+ dragMode: n.panelId ? r[n.panelId] : "unknown"
1616
+ }), n.isActive) {
1617
+ $.current.stop();
1618
+ const A = L.current;
1619
+ if (A) {
1620
+ const x = document.elementFromPoint(p.clientX, p.clientY)?.closest("[data-drop-zone]");
1621
+ if (x) {
1622
+ const z = x.getAttribute("data-column-key");
1623
+ z && r[n.panelId] === "custom" ? (S(j.current, 1, "🔄 カスタムドラッグパネル移動実行:", n.panelId, "→", z), y(n.panelId, z, A.insertIndex)) : S(j.current, 1, "🚫 カスタムドラッグパネル移動スキップ:", n.panelId, "モード:", r[n.panelId]);
1624
+ }
1625
+ }
1626
+ f(), document.body.classList.remove("custom-dragging", "droppable"), I(), E.current = 0;
1627
+ } else if (U(p.clientX, p.clientY)) {
1628
+ const q = document.elementFromPoint(p.clientX, p.clientY)?.closest("[data-panel-id]"), x = q?.getAttribute("data-panel-id") ?? null;
1629
+ if (!q || !x || r[x] !== "custom") {
1630
+ i.current && (clearTimeout(i.current), i.current = null), X(), g.current = null, E.current = 0;
1631
+ return;
1632
+ }
1633
+ E.current += 1, l.isClicked === !1 && E.current === 1 ? (S(j.current, 1, "🖱️ 仮想クリック検出 - ドラッグ待機状態へ:", x), M({ isClicked: !0, panelId: x }), i.current = window.setTimeout(() => {
1634
+ S(j.current, 1, "⏳ クリック待機状態を自動解除:", x), X(), g.current = null, E.current = 0;
1635
+ }, 2e3)) : (S(j.current, 1, "🚫 クリック待機状態を解除 - 仮想クリック検出停止:", x), i.current && (clearTimeout(i.current), i.current = null), X(), g.current = null, E.current = 0, i.current = window.setTimeout(() => {
1636
+ S(j.current, 1, "⏳ 仮想クリック検出再開:", x);
1637
+ }, 2e3));
1638
+ } else l.isClicked && (X(), g.current = null, E.current = 0);
1639
+ u && T(!1);
1640
+ },
1641
+ [
1642
+ n.isActive,
1643
+ n.panelId,
1644
+ l,
1645
+ r,
1646
+ u,
1647
+ y,
1648
+ I,
1649
+ X,
1650
+ U,
1651
+ M,
1652
+ T,
1653
+ f
1654
+ ]
1655
+ ), a = P(
1656
+ (p, A) => {
1657
+ if (r[A] !== "custom") {
1658
+ S(j.current, 1, "🚫 カスタムドラッグモードではない - スキップ:", A);
1659
+ return;
1660
+ }
1661
+ O(p.clientX, p.clientY), l.isClicked && l.panelId === A && (T(!0), i.current !== null && (clearTimeout(i.current), i.current = null), F(p.clientX, p.clientY), g.current = { x: p.clientX, y: p.clientY });
1662
+ },
1663
+ [l, r, O, T, F]
1664
+ );
1665
+ return G(() => () => {
1666
+ i.current !== null && clearTimeout(i.current), $.current.stop();
1667
+ }, []), {
1668
+ handleGlobalMouseMove: Y,
1669
+ handleGlobalMouseUp: V,
1670
+ handleMouseDown: a
1671
+ };
1672
+ }, Ue = () => {
1673
+ const [t, o] = ee({
1674
+ x: 0,
1675
+ y: 0,
1676
+ isVisible: !1
1677
+ }), n = H(null), l = H(0), r = H(null), u = P((s, y) => {
1678
+ o({ x: s, y, isVisible: !0 });
1679
+ }, []), d = P(() => {
1680
+ o((s) => ({ ...s, isVisible: !1 }));
1681
+ }, []), c = P((s, y) => {
1682
+ o((D) => D.x === s && D.y === y ? D : {
1683
+ x: s,
1684
+ y,
1685
+ isVisible: D.isVisible
1686
+ });
1687
+ }, []), b = P((s, y) => {
1688
+ l.current = Date.now(), r.current = { x: s, y };
1689
+ }, []), C = P((s, y) => {
1690
+ n.current = { x: s, y };
1691
+ }, []), w = P((s, y, D = 500, m = 5) => Date.now() - (l.current || 0) >= D || !r.current ? !1 : Math.sqrt((s - r.current.x) ** 2 + (y - r.current.y) ** 2) < m, []), M = P((s, y) => {
1692
+ if (!n.current)
1693
+ return 0;
1694
+ const D = Math.abs(s - n.current.x), m = Math.abs(y - n.current.y);
1695
+ return Math.sqrt(D * D + m * m);
1696
+ }, []), T = P(() => {
1697
+ n.current = null, l.current = 0, r.current = null;
1698
+ }, []);
1699
+ return {
1700
+ mousePosition: t,
1701
+ lastClickPosition: n.current,
1702
+ mouseDownTime: l.current,
1703
+ mouseDownPosition: r.current,
1704
+ showMousePosition: u,
1705
+ hideMousePosition: d,
1706
+ updateMousePosition: c,
1707
+ recordMouseDown: b,
1708
+ recordClickPosition: C,
1709
+ isVirtualClick: w,
1710
+ calculateMoveDistance: M,
1711
+ clearMouseTracking: T
1712
+ };
1713
+ }, Ie = () => {
1714
+ const [t, o] = ee({
1715
+ isDragging: !1,
1716
+ draggedPanel: null,
1717
+ dragOverColumn: null
1718
+ }), [n, l] = ee(null), [r, u] = ee(null), [d, c] = ee({
1719
+ isActive: !1,
1720
+ panelId: "",
1721
+ startX: 0,
1722
+ startY: 0
1723
+ }), [b, C] = ee({
1724
+ isClicked: !1,
1725
+ panelId: null
1726
+ }), [w, M] = ee({
1727
+ isTouchDragging: !1,
1728
+ startX: 0,
1729
+ startY: 0,
1730
+ currentX: 0,
1731
+ currentY: 0,
1732
+ draggedElement: null
1733
+ }), [T, s] = ee(!1), y = P(() => {
1734
+ c({ isActive: !1, panelId: "", startX: 0, startY: 0 }), o({ isDragging: !1, draggedPanel: null, dragOverColumn: null }), l(null), u(null);
1735
+ }, []), D = P(() => {
1736
+ C({ isClicked: !1, panelId: null }), s(!1);
1737
+ }, []), m = P((X) => {
1738
+ o(X);
1739
+ }, []), O = P((X) => {
1740
+ l(X);
1741
+ }, []), F = P((X) => {
1742
+ u(X);
1743
+ }, []), U = P((X) => {
1744
+ c(X);
1745
+ }, []), B = P((X) => {
1746
+ C(X);
1747
+ }, []), k = P((X) => {
1748
+ M(X);
1749
+ }, []), I = P((X) => {
1750
+ s(X);
1751
+ }, []);
1752
+ return {
1753
+ // States / 状態
1754
+ dragState: t,
1755
+ dragOverPosition: n,
1756
+ originalPanelPosition: r,
1757
+ customDrag: d,
1758
+ clickState: b,
1759
+ touchDragState: w,
1760
+ isMouseDown: T,
1761
+ // Stabilized Setters / 安定化されたセッター
1762
+ setDragState: m,
1763
+ setDragOverPosition: O,
1764
+ setOriginalPanelPosition: F,
1765
+ setCustomDrag: U,
1766
+ setClickState: B,
1767
+ setTouchDragState: k,
1768
+ setIsMouseDown: I,
1769
+ // Utility Functions / ユーティリティ関数
1770
+ resetDragState: y,
1771
+ resetClickState: D
1772
+ };
1773
+ }, Ve = ({
1774
+ debugConfig: t,
1775
+ dragState: o,
1776
+ customDrag: n,
1777
+ dragModes: l,
1778
+ columnPanels: r,
1779
+ dragOverPosition: u,
1780
+ originalPanelPosition: d,
1781
+ setDragState: c,
1782
+ setDragOverPosition: b,
1783
+ setOriginalPanelPosition: C,
1784
+ performPanelMove: w,
1785
+ showMousePosition: M,
1786
+ updateMousePosition: T,
1787
+ resetDragState: s,
1788
+ handlePlaceholderDragEnter: y,
1789
+ handlePlaceholderDragLeave: D
1790
+ }) => {
1791
+ const m = H(t);
1792
+ m.current = t;
1793
+ const O = H(r);
1794
+ O.current = r;
1795
+ const F = H(o);
1796
+ F.current = o;
1797
+ const U = H(u);
1798
+ U.current = u;
1799
+ const B = H(d);
1800
+ B.current = d;
1801
+ const k = H(new De(ue));
1802
+ G(() => {
1803
+ const v = document.querySelector("main.max-w-full.flex-1.overflow-auto");
1804
+ v && k.current.setScrollElement(v);
1805
+ }, []);
1806
+ const I = P(
1807
+ (v, N) => {
1808
+ if (n.isActive) {
1809
+ S(m.current, 2, "カスタムドラッグアクティブ中 - 通常ドラッグを無効化:", N), v.preventDefault();
1810
+ return;
1811
+ }
1812
+ if (l[N] === "custom") {
1813
+ S(m.current, 2, "カスタムドラッグモード - 通常ドラッグを無効化:", N), v.preventDefault();
1814
+ return;
1815
+ }
1816
+ S(m.current, 1, "ドラッグ開始:", N);
1817
+ const j = Object.keys(O.current);
1818
+ let i = null;
1819
+ for (let g = 0; g < j.length; g++) {
1820
+ const E = j[g], $ = O.current[E].indexOf(N);
1821
+ if ($ !== -1) {
1822
+ i = { columnIndex: g, panelIndex: $ };
1823
+ break;
1824
+ }
1825
+ }
1826
+ C(i), v.dataTransfer && (v.dataTransfer.setData("text/plain", N), v.dataTransfer.effectAllowed = "move"), M(v.clientX, v.clientY), requestAnimationFrame(() => {
1827
+ c({
1828
+ isDragging: !0,
1829
+ draggedPanel: N,
1830
+ dragOverColumn: null
1831
+ });
1832
+ });
1833
+ },
1834
+ [l, n.isActive, C, M, c]
1835
+ ), X = P(() => {
1836
+ S(m.current, 1, "ドラッグ終了"), k.current.stop(), s();
1837
+ }, [s]), Q = P(
1838
+ (v, N) => {
1839
+ if (v.preventDefault(), v.dataTransfer.dropEffect = "move", !F.current.isDragging) return;
1840
+ T(v.clientX, v.clientY), N !== F.current.dragOverColumn && c((g) => ({ ...g, dragOverColumn: N }));
1841
+ const j = document.elementFromPoint(v.clientX, v.clientY), i = j?.closest("[data-placeholder-index]");
1842
+ if (i) {
1843
+ const g = i.getAttribute("data-placeholder-index"), E = i.getAttribute("data-placeholder-column");
1844
+ if (g && E) {
1845
+ const $ = parseInt(g), L = parseInt(E);
1846
+ y(L, $);
1847
+ }
1848
+ } else
1849
+ j?.closest("[data-drop-zone]") || D();
1850
+ },
1851
+ [T, c, y, D]
1852
+ ), h = P(
1853
+ (v, N) => {
1854
+ v.preventDefault();
1855
+ const j = v.dataTransfer.getData("text/plain"), i = U.current;
1856
+ j && i && (S(m.current, 1, "🎯 ドロップ完了:", {
1857
+ draggedPanel: j,
1858
+ targetColumn: N,
1859
+ insertPosition: `カラム${i.columnIndex} - 位置${i.insertIndex}`
1860
+ }), w(j, N, i.insertIndex), b(null), X());
1861
+ },
1862
+ [w, b, X]
1863
+ ), f = P(
1864
+ (v) => {
1865
+ const N = v.currentTarget, j = v.relatedTarget;
1866
+ j && N.contains(j) || (b(null), c((i) => ({ ...i, dragOverColumn: null })));
1867
+ },
1868
+ [b, c]
1869
+ );
1870
+ return G(() => {
1871
+ const v = (N) => {
1872
+ F.current.isDragging && (T(N.clientX, N.clientY), k.current.update(N.clientX, N.clientY));
1873
+ };
1874
+ if (o.isDragging)
1875
+ return document.addEventListener("dragover", v), () => {
1876
+ document.removeEventListener("dragover", v), k.current.stop();
1877
+ };
1878
+ }, [o.isDragging, T]), G(() => () => {
1879
+ k.current.stop();
1880
+ }, []), {
1881
+ handleDragStart: I,
1882
+ handleDragEnd: X,
1883
+ handleDragOverWithInsert: Q,
1884
+ handleDropWithInsert: h,
1885
+ handleColumnDragLeave: f
1886
+ };
1887
+ }, Be = (t) => {
1888
+ const [o, n] = ee(t), [l, r] = ee({}), u = H({}), d = H(null), c = H({ x: 0, y: 0 }), b = P((m) => document.querySelector(`[data-panel-id="${m}"]`), []), C = P(
1889
+ (m, O) => {
1890
+ const F = O.getBoundingClientRect(), U = window.getComputedStyle(O), B = {
1891
+ width: Math.round(F.width),
1892
+ height: Math.round(F.height),
1893
+ x: Math.round(F.left),
1894
+ y: Math.round(F.top),
1895
+ minHeight: U.minHeight || "auto",
1896
+ maxHeight: U.maxHeight || "none"
1897
+ }, k = u.current[m];
1898
+ (!k || Object.keys(B).some((I) => k[I] !== B[I])) && (u.current[m] = B, r((I) => ({
1899
+ ...I,
1900
+ [m]: B
1901
+ })));
1902
+ },
1903
+ []
1904
+ // setPanelSizes は React の state セッターなので依存配列に含める必要はありません
1905
+ ), w = P(
1906
+ (m) => {
1907
+ const O = b(m);
1908
+ O && C(m, O);
1909
+ },
1910
+ [b, C]
1911
+ ), M = P(
1912
+ (m, O) => {
1913
+ O && requestAnimationFrame(() => C(m, O));
1914
+ },
1915
+ [C]
1916
+ ), T = P(
1917
+ (m, O, F) => {
1918
+ const U = b(m);
1919
+ if (!U || d.current) return;
1920
+ const B = U.getBoundingClientRect(), k = U.cloneNode(!0);
1921
+ k.style.position = "fixed", k.style.top = "0px", k.style.left = "0px", k.style.width = `${B.width}px`, k.style.height = `${B.height}px`, k.style.pointerEvents = "none", k.style.zIndex = "1000", k.style.opacity = "0.5", k.style.margin = "0", k.style.transition = "none", k.style.boxShadow = "0 8px 32px rgba(0,0,0,0.3)", k.style.transform = `translate(${B.left}px, ${B.top}px)`, k.id = `drag-image-${m}`, document.body.appendChild(k), d.current = k, c.current = { x: O, y: F };
1922
+ },
1923
+ [b]
1924
+ ), s = P((m, O) => {
1925
+ if (d.current) {
1926
+ const F = m - c.current.x, U = O - c.current.y;
1927
+ d.current.style.transform = `translate(${F}px, ${U}px) scale(1.05)`;
1928
+ }
1929
+ }, []), y = P(() => {
1930
+ d.current && (d.current.remove(), d.current = null);
1931
+ }, []), D = P((m) => {
1932
+ n((O) => ({
1933
+ ...O,
1934
+ [m]: !O[m]
1935
+ }));
1936
+ }, []);
1937
+ return {
1938
+ // State / 状態
1939
+ panelVisibility: o,
1940
+ panelSizes: l,
1941
+ // State update functions / 状態更新関数
1942
+ setPanelVisibility: n,
1943
+ setPanelSizes: r,
1944
+ setPanelRef: M,
1945
+ updatePanelSize: w,
1946
+ togglePanelVisibility: D,
1947
+ // Utility functions / ユーティリティ関数
1948
+ getPanelElement: b,
1949
+ // Functions for drag image management / ドラッグイメージ管理用の関数
1950
+ createDragImage: T,
1951
+ updateDragImagePosition: s,
1952
+ removeDragImage: y
1953
+ };
1954
+ }, at = ({
1955
+ minColumnWidth: t = 350,
1956
+ defaultColumns: o = 3,
1957
+ maxColumns: n = 6,
1958
+ minColumns: l = 1,
1959
+ currentColumnWidths: r = {}
1960
+ } = {}) => {
1961
+ const [u, d] = ee(0), c = H(0), b = H(null), [C, w] = ee(!1), M = H(o);
1962
+ G(() => {
1963
+ if (typeof window > "u")
1964
+ return;
1965
+ const y = () => {
1966
+ const m = window.visualViewport?.width ?? 0, O = document?.documentElement?.clientWidth ?? 0, F = document?.body?.clientWidth ?? 0, U = window.innerWidth ?? 0;
1967
+ return O > 0 ? Math.floor(O) : m > 0 ? Math.floor(m) : F > 0 ? Math.floor(F) : Math.floor(U);
1968
+ }, D = () => {
1969
+ b.current !== null && cancelAnimationFrame(b.current), b.current = requestAnimationFrame(() => {
1970
+ const m = y();
1971
+ b.current = null, m !== 0 && (Math.abs(c.current - m) < 2 || (c.current = m, d(m)));
1972
+ });
1973
+ };
1974
+ return D(), window.addEventListener("resize", D), window.addEventListener("orientationchange", D), window.visualViewport?.addEventListener("resize", D), () => {
1975
+ b.current !== null && cancelAnimationFrame(b.current), window.removeEventListener("resize", D), window.removeEventListener("orientationchange", D), window.visualViewport?.removeEventListener("resize", D);
1976
+ };
1977
+ }, []);
1978
+ const T = ve(() => {
1979
+ if (!C || u === 0)
1980
+ return M.current = o, o;
1981
+ const y = Math.max(u - 64, 0), D = 24, m = Object.values(r);
1982
+ let O;
1983
+ if (m.length > 0) {
1984
+ const F = m.reduce((k, I) => k + I, 0) / m.length, U = Math.max(t, F);
1985
+ O = Math.floor((y + D) / (U + D)), m.reduce((k, I) => k + I, 0) + (m.length - 1) * D > y && m.length > l && (O = Math.min(O, m.length - 1));
1986
+ } else
1987
+ O = Math.floor((y + D) / (t + D));
1988
+ return O = Math.max(l, Math.min(n, O)), M.current === O ? M.current : (M.current = O, O);
1989
+ }, [C, u, o, t, n, l, r]), s = P(() => {
1990
+ w((y) => !y);
1991
+ }, []);
1992
+ return {
1993
+ responsiveColumnCount: T,
1994
+ isResponsiveMode: C,
1995
+ screenWidth: u,
1996
+ toggleResponsiveMode: s
1997
+ };
1998
+ }, it = ({ initialColumnPanels: t, initialPanelVisibility: o, initialDragModes: n = {}, debugConfig: l, onPanelMove: r, onDragModeChange: u, onColumnPanelsChange: d }) => {
1999
+ const c = H(l);
2000
+ c.current = l;
2001
+ const [b, C] = ee(t), [w, M] = ee(n), T = H(b);
2002
+ T.current = b;
2003
+ const s = Ie(), y = Ue(), D = Be(o), m = H({
2004
+ mousemove: null,
2005
+ mouseup: null
2006
+ }), O = P((i) => {
2007
+ const g = Object.keys(T.current), E = Xe(g, ne);
2008
+ for (let $ = 0; $ < E.length; $++) {
2009
+ const L = E[$], Y = T.current[L]?.indexOf(i) ?? -1;
2010
+ if (Y !== -1)
2011
+ return { columnIndex: $, panelIndex: Y };
2012
+ }
2013
+ return null;
2014
+ }, []), F = P(
2015
+ (i, g, E) => {
2016
+ S(c.current, 1, "🔄 パネル移動実行:", i, "→", g, "@", E), C(($) => {
2017
+ const L = { ...$ }, Y = Object.keys(L).find((V) => L[V].includes(i));
2018
+ if (!Y)
2019
+ return console.error("Source column not found for panel:", i), $;
2020
+ if (!L[g])
2021
+ return console.error("Target column not found:", g), $;
2022
+ if (Y === g) {
2023
+ const V = [...L[Y]], a = V.indexOf(i), [p] = V.splice(a, 1), A = a < E ? E - 1 : E;
2024
+ V.splice(A, 0, p), L[g] = V;
2025
+ } else {
2026
+ L[Y] = L[Y].filter((a) => a !== i);
2027
+ const V = [...L[g]];
2028
+ V.splice(E, 0, i), L[g] = V;
2029
+ }
2030
+ if (S(c.current, 1, "✅ パネル移動完了:", i, "→", g), d && requestAnimationFrame(() => {
2031
+ d(L);
2032
+ }), r) {
2033
+ const V = Object.keys($).find((a) => $[a].includes(i));
2034
+ V && requestAnimationFrame(() => {
2035
+ r(i, V, g, E);
2036
+ });
2037
+ }
2038
+ return L;
2039
+ });
2040
+ },
2041
+ [d, r]
2042
+ ), U = P(
2043
+ (i, g) => {
2044
+ if (!s.dragState.isDragging && !s.customDrag.isActive) return;
2045
+ const E = s.originalPanelPosition;
2046
+ if (E && E.columnIndex === i && (E.panelIndex === g || E.panelIndex + 1 === g)) {
2047
+ S(c.current, 1, `元の位置への挿入をスキップ: カラム${i}, 位置${g}`);
2048
+ return;
2049
+ }
2050
+ const $ = s.dragOverPosition;
2051
+ (!$ || $.columnIndex !== i || $.insertIndex !== g) && (S(c.current, 1, `プレースホルダーエンター: カラム${i}, 位置${g}`), s.setDragOverPosition({ columnIndex: i, insertIndex: g }), s.setDragState((L) => ({ ...L, dragOverColumn: i })));
2052
+ },
2053
+ [s]
2054
+ ), B = P(
2055
+ (i, g, E) => {
2056
+ if (!(!s.dragState.isDragging && !s.customDrag.isActive)) {
2057
+ if (s.customDrag.isActive)
2058
+ S(c.current, 1, "🚫 カスタムドラッグ - プレースホルダーリーブ: ハイライトを解除します。"), s.setDragOverPosition(null);
2059
+ else if (s.dragState.isDragging && i && g !== void 0 && E !== void 0) {
2060
+ const $ = s.dragOverPosition;
2061
+ if ($ && $.columnIndex === g && $.insertIndex === E) {
2062
+ const L = i.currentTarget, Y = i.relatedTarget;
2063
+ Y && L.contains(Y) || (S(c.current, 1, `ノーマルドラッグ - プレースホルダーリーブ: カラム${g}, 位置${E}。ハイライトを解除します。`), s.setDragOverPosition(null));
2064
+ }
2065
+ }
2066
+ }
2067
+ },
2068
+ [s]
2069
+ ), k = qe({
2070
+ debugConfig: c.current,
2071
+ dragState: s.dragState,
2072
+ customDrag: s.customDrag,
2073
+ clickState: s.clickState,
2074
+ dragModes: w,
2075
+ isMouseDown: s.isMouseDown,
2076
+ originalPanelPosition: s.originalPanelPosition,
2077
+ dragOverPosition: s.dragOverPosition,
2078
+ setCustomDrag: s.setCustomDrag,
2079
+ setDragState: s.setDragState,
2080
+ setDragOverPosition: s.setDragOverPosition,
2081
+ setOriginalPanelPosition: s.setOriginalPanelPosition,
2082
+ setClickState: s.setClickState,
2083
+ setIsMouseDown: s.setIsMouseDown,
2084
+ findPanelPosition: O,
2085
+ performPanelMove: F,
2086
+ showMousePosition: y.showMousePosition,
2087
+ updateMousePosition: y.updateMousePosition,
2088
+ recordMouseDown: y.recordMouseDown,
2089
+ recordClickPosition: y.recordClickPosition,
2090
+ isVirtualClick: y.isVirtualClick,
2091
+ calculateMoveDistance: y.calculateMoveDistance,
2092
+ clearMouseTracking: y.clearMouseTracking,
2093
+ resetDragState: s.resetDragState,
2094
+ resetClickState: s.resetClickState,
2095
+ createDragImage: D.createDragImage,
2096
+ updateDragImagePosition: D.updateDragImagePosition,
2097
+ removeDragImage: D.removeDragImage,
2098
+ handlePlaceholderDragEnter: U,
2099
+ handlePlaceholderDragLeave: B
2100
+ }), I = Ve({
2101
+ debugConfig: c.current,
2102
+ dragState: s.dragState,
2103
+ customDrag: s.customDrag,
2104
+ dragModes: w,
2105
+ columnPanels: b,
2106
+ dragOverPosition: s.dragOverPosition,
2107
+ originalPanelPosition: s.originalPanelPosition,
2108
+ setDragState: s.setDragState,
2109
+ setDragOverPosition: s.setDragOverPosition,
2110
+ setOriginalPanelPosition: s.setOriginalPanelPosition,
2111
+ performPanelMove: F,
2112
+ showMousePosition: y.showMousePosition,
2113
+ updateMousePosition: y.updateMousePosition,
2114
+ resetDragState: s.resetDragState,
2115
+ handlePlaceholderDragEnter: U,
2116
+ handlePlaceholderDragLeave: B
2117
+ }), X = P((i) => {
2118
+ m.current.mousemove && m.current.mousemove(i);
2119
+ }, []), Q = P((i) => {
2120
+ m.current.mouseup && m.current.mouseup(i);
2121
+ }, []);
2122
+ G(() => (S(c.current, 1, "🔧 グローバルイベントリスナー初期化 - refベース管理開始"), document.addEventListener("mousemove", X), document.addEventListener("mouseup", Q), () => {
2123
+ S(c.current, 1, "🔴 グローバルイベントリスナー終了 - refベース管理終了"), document.removeEventListener("mousemove", X), document.removeEventListener("mouseup", Q);
2124
+ }), [X, Q]), G(() => {
2125
+ const i = !s.clickState.isClicked && Object.entries(w).some(([, E]) => E === "custom"), g = s.clickState.isClicked && s.clickState.panelId;
2126
+ if (i || g) {
2127
+ const E = i ? "パターン1(仮想クリック検出)" : "パターン2,3(ドラッグ準備)";
2128
+ S(c.current, 1, `🔧 イベントハンドラー設定開始: ${E}`), m.current.mousemove = k.handleGlobalMouseMove, m.current.mouseup = k.handleGlobalMouseUp;
2129
+ } else
2130
+ s.customDrag.isActive || s.dragState.isDragging || (m.current.mousemove = null, m.current.mouseup = null);
2131
+ }, [s.clickState.isClicked, s.clickState.panelId, w, s.customDrag.isActive, s.dragState.isDragging, k.handleGlobalMouseMove, k.handleGlobalMouseUp]);
2132
+ const h = P(
2133
+ (i, g) => {
2134
+ const E = i.touches[0], $ = i.currentTarget;
2135
+ s.setTouchDragState({
2136
+ isTouchDragging: !0,
2137
+ startX: E.clientX,
2138
+ startY: E.clientY,
2139
+ currentX: E.clientX,
2140
+ currentY: E.clientY,
2141
+ draggedElement: $
2142
+ }), s.setDragState({
2143
+ isDragging: !0,
2144
+ draggedPanel: g,
2145
+ dragOverColumn: null
2146
+ });
2147
+ },
2148
+ [s]
2149
+ ), f = P(
2150
+ (i) => {
2151
+ if (!s.touchDragState.isTouchDragging) return;
2152
+ i.preventDefault();
2153
+ const g = i.touches[0];
2154
+ s.setTouchDragState((E) => ({
2155
+ ...E,
2156
+ currentX: g.clientX,
2157
+ currentY: g.clientY
2158
+ }));
2159
+ },
2160
+ [s.touchDragState.isTouchDragging, s]
2161
+ ), v = P(
2162
+ (i) => {
2163
+ s.touchDragState.isTouchDragging && (s.setTouchDragState({
2164
+ isTouchDragging: !1,
2165
+ startX: 0,
2166
+ startY: 0,
2167
+ currentX: 0,
2168
+ currentY: 0,
2169
+ draggedElement: null
2170
+ }), I.handleDragEnd());
2171
+ },
2172
+ [s.touchDragState.isTouchDragging, s, I]
2173
+ ), N = P(
2174
+ (i) => {
2175
+ S(c.current, 1, "🔄 toggleDragMode called:", { panelId: i }), M((g) => {
2176
+ const $ = (g[i] || "normal") === "normal" ? "custom" : "normal", L = { ...g, [i]: $ };
2177
+ if (u)
2178
+ try {
2179
+ u(i, $);
2180
+ } catch (Y) {
2181
+ console.error("🔄 Error in onDragModeChange:", Y);
2182
+ }
2183
+ return L;
2184
+ });
2185
+ },
2186
+ [u]
2187
+ ), j = P((i, g) => {
2188
+ i.stopPropagation(), S(c.current, 2, "パネルサイズ情報クリック:", g);
2189
+ }, []);
2190
+ return {
2191
+ // 状態
2192
+ columnPanels: b,
2193
+ panelVisibility: D.panelVisibility,
2194
+ dragModes: w,
2195
+ dragState: s.dragState,
2196
+ dragOverPosition: s.dragOverPosition,
2197
+ originalPanelPosition: s.originalPanelPosition,
2198
+ touchDragState: s.touchDragState,
2199
+ customDrag: s.customDrag,
2200
+ clickState: s.clickState,
2201
+ mousePosition: y.mousePosition,
2202
+ panelSizes: D.panelSizes,
2203
+ // 状態更新関数
2204
+ setColumnPanels: C,
2205
+ setPanelVisibility: D.setPanelVisibility,
2206
+ setDragModes: M,
2207
+ setPanelRef: D.setPanelRef,
2208
+ // イベントハンドラー
2209
+ handleDragStart: I.handleDragStart,
2210
+ handleDragEnd: I.handleDragEnd,
2211
+ handleMouseDown: k.handleMouseDown,
2212
+ handleTouchStart: h,
2213
+ handleTouchMove: f,
2214
+ handleTouchEnd: v,
2215
+ handlePlaceholderDragEnter: U,
2216
+ handlePlaceholderDragLeave: B,
2217
+ handleDragOverWithInsert: I.handleDragOverWithInsert,
2218
+ handleDropWithInsert: I.handleDropWithInsert,
2219
+ handleColumnDragLeave: I.handleColumnDragLeave,
2220
+ handlePanelSizeInfoClick: j,
2221
+ // ユーティリティ関数
2222
+ toggleDragMode: N,
2223
+ findPanelPosition: O
2224
+ };
2225
+ }, ct = {
2226
+ showDebugPanel: !1,
2227
+ showMousePosition: !1,
2228
+ showPanelSizes: !1,
2229
+ showPlaceholderInfo: !1,
2230
+ showDropZoneOutlines: !1,
2231
+ logLevel: 0
2232
+ };
2233
+ export {
2234
+ Ke as ColumnControlPanel,
2235
+ et as ColumnInsertPanel,
2236
+ ne as DEFAULT_COLUMN_ID_CONFIG,
2237
+ ct as DEFAULT_DEBUG_CONFIG,
2238
+ ue as DEFAULT_EDGE_SCROLL_CONFIG,
2239
+ tt as DebugControlPanel,
2240
+ Qe as DragDropLayout,
2241
+ we as DropZoneDebugOverlay,
2242
+ De as EdgeScrollManager,
2243
+ ye as InsertPlaceholder,
2244
+ Ye as PanelSizeDisplay,
2245
+ Je as ResizableColumn,
2246
+ je as ResizeHandle,
2247
+ nt as ResponsiveControl,
2248
+ pe as calculateScrollVector,
2249
+ ot as createColumnIdMapping,
2250
+ S as debugLog,
2251
+ ie as generateColumnId,
2252
+ Pe as generateColumnIds,
2253
+ st as getNextColumnId,
2254
+ rt as isValidColumnId,
2255
+ Fe as normalizeColumnPanels,
2256
+ ce as parseColumnId,
2257
+ He as performScroll,
2258
+ Xe as sortColumnIds,
2259
+ lt as useColumnLayout,
2260
+ qe as useCustomDragHandlers,
2261
+ it as useDragDropColumns,
2262
+ Ie as useDragDropState,
2263
+ Ue as useMouseTracking,
2264
+ Ve as useNormalDragHandlers,
2265
+ Be as usePanelManagement,
2266
+ at as useResponsiveColumns
2267
+ };