@bwg-ui/core 1.1.16 → 1.1.17

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 (129) hide show
  1. package/dist/chunks/{BwgLargeUploader-Nx2-wiD8.js → BwgLargeUploader-CBwGaHh6.js} +69 -70
  2. package/dist/chunks/BwgLargeUploader-CBwGaHh6.js.map +1 -0
  3. package/dist/chunks/BwgLargeUploader-CVdp_rxx.cjs +3 -0
  4. package/dist/chunks/BwgLargeUploader-CVdp_rxx.cjs.map +1 -0
  5. package/dist/chunks/{SSOHandler-DrKRTb6h.js → SSOHandler-BfRH51hZ.js} +250 -249
  6. package/dist/chunks/SSOHandler-BfRH51hZ.js.map +1 -0
  7. package/dist/chunks/{SSOHandler-DZeC8Xgh.cjs → SSOHandler-DoidypM2.cjs} +43 -43
  8. package/dist/chunks/SSOHandler-DoidypM2.cjs.map +1 -0
  9. package/dist/chunks/{SearchBoxContext-Cpr9xa1S.cjs → SearchBoxContext-CNoEc4uu.cjs} +2 -2
  10. package/dist/chunks/{SearchBoxContext-Cpr9xa1S.cjs.map → SearchBoxContext-CNoEc4uu.cjs.map} +1 -1
  11. package/dist/chunks/{SearchBoxContext-BxtHF9BO.js → SearchBoxContext-CjdCL1e9.js} +10 -10
  12. package/dist/chunks/{SearchBoxContext-BxtHF9BO.js.map → SearchBoxContext-CjdCL1e9.js.map} +1 -1
  13. package/dist/chunks/{ViewContainer-BJQtASUE.cjs → ViewContainer-DUjKBgcl.cjs} +2 -2
  14. package/dist/chunks/{ViewContainer-BJQtASUE.cjs.map → ViewContainer-DUjKBgcl.cjs.map} +1 -1
  15. package/dist/chunks/{ViewContainer-D6ne-F5v.js → ViewContainer-Du3IzFYo.js} +7 -7
  16. package/dist/chunks/{ViewContainer-D6ne-F5v.js.map → ViewContainer-Du3IzFYo.js.map} +1 -1
  17. package/dist/chunks/apiUtils-DlsnkCO4.cjs +3 -0
  18. package/dist/chunks/apiUtils-DlsnkCO4.cjs.map +1 -0
  19. package/dist/chunks/apiUtils-IzgDPO-1.js +1277 -0
  20. package/dist/chunks/apiUtils-IzgDPO-1.js.map +1 -0
  21. package/dist/chunks/{codeStore-BzT5wSd9.js → codeStore-Dsjc4uXs.js} +2 -2
  22. package/dist/chunks/{codeStore-BzT5wSd9.js.map → codeStore-Dsjc4uXs.js.map} +1 -1
  23. package/dist/chunks/{codeStore-BGLhSpAM.cjs → codeStore-HfLmmkAL.cjs} +2 -2
  24. package/dist/chunks/{codeStore-BGLhSpAM.cjs.map → codeStore-HfLmmkAL.cjs.map} +1 -1
  25. package/dist/chunks/envUtils-C4Yv5Nfg.cjs +2 -0
  26. package/dist/chunks/{envUtils-CduTHoHu.cjs.map → envUtils-C4Yv5Nfg.cjs.map} +1 -1
  27. package/dist/chunks/envUtils-Ck_DT0s_.js +43 -0
  28. package/dist/chunks/{envUtils-C9Gf5aek.js.map → envUtils-Ck_DT0s_.js.map} +1 -1
  29. package/dist/chunks/{favoriteStore-C9utQ6sm.js → favoriteStore-C0o6Sj55.js} +6 -6
  30. package/dist/chunks/favoriteStore-C0o6Sj55.js.map +1 -0
  31. package/dist/chunks/{favoriteStore-3YceyayF.cjs → favoriteStore-DOz2rAJu.cjs} +2 -2
  32. package/dist/chunks/favoriteStore-DOz2rAJu.cjs.map +1 -0
  33. package/dist/chunks/popupStore-Cm5utmtA.cjs +2 -0
  34. package/dist/chunks/popupStore-Cm5utmtA.cjs.map +1 -0
  35. package/dist/chunks/popupStore-D6b6b5-T.js +92 -0
  36. package/dist/chunks/popupStore-D6b6b5-T.js.map +1 -0
  37. package/dist/chunks/usePopup-BG24CocH.cjs +2 -0
  38. package/dist/chunks/usePopup-BG24CocH.cjs.map +1 -0
  39. package/dist/chunks/usePopup-Dm-UyUbV.js +109 -0
  40. package/dist/chunks/usePopup-Dm-UyUbV.js.map +1 -0
  41. package/dist/components/common/BwgButtonGroup.d.ts.map +1 -1
  42. package/dist/components/common/BwgGrid.d.ts +5 -1
  43. package/dist/components/common/BwgGrid.d.ts.map +1 -1
  44. package/dist/components/common/index.cjs +1 -1
  45. package/dist/components/common/index.js +1 -1
  46. package/dist/components/core/BwgDatePicker.d.ts.map +1 -1
  47. package/dist/components/core/BwgLargeUploader.d.ts.map +1 -1
  48. package/dist/components/core/BwgMaskedInput.d.ts +1 -1
  49. package/dist/components/core/BwgMaskedInput.d.ts.map +1 -1
  50. package/dist/components/core/BwgMaskedPicker.d.ts +1 -1
  51. package/dist/components/core/BwgMaskedPicker.d.ts.map +1 -1
  52. package/dist/components/core/BwgNumber.d.ts +0 -1
  53. package/dist/components/core/BwgNumber.d.ts.map +1 -1
  54. package/dist/components/core/BwgUploader.d.ts.map +1 -1
  55. package/dist/components/core/index.cjs +1 -1
  56. package/dist/components/core/index.js +1 -1
  57. package/dist/components/layout/index.cjs +1 -1
  58. package/dist/components/layout/index.js +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.js +218 -314
  61. package/dist/index.js.map +1 -1
  62. package/dist/provider/contexts/index.d.ts +0 -1
  63. package/dist/provider/contexts/index.d.ts.map +1 -1
  64. package/dist/provider/index.cjs +1 -1
  65. package/dist/provider/index.js +24 -31
  66. package/dist/stores/favoriteStore.d.ts.map +1 -1
  67. package/dist/stores/index.cjs +1 -1
  68. package/dist/stores/index.js +8 -8
  69. package/dist/utils/commonUtils.d.ts +236 -37
  70. package/dist/utils/commonUtils.d.ts.map +1 -1
  71. package/dist/utils/{FileUtils.d.ts → fileUtils.d.ts} +9 -1
  72. package/dist/utils/fileUtils.d.ts.map +1 -0
  73. package/dist/utils/index.cjs +1 -1
  74. package/dist/utils/index.cjs.map +1 -1
  75. package/dist/utils/index.d.ts +381 -15
  76. package/dist/utils/index.d.ts.map +1 -1
  77. package/dist/utils/index.js +215 -208
  78. package/dist/utils/index.js.map +1 -1
  79. package/dist/utils/notificationUtils.d.ts +5 -5
  80. package/dist/utils/notificationUtils.d.ts.map +1 -1
  81. package/package.json +2 -1
  82. package/dist/chunks/BwgLargeUploader-CgrJUwFW.cjs +0 -3
  83. package/dist/chunks/BwgLargeUploader-CgrJUwFW.cjs.map +0 -1
  84. package/dist/chunks/BwgLargeUploader-Nx2-wiD8.js.map +0 -1
  85. package/dist/chunks/FileUtils-Bbz3AvQn.js +0 -141
  86. package/dist/chunks/FileUtils-Bbz3AvQn.js.map +0 -1
  87. package/dist/chunks/FileUtils-D73GVmB8.cjs +0 -2
  88. package/dist/chunks/FileUtils-D73GVmB8.cjs.map +0 -1
  89. package/dist/chunks/SSOHandler-DZeC8Xgh.cjs.map +0 -1
  90. package/dist/chunks/SSOHandler-DrKRTb6h.js.map +0 -1
  91. package/dist/chunks/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  92. package/dist/chunks/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  93. package/dist/chunks/_commonjsHelpers-DaMA6jEr.js +0 -9
  94. package/dist/chunks/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  95. package/dist/chunks/apiUtils-C45AWfu-.js +0 -957
  96. package/dist/chunks/apiUtils-C45AWfu-.js.map +0 -1
  97. package/dist/chunks/apiUtils-Cbg6NQLv.cjs +0 -4
  98. package/dist/chunks/apiUtils-Cbg6NQLv.cjs.map +0 -1
  99. package/dist/chunks/commonUtils-BH6QwGUb.cjs +0 -2
  100. package/dist/chunks/commonUtils-BH6QwGUb.cjs.map +0 -1
  101. package/dist/chunks/commonUtils-Bb16Yqjk.js +0 -629
  102. package/dist/chunks/commonUtils-Bb16Yqjk.js.map +0 -1
  103. package/dist/chunks/envUtils-C9Gf5aek.js +0 -30
  104. package/dist/chunks/envUtils-CduTHoHu.cjs +0 -2
  105. package/dist/chunks/favoriteStore-3YceyayF.cjs.map +0 -1
  106. package/dist/chunks/favoriteStore-C9utQ6sm.js.map +0 -1
  107. package/dist/chunks/popupStore-DmFbkkjd.js +0 -98
  108. package/dist/chunks/popupStore-DmFbkkjd.js.map +0 -1
  109. package/dist/chunks/popupStore-DnWLaQ70.cjs +0 -2
  110. package/dist/chunks/popupStore-DnWLaQ70.cjs.map +0 -1
  111. package/dist/chunks/usePopup-C8FrbrDD.cjs +0 -2
  112. package/dist/chunks/usePopup-C8FrbrDD.cjs.map +0 -1
  113. package/dist/chunks/usePopup-pfh-ajfP.js +0 -241
  114. package/dist/chunks/usePopup-pfh-ajfP.js.map +0 -1
  115. package/dist/provider/contexts/UtilsContext.d.ts +0 -195
  116. package/dist/provider/contexts/UtilsContext.d.ts.map +0 -1
  117. package/dist/utils/FileUtils.d.ts.map +0 -1
  118. package/dist/utils/arrayUtils.d.ts +0 -35
  119. package/dist/utils/arrayUtils.d.ts.map +0 -1
  120. package/dist/utils/cookieUtils.d.ts +0 -5
  121. package/dist/utils/cookieUtils.d.ts.map +0 -1
  122. package/dist/utils/dateUtils.d.ts +0 -27
  123. package/dist/utils/dateUtils.d.ts.map +0 -1
  124. package/dist/utils/imageUtils.d.ts +0 -32
  125. package/dist/utils/imageUtils.d.ts.map +0 -1
  126. package/dist/utils/objectUtils.d.ts +0 -28
  127. package/dist/utils/objectUtils.d.ts.map +0 -1
  128. package/dist/utils/stringUtils.d.ts +0 -143
  129. package/dist/utils/stringUtils.d.ts.map +0 -1
