@bwg-ui/core 1.1.26 → 1.1.28

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 (116) hide show
  1. package/dist/chunks/common-components-3AGyXNkY.cjs +183 -0
  2. package/dist/chunks/common-components-CSaGU_Fk.js +15782 -0
  3. package/dist/chunks/{core-BBMCFpHx.js → core-CTXWuoUa.js} +1 -2
  4. package/dist/chunks/core-Cp0Uyip7.cjs +1 -0
  5. package/dist/chunks/{enc-base64-DAsYWbA2.js → enc-base64-ClENPele.js} +4 -5
  6. package/dist/chunks/enc-base64-CvKQ-yW8.cjs +1 -0
  7. package/dist/chunks/sha256-Dl_QPg4b.cjs +1 -0
  8. package/dist/chunks/{sha256-D80RpYO2.js → sha256-DxfJD4fu.js} +12 -13
  9. package/dist/components/common/BwgEditor.d.ts.map +1 -1
  10. package/dist/components/common/BwgPagination.d.ts +1 -1
  11. package/dist/components/common/BwgPagination.d.ts.map +1 -1
  12. package/dist/components/common/index.cjs +1 -2
  13. package/dist/components/common/index.d.ts +3 -1
  14. package/dist/components/common/index.d.ts.map +1 -1
  15. package/dist/components/common/index.js +16 -17
  16. package/dist/components/core/index.cjs +1 -2
  17. package/dist/components/core/index.js +1218 -23
  18. package/dist/components/guide/index.cjs +1 -2
  19. package/dist/components/guide/index.js +1 -2
  20. package/dist/components/layout/index.cjs +35 -2
  21. package/dist/components/layout/index.js +350 -10
  22. package/dist/components/popup/MenuReport.d.ts.map +1 -1
  23. package/dist/index.cjs +1 -2
  24. package/dist/index.js +211 -222
  25. package/dist/provider/index.cjs +1 -2
  26. package/dist/provider/index.js +384 -25
  27. package/dist/stores/index.cjs +2 -2
  28. package/dist/stores/index.js +1394 -24
  29. package/dist/utils/index.cjs +1 -2
  30. package/dist/utils/index.js +1369 -200
  31. package/package.json +1 -1
  32. package/dist/chunks/AuthContext-BQ3gHLbr.cjs +0 -2
  33. package/dist/chunks/AuthContext-BQ3gHLbr.cjs.map +0 -1
  34. package/dist/chunks/AuthContext-CVizgYxY.js +0 -57
  35. package/dist/chunks/AuthContext-CVizgYxY.js.map +0 -1
  36. package/dist/chunks/BwgSpace-BPJARdOc.js +0 -27
  37. package/dist/chunks/BwgSpace-BPJARdOc.js.map +0 -1
  38. package/dist/chunks/BwgSpace-Cw27d-XU.cjs +0 -2
  39. package/dist/chunks/BwgSpace-Cw27d-XU.cjs.map +0 -1
  40. package/dist/chunks/BwgSwitch-BLtVdW44.cjs +0 -2
  41. package/dist/chunks/BwgSwitch-BLtVdW44.cjs.map +0 -1
  42. package/dist/chunks/BwgSwitch-DdHo4gYR.js +0 -269
  43. package/dist/chunks/BwgSwitch-DdHo4gYR.js.map +0 -1
  44. package/dist/chunks/BwgUploader-BUmFmeuS.js +0 -3250
  45. package/dist/chunks/BwgUploader-BUmFmeuS.js.map +0 -1
  46. package/dist/chunks/BwgUploader-Djhl4lIt.cjs +0 -3
  47. package/dist/chunks/BwgUploader-Djhl4lIt.cjs.map +0 -1
  48. package/dist/chunks/LoadingOverlay-Uf6xy04v.js +0 -19
  49. package/dist/chunks/LoadingOverlay-Uf6xy04v.js.map +0 -1
  50. package/dist/chunks/LoadingOverlay-jdMzdB-z.cjs +0 -2
  51. package/dist/chunks/LoadingOverlay-jdMzdB-z.cjs.map +0 -1
  52. package/dist/chunks/SSOHandler-CR0nR3rJ.js +0 -28654
  53. package/dist/chunks/SSOHandler-CR0nR3rJ.js.map +0 -1
  54. package/dist/chunks/SSOHandler-DQG0Jp4V.cjs +0 -237
  55. package/dist/chunks/SSOHandler-DQG0Jp4V.cjs.map +0 -1
  56. package/dist/chunks/ScreenProtectContext-BMsPPcTX.js +0 -154
  57. package/dist/chunks/ScreenProtectContext-BMsPPcTX.js.map +0 -1
  58. package/dist/chunks/ScreenProtectContext-DrCGlcTs.cjs +0 -2
  59. package/dist/chunks/ScreenProtectContext-DrCGlcTs.cjs.map +0 -1
  60. package/dist/chunks/SearchBoxContext-DY6lES-W.cjs +0 -2
  61. package/dist/chunks/SearchBoxContext-DY6lES-W.cjs.map +0 -1
  62. package/dist/chunks/SearchBoxContext-Dtzo_rJd.js +0 -86
  63. package/dist/chunks/SearchBoxContext-Dtzo_rJd.js.map +0 -1
  64. package/dist/chunks/ViewContainer-BfiTFvLP.cjs +0 -36
  65. package/dist/chunks/ViewContainer-BfiTFvLP.cjs.map +0 -1
  66. package/dist/chunks/ViewContainer-CTl3_56W.js +0 -338
  67. package/dist/chunks/ViewContainer-CTl3_56W.js.map +0 -1
  68. package/dist/chunks/apiUtils-D9Vn1gwZ.cjs +0 -3
  69. package/dist/chunks/apiUtils-D9Vn1gwZ.cjs.map +0 -1
  70. package/dist/chunks/apiUtils-DPUgfmKk.js +0 -1450
  71. package/dist/chunks/apiUtils-DPUgfmKk.js.map +0 -1
  72. package/dist/chunks/codeStore-BrCfe9K3.js +0 -450
  73. package/dist/chunks/codeStore-BrCfe9K3.js.map +0 -1
  74. package/dist/chunks/codeStore-_b2fDZtD.cjs +0 -2
  75. package/dist/chunks/codeStore-_b2fDZtD.cjs.map +0 -1
  76. package/dist/chunks/core-BBMCFpHx.js.map +0 -1
  77. package/dist/chunks/core-CM9MsJRf.cjs +0 -2
  78. package/dist/chunks/core-CM9MsJRf.cjs.map +0 -1
  79. package/dist/chunks/enc-base64-DAsYWbA2.js.map +0 -1
  80. package/dist/chunks/enc-base64-DbK5VBfD.cjs +0 -2
  81. package/dist/chunks/enc-base64-DbK5VBfD.cjs.map +0 -1
  82. package/dist/chunks/favoriteStore-BnQ2u-sa.cjs +0 -2
  83. package/dist/chunks/favoriteStore-BnQ2u-sa.cjs.map +0 -1
  84. package/dist/chunks/favoriteStore-SyAjqLG8.js +0 -439
  85. package/dist/chunks/favoriteStore-SyAjqLG8.js.map +0 -1
  86. package/dist/chunks/popupStore-BrKcPw7K.js +0 -92
  87. package/dist/chunks/popupStore-BrKcPw7K.js.map +0 -1
  88. package/dist/chunks/popupStore-ChbYTqy1.cjs +0 -2
  89. package/dist/chunks/popupStore-ChbYTqy1.cjs.map +0 -1
  90. package/dist/chunks/realFormat-Cha7OTd9.cjs +0 -2
  91. package/dist/chunks/realFormat-Cha7OTd9.cjs.map +0 -1
  92. package/dist/chunks/realFormat-DRGLFabQ.js +0 -305
  93. package/dist/chunks/realFormat-DRGLFabQ.js.map +0 -1
  94. package/dist/chunks/sha256-BnWVPP1K.cjs +0 -2
  95. package/dist/chunks/sha256-BnWVPP1K.cjs.map +0 -1
  96. package/dist/chunks/sha256-D80RpYO2.js.map +0 -1
  97. package/dist/chunks/usePopup-DnfKRiYs.js +0 -109
  98. package/dist/chunks/usePopup-DnfKRiYs.js.map +0 -1
  99. package/dist/chunks/usePopup-Domnpg55.cjs +0 -2
  100. package/dist/chunks/usePopup-Domnpg55.cjs.map +0 -1
  101. package/dist/components/common/index.cjs.map +0 -1
  102. package/dist/components/common/index.js.map +0 -1
  103. package/dist/components/core/index.cjs.map +0 -1
  104. package/dist/components/core/index.js.map +0 -1
  105. package/dist/components/guide/index.cjs.map +0 -1
  106. package/dist/components/guide/index.js.map +0 -1
  107. package/dist/components/layout/index.cjs.map +0 -1
  108. package/dist/components/layout/index.js.map +0 -1
  109. package/dist/index.cjs.map +0 -1
  110. package/dist/index.js.map +0 -1
  111. package/dist/provider/index.cjs.map +0 -1
  112. package/dist/provider/index.js.map +0 -1
  113. package/dist/stores/index.cjs.map +0 -1
  114. package/dist/stores/index.js.map +0 -1
  115. package/dist/utils/index.cjs.map +0 -1
  116. package/dist/utils/index.js.map +0 -1
