@bwg-ui/core 1.1.25 → 1.1.27

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 (122) hide show
  1. package/dist/chunks/common-components-CniOkOzu.js +15776 -0
  2. package/dist/chunks/common-components-DrcQahsO.cjs +183 -0
  3. package/dist/chunks/{core-Dl0PdDdT.js → core-CEDyqniq.js} +1 -2
  4. package/dist/chunks/core-lmAmbqvY.cjs +1 -0
  5. package/dist/chunks/{enc-base64-D7t4BoUA.js → enc-base64-CF2tIkYl.js} +4 -5
  6. package/dist/chunks/enc-base64-Dxq399hI.cjs +1 -0
  7. package/dist/chunks/{sha256-C2-s1oZe.js → sha256-DYurgXCU.js} +12 -13
  8. package/dist/chunks/sha256-H5WWQnKT.cjs +1 -0
  9. package/dist/components/common/BwgPagination.d.ts +1 -1
  10. package/dist/components/common/BwgPagination.d.ts.map +1 -1
  11. package/dist/components/common/index.cjs +1 -2
  12. package/dist/components/common/index.d.ts +3 -1
  13. package/dist/components/common/index.d.ts.map +1 -1
  14. package/dist/components/common/index.js +16 -17
  15. package/dist/components/core/BwgFormItem.d.ts +2 -2
  16. package/dist/components/core/BwgFormItem.d.ts.map +1 -1
  17. package/dist/components/core/BwgInput.d.ts.map +1 -1
  18. package/dist/components/core/index.cjs +1 -2
  19. package/dist/components/core/index.js +1218 -23
  20. package/dist/components/guide/index.cjs +1 -2
  21. package/dist/components/guide/index.js +3 -4
  22. package/dist/components/layout/index.cjs +35 -2
  23. package/dist/components/layout/index.js +350 -10
  24. package/dist/components/popup/MenuReport.d.ts.map +1 -1
  25. package/dist/index.cjs +1 -2
  26. package/dist/index.js +211 -222
  27. package/dist/provider/index.cjs +1 -2
  28. package/dist/provider/index.js +384 -25
  29. package/dist/stores/index.cjs +2 -2
  30. package/dist/stores/index.js +1394 -24
  31. package/dist/utils/index.cjs +1 -2
  32. package/dist/utils/index.js +1369 -200
  33. package/package.json +2 -3
  34. package/dist/chunks/AuthContext-CXng9fj0.cjs +0 -2
  35. package/dist/chunks/AuthContext-CXng9fj0.cjs.map +0 -1
  36. package/dist/chunks/AuthContext-DrEpBrpB.js +0 -57
  37. package/dist/chunks/AuthContext-DrEpBrpB.js.map +0 -1
  38. package/dist/chunks/BwgSpace-CnLM4qcg.js +0 -27
  39. package/dist/chunks/BwgSpace-CnLM4qcg.js.map +0 -1
  40. package/dist/chunks/BwgSpace-b0hmM1Ht.cjs +0 -2
  41. package/dist/chunks/BwgSpace-b0hmM1Ht.cjs.map +0 -1
  42. package/dist/chunks/BwgSwitch-DOlc57wi.cjs +0 -2
  43. package/dist/chunks/BwgSwitch-DOlc57wi.cjs.map +0 -1
  44. package/dist/chunks/BwgSwitch-D_scwi9_.js +0 -269
  45. package/dist/chunks/BwgSwitch-D_scwi9_.js.map +0 -1
  46. package/dist/chunks/BwgUploader-CkXwkcUL.cjs +0 -3
  47. package/dist/chunks/BwgUploader-CkXwkcUL.cjs.map +0 -1
  48. package/dist/chunks/BwgUploader-DBFF9BPF.js +0 -3250
  49. package/dist/chunks/BwgUploader-DBFF9BPF.js.map +0 -1
  50. package/dist/chunks/LoadingOverlay-DAZJF5wg.js +0 -19
  51. package/dist/chunks/LoadingOverlay-DAZJF5wg.js.map +0 -1
  52. package/dist/chunks/LoadingOverlay-DcmKvoZA.cjs +0 -2
  53. package/dist/chunks/LoadingOverlay-DcmKvoZA.cjs.map +0 -1
  54. package/dist/chunks/SSOHandler-BY6LXMLc.cjs +0 -237
  55. package/dist/chunks/SSOHandler-BY6LXMLc.cjs.map +0 -1
  56. package/dist/chunks/SSOHandler-CxvxEBaH.js +0 -28654
  57. package/dist/chunks/SSOHandler-CxvxEBaH.js.map +0 -1
  58. package/dist/chunks/ScreenProtectContext-3my4PHFa.js +0 -154
  59. package/dist/chunks/ScreenProtectContext-3my4PHFa.js.map +0 -1
  60. package/dist/chunks/ScreenProtectContext-CVuXrJm6.cjs +0 -2
  61. package/dist/chunks/ScreenProtectContext-CVuXrJm6.cjs.map +0 -1
  62. package/dist/chunks/SearchBoxContext-DwFDOyYG.cjs +0 -2
  63. package/dist/chunks/SearchBoxContext-DwFDOyYG.cjs.map +0 -1
  64. package/dist/chunks/SearchBoxContext-gWM7FHIw.js +0 -86
  65. package/dist/chunks/SearchBoxContext-gWM7FHIw.js.map +0 -1
  66. package/dist/chunks/ViewContainer-Bhq22_B3.cjs +0 -36
  67. package/dist/chunks/ViewContainer-Bhq22_B3.cjs.map +0 -1
  68. package/dist/chunks/ViewContainer-D9SKBnrn.js +0 -338
  69. package/dist/chunks/ViewContainer-D9SKBnrn.js.map +0 -1
  70. package/dist/chunks/apiUtils-BZ6s0_NI.cjs +0 -3
  71. package/dist/chunks/apiUtils-BZ6s0_NI.cjs.map +0 -1
  72. package/dist/chunks/apiUtils-DSwE62oG.js +0 -1450
  73. package/dist/chunks/apiUtils-DSwE62oG.js.map +0 -1
  74. package/dist/chunks/codeStore-il4-kZPe.cjs +0 -2
  75. package/dist/chunks/codeStore-il4-kZPe.cjs.map +0 -1
  76. package/dist/chunks/codeStore-vPj4Y0TK.js +0 -450
  77. package/dist/chunks/codeStore-vPj4Y0TK.js.map +0 -1
  78. package/dist/chunks/core-BHejg5iS.cjs +0 -2
  79. package/dist/chunks/core-BHejg5iS.cjs.map +0 -1
  80. package/dist/chunks/core-Dl0PdDdT.js.map +0 -1
  81. package/dist/chunks/enc-base64-BkBtNBQV.cjs +0 -2
  82. package/dist/chunks/enc-base64-BkBtNBQV.cjs.map +0 -1
  83. package/dist/chunks/enc-base64-D7t4BoUA.js.map +0 -1
  84. package/dist/chunks/favoriteStore-Bh1FuZm9.js +0 -439
  85. package/dist/chunks/favoriteStore-Bh1FuZm9.js.map +0 -1
  86. package/dist/chunks/favoriteStore-CcKg_nEH.cjs +0 -2
  87. package/dist/chunks/favoriteStore-CcKg_nEH.cjs.map +0 -1
  88. package/dist/chunks/jsx-runtime-CeSfJrVB.cjs +0 -31
  89. package/dist/chunks/jsx-runtime-CeSfJrVB.cjs.map +0 -1
  90. package/dist/chunks/jsx-runtime-Dpn_P65e.js +0 -634
  91. package/dist/chunks/jsx-runtime-Dpn_P65e.js.map +0 -1
  92. package/dist/chunks/popupStore-BRRmB4zH.js +0 -92
  93. package/dist/chunks/popupStore-BRRmB4zH.js.map +0 -1
  94. package/dist/chunks/popupStore-DUApUBF2.cjs +0 -2
  95. package/dist/chunks/popupStore-DUApUBF2.cjs.map +0 -1
  96. package/dist/chunks/realFormat-Cha7OTd9.cjs +0 -2
  97. package/dist/chunks/realFormat-Cha7OTd9.cjs.map +0 -1
  98. package/dist/chunks/realFormat-DRGLFabQ.js +0 -305
  99. package/dist/chunks/realFormat-DRGLFabQ.js.map +0 -1
  100. package/dist/chunks/sha256-C2-s1oZe.js.map +0 -1
  101. package/dist/chunks/sha256-DiIRoCQ8.cjs +0 -2
  102. package/dist/chunks/sha256-DiIRoCQ8.cjs.map +0 -1
  103. package/dist/chunks/usePopup-D2JEuDrO.cjs +0 -2
  104. package/dist/chunks/usePopup-D2JEuDrO.cjs.map +0 -1
  105. package/dist/chunks/usePopup-DarKTbRC.js +0 -109
  106. package/dist/chunks/usePopup-DarKTbRC.js.map +0 -1
  107. package/dist/components/common/index.cjs.map +0 -1
  108. package/dist/components/common/index.js.map +0 -1
  109. package/dist/components/core/index.cjs.map +0 -1
  110. package/dist/components/core/index.js.map +0 -1
  111. package/dist/components/guide/index.cjs.map +0 -1
  112. package/dist/components/guide/index.js.map +0 -1
  113. package/dist/components/layout/index.cjs.map +0 -1
  114. package/dist/components/layout/index.js.map +0 -1
  115. package/dist/index.cjs.map +0 -1
  116. package/dist/index.js.map +0 -1
  117. package/dist/provider/index.cjs.map +0 -1
  118. package/dist/provider/index.js.map +0 -1
  119. package/dist/stores/index.cjs.map +0 -1
  120. package/dist/stores/index.js.map +0 -1
  121. package/dist/utils/index.cjs.map +0 -1
  122. package/dist/utils/index.js.map +0 -1