@@ -0,0 +1,1277 @@
1
+ import te from "axios";
2
+ import L from "dayjs";
3
+ import { i as Z } from "./envUtils-Ck_DT0s_.js";
4
+ import { message as G, notification as O } from "antd";
5
+ import { create as z } from "zustand";
6
+ var pr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
7
+ function re(e) {
8
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
9
+ }
10
+ const de = {
11
+ // 권한 관련
12
+ AUTH_BTNS: "SCMSIGN00202",
13
+ // 버튼 권한 조회
14
+ AUTH_MENU: "SCMSIGN00201",
15
+ // 메뉴 권한 조회
16
+ SRCH_CODE: "SCMSIGN00301",
17
+ // 코드 조회
18
+ // 팝업 관련
19
+ SRCH_POPU: "SCMPOPU00101",
20
+ // 팝업 조회
21
+ // 즐겨찾기 관련
22
+ AUTH_BMRK: "SCMBMRK00101"
23
+ // 즐겨찾기 관리
24
+ };
25
+ let A = {};
26
+ function Ce(e) {
27
+ A = e, console.log("🔧 Provider 서비스코드 오버라이드 설정:", e);
28
+ }
29
+ function ne(e) {
30
+ return A[e] && A[e].trim() !== "" ? A[e] : de[e];
31
+ }
32
+ function fe() {
33
+ const e = {};
34
+ for (const r of Object.keys(de))
35
+ e[r] = ne(r);
36
+ return e;
37
+ }
38
+ function _e() {
39
+ console.log("🔧 bwg-core 서비스코드 설정:"), console.log("📋 Provider 설정 > 기본값 순서로 확인");
40
+ const e = fe();
41
+ for (const [r, t] of Object.entries(e)) {
42
+ const n = A[r] ? "Provider 설정" : "기본값";
43
+ console.log(` ${r}: ${t} (${n})`);
44
+ }
45
+ }
46
+ const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47
+ __proto__: null,
48
+ getAllServiceCodes: fe,
49
+ getServiceCode: ne,
50
+ logServiceCodeConfig: _e,
51
+ setServiceCodeOverrides: Ce
52
+ }, Symbol.toStringTag, { value: "Module" }));
53
+ import.meta.env.DEV;
54
+ function xe(e, r) {
55
+ let t;
56
+ try {
57
+ t = e();
58
+ } catch {
59
+ return;
60
+ }
61
+ return {
62
+ getItem: (a) => {
63
+ var o;
64
+ const i = (c) => c === null ? null : JSON.parse(c, void 0), m = (o = t.getItem(a)) != null ? o : null;
65
+ return m instanceof Promise ? m.then(i) : i(m);
66
+ },
67
+ setItem: (a, o) => t.setItem(a, JSON.stringify(o, void 0)),
68
+ removeItem: (a) => t.removeItem(a)
69
+ };
70
+ }
71
+ const X = (e) => (r) => {
72
+ try {
73
+ const t = e(r);
74
+ return t instanceof Promise ? t : {
75
+ then(n) {
76
+ return X(n)(t);
77
+ },
78
+ catch(n) {
79
+ return this;
80
+ }
81
+ };
82
+ } catch (t) {
83
+ return {
84
+ then(n) {
85
+ return this;
86
+ },
87
+ catch(n) {
88
+ return X(n)(t);
89
+ }
90
+ };
91
+ }
92
+ }, De = (e, r) => (t, n, a) => {
93
+ let o = {
94
+ storage: xe(() => localStorage),
95
+ partialize: (s) => s,
96
+ version: 0,
97
+ merge: (s, d) => ({
98
+ ...d,
99
+ ...s
100
+ }),
101
+ ...r
102
+ }, i = !1;
103
+ const m = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
104
+ let p = o.storage;
105
+ if (!p)
106
+ return e(
107
+ (...s) => {
108
+ console.warn(
109
+ `[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`
110
+ ), t(...s);
111
+ },
112
+ n,
113
+ a
114
+ );
115
+ const g = () => {
116
+ const s = o.partialize({ ...n() });
117
+ return p.setItem(o.name, {
118
+ state: s,
119
+ version: o.version
120
+ });
121
+ }, S = a.setState;
122
+ a.setState = (s, d) => (S(s, d), g());
123
+ const u = e(
124
+ (...s) => (t(...s), g()),
125
+ n,
126
+ a
127
+ );
128
+ a.getInitialState = () => u;
129
+ let f;
130
+ const l = () => {
131
+ var s, d;
132
+ if (!p) return;
133
+ i = !1, m.forEach((h) => {
134
+ var v;
135
+ return h((v = n()) != null ? v : u);
136
+ });
137
+ const y = ((d = o.onRehydrateStorage) == null ? void 0 : d.call(o, (s = n()) != null ? s : u)) || void 0;
138
+ return X(p.getItem.bind(p))(o.name).then((h) => {
139
+ if (h)
140
+ if (typeof h.version == "number" && h.version !== o.version) {
141
+ if (o.migrate) {
142
+ const v = o.migrate(
143
+ h.state,
144
+ h.version
145
+ );
146
+ return v instanceof Promise ? v.then((T) => [!0, T]) : [!0, v];
147
+ }
148
+ console.error(
149
+ "State loaded from storage couldn't be migrated since no migrate function was provided"
150
+ );
151
+ } else
152
+ return [!1, h.state];
153
+ return [!1, void 0];
154
+ }).then((h) => {
155
+ var v;
156
+ const [T, M] = h;
157
+ if (f = o.merge(
158
+ M,
159
+ (v = n()) != null ? v : u
160
+ ), t(f, !0), T)
161
+ return g();
162
+ }).then(() => {
163
+ y?.(f, void 0), f = n(), i = !0, c.forEach((h) => h(f));
164
+ }).catch((h) => {
165
+ y?.(void 0, h);
166
+ });
167
+ };
168
+ return a.persist = {
169
+ setOptions: (s) => {
170
+ o = {
171
+ ...o,
172
+ ...s
173
+ }, s.storage && (p = s.storage);
174
+ },
175
+ clearStorage: () => {
176
+ p?.removeItem(o.name);
177
+ },
178
+ getOptions: () => o,
179
+ rehydrate: () => l(),
180
+ hasHydrated: () => i,
181
+ onHydrate: (s) => (m.add(s), () => {
182
+ m.delete(s);
183
+ }),
184
+ onFinishHydration: (s) => (c.add(s), () => {
185
+ c.delete(s);
186
+ })
187
+ }, o.skipHydration || l(), f || u;
188
+ }, Ne = De, _ = z()(
189
+ Ne(
190
+ (e, r) => ({
191
+ user: null,
192
+ isLoggedIn: !1,
193
+ // 로그인
194
+ login: (t) => {
195
+ e({ user: t, isLoggedIn: !0 }), console.log("사용자 로그인:", t);
196
+ },
197
+ // 로그아웃
198
+ logout: () => {
199
+ e({ user: null, isLoggedIn: !1 }), console.log("사용자 로그아웃");
200
+ },
201
+ // 사용자 정보 업데이트
202
+ updateUser: (t) => {
203
+ const n = r().user;
204
+ n && e({ user: { ...n, ...t } });
205
+ }
206
+ }),
207
+ {
208
+ name: "user-storage",
209
+ // 로컬 스토리지 키
210
+ partialize: (e) => ({
211
+ user: e.user,
212
+ isLoggedIn: e.isLoggedIn
213
+ })
214
+ // 저장할 상태만 선택
215
+ }
216
+ )
217
+ ), $e = () => _.getState().user?.crprCd || null, me = () => _.getState().user?.userId || null, he = () => _.getState().user?.userNm || null, Oe = () => _.getState().user?.userDvsn || null, Le = () => _.getState().user?.emplNo || null, ge = () => _.getState().user?.dprtCd || null, pe = () => _.getState().user?.dprtNm || null, B = () => _.getState().user?.roleList || null, Ue = (e) => {
218
+ const r = B();
219
+ return r ? r.includes(e) : !1;
220
+ }, Pe = (e) => {
221
+ const r = B();
222
+ return r ? e.some((t) => r.includes(t)) : !1;
223
+ }, Ee = (e) => {
224
+ const r = B();
225
+ return r ? e.every((t) => r.includes(t)) : !1;
226
+ }, Ae = () => _.getState().isLoggedIn, se = () => _.getState().user, ke = () => se() !== null, Ye = () => {
227
+ const e = he(), r = me();
228
+ return e || r || null;
229
+ }, Fe = () => {
230
+ const e = pe(), r = ge();
231
+ return e || (r ? String(r) : null);
232
+ }, yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
233
+ __proto__: null,
234
+ getCrprCd: $e,
235
+ getDepartmentInfo: Fe,
236
+ getDisplayName: Ye,
237
+ getDprtCd: ge,
238
+ getDprtNm: pe,
239
+ getEmplNo: Le,
240
+ getRoleList: B,
241
+ getUserDvsn: Oe,
242
+ getUserId: me,
243
+ getUserInfo: se,
244
+ getUserNm: he,
245
+ hasAllRoles: Ee,
246
+ hasAnyRole: Pe,
247
+ hasRole: Ue,
248
+ hasUserInfo: ke,
249
+ isLoggedIn: Ae
250
+ }, Symbol.toStringTag, { value: "Module" })), V = {
251
+ DEFAULT_PRNT_GBCD: 1
252
+ }, Re = (e) => e && typeof e == "object" && typeof e.menuId == "string" && typeof e.menuNm == "string" && typeof e.crprCd == "string", oe = (e) => Array.isArray(e) && e.every(Re);
253
+ let K = [], ae = [];
254
+ const je = (e) => {
255
+ if (e && typeof e == "object") {
256
+ const r = e;
257
+ if (r.menus && oe(r.menus)) return r.menus;
258
+ if (oe(e)) return e;
259
+ }
260
+ return console.warn("⚠️ 메뉴 응답이 비어있거나 예상과 다릅니다."), [];
261
+ }, ze = (e, r) => !!r && e.crprCd === r.crprCd && e.userId === r.userId && (e.prntGbcd ?? V.DEFAULT_PRNT_GBCD) === (r.prntGbcd ?? V.DEFAULT_PRNT_GBCD), Be = (e) => {
262
+ if (K.length === e.length && K.every(
263
+ (o, i) => o.menuId === e[i]?.menuId && o.menuPrntId === e[i]?.menuPrntId
264
+ ))
265
+ return ae;
266
+ if (!e.length) return [];
267
+ const r = /* @__PURE__ */ new Map(), t = [];
268
+ e.forEach((o) => o?.menuId && r.set(o.menuId, { ...o, children: [] })), e.forEach((o) => {
269
+ const i = r.get(o.menuId);
270
+ i && (o.menuPrntId && o.menuPrntId !== "" && o.menuPrntId !== "-" ? r.get(o.menuPrntId)?.children?.push(i) : t.push(i));
271
+ });
272
+ const n = (o) => o.sort((i, m) => (i?.menuNo ?? 0) - (m?.menuNo ?? 0)).map((i) => ({
273
+ ...i,
274
+ children: i.children && i.children.length ? n(i.children) : void 0
275
+ })), a = n(t);
276
+ return K = [...e], ae = a, a;
277
+ }, He = z((e, r) => ({
278
+ // 📊 초기 상태값
279
+ menuList: [],
280
+ flatMenuList: [],
281
+ isLoading: !1,
282
+ error: null,
283
+ _lastFetchParams: null,
284
+ // 🔧 메뉴 모델 조회
285
+ // 서버에서 사용자별 메뉴 권한 데이터를 가져와서 트리/플랫 구조로 저장
286
+ fetchMenu: async ({ crprCd: t, userId: n, prntGbcd: a }) => {
287
+ const o = {
288
+ crprCd: t,
289
+ userId: n,
290
+ prntGbcd: a ?? V.DEFAULT_PRNT_GBCD
291
+ };
292
+ if (ze(o, r()._lastFetchParams)) {
293
+ console.log("✅ 중복 fetch 차단", o);
294
+ return;
295
+ }
296
+ e({ isLoading: !0, error: null, _lastFetchParams: o });
297
+ try {
298
+ const i = await U(ne("AUTH_MENU"), o), m = je(i), c = Be(m);
299
+ e({
300
+ flatMenuList: m,
301
+ // 평면 리스트 저장
302
+ menuList: c,
303
+ // 트리 구조 저장
304
+ isLoading: !1,
305
+ error: null
306
+ });
307
+ } catch (i) {
308
+ e({ isLoading: !1, error: i?.message ?? "메뉴 로드 실패" });
309
+ }
310
+ },
311
+ // 🔧 메뉴 모델 초기화
312
+ // 로그아웃 시나 사용자 변경 시 메뉴 모델 클리어
313
+ clearMenu: () => {
314
+ e({
315
+ menuList: [],
316
+ flatMenuList: [],
317
+ error: null,
318
+ _lastFetchParams: null
319
+ });
320
+ },
321
+ // 🔧 메뉴 ID로 메뉴 아이템 찾기
322
+ // URL 파라미터나 프로그래밍 방식으로 특정 메뉴를 찾을 때 사용
323
+ findMenuById: (t) => {
324
+ const { flatMenuList: n } = r();
325
+ return n.find((a) => a.menuId === t) ?? null;
326
+ }
327
+ })), J = {
328
+ MAX_TABS: 15
329
+ }, qe = z((e, r) => ({
330
+ // 📊 초기 상태값
331
+ activeMenuId: null,
332
+ activeMenuItem: null,
333
+ activeDetailItem: null,
334
+ tabs: [],
335
+ sidebarCollapsed: !1,
336
+ maxTabs: J.MAX_TABS,
337
+ tabProtectFlag: {},
338
+ tabParams: {},
339
+ componentLabelMap: {},
340
+ // 🔧 탭 추가 (메뉴 아이템 객체로)
341
+ // 사이드바에서 메뉴 클릭 시 호출되는 메인 함수
342
+ openTabFromMenu: (t, n) => {
343
+ const { tabs: a, activeMenuId: o } = r(), i = a.find((c) => c.key === t.menuId), m = a.find((c) => c.key === t.menuId);
344
+ if (i)
345
+ m != null ? (e({ activeMenuId: t.menuId, activeMenuItem: t }), r().setTabParams(t.menuId, n || {}), t?.prsnInfoYn === "Y" && r().setProtectFlagForKey(t.menuId)) : G.warning("유효하지 않은 메뉴정보입니다.");
346
+ else {
347
+ if (a.length > J.MAX_TABS) {
348
+ console.warn("❌ 최대 탭 개수를 초과했습니다."), G.warning(
349
+ `최대 ${J.MAX_TABS}개의 탭만 열 수 있습니다.
350
+ 기존 탭을 닫고 다시 시도해주세요.`
351
+ );
352
+ return;
353
+ }
354
+ const c = {
355
+ key: t.menuId,
356
+ label: t.menuNm,
357
+ gubun: "M",
358
+ menuItem: t,
359
+ closable: !0
360
+ };
361
+ e({
362
+ tabs: [...a, c],
363
+ // 탭 목록에 추가
364
+ activeMenuId: t.menuId,
365
+ // 새 탭을 활성화
366
+ activeMenuItem: t
367
+ // 현재 프로그램으로 설정
368
+ }), r().setTabParams(t.menuId, n || {}), t?.prsnInfoYn === "Y" && r().setProtectFlagForKey(t.menuId);
369
+ }
370
+ },
371
+ // 🔧 탭 추가 (메뉴 ID로)
372
+ // URL 파라미터로 메뉴 열기 시 사용 (예: ?menuId=CM000301)
373
+ openTabByMenuId: (t, n) => {
374
+ const a = He.getState().findMenuById(t);
375
+ a ? r().openTabFromMenu(a, n) : G.warning("메뉴 ID를 찾을 수 없습니다.");
376
+ },
377
+ openDetailView: (t, n, a) => {
378
+ const { tabs: o, activeMenuId: i } = r();
379
+ if (o.find((c) => c.key === t.viewId))
380
+ r().focusTab(t.viewId);
381
+ else {
382
+ const c = {
383
+ key: t.viewId,
384
+ label: t.viewLabel,
385
+ gubun: "C",
386
+ componentItem: {
387
+ scrnPath: n,
388
+ prsnInfoYn: a,
389
+ prntInfo: t.prntInfo
390
+ },
391
+ closable: !0
392
+ };
393
+ e({
394
+ tabs: [...o, c],
395
+ // 탭 목록에 추가
396
+ activeMenuId: t.viewId,
397
+ // 새 탭을 활성화
398
+ activeDetailItem: t
399
+ }), r().setTabParams(t.viewId, t.viewParams || {});
400
+ }
401
+ },
402
+ // 🔧 탭 제거
403
+ // X 버튼 클릭 시 탭을 닫고 관련 상태도 정리
404
+ closeTab: (t) => {
405
+ const { tabs: n, activeMenuId: a } = r();
406
+ n.find((m) => m.key === t);
407
+ const o = n.filter((m) => m.key !== t);
408
+ let i = a;
409
+ if (a === t) {
410
+ const m = n.findIndex((c) => c.key === t);
411
+ i = o.length ? o[Math.min(m, o.length - 1)]?.key ?? null : null;
412
+ }
413
+ e({
414
+ tabs: o
415
+ }), i && r().focusTab(i);
416
+ },
417
+ // 🔧 활성 탭 변경
418
+ // 탭 헤더 클릭 시 해당 탭으로 전환
419
+ focusTab: (t) => {
420
+ const { tabs: n } = r(), a = n.find((o) => o.key === t);
421
+ if (a) {
422
+ const o = a.gubun === "C" ? {
423
+ viewId: a.key,
424
+ viewLabel: a.label,
425
+ prntInfo: a.componentItem?.prntInfo
426
+ } : null;
427
+ a.menuItem?.prsnInfoYn === "Y" ? (e({
428
+ activeMenuId: t,
429
+ activeMenuItem: a.menuItem,
430
+ activeDetailItem: o
431
+ }), console.log(
432
+ "✅ 탭 포커스 (개인정보) - activeMenuItem:",
433
+ a.menuItem
434
+ ), r().setProtectFlagForKey(t)) : (e({
435
+ activeMenuId: t,
436
+ activeMenuItem: a.menuItem,
437
+ activeDetailItem: o
438
+ }), r().clearProtectFlagForKey(t));
439
+ } else
440
+ e({ activeMenuId: t, activeMenuItem: null, activeDetailItem: null }), console.warn("❌ 탭을 찾을 수 없음:", t);
441
+ },
442
+ // 🔧 모든 탭 제거
443
+ // 로그아웃이나 전체 초기화 시 사용
444
+ closeAllTabs: () => e({ tabs: [], activeMenuId: null, activeMenuItem: null, activeDetailItem: null }),
445
+ // 🔧 사이드바 토글
446
+ // 햄버거 메뉴 클릭 시 사이드바 접기/펼치기
447
+ toggleSidebar: () => e((t) => ({ sidebarCollapsed: !t.sidebarCollapsed })),
448
+ // useMenuViewStore.ts
449
+ reorderTabs: (t) => e((n) => {
450
+ const a = new Map(n.tabs.map((o) => [o.key, o]));
451
+ return { tabs: t.map((o) => a.get(o)).filter(Boolean) };
452
+ }),
453
+ // 개인정보 포함여부에 따른 탭 잠금 Flag 설정
454
+ setProtectFlagForKey: (t) => e((n) => ({
455
+ tabProtectFlag: { ...n.tabProtectFlag, [t]: !0 }
456
+ })),
457
+ // 개인정보 포함여부에 따른 탭 잠금 해제
458
+ clearProtectFlagForKey: (t) => e((n) => {
459
+ const a = { ...n.tabProtectFlag };
460
+ return delete a[t], { tabProtectFlag: a };
461
+ }),
462
+ // 탭 파라미터 설정
463
+ setTabParams: (t, n) => e((a) => {
464
+ const o = a.tabParams[t] || {}, i = { ...n || {} };
465
+ return Object.keys(o).length === Object.keys(i).length && Object.keys(i).every((c) => o[c] === i[c]) ? a : {
466
+ tabParams: { ...a.tabParams, [t]: i }
467
+ };
468
+ }),
469
+ // 컴포넌트 라벨 맵 설정
470
+ setComponentLabelMap: (t, n) => e({ componentLabelMap: t })
471
+ })), Q = z((e) => ({
472
+ requestCount: 0,
473
+ loading: !1,
474
+ showLoading: () => e((r) => {
475
+ const t = r.requestCount + 1;
476
+ return { requestCount: t, loading: t > 0 };
477
+ }),
478
+ hideLoading: () => e((r) => {
479
+ const t = Math.max(0, r.requestCount - 1);
480
+ return { requestCount: t, loading: t > 0 };
481
+ })
482
+ }));
483
+ var k = { exports: {} }, We = k.exports, ie;
484
+ function Ge() {
485
+ return ie || (ie = 1, (function(e, r) {
486
+ (function(t, n) {
487
+ e.exports = n(L);
488
+ })(We, (function(t) {
489
+ function n(i) {
490
+ return i && typeof i == "object" && "default" in i ? i : { default: i };
491
+ }
492
+ var a = n(t), o = { name: "ko", weekdays: "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"), weekdaysShort: "일_월_화_수_목_금_토".split("_"), weekdaysMin: "일_월_화_수_목_금_토".split("_"), months: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), monthsShort: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), ordinal: function(i) {
493
+ return i + "일";
494
+ }, formats: { LT: "A h:mm", LTS: "A h:mm:ss", L: "YYYY.MM.DD.", LL: "YYYY년 MMMM D일", LLL: "YYYY년 MMMM D일 A h:mm", LLLL: "YYYY년 MMMM D일 dddd A h:mm", l: "YYYY.MM.DD.", ll: "YYYY년 MMMM D일", lll: "YYYY년 MMMM D일 A h:mm", llll: "YYYY년 MMMM D일 dddd A h:mm" }, meridiem: function(i) {
495
+ return i < 12 ? "오전" : "오후";
496
+ }, relativeTime: { future: "%s 후", past: "%s 전", s: "몇 초", m: "1분", mm: "%d분", h: "한 시간", hh: "%d시간", d: "하루", dd: "%d일", M: "한 달", MM: "%d달", y: "일 년", yy: "%d년" } };
497
+ return a.default.locale(o, null, !0), o;
498
+ }));
499
+ })(k)), k.exports;
500
+ }
501
+ Ge();
502
+ var Y = { exports: {} }, Ke = Y.exports, ce;
503
+ function Je() {
504
+ return ce || (ce = 1, (function(e, r) {
505
+ (function(t, n) {
506
+ e.exports = n();
507
+ })(Ke, (function() {
508
+ return function(t, n, a) {
509
+ t = t || {};
510
+ var o = n.prototype, i = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
511
+ function m(p, g, S, u) {
512
+ return o.fromToBase(p, g, S, u);
513
+ }
514
+ a.en.relativeTime = i, o.fromToBase = function(p, g, S, u, f) {
515
+ for (var l, s, d, y = S.$locale().relativeTime || i, h = t.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], v = h.length, T = 0; T < v; T += 1) {
516
+ var M = h[T];
517
+ M.d && (l = u ? a(p).diff(S, M.d, !0) : S.diff(p, M.d, !0));
518
+ var I = (t.rounding || Math.round)(Math.abs(l));
519
+ if (d = l > 0, I <= M.r || !M.r) {
520
+ I <= 1 && T > 0 && (M = h[T - 1]);
521
+ var b = y[M.l];
522
+ f && (I = f("" + I)), s = typeof b == "string" ? b.replace("%d", I) : b(I, g, M.l, d);
523
+ break;
524
+ }
525
+ }
526
+ if (g) return s;
527
+ var w = d ? y.future : y.past;
528
+ return typeof w == "function" ? w(s) : w.replace("%s", s);
529
+ }, o.to = function(p, g) {
530
+ return m(p, g, this, !0);
531
+ }, o.from = function(p, g) {
532
+ return m(p, g, this);
533
+ };
534
+ var c = function(p) {
535
+ return p.$u ? a.utc() : a();
536
+ };
537
+ o.toNow = function(p) {
538
+ return this.to(c(this), p);
539
+ }, o.fromNow = function(p) {
540
+ return this.from(c(this), p);
541
+ };
542
+ };
543
+ }));
544
+ })(Y)), Y.exports;
545
+ }
546
+ var Ze = Je();
547
+ const Xe = /* @__PURE__ */ re(Ze);
548
+ var F = { exports: {} }, Ve = F.exports, ue;
549
+ function Qe() {
550
+ return ue || (ue = 1, (function(e, r) {
551
+ (function(t, n) {
552
+ e.exports = n();
553
+ })(Ve, (function() {
554
+ var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
555
+ return function(a, o, i) {
556
+ var m, c = function(u, f, l) {
557
+ l === void 0 && (l = {});
558
+ var s = new Date(u), d = (function(y, h) {
559
+ h === void 0 && (h = {});
560
+ var v = h.timeZoneName || "short", T = y + "|" + v, M = n[T];
561
+ return M || (M = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: y, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: v }), n[T] = M), M;
562
+ })(f, l);
563
+ return d.formatToParts(s);
564
+ }, p = function(u, f) {
565
+ for (var l = c(u, f), s = [], d = 0; d < l.length; d += 1) {
566
+ var y = l[d], h = y.type, v = y.value, T = t[h];
567
+ T >= 0 && (s[T] = parseInt(v, 10));
568
+ }
569
+ var M = s[3], I = M === 24 ? 0 : M, b = s[0] + "-" + s[1] + "-" + s[2] + " " + I + ":" + s[4] + ":" + s[5] + ":000", w = +u;
570
+ return (i.utc(b).valueOf() - (w -= w % 1e3)) / 6e4;
571
+ }, g = o.prototype;
572
+ g.tz = function(u, f) {
573
+ u === void 0 && (u = m);
574
+ var l, s = this.utcOffset(), d = this.toDate(), y = d.toLocaleString("en-US", { timeZone: u }), h = Math.round((d - new Date(y)) / 1e3 / 60), v = 15 * -Math.round(d.getTimezoneOffset() / 15) - h;
575
+ if (!Number(v)) l = this.utcOffset(0, f);
576
+ else if (l = i(y, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(v, !0), f) {
577
+ var T = l.utcOffset();
578
+ l = l.add(s - T, "minute");
579
+ }
580
+ return l.$x.$timezone = u, l;
581
+ }, g.offsetName = function(u) {
582
+ var f = this.$x.$timezone || i.tz.guess(), l = c(this.valueOf(), f, { timeZoneName: u }).find((function(s) {
583
+ return s.type.toLowerCase() === "timezonename";
584
+ }));
585
+ return l && l.value;
586
+ };
587
+ var S = g.startOf;
588
+ g.startOf = function(u, f) {
589
+ if (!this.$x || !this.$x.$timezone) return S.call(this, u, f);
590
+ var l = i(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
591
+ return S.call(l, u, f).tz(this.$x.$timezone, !0);
592
+ }, i.tz = function(u, f, l) {
593
+ var s = l && f, d = l || f || m, y = p(+i(), d);
594
+ if (typeof u != "string") return i(u).tz(d);
595
+ var h = (function(I, b, w) {
596
+ var D = I - 60 * b * 1e3, P = p(D, w);
597
+ if (b === P) return [D, b];
598
+ var W = p(D -= 60 * (P - b) * 1e3, w);
599
+ return P === W ? [D, P] : [I - 60 * Math.min(P, W) * 1e3, Math.max(P, W)];
600
+ })(i.utc(u, s).valueOf(), y, d), v = h[0], T = h[1], M = i(v).utcOffset(T);
601
+ return M.$x.$timezone = d, M;
602
+ }, i.tz.guess = function() {
603
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
604
+ }, i.tz.setDefault = function(u) {
605
+ m = u;
606
+ };
607
+ };
608
+ }));
609
+ })(F)), F.exports;
610
+ }
611
+ var et = Qe();
612
+ const tt = /* @__PURE__ */ re(et);
613
+ var R = { exports: {} }, rt = R.exports, le;
614
+ function nt() {
615
+ return le || (le = 1, (function(e, r) {
616
+ (function(t, n) {
617
+ e.exports = n();
618
+ })(rt, (function() {
619
+ var t = "minute", n = /[+-]\d\d(?::?\d\d)?/g, a = /([+-]|\d\d)/g;
620
+ return function(o, i, m) {
621
+ var c = i.prototype;
622
+ m.utc = function(s) {
623
+ var d = { date: s, utc: !0, args: arguments };
624
+ return new i(d);
625
+ }, c.utc = function(s) {
626
+ var d = m(this.toDate(), { locale: this.$L, utc: !0 });
627
+ return s ? d.add(this.utcOffset(), t) : d;
628
+ }, c.local = function() {
629
+ return m(this.toDate(), { locale: this.$L, utc: !1 });
630
+ };
631
+ var p = c.parse;
632
+ c.parse = function(s) {
633
+ s.utc && (this.$u = !0), this.$utils().u(s.$offset) || (this.$offset = s.$offset), p.call(this, s);
634
+ };
635
+ var g = c.init;
636
+ c.init = function() {
637
+ if (this.$u) {
638
+ var s = this.$d;
639
+ this.$y = s.getUTCFullYear(), this.$M = s.getUTCMonth(), this.$D = s.getUTCDate(), this.$W = s.getUTCDay(), this.$H = s.getUTCHours(), this.$m = s.getUTCMinutes(), this.$s = s.getUTCSeconds(), this.$ms = s.getUTCMilliseconds();
640
+ } else g.call(this);
641
+ };
642
+ var S = c.utcOffset;
643
+ c.utcOffset = function(s, d) {
644
+ var y = this.$utils().u;
645
+ if (y(s)) return this.$u ? 0 : y(this.$offset) ? S.call(this) : this.$offset;
646
+ if (typeof s == "string" && (s = (function(M) {
647
+ M === void 0 && (M = "");
648
+ var I = M.match(n);
649
+ if (!I) return null;
650
+ var b = ("" + I[0]).match(a) || ["-", 0, 0], w = b[0], D = 60 * +b[1] + +b[2];
651
+ return D === 0 ? 0 : w === "+" ? D : -D;
652
+ })(s), s === null)) return this;
653
+ var h = Math.abs(s) <= 16 ? 60 * s : s;
654
+ if (h === 0) return this.utc(d);
655
+ var v = this.clone();
656
+ if (d) return v.$offset = h, v.$u = !1, v;
657
+ var T = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
658
+ return (v = this.local().add(h + T, t)).$offset = h, v.$x.$localOffset = T, v;
659
+ };
660
+ var u = c.format;
661
+ c.format = function(s) {
662
+ var d = s || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
663
+ return u.call(this, d);
664
+ }, c.valueOf = function() {
665
+ var s = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
666
+ return this.$d.valueOf() - 6e4 * s;
667
+ }, c.isUTC = function() {
668
+ return !!this.$u;
669
+ }, c.toISOString = function() {
670
+ return this.toDate().toISOString();
671
+ }, c.toString = function() {
672
+ return this.toDate().toUTCString();
673
+ };
674
+ var f = c.toDate;
675
+ c.toDate = function(s) {
676
+ return s === "s" && this.$offset ? m(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : f.call(this);
677
+ };
678
+ var l = c.diff;
679
+ c.diff = function(s, d, y) {
680
+ if (s && this.$u === s.$u) return l.call(this, s, d, y);
681
+ var h = this.local(), v = m(s).local();
682
+ return l.call(h, v, d, y);
683
+ };
684
+ };
685
+ }));
686
+ })(R)), R.exports;
687
+ }
688
+ var st = nt();
689
+ const ot = /* @__PURE__ */ re(st), at = "ui_theme", it = (e) => typeof e == "string", ct = (e) => typeof e == "number" && !isNaN(e), ut = (e) => typeof e == "boolean", lt = (e) => typeof e == "function", dt = (e) => e !== null && typeof e == "object", ft = (e) => Array.isArray(e), mt = (e) => e === null, ht = (e) => e === void 0, gt = (e) => e == null, pt = (e, r) => {
690
+ let t = 0;
691
+ return (...n) => {
692
+ const a = Date.now();
693
+ a - t >= r && (t = a, e(...n));
694
+ };
695
+ }, vt = (e, r) => {
696
+ let t;
697
+ return (...n) => {
698
+ clearTimeout(t), t = setTimeout(() => e(...n), r);
699
+ };
700
+ }, yt = async (e) => {
701
+ try {
702
+ return await navigator.clipboard.writeText(e), !0;
703
+ } catch (r) {
704
+ return console.error("Error copying to clipboard:", r), !1;
705
+ }
706
+ }, H = () => {
707
+ const e = window.innerWidth;
708
+ return e < 768 ? "mobile" : e < 1024 ? "tablet" : "desktop";
709
+ }, Mt = () => H() === "mobile", St = () => H() === "tablet", Tt = () => H() === "desktop", It = () => "#" + Math.floor(Math.random() * 16777215).toString(16), q = (e) => !e || e.length === 0, bt = (e) => [...new Set(e)], wt = (e) => {
710
+ if (!q(e))
711
+ return Math.max(...e);
712
+ }, Ct = (e) => {
713
+ if (!q(e))
714
+ return Math.min(...e);
715
+ }, _t = (e) => {
716
+ if (!q(e))
717
+ return e.reduce((r, t) => r + t, 0) / e.length;
718
+ }, xt = (e) => e.reduce((r, t) => r + t, 0), Dt = (e, r) => e.filter(r).length, Nt = (e) => [...e].reverse(), $t = (e) => {
719
+ const r = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
720
+ return e.forEach((n) => {
721
+ r.has(n) ? t.add(n) : r.add(n);
722
+ }), Array.from(t);
723
+ }, Ot = (e, r) => Math.random() * (r - e) + e, Lt = (e, r, t) => Math.min(Math.max(e, r), t), Ut = (e, r = 0) => Math.round(e * Math.pow(10, r)) / Math.pow(10, r), Pt = (e, r) => {
724
+ try {
725
+ sessionStorage.setItem(e, JSON.stringify(r));
726
+ } catch (t) {
727
+ console.error("Error saving to sessionStorage:", t);
728
+ }
729
+ }, Et = (e, r) => {
730
+ try {
731
+ const t = sessionStorage.getItem(e);
732
+ return t ? JSON.parse(t) : r || null;
733
+ } catch (t) {
734
+ return console.error("Error reading from sessionStorage:", t), r || null;
735
+ }
736
+ }, At = (e) => {
737
+ try {
738
+ sessionStorage.removeItem(e);
739
+ } catch (r) {
740
+ console.error("Error removing from sessionStorage:", r);
741
+ }
742
+ }, kt = () => {
743
+ try {
744
+ sessionStorage.clear();
745
+ } catch (e) {
746
+ console.error("Error clearing sessionStorage:", e);
747
+ }
748
+ }, Yt = (e, r, t = 30) => {
749
+ const n = /* @__PURE__ */ new Date();
750
+ n.setTime(n.getTime() + t * 24 * 60 * 60 * 1e3), document.cookie = `${e}=${r};expires=${n.toUTCString()};path=/`;
751
+ }, Ft = (e) => {
752
+ const r = e + "=", t = document.cookie.split(";");
753
+ for (let n = 0; n < t.length; n++) {
754
+ let a = t[n];
755
+ for (; a.charAt(0) === " "; ) a = a.substring(1, a.length);
756
+ if (a.indexOf(r) === 0) return a.substring(r.length, a.length);
757
+ }
758
+ return null;
759
+ }, Rt = (e) => {
760
+ document.cookie = `${e}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/`;
761
+ }, ve = (e) => typeof e != "string" ? !e : e.trim().length === 0, jt = (e, r) => ve(e) ? r : e || "", zt = (e) => e.replace(/-([a-z])/g, (r) => r[1].toUpperCase()), Bt = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e), Ht = (e) => {
762
+ try {
763
+ return new URL(e), !0;
764
+ } catch {
765
+ return !1;
766
+ }
767
+ }, qt = (e, r, t = " ") => e.padStart(r, t), Wt = (e, r, t = " ") => e.padEnd(r, t), ye = (e, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") => {
768
+ let t = "";
769
+ for (let n = 0; n < e; n++)
770
+ t += r.charAt(Math.floor(Math.random() * r.length));
771
+ return t;
772
+ }, Gt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
773
+ const r = Math.random() * 16 | 0;
774
+ return (e === "x" ? r : r & 3 | 8).toString(16);
775
+ }), Me = (e = 32) => {
776
+ const t = Gt().replace(/-/g, "");
777
+ return e >= 32 ? t + ye(e - 32, "0123456789abcdef") : t.substring(0, e);
778
+ };
779
+ async function Kt(e) {
780
+ const r = new TextEncoder().encode(e), t = await crypto.subtle.digest("SHA-256", r);
781
+ let n = "";
782
+ for (const a of new Uint8Array(t)) n += String.fromCharCode(a);
783
+ return btoa(n);
784
+ }
785
+ L.extend(Xe);
786
+ L.extend(ot);
787
+ L.extend(tt);
788
+ L.locale("ko");
789
+ const Jt = () => L(), Zt = (e = "YYYY-MM-DD") => L().format(e), Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
790
+ __proto__: null,
791
+ THEME_COOKIE_NAME: at,
792
+ arrAverage: _t,
793
+ arrCount: Dt,
794
+ arrMax: wt,
795
+ arrMin: Ct,
796
+ arrReverse: Nt,
797
+ arrSum: xt,
798
+ arrUnique: bt,
799
+ clamp: Lt,
800
+ clearSessionStorage: kt,
801
+ copyToClipboard: yt,
802
+ debounce: vt,
803
+ deleteCookie: Rt,
804
+ duplicates: $t,
805
+ encryptSha256: Kt,
806
+ generateRandomColor: It,
807
+ generateRandomString: ye,
808
+ generateUID: Me,
809
+ getCookie: Ft,
810
+ getCurrentDate: Jt,
811
+ getCurrentDateString: Zt,
812
+ getDeviceType: H,
813
+ getSessionStorage: Et,
814
+ isArray: ft,
815
+ isBoolean: ut,
816
+ isDesktop: Tt,
817
+ isEmpty: ve,
818
+ isEmptyArray: q,
819
+ isFunction: lt,
820
+ isMobile: Mt,
821
+ isNull: mt,
822
+ isNullOrUndefined: gt,
823
+ isNumber: ct,
824
+ isObject: dt,
825
+ isSafeEmpty: jt,
826
+ isString: it,
827
+ isTablet: St,
828
+ isUndefined: ht,
829
+ isValidEmail: Bt,
830
+ isValidUrl: Ht,
831
+ padLeft: qt,
832
+ padRight: Wt,
833
+ random: Ot,
834
+ removeSessionStorage: At,
835
+ round: Ut,
836
+ setCookie: Yt,
837
+ setSessionStorage: Pt,
838
+ throttle: pt,
839
+ toCamelCase: zt
840
+ }, Symbol.toStringTag, { value: "Module" })), C = {
841
+ duration: 4.5,
842
+ // 4.5초
843
+ placement: "topRight"
844
+ };
845
+ class E {
846
+ constructor() {
847
+ }
848
+ static getInstance() {
849
+ return E.instance || (E.instance = new E()), E.instance;
850
+ }
851
+ /**
852
+ * BwgError 전용 에러 알림
853
+ * @param props - 에러 메시지 설정
854
+ */
855
+ showBwgError(r) {
856
+ const {
857
+ message: t,
858
+ description: n,
859
+ duration: a = C.duration,
860
+ placement: o = C.placement
861
+ } = r;
862
+ O.error({
863
+ message: `${t}`,
864
+ description: n || "오류가 발생했습니다. 다시 시도해주세요.",
865
+ duration: a,
866
+ placement: o,
867
+ style: {
868
+ borderLeft: "4px solid #ff4d4f",
869
+ backgroundColor: "#fff2f0"
870
+ }
871
+ });
872
+ }
873
+ /**
874
+ * 성공 알림
875
+ */
876
+ showSuccess(r, t, n) {
877
+ O.success({
878
+ message: `${r}`,
879
+ description: t,
880
+ duration: n || C.duration,
881
+ placement: C.placement
882
+ });
883
+ }
884
+ /**
885
+ * 정보 알림
886
+ */
887
+ showInfo(r, t, n) {
888
+ O.info({
889
+ message: `${r}`,
890
+ description: t,
891
+ duration: n || C.duration,
892
+ placement: C.placement
893
+ });
894
+ }
895
+ /**
896
+ * 경고 알림
897
+ */
898
+ showWarning(r, t, n) {
899
+ O.warning({
900
+ message: `${r}`,
901
+ description: t,
902
+ duration: n || C.duration,
903
+ placement: C.placement
904
+ });
905
+ }
906
+ /**
907
+ * 일반 에러 알림
908
+ */
909
+ showError(r, t, n) {
910
+ O.error({
911
+ message: `${r}`,
912
+ description: t,
913
+ duration: n || C.duration,
914
+ placement: C.placement
915
+ });
916
+ }
917
+ /**
918
+ * 모든 알림 닫기
919
+ */
920
+ destroy() {
921
+ O.destroy();
922
+ }
923
+ /**
924
+ * 특정 키의 알림 닫기
925
+ */
926
+ close(r) {
927
+ O.destroy();
928
+ }
929
+ }
930
+ const $ = E.getInstance(), Se = (e) => {
931
+ $.showBwgError(e);
932
+ }, Xt = (e, r, t) => {
933
+ $.showSuccess(e, r, t);
934
+ }, Te = (e, r, t) => {
935
+ $.showInfo(e, r, t);
936
+ }, Ie = (e, r, t) => {
937
+ $.showWarning(e, r, t);
938
+ }, Vt = (e, r, t) => {
939
+ $.showError(e, r, t);
940
+ }, Qt = () => {
941
+ $.destroy();
942
+ }, er = (e) => {
943
+ $.close(e);
944
+ }, Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
945
+ __proto__: null,
946
+ closeNotification: er,
947
+ destroyNotifications: Qt,
948
+ notiBwgError: Se,
949
+ notiError: Vt,
950
+ notiInfo: Te,
951
+ notiSuccess: Xt,
952
+ notiWarning: Ie,
953
+ notificationService: $
954
+ }, Symbol.toStringTag, { value: "Module" }));
955
+ let N = null;
956
+ const be = async (e) => {
957
+ if (N === null)
958
+ if (e === void 0)
959
+ try {
960
+ let t = (await te.get("/api/ip")).data.trim();
961
+ t = t.replace(/\s+/g, ""), N = t;
962
+ } catch (r) {
963
+ console.warn("IP 가져오기 실패:", r), N = "unknown";
964
+ }
965
+ else
966
+ N = e;
967
+ }, tr = () => N, rr = async () => (console.log("IP 검증 비활성화됨 (성능 최적화)"), N || "unknown");
968
+ class x extends Error {
969
+ constructor(r, t, n, a, o) {
970
+ super(r), this.name = "ApiError", this.detailMsg = t, this.response = n, this.msgCd = a, this.errorType = o, Error.captureStackTrace && Error.captureStackTrace(this, x);
971
+ }
972
+ }
973
+ const ee = {
974
+ method: "POST",
975
+ timeout: 3e4,
976
+ // 30초
977
+ withCredentials: !0,
978
+ // 쿠키 포함
979
+ showLoading: !0,
980
+ showError: !0,
981
+ retryCount: 0,
982
+ retryDelay: 1e3
983
+ }, j = te.create({
984
+ timeout: ee.timeout,
985
+ withCredentials: ee.withCredentials,
986
+ headers: {
987
+ "Content-Type": "application/json; charset=utf-8",
988
+ Accept: "application/json; charset=utf-8"
989
+ }
990
+ });
991
+ j.interceptors.request.use(
992
+ (e) => {
993
+ e.showLoading && Q.getState().showLoading();
994
+ let r = "UNKNOWN", t = "UNKNOWN";
995
+ (/* @__PURE__ */ new Date()).getTime();
996
+ try {
997
+ e.data && e.data.header ? (r = e.data.header.trxCd || "UNKNOWN", t = e.data.header.guid || "UNKNOWN") : e.params && e.params.header && (r = e.params.header.trxCd || "UNKNOWN", t = e.params.header.guid || "UNKNOWN");
998
+ } catch (a) {
999
+ console.warn("trxCd/guid 추출 실패:", a);
1000
+ }
1001
+ e.trxCd = r, e.guid = t, e.requestStartTime = Date.now(), console.log(`🚀 API 요청 시작 [거래코드: ${r} / GUID: ${t}]`);
1002
+ const n = localStorage.getItem("accessToken");
1003
+ return n && (e.headers.Authorization = `Bearer ${n}`), e.headers["Content-Type"] = "application/json; charset=UTF-8", e.headers.Accept = "application/json; charset=UTF-8", e;
1004
+ },
1005
+ (e) => (console.error("❌ 요청 인터셉터 에러:", e), Promise.reject(e))
1006
+ );
1007
+ j.interceptors.response.use(
1008
+ (e) => {
1009
+ e.config.showLoading && Q.getState().hideLoading();
1010
+ let r = "UNKNOWN", t = "UNKNOWN";
1011
+ const n = (/* @__PURE__ */ new Date()).getTime();
1012
+ try {
1013
+ e.config.trxCd && (r = e.config.trxCd), e.config.guid ? t = e.config.guid : e.data && e.data.header && e.data.header.trxCd ? (r = e.data.header.trxCd, t = e.data.header.guid || "UNKNOWN") : e.config.data && e.config.data.header ? (r = e.config.data.header.trxCd || "UNKNOWN", t = e.config.data.header.guid || "UNKNOWN") : e.config.params && e.config.params.header && (r = e.config.params.header.trxCd || "UNKNOWN", t = e.config.params.header.guid || "UNKNOWN");
1014
+ } catch (o) {
1015
+ console.warn("trxCd/guid 추출 실패:", o);
1016
+ }
1017
+ let a = 0;
1018
+ return e.config.requestStartTime && (a = n - e.config.requestStartTime), console.log(
1019
+ `✅ API 응답 성공 [거래코드: ${r} / GUID : ${t}] - (소요시간: ${a}ms)`
1020
+ ), e;
1021
+ },
1022
+ async (e) => {
1023
+ if (e.config && e.config.showLoading && Q.getState().hideLoading(), console.error("❌ API 응답 에러:", e), Z && console.error("🚨 Error Details:", {
1024
+ message: e.message,
1025
+ status: e.response?.status,
1026
+ statusText: e.response?.statusText,
1027
+ data: e.response?.data,
1028
+ config: {
1029
+ url: e.config?.url,
1030
+ method: e.config?.method,
1031
+ baseURL: e.config?.baseURL
1032
+ }
1033
+ }), e.response?.status === 401) {
1034
+ const r = localStorage.getItem("refreshToken");
1035
+ if (r)
1036
+ try {
1037
+ const t = await te.post("/auth/refresh", {
1038
+ refreshToken: r
1039
+ });
1040
+ if (t.data.accessToken) {
1041
+ localStorage.setItem(
1042
+ "accessToken",
1043
+ t.data.accessToken
1044
+ );
1045
+ const n = e.config;
1046
+ if (n)
1047
+ return n.headers.Authorization = `Bearer ${t.data.accessToken}`, j(n);
1048
+ }
1049
+ } catch {
1050
+ localStorage.removeItem("accessToken"), localStorage.removeItem("refreshToken"), window.location.href = "/login";
1051
+ }
1052
+ }
1053
+ return Promise.reject(e);
1054
+ }
1055
+ );
1056
+ const we = () => Me(), U = async (e, r, t) => {
1057
+ try {
1058
+ const n = {
1059
+ ...ee,
1060
+ ...t
1061
+ }, { activeMenuId: a } = qe.getState();
1062
+ if (N === null) {
1063
+ const S = Date.now();
1064
+ await be();
1065
+ const u = Date.now();
1066
+ console.log(`[INFO] IP 조회 소요시간: ${u - S}ms`);
1067
+ }
1068
+ const o = {
1069
+ method: n.method,
1070
+ url: "/api/service",
1071
+ timeout: n.timeout,
1072
+ withCredentials: n.withCredentials,
1073
+ showLoading: n.showLoading
1074
+ };
1075
+ n.headers && (o.headers = n.headers);
1076
+ const i = N || "unknown", m = __APP_CD__, c = __SYS_CD__, p = {
1077
+ header: {
1078
+ trxCd: e,
1079
+ guid: we(),
1080
+ userInfo: se(),
1081
+ clientIp: i,
1082
+ // 클라이언트 IP 추가 (서버에서 재확인 권장)
1083
+ domainId: "DEFAULT",
1084
+ appCd: m,
1085
+ sysCd: c,
1086
+ screenId: a
1087
+ },
1088
+ // data: bxmEncrypt(JSON.stringify(data)),
1089
+ data: r
1090
+ };
1091
+ Z && console.log("__BWG_LOCAL__ 테스트 입니다. ", Z), n.method === "GET" ? o.params = p || n.params : (o.data = p || n.data, n.params && (o.params = n.params));
1092
+ let g;
1093
+ for (let S = 0; S <= (n.retryCount || 0); S++)
1094
+ try {
1095
+ const u = await j(o);
1096
+ if (u.data.header?.resCd == 0) {
1097
+ for (const f in u.data)
1098
+ if (f !== "header")
1099
+ return u.data[f];
1100
+ return {};
1101
+ } else {
1102
+ const f = u.data.header, l = f?.msgs?.basicMsg || "요청 처리 중 오류가 발생했습니다.", s = f?.msgs?.detailMsgs || l, d = f?.msgCd, y = f?.msgs?.type;
1103
+ throw new x(l, s, u, d, y);
1104
+ }
1105
+ } catch (u) {
1106
+ if (u.isAxiosError && u.response) {
1107
+ const f = u, l = f.response, s = l.data, d = s?.header?.msgs?.basicMsg || f.message || // 실패 시 Axios 에러 메시지 사용
1108
+ "서버에서 오류가 발생했습니다.", y = s?.header?.msgs?.detailMsgs || // 상세 메시지로 응답 본문 제공 (문자열이 아니면 JSON으로 변환)
1109
+ (typeof l.data == "string" ? l.data : JSON.stringify(l.data)) || d, h = s?.header?.msgCd, v = s?.header?.msgs?.type;
1110
+ g = new x(
1111
+ d,
1112
+ y,
1113
+ l,
1114
+ h,
1115
+ v
1116
+ );
1117
+ } else
1118
+ g = u;
1119
+ if (u.isAxiosError && nr(u) && S < (n.retryCount || 0)) {
1120
+ await sr(n.retryDelay || 1e3);
1121
+ continue;
1122
+ }
1123
+ break;
1124
+ }
1125
+ if (g) {
1126
+ if (n.showError) {
1127
+ const S = g instanceof x ? g.message : "요청 처리 중 오류가 발생했습니다.", u = g instanceof x ? g.msgCd : "요청 처리 중 오류가 발생했습니다.", f = g instanceof x ? g.detailMsg : g.message, l = g instanceof x ? g.errorType : "";
1128
+ u?.startsWith("BXM") ? Se({
1129
+ message: S,
1130
+ description: f,
1131
+ duration: 5
1132
+ }) : l == "I" ? Te(S, f, 5) : Ie(S, f, 5);
1133
+ }
1134
+ throw g;
1135
+ }
1136
+ throw new Error("알 수 없는 API 오류가 발생했습니다.");
1137
+ } catch (n) {
1138
+ throw console.error("callService 최종 에러:", n), n;
1139
+ }
1140
+ }, nr = (e) => !e.response || e.response.status >= 500 && e.response.status < 600, sr = (e) => new Promise((r) => setTimeout(r, e)), or = (e, r, t) => U(e, r, { ...t, method: "GET" }), ar = (e, r, t) => U(e, r, { ...t, method: "POST" }), ir = (e, r, t) => U(e, r, { ...t, method: "PUT" }), cr = (e, r, t) => U(e, r, { ...t, method: "DELETE" }), ur = (e, r, t) => U(e, r, { ...t, method: "PATCH" }), lr = async (e, r, t) => {
1141
+ try {
1142
+ const n = await fetch("/api/permissions", {
1143
+ method: "POST",
1144
+ headers: {
1145
+ "Content-Type": "application/json"
1146
+ },
1147
+ body: JSON.stringify({
1148
+ userId: e,
1149
+ menuId: r,
1150
+ popupId: t
1151
+ })
1152
+ });
1153
+ if (!n.ok)
1154
+ throw new Error(`권한 확인 실패: ${n.status}`);
1155
+ return await n.json();
1156
+ } catch (n) {
1157
+ throw console.error("권한 확인 서비스 오류:", n), n;
1158
+ }
1159
+ }, Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1160
+ __proto__: null,
1161
+ ApiError: x,
1162
+ apiDelete: cr,
1163
+ apiGet: or,
1164
+ apiPatch: ur,
1165
+ apiPost: ar,
1166
+ apiPut: ir,
1167
+ callService: U,
1168
+ getClientIp: tr,
1169
+ getGuid: we,
1170
+ getPermissionService: lr,
1171
+ setClientIp: be,
1172
+ verifyClientIp: rr
1173
+ }, Symbol.toStringTag, { value: "Module" }));
1174
+ export {
1175
+ Ht as $,
1176
+ x as A,
1177
+ Tt as B,
1178
+ It as C,
1179
+ q as D,
1180
+ bt as E,
1181
+ wt as F,
1182
+ Ct as G,
1183
+ _t as H,
1184
+ xt as I,
1185
+ Dt as J,
1186
+ Nt as K,
1187
+ $t as L,
1188
+ Ot as M,
1189
+ Lt as N,
1190
+ Ut as O,
1191
+ Pt as P,
1192
+ Et as Q,
1193
+ At as R,
1194
+ kt as S,
1195
+ at as T,
1196
+ Yt as U,
1197
+ Ft as V,
1198
+ Rt as W,
1199
+ ve as X,
1200
+ jt as Y,
1201
+ zt as Z,
1202
+ Bt as _,
1203
+ we as a,
1204
+ qt as a0,
1205
+ Wt as a1,
1206
+ ye as a2,
1207
+ Me as a3,
1208
+ Kt as a4,
1209
+ Jt as a5,
1210
+ Zt as a6,
1211
+ $ as a7,
1212
+ Se as a8,
1213
+ Xt as a9,
1214
+ He as aA,
1215
+ qe as aB,
1216
+ _ as aC,
1217
+ Ne as aD,
1218
+ Tr as aE,
1219
+ Mr as aF,
1220
+ Sr as aG,
1221
+ vr as aH,
1222
+ yr as aI,
1223
+ re as aJ,
1224
+ pr as aK,
1225
+ Te as aa,
1226
+ Ie as ab,
1227
+ Vt as ac,
1228
+ Qt as ad,
1229
+ er as ae,
1230
+ Ce as af,
1231
+ ne as ag,
1232
+ fe as ah,
1233
+ _e as ai,
1234
+ $e as aj,
1235
+ me as ak,
1236
+ he as al,
1237
+ Oe as am,
1238
+ Le as an,
1239
+ ge as ao,
1240
+ pe as ap,
1241
+ B as aq,
1242
+ Ue as ar,
1243
+ Pe as as,
1244
+ Ee as at,
1245
+ Ae as au,
1246
+ se as av,
1247
+ ke as aw,
1248
+ Ye as ax,
1249
+ Fe as ay,
1250
+ Q as az,
1251
+ or as b,
1252
+ U as c,
1253
+ ar as d,
1254
+ ir as e,
1255
+ cr as f,
1256
+ tr as g,
1257
+ ur as h,
1258
+ lr as i,
1259
+ it as j,
1260
+ ct as k,
1261
+ ut as l,
1262
+ lt as m,
1263
+ dt as n,
1264
+ ft as o,
1265
+ mt as p,
1266
+ ht as q,
1267
+ gt as r,
1268
+ be as s,
1269
+ pt as t,
1270
+ vt as u,
1271
+ rr as v,
1272
+ yt as w,
1273
+ H as x,
1274
+ Mt as y,
1275
+ St as z
1276
+ };
1277
+ //# sourceMappingURL=apiUtils-IzgDPO-1.js.map