@@ -1,3250 +0,0 @@
1
- import { jsx as c, jsxs as W } from "react/jsx-runtime";
2
- import { Button as Y, Form as B, ConfigProvider as mt, Checkbox as Pe, message as _, Card as Xe, List as K, Spin as vt, Upload as j, Tooltip as Dt, Typography as yt, Flex as _e, Progress as St, notification as Ot, Input as ee, DatePicker as Tt, Select as We, Space as me, InputNumber as bt, Radio as It } from "antd";
3
- import { c as A } from "./BwgSwitch-DdHo4gYR.js";
4
- import { useState as L, useEffect as R, useRef as $, useMemo as M, createContext as Et, memo as Ct, useLayoutEffect as wt, useCallback as Nt, isValidElement as Pt, cloneElement as ve, useContext as _t } from "react";
5
- import { PaperClipOutlined as xt, DownloadOutlined as Rt, CloseCircleOutlined as Lt, DeleteOutlined as Mt, InboxOutlined as Ft, UploadOutlined as Ke, CloudUploadOutlined as kt, CheckCircleOutlined as At, FileTextOutlined as Ht, SearchOutlined as jt } from "@ant-design/icons";
6
- import { isEmpty as Ut, debounce as Yt, findIndex as Z } from "lodash";
7
- import { a as Bt, aA as H, c as U, aQ as $t } from "./apiUtils-DPUgfmKk.js";
8
- import Vt from "jszip";
9
- import Je from "imask";
10
- import te from "dayjs";
11
- import { u as zt } from "./popupStore-BrKcPw7K.js";
12
- const Ci = (t) => /* @__PURE__ */ c(Y, { ...t, className: "bwg-btn" }), wi = ({ itemProps: t, inputProps: e }) => {
13
- const r = B.useFormInstance(), [n, i] = L(
14
- t?.initialValue ?? []
15
- ), [o, a] = L([]), s = o.length > 0 && o.length == n?.length, u = n?.length > 0 && n.length < o.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 ? o : []), r.setFieldValue(t?.name, g.target.checked ? o : []);
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(A, { ...t, children: /* @__PURE__ */ W(mt, { 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(
41
- Pe,
42
- {
43
- indeterminate: u,
44
- checked: s,
45
- onChange: p,
46
- children: "전체선택"
47
- }
48
- ),
49
- /* @__PURE__ */ c(
50
- Pe.Group,
51
- {
52
- options: e?.options,
53
- value: n,
54
- onChange: m
55
- }
56
- )
57
- ] }) });
58
- }, Ni = ({
59
- fileGrpKey: t,
60
- onFetchFilesTrxCd: e = "SCMFILE00101",
61
- readOnly: r = !1,
62
- sysCd: n = __SYS_CD__
63
- }) => {
64
- const [i, o] = L([]);
65
- R(() => {
66
- t && e ? n != __SYS_CD__ ? Bt(n, e, {
67
- crprCd: H()?.crprCd,
68
- sysCd: n,
69
- fileGrpKey: t
70
- }).then((s) => {
71
- if (s?.sub) {
72
- const u = s.sub.map((l) => ({
73
- uid: l.fileKey,
74
- name: l.lgclFileNm,
75
- filePath: l.filePath
76
- }));
77
- o(u);
78
- }
79
- }).catch((s) => {
80
- console.error("파일 목록 조회 서비스 호출에 실패했습니다.", s), _.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
81
- }) : U(e, {
82
- crprCd: H()?.crprCd,
83
- sysCd: n,
84
- fileGrpKey: t
85
- }).then((s) => {
86
- if (s?.sub) {
87
- const u = s.sub.map((l) => ({
88
- uid: l.fileKey,
89
- name: l.lgclFileNm,
90
- filePath: l.filePath
91
- }));
92
- o(u);
93
- }
94
- }).catch((s) => {
95
- console.error("파일 목록 조회 서비스 호출에 실패했습니다.", s), _.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
96
- }) : o([]);
97
- }, [t, e]);
98
- const a = async (s) => {
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: s.filePath,
111
- logicalName: s.name,
112
- fileKey: s.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", s.name), document.body.appendChild(g), g.click(), document.body.removeChild(g), window.URL.revokeObjectURL(m);
121
- } catch (u) {
122
- console.error(u), _.error(
123
- u.message || "파일을 다운로드하는 중 오류가 발생했습니다."
124
- );
125
- }
126
- };
127
- return Ut(i) ? null : /* @__PURE__ */ c(Xe, { title: "파일 목록", children: /* @__PURE__ */ c(
128
- K,
129
- {
130
- dataSource: i,
131
- renderItem: (s) => /* @__PURE__ */ c(
132
- K.Item,
133
- {
134
- actions: r ? [] : [
135
- /* @__PURE__ */ c(
136
- Y,
137
- {
138
- type: "text",
139
- icon: /* @__PURE__ */ c(Rt, {}),
140
- onClick: () => a(s)
141
- },
142
- "download"
143
- )
144
- ],
145
- children: /* @__PURE__ */ c(K.Item.Meta, { avatar: /* @__PURE__ */ c(xt, {}), title: s.name })
146
- }
147
- )
148
- }
149
- ) });
150
- }, { Text: re, Link: Pi } = yt, { Dragger: qt } = j, Gt = [
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
- ], Xt = (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"], o = Math.floor(Math.log(t) / Math.log(r));
171
- return parseFloat((t / Math.pow(r, o)).toFixed(n)) + " " + i[o];
172
- }, _i = ({
173
- title: t = "첨부파일",
174
- fileGrpKey: e,
175
- onUploadComplete: r,
176
- onSuccessTrxCd: n = "SCMFILE00102",
177
- // BwgUploader와 동일한 기본 trxCd 설정
178
- anotherServiceTrxCd: i = "SCMFILE00105",
179
- allowedExtensions: o = Gt,
180
- maxFileSize: a = 2048
181
- // 기본값 2GB
182
- }) => {
183
- const [s, u] = L([]), [l, p] = L(!1), [m, g] = L(!1), [d, b] = L(0), D = (h) => {
184
- if (o && o.length > 0) {
185
- const f = ((T) => {
186
- const S = T.lastIndexOf(".");
187
- return S === -1 ? "" : T.substring(S).toLowerCase();
188
- })(h.name);
189
- if (!o.includes(f))
190
- return _.error(
191
- `${h.name} 파일은 허용되지 않는 확장자입니다. (${o.join(
192
- ", "
193
- )}만 가능)`
194
- ), !1;
195
- }
196
- return !0;
197
- }, E = async () => {
198
- const h = s.filter((O) => O.status !== "done"), I = h.reduce(
199
- (O, N) => O + (N.size || 0),
200
- 0
201
- ), f = 2 * 1024 * 1024 * 1024;
202
- if (I > f) {
203
- Ot.error({
204
- message: "업로드 용량 초과",
205
- description: "한 번에 업로드할 수 있는 총 파일 용량은 2GB를 초과할 수 없습니다."
206
- });
207
- return;
208
- }
209
- if (h.length === 0) {
210
- _.warning(
211
- "업로드할 파일이 없거나 모든 파일이 이미 업로드되었습니다."
212
- );
213
- return;
214
- }
215
- g(!0);
216
- let T;
217
- try {
218
- const O = new Vt();
219
- h.forEach((N) => {
220
- N.originFileObj && O.file(N.name, N.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), _.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, P) => {
238
- const x = new XMLHttpRequest();
239
- x.open("POST", "/api/upload-large", !0), x.upload.onprogress = (w) => {
240
- if (w.lengthComputable) {
241
- const z = Math.round(
242
- w.loaded / w.total * 100
243
- );
244
- b(z);
245
- }
246
- }, x.onload = () => {
247
- if (x.status >= 200 && x.status < 300)
248
- try {
249
- const w = JSON.parse(x.responseText);
250
- w.success ? C(w) : P(
251
- new Error(w.message || "파일 업로드에 실패했습니다.")
252
- );
253
- } catch {
254
- P(new Error("잘못된 서버 응답입니다."));
255
- }
256
- else
257
- try {
258
- const w = JSON.parse(x.responseText);
259
- P(new Error(w.message || `서버 오류: ${x.status}`));
260
- } catch {
261
- P(new Error(`서버 오류: ${x.status}`));
262
- }
263
- }, x.onerror = () => {
264
- P(new Error("네트워크 오류가 발생했습니다."));
265
- }, x.send(S);
266
- });
267
- _.success(
268
- O.message || "압축 파일이 성공적으로 업로드되었습니다."
269
- );
270
- const N = s.map(
271
- (C) => h.find((P) => P.uid === C.uid) ? { ...C, status: "done" } : C
272
- );
273
- if (u(N), n && O.uploadedFiles && Array.isArray(O.uploadedFiles)) {
274
- const C = H();
275
- O.uploadedFiles.forEach((P) => {
276
- const x = {
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: P.fileNameP,
286
- lgclFileNm: P.fileNameL,
287
- filePath: P.filePath,
288
- fileExtn: P.fileExt,
289
- fileSize: P.fileSize,
290
- mltpYn: "Y"
291
- }
292
- ]
293
- };
294
- U(n, x).then((w) => {
295
- const z = s.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), _.error(
311
- `${P.fileNameL} 파일의 후처리 작업에 실패했습니다.`
312
- );
313
- }), r && r({
314
- fileNameP: P.fileNameP,
315
- fileNameL: P.fileNameL
316
- });
317
- });
318
- }
319
- } catch (O) {
320
- _.error(O.message || "파일 업로드 중 오류가 발생했습니다.");
321
- const N = s.map(
322
- (C) => h.find((P) => P.uid === C.uid) ? {
323
- ...C,
324
- status: "error",
325
- response: O.message || "파일 업로드 중 오류가 발생했습니다."
326
- } : C
327
- );
328
- u(N);
329
- } finally {
330
- p(!1);
331
- }
332
- }, v = {
333
- multiple: !0,
334
- fileList: s,
335
- beforeUpload: (h) => D(h) ? a && h.size >= a * 1024 * 1024 ? (_.error(
336
- `대용량 첨부 파일 최대 크기는 ${(a / 1024).toFixed(
337
- 1
338
- )}GB입니다.`
339
- ), j.LIST_IGNORE) : !1 : j.LIST_IGNORE,
340
- onChange: ({ fileList: h }) => {
341
- const I = new Map(s.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 = s.filter((f) => f.uid !== h.uid);
348
- u(I);
349
- },
350
- showUploadList: !1
351
- // 수동으로 목록을 렌더링하므로 antd의 기본 목록은 숨깁니다.
352
- };
353
- return /* @__PURE__ */ c(
354
- vt,
355
- {
356
- spinning: l || m,
357
- tip: m ? "파일 압축 중..." : `파일 업로드 중... ${d}%`,
358
- children: /* @__PURE__ */ W("div", { className: "bwg-large-uploader-container", children: [
359
- /* @__PURE__ */ c(
360
- Xe,
361
- {
362
- title: /* @__PURE__ */ c(re, { strong: !0, children: t }),
363
- extra: /* @__PURE__ */ c(j, { ...v, children: /* @__PURE__ */ c(Y, { icon: /* @__PURE__ */ c(Ke, {}), children: "파일 선택" }) }),
364
- bodyStyle: { padding: 0 },
365
- children: /* @__PURE__ */ c(
366
- qt,
367
- {
368
- ...v,
369
- style: {
370
- border: "none",
371
- background: "transparent",
372
- padding: 0
373
- },
374
- children: /* @__PURE__ */ c("div", { className: "upload-list-container", children: s.length > 0 ? /* @__PURE__ */ c(
375
- K,
376
- {
377
- style: { textAlign: "left" },
378
- dataSource: s,
379
- renderItem: (h) => {
380
- const I = h.status === "done", f = h.status === "error";
381
- let T;
382
- return I ? T = /* @__PURE__ */ c(
383
- At,
384
- {
385
- style: { color: "#52c41a", fontSize: 14 }
386
- }
387
- ) : f ? T = /* @__PURE__ */ c(
388
- Dt,
389
- {
390
- title: typeof h.response == "string" ? h.response : "업로드 실패",
391
- children: /* @__PURE__ */ c(
392
- Lt,
393
- {
394
- style: { color: "#ff4d4f", fontSize: 14 }
395
- }
396
- )
397
- }
398
- ) : T = /* @__PURE__ */ c(Ht, { style: { fontSize: 14 } }), /* @__PURE__ */ c(
399
- K.Item,
400
- {
401
- actions: [
402
- /* @__PURE__ */ c(re, { type: "secondary", children: Xt(h.size || 0) }, "size"),
403
- /* @__PURE__ */ c(
404
- Y,
405
- {
406
- type: "text",
407
- icon: /* @__PURE__ */ c(Mt, {}),
408
- onClick: (S) => {
409
- S.stopPropagation(), v.onRemove?.(h);
410
- },
411
- disabled: l || m
412
- },
413
- "delete"
414
- )
415
- ],
416
- children: /* @__PURE__ */ c(
417
- K.Item.Meta,
418
- {
419
- avatar: T,
420
- title: /* @__PURE__ */ c(re, { type: f ? "danger" : void 0, children: h.name })
421
- }
422
- )
423
- },
424
- h.uid
425
- );
426
- }
427
- }
428
- ) : /* @__PURE__ */ W(
429
- _e,
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(Ft, { style: { fontSize: "32px", color: "#999" } }),
438
- /* @__PURE__ */ c(re, { type: "secondary", children: "업로드할 파일을 선택하거나 이 영역으로 드래그하세요." })
439
- ]
440
- }
441
- ) })
442
- }
443
- )
444
- }
445
- ),
446
- s.length > 0 && /* @__PURE__ */ W(
447
- _e,
448
- {
449
- justify: "flex-end",
450
- align: "center",
451
- gap: "large",
452
- style: { marginTop: 16 },
453
- children: [
454
- l && /* @__PURE__ */ c("div", { style: { width: "250px" }, children: /* @__PURE__ */ c(St, { percent: d, size: "small" }) }),
455
- /* @__PURE__ */ c(
456
- Y,
457
- {
458
- type: "primary",
459
- onClick: E,
460
- disabled: l || m || s.filter((h) => h.status !== "done").length === 0,
461
- icon: /* @__PURE__ */ c(kt, {}),
462
- children: "일괄 업로드"
463
- }
464
- )
465
- ]
466
- }
467
- )
468
- ] })
469
- }
470
- );
471
- }, Wt = (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 o = r?.[n]?.maxLength ?? 3;
480
- return "_".repeat(o);
481
- }).join(".");
482
- }
483
- return "";
484
- }, xi = ({
485
- itemProps: t,
486
- inputProps: e,
487
- mask: r
488
- }) => {
489
- const n = $(null), i = B.useFormInstance(), o = M(() => Wt(r), [r]);
490
- return R(() => {
491
- if (!n.current?.input) return;
492
- const a = typeof r == "string" || Array.isArray(r) ? { mask: r } : r, s = Je(n.current.input, a);
493
- return s.on("accept", () => {
494
- i && t?.name && i.setFieldValue(t.name, s.value);
495
- }), () => {
496
- s.destroy();
497
- };
498
- }, [r, i, t?.name]), /* @__PURE__ */ c(A, { ...t, children: /* @__PURE__ */ c(ee, { ...e, ref: n, placeholder: o }) });
499
- }, Kt = (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
- }, Ri = ({
514
- type: t = "date",
515
- itemProps: e = { name: "calendar" },
516
- inputProps: r
517
- }) => {
518
- const { format: n, mask: i, outputFormat: o } = Kt(t), a = $(null), s = $(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 = Je(a.current.input, {
522
- mask: i,
523
- lazy: !1
524
- });
525
- return s.current = v, v.on("accept", () => {
526
- console.log("input :: ", v.value);
527
- const h = v.value, I = te(h, n, !0);
528
- console.log("input :: ", I), h.length === n.length && I.isValid() && (console.log("parsed :: ", I.format(o)), u.setFieldValue(d, I.format(o)), s.current?.updateValue(), p(!1));
529
- }), () => {
530
- v.destroy();
531
- };
532
- }, [n, i]), R(() => {
533
- D(te(u.getFieldValue(d)));
534
- }, [u.getFieldValue(d)]);
535
- const E = (v) => {
536
- if (!v) {
537
- s.current?.updateValue();
538
- return;
539
- }
540
- const h = v.format(o);
541
- console.log("formatted :: ", h), s.current && (s.current.value = h, s.current.updateValue()), g(!1);
542
- };
543
- return /* @__PURE__ */ c(
544
- A,
545
- {
546
- ...e,
547
- name: void 0,
548
- validateStatus: m ? "warning" : void 0,
549
- help: m ? "유효하지 않은 날짜입니다" : void 0,
550
- children: /* @__PURE__ */ W("div", { style: { position: "relative" }, children: [
551
- /* @__PURE__ */ c(
552
- B.Item,
553
- {
554
- name: d,
555
- getValueProps: (v) => ({
556
- value: v ? te(v).format(n) : void 0
557
- }),
558
- normalize: (v) => v ? te(v).format(o) : void 0,
559
- noStyle: !0,
560
- children: /* @__PURE__ */ c(
561
- ee,
562
- {
563
- ...r,
564
- ref: a,
565
- onFocus: () => {
566
- p(!l), s.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(
579
- Tt,
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: xe } = We, Li = ({ 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(
608
- A,
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(We, { ...e, mode: "multiple", children: r.map((i) => {
618
- const { value: o, label: a } = i;
619
- return e?.printCode ? /* @__PURE__ */ c(xe, { value: o, label: a, children: /* @__PURE__ */ c(me, { children: `[${o}] ${a}` }) }, o) : /* @__PURE__ */ c(xe, { value: o, label: a, children: /* @__PURE__ */ c(me, { children: `${a}` }) }, o);
620
- }) })
621
- }
622
- );
623
- }, Mi = ({ itemProps: t, inputProps: e }) => {
624
- const r = (i) => {
625
- let o = i.toString().split(".");
626
- return e?.decimalPoint != null && o[1] != null && e?.decimalPoint > 0 ? o[1].length > e?.decimalPoint ? o[1] = "." + o[1].substring(0, e?.decimalPoint) : o[1] = "." + o[1] : o[1] = "", o[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") + o[1];
627
- }, n = (i) => {
628
- let o = i.toString().split(".");
629
- return e?.decimalPoint != null && o[1] != null && e?.decimalPoint > 0 ? o[1].length > e?.decimalPoint ? o[1] = "." + o[1].substring(0, e?.decimalPoint) : o[1] = "." + o[1] : o[1] = "", o[0].replace(/\$\s?|(,*)/g, "") + o[1];
630
- };
631
- return /* @__PURE__ */ c(A, { ...t, children: /* @__PURE__ */ c(
632
- bt,
633
- {
634
- ...e,
635
- formatter: (i) => r(i),
636
- parser: (i) => n(i)
637
- }
638
- ) });
639
- }, Fi = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ c(A, { ...t, children: /* @__PURE__ */ c(It.Group, { ...e }) }), Re = ee.Search, ki = (t) => {
640
- const e = B.useFormInstance(), { openPopup: r } = zt(), 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
- }, o = {
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(A, { ...t.itemProps, name: void 0, children: /* @__PURE__ */ W(me.Compact, { block: !0, children: [
655
- /* @__PURE__ */ c(
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(
664
- ee,
665
- {
666
- style: { color: "#999", backgroundColor: "#f5f5f5" },
667
- placeholder: t.placeholder?.[0] || "",
668
- readOnly: !0
669
- }
670
- )
671
- }
672
- ),
673
- /* @__PURE__ */ c(B.Item, { name: n[1], style: { width: "60%", marginBottom: 0 }, children: /* @__PURE__ */ c(
674
- Re,
675
- {
676
- readOnly: t.readOnly,
677
- enterButton: /* @__PURE__ */ c(
678
- Y,
679
- {
680
- icon: /* @__PURE__ */ c(jt, {}),
681
- disabled: t.readOnly
682
- }
683
- ),
684
- ...o
685
- }
686
- ) })
687
- ] }) }) : /* @__PURE__ */ c(A, { ...t.itemProps, children: /* @__PURE__ */ c(Re, { ...o }) });
688
- }, { TextArea: Jt } = ee, Ai = ({ itemProps: t, inputProps: e }) => /* @__PURE__ */ c(A, { ...t, children: /* @__PURE__ */ c(Jt, { ...e }) }), Ze = Et({
689
- dragDropManager: void 0
690
- });
691
- function F(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 Le = (function() {
695
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
696
- })(), Me = function() {
697
- return Math.random().toString(36).substring(7).split("").join(".");
698
- }, Fe = {
699
- INIT: "@@redux/INIT" + Me(),
700
- REPLACE: "@@redux/REPLACE" + Me()
701
- };
702
- function Zt(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 Qt(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 (rr(t)) return "date";
722
- if (tr(t)) return "error";
723
- var r = er(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 er(t) {
736
- return typeof t.constructor == "function" ? t.constructor.name : null;
737
- }
738
- function tr(t) {
739
- return t instanceof Error || typeof t.message == "string" && t.constructor && typeof t.constructor.stackTraceLimit == "number";
740
- }
741
- function rr(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 = Qt(t)), e;
747
- }
748
- function Qe(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" ? F(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" ? F(1) : "Expected the enhancer to be a function. Instead, received: '" + G(r) + "'");
755
- return r(Qe)(t, e);
756
- }
757
- if (typeof t != "function")
758
- throw new Error(process.env.NODE_ENV === "production" ? F(2) : "Expected the root reducer to be a function. Instead, received: '" + G(t) + "'");
759
- var i = t, o = e, a = [], s = a, u = !1;
760
- function l() {
761
- s === a && (s = a.slice());
762
- }
763
- function p() {
764
- if (u)
765
- throw new Error(process.env.NODE_ENV === "production" ? F(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 o;
767
- }
768
- function m(D) {
769
- if (typeof D != "function")
770
- throw new Error(process.env.NODE_ENV === "production" ? F(4) : "Expected the listener to be a function. Instead, received: '" + G(D) + "'");
771
- if (u)
772
- throw new Error(process.env.NODE_ENV === "production" ? F(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(), s.push(D), function() {
775
- if (E) {
776
- if (u)
777
- throw new Error(process.env.NODE_ENV === "production" ? F(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 = s.indexOf(D);
780
- s.splice(h, 1), a = null;
781
- }
782
- };
783
- }
784
- function g(D) {
785
- if (!Zt(D))
786
- throw new Error(process.env.NODE_ENV === "production" ? F(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" ? F(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" ? F(9) : "Reducers may not dispatch actions.");
791
- try {
792
- u = !0, o = i(o, D);
793
- } finally {
794
- u = !1;
795
- }
796
- for (var E = a = s, 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" ? F(10) : "Expected the nextReducer to be a function. Instead, received: '" + G(D));
805
- i = D, g({
806
- type: Fe.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" ? F(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[Le] = function() {
833
- return this;
834
- }, D;
835
- }
836
- return g({
837
- type: Fe.INIT
838
- }), n = {
839
- dispatch: g,
840
- subscribe: m,
841
- getState: p,
842
- replaceReducer: d
843
- }, n[Le] = b, n;
844
- }
845
- function y(t, e, ...r) {
846
- if (nr() && 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 nr() {
862
- return typeof process < "u" && process.env.NODE_ENV === "production";
863
- }
864
- function ir(t, e, r) {
865
- return e.split(".").reduce(
866
- (n, i) => n && n[i] ? n[i] : r || null,
867
- t
868
- );
869
- }
870
- function or(t, e) {
871
- return t.filter(
872
- (r) => r !== e
873
- );
874
- }
875
- function et(t) {
876
- return typeof t == "object";
877
- }
878
- function sr(t, e) {
879
- const r = /* @__PURE__ */ new Map(), n = (o) => {
880
- r.set(o, r.has(o) ? r.get(o) + 1 : 1);
881
- };
882
- t.forEach(n), e.forEach(n);
883
- const i = [];
884
- return r.forEach((o, a) => {
885
- o === 1 && i.push(a);
886
- }), i;
887
- }
888
- function ar(t, e) {
889
- return t.filter(
890
- (r) => e.indexOf(r) > -1
891
- );
892
- }
893
- const be = "dnd-core/INIT_COORDS", oe = "dnd-core/BEGIN_DRAG", Ie = "dnd-core/PUBLISH_DRAG_SOURCE", se = "dnd-core/HOVER", ae = "dnd-core/DROP", ce = "dnd-core/END_DRAG";
894
- function ke(t, e) {
895
- return {
896
- type: be,
897
- payload: {
898
- sourceClientOffset: e || null,
899
- clientOffset: t || null
900
- }
901
- };
902
- }
903
- const cr = {
904
- type: be,
905
- payload: {
906
- clientOffset: null,
907
- sourceClientOffset: null
908
- }
909
- };
910
- function ur(t) {
911
- return function(r = [], n = {
912
- publishSource: !0
913
- }) {
914
- const { publishSource: i = !0, clientOffset: o, getSourceClientOffset: a } = n, s = t.getMonitor(), u = t.getRegistry();
915
- t.dispatch(ke(o)), lr(r, s, u);
916
- const l = gr(r, s);
917
- if (l == null) {
918
- t.dispatch(cr);
919
- return;
920
- }
921
- let p = null;
922
- if (o) {
923
- if (!a)
924
- throw new Error("getSourceClientOffset must be defined");
925
- dr(a), p = a(l);
926
- }
927
- t.dispatch(ke(o, p));
928
- const g = u.getSource(l).beginDrag(s, l);
929
- if (g == null)
930
- return;
931
- fr(g), u.pinSource(l);
932
- const d = u.getSourceType(l);
933
- return {
934
- type: oe,
935
- payload: {
936
- itemType: d,
937
- item: g,
938
- sourceId: l,
939
- clientOffset: o || null,
940
- sourceClientOffset: p || null,
941
- isSourcePublic: !!i
942
- }
943
- };
944
- };
945
- }
946
- function lr(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 dr(t) {
952
- y(typeof t == "function", "When clientOffset is provided, getSourceClientOffset must be a function.");
953
- }
954
- function fr(t) {
955
- y(et(t), "Item must be an object.");
956
- }
957
- function gr(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 hr(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 pr(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
- hr(t, i, r[i]);
981
- });
982
- }
983
- return t;
984
- }
985
- function mr(t) {
986
- return function(r = {}) {
987
- const n = t.getMonitor(), i = t.getRegistry();
988
- vr(n), Sr(n).forEach((a, s) => {
989
- const u = Dr(a, s, i, n), l = {
990
- type: ae,
991
- payload: {
992
- dropResult: pr({}, r, u)
993
- }
994
- };
995
- t.dispatch(l);
996
- });
997
- };
998
- }
999
- function vr(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 Dr(t, e, r, n) {
1003
- const i = r.getTarget(t);
1004
- let o = i ? i.drop(n, t) : void 0;
1005
- return yr(o), typeof o > "u" && (o = e === 0 ? {} : n.getDropResult()), o;
1006
- }
1007
- function yr(t) {
1008
- y(typeof t > "u" || et(t), "Drop result must either be an object or undefined.");
1009
- }
1010
- function Sr(t) {
1011
- const e = t.getTargetIds().filter(t.canDropOnTarget, t);
1012
- return e.reverse(), e;
1013
- }
1014
- function Or(t) {
1015
- return function() {
1016
- const r = t.getMonitor(), n = t.getRegistry();
1017
- Tr(r);
1018
- const i = r.getSourceId();
1019
- return i != null && (n.getSource(i, !0).endDrag(r, i), n.unpinSource()), {
1020
- type: ce
1021
- };
1022
- };
1023
- }
1024
- function Tr(t) {
1025
- y(t.isDragging(), "Cannot call endDrag while not dragging.");
1026
- }
1027
- function De(t, e) {
1028
- return e === null ? t === null : Array.isArray(t) ? t.some(
1029
- (r) => r === e
1030
- ) : t === e;
1031
- }
1032
- function br(t) {
1033
- return function(r, { clientOffset: n } = {}) {
1034
- Ir(r);
1035
- const i = r.slice(0), o = t.getMonitor(), a = t.getRegistry(), s = o.getItemType();
1036
- return Cr(i, a, s), Er(i, o, a), wr(i, o, a), {
1037
- type: se,
1038
- payload: {
1039
- targetIds: i,
1040
- clientOffset: n || null
1041
- }
1042
- };
1043
- };
1044
- }
1045
- function Ir(t) {
1046
- y(Array.isArray(t), "Expected targetIds to be an array.");
1047
- }
1048
- function Er(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 o = r.getTarget(i);
1054
- y(o, "Expected targetIds to be registered.");
1055
- }
1056
- }
1057
- function Cr(t, e, r) {
1058
- for (let n = t.length - 1; n >= 0; n--) {
1059
- const i = t[n], o = e.getTargetType(i);
1060
- De(o, r) || t.splice(n, 1);
1061
- }
1062
- }
1063
- function wr(t, e, r) {
1064
- t.forEach(function(n) {
1065
- r.getTarget(n).hover(e, n);
1066
- });
1067
- }
1068
- function Nr(t) {
1069
- return function() {
1070
- if (t.getMonitor().isDragging())
1071
- return {
1072
- type: Ie
1073
- };
1074
- };
1075
- }
1076
- function Pr(t) {
1077
- return {
1078
- beginDrag: ur(t),
1079
- publishDragSource: Nr(t),
1080
- hover: br(t),
1081
- drop: mr(t),
1082
- endDrag: Or(t)
1083
- };
1084
- }
1085
- class _r {
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(o) {
1101
- return (...a) => {
1102
- const s = o.apply(e, a);
1103
- typeof s < "u" && r(s);
1104
- };
1105
- }
1106
- const i = Pr(this);
1107
- return Object.keys(i).reduce((o, a) => {
1108
- const s = i[a];
1109
- return o[a] = n(s), o;
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 xr(t, e) {
1123
- return {
1124
- x: t.x + e.x,
1125
- y: t.y + e.y
1126
- };
1127
- }
1128
- function tt(t, e) {
1129
- return {
1130
- x: t.x - e.x,
1131
- y: t.y - e.y
1132
- };
1133
- }
1134
- function Rr(t) {
1135
- const { clientOffset: e, initialClientOffset: r, initialSourceClientOffset: n } = t;
1136
- return !e || !r || !n ? null : tt(xr(e, n), r);
1137
- }
1138
- function Lr(t) {
1139
- const { clientOffset: e, initialClientOffset: r } = t;
1140
- return !e || !r ? null : tt(e, r);
1141
- }
1142
- const Q = [], Ee = [];
1143
- Q.__IS_NONE__ = !0;
1144
- Ee.__IS_ALL__ = !0;
1145
- function Mr(t, e) {
1146
- return t === Q ? !1 : t === Ee || typeof e > "u" ? !0 : ar(e, t).length > 0;
1147
- }
1148
- class Fr {
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 o = () => {
1154
- const a = this.store.getState(), s = a.stateId;
1155
- try {
1156
- s === i || s === i + 1 && !Mr(a.dirtyHandlerIds, n) || e();
1157
- } finally {
1158
- i = s;
1159
- }
1160
- };
1161
- return this.store.subscribe(o);
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 De(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), o = this.getItemType();
1208
- if (o && !De(i, o))
1209
- return !1;
1210
- const a = this.getTargetIds();
1211
- if (!a.length)
1212
- return !1;
1213
- const s = a.indexOf(e);
1214
- return n ? s === a.length - 1 : s > -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 Rr(this.store.getState().dragOffset);
1248
- }
1249
- getDifferenceFromInitialOffset() {
1250
- return Lr(this.store.getState().dragOffset);
1251
- }
1252
- constructor(e, r) {
1253
- this.store = e, this.registry = r;
1254
- }
1255
- }
1256
- const Ae = typeof global < "u" ? global : self, rt = Ae.MutationObserver || Ae.WebKitMutationObserver;
1257
- function nt(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 kr(t) {
1266
- let e = 1;
1267
- const r = new rt(t), n = document.createTextNode("");
1268
- return r.observe(n, {
1269
- characterData: !0
1270
- }), function() {
1271
- e = -e, n.data = e;
1272
- };
1273
- }
1274
- const Ar = typeof rt == "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
- kr
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
- nt
1312
- );
1313
- class Hr {
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 = Ar(this.flush), this.requestErrorThrow = nt(() => {
1343
- if (this.pendingErrors.length)
1344
- throw this.pendingErrors.shift();
1345
- });
1346
- }
1347
- }
1348
- class jr {
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 Ur {
1363
- create(e) {
1364
- const r = this.freeTasks, n = r.length ? r.pop() : new jr(
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 it = new Hr(), Yr = new Ur(it.registerPendingError);
1375
- function Br(t) {
1376
- it.enqueueTask(Yr.create(t));
1377
- }
1378
- const Ce = "dnd-core/ADD_SOURCE", we = "dnd-core/ADD_TARGET", Ne = "dnd-core/REMOVE_SOURCE", ue = "dnd-core/REMOVE_TARGET";
1379
- function $r(t) {
1380
- return {
1381
- type: Ce,
1382
- payload: {
1383
- sourceId: t
1384
- }
1385
- };
1386
- }
1387
- function Vr(t) {
1388
- return {
1389
- type: we,
1390
- payload: {
1391
- targetId: t
1392
- }
1393
- };
1394
- }
1395
- function zr(t) {
1396
- return {
1397
- type: Ne,
1398
- payload: {
1399
- sourceId: t
1400
- }
1401
- };
1402
- }
1403
- function qr(t) {
1404
- return {
1405
- type: ue,
1406
- payload: {
1407
- targetId: t
1408
- }
1409
- };
1410
- }
1411
- function Gr(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 Xr(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 ye(t, e) {
1418
- if (e && Array.isArray(t)) {
1419
- t.forEach(
1420
- (r) => ye(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 k;
1427
- (function(t) {
1428
- t.SOURCE = "SOURCE", t.TARGET = "TARGET";
1429
- })(k || (k = {}));
1430
- let Wr = 0;
1431
- function Kr() {
1432
- return Wr++;
1433
- }
1434
- function Jr(t) {
1435
- const e = Kr().toString();
1436
- switch (t) {
1437
- case k.SOURCE:
1438
- return `S${e}`;
1439
- case k.TARGET:
1440
- return `T${e}`;
1441
- default:
1442
- throw new Error(`Unknown Handler Role: ${t}`);
1443
- }
1444
- }
1445
- function He(t) {
1446
- switch (t[0]) {
1447
- case "S":
1448
- return k.SOURCE;
1449
- case "T":
1450
- return k.TARGET;
1451
- default:
1452
- throw new Error(`Cannot parse handler ID: ${t}`);
1453
- }
1454
- }
1455
- function je(t, e) {
1456
- const r = t.entries();
1457
- let n = !1;
1458
- do {
1459
- const { done: i, value: [, o] } = r.next();
1460
- if (o === e)
1461
- return !0;
1462
- n = !!i;
1463
- } while (!n);
1464
- return !1;
1465
- }
1466
- class Zr {
1467
- addSource(e, r) {
1468
- ye(e), Gr(r);
1469
- const n = this.addHandler(k.SOURCE, e, r);
1470
- return this.store.dispatch($r(n)), n;
1471
- }
1472
- addTarget(e, r) {
1473
- ye(e, !0), Xr(r);
1474
- const n = this.addHandler(k.TARGET, e, r);
1475
- return this.store.dispatch(Vr(n)), n;
1476
- }
1477
- containsHandler(e) {
1478
- return je(this.dragSources, e) || je(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 He(e) === k.SOURCE;
1494
- }
1495
- isTargetId(e) {
1496
- return He(e) === k.TARGET;
1497
- }
1498
- removeSource(e) {
1499
- y(this.getSource(e), "Expected an existing source."), this.store.dispatch(zr(e)), Br(() => {
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(qr(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 = Jr(e);
1515
- return this.types.set(i, r), e === k.SOURCE ? this.dragSources.set(i, n) : e === k.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 Qr = (t, e) => t === e;
1522
- function en(t, e) {
1523
- return !t && !e ? !0 : !t || !e ? !1 : t.x === e.x && t.y === e.y;
1524
- }
1525
- function tn(t, e, r = Qr) {
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 rn(t = Q, e) {
1534
- switch (e.type) {
1535
- case se:
1536
- break;
1537
- case Ce:
1538
- case we:
1539
- case ue:
1540
- case Ne:
1541
- return Q;
1542
- case oe:
1543
- case Ie:
1544
- case ce:
1545
- case ae:
1546
- default:
1547
- return Ee;
1548
- }
1549
- const { targetIds: r = [], prevTargetIds: n = [] } = e.payload, i = sr(r, n);
1550
- if (!(i.length > 0 || !tn(r, n)))
1551
- return Q;
1552
- const a = n[n.length - 1], s = r[r.length - 1];
1553
- return a !== s && (a && i.push(a), s && i.push(s)), i;
1554
- }
1555
- function nn(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 on(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
- nn(t, i, r[i]);
1570
- });
1571
- }
1572
- return t;
1573
- }
1574
- const Ue = {
1575
- initialSourceClientOffset: null,
1576
- initialClientOffset: null,
1577
- clientOffset: null
1578
- };
1579
- function sn(t = Ue, e) {
1580
- const { payload: r } = e;
1581
- switch (e.type) {
1582
- case be:
1583
- case oe:
1584
- return {
1585
- initialSourceClientOffset: r.sourceClientOffset,
1586
- initialClientOffset: r.clientOffset,
1587
- clientOffset: r.clientOffset
1588
- };
1589
- case se:
1590
- return en(t.clientOffset, r.clientOffset) ? t : on({}, t, {
1591
- clientOffset: r.clientOffset
1592
- });
1593
- case ce:
1594
- case ae:
1595
- return Ue;
1596
- default:
1597
- return t;
1598
- }
1599
- }
1600
- function an(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
- an(t, i, r[i]);
1615
- });
1616
- }
1617
- return t;
1618
- }
1619
- const cn = {
1620
- itemType: null,
1621
- item: null,
1622
- sourceId: null,
1623
- targetIds: [],
1624
- dropResult: null,
1625
- didDrop: !1,
1626
- isSourcePublic: null
1627
- };
1628
- function un(t = cn, e) {
1629
- const { payload: r } = e;
1630
- switch (e.type) {
1631
- case oe:
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 Ie:
1641
- return X({}, t, {
1642
- isSourcePublic: !0
1643
- });
1644
- case se:
1645
- return X({}, t, {
1646
- targetIds: r.targetIds
1647
- });
1648
- case ue:
1649
- return t.targetIds.indexOf(r.targetId) === -1 ? t : X({}, t, {
1650
- targetIds: or(t.targetIds, r.targetId)
1651
- });
1652
- case ae:
1653
- return X({}, t, {
1654
- dropResult: r.dropResult,
1655
- didDrop: !0,
1656
- targetIds: []
1657
- });
1658
- case ce:
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 ln(t = 0, e) {
1673
- switch (e.type) {
1674
- case Ce:
1675
- case we:
1676
- return t + 1;
1677
- case Ne:
1678
- case ue:
1679
- return t - 1;
1680
- default:
1681
- return t;
1682
- }
1683
- }
1684
- function dn(t = 0) {
1685
- return t + 1;
1686
- }
1687
- function fn(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 gn(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
- fn(t, i, r[i]);
1702
- });
1703
- }
1704
- return t;
1705
- }
1706
- function hn(t = {}, e) {
1707
- return {
1708
- dirtyHandlerIds: rn(t.dirtyHandlerIds, {
1709
- type: e.type,
1710
- payload: gn({}, e.payload, {
1711
- prevTargetIds: ir(t, "dragOperation.targetIds", [])
1712
- })
1713
- }),
1714
- dragOffset: sn(t.dragOffset, e),
1715
- refCount: ln(t.refCount, e),
1716
- dragOperation: un(t.dragOperation, e),
1717
- stateId: dn(t.stateId)
1718
- };
1719
- }
1720
- function pn(t, e = void 0, r = {}, n = !1) {
1721
- const i = mn(n), o = new Fr(i, new Zr(i)), a = new _r(i, o), s = t(a, e, r);
1722
- return a.receiveBackend(s), a;
1723
- }
1724
- function mn(t) {
1725
- const e = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION__;
1726
- return Qe(hn, t && e && e({
1727
- name: "dnd-core",
1728
- instanceId: "dnd-core"
1729
- }));
1730
- }
1731
- function vn(t, e) {
1732
- if (t == null) return {};
1733
- var r = Dn(t, e), n, i;
1734
- if (Object.getOwnPropertySymbols) {
1735
- var o = Object.getOwnPropertySymbols(t);
1736
- for (i = 0; i < o.length; i++)
1737
- n = o[i], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
1738
- }
1739
- return r;
1740
- }
1741
- function Dn(t, e) {
1742
- if (t == null) return {};
1743
- var r = {}, n = Object.keys(t), i, o;
1744
- for (o = 0; o < n.length; o++)
1745
- i = n[o], !(e.indexOf(i) >= 0) && (r[i] = t[i]);
1746
- return r;
1747
- }
1748
- let Ye = 0;
1749
- const ie = Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");
1750
- var yn = /* @__PURE__ */ Ct(function(e) {
1751
- var { children: r } = e, n = vn(e, [
1752
- "children"
1753
- ]);
1754
- const [i, o] = Sn(n);
1755
- return R(() => {
1756
- if (o) {
1757
- const a = ot();
1758
- return ++Ye, () => {
1759
- --Ye === 0 && (a[ie] = null);
1760
- };
1761
- }
1762
- }, []), /* @__PURE__ */ c(Ze.Provider, {
1763
- value: i,
1764
- children: r
1765
- });
1766
- });
1767
- function Sn(t) {
1768
- if ("manager" in t)
1769
- return [
1770
- {
1771
- dragDropManager: t.manager
1772
- },
1773
- !1
1774
- ];
1775
- const e = On(t.backend, t.context, t.options, t.debugMode), r = !t.context;
1776
- return [
1777
- e,
1778
- r
1779
- ];
1780
- }
1781
- function On(t, e = ot(), r, n) {
1782
- const i = e;
1783
- return i[ie] || (i[ie] = {
1784
- dragDropManager: pn(t, e, r, n)
1785
- }), i[ie];
1786
- }
1787
- function ot() {
1788
- return typeof global < "u" ? global : window;
1789
- }
1790
- var le, Be;
1791
- function Tn() {
1792
- return Be || (Be = 1, le = 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, o;
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 (o = Object.keys(e), n = o.length, n !== Object.keys(r).length) return !1;
1807
- for (i = n; i-- !== 0; )
1808
- if (!Object.prototype.hasOwnProperty.call(r, o[i])) return !1;
1809
- for (i = n; i-- !== 0; ) {
1810
- var a = o[i];
1811
- if (!t(e[a], r[a])) return !1;
1812
- }
1813
- return !0;
1814
- }
1815
- return e !== e && r !== r;
1816
- }), le;
1817
- }
1818
- var bn = Tn();
1819
- const In = /* @__PURE__ */ $t(bn), V = typeof window < "u" ? wt : R;
1820
- function En(t, e, r) {
1821
- const [n, i] = L(
1822
- () => e(t)
1823
- ), o = Nt(() => {
1824
- const a = e(t);
1825
- In(n, a) || (i(a), r && r());
1826
- }, [
1827
- n,
1828
- t,
1829
- r
1830
- ]);
1831
- return V(o), [
1832
- n,
1833
- o
1834
- ];
1835
- }
1836
- function Cn(t, e, r) {
1837
- const [n, i] = En(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 Cn(
1853
- e,
1854
- t || (() => ({})),
1855
- () => r.reconnect()
1856
- );
1857
- }
1858
- function at(t, e) {
1859
- const r = [];
1860
- return typeof t != "function" && r.push(t), M(() => typeof t == "function" ? t() : t, r);
1861
- }
1862
- function wn(t) {
1863
- return M(
1864
- () => t.hooks.dragSource(),
1865
- [
1866
- t
1867
- ]
1868
- );
1869
- }
1870
- function Nn(t) {
1871
- return M(
1872
- () => t.hooks.dragPreview(),
1873
- [
1874
- t
1875
- ]
1876
- );
1877
- }
1878
- let de = !1, fe = !1;
1879
- class Pn {
1880
- receiveHandlerId(e) {
1881
- this.sourceId = e;
1882
- }
1883
- getHandlerId() {
1884
- return this.sourceId;
1885
- }
1886
- canDrag() {
1887
- y(!de, "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 de = !0, this.internalMonitor.canDragSource(this.sourceId);
1890
- } finally {
1891
- de = !1;
1892
- }
1893
- }
1894
- isDragging() {
1895
- if (!this.sourceId)
1896
- return !1;
1897
- y(!fe, "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 fe = !0, this.internalMonitor.isDraggingSource(this.sourceId);
1900
- } finally {
1901
- fe = !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 ge = !1;
1963
- class _n {
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(!ge, "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 ge = !0, this.internalMonitor.canDropOnTarget(this.targetId);
1979
- } finally {
1980
- ge = !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 xn(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 Rn(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 Se(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 o = Object.keys(t), a = Object.keys(e);
2040
- if (o.length !== a.length)
2041
- return !1;
2042
- const s = Object.prototype.hasOwnProperty.bind(e);
2043
- for (let u = 0; u < o.length; u++) {
2044
- const l = o[u];
2045
- if (!s(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 Oe(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 Ln(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 Mn(t) {
2066
- return (e = null, r = null) => {
2067
- if (!Pt(e)) {
2068
- const o = e;
2069
- return t(o, r), o;
2070
- }
2071
- const n = e;
2072
- return Ln(n), Fn(n, r ? (o) => t(o, r) : t);
2073
- };
2074
- }
2075
- function ct(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 = Mn(n);
2083
- e[r] = () => i;
2084
- }
2085
- }), e;
2086
- }
2087
- function $e(t, e) {
2088
- typeof t == "function" ? t(e) : t.current = e;
2089
- }
2090
- function Fn(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 ? ve(t, {
2093
- ref: (n) => {
2094
- $e(r, n), $e(e, n);
2095
- }
2096
- }) : ve(t, {
2097
- ref: e
2098
- });
2099
- }
2100
- class kn {
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 !Se(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
2148
- }
2149
- didDragPreviewOptionsChange() {
2150
- return !Se(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 = ct({
2172
- dragSource: (r, n) => {
2173
- this.clearDragSource(), this.dragSourceOptions = n || null, Oe(r) ? this.dragSourceRef = r : this.dragSourceNode = r, this.reconnectDragSource();
2174
- },
2175
- dragPreview: (r, n) => {
2176
- this.clearDragPreview(), this.dragPreviewOptions = n || null, Oe(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 An {
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 !Se(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 = ct({
2226
- dropTarget: (r, n) => {
2227
- this.clearDropTarget(), this.dropTargetOptions = n, Oe(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 J() {
2233
- const { dragDropManager: t } = _t(Ze);
2234
- return y(t != null, "Expected drag drop context"), t;
2235
- }
2236
- function Hn(t, e) {
2237
- const r = J(), n = M(
2238
- () => new kn(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 jn() {
2252
- const t = J();
2253
- return M(
2254
- () => new Pn(t),
2255
- [
2256
- t
2257
- ]
2258
- );
2259
- }
2260
- class Un {
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: o } = n;
2272
- return o ? o(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 Yn(t, e, r) {
2283
- const n = M(
2284
- () => new Un(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 Bn(t) {
2297
- return M(() => {
2298
- const e = t.type;
2299
- return y(e != null, "spec.type must be defined"), e;
2300
- }, [
2301
- t
2302
- ]);
2303
- }
2304
- function $n(t, e, r) {
2305
- const n = J(), i = Yn(t, e, r), o = Bn(t);
2306
- V(function() {
2307
- if (o != null) {
2308
- const [s, u] = Rn(o, i, n);
2309
- return e.receiveHandlerId(s), r.receiveHandlerId(s), u;
2310
- }
2311
- }, [
2312
- n,
2313
- e,
2314
- r,
2315
- i,
2316
- o
2317
- ]);
2318
- }
2319
- function Vn(t, e) {
2320
- const r = at(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 = jn(), i = Hn(r.options, r.previewOptions);
2323
- return $n(r, n, i), [
2324
- st(r.collect, n, i),
2325
- wn(i),
2326
- Nn(i)
2327
- ];
2328
- }
2329
- function zn(t) {
2330
- return M(
2331
- () => t.hooks.dropTarget(),
2332
- [
2333
- t
2334
- ]
2335
- );
2336
- }
2337
- function qn(t) {
2338
- const e = J(), r = M(
2339
- () => new An(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 Gn() {
2349
- const t = J();
2350
- return M(
2351
- () => new _n(t),
2352
- [
2353
- t
2354
- ]
2355
- );
2356
- }
2357
- function Xn(t) {
2358
- const { accept: e } = t;
2359
- return M(() => (y(t.accept != null, "accept must be defined"), Array.isArray(e) ? e : [
2360
- e
2361
- ]), [
2362
- e
2363
- ]);
2364
- }
2365
- class Wn {
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 Kn(t, e) {
2384
- const r = M(
2385
- () => new Wn(t, e),
2386
- [
2387
- e
2388
- ]
2389
- );
2390
- return R(() => {
2391
- r.spec = t;
2392
- }, [
2393
- t
2394
- ]), r;
2395
- }
2396
- function Jn(t, e, r) {
2397
- const n = J(), i = Kn(t, e), o = Xn(t);
2398
- V(function() {
2399
- const [s, u] = xn(o, i, n);
2400
- return e.receiveHandlerId(s), r.receiveHandlerId(s), u;
2401
- }, [
2402
- n,
2403
- e,
2404
- i,
2405
- r,
2406
- o.map(
2407
- (a) => a.toString()
2408
- ).join("|")
2409
- ]);
2410
- }
2411
- function Zn(t, e) {
2412
- const r = at(t), n = Gn(), i = qn(r.options);
2413
- return Jn(r, n, i), [
2414
- st(r.collect, n, i),
2415
- zn(i)
2416
- ];
2417
- }
2418
- function ut(t) {
2419
- let e = null;
2420
- return () => (e == null && (e = t()), e);
2421
- }
2422
- function Qn(t, e) {
2423
- return t.filter(
2424
- (r) => r !== e
2425
- );
2426
- }
2427
- function ei(t, e) {
2428
- const r = /* @__PURE__ */ new Set(), n = (o) => r.add(o);
2429
- t.forEach(n), e.forEach(n);
2430
- const i = [];
2431
- return r.forEach(
2432
- (o) => i.push(o)
2433
- ), i;
2434
- }
2435
- class ti {
2436
- enter(e) {
2437
- const r = this.entered.length, n = (i) => this.isNodeInDocument(i) && (!i.contains || i.contains(e));
2438
- return this.entered = ei(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 = Qn(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 ri {
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 lt = "__NATIVE_FILE__", dt = "__NATIVE_URL__", ft = "__NATIVE_TEXT__", gt = "__NATIVE_HTML__", Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2494
- __proto__: null,
2495
- FILE: lt,
2496
- HTML: gt,
2497
- TEXT: ft,
2498
- URL: dt
2499
- }, Symbol.toStringTag, { value: "Module" }));
2500
- function he(t, e, r) {
2501
- const n = e.reduce(
2502
- (i, o) => i || t.getData(o),
2503
- ""
2504
- );
2505
- return n ?? r;
2506
- }
2507
- const Te = {
2508
- [lt]: {
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
- [gt]: {
2519
- exposeProperties: {
2520
- html: (t, e) => he(t, e, ""),
2521
- dataTransfer: (t) => t
2522
- },
2523
- matchesTypes: [
2524
- "Html",
2525
- "text/html"
2526
- ]
2527
- },
2528
- [dt]: {
2529
- exposeProperties: {
2530
- urls: (t, e) => he(t, e, "").split(`
2531
- `),
2532
- dataTransfer: (t) => t
2533
- },
2534
- matchesTypes: [
2535
- "Url",
2536
- "text/uri-list"
2537
- ]
2538
- },
2539
- [ft]: {
2540
- exposeProperties: {
2541
- text: (t, e) => he(t, e, ""),
2542
- dataTransfer: (t) => t
2543
- },
2544
- matchesTypes: [
2545
- "Text",
2546
- "text/plain"
2547
- ]
2548
- }
2549
- };
2550
- function ni(t, e) {
2551
- const r = Te[t];
2552
- if (!r)
2553
- throw new Error(`native type ${t} has no configuration`);
2554
- const n = new ri(r);
2555
- return n.loadDataTransfer(e), n;
2556
- }
2557
- function pe(t) {
2558
- if (!t)
2559
- return null;
2560
- const e = Array.prototype.slice.call(t.types || []);
2561
- return Object.keys(Te).filter((r) => {
2562
- const n = Te[r];
2563
- return n?.matchesTypes ? n.matchesTypes.some(
2564
- (i) => e.indexOf(i) > -1
2565
- ) : !1;
2566
- })[0] || null;
2567
- }
2568
- const ii = ut(
2569
- () => /firefox/i.test(navigator.userAgent)
2570
- ), ht = ut(
2571
- () => !!window.safari
2572
- );
2573
- class ze {
2574
- interpolate(e) {
2575
- const { xs: r, ys: n, c1s: i, c2s: o, c3s: a } = this;
2576
- let s = r.length - 1;
2577
- if (e === r[s])
2578
- return n[s];
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
- s = Math.max(0, l);
2591
- const m = e - r[s], g = m * m;
2592
- return n[s] + i[s] * m + o[s] * g + a[s] * 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 o = [], a = [];
2602
- let s, u;
2603
- for (let d = 0; d < n - 1; d++)
2604
- s = e[d + 1] - e[d], u = r[d + 1] - r[d], o.push(s), a.push(u / s);
2605
- const l = [
2606
- a[0]
2607
- ];
2608
- for (let d = 0; d < o.length - 1; d++) {
2609
- const b = a[d], D = a[d + 1];
2610
- if (b * D <= 0)
2611
- l.push(0);
2612
- else {
2613
- s = o[d];
2614
- const E = o[d + 1], v = s + E;
2615
- l.push(3 * v / ((v + E) / b + (v + s) / 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 / o[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 oi = 1;
2630
- function pt(t) {
2631
- const e = t.nodeType === oi ? 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 ne(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" && (ii() || !(!((e = document.documentElement) === null || e === void 0) && e.contains(t)));
2649
- }
2650
- function ai(t, e, r, n) {
2651
- let i = t ? e.width : r, o = t ? e.height : n;
2652
- return ht() && t && (o /= window.devicePixelRatio, i /= window.devicePixelRatio), {
2653
- dragPreviewWidth: i,
2654
- dragPreviewHeight: o
2655
- };
2656
- }
2657
- function ci(t, e, r, n, i) {
2658
- const o = si(e), s = pt(o ? t : e), u = {
2659
- x: r.x - s.x,
2660
- y: r.y - s.y
2661
- }, { offsetWidth: l, offsetHeight: p } = t, { anchorX: m, anchorY: g } = n, { dragPreviewWidth: d, dragPreviewHeight: b } = ai(o, e, l, p), D = () => {
2662
- let S = new ze([
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 ht() && o && (S += (window.devicePixelRatio - 1) * b), S;
2675
- }, E = () => new ze([
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 ui {
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 li(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 qe(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
- li(t, i, r[i]);
2726
- });
2727
- }
2728
- return t;
2729
- }
2730
- class di {
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), o = (a) => this.handleSelectStart(a);
2783
- return r.setAttribute("draggable", "true"), r.addEventListener("dragstart", i), r.addEventListener("selectstart", o), () => {
2784
- this.sourceNodes.delete(e), this.sourceNodeOptions.delete(e), r.removeEventListener("dragstart", i), r.removeEventListener("selectstart", o), r.setAttribute("draggable", "false");
2785
- };
2786
- }
2787
- connectDropTarget(e, r) {
2788
- const n = (a) => this.handleDragEnter(a, e), i = (a) => this.handleDragOver(a, e), o = (a) => this.handleDrop(a, e);
2789
- return r.addEventListener("dragenter", n), r.addEventListener("dragover", i), r.addEventListener("drop", o), () => {
2790
- r.removeEventListener("dragenter", n), r.removeEventListener("dragover", i), r.removeEventListener("drop", o);
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 qe({
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 qe({
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(Ve).some(
2819
- (r) => Ve[r] === e
2820
- );
2821
- }
2822
- beginDragNativeItem(e, r) {
2823
- this.clearCurrentDragSourceNode(), this.currentNativeSource = ni(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 o = this.sourceNodes.get(i);
2860
- return o && pt(o) || 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: o } = this;
2880
- this.dragStartSourceIds = null;
2881
- const a = ne(i);
2882
- this.monitor.isDragging() && (this.actions.endDrag(), this.cancelHover()), this.actions.beginDrag(o || [], {
2883
- publishSource: !1,
2884
- getSourceClientOffset: this.getSourceClientOffset,
2885
- clientOffset: a
2886
- });
2887
- const { dataTransfer: s } = i, u = pe(s);
2888
- if (this.monitor.isDragging()) {
2889
- if (s && typeof s.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 = ci(m, g, a, {
2893
- anchorX: d,
2894
- anchorY: b
2895
- }, {
2896
- offsetX: D,
2897
- offsetY: E
2898
- });
2899
- s.setDragImage(g, I.x, I.y);
2900
- }
2901
- }
2902
- try {
2903
- s?.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 (s && !s.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 o;
2924
- (o = this.currentNativeSource) === null || o === void 0 || o.loadDataTransfer(i.dataTransfer);
2925
- }
2926
- if (!this.enterLeaveCounter.enter(i.target) || this.monitor.isDragging())
2927
- return;
2928
- const { dataTransfer: s } = i, u = pe(s);
2929
- u && this.beginDragNativeItem(u, s);
2930
- }, this.handleTopDragEnter = (i) => {
2931
- const { dragEnterTargetIds: o } = this;
2932
- if (this.dragEnterTargetIds = [], !this.monitor.isDragging())
2933
- return;
2934
- this.altKeyPressed = i.altKey, o.length > 0 && this.actions.hover(o, {
2935
- clientOffset: ne(i)
2936
- }), o.some(
2937
- (s) => this.monitor.canDropOnTarget(s)
2938
- ) && (i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = this.getCurrentDropEffect()));
2939
- }, this.handleTopDragOverCapture = (i) => {
2940
- if (this.dragOverTargetIds = [], this.isDraggingNativeItem()) {
2941
- var o;
2942
- (o = this.currentNativeSource) === null || o === void 0 || o.loadDataTransfer(i.dataTransfer);
2943
- }
2944
- }, this.handleTopDragOver = (i) => {
2945
- const { dragOverTargetIds: o } = 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 = ne(i), this.scheduleHover(o), (o || []).some(
2951
- (s) => this.monitor.canDropOnTarget(s)
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 o;
2961
- i.preventDefault(), (o = this.currentNativeSource) === null || o === void 0 || o.loadDataTransfer(i.dataTransfer);
2962
- } else pe(i.dataTransfer) && i.preventDefault();
2963
- this.enterLeaveCounter.reset();
2964
- }, this.handleTopDrop = (i) => {
2965
- const { dropTargetIds: o } = this;
2966
- this.dropTargetIds = [], this.actions.hover(o, {
2967
- clientOffset: ne(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 o = i.target;
2973
- typeof o.dragDrop == "function" && (o.tagName === "INPUT" || o.tagName === "SELECT" || o.tagName === "TEXTAREA" || o.isContentEditable || (i.preventDefault(), o.dragDrop()));
2974
- }, this.options = new ui(r, n), this.actions = e.getActions(), this.monitor = e.getMonitor(), this.registry = e.getRegistry(), this.enterLeaveCounter = new ti(this.isNodeInDocument);
2975
- }
2976
- }
2977
- const fi = function(e, r, n) {
2978
- return new di(e, r, n);
2979
- }, gi = [
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
- ], Ge = {
2998
- FILE: "file"
2999
- }, hi = ({
3000
- originNode: t,
3001
- file: e,
3002
- fileList: r,
3003
- moveFile: n,
3004
- onDrop: i
3005
- }) => {
3006
- const o = $(null), [{ handlerId: a }, s] = Zn({
3007
- accept: Ge.FILE,
3008
- collect: (m) => ({
3009
- handlerId: m.getHandlerId()
3010
- }),
3011
- hover(m, g) {
3012
- if (!o.current)
3013
- return;
3014
- const d = m.uid, b = e.uid;
3015
- if (d === b)
3016
- return;
3017
- const D = Z(r, { uid: b }), E = Z(r, { uid: d });
3018
- if (E === -1 || D === -1)
3019
- return;
3020
- const v = o.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] = Vn({
3030
- type: Ge.FILE,
3031
- item: () => ({
3032
- uid: e.uid,
3033
- index: Z(r, { uid: e.uid })
3034
- }),
3035
- collect: (m) => ({
3036
- isDragging: m.isDragging()
3037
- })
3038
- }), p = u ? 0 : 1;
3039
- return l(s(o)), /* @__PURE__ */ c("div", { ref: o, style: { opacity: p }, "data-handler-id": a, children: t });
3040
- }, Hi = ({
3041
- fileGrpKey: t,
3042
- onUploadComplete: e,
3043
- onFetchFilesTrxCd: r = "SCMFILE00101",
3044
- onSuccessTrxCd: n = "SCMFILE00102",
3045
- onDeleteFileTrxCd: i = "SCMFILE00103",
3046
- onReorderFilesTrxCd: o = "SCMFILE00104",
3047
- allowedExtensions: a = gi,
3048
- maxFileSize: s = 200,
3049
- showButton: u = !0,
3050
- // 기본값으로 true 설정
3051
- multiple: l = !1
3052
- }) => {
3053
- const [p, m] = L([]), g = $(t), d = $([]), D = $(
3054
- Yt(() => {
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: H()?.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: H()?.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 N = /* @__PURE__ */ new Map();
3080
- S.sub.forEach((C) => {
3081
- const P = f.find(
3082
- (x) => x.fileNameL === C.lgclFileNm
3083
- );
3084
- P && N.set(P.tempId, C);
3085
- }), m((C) => C.map((x) => {
3086
- const w = N.get(x.uid);
3087
- if (w) {
3088
- const z = f.find(
3089
- (q) => q.tempId === x.uid
3090
- );
3091
- return e && z && e({
3092
- ...z,
3093
- fileGrpKey: O,
3094
- fileKey: w.fileKey
3095
- }), {
3096
- ...x,
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 x;
3106
- }));
3107
- }
3108
- }).catch((S) => {
3109
- console.error("업로드 후처리 서비스 호출 실패:", S), _.error("파일 후처리 중 오류가 발생했습니다.");
3110
- const O = new Set(f.map((N) => N.tempId));
3111
- m(
3112
- (N) => N.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: H()?.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), _.error("파일 목록을 불러오는 중 오류가 발생했습니다.");
3141
- });
3142
- }, [t, r]);
3143
- const E = (f, T) => {
3144
- const S = Z(p, { uid: f }), O = Z(p, { uid: T });
3145
- if (S < 0 || O < 0) return;
3146
- const N = [...p], [C] = N.splice(S, 1);
3147
- N.splice(O, 0, C), m(N);
3148
- }, v = () => {
3149
- if (t && o) {
3150
- const f = p.map((T) => T.uid);
3151
- U(o, {
3152
- crprCd: H()?.crprCd,
3153
- sysCd: __SYS_CD__,
3154
- fileGrpKey: t,
3155
- reorderedFileKeys: f
3156
- }).then(() => {
3157
- _.success("파일 순서가 성공적으로 저장되었습니다.");
3158
- }).catch((T) => {
3159
- console.error("파일 순서 저장 서비스 호출 실패:", T), _.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 _.error("하나의 파일만 업로드할 수 있습니다."), j.LIST_IGNORE;
3170
- if (a && a.length > 0) {
3171
- const T = `.${f.name.split(".").pop()?.toLowerCase()}`;
3172
- if (!a.includes(T))
3173
- return _.error(
3174
- `${f.name} 파일은 허용되지 않는 확장자입니다. (${a.join(
3175
- ", "
3176
- )})`
3177
- ), j.LIST_IGNORE;
3178
- }
3179
- return s && !(f.size / 1024 / 1024 < s) ? (_.error(`일반업로드의 최대용량은 ${s}MB입니다.`), j.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: H()?.crprCd,
3190
- sysCd: __SYS_CD__,
3191
- fileGrpKey: g.current,
3192
- fileKey: S
3193
- }).then(() => {
3194
- _.success("파일이 성공적으로 삭제되었습니다."), m(f.fileList);
3195
- }).catch((O) => {
3196
- console.error("파일 삭제 서비스 호출에 실패했습니다.", O), _.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((N) => {
3204
- N.tempId = f.file.uid, d.current.push(N);
3205
- }), D()), _.success(
3206
- f.file.response.message || `${f.file.name} 파일이 성공적으로 업로드되었습니다.`
3207
- );
3208
- } else
3209
- _.error(
3210
- f.file.response?.message || `${f.file.name} 파일 업로드에 실패했습니다.`
3211
- );
3212
- else T === "error" && _.error(
3213
- f.file.response?.message || `${f.file.name} 파일 업로드 중 오류가 발생했습니다.`
3214
- );
3215
- },
3216
- itemRender(f, T, S) {
3217
- const O = ve(f, {
3218
- href: T.url || void 0,
3219
- title: void 0
3220
- });
3221
- return /* @__PURE__ */ c(
3222
- hi,
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(yn, { backend: fi, children: /* @__PURE__ */ c(j, { headers: { SYSCD: __SYS_CD__ }, ...I, listType: "picture", children: u && (l || p.length === 0) && /* @__PURE__ */ c(Y, { icon: /* @__PURE__ */ c(Ke, {}), children: "파일 선택" }) }) });
3235
- };
3236
- export {
3237
- Ci as B,
3238
- wi as a,
3239
- Ni as b,
3240
- _i as c,
3241
- xi as d,
3242
- Ri as e,
3243
- Li as f,
3244
- Mi as g,
3245
- Fi as h,
3246
- ki as i,
3247
- Ai as j,
3248
- Hi as k
3249
- };
3250
- //# sourceMappingURL=BwgUploader-BUmFmeuS.js.map