@@ -1,3250 +0,0 @@
1
- import { j as c } from "./jsx-runtime-Dpn_P65e.js";
2
- import { Button as Y, Form as B, ConfigProvider as pt, Checkbox as xe, message as P, Card as Ge, List as W, Spin as mt, Upload as H, Tooltip as vt, Typography as Dt, Flex as Ne, Progress as yt, notification as St, Input as Q, DatePicker as Ot, Select as Xe, Space as pe, InputNumber as Tt, Radio as bt } from "antd";
3
- import { c as k } from "./BwgSwitch-D_scwi9_.js";
4
- import { useState as L, useEffect as R, useRef as $, useMemo as j, createContext as It, memo as Et, useLayoutEffect as Ct, useCallback as wt, isValidElement as xt, cloneElement as me, useContext as Nt } from "react";
5
- import { PaperClipOutlined as Pt, DownloadOutlined as _t, CloseCircleOutlined as Rt, DeleteOutlined as Lt, InboxOutlined as jt, UploadOutlined as We, CloudUploadOutlined as Mt, CheckCircleOutlined as Ft, FileTextOutlined as kt, SearchOutlined as At } from "@ant-design/icons";
6
- import { isEmpty as Ht, debounce as Ut, findIndex as J } from "lodash";
7
- import { a as Yt, aA as A, c as U, aQ as Bt } from "./apiUtils-DSwE62oG.js";
8
- import $t from "jszip";
9
- import Ke from "imask";
10
- import ee from "dayjs";
11
- import { u as Vt } from "./popupStore-BRRmB4zH.js";
12
- const Ei = (t) => /* @__PURE__ */ c.jsx(Y, { ...t, className: "bwg-btn" }), Ci = ({ itemProps: t, inputProps: e }) => {
13
- const r = B.useFormInstance(), [n, i] = L(
14
- t?.initialValue ?? []
15
- ), [s, a] = L([]), o = s.length > 0 && s.length == n?.length, u = n?.length > 0 && n.length < s.length;
16
- R(() => {
17
- a(l(e?.options));
18
- }, [e?.options]), R(() => {
19
- i(n);
20
- }, [n]);
21
- const l = (g) => {
22
- const d = [];
23
- return (g || []).map((b, D) => {
24
- d.push(b.value);
25
- }), d;
26
- }, p = (g) => {
27
- i(g.target.checked ? s : []), r.setFieldValue(t?.name, g.target.checked ? s : []);
28
- }, m = (g) => {
29
- i(g), r.setFieldValue(t?.name, g), e?.onChange && typeof e?.onChange == "function" && e?.onChange(g);
30
- };
31
- return /* @__PURE__ */ c.jsx(k, { ...t, children: /* @__PURE__ */ c.jsxs(pt, { theme: {
32
- components: {
33
- Checkbox: {
34
- colorPrimary: "var(--check-primary)",
35
- colorPrimaryBorder: "var(--check-primary)",
36
- colorPrimaryHover: "var(--check-primary-active)"
37
- }
38
- }
39
- }, children: [
40
- e?.allCheck && /* @__PURE__ */ c.jsx(
41
- xe,
42
- {
43
- indeterminate: u,
44
- checked: o,
45
- onChange: p,
46
- children: "전체선택"
47
- }
48
- ),
49
- /* @__PURE__ */ c.jsx(
50
- xe.Group,
51
- {
52
- options: e?.options,
53
- value: n,
54
- onChange: m
55
- }
56
- )
57
- ] }) });
58
- }, wi = ({
59
- fileGrpKey: t,
60
- onFetchFilesTrxCd: e = "SCMFILE00101",
61
- readOnly: r = !1,
62
- sysCd: n = __SYS_CD__
63
- }) => {
64
- const [i, s] = L([]);
65
- R(() => {
66
- t && e ? n != __SYS_CD__ ? Yt(n, e, {
67
- crprCd: A()?.crprCd,
68
- sysCd: n,
69
- fileGrpKey: t
70
- }).then((o) => {
71
- if (o?.sub) {
72
- const u = o.sub.map((l) => ({
73
- uid: l.fileKey,
74
- name: l.lgclFileNm,
75
- filePath: l.filePath
76
- }));
77
- s(u);
78
- }
79
- }).catch((o) => {
80
- console.error("파일 목록 조회 서비스 호출에 실패했습니다.", o), P.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
81
- }) : U(e, {
82
- crprCd: A()?.crprCd,
83
- sysCd: n,
84
- fileGrpKey: t
85
- }).then((o) => {
86
- if (o?.sub) {
87
- const u = o.sub.map((l) => ({
88
- uid: l.fileKey,
89
- name: l.lgclFileNm,
90
- filePath: l.filePath
91
- }));
92
- s(u);
93
- }
94
- }).catch((o) => {
95
- console.error("파일 목록 조회 서비스 호출에 실패했습니다.", o), P.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
96
- }) : s([]);
97
- }, [t, e]);
98
- const a = async (o) => {
99
- try {
100
- let u;
101
- n != __SYS_CD__ ? u = "/api/download/" + n : u = "/api/download";
102
- const l = await fetch(u, {
103
- method: "POST",
104
- headers: {
105
- SYSCD: __SYS_CD__,
106
- "Content-Type": "application/json"
107
- // 여기에 필요한 다른 헤더(예: 인증 토큰)를 추가할 수 있습니다.
108
- },
109
- body: JSON.stringify({
110
- filePath: o.filePath,
111
- logicalName: o.name,
112
- fileKey: o.uid
113
- })
114
- });
115
- if (!l.ok) {
116
- const b = (await l.json().catch(() => null))?.message || "파일 다운로드에 실패했습니다.";
117
- throw new Error(b);
118
- }
119
- const p = await l.blob(), m = window.URL.createObjectURL(p), g = document.createElement("a");
120
- g.href = m, g.setAttribute("download", o.name), document.body.appendChild(g), g.click(), document.body.removeChild(g), window.URL.revokeObjectURL(m);
121
- } catch (u) {
122
- console.error(u), P.error(
123
- u.message || "파일을 다운로드하는 중 오류가 발생했습니다."
124
- );
125
- }
126
- };
127
- return Ht(i) ? null : /* @__PURE__ */ c.jsx(Ge, { title: "파일 목록", children: /* @__PURE__ */ c.jsx(
128
- W,
129
- {
130
- dataSource: i,
131
- renderItem: (o) => /* @__PURE__ */ c.jsx(
132
- W.Item,
133
- {
134
- actions: r ? [] : [
135
- /* @__PURE__ */ c.jsx(
136
- Y,
137
- {
138
- type: "text",
139
- icon: /* @__PURE__ */ c.jsx(_t, {}),
140
- onClick: () => a(o)
141
- },
142
- "download"
143
- )
144
- ],
145
- children: /* @__PURE__ */ c.jsx(W.Item.Meta, { avatar: /* @__PURE__ */ c.jsx(Pt, {}), title: o.name })
146
- }
147
- )
148
- }
149
- ) });
150
- }, { Text: te, Link: xi } = Dt, { Dragger: zt } = H, qt = [
151
- ".pdf",
152
- ".xlsx",
153
- ".xls",
154
- ".docx",
155
- ".doc",
156
- ".pptx",
157
- ".ppt",
158
- ".hwp",
159
- ".txt",
160
- ".csv",
161
- // 이미지
162
- ".jpg",
163
- ".jpeg",
164
- ".png",
165
- ".gif",
166
- // 압축
167
- ".zip"
168
- ], Gt = (t, e = 2) => {
169
- if (t === 0) return "0 Bytes";
170
- const r = 1024, n = e < 0 ? 0 : e, i = ["Bytes", "KB", "MB", "GB", "TB"], s = Math.floor(Math.log(t) / Math.log(r));
171
- return parseFloat((t / Math.pow(r, s)).toFixed(n)) + " " + i[s];
172
- }, Ni = ({
173
- title: t = "첨부파일",
174
- fileGrpKey: e,
175
- onUploadComplete: r,
176
- onSuccessTrxCd: n = "SCMFILE00102",
177
- // BwgUploader와 동일한 기본 trxCd 설정
178
- anotherServiceTrxCd: i = "SCMFILE00105",
179
- allowedExtensions: s = qt,
180
- maxFileSize: a = 2048
181
- // 기본값 2GB
182
- }) => {
183
- const [o, u] = L([]), [l, p] = L(!1), [m, g] = L(!1), [d, b] = L(0), D = (h) => {
184
- if (s && s.length > 0) {
185
- const f = ((T) => {
186
- const S = T.lastIndexOf(".");
187
- return S === -1 ? "" : T.substring(S).toLowerCase();
188
- })(h.name);
189
- if (!s.includes(f))
190
- return P.error(
191
- `${h.name} 파일은 허용되지 않는 확장자입니다. (${s.join(
192
- ", "
193
- )}만 가능)`
194
- ), !1;
195
- }
196
- return !0;
197
- }, E = async () => {
198
- const h = o.filter((O) => O.status !== "done"), I = h.reduce(
199
- (O, x) => O + (x.size || 0),
200
- 0
201
- ), f = 2 * 1024 * 1024 * 1024;
202
- if (I > f) {
203
- St.error({
204
- message: "업로드 용량 초과",
205
- description: "한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."
206
- });
207
- return;
208
- }
209
- if (h.length === 0) {
210
- P.warning(
211
- "업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다."
212
- );
213
- return;
214
- }
215
- g(!0);
216
- let T;
217
- try {
218
- const O = new $t();
219
- h.forEach((x) => {
220
- x.originFileObj && O.file(x.name, x.originFileObj);
221
- }), T = await O.generateAsync({
222
- type: "blob",
223
- compression: "DEFLATE",
224
- compressionOptions: {
225
- level: 9
226
- // 높은 압축률 설정
227
- }
228
- });
229
- } catch (O) {
230
- g(!1), P.error("파일을 압축하는 중 오류가 발생했습니다."), console.error("Zipping error:", O);
231
- return;
232
- }
233
- g(!1);
234
- const S = new FormData();
235
- S.append("file", T, "upload.zip"), p(!0), b(0);
236
- try {
237
- const O = await new Promise((C, N) => {
238
- const _ = new XMLHttpRequest();
239
- _.open("POST", "/api/upload-large", !0), _.upload.onprogress = (w) => {
240
- if (w.lengthComputable) {
241
- const z = Math.round(
242
- w.loaded / w.total * 100
243
- );
244
- b(z);
245
- }
246
- }, _.onload = () => {
247
- if (_.status >= 200 && _.status < 300)
248
- try {
249
- const w = JSON.parse(_.responseText);
250
- w.success ? C(w) : N(
251
- new Error(w.message || "파일 업로드에 실패했습니다.")
252
- );
253
- } catch {
254
- N(new Error("잘못된 서버 응답입니다."));
255
- }
256
- else
257
- try {
258
- const w = JSON.parse(_.responseText);
259
- N(new Error(w.message || `서버 오류: ${_.status}`));
260
- } catch {
261
- N(new Error(`서버 오류: ${_.status}`));
262
- }
263
- }, _.onerror = () => {
264
- N(new Error("네트워크 오류가 발생했습니다."));
265
- }, _.send(S);
266
- });
267
- P.success(
268
- O.message || "압축 파일이 성공적으로 업로드되었습니다."
269
- );
270
- const x = o.map(
271
- (C) => h.find((N) => N.uid === C.uid) ? { ...C, status: "done" } : C
272
- );
273
- if (u(x), n && O.uploadedFiles && Array.isArray(O.uploadedFiles)) {
274
- const C = A();
275
- O.uploadedFiles.forEach((N) => {
276
- const _ = {
277
- crprCd: C?.crprCd,
278
- sysCd: __SYS_CD__,
279
- fileGrpKey: e,
280
- sub: [
281
- {
282
- crprCd: C?.crprCd,
283
- sysCd: __SYS_CD__,
284
- fileGrpKey: e,
285
- physFileNm: N.fileNameP,
286
- lgclFileNm: N.fileNameL,
287
- filePath: N.filePath,
288
- fileExtn: N.fileExt,
289
- fileSize: N.fileSize,
290
- mltpYn: "Y"
291
- }
292
- ]
293
- };
294
- U(n, _).then((w) => {
295
- const z = o.map((q) => ({
296
- crprCd: C?.crprCd,
297
- sysCd: __SYS_CD__,
298
- fileGrpKey: w.sub[0].fileGrpKey,
299
- fileKey: w.sub[0].fileKey,
300
- lgclFileNm: q.name,
301
- fileSize: q.size,
302
- fileExtn: q.name.split(".").pop(),
303
- fileType: q.type
304
- }));
305
- U(i, {
306
- // 파일 목록에 fileKey를 추가합니다.
307
- sub: z
308
- });
309
- }).catch((w) => {
310
- console.error("후처리 서비스 호출 실패:", w), P.error(
311
- `${N.fileNameL} 파일의 후처리 작업에 실패했습니다.`
312
- );
313
- }), r && r({
314
- fileNameP: N.fileNameP,
315
- fileNameL: N.fileNameL
316
- });
317
- });
318
- }
319
- } catch (O) {
320
- P.error(O.message || "파일 업로드 중 오류가 발생했습니다.");
321
- const x = o.map(
322
- (C) => h.find((N) => N.uid === C.uid) ? {
323
- ...C,
324
- status: "error",
325
- response: O.message || "파일 업로드 중 오류가 발생했습니다."
326
- } : C
327
- );
328
- u(x);
329
- } finally {
330
- p(!1);
331
- }
332
- }, v = {
333
- multiple: !0,
334
- fileList: o,
335
- beforeUpload: (h) => D(h) ? a && h.size >= a * 1024 * 1024 ? (P.error(
336
- `대용량 첨부 파일 최대 크기는 ${(a / 1024).toFixed(
337
- 1
338
- )}GB입니다.`
339
- ), H.LIST_IGNORE) : !1 : H.LIST_IGNORE,
340
- onChange: ({ fileList: h }) => {
341
- const I = new Map(o.map((f) => [f.uid, f]));
342
- h.forEach((f) => {
343
- I.set(f.uid, f);
344
- }), u(Array.from(I.values()));
345
- },
346
- onRemove: (h) => {
347
- const I = o.filter((f) => f.uid !== h.uid);
348
- u(I);
349
- },
350
- showUploadList: !1
351
- // 수동으로 목록을 렌더링하므로 antd의 기본 목록은 숨깁니다.
352
- };
353
- return /* @__PURE__ */ c.jsx(
354
- mt,
355
- {
356
- spinning: l || m,
357
- tip: m ? "파일 압축 중..." : `파일 업로드 중... ${d}%`,
358
- children: /* @__PURE__ */ c.jsxs("div", { className: "bwg-large-uploader-container", children: [
359
- /* @__PURE__ */ c.jsx(
360
- Ge,
361
- {
362
- title: /* @__PURE__ */ c.jsx(te, { strong: !0, children: t }),
363
- extra: /* @__PURE__ */ c.jsx(H, { ...v, children: /* @__PURE__ */ c.jsx(Y, { icon: /* @__PURE__ */ c.jsx(We, {}), children: "파일 선택" }) }),
364
- bodyStyle: { padding: 0 },
365
- children: /* @__PURE__ */ c.jsx(
366
- zt,
367
- {
368
- ...v,
369
- style: {
370
- border: "none",
371
- background: "transparent",
372
- padding: 0
373
- },
374
- children: /* @__PURE__ */ c.jsx("div", { className: "upload-list-container", children: o.length > 0 ? /* @__PURE__ */ c.jsx(
375
- W,
376
- {
377
- style: { textAlign: "left" },
378
- dataSource: o,
379
- renderItem: (h) => {
380
- const I = h.status === "done", f = h.status === "error";
381
- let T;
382
- return I ? T = /* @__PURE__ */ c.jsx(
383
- Ft,
384
- {
385
- style: { color: "#52c41a", fontSize: 14 }
386
- }
387
- ) : f ? T = /* @__PURE__ */ c.jsx(
388
- vt,
389
- {
390
- title: typeof h.response == "string" ? h.response : "업로드 실패",
391
- children: /* @__PURE__ */ c.jsx(
392
- Rt,
393
- {
394
- style: { color: "#ff4d4f", fontSize: 14 }
395
- }
396
- )
397
- }
398
- ) : T = /* @__PURE__ */ c.jsx(kt, { style: { fontSize: 14 } }), /* @__PURE__ */ c.jsx(
399
- W.Item,
400
- {
401
- actions: [
402
- /* @__PURE__ */ c.jsx(te, { type: "secondary", children: Gt(h.size || 0) }, "size"),
403
- /* @__PURE__ */ c.jsx(
404
- Y,
405
- {
406
- type: "text",
407
- icon: /* @__PURE__ */ c.jsx(Lt, {}),
408
- onClick: (S) => {
409
- S.stopPropagation(), v.onRemove?.(h);
410
- },
411
- disabled: l || m
412
- },
413
- "delete"
414
- )
415
- ],
416
- children: /* @__PURE__ */ c.jsx(
417
- W.Item.Meta,
418
- {
419
- avatar: T,
420
- title: /* @__PURE__ */ c.jsx(te, { type: f ? "danger" : void 0, children: h.name })
421
- }
422
- )
423
- },
424
- h.uid
425
- );
426
- }
427
- }
428
- ) : /* @__PURE__ */ c.jsxs(
429
- Ne,
430
- {
431
- gap: "middle",
432
- align: "center",
433
- justify: "center",
434
- vertical: !0,
435
- style: { padding: "20px 0", minHeight: "120px" },
436
- children: [
437
- /* @__PURE__ */ c.jsx(jt, { style: { fontSize: "32px", color: "#999" } }),
438
- /* @__PURE__ */ c.jsx(te, { type: "secondary", children: "업로드할 파일을 선택하거나 이 영역으로 드래그하세요." })
439
- ]
440
- }
441
- ) })
442
- }
443
- )
444
- }
445
- ),
446
- o.length > 0 && /* @__PURE__ */ c.jsxs(
447
- Ne,
448
- {
449
- justify: "flex-end",
450
- align: "center",
451
- gap: "large",
452
- style: { marginTop: 16 },
453
- children: [
454
- l && /* @__PURE__ */ c.jsx("div", { style: { width: "250px" }, children: /* @__PURE__ */ c.jsx(yt, { percent: d, size: "small" }) }),
455
- /* @__PURE__ */ c.jsx(
456
- Y,
457
- {
458
- type: "primary",
459
- onClick: E,
460
- disabled: l || m || o.filter((h) => h.status !== "done").length === 0,
461
- icon: /* @__PURE__ */ c.jsx(Mt, {}),
462
- children: "일괄 업로드"
463
- }
464
- )
465
- ]
466
- }
467
- )
468
- ] })
469
- }
470
- );
471
- }, Xt = (t) => {
472
- if (typeof t == "string")
473
- return t.replace(/0/g, "_");
474
- if (Array.isArray(t))
475
- return t[0].replace(/0/g, "_");
476
- if (typeof t == "object" && "mask" in t && "blocks" in t) {
477
- const { mask: e, blocks: r } = t;
478
- return e.split(".").map((n) => {
479
- const s = r?.[n]?.maxLength ?? 3;
480
- return "_".repeat(s);
481
- }).join(".");
482
- }
483
- return "";
484
- }, Pi = ({
485
- itemProps: t,
486
- inputProps: e,
487
- mask: r
488
- }) => {
489
- const n = $(null), i = B.useFormInstance(), s = j(() => Xt(r), [r]);
490
- return R(() => {
491
- if (!n.current?.input) return;
492
- const a = typeof r == "string" || Array.isArray(r) ? { mask: r } : r, o = Ke(n.current.input, a);
493
- return o.on("accept", () => {
494
- i && t?.name && i.setFieldValue(t.name, o.value);
495
- }), () => {
496
- o.destroy();
497
- };
498
- }, [r, i, t?.name]), /* @__PURE__ */ c.jsx(k, { ...t, children: /* @__PURE__ */ c.jsx(Q, { ...e, ref: n, placeholder: s }) });
499
- }, Wt = (t) => {
500
- switch (t) {
501
- case "year":
502
- return { format: "YYYY", mask: "0000", outputFormat: "YYYY" };
503
- case "month":
504
- return { format: "YYYY-MM", mask: "0000-00", outputFormat: "YYYYMM" };
505
- case "date":
506
- default:
507
- return {
508
- format: "YYYY-MM-DD",
509
- mask: "0000-00-00",
510
- outputFormat: "YYYYMMDD"
511
- };
512
- }
513
- }, _i = ({
514
- type: t = "date",
515
- itemProps: e = { name: "calendar" },
516
- inputProps: r
517
- }) => {
518
- const { format: n, mask: i, outputFormat: s } = Wt(t), a = $(null), o = $(null), u = B.useFormInstance(), [l, p] = L(!1), [m, g] = L(!1), d = e?.name, [b, D] = L(null);
519
- R(() => {
520
- if (!a.current?.input) return;
521
- const v = Ke(a.current.input, {
522
- mask: i,
523
- lazy: !1
524
- });
525
- return o.current = v, v.on("accept", () => {
526
- console.log("input :: ", v.value);
527
- const h = v.value, I = ee(h, n, !0);
528
- console.log("input :: ", I), h.length === n.length && I.isValid() && (console.log("parsed :: ", I.format(s)), u.setFieldValue(d, I.format(s)), o.current?.updateValue(), p(!1));
529
- }), () => {
530
- v.destroy();
531
- };
532
- }, [n, i]), R(() => {
533
- D(ee(u.getFieldValue(d)));
534
- }, [u.getFieldValue(d)]);
535
- const E = (v) => {
536
- if (!v) {
537
- o.current?.updateValue();
538
- return;
539
- }
540
- const h = v.format(s);
541
- console.log("formatted :: ", h), o.current && (o.current.value = h, o.current.updateValue()), g(!1);
542
- };
543
- return /* @__PURE__ */ c.jsx(
544
- k,
545
- {
546
- ...e,
547
- name: void 0,
548
- validateStatus: m ? "warning" : void 0,
549
- help: m ? "유효하지 않은 날짜입니다" : void 0,
550
- children: /* @__PURE__ */ c.jsxs("div", { style: { position: "relative" }, children: [
551
- /* @__PURE__ */ c.jsx(
552
- B.Item,
553
- {
554
- name: d,
555
- getValueProps: (v) => ({
556
- value: v ? ee(v).format(n) : void 0
557
- }),
558
- normalize: (v) => v ? ee(v).format(s) : void 0,
559
- noStyle: !0,
560
- children: /* @__PURE__ */ c.jsx(
561
- Q,
562
- {
563
- ...r,
564
- ref: a,
565
- onFocus: () => {
566
- p(!l), o.current?.updateValue();
567
- },
568
- onKeyDown: (v) => {
569
- v.key === "Backspace" && p(!0), v.key === "Tab" && p(!1);
570
- },
571
- allowClear: !0,
572
- placeholder: i.replace(/0/g, "_"),
573
- autoComplete: "off"
574
- }
575
- )
576
- }
577
- ),
578
- /* @__PURE__ */ c.jsx(
579
- Ot,
580
- {
581
- open: l,
582
- picker: t,
583
- format: n,
584
- value: b,
585
- onChange: E,
586
- getPopupContainer: (v) => v.parentElement,
587
- style: {
588
- position: "absolute",
589
- top: 0,
590
- left: 0,
591
- pointerEvents: "none",
592
- opacity: 0,
593
- width: "100%"
594
- }
595
- }
596
- )
597
- ] })
598
- }
599
- );
600
- }, { Option: Pe } = Xe, Ri = ({ itemProps: t, inputProps: e }) => {
601
- const [r, n] = L([]);
602
- return R(() => {
603
- e?.addField === "ALL" ? n([
604
- { label: "전체", value: "" },
605
- ...e?.list || []
606
- ]) : e?.addField === "NULL" ? n([{ label: "", value: "" }, ...e?.list || []]) : n(e?.list || []);
607
- }, [e?.list]), /* @__PURE__ */ c.jsx(
608
- k,
609
- {
610
- ...t,
611
- getValueProps: (i) => i ? {
612
- value: i && i.indexOf(",") > 0 ? i.split(",") : [i]
613
- } : {
614
- value: []
615
- },
616
- normalize: (i) => i != null && i != null && i.length > 0 ? i.toString() : "",
617
- children: /* @__PURE__ */ c.jsx(Xe, { ...e, mode: "multiple", children: r.map((i) => {
618
- const { value: s, label: a } = i;
619
- return e?.printCode ? /* @__PURE__ */ c.jsx(Pe, { value: s, label: a, children: /* @__PURE__ */ c.jsx(pe, { children: `[${s}] ${a}` }) }, s) : /* @__PURE__ */ c.jsx(Pe, { value: s, label: a, children: /* @__PURE__ */ c.jsx(pe, { children: `${a}` }) }, s);
620
- }) })
621
- }
622
- );
623
- }, Li = ({ itemProps: t, inputProps: e }) => {
624
- const r = (i) => {
625
- let s = i.toString().split(".");
626
- return e?.decimalPoint != null && s[1] != null && e?.decimalPoint > 0 ? s[1].length > e?.decimalPoint ? s[1] = "." + s[1].substring(0, e?.decimalPoint) : s[1] = "." + s[1] : s[1] = "", s[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") + s[1];
627
- }, n = (i) => {
628
- let s = i.toString().split(".");
629
- return e?.decimalPoint != null && s[1] != null && e?.decimalPoint > 0 ? s[1].length > e?.decimalPoint ? s[1] = "." + s[1].substring(0, e?.decimalPoint) : s[1] = "." + s[1] : s[1] = "", s[0].replace(/\$\s?|(,*)/g, "") + s[1];
630
- };
631
- return /* @__PURE__ */ c.jsx(k, { ...t, children: /* @__PURE__ */ c.jsx(
632
- Tt,
633
- {
634
- ...e,
635
- formatter: (i) => r(i),
636
- parser: (i) => n(i)
637
- }
638
- ) });
639
- }, ji = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ c.jsx(k, { ...t, children: /* @__PURE__ */ c.jsx(bt.Group, { ...e }) }), _e = Q.Search, Mi = (t) => {
640
- const e = B.useFormInstance(), { openPopup: r } = Vt(), n = t.itemProps?.name || [], i = t.popupConfig || {
641
- callback(a) {
642
- console.log("callback data :: ", a), n.length > 1 ? (e.setFieldValue(n[0], a.code), e.setFieldValue(n[1], a.name)) : e.setFieldValue(n, a.code);
643
- }
644
- }, s = {
645
- ...t,
646
- placeholder: typeof t.placeholder == "string" ? t.placeholder : t.placeholder?.[0] || "",
647
- onChange: (a) => {
648
- n.length > 1 && e.setFieldValue(n[0], ""), t.onChange?.(a);
649
- },
650
- onSearch: (a) => {
651
- t.popuCd ? r(t.popuCd, t.popupParams, i) : t.onSearch?.(a);
652
- }
653
- };
654
- return n.length > 1 ? /* @__PURE__ */ c.jsx(k, { ...t.itemProps, name: void 0, children: /* @__PURE__ */ c.jsxs(pe.Compact, { block: !0, children: [
655
- /* @__PURE__ */ c.jsx(
656
- B.Item,
657
- {
658
- name: n[0],
659
- rules: t.itemProps?.rules,
660
- style: { width: "40%", marginBottom: 0, marginInlineEnd: 0 },
661
- validateStatus: "",
662
- help: "",
663
- children: /* @__PURE__ */ c.jsx(
664
- Q,
665
- {
666
- style: { color: "#999", backgroundColor: "#f5f5f5" },
667
- placeholder: t.placeholder?.[0] || "",
668
- readOnly: !0
669
- }
670
- )
671
- }
672
- ),
673
- /* @__PURE__ */ c.jsx(B.Item, { name: n[1], style: { width: "60%", marginBottom: 0 }, children: /* @__PURE__ */ c.jsx(
674
- _e,
675
- {
676
- readOnly: t.readOnly,
677
- enterButton: /* @__PURE__ */ c.jsx(
678
- Y,
679
- {
680
- icon: /* @__PURE__ */ c.jsx(At, {}),
681
- disabled: t.readOnly
682
- }
683
- ),
684
- ...s
685
- }
686
- ) })
687
- ] }) }) : /* @__PURE__ */ c.jsx(k, { ...t.itemProps, children: /* @__PURE__ */ c.jsx(_e, { ...s }) });
688
- }, { TextArea: Kt } = Q, Fi = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ c.jsx(k, { ...t, children: /* @__PURE__ */ c.jsx(Kt, { ...e }) }), Je = It({
689
- dragDropManager: void 0
690
- });
691
- function M(t) {
692
- return "Minified Redux error #" + t + "; visit https://redux.js.org/Errors?code=" + t + " for the full message or use the non-minified dev environment for full errors. ";
693
- }
694
- var Re = (function() {
695
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
696
- })(), Le = function() {
697
- return Math.random().toString(36).substring(7).split("").join(".");
698
- }, je = {
699
- INIT: "@@redux/INIT" + Le(),
700
- REPLACE: "@@redux/REPLACE" + Le()
701
- };
702
- function Jt(t) {
703
- if (typeof t != "object" || t === null) return !1;
704
- for (var e = t; Object.getPrototypeOf(e) !== null; )
705
- e = Object.getPrototypeOf(e);
706
- return Object.getPrototypeOf(t) === e;
707
- }
708
- function Zt(t) {
709
- if (t === void 0) return "undefined";
710
- if (t === null) return "null";
711
- var e = typeof t;
712
- switch (e) {
713
- case "boolean":
714
- case "string":
715
- case "number":
716
- case "symbol":
717
- case "function":
718
- return e;
719
- }
720
- if (Array.isArray(t)) return "array";
721
- if (tr(t)) return "date";
722
- if (er(t)) return "error";
723
- var r = Qt(t);
724
- switch (r) {
725
- case "Symbol":
726
- case "Promise":
727
- case "WeakMap":
728
- case "WeakSet":
729
- case "Map":
730
- case "Set":
731
- return r;
732
- }
733
- return e.slice(8, -1).toLowerCase().replace(/\s/g, "");
734
- }
735
- function Qt(t) {
736
- return typeof t.constructor == "function" ? t.constructor.name : null;
737
- }
738
- function er(t) {
739
- return t instanceof Error || typeof t.message == "string" && t.constructor && typeof t.constructor.stackTraceLimit == "number";
740
- }
741
- function tr(t) {
742
- return t instanceof Date ? !0 : typeof t.toDateString == "function" && typeof t.getDate == "function" && typeof t.setDate == "function";
743
- }
744
- function G(t) {
745
- var e = typeof t;
746
- return process.env.NODE_ENV !== "production" && (e = Zt(t)), e;
747
- }
748
- function Ze(t, e, r) {
749
- var n;
750
- if (typeof e == "function" && typeof r == "function" || typeof r == "function" && typeof arguments[3] == "function")
751
- throw new Error(process.env.NODE_ENV === "production" ? M(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
752
- if (typeof e == "function" && typeof r > "u" && (r = e, e = void 0), typeof r < "u") {
753
- if (typeof r != "function")
754
- throw new Error(process.env.NODE_ENV === "production" ? M(1) : "Expected the enhancer to be a function. Instead, received: '" + G(r) + "'");
755
- return r(Ze)(t, e);
756
- }
757
- if (typeof t != "function")
758
- throw new Error(process.env.NODE_ENV === "production" ? M(2) : "Expected the root reducer to be a function. Instead, received: '" + G(t) + "'");
759
- var i = t, s = e, a = [], o = a, u = !1;
760
- function l() {
761
- o === a && (o = a.slice());
762
- }
763
- function p() {
764
- if (u)
765
- throw new Error(process.env.NODE_ENV === "production" ? M(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
766
- return s;
767
- }
768
- function m(D) {
769
- if (typeof D != "function")
770
- throw new Error(process.env.NODE_ENV === "production" ? M(4) : "Expected the listener to be a function. Instead, received: '" + G(D) + "'");
771
- if (u)
772
- throw new Error(process.env.NODE_ENV === "production" ? M(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
773
- var E = !0;
774
- return l(), o.push(D), function() {
775
- if (E) {
776
- if (u)
777
- throw new Error(process.env.NODE_ENV === "production" ? M(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
778
- E = !1, l();
779
- var h = o.indexOf(D);
780
- o.splice(h, 1), a = null;
781
- }
782
- };
783
- }
784
- function g(D) {
785
- if (!Jt(D))
786
- throw new Error(process.env.NODE_ENV === "production" ? M(7) : "Actions must be plain objects. Instead, the actual type was: '" + G(D) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
787
- if (typeof D.type > "u")
788
- throw new Error(process.env.NODE_ENV === "production" ? M(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
789
- if (u)
790
- throw new Error(process.env.NODE_ENV === "production" ? M(9) : "Reducers may not dispatch actions.");
791
- try {
792
- u = !0, s = i(s, D);
793
- } finally {
794
- u = !1;
795
- }
796
- for (var E = a = o, v = 0; v < E.length; v++) {
797
- var h = E[v];
798
- h();
799
- }
800
- return D;
801
- }
802
- function d(D) {
803
- if (typeof D != "function")
804
- throw new Error(process.env.NODE_ENV === "production" ? M(10) : "Expected the nextReducer to be a function. Instead, received: '" + G(D));
805
- i = D, g({
806
- type: je.REPLACE
807
- });
808
- }
809
- function b() {
810
- var D, E = m;
811
- return D = {
812
- /**
813
- * The minimal observable subscription method.
814
- * @param {Object} observer Any object that can be used as an observer.
815
- * The observer object should have a `next` method.
816
- * @returns {subscription} An object with an `unsubscribe` method that can
817
- * be used to unsubscribe the observable from the store, and prevent further
818
- * emission of values from the observable.
819
- */
820
- subscribe: function(h) {
821
- if (typeof h != "object" || h === null)
822
- throw new Error(process.env.NODE_ENV === "production" ? M(11) : "Expected the observer to be an object. Instead, received: '" + G(h) + "'");
823
- function I() {
824
- h.next && h.next(p());
825
- }
826
- I();
827
- var f = E(I);
828
- return {
829
- unsubscribe: f
830
- };
831
- }
832
- }, D[Re] = function() {
833
- return this;
834
- }, D;
835
- }
836
- return g({
837
- type: je.INIT
838
- }), n = {
839
- dispatch: g,
840
- subscribe: m,
841
- getState: p,
842
- replaceReducer: d
843
- }, n[Re] = b, n;
844
- }
845
- function y(t, e, ...r) {
846
- if (rr() && e === void 0)
847
- throw new Error("invariant requires an error message argument");
848
- if (!t) {
849
- let n;
850
- if (e === void 0)
851
- n = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
852
- else {
853
- let i = 0;
854
- n = new Error(e.replace(/%s/g, function() {
855
- return r[i++];
856
- })), n.name = "Invariant Violation";
857
- }
858
- throw n.framesToPop = 1, n;
859
- }
860
- }
861
- function rr() {
862
- return typeof process < "u" && process.env.NODE_ENV === "production";
863
- }
864
- function nr(t, e, r) {
865
- return e.split(".").reduce(
866
- (n, i) => n && n[i] ? n[i] : r || null,
867
- t
868
- );
869
- }
870
- function ir(t, e) {
871
- return t.filter(
872
- (r) => r !== e
873
- );
874
- }
875
- function Qe(t) {
876
- return typeof t == "object";
877
- }
878
- function sr(t, e) {
879
- const r = /* @__PURE__ */ new Map(), n = (s) => {
880
- r.set(s, r.has(s) ? r.get(s) + 1 : 1);
881
- };
882
- t.forEach(n), e.forEach(n);
883
- const i = [];
884
- return r.forEach((s, a) => {
885
- s === 1 && i.push(a);
886
- }), i;
887
- }
888
- function or(t, e) {
889
- return t.filter(
890
- (r) => e.indexOf(r) > -1
891
- );
892
- }
893
- const Te = "dnd-core/INIT_COORDS", ie = "dnd-core/BEGIN_DRAG", be = "dnd-core/PUBLISH_DRAG_SOURCE", se = "dnd-core/HOVER", oe = "dnd-core/DROP", ae = "dnd-core/END_DRAG";
894
- function Me(t, e) {
895
- return {
896
- type: Te,
897
- payload: {
898
- sourceClientOffset: e || null,
899
- clientOffset: t || null
900
- }
901
- };
902
- }
903
- const ar = {
904
- type: Te,
905
- payload: {
906
- clientOffset: null,
907
- sourceClientOffset: null
908
- }
909
- };
910
- function cr(t) {
911
- return function(r = [], n = {
912
- publishSource: !0
913
- }) {
914
- const { publishSource: i = !0, clientOffset: s, getSourceClientOffset: a } = n, o = t.getMonitor(), u = t.getRegistry();
915
- t.dispatch(Me(s)), ur(r, o, u);
916
- const l = fr(r, o);
917
- if (l == null) {
918
- t.dispatch(ar);
919
- return;
920
- }
921
- let p = null;
922
- if (s) {
923
- if (!a)
924
- throw new Error("getSourceClientOffset must be defined");
925
- lr(a), p = a(l);
926
- }
927
- t.dispatch(Me(s, p));
928
- const g = u.getSource(l).beginDrag(o, l);
929
- if (g == null)
930
- return;
931
- dr(g), u.pinSource(l);
932
- const d = u.getSourceType(l);
933
- return {
934
- type: ie,
935
- payload: {
936
- itemType: d,
937
- item: g,
938
- sourceId: l,
939
- clientOffset: s || null,
940
- sourceClientOffset: p || null,
941
- isSourcePublic: !!i
942
- }
943
- };
944
- };
945
- }
946
- function ur(t, e, r) {
947
- y(!e.isDragging(), "Cannot call beginDrag while dragging."), t.forEach(function(n) {
948
- y(r.getSource(n), "Expected sourceIds to be registered.");
949
- });
950
- }
951
- function lr(t) {
952
- y(typeof t == "function", "When clientOffset is provided, getSourceClientOffset must be a function.");
953
- }
954
- function dr(t) {
955
- y(Qe(t), "Item must be an object.");
956
- }
957
- function fr(t, e) {
958
- let r = null;
959
- for (let n = t.length - 1; n >= 0; n--)
960
- if (e.canDragSource(t[n])) {
961
- r = t[n];
962
- break;
963
- }
964
- return r;
965
- }
966
- function gr(t, e, r) {
967
- return e in t ? Object.defineProperty(t, e, {
968
- value: r,
969
- enumerable: !0,
970
- configurable: !0,
971
- writable: !0
972
- }) : t[e] = r, t;
973
- }
974
- function hr(t) {
975
- for (var e = 1; e < arguments.length; e++) {
976
- var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
977
- typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
978
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
979
- }))), n.forEach(function(i) {
980
- gr(t, i, r[i]);
981
- });
982
- }
983
- return t;
984
- }
985
- function pr(t) {
986
- return function(r = {}) {
987
- const n = t.getMonitor(), i = t.getRegistry();
988
- mr(n), yr(n).forEach((a, o) => {
989
- const u = vr(a, o, i, n), l = {
990
- type: oe,
991
- payload: {
992
- dropResult: hr({}, r, u)
993
- }
994
- };
995
- t.dispatch(l);
996
- });
997
- };
998
- }
999
- function mr(t) {
1000
- y(t.isDragging(), "Cannot call drop while not dragging."), y(!t.didDrop(), "Cannot call drop twice during one drag operation.");
1001
- }
1002
- function vr(t, e, r, n) {
1003
- const i = r.getTarget(t);
1004
- let s = i ? i.drop(n, t) : void 0;
1005
- return Dr(s), typeof s > "u" && (s = e === 0 ? {} : n.getDropResult()), s;
1006
- }
1007
- function Dr(t) {
1008
- y(typeof t > "u" || Qe(t), "Drop result must either be an object or undefined.");
1009
- }
1010
- function yr(t) {
1011
- const e = t.getTargetIds().filter(t.canDropOnTarget, t);
1012
- return e.reverse(), e;
1013
- }
1014
- function Sr(t) {
1015
- return function() {
1016
- const r = t.getMonitor(), n = t.getRegistry();
1017
- Or(r);
1018
- const i = r.getSourceId();
1019
- return i != null && (n.getSource(i, !0).endDrag(r, i), n.unpinSource()), {
1020
- type: ae
1021
- };
1022
- };
1023
- }
1024
- function Or(t) {
1025
- y(t.isDragging(), "Cannot call endDrag while not dragging.");
1026
- }
1027
- function ve(t, e) {
1028
- return e === null ? t === null : Array.isArray(t) ? t.some(
1029
- (r) => r === e
1030
- ) : t === e;
1031
- }
1032
- function Tr(t) {
1033
- return function(r, { clientOffset: n } = {}) {
1034
- br(r);
1035
- const i = r.slice(0), s = t.getMonitor(), a = t.getRegistry(), o = s.getItemType();
1036
- return Er(i, a, o), Ir(i, s, a), Cr(i, s, a), {
1037
- type: se,
1038
- payload: {
1039
- targetIds: i,
1040
- clientOffset: n || null
1041
- }
1042
- };
1043
- };
1044
- }
1045
- function br(t) {
1046
- y(Array.isArray(t), "Expected targetIds to be an array.");
1047
- }
1048
- function Ir(t, e, r) {
1049
- y(e.isDragging(), "Cannot call hover while not dragging."), y(!e.didDrop(), "Cannot call hover after drop.");
1050
- for (let n = 0; n < t.length; n++) {
1051
- const i = t[n];
1052
- y(t.lastIndexOf(i) === n, "Expected targetIds to be unique in the passed array.");
1053
- const s = r.getTarget(i);
1054
- y(s, "Expected targetIds to be registered.");
1055
- }
1056
- }
1057
- function Er(t, e, r) {
1058
- for (let n = t.length - 1; n >= 0; n--) {
1059
- const i = t[n], s = e.getTargetType(i);
1060
- ve(s, r) || t.splice(n, 1);
1061
- }
1062
- }
1063
- function Cr(t, e, r) {
1064
- t.forEach(function(n) {
1065
- r.getTarget(n).hover(e, n);
1066
- });
1067
- }
1068
- function wr(t) {
1069
- return function() {
1070
- if (t.getMonitor().isDragging())
1071
- return {
1072
- type: be
1073
- };
1074
- };
1075
- }
1076
- function xr(t) {
1077
- return {
1078
- beginDrag: cr(t),
1079
- publishDragSource: wr(t),
1080
- hover: Tr(t),
1081
- drop: pr(t),
1082
- endDrag: Sr(t)
1083
- };
1084
- }
1085
- class Nr {
1086
- receiveBackend(e) {
1087
- this.backend = e;
1088
- }
1089
- getMonitor() {
1090
- return this.monitor;
1091
- }
1092
- getBackend() {
1093
- return this.backend;
1094
- }
1095
- getRegistry() {
1096
- return this.monitor.registry;
1097
- }
1098
- getActions() {
1099
- const e = this, { dispatch: r } = this.store;
1100
- function n(s) {
1101
- return (...a) => {
1102
- const o = s.apply(e, a);
1103
- typeof o < "u" && r(o);
1104
- };
1105
- }
1106
- const i = xr(this);
1107
- return Object.keys(i).reduce((s, a) => {
1108
- const o = i[a];
1109
- return s[a] = n(o), s;
1110
- }, {});
1111
- }
1112
- dispatch(e) {
1113
- this.store.dispatch(e);
1114
- }
1115
- constructor(e, r) {
1116
- this.isSetUp = !1, this.handleRefCountChange = () => {
1117
- const n = this.store.getState().refCount > 0;
1118
- this.backend && (n && !this.isSetUp ? (this.backend.setup(), this.isSetUp = !0) : !n && this.isSetUp && (this.backend.teardown(), this.isSetUp = !1));
1119
- }, this.store = e, this.monitor = r, e.subscribe(this.handleRefCountChange);
1120
- }
1121
- }
1122
- function Pr(t, e) {
1123
- return {
1124
- x: t.x + e.x,
1125
- y: t.y + e.y
1126
- };
1127
- }
1128
- function et(t, e) {
1129
- return {
1130
- x: t.x - e.x,
1131
- y: t.y - e.y
1132
- };
1133
- }
1134
- function _r(t) {
1135
- const { clientOffset: e, initialClientOffset: r, initialSourceClientOffset: n } = t;
1136
- return !e || !r || !n ? null : et(Pr(e, n), r);
1137
- }
1138
- function Rr(t) {
1139
- const { clientOffset: e, initialClientOffset: r } = t;
1140
- return !e || !r ? null : et(e, r);
1141
- }
1142
- const Z = [], Ie = [];
1143
- Z.__IS_NONE__ = !0;
1144
- Ie.__IS_ALL__ = !0;
1145
- function Lr(t, e) {
1146
- return t === Z ? !1 : t === Ie || typeof e > "u" ? !0 : or(e, t).length > 0;
1147
- }
1148
- class jr {
1149
- subscribeToStateChange(e, r = {}) {
1150
- const { handlerIds: n } = r;
1151
- y(typeof e == "function", "listener must be a function."), y(typeof n > "u" || Array.isArray(n), "handlerIds, when specified, must be an array of strings.");
1152
- let i = this.store.getState().stateId;
1153
- const s = () => {
1154
- const a = this.store.getState(), o = a.stateId;
1155
- try {
1156
- o === i || o === i + 1 && !Lr(a.dirtyHandlerIds, n) || e();
1157
- } finally {
1158
- i = o;
1159
- }
1160
- };
1161
- return this.store.subscribe(s);
1162
- }
1163
- subscribeToOffsetChange(e) {
1164
- y(typeof e == "function", "listener must be a function.");
1165
- let r = this.store.getState().dragOffset;
1166
- const n = () => {
1167
- const i = this.store.getState().dragOffset;
1168
- i !== r && (r = i, e());
1169
- };
1170
- return this.store.subscribe(n);
1171
- }
1172
- canDragSource(e) {
1173
- if (!e)
1174
- return !1;
1175
- const r = this.registry.getSource(e);
1176
- return y(r, `Expected to find a valid source. sourceId=${e}`), this.isDragging() ? !1 : r.canDrag(this, e);
1177
- }
1178
- canDropOnTarget(e) {
1179
- if (!e)
1180
- return !1;
1181
- const r = this.registry.getTarget(e);
1182
- if (y(r, `Expected to find a valid target. targetId=${e}`), !this.isDragging() || this.didDrop())
1183
- return !1;
1184
- const n = this.registry.getTargetType(e), i = this.getItemType();
1185
- return ve(n, i) && r.canDrop(this, e);
1186
- }
1187
- isDragging() {
1188
- return !!this.getItemType();
1189
- }
1190
- isDraggingSource(e) {
1191
- if (!e)
1192
- return !1;
1193
- const r = this.registry.getSource(e, !0);
1194
- if (y(r, `Expected to find a valid source. sourceId=${e}`), !this.isDragging() || !this.isSourcePublic())
1195
- return !1;
1196
- const n = this.registry.getSourceType(e), i = this.getItemType();
1197
- return n !== i ? !1 : r.isDragging(this, e);
1198
- }
1199
- isOverTarget(e, r = {
1200
- shallow: !1
1201
- }) {
1202
- if (!e)
1203
- return !1;
1204
- const { shallow: n } = r;
1205
- if (!this.isDragging())
1206
- return !1;
1207
- const i = this.registry.getTargetType(e), s = this.getItemType();
1208
- if (s && !ve(i, s))
1209
- return !1;
1210
- const a = this.getTargetIds();
1211
- if (!a.length)
1212
- return !1;
1213
- const o = a.indexOf(e);
1214
- return n ? o === a.length - 1 : o > -1;
1215
- }
1216
- getItemType() {
1217
- return this.store.getState().dragOperation.itemType;
1218
- }
1219
- getItem() {
1220
- return this.store.getState().dragOperation.item;
1221
- }
1222
- getSourceId() {
1223
- return this.store.getState().dragOperation.sourceId;
1224
- }
1225
- getTargetIds() {
1226
- return this.store.getState().dragOperation.targetIds;
1227
- }
1228
- getDropResult() {
1229
- return this.store.getState().dragOperation.dropResult;
1230
- }
1231
- didDrop() {
1232
- return this.store.getState().dragOperation.didDrop;
1233
- }
1234
- isSourcePublic() {
1235
- return !!this.store.getState().dragOperation.isSourcePublic;
1236
- }
1237
- getInitialClientOffset() {
1238
- return this.store.getState().dragOffset.initialClientOffset;
1239
- }
1240
- getInitialSourceClientOffset() {
1241
- return this.store.getState().dragOffset.initialSourceClientOffset;
1242
- }
1243
- getClientOffset() {
1244
- return this.store.getState().dragOffset.clientOffset;
1245
- }
1246
- getSourceClientOffset() {
1247
- return _r(this.store.getState().dragOffset);
1248
- }
1249
- getDifferenceFromInitialOffset() {
1250
- return Rr(this.store.getState().dragOffset);
1251
- }
1252
- constructor(e, r) {
1253
- this.store = e, this.registry = r;
1254
- }
1255
- }
1256
- const Fe = typeof global < "u" ? global : self, tt = Fe.MutationObserver || Fe.WebKitMutationObserver;
1257
- function rt(t) {
1258
- return function() {
1259
- const r = setTimeout(i, 0), n = setInterval(i, 50);
1260
- function i() {
1261
- clearTimeout(r), clearInterval(n), t();
1262
- }
1263
- };
1264
- }
1265
- function Mr(t) {
1266
- let e = 1;
1267
- const r = new tt(t), n = document.createTextNode("");
1268
- return r.observe(n, {
1269
- characterData: !0
1270
- }), function() {
1271
- e = -e, n.data = e;
1272
- };
1273
- }
1274
- const Fr = typeof tt == "function" ? (
1275
- // reliably everywhere they are implemented.
1276
- // They are implemented in all modern browsers.
1277
- //
1278
- // - Android 4-4.3
1279
- // - Chrome 26-34
1280
- // - Firefox 14-29
1281
- // - Internet Explorer 11
1282
- // - iPad Safari 6-7.1
1283
- // - iPhone Safari 7-7.1
1284
- // - Safari 6-7
1285
- Mr
1286
- ) : (
1287
- // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
1288
- // 11-12, and in web workers in many engines.
1289
- // Although message channels yield to any queued rendering and IO tasks, they
1290
- // would be better than imposing the 4ms delay of timers.
1291
- // However, they do not work reliably in Internet Explorer or Safari.
1292
- // Internet Explorer 10 is the only browser that has setImmediate but does
1293
- // not have MutationObservers.
1294
- // Although setImmediate yields to the browser's renderer, it would be
1295
- // preferrable to falling back to setTimeout since it does not have
1296
- // the minimum 4ms penalty.
1297
- // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
1298
- // Desktop to a lesser extent) that renders both setImmediate and
1299
- // MessageChannel useless for the purposes of ASAP.
1300
- // https://github.com/kriskowal/q/issues/396
1301
- // Timers are implemented universally.
1302
- // We fall back to timers in workers in most engines, and in foreground
1303
- // contexts in the following browsers.
1304
- // However, note that even this simple case requires nuances to operate in a
1305
- // broad spectrum of browsers.
1306
- //
1307
- // - Firefox 3-13
1308
- // - Internet Explorer 6-9
1309
- // - iPad Safari 4.3
1310
- // - Lynx 2.8.7
1311
- rt
1312
- );
1313
- class kr {
1314
- // Use the fastest means possible to execute a task in its own turn, with
1315
- // priority over other events including IO, animation, reflow, and redraw
1316
- // events in browsers.
1317
- //
1318
- // An exception thrown by a task will permanently interrupt the processing of
1319
- // subsequent tasks. The higher level `asap` function ensures that if an
1320
- // exception is thrown by a task, that the task queue will continue flushing as
1321
- // soon as possible, but if you use `rawAsap` directly, you are responsible to
1322
- // either ensure that no exceptions are thrown from your task, or to manually
1323
- // call `rawAsap.requestFlush` if an exception is thrown.
1324
- enqueueTask(e) {
1325
- const { queue: r, requestFlush: n } = this;
1326
- r.length || (n(), this.flushing = !0), r[r.length] = e;
1327
- }
1328
- constructor() {
1329
- this.queue = [], this.pendingErrors = [], this.flushing = !1, this.index = 0, this.capacity = 1024, this.flush = () => {
1330
- const { queue: e } = this;
1331
- for (; this.index < e.length; ) {
1332
- const r = this.index;
1333
- if (this.index++, e[r].call(), this.index > this.capacity) {
1334
- for (let n = 0, i = e.length - this.index; n < i; n++)
1335
- e[n] = e[n + this.index];
1336
- e.length -= this.index, this.index = 0;
1337
- }
1338
- }
1339
- e.length = 0, this.index = 0, this.flushing = !1;
1340
- }, this.registerPendingError = (e) => {
1341
- this.pendingErrors.push(e), this.requestErrorThrow();
1342
- }, this.requestFlush = Fr(this.flush), this.requestErrorThrow = rt(() => {
1343
- if (this.pendingErrors.length)
1344
- throw this.pendingErrors.shift();
1345
- });
1346
- }
1347
- }
1348
- class Ar {
1349
- call() {
1350
- try {
1351
- this.task && this.task();
1352
- } catch (e) {
1353
- this.onError(e);
1354
- } finally {
1355
- this.task = null, this.release(this);
1356
- }
1357
- }
1358
- constructor(e, r) {
1359
- this.onError = e, this.release = r, this.task = null;
1360
- }
1361
- }
1362
- class Hr {
1363
- create(e) {
1364
- const r = this.freeTasks, n = r.length ? r.pop() : new Ar(
1365
- this.onError,
1366
- (i) => r[r.length] = i
1367
- );
1368
- return n.task = e, n;
1369
- }
1370
- constructor(e) {
1371
- this.onError = e, this.freeTasks = [];
1372
- }
1373
- }
1374
- const nt = new kr(), Ur = new Hr(nt.registerPendingError);
1375
- function Yr(t) {
1376
- nt.enqueueTask(Ur.create(t));
1377
- }
1378
- const Ee = "dnd-core/ADD_SOURCE", Ce = "dnd-core/ADD_TARGET", we = "dnd-core/REMOVE_SOURCE", ce = "dnd-core/REMOVE_TARGET";
1379
- function Br(t) {
1380
- return {
1381
- type: Ee,
1382
- payload: {
1383
- sourceId: t
1384
- }
1385
- };
1386
- }
1387
- function $r(t) {
1388
- return {
1389
- type: Ce,
1390
- payload: {
1391
- targetId: t
1392
- }
1393
- };
1394
- }
1395
- function Vr(t) {
1396
- return {
1397
- type: we,
1398
- payload: {
1399
- sourceId: t
1400
- }
1401
- };
1402
- }
1403
- function zr(t) {
1404
- return {
1405
- type: ce,
1406
- payload: {
1407
- targetId: t
1408
- }
1409
- };
1410
- }
1411
- function qr(t) {
1412
- y(typeof t.canDrag == "function", "Expected canDrag to be a function."), y(typeof t.beginDrag == "function", "Expected beginDrag to be a function."), y(typeof t.endDrag == "function", "Expected endDrag to be a function.");
1413
- }
1414
- function Gr(t) {
1415
- y(typeof t.canDrop == "function", "Expected canDrop to be a function."), y(typeof t.hover == "function", "Expected hover to be a function."), y(typeof t.drop == "function", "Expected beginDrag to be a function.");
1416
- }
1417
- function De(t, e) {
1418
- if (e && Array.isArray(t)) {
1419
- t.forEach(
1420
- (r) => De(r, !1)
1421
- );
1422
- return;
1423
- }
1424
- y(typeof t == "string" || typeof t == "symbol", e ? "Type can only be a string, a symbol, or an array of either." : "Type can only be a string or a symbol.");
1425
- }
1426
- var F;
1427
- (function(t) {
1428
- t.SOURCE = "SOURCE", t.TARGET = "TARGET";
1429
- })(F || (F = {}));
1430
- let Xr = 0;
1431
- function Wr() {
1432
- return Xr++;
1433
- }
1434
- function Kr(t) {
1435
- const e = Wr().toString();
1436
- switch (t) {
1437
- case F.SOURCE:
1438
- return `S${e}`;
1439
- case F.TARGET:
1440
- return `T${e}`;
1441
- default:
1442
- throw new Error(`Unknown Handler Role: ${t}`);
1443
- }
1444
- }
1445
- function ke(t) {
1446
- switch (t[0]) {
1447
- case "S":
1448
- return F.SOURCE;
1449
- case "T":
1450
- return F.TARGET;
1451
- default:
1452
- throw new Error(`Cannot parse handler ID: ${t}`);
1453
- }
1454
- }
1455
- function Ae(t, e) {
1456
- const r = t.entries();
1457
- let n = !1;
1458
- do {
1459
- const { done: i, value: [, s] } = r.next();
1460
- if (s === e)
1461
- return !0;
1462
- n = !!i;
1463
- } while (!n);
1464
- return !1;
1465
- }
1466
- class Jr {
1467
- addSource(e, r) {
1468
- De(e), qr(r);
1469
- const n = this.addHandler(F.SOURCE, e, r);
1470
- return this.store.dispatch(Br(n)), n;
1471
- }
1472
- addTarget(e, r) {
1473
- De(e, !0), Gr(r);
1474
- const n = this.addHandler(F.TARGET, e, r);
1475
- return this.store.dispatch($r(n)), n;
1476
- }
1477
- containsHandler(e) {
1478
- return Ae(this.dragSources, e) || Ae(this.dropTargets, e);
1479
- }
1480
- getSource(e, r = !1) {
1481
- return y(this.isSourceId(e), "Expected a valid source ID."), r && e === this.pinnedSourceId ? this.pinnedSource : this.dragSources.get(e);
1482
- }
1483
- getTarget(e) {
1484
- return y(this.isTargetId(e), "Expected a valid target ID."), this.dropTargets.get(e);
1485
- }
1486
- getSourceType(e) {
1487
- return y(this.isSourceId(e), "Expected a valid source ID."), this.types.get(e);
1488
- }
1489
- getTargetType(e) {
1490
- return y(this.isTargetId(e), "Expected a valid target ID."), this.types.get(e);
1491
- }
1492
- isSourceId(e) {
1493
- return ke(e) === F.SOURCE;
1494
- }
1495
- isTargetId(e) {
1496
- return ke(e) === F.TARGET;
1497
- }
1498
- removeSource(e) {
1499
- y(this.getSource(e), "Expected an existing source."), this.store.dispatch(Vr(e)), Yr(() => {
1500
- this.dragSources.delete(e), this.types.delete(e);
1501
- });
1502
- }
1503
- removeTarget(e) {
1504
- y(this.getTarget(e), "Expected an existing target."), this.store.dispatch(zr(e)), this.dropTargets.delete(e), this.types.delete(e);
1505
- }
1506
- pinSource(e) {
1507
- const r = this.getSource(e);
1508
- y(r, "Expected an existing source."), this.pinnedSourceId = e, this.pinnedSource = r;
1509
- }
1510
- unpinSource() {
1511
- y(this.pinnedSource, "No source is pinned at the time."), this.pinnedSourceId = null, this.pinnedSource = null;
1512
- }
1513
- addHandler(e, r, n) {
1514
- const i = Kr(e);
1515
- return this.types.set(i, r), e === F.SOURCE ? this.dragSources.set(i, n) : e === F.TARGET && this.dropTargets.set(i, n), i;
1516
- }
1517
- constructor(e) {
1518
- this.types = /* @__PURE__ */ new Map(), this.dragSources = /* @__PURE__ */ new Map(), this.dropTargets = /* @__PURE__ */ new Map(), this.pinnedSourceId = null, this.pinnedSource = null, this.store = e;
1519
- }
1520
- }
1521
- const Zr = (t, e) => t === e;
1522
- function Qr(t, e) {
1523
- return !t && !e ? !0 : !t || !e ? !1 : t.x === e.x && t.y === e.y;
1524
- }
1525
- function en(t, e, r = Zr) {
1526
- if (t.length !== e.length)
1527
- return !1;
1528
- for (let n = 0; n < t.length; ++n)
1529
- if (!r(t[n], e[n]))
1530
- return !1;
1531
- return !0;
1532
- }
1533
- function tn(t = Z, e) {
1534
- switch (e.type) {
1535
- case se:
1536
- break;
1537
- case Ee:
1538
- case Ce:
1539
- case ce:
1540
- case we:
1541
- return Z;
1542
- case ie:
1543
- case be:
1544
- case ae:
1545
- case oe:
1546
- default:
1547
- return Ie;
1548
- }
1549
- const { targetIds: r = [], prevTargetIds: n = [] } = e.payload, i = sr(r, n);
1550
- if (!(i.length > 0 || !en(r, n)))
1551
- return Z;
1552
- const a = n[n.length - 1], o = r[r.length - 1];
1553
- return a !== o && (a && i.push(a), o && i.push(o)), i;
1554
- }
1555
- function rn(t, e, r) {
1556
- return e in t ? Object.defineProperty(t, e, {
1557
- value: r,
1558
- enumerable: !0,
1559
- configurable: !0,
1560
- writable: !0
1561
- }) : t[e] = r, t;
1562
- }
1563
- function nn(t) {
1564
- for (var e = 1; e < arguments.length; e++) {
1565
- var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
1566
- typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
1567
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
1568
- }))), n.forEach(function(i) {
1569
- rn(t, i, r[i]);
1570
- });
1571
- }
1572
- return t;
1573
- }
1574
- const He = {
1575
- initialSourceClientOffset: null,
1576
- initialClientOffset: null,
1577
- clientOffset: null
1578
- };
1579
- function sn(t = He, e) {
1580
- const { payload: r } = e;
1581
- switch (e.type) {
1582
- case Te:
1583
- case ie:
1584
- return {
1585
- initialSourceClientOffset: r.sourceClientOffset,
1586
- initialClientOffset: r.clientOffset,
1587
- clientOffset: r.clientOffset
1588
- };
1589
- case se:
1590
- return Qr(t.clientOffset, r.clientOffset) ? t : nn({}, t, {
1591
- clientOffset: r.clientOffset
1592
- });
1593
- case ae:
1594
- case oe:
1595
- return He;
1596
- default:
1597
- return t;
1598
- }
1599
- }
1600
- function on(t, e, r) {
1601
- return e in t ? Object.defineProperty(t, e, {
1602
- value: r,
1603
- enumerable: !0,
1604
- configurable: !0,
1605
- writable: !0
1606
- }) : t[e] = r, t;
1607
- }
1608
- function X(t) {
1609
- for (var e = 1; e < arguments.length; e++) {
1610
- var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
1611
- typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
1612
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
1613
- }))), n.forEach(function(i) {
1614
- on(t, i, r[i]);
1615
- });
1616
- }
1617
- return t;
1618
- }
1619
- const an = {
1620
- itemType: null,
1621
- item: null,
1622
- sourceId: null,
1623
- targetIds: [],
1624
- dropResult: null,
1625
- didDrop: !1,
1626
- isSourcePublic: null
1627
- };
1628
- function cn(t = an, e) {
1629
- const { payload: r } = e;
1630
- switch (e.type) {
1631
- case ie:
1632
- return X({}, t, {
1633
- itemType: r.itemType,
1634
- item: r.item,
1635
- sourceId: r.sourceId,
1636
- isSourcePublic: r.isSourcePublic,
1637
- dropResult: null,
1638
- didDrop: !1
1639
- });
1640
- case be:
1641
- return X({}, t, {
1642
- isSourcePublic: !0
1643
- });
1644
- case se:
1645
- return X({}, t, {
1646
- targetIds: r.targetIds
1647
- });
1648
- case ce:
1649
- return t.targetIds.indexOf(r.targetId) === -1 ? t : X({}, t, {
1650
- targetIds: ir(t.targetIds, r.targetId)
1651
- });
1652
- case oe:
1653
- return X({}, t, {
1654
- dropResult: r.dropResult,
1655
- didDrop: !0,
1656
- targetIds: []
1657
- });
1658
- case ae:
1659
- return X({}, t, {
1660
- itemType: null,
1661
- item: null,
1662
- sourceId: null,
1663
- dropResult: null,
1664
- didDrop: !1,
1665
- isSourcePublic: null,
1666
- targetIds: []
1667
- });
1668
- default:
1669
- return t;
1670
- }
1671
- }
1672
- function un(t = 0, e) {
1673
- switch (e.type) {
1674
- case Ee:
1675
- case Ce:
1676
- return t + 1;
1677
- case we:
1678
- case ce:
1679
- return t - 1;
1680
- default:
1681
- return t;
1682
- }
1683
- }
1684
- function ln(t = 0) {
1685
- return t + 1;
1686
- }
1687
- function dn(t, e, r) {
1688
- return e in t ? Object.defineProperty(t, e, {
1689
- value: r,
1690
- enumerable: !0,
1691
- configurable: !0,
1692
- writable: !0
1693
- }) : t[e] = r, t;
1694
- }
1695
- function fn(t) {
1696
- for (var e = 1; e < arguments.length; e++) {
1697
- var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
1698
- typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
1699
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
1700
- }))), n.forEach(function(i) {
1701
- dn(t, i, r[i]);
1702
- });
1703
- }
1704
- return t;
1705
- }
1706
- function gn(t = {}, e) {
1707
- return {
1708
- dirtyHandlerIds: tn(t.dirtyHandlerIds, {
1709
- type: e.type,
1710
- payload: fn({}, e.payload, {
1711
- prevTargetIds: nr(t, "dragOperation.targetIds", [])
1712
- })
1713
- }),
1714
- dragOffset: sn(t.dragOffset, e),
1715
- refCount: un(t.refCount, e),
1716
- dragOperation: cn(t.dragOperation, e),
1717
- stateId: ln(t.stateId)
1718
- };
1719
- }
1720
- function hn(t, e = void 0, r = {}, n = !1) {
1721
- const i = pn(n), s = new jr(i, new Jr(i)), a = new Nr(i, s), o = t(a, e, r);
1722
- return a.receiveBackend(o), a;
1723
- }
1724
- function pn(t) {
1725
- const e = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION__;
1726
- return Ze(gn, t && e && e({
1727
- name: "dnd-core",
1728
- instanceId: "dnd-core"
1729
- }));
1730
- }
1731
- function mn(t, e) {
1732
- if (t == null) return {};
1733
- var r = vn(t, e), n, i;
1734
- if (Object.getOwnPropertySymbols) {
1735
- var s = Object.getOwnPropertySymbols(t);
1736
- for (i = 0; i < s.length; i++)
1737
- n = s[i], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
1738
- }
1739
- return r;
1740
- }
1741
- function vn(t, e) {
1742
- if (t == null) return {};
1743
- var r = {}, n = Object.keys(t), i, s;
1744
- for (s = 0; s < n.length; s++)
1745
- i = n[s], !(e.indexOf(i) >= 0) && (r[i] = t[i]);
1746
- return r;
1747
- }
1748
- let Ue = 0;
1749
- const ne = Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");
1750
- var Dn = /* @__PURE__ */ Et(function(e) {
1751
- var { children: r } = e, n = mn(e, [
1752
- "children"
1753
- ]);
1754
- const [i, s] = yn(n);
1755
- return R(() => {
1756
- if (s) {
1757
- const a = it();
1758
- return ++Ue, () => {
1759
- --Ue === 0 && (a[ne] = null);
1760
- };
1761
- }
1762
- }, []), /* @__PURE__ */ c.jsx(Je.Provider, {
1763
- value: i,
1764
- children: r
1765
- });
1766
- });
1767
- function yn(t) {
1768
- if ("manager" in t)
1769
- return [
1770
- {
1771
- dragDropManager: t.manager
1772
- },
1773
- !1
1774
- ];
1775
- const e = Sn(t.backend, t.context, t.options, t.debugMode), r = !t.context;
1776
- return [
1777
- e,
1778
- r
1779
- ];
1780
- }
1781
- function Sn(t, e = it(), r, n) {
1782
- const i = e;
1783
- return i[ne] || (i[ne] = {
1784
- dragDropManager: hn(t, e, r, n)
1785
- }), i[ne];
1786
- }
1787
- function it() {
1788
- return typeof global < "u" ? global : window;
1789
- }
1790
- var ue, Ye;
1791
- function On() {
1792
- return Ye || (Ye = 1, ue = function t(e, r) {
1793
- if (e === r) return !0;
1794
- if (e && r && typeof e == "object" && typeof r == "object") {
1795
- if (e.constructor !== r.constructor) return !1;
1796
- var n, i, s;
1797
- if (Array.isArray(e)) {
1798
- if (n = e.length, n != r.length) return !1;
1799
- for (i = n; i-- !== 0; )
1800
- if (!t(e[i], r[i])) return !1;
1801
- return !0;
1802
- }
1803
- if (e.constructor === RegExp) return e.source === r.source && e.flags === r.flags;
1804
- if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === r.valueOf();
1805
- if (e.toString !== Object.prototype.toString) return e.toString() === r.toString();
1806
- if (s = Object.keys(e), n = s.length, n !== Object.keys(r).length) return !1;
1807
- for (i = n; i-- !== 0; )
1808
- if (!Object.prototype.hasOwnProperty.call(r, s[i])) return !1;
1809
- for (i = n; i-- !== 0; ) {
1810
- var a = s[i];
1811
- if (!t(e[a], r[a])) return !1;
1812
- }
1813
- return !0;
1814
- }
1815
- return e !== e && r !== r;
1816
- }), ue;
1817
- }
1818
- var Tn = On();
1819
- const bn = /* @__PURE__ */ Bt(Tn), V = typeof window < "u" ? Ct : R;
1820
- function In(t, e, r) {
1821
- const [n, i] = L(
1822
- () => e(t)
1823
- ), s = wt(() => {
1824
- const a = e(t);
1825
- bn(n, a) || (i(a), r && r());
1826
- }, [
1827
- n,
1828
- t,
1829
- r
1830
- ]);
1831
- return V(s), [
1832
- n,
1833
- s
1834
- ];
1835
- }
1836
- function En(t, e, r) {
1837
- const [n, i] = In(t, e, r);
1838
- return V(function() {
1839
- const a = t.getHandlerId();
1840
- if (a != null)
1841
- return t.subscribeToStateChange(i, {
1842
- handlerIds: [
1843
- a
1844
- ]
1845
- });
1846
- }, [
1847
- t,
1848
- i
1849
- ]), n;
1850
- }
1851
- function st(t, e, r) {
1852
- return En(
1853
- e,
1854
- t || (() => ({})),
1855
- () => r.reconnect()
1856
- );
1857
- }
1858
- function ot(t, e) {
1859
- const r = [];
1860
- return typeof t != "function" && r.push(t), j(() => typeof t == "function" ? t() : t, r);
1861
- }
1862
- function Cn(t) {
1863
- return j(
1864
- () => t.hooks.dragSource(),
1865
- [
1866
- t
1867
- ]
1868
- );
1869
- }
1870
- function wn(t) {
1871
- return j(
1872
- () => t.hooks.dragPreview(),
1873
- [
1874
- t
1875
- ]
1876
- );
1877
- }
1878
- let le = !1, de = !1;
1879
- class xn {
1880
- receiveHandlerId(e) {
1881
- this.sourceId = e;
1882
- }
1883
- getHandlerId() {
1884
- return this.sourceId;
1885
- }
1886
- canDrag() {
1887
- y(!le, "You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
1888
- try {
1889
- return le = !0, this.internalMonitor.canDragSource(this.sourceId);
1890
- } finally {
1891
- le = !1;
1892
- }
1893
- }
1894
- isDragging() {
1895
- if (!this.sourceId)
1896
- return !1;
1897
- y(!de, "You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
1898
- try {
1899
- return de = !0, this.internalMonitor.isDraggingSource(this.sourceId);
1900
- } finally {
1901
- de = !1;
1902
- }
1903
- }
1904
- subscribeToStateChange(e, r) {
1905
- return this.internalMonitor.subscribeToStateChange(e, r);
1906
- }
1907
- isDraggingSource(e) {
1908
- return this.internalMonitor.isDraggingSource(e);
1909
- }
1910
- isOverTarget(e, r) {
1911
- return this.internalMonitor.isOverTarget(e, r);
1912
- }
1913
- getTargetIds() {
1914
- return this.internalMonitor.getTargetIds();
1915
- }
1916
- isSourcePublic() {
1917
- return this.internalMonitor.isSourcePublic();
1918
- }
1919
- getSourceId() {
1920
- return this.internalMonitor.getSourceId();
1921
- }
1922
- subscribeToOffsetChange(e) {
1923
- return this.internalMonitor.subscribeToOffsetChange(e);
1924
- }
1925
- canDragSource(e) {
1926
- return this.internalMonitor.canDragSource(e);
1927
- }
1928
- canDropOnTarget(e) {
1929
- return this.internalMonitor.canDropOnTarget(e);
1930
- }
1931
- getItemType() {
1932
- return this.internalMonitor.getItemType();
1933
- }
1934
- getItem() {
1935
- return this.internalMonitor.getItem();
1936
- }
1937
- getDropResult() {
1938
- return this.internalMonitor.getDropResult();
1939
- }
1940
- didDrop() {
1941
- return this.internalMonitor.didDrop();
1942
- }
1943
- getInitialClientOffset() {
1944
- return this.internalMonitor.getInitialClientOffset();
1945
- }
1946
- getInitialSourceClientOffset() {
1947
- return this.internalMonitor.getInitialSourceClientOffset();
1948
- }
1949
- getSourceClientOffset() {
1950
- return this.internalMonitor.getSourceClientOffset();
1951
- }
1952
- getClientOffset() {
1953
- return this.internalMonitor.getClientOffset();
1954
- }
1955
- getDifferenceFromInitialOffset() {
1956
- return this.internalMonitor.getDifferenceFromInitialOffset();
1957
- }
1958
- constructor(e) {
1959
- this.sourceId = null, this.internalMonitor = e.getMonitor();
1960
- }
1961
- }
1962
- let fe = !1;
1963
- class Nn {
1964
- receiveHandlerId(e) {
1965
- this.targetId = e;
1966
- }
1967
- getHandlerId() {
1968
- return this.targetId;
1969
- }
1970
- subscribeToStateChange(e, r) {
1971
- return this.internalMonitor.subscribeToStateChange(e, r);
1972
- }
1973
- canDrop() {
1974
- if (!this.targetId)
1975
- return !1;
1976
- y(!fe, "You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");
1977
- try {
1978
- return fe = !0, this.internalMonitor.canDropOnTarget(this.targetId);
1979
- } finally {
1980
- fe = !1;
1981
- }
1982
- }
1983
- isOver(e) {
1984
- return this.targetId ? this.internalMonitor.isOverTarget(this.targetId, e) : !1;
1985
- }
1986
- getItemType() {
1987
- return this.internalMonitor.getItemType();
1988
- }
1989
- getItem() {
1990
- return this.internalMonitor.getItem();
1991
- }
1992
- getDropResult() {
1993
- return this.internalMonitor.getDropResult();
1994
- }
1995
- didDrop() {
1996
- return this.internalMonitor.didDrop();
1997
- }
1998
- getInitialClientOffset() {
1999
- return this.internalMonitor.getInitialClientOffset();
2000
- }
2001
- getInitialSourceClientOffset() {
2002
- return this.internalMonitor.getInitialSourceClientOffset();
2003
- }
2004
- getSourceClientOffset() {
2005
- return this.internalMonitor.getSourceClientOffset();
2006
- }
2007
- getClientOffset() {
2008
- return this.internalMonitor.getClientOffset();
2009
- }
2010
- getDifferenceFromInitialOffset() {
2011
- return this.internalMonitor.getDifferenceFromInitialOffset();
2012
- }
2013
- constructor(e) {
2014
- this.targetId = null, this.internalMonitor = e.getMonitor();
2015
- }
2016
- }
2017
- function Pn(t, e, r) {
2018
- const n = r.getRegistry(), i = n.addTarget(t, e);
2019
- return [
2020
- i,
2021
- () => n.removeTarget(i)
2022
- ];
2023
- }
2024
- function _n(t, e, r) {
2025
- const n = r.getRegistry(), i = n.addSource(t, e);
2026
- return [
2027
- i,
2028
- () => n.removeSource(i)
2029
- ];
2030
- }
2031
- function ye(t, e, r, n) {
2032
- let i;
2033
- if (i !== void 0)
2034
- return !!i;
2035
- if (t === e)
2036
- return !0;
2037
- if (typeof t != "object" || !t || typeof e != "object" || !e)
2038
- return !1;
2039
- const s = Object.keys(t), a = Object.keys(e);
2040
- if (s.length !== a.length)
2041
- return !1;
2042
- const o = Object.prototype.hasOwnProperty.bind(e);
2043
- for (let u = 0; u < s.length; u++) {
2044
- const l = s[u];
2045
- if (!o(l))
2046
- return !1;
2047
- const p = t[l], m = e[l];
2048
- if (i = void 0, i === !1 || i === void 0 && p !== m)
2049
- return !1;
2050
- }
2051
- return !0;
2052
- }
2053
- function Se(t) {
2054
- return (
2055
- // eslint-disable-next-line no-prototype-builtins
2056
- t !== null && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current")
2057
- );
2058
- }
2059
- function Rn(t) {
2060
- if (typeof t.type == "string")
2061
- return;
2062
- const e = t.type.displayName || t.type.name || "the component";
2063
- throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`);
2064
- }
2065
- function Ln(t) {
2066
- return (e = null, r = null) => {
2067
- if (!xt(e)) {
2068
- const s = e;
2069
- return t(s, r), s;
2070
- }
2071
- const n = e;
2072
- return Rn(n), jn(n, r ? (s) => t(s, r) : t);
2073
- };
2074
- }
2075
- function at(t) {
2076
- const e = {};
2077
- return Object.keys(t).forEach((r) => {
2078
- const n = t[r];
2079
- if (r.endsWith("Ref"))
2080
- e[r] = t[r];
2081
- else {
2082
- const i = Ln(n);
2083
- e[r] = () => i;
2084
- }
2085
- }), e;
2086
- }
2087
- function Be(t, e) {
2088
- typeof t == "function" ? t(e) : t.current = e;
2089
- }
2090
- function jn(t, e) {
2091
- const r = t.ref;
2092
- return y(typeof r != "string", "Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"), r ? me(t, {
2093
- ref: (n) => {
2094
- Be(r, n), Be(e, n);
2095
- }
2096
- }) : me(t, {
2097
- ref: e
2098
- });
2099
- }
2100
- class Mn {
2101
- receiveHandlerId(e) {
2102
- this.handlerId !== e && (this.handlerId = e, this.reconnect());
2103
- }
2104
- get connectTarget() {
2105
- return this.dragSource;
2106
- }
2107
- get dragSourceOptions() {
2108
- return this.dragSourceOptionsInternal;
2109
- }
2110
- set dragSourceOptions(e) {
2111
- this.dragSourceOptionsInternal = e;
2112
- }
2113
- get dragPreviewOptions() {
2114
- return this.dragPreviewOptionsInternal;
2115
- }
2116
- set dragPreviewOptions(e) {
2117
- this.dragPreviewOptionsInternal = e;
2118
- }
2119
- reconnect() {
2120
- const e = this.reconnectDragSource();
2121
- this.reconnectDragPreview(e);
2122
- }
2123
- reconnectDragSource() {
2124
- const e = this.dragSource, r = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();
2125
- return r && this.disconnectDragSource(), this.handlerId ? e ? (r && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDragSource = e, this.lastConnectedDragSourceOptions = this.dragSourceOptions, this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, e, this.dragSourceOptions)), r) : (this.lastConnectedDragSource = e, r) : r;
2126
- }
2127
- reconnectDragPreview(e = !1) {
2128
- const r = this.dragPreview, n = e || this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();
2129
- if (n && this.disconnectDragPreview(), !!this.handlerId) {
2130
- if (!r) {
2131
- this.lastConnectedDragPreview = r;
2132
- return;
2133
- }
2134
- n && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDragPreview = r, this.lastConnectedDragPreviewOptions = this.dragPreviewOptions, this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, r, this.dragPreviewOptions));
2135
- }
2136
- }
2137
- didHandlerIdChange() {
2138
- return this.lastConnectedHandlerId !== this.handlerId;
2139
- }
2140
- didConnectedDragSourceChange() {
2141
- return this.lastConnectedDragSource !== this.dragSource;
2142
- }
2143
- didConnectedDragPreviewChange() {
2144
- return this.lastConnectedDragPreview !== this.dragPreview;
2145
- }
2146
- didDragSourceOptionsChange() {
2147
- return !ye(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
2148
- }
2149
- didDragPreviewOptionsChange() {
2150
- return !ye(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
2151
- }
2152
- disconnectDragSource() {
2153
- this.dragSourceUnsubscribe && (this.dragSourceUnsubscribe(), this.dragSourceUnsubscribe = void 0);
2154
- }
2155
- disconnectDragPreview() {
2156
- this.dragPreviewUnsubscribe && (this.dragPreviewUnsubscribe(), this.dragPreviewUnsubscribe = void 0, this.dragPreviewNode = null, this.dragPreviewRef = null);
2157
- }
2158
- get dragSource() {
2159
- return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;
2160
- }
2161
- get dragPreview() {
2162
- return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;
2163
- }
2164
- clearDragSource() {
2165
- this.dragSourceNode = null, this.dragSourceRef = null;
2166
- }
2167
- clearDragPreview() {
2168
- this.dragPreviewNode = null, this.dragPreviewRef = null;
2169
- }
2170
- constructor(e) {
2171
- this.hooks = at({
2172
- dragSource: (r, n) => {
2173
- this.clearDragSource(), this.dragSourceOptions = n || null, Se(r) ? this.dragSourceRef = r : this.dragSourceNode = r, this.reconnectDragSource();
2174
- },
2175
- dragPreview: (r, n) => {
2176
- this.clearDragPreview(), this.dragPreviewOptions = n || null, Se(r) ? this.dragPreviewRef = r : this.dragPreviewNode = r, this.reconnectDragPreview();
2177
- }
2178
- }), this.handlerId = null, this.dragSourceRef = null, this.dragSourceOptionsInternal = null, this.dragPreviewRef = null, this.dragPreviewOptionsInternal = null, this.lastConnectedHandlerId = null, this.lastConnectedDragSource = null, this.lastConnectedDragSourceOptions = null, this.lastConnectedDragPreview = null, this.lastConnectedDragPreviewOptions = null, this.backend = e;
2179
- }
2180
- }
2181
- class Fn {
2182
- get connectTarget() {
2183
- return this.dropTarget;
2184
- }
2185
- reconnect() {
2186
- const e = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
2187
- e && this.disconnectDropTarget();
2188
- const r = this.dropTarget;
2189
- if (this.handlerId) {
2190
- if (!r) {
2191
- this.lastConnectedDropTarget = r;
2192
- return;
2193
- }
2194
- e && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDropTarget = r, this.lastConnectedDropTargetOptions = this.dropTargetOptions, this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, r, this.dropTargetOptions));
2195
- }
2196
- }
2197
- receiveHandlerId(e) {
2198
- e !== this.handlerId && (this.handlerId = e, this.reconnect());
2199
- }
2200
- get dropTargetOptions() {
2201
- return this.dropTargetOptionsInternal;
2202
- }
2203
- set dropTargetOptions(e) {
2204
- this.dropTargetOptionsInternal = e;
2205
- }
2206
- didHandlerIdChange() {
2207
- return this.lastConnectedHandlerId !== this.handlerId;
2208
- }
2209
- didDropTargetChange() {
2210
- return this.lastConnectedDropTarget !== this.dropTarget;
2211
- }
2212
- didOptionsChange() {
2213
- return !ye(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
2214
- }
2215
- disconnectDropTarget() {
2216
- this.unsubscribeDropTarget && (this.unsubscribeDropTarget(), this.unsubscribeDropTarget = void 0);
2217
- }
2218
- get dropTarget() {
2219
- return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
2220
- }
2221
- clearDropTarget() {
2222
- this.dropTargetRef = null, this.dropTargetNode = null;
2223
- }
2224
- constructor(e) {
2225
- this.hooks = at({
2226
- dropTarget: (r, n) => {
2227
- this.clearDropTarget(), this.dropTargetOptions = n, Se(r) ? this.dropTargetRef = r : this.dropTargetNode = r, this.reconnect();
2228
- }
2229
- }), this.handlerId = null, this.dropTargetRef = null, this.dropTargetOptionsInternal = null, this.lastConnectedHandlerId = null, this.lastConnectedDropTarget = null, this.lastConnectedDropTargetOptions = null, this.backend = e;
2230
- }
2231
- }
2232
- function K() {
2233
- const { dragDropManager: t } = Nt(Je);
2234
- return y(t != null, "Expected drag drop context"), t;
2235
- }
2236
- function kn(t, e) {
2237
- const r = K(), n = j(
2238
- () => new Mn(r.getBackend()),
2239
- [
2240
- r
2241
- ]
2242
- );
2243
- return V(() => (n.dragSourceOptions = t || null, n.reconnect(), () => n.disconnectDragSource()), [
2244
- n,
2245
- t
2246
- ]), V(() => (n.dragPreviewOptions = e || null, n.reconnect(), () => n.disconnectDragPreview()), [
2247
- n,
2248
- e
2249
- ]), n;
2250
- }
2251
- function An() {
2252
- const t = K();
2253
- return j(
2254
- () => new xn(t),
2255
- [
2256
- t
2257
- ]
2258
- );
2259
- }
2260
- class Hn {
2261
- beginDrag() {
2262
- const e = this.spec, r = this.monitor;
2263
- let n = null;
2264
- return typeof e.item == "object" ? n = e.item : typeof e.item == "function" ? n = e.item(r) : n = {}, n ?? null;
2265
- }
2266
- canDrag() {
2267
- const e = this.spec, r = this.monitor;
2268
- return typeof e.canDrag == "boolean" ? e.canDrag : typeof e.canDrag == "function" ? e.canDrag(r) : !0;
2269
- }
2270
- isDragging(e, r) {
2271
- const n = this.spec, i = this.monitor, { isDragging: s } = n;
2272
- return s ? s(i) : r === e.getSourceId();
2273
- }
2274
- endDrag() {
2275
- const e = this.spec, r = this.monitor, n = this.connector, { end: i } = e;
2276
- i && i(r.getItem(), r), n.reconnect();
2277
- }
2278
- constructor(e, r, n) {
2279
- this.spec = e, this.monitor = r, this.connector = n;
2280
- }
2281
- }
2282
- function Un(t, e, r) {
2283
- const n = j(
2284
- () => new Hn(t, e, r),
2285
- [
2286
- e,
2287
- r
2288
- ]
2289
- );
2290
- return R(() => {
2291
- n.spec = t;
2292
- }, [
2293
- t
2294
- ]), n;
2295
- }
2296
- function Yn(t) {
2297
- return j(() => {
2298
- const e = t.type;
2299
- return y(e != null, "spec.type must be defined"), e;
2300
- }, [
2301
- t
2302
- ]);
2303
- }
2304
- function Bn(t, e, r) {
2305
- const n = K(), i = Un(t, e, r), s = Yn(t);
2306
- V(function() {
2307
- if (s != null) {
2308
- const [o, u] = _n(s, i, n);
2309
- return e.receiveHandlerId(o), r.receiveHandlerId(o), u;
2310
- }
2311
- }, [
2312
- n,
2313
- e,
2314
- r,
2315
- i,
2316
- s
2317
- ]);
2318
- }
2319
- function $n(t, e) {
2320
- const r = ot(t);
2321
- y(!r.begin, "useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");
2322
- const n = An(), i = kn(r.options, r.previewOptions);
2323
- return Bn(r, n, i), [
2324
- st(r.collect, n, i),
2325
- Cn(i),
2326
- wn(i)
2327
- ];
2328
- }
2329
- function Vn(t) {
2330
- return j(
2331
- () => t.hooks.dropTarget(),
2332
- [
2333
- t
2334
- ]
2335
- );
2336
- }
2337
- function zn(t) {
2338
- const e = K(), r = j(
2339
- () => new Fn(e.getBackend()),
2340
- [
2341
- e
2342
- ]
2343
- );
2344
- return V(() => (r.dropTargetOptions = t || null, r.reconnect(), () => r.disconnectDropTarget()), [
2345
- t
2346
- ]), r;
2347
- }
2348
- function qn() {
2349
- const t = K();
2350
- return j(
2351
- () => new Nn(t),
2352
- [
2353
- t
2354
- ]
2355
- );
2356
- }
2357
- function Gn(t) {
2358
- const { accept: e } = t;
2359
- return j(() => (y(t.accept != null, "accept must be defined"), Array.isArray(e) ? e : [
2360
- e
2361
- ]), [
2362
- e
2363
- ]);
2364
- }
2365
- class Xn {
2366
- canDrop() {
2367
- const e = this.spec, r = this.monitor;
2368
- return e.canDrop ? e.canDrop(r.getItem(), r) : !0;
2369
- }
2370
- hover() {
2371
- const e = this.spec, r = this.monitor;
2372
- e.hover && e.hover(r.getItem(), r);
2373
- }
2374
- drop() {
2375
- const e = this.spec, r = this.monitor;
2376
- if (e.drop)
2377
- return e.drop(r.getItem(), r);
2378
- }
2379
- constructor(e, r) {
2380
- this.spec = e, this.monitor = r;
2381
- }
2382
- }
2383
- function Wn(t, e) {
2384
- const r = j(
2385
- () => new Xn(t, e),
2386
- [
2387
- e
2388
- ]
2389
- );
2390
- return R(() => {
2391
- r.spec = t;
2392
- }, [
2393
- t
2394
- ]), r;
2395
- }
2396
- function Kn(t, e, r) {
2397
- const n = K(), i = Wn(t, e), s = Gn(t);
2398
- V(function() {
2399
- const [o, u] = Pn(s, i, n);
2400
- return e.receiveHandlerId(o), r.receiveHandlerId(o), u;
2401
- }, [
2402
- n,
2403
- e,
2404
- i,
2405
- r,
2406
- s.map(
2407
- (a) => a.toString()
2408
- ).join("|")
2409
- ]);
2410
- }
2411
- function Jn(t, e) {
2412
- const r = ot(t), n = qn(), i = zn(r.options);
2413
- return Kn(r, n, i), [
2414
- st(r.collect, n, i),
2415
- Vn(i)
2416
- ];
2417
- }
2418
- function ct(t) {
2419
- let e = null;
2420
- return () => (e == null && (e = t()), e);
2421
- }
2422
- function Zn(t, e) {
2423
- return t.filter(
2424
- (r) => r !== e
2425
- );
2426
- }
2427
- function Qn(t, e) {
2428
- const r = /* @__PURE__ */ new Set(), n = (s) => r.add(s);
2429
- t.forEach(n), e.forEach(n);
2430
- const i = [];
2431
- return r.forEach(
2432
- (s) => i.push(s)
2433
- ), i;
2434
- }
2435
- class ei {
2436
- enter(e) {
2437
- const r = this.entered.length, n = (i) => this.isNodeInDocument(i) && (!i.contains || i.contains(e));
2438
- return this.entered = Qn(this.entered.filter(n), [
2439
- e
2440
- ]), r === 0 && this.entered.length > 0;
2441
- }
2442
- leave(e) {
2443
- const r = this.entered.length;
2444
- return this.entered = Zn(this.entered.filter(this.isNodeInDocument), e), r > 0 && this.entered.length === 0;
2445
- }
2446
- reset() {
2447
- this.entered = [];
2448
- }
2449
- constructor(e) {
2450
- this.entered = [], this.isNodeInDocument = e;
2451
- }
2452
- }
2453
- class ti {
2454
- initializeExposedProperties() {
2455
- Object.keys(this.config.exposeProperties).forEach((e) => {
2456
- Object.defineProperty(this.item, e, {
2457
- configurable: !0,
2458
- enumerable: !0,
2459
- get() {
2460
- return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`), null;
2461
- }
2462
- });
2463
- });
2464
- }
2465
- loadDataTransfer(e) {
2466
- if (e) {
2467
- const r = {};
2468
- Object.keys(this.config.exposeProperties).forEach((n) => {
2469
- const i = this.config.exposeProperties[n];
2470
- i != null && (r[n] = {
2471
- value: i(e, this.config.matchesTypes),
2472
- configurable: !0,
2473
- enumerable: !0
2474
- });
2475
- }), Object.defineProperties(this.item, r);
2476
- }
2477
- }
2478
- canDrag() {
2479
- return !0;
2480
- }
2481
- beginDrag() {
2482
- return this.item;
2483
- }
2484
- isDragging(e, r) {
2485
- return r === e.getSourceId();
2486
- }
2487
- endDrag() {
2488
- }
2489
- constructor(e) {
2490
- this.config = e, this.item = {}, this.initializeExposedProperties();
2491
- }
2492
- }
2493
- const ut = "__NATIVE_FILE__", lt = "__NATIVE_URL__", dt = "__NATIVE_TEXT__", ft = "__NATIVE_HTML__", $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2494
- __proto__: null,
2495
- FILE: ut,
2496
- HTML: ft,
2497
- TEXT: dt,
2498
- URL: lt
2499
- }, Symbol.toStringTag, { value: "Module" }));
2500
- function ge(t, e, r) {
2501
- const n = e.reduce(
2502
- (i, s) => i || t.getData(s),
2503
- ""
2504
- );
2505
- return n ?? r;
2506
- }
2507
- const Oe = {
2508
- [ut]: {
2509
- exposeProperties: {
2510
- files: (t) => Array.prototype.slice.call(t.files),
2511
- items: (t) => t.items,
2512
- dataTransfer: (t) => t
2513
- },
2514
- matchesTypes: [
2515
- "Files"
2516
- ]
2517
- },
2518
- [ft]: {
2519
- exposeProperties: {
2520
- html: (t, e) => ge(t, e, ""),
2521
- dataTransfer: (t) => t
2522
- },
2523
- matchesTypes: [
2524
- "Html",
2525
- "text/html"
2526
- ]
2527
- },
2528
- [lt]: {
2529
- exposeProperties: {
2530
- urls: (t, e) => ge(t, e, "").split(`
2531
- `),
2532
- dataTransfer: (t) => t
2533
- },
2534
- matchesTypes: [
2535
- "Url",
2536
- "text/uri-list"
2537
- ]
2538
- },
2539
- [dt]: {
2540
- exposeProperties: {
2541
- text: (t, e) => ge(t, e, ""),
2542
- dataTransfer: (t) => t
2543
- },
2544
- matchesTypes: [
2545
- "Text",
2546
- "text/plain"
2547
- ]
2548
- }
2549
- };
2550
- function ri(t, e) {
2551
- const r = Oe[t];
2552
- if (!r)
2553
- throw new Error(`native type ${t} has no configuration`);
2554
- const n = new ti(r);
2555
- return n.loadDataTransfer(e), n;
2556
- }
2557
- function he(t) {
2558
- if (!t)
2559
- return null;
2560
- const e = Array.prototype.slice.call(t.types || []);
2561
- return Object.keys(Oe).filter((r) => {
2562
- const n = Oe[r];
2563
- return n?.matchesTypes ? n.matchesTypes.some(
2564
- (i) => e.indexOf(i) > -1
2565
- ) : !1;
2566
- })[0] || null;
2567
- }
2568
- const ni = ct(
2569
- () => /firefox/i.test(navigator.userAgent)
2570
- ), gt = ct(
2571
- () => !!window.safari
2572
- );
2573
- class Ve {
2574
- interpolate(e) {
2575
- const { xs: r, ys: n, c1s: i, c2s: s, c3s: a } = this;
2576
- let o = r.length - 1;
2577
- if (e === r[o])
2578
- return n[o];
2579
- let u = 0, l = a.length - 1, p;
2580
- for (; u <= l; ) {
2581
- p = Math.floor(0.5 * (u + l));
2582
- const d = r[p];
2583
- if (d < e)
2584
- u = p + 1;
2585
- else if (d > e)
2586
- l = p - 1;
2587
- else
2588
- return n[p];
2589
- }
2590
- o = Math.max(0, l);
2591
- const m = e - r[o], g = m * m;
2592
- return n[o] + i[o] * m + s[o] * g + a[o] * m * g;
2593
- }
2594
- constructor(e, r) {
2595
- const { length: n } = e, i = [];
2596
- for (let d = 0; d < n; d++)
2597
- i.push(d);
2598
- i.sort(
2599
- (d, b) => e[d] < e[b] ? -1 : 1
2600
- );
2601
- const s = [], a = [];
2602
- let o, u;
2603
- for (let d = 0; d < n - 1; d++)
2604
- o = e[d + 1] - e[d], u = r[d + 1] - r[d], s.push(o), a.push(u / o);
2605
- const l = [
2606
- a[0]
2607
- ];
2608
- for (let d = 0; d < s.length - 1; d++) {
2609
- const b = a[d], D = a[d + 1];
2610
- if (b * D <= 0)
2611
- l.push(0);
2612
- else {
2613
- o = s[d];
2614
- const E = s[d + 1], v = o + E;
2615
- l.push(3 * v / ((v + E) / b + (v + o) / D));
2616
- }
2617
- }
2618
- l.push(a[a.length - 1]);
2619
- const p = [], m = [];
2620
- let g;
2621
- for (let d = 0; d < l.length - 1; d++) {
2622
- g = a[d];
2623
- const b = l[d], D = 1 / s[d], E = b + l[d + 1] - g - g;
2624
- p.push((g - b - E) * D), m.push(E * D * D);
2625
- }
2626
- this.xs = e, this.ys = r, this.c1s = l, this.c2s = p, this.c3s = m;
2627
- }
2628
- }
2629
- const ii = 1;
2630
- function ht(t) {
2631
- const e = t.nodeType === ii ? t : t.parentElement;
2632
- if (!e)
2633
- return null;
2634
- const { top: r, left: n } = e.getBoundingClientRect();
2635
- return {
2636
- x: n,
2637
- y: r
2638
- };
2639
- }
2640
- function re(t) {
2641
- return {
2642
- x: t.clientX,
2643
- y: t.clientY
2644
- };
2645
- }
2646
- function si(t) {
2647
- var e;
2648
- return t.nodeName === "IMG" && (ni() || !(!((e = document.documentElement) === null || e === void 0) && e.contains(t)));
2649
- }
2650
- function oi(t, e, r, n) {
2651
- let i = t ? e.width : r, s = t ? e.height : n;
2652
- return gt() && t && (s /= window.devicePixelRatio, i /= window.devicePixelRatio), {
2653
- dragPreviewWidth: i,
2654
- dragPreviewHeight: s
2655
- };
2656
- }
2657
- function ai(t, e, r, n, i) {
2658
- const s = si(e), o = ht(s ? t : e), u = {
2659
- x: r.x - o.x,
2660
- y: r.y - o.y
2661
- }, { offsetWidth: l, offsetHeight: p } = t, { anchorX: m, anchorY: g } = n, { dragPreviewWidth: d, dragPreviewHeight: b } = oi(s, e, l, p), D = () => {
2662
- let S = new Ve([
2663
- 0,
2664
- 0.5,
2665
- 1
2666
- ], [
2667
- // Dock to the top
2668
- u.y,
2669
- // Align at the center
2670
- u.y / p * b,
2671
- // Dock to the bottom
2672
- u.y + b - p
2673
- ]).interpolate(g);
2674
- return gt() && s && (S += (window.devicePixelRatio - 1) * b), S;
2675
- }, E = () => new Ve([
2676
- 0,
2677
- 0.5,
2678
- 1
2679
- ], [
2680
- // Dock to the left
2681
- u.x,
2682
- // Align at the center
2683
- u.x / l * d,
2684
- // Dock to the right
2685
- u.x + d - l
2686
- ]).interpolate(m), { offsetX: v, offsetY: h } = i, I = v === 0 || v, f = h === 0 || h;
2687
- return {
2688
- x: I ? v : E(),
2689
- y: f ? h : D()
2690
- };
2691
- }
2692
- class ci {
2693
- get window() {
2694
- if (this.globalContext)
2695
- return this.globalContext;
2696
- if (typeof window < "u")
2697
- return window;
2698
- }
2699
- get document() {
2700
- var e;
2701
- return !((e = this.globalContext) === null || e === void 0) && e.document ? this.globalContext.document : this.window ? this.window.document : void 0;
2702
- }
2703
- get rootElement() {
2704
- var e;
2705
- return ((e = this.optionsArgs) === null || e === void 0 ? void 0 : e.rootElement) || this.window;
2706
- }
2707
- constructor(e, r) {
2708
- this.ownerDocument = null, this.globalContext = e, this.optionsArgs = r;
2709
- }
2710
- }
2711
- function ui(t, e, r) {
2712
- return e in t ? Object.defineProperty(t, e, {
2713
- value: r,
2714
- enumerable: !0,
2715
- configurable: !0,
2716
- writable: !0
2717
- }) : t[e] = r, t;
2718
- }
2719
- function ze(t) {
2720
- for (var e = 1; e < arguments.length; e++) {
2721
- var r = arguments[e] != null ? arguments[e] : {}, n = Object.keys(r);
2722
- typeof Object.getOwnPropertySymbols == "function" && (n = n.concat(Object.getOwnPropertySymbols(r).filter(function(i) {
2723
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
2724
- }))), n.forEach(function(i) {
2725
- ui(t, i, r[i]);
2726
- });
2727
- }
2728
- return t;
2729
- }
2730
- class li {
2731
- /**
2732
- * Generate profiling statistics for the HTML5Backend.
2733
- */
2734
- profile() {
2735
- var e, r;
2736
- return {
2737
- sourcePreviewNodes: this.sourcePreviewNodes.size,
2738
- sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size,
2739
- sourceNodeOptions: this.sourceNodeOptions.size,
2740
- sourceNodes: this.sourceNodes.size,
2741
- dragStartSourceIds: ((e = this.dragStartSourceIds) === null || e === void 0 ? void 0 : e.length) || 0,
2742
- dropTargetIds: this.dropTargetIds.length,
2743
- dragEnterTargetIds: this.dragEnterTargetIds.length,
2744
- dragOverTargetIds: ((r = this.dragOverTargetIds) === null || r === void 0 ? void 0 : r.length) || 0
2745
- };
2746
- }
2747
- // public for test
2748
- get window() {
2749
- return this.options.window;
2750
- }
2751
- get document() {
2752
- return this.options.document;
2753
- }
2754
- /**
2755
- * Get the root element to use for event subscriptions
2756
- */
2757
- get rootElement() {
2758
- return this.options.rootElement;
2759
- }
2760
- setup() {
2761
- const e = this.rootElement;
2762
- if (e !== void 0) {
2763
- if (e.__isReactDndBackendSetUp)
2764
- throw new Error("Cannot have two HTML5 backends at the same time.");
2765
- e.__isReactDndBackendSetUp = !0, this.addEventListeners(e);
2766
- }
2767
- }
2768
- teardown() {
2769
- const e = this.rootElement;
2770
- if (e !== void 0 && (e.__isReactDndBackendSetUp = !1, this.removeEventListeners(this.rootElement), this.clearCurrentDragSourceNode(), this.asyncEndDragFrameId)) {
2771
- var r;
2772
- (r = this.window) === null || r === void 0 || r.cancelAnimationFrame(this.asyncEndDragFrameId);
2773
- }
2774
- }
2775
- connectDragPreview(e, r, n) {
2776
- return this.sourcePreviewNodeOptions.set(e, n), this.sourcePreviewNodes.set(e, r), () => {
2777
- this.sourcePreviewNodes.delete(e), this.sourcePreviewNodeOptions.delete(e);
2778
- };
2779
- }
2780
- connectDragSource(e, r, n) {
2781
- this.sourceNodes.set(e, r), this.sourceNodeOptions.set(e, n);
2782
- const i = (a) => this.handleDragStart(a, e), s = (a) => this.handleSelectStart(a);
2783
- return r.setAttribute("draggable", "true"), r.addEventListener("dragstart", i), r.addEventListener("selectstart", s), () => {
2784
- this.sourceNodes.delete(e), this.sourceNodeOptions.delete(e), r.removeEventListener("dragstart", i), r.removeEventListener("selectstart", s), r.setAttribute("draggable", "false");
2785
- };
2786
- }
2787
- connectDropTarget(e, r) {
2788
- const n = (a) => this.handleDragEnter(a, e), i = (a) => this.handleDragOver(a, e), s = (a) => this.handleDrop(a, e);
2789
- return r.addEventListener("dragenter", n), r.addEventListener("dragover", i), r.addEventListener("drop", s), () => {
2790
- r.removeEventListener("dragenter", n), r.removeEventListener("dragover", i), r.removeEventListener("drop", s);
2791
- };
2792
- }
2793
- addEventListeners(e) {
2794
- e.addEventListener && (e.addEventListener("dragstart", this.handleTopDragStart), e.addEventListener("dragstart", this.handleTopDragStartCapture, !0), e.addEventListener("dragend", this.handleTopDragEndCapture, !0), e.addEventListener("dragenter", this.handleTopDragEnter), e.addEventListener("dragenter", this.handleTopDragEnterCapture, !0), e.addEventListener("dragleave", this.handleTopDragLeaveCapture, !0), e.addEventListener("dragover", this.handleTopDragOver), e.addEventListener("dragover", this.handleTopDragOverCapture, !0), e.addEventListener("drop", this.handleTopDrop), e.addEventListener("drop", this.handleTopDropCapture, !0));
2795
- }
2796
- removeEventListeners(e) {
2797
- e.removeEventListener && (e.removeEventListener("dragstart", this.handleTopDragStart), e.removeEventListener("dragstart", this.handleTopDragStartCapture, !0), e.removeEventListener("dragend", this.handleTopDragEndCapture, !0), e.removeEventListener("dragenter", this.handleTopDragEnter), e.removeEventListener("dragenter", this.handleTopDragEnterCapture, !0), e.removeEventListener("dragleave", this.handleTopDragLeaveCapture, !0), e.removeEventListener("dragover", this.handleTopDragOver), e.removeEventListener("dragover", this.handleTopDragOverCapture, !0), e.removeEventListener("drop", this.handleTopDrop), e.removeEventListener("drop", this.handleTopDropCapture, !0));
2798
- }
2799
- getCurrentSourceNodeOptions() {
2800
- const e = this.monitor.getSourceId(), r = this.sourceNodeOptions.get(e);
2801
- return ze({
2802
- dropEffect: this.altKeyPressed ? "copy" : "move"
2803
- }, r || {});
2804
- }
2805
- getCurrentDropEffect() {
2806
- return this.isDraggingNativeItem() ? "copy" : this.getCurrentSourceNodeOptions().dropEffect;
2807
- }
2808
- getCurrentSourcePreviewNodeOptions() {
2809
- const e = this.monitor.getSourceId(), r = this.sourcePreviewNodeOptions.get(e);
2810
- return ze({
2811
- anchorX: 0.5,
2812
- anchorY: 0.5,
2813
- captureDraggingState: !1
2814
- }, r || {});
2815
- }
2816
- isDraggingNativeItem() {
2817
- const e = this.monitor.getItemType();
2818
- return Object.keys($e).some(
2819
- (r) => $e[r] === e
2820
- );
2821
- }
2822
- beginDragNativeItem(e, r) {
2823
- this.clearCurrentDragSourceNode(), this.currentNativeSource = ri(e, r), this.currentNativeHandle = this.registry.addSource(e, this.currentNativeSource), this.actions.beginDrag([
2824
- this.currentNativeHandle
2825
- ]);
2826
- }
2827
- setCurrentDragSourceNode(e) {
2828
- this.clearCurrentDragSourceNode(), this.currentDragSourceNode = e;
2829
- const r = 1e3;
2830
- this.mouseMoveTimeoutTimer = setTimeout(() => {
2831
- var n;
2832
- return (n = this.rootElement) === null || n === void 0 ? void 0 : n.addEventListener("mousemove", this.endDragIfSourceWasRemovedFromDOM, !0);
2833
- }, r);
2834
- }
2835
- clearCurrentDragSourceNode() {
2836
- if (this.currentDragSourceNode) {
2837
- if (this.currentDragSourceNode = null, this.rootElement) {
2838
- var e;
2839
- (e = this.window) === null || e === void 0 || e.clearTimeout(this.mouseMoveTimeoutTimer || void 0), this.rootElement.removeEventListener("mousemove", this.endDragIfSourceWasRemovedFromDOM, !0);
2840
- }
2841
- return this.mouseMoveTimeoutTimer = null, !0;
2842
- }
2843
- return !1;
2844
- }
2845
- handleDragStart(e, r) {
2846
- e.defaultPrevented || (this.dragStartSourceIds || (this.dragStartSourceIds = []), this.dragStartSourceIds.unshift(r));
2847
- }
2848
- handleDragEnter(e, r) {
2849
- this.dragEnterTargetIds.unshift(r);
2850
- }
2851
- handleDragOver(e, r) {
2852
- this.dragOverTargetIds === null && (this.dragOverTargetIds = []), this.dragOverTargetIds.unshift(r);
2853
- }
2854
- handleDrop(e, r) {
2855
- this.dropTargetIds.unshift(r);
2856
- }
2857
- constructor(e, r, n) {
2858
- this.sourcePreviewNodes = /* @__PURE__ */ new Map(), this.sourcePreviewNodeOptions = /* @__PURE__ */ new Map(), this.sourceNodes = /* @__PURE__ */ new Map(), this.sourceNodeOptions = /* @__PURE__ */ new Map(), this.dragStartSourceIds = null, this.dropTargetIds = [], this.dragEnterTargetIds = [], this.currentNativeSource = null, this.currentNativeHandle = null, this.currentDragSourceNode = null, this.altKeyPressed = !1, this.mouseMoveTimeoutTimer = null, this.asyncEndDragFrameId = null, this.dragOverTargetIds = null, this.lastClientOffset = null, this.hoverRafId = null, this.getSourceClientOffset = (i) => {
2859
- const s = this.sourceNodes.get(i);
2860
- return s && ht(s) || null;
2861
- }, this.endDragNativeItem = () => {
2862
- this.isDraggingNativeItem() && (this.actions.endDrag(), this.currentNativeHandle && this.registry.removeSource(this.currentNativeHandle), this.currentNativeHandle = null, this.currentNativeSource = null);
2863
- }, this.isNodeInDocument = (i) => !!(i && this.document && this.document.body && this.document.body.contains(i)), this.endDragIfSourceWasRemovedFromDOM = () => {
2864
- const i = this.currentDragSourceNode;
2865
- i == null || this.isNodeInDocument(i) || (this.clearCurrentDragSourceNode() && this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover());
2866
- }, this.scheduleHover = (i) => {
2867
- this.hoverRafId === null && typeof requestAnimationFrame < "u" && (this.hoverRafId = requestAnimationFrame(() => {
2868
- this.monitor.isDragging() && this.actions.hover(i || [], {
2869
- clientOffset: this.lastClientOffset
2870
- }), this.hoverRafId = null;
2871
- }));
2872
- }, this.cancelHover = () => {
2873
- this.hoverRafId !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(this.hoverRafId), this.hoverRafId = null);
2874
- }, this.handleTopDragStartCapture = () => {
2875
- this.clearCurrentDragSourceNode(), this.dragStartSourceIds = [];
2876
- }, this.handleTopDragStart = (i) => {
2877
- if (i.defaultPrevented)
2878
- return;
2879
- const { dragStartSourceIds: s } = this;
2880
- this.dragStartSourceIds = null;
2881
- const a = re(i);
2882
- this.monitor.isDragging() && (this.actions.endDrag(), this.cancelHover()), this.actions.beginDrag(s || [], {
2883
- publishSource: !1,
2884
- getSourceClientOffset: this.getSourceClientOffset,
2885
- clientOffset: a
2886
- });
2887
- const { dataTransfer: o } = i, u = he(o);
2888
- if (this.monitor.isDragging()) {
2889
- if (o && typeof o.setDragImage == "function") {
2890
- const p = this.monitor.getSourceId(), m = this.sourceNodes.get(p), g = this.sourcePreviewNodes.get(p) || m;
2891
- if (g) {
2892
- const { anchorX: d, anchorY: b, offsetX: D, offsetY: E } = this.getCurrentSourcePreviewNodeOptions(), I = ai(m, g, a, {
2893
- anchorX: d,
2894
- anchorY: b
2895
- }, {
2896
- offsetX: D,
2897
- offsetY: E
2898
- });
2899
- o.setDragImage(g, I.x, I.y);
2900
- }
2901
- }
2902
- try {
2903
- o?.setData("application/json", {});
2904
- } catch {
2905
- }
2906
- this.setCurrentDragSourceNode(i.target);
2907
- const { captureDraggingState: l } = this.getCurrentSourcePreviewNodeOptions();
2908
- l ? this.actions.publishDragSource() : setTimeout(
2909
- () => this.actions.publishDragSource(),
2910
- 0
2911
- );
2912
- } else if (u)
2913
- this.beginDragNativeItem(u);
2914
- else {
2915
- if (o && !o.types && (i.target && !i.target.hasAttribute || !i.target.hasAttribute("draggable")))
2916
- return;
2917
- i.preventDefault();
2918
- }
2919
- }, this.handleTopDragEndCapture = () => {
2920
- this.clearCurrentDragSourceNode() && this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover();
2921
- }, this.handleTopDragEnterCapture = (i) => {
2922
- if (this.dragEnterTargetIds = [], this.isDraggingNativeItem()) {
2923
- var s;
2924
- (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(i.dataTransfer);
2925
- }
2926
- if (!this.enterLeaveCounter.enter(i.target) || this.monitor.isDragging())
2927
- return;
2928
- const { dataTransfer: o } = i, u = he(o);
2929
- u && this.beginDragNativeItem(u, o);
2930
- }, this.handleTopDragEnter = (i) => {
2931
- const { dragEnterTargetIds: s } = this;
2932
- if (this.dragEnterTargetIds = [], !this.monitor.isDragging())
2933
- return;
2934
- this.altKeyPressed = i.altKey, s.length > 0 && this.actions.hover(s, {
2935
- clientOffset: re(i)
2936
- }), s.some(
2937
- (o) => this.monitor.canDropOnTarget(o)
2938
- ) && (i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = this.getCurrentDropEffect()));
2939
- }, this.handleTopDragOverCapture = (i) => {
2940
- if (this.dragOverTargetIds = [], this.isDraggingNativeItem()) {
2941
- var s;
2942
- (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(i.dataTransfer);
2943
- }
2944
- }, this.handleTopDragOver = (i) => {
2945
- const { dragOverTargetIds: s } = this;
2946
- if (this.dragOverTargetIds = [], !this.monitor.isDragging()) {
2947
- i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = "none");
2948
- return;
2949
- }
2950
- this.altKeyPressed = i.altKey, this.lastClientOffset = re(i), this.scheduleHover(s), (s || []).some(
2951
- (o) => this.monitor.canDropOnTarget(o)
2952
- ) ? (i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = this.getCurrentDropEffect())) : this.isDraggingNativeItem() ? i.preventDefault() : (i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = "none"));
2953
- }, this.handleTopDragLeaveCapture = (i) => {
2954
- this.isDraggingNativeItem() && i.preventDefault(), this.enterLeaveCounter.leave(i.target) && (this.isDraggingNativeItem() && setTimeout(
2955
- () => this.endDragNativeItem(),
2956
- 0
2957
- ), this.cancelHover());
2958
- }, this.handleTopDropCapture = (i) => {
2959
- if (this.dropTargetIds = [], this.isDraggingNativeItem()) {
2960
- var s;
2961
- i.preventDefault(), (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(i.dataTransfer);
2962
- } else he(i.dataTransfer) && i.preventDefault();
2963
- this.enterLeaveCounter.reset();
2964
- }, this.handleTopDrop = (i) => {
2965
- const { dropTargetIds: s } = this;
2966
- this.dropTargetIds = [], this.actions.hover(s, {
2967
- clientOffset: re(i)
2968
- }), this.actions.drop({
2969
- dropEffect: this.getCurrentDropEffect()
2970
- }), this.isDraggingNativeItem() ? this.endDragNativeItem() : this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover();
2971
- }, this.handleSelectStart = (i) => {
2972
- const s = i.target;
2973
- typeof s.dragDrop == "function" && (s.tagName === "INPUT" || s.tagName === "SELECT" || s.tagName === "TEXTAREA" || s.isContentEditable || (i.preventDefault(), s.dragDrop()));
2974
- }, this.options = new ci(r, n), this.actions = e.getActions(), this.monitor = e.getMonitor(), this.registry = e.getRegistry(), this.enterLeaveCounter = new ei(this.isNodeInDocument);
2975
- }
2976
- }
2977
- const di = function(e, r, n) {
2978
- return new li(e, r, n);
2979
- }, fi = [
2980
- ".pdf",
2981
- ".xlsx",
2982
- ".xls",
2983
- ".docx",
2984
- ".doc",
2985
- ".pptx",
2986
- ".ppt",
2987
- ".hwp",
2988
- ".txt",
2989
- ".csv",
2990
- // 이미지
2991
- ".jpg",
2992
- ".jpeg",
2993
- ".png",
2994
- ".gif",
2995
- // 압축
2996
- ".zip"
2997
- ], qe = {
2998
- FILE: "file"
2999
- }, gi = ({
3000
- originNode: t,
3001
- file: e,
3002
- fileList: r,
3003
- moveFile: n,
3004
- onDrop: i
3005
- }) => {
3006
- const s = $(null), [{ handlerId: a }, o] = Jn({
3007
- accept: qe.FILE,
3008
- collect: (m) => ({
3009
- handlerId: m.getHandlerId()
3010
- }),
3011
- hover(m, g) {
3012
- if (!s.current)
3013
- return;
3014
- const d = m.uid, b = e.uid;
3015
- if (d === b)
3016
- return;
3017
- const D = J(r, { uid: b }), E = J(r, { uid: d });
3018
- if (E === -1 || D === -1)
3019
- return;
3020
- const v = s.current.getBoundingClientRect(), h = g.getClientOffset();
3021
- if (!h)
3022
- return;
3023
- const I = (v.bottom - v.top) / 2, f = h.y - v.top;
3024
- E < D && f < I || E > D && f > I || n(d, b);
3025
- },
3026
- drop() {
3027
- i();
3028
- }
3029
- }), [{ isDragging: u }, l] = $n({
3030
- type: qe.FILE,
3031
- item: () => ({
3032
- uid: e.uid,
3033
- index: J(r, { uid: e.uid })
3034
- }),
3035
- collect: (m) => ({
3036
- isDragging: m.isDragging()
3037
- })
3038
- }), p = u ? 0 : 1;
3039
- return l(o(s)), /* @__PURE__ */ c.jsx("div", { ref: s, style: { opacity: p }, "data-handler-id": a, children: t });
3040
- }, ki = ({
3041
- fileGrpKey: t,
3042
- onUploadComplete: e,
3043
- onFetchFilesTrxCd: r = "SCMFILE00101",
3044
- onSuccessTrxCd: n = "SCMFILE00102",
3045
- onDeleteFileTrxCd: i = "SCMFILE00103",
3046
- onReorderFilesTrxCd: s = "SCMFILE00104",
3047
- allowedExtensions: a = fi,
3048
- maxFileSize: o = 200,
3049
- showButton: u = !0,
3050
- // 기본값으로 true 설정
3051
- multiple: l = !1
3052
- }) => {
3053
- const [p, m] = L([]), g = $(t), d = $([]), D = $(
3054
- Ut(() => {
3055
- if (d.current.length === 0)
3056
- return;
3057
- const f = [...d.current];
3058
- if (d.current = [], n) {
3059
- const T = f.map((S) => ({
3060
- crprCd: A()?.crprCd,
3061
- sysCd: __SYS_CD__,
3062
- fileGrpKey: g.current,
3063
- physFileNm: S.fileNameP,
3064
- lgclFileNm: S.fileNameL,
3065
- filePath: S.filePath,
3066
- fileExtn: S.fileExt,
3067
- fileSize: S.fileSize,
3068
- mltpYn: "N"
3069
- }));
3070
- U(n, {
3071
- crprCd: A()?.crprCd,
3072
- sysCd: __SYS_CD__,
3073
- fileGrpKey: g.current,
3074
- sub: T
3075
- }).then((S) => {
3076
- if (S?.sub && S.sub.length > 0) {
3077
- const O = S.sub[0].fileGrpKey;
3078
- g.current || (g.current = O);
3079
- const x = /* @__PURE__ */ new Map();
3080
- S.sub.forEach((C) => {
3081
- const N = f.find(
3082
- (_) => _.fileNameL === C.lgclFileNm
3083
- );
3084
- N && x.set(N.tempId, C);
3085
- }), m((C) => C.map((_) => {
3086
- const w = x.get(_.uid);
3087
- if (w) {
3088
- const z = f.find(
3089
- (q) => q.tempId === _.uid
3090
- );
3091
- return e && z && e({
3092
- ...z,
3093
- fileGrpKey: O,
3094
- fileKey: w.fileKey
3095
- }), {
3096
- ..._,
3097
- name: w.lgclFileNm,
3098
- fileGrpKey: O,
3099
- fileKey: w.fileKey,
3100
- uid: w.fileKey,
3101
- status: "done",
3102
- url: `/api/download?filePath=${w.filePath}&logicalName=${w.lgclFileNm}`
3103
- };
3104
- }
3105
- return _;
3106
- }));
3107
- }
3108
- }).catch((S) => {
3109
- console.error("업로드 후처리 서비스 호출 실패:", S), P.error("파일 후처리 중 오류가 발생했습니다.");
3110
- const O = new Set(f.map((x) => x.tempId));
3111
- m(
3112
- (x) => x.map(
3113
- (C) => O.has(C.uid) ? { ...C, status: "error", error: "후처리 실패" } : C
3114
- )
3115
- );
3116
- });
3117
- }
3118
- }, 500)
3119
- ).current;
3120
- R(() => () => {
3121
- D.cancel();
3122
- }, [D]), R(() => {
3123
- g.current = t;
3124
- }, [t]), R(() => {
3125
- t && r && U(r, {
3126
- crprCd: A()?.crprCd,
3127
- sysCd: __SYS_CD__,
3128
- fileGrpKey: t
3129
- }).then((f) => {
3130
- if (f?.sub) {
3131
- const T = f.sub.map((S) => ({
3132
- uid: S.fileKey,
3133
- name: S.lgclFileNm,
3134
- status: "done",
3135
- url: `/api/download?filePath=${S.filePath}&logicalName=${S.lgclFileNm}`
3136
- }));
3137
- m(T);
3138
- }
3139
- }).catch((f) => {
3140
- console.error("파일 목록 조회 서비스 호출에 실패했습니다.", f), P.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
3141
- });
3142
- }, [t, r]);
3143
- const E = (f, T) => {
3144
- const S = J(p, { uid: f }), O = J(p, { uid: T });
3145
- if (S < 0 || O < 0) return;
3146
- const x = [...p], [C] = x.splice(S, 1);
3147
- x.splice(O, 0, C), m(x);
3148
- }, v = () => {
3149
- if (t && s) {
3150
- const f = p.map((T) => T.uid);
3151
- U(s, {
3152
- crprCd: A()?.crprCd,
3153
- sysCd: __SYS_CD__,
3154
- fileGrpKey: t,
3155
- reorderedFileKeys: f
3156
- }).then(() => {
3157
- P.success("파일 순서가 성공적으로 저장되었습니다.");
3158
- }).catch((T) => {
3159
- console.error("파일 순서 저장 서비스 호출 실패:", T), P.error("파일 순서 저장 중 오류가 발생했습니다.");
3160
- });
3161
- }
3162
- }, I = {
3163
- name: "file",
3164
- multiple: l,
3165
- action: "/api/upload",
3166
- fileList: p,
3167
- beforeUpload: (f) => {
3168
- if (!l && p.length > 0)
3169
- return P.error("하나의 파일만 업로드할 수 있습니다."), H.LIST_IGNORE;
3170
- if (a && a.length > 0) {
3171
- const T = `.${f.name.split(".").pop()?.toLowerCase()}`;
3172
- if (!a.includes(T))
3173
- return P.error(
3174
- `${f.name} 파일은 허용되지 않는 확장자입니다. (${a.join(
3175
- ", "
3176
- )})`
3177
- ), H.LIST_IGNORE;
3178
- }
3179
- return o && !(f.size / 1024 / 1024 < o) ? (P.error(`일반업로드의 최대용량은 ${o}MB입니다.`), H.LIST_IGNORE) : !0;
3180
- },
3181
- showUploadList: {
3182
- showRemoveIcon: u
3183
- // showButton 값에 따라 삭제 버튼 표시/숨김
3184
- },
3185
- onChange(f) {
3186
- const { status: T, uid: S } = f.file;
3187
- if (T === "removed") {
3188
- i ? U(i, {
3189
- crprCd: A()?.crprCd,
3190
- sysCd: __SYS_CD__,
3191
- fileGrpKey: g.current,
3192
- fileKey: S
3193
- }).then(() => {
3194
- P.success("파일이 성공적으로 삭제되었습니다."), m(f.fileList);
3195
- }).catch((O) => {
3196
- console.error("파일 삭제 서비스 호출에 실패했습니다.", O), P.error("파일 삭제 중 오류가 발생했습니다.");
3197
- }) : m(f.fileList);
3198
- return;
3199
- }
3200
- if (m(f.fileList), T === "done")
3201
- if (f.file.response?.success) {
3202
- const { uploadedFiles: O } = f.file.response;
3203
- O && Array.isArray(O) && O.length > 0 && (O.forEach((x) => {
3204
- x.tempId = f.file.uid, d.current.push(x);
3205
- }), D()), P.success(
3206
- f.file.response.message || `${f.file.name} 파일이 성공적으로 업로드되었습니다.`
3207
- );
3208
- } else
3209
- P.error(
3210
- f.file.response?.message || `${f.file.name} 파일 업로드에 실패했습니다.`
3211
- );
3212
- else T === "error" && P.error(
3213
- f.file.response?.message || `${f.file.name} 파일 업로드 중 오류가 발생했습니다.`
3214
- );
3215
- },
3216
- itemRender(f, T, S) {
3217
- const O = me(f, {
3218
- href: T.url || void 0,
3219
- title: void 0
3220
- });
3221
- return /* @__PURE__ */ c.jsx(
3222
- gi,
3223
- {
3224
- originNode: O,
3225
- file: T,
3226
- fileList: S,
3227
- moveFile: E,
3228
- onDrop: v
3229
- },
3230
- T.uid
3231
- );
3232
- }
3233
- };
3234
- return /* @__PURE__ */ c.jsx(Dn, { backend: di, children: /* @__PURE__ */ c.jsx(H, { headers: { SYSCD: __SYS_CD__ }, ...I, listType: "picture", children: u && (l || p.length === 0) && /* @__PURE__ */ c.jsx(Y, { icon: /* @__PURE__ */ c.jsx(We, {}), children: "파일 선택" }) }) });
3235
- };
3236
- export {
3237
- Ei as B,
3238
- Ci as a,
3239
- wi as b,
3240
- Ni as c,
3241
- Pi as d,
3242
- _i as e,
3243
- Ri as f,
3244
- Li as g,
3245
- ji as h,
3246
- Mi as i,
3247
- Fi as j,
3248
- ki as k
3249
- };
3250
- //# sourceMappingURL=BwgUploader-DBFF9BPF.js.map