@nice2dev/ui 1.0.30 → 1.1.5

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 (126) hide show
  1. package/CHANGELOG.md +848 -0
  2. package/README.md +30 -31
  3. package/dist/NiceCalendarScheduler.doc-BEtQkZjV.cjs +9 -0
  4. package/dist/NiceCalendarScheduler.doc-D__LRgOx.js +33 -0
  5. package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
  6. package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
  7. package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
  8. package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
  9. package/dist/NiceConfirmDialog-B57cl_F7.cjs +1 -0
  10. package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
  11. package/dist/NiceConfirmDialog-N9fBTLYm.js +81 -0
  12. package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
  13. package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
  14. package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
  15. package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
  16. package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
  17. package/dist/NiceDrawingCanvas.doc-Dv5vB4gY.js +32 -0
  18. package/dist/NiceDrawingCanvas.doc-Ww9zz17x.cjs +8 -0
  19. package/dist/NiceErrorBoundary-BD-uqk_q.js +709 -0
  20. package/dist/NiceErrorBoundary-CIPXaYik.cjs +1 -0
  21. package/dist/NiceFileManagerViews.doc-CKlnm6cX.cjs +1 -0
  22. package/dist/NiceFileManagerViews.doc-Cg21DArG.js +25 -0
  23. package/dist/NiceForm-BNZB31Pg.js +4499 -0
  24. package/dist/NiceForm-C6F0HvrX.cjs +1 -0
  25. package/dist/NiceForm-CCyfWgIs.js +4805 -0
  26. package/dist/NiceForm-CPyAXxBO.cjs +1 -0
  27. package/dist/NiceGantt-CSFLZD2y.js +328 -0
  28. package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
  29. package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
  30. package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
  31. package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
  32. package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
  33. package/dist/NiceMegaMenu.doc-7UyOCd3l.cjs +7 -0
  34. package/dist/NiceMegaMenu.doc-zeIyVa65.js +31 -0
  35. package/dist/NiceMention-CWoLD0SE.js +11082 -0
  36. package/dist/NiceMention-J1lUDLhg.cjs +430 -0
  37. package/dist/NiceMention.css +1 -0
  38. package/dist/NiceModal-0UxviEYE.cjs +1 -0
  39. package/dist/NiceModal-Bj53SKLI.js +95 -0
  40. package/dist/NiceModal-D-iOonog.js +95 -0
  41. package/dist/NiceModal-DC0UlQhc.cjs +1 -0
  42. package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
  43. package/dist/NiceModuleLifecyclePanel-BBOg9g0b.cjs +1 -0
  44. package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
  45. package/dist/NiceModuleLifecyclePanel-DtuXRiLR.js +6991 -0
  46. package/dist/NiceModuleLifecyclePanel.css +1 -1
  47. package/dist/NicePagination-Bjxy9aEc.js +172 -0
  48. package/dist/NicePagination-CPn-Q1h_.js +172 -0
  49. package/dist/NicePagination-CfFfNwrg.cjs +1 -0
  50. package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
  51. package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
  52. package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
  53. package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
  54. package/dist/NiceSavedQueryPanel-CH5c3rUG.js +6988 -0
  55. package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
  56. package/dist/NiceSavedQueryPanel-aQrEmmcC.cjs +596 -0
  57. package/dist/NiceScannerControl-Cd5KXJA9.js +12769 -0
  58. package/dist/NiceScannerControl-DZsERSw_.cjs +698 -0
  59. package/dist/NiceScannerControl.css +1 -0
  60. package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
  61. package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
  62. package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
  63. package/dist/NiceSelect-DHowflmX.js +433 -0
  64. package/dist/NiceWindow-BoDzlGk-.js +1621 -0
  65. package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
  66. package/dist/NiceWindow-DgONWxBm.cjs +1 -0
  67. package/dist/NiceWindow-xnTSHdHv.js +1623 -0
  68. package/dist/charts-B-sl1V9y.cjs +882 -0
  69. package/dist/charts-Bs0aDM0X.js +4671 -0
  70. package/dist/charts-DO2z6Ziu.js +31920 -0
  71. package/dist/charts-DjjKkw0q.cjs +761 -0
  72. package/dist/charts.cjs +1 -1
  73. package/dist/charts.mjs +7 -7
  74. package/dist/core-BUsZ7_vI.js +27914 -0
  75. package/dist/core-C2KhqEaU.cjs +1 -0
  76. package/dist/core-CLfcCDKc.cjs +122 -0
  77. package/dist/core-K2DIxXLn.js +795 -0
  78. package/dist/data-branching-D7l_kILW.cjs +1 -0
  79. package/dist/data-branching-DC6hcBQN.cjs +1 -0
  80. package/dist/data-branching-DykdTpjJ.js +6255 -0
  81. package/dist/data-branching-lJ07lDN-.js +6255 -0
  82. package/dist/data-branching.cjs +1 -1
  83. package/dist/data-branching.mjs +1 -1
  84. package/dist/data.cjs +1 -1
  85. package/dist/data.d.ts +70 -44
  86. package/dist/data.mjs +17 -16
  87. package/dist/devops-Bi8MXtko.js +8165 -0
  88. package/dist/devops-CU0sOVEA.cjs +17 -0
  89. package/dist/devops-CXyEwQeM.js +8165 -0
  90. package/dist/devops-On_1wRf9.cjs +17 -0
  91. package/dist/devops.cjs +1 -1
  92. package/dist/devops.mjs +1 -1
  93. package/dist/editors.cjs +1 -1
  94. package/dist/editors.d.ts +288 -432
  95. package/dist/editors.mjs +58 -62
  96. package/dist/feedback.cjs +1 -1
  97. package/dist/feedback.d.ts +1 -1
  98. package/dist/feedback.mjs +3 -3
  99. package/dist/index-BDH1yDSg.js +69235 -0
  100. package/dist/index-C9njkNOD.cjs +5470 -0
  101. package/dist/index.cjs +5137 -1
  102. package/dist/index.css +1 -1
  103. package/dist/index.d.ts +556 -929
  104. package/dist/index.mjs +66371 -1017
  105. package/dist/lazy.cjs +1 -1
  106. package/dist/lazy.mjs +24 -24
  107. package/dist/navigation.cjs +1 -1
  108. package/dist/navigation.d.ts +31 -213
  109. package/dist/navigation.mjs +105 -113
  110. package/dist/no-code-8lO7o6xi.js +7425 -0
  111. package/dist/no-code-C58g8_fb.cjs +332 -0
  112. package/dist/no-code-Cj4xJ3w9.js +7425 -0
  113. package/dist/no-code-K8tOLNew.cjs +332 -0
  114. package/dist/no-code.cjs +1 -1
  115. package/dist/no-code.mjs +1 -1
  116. package/dist/overlays.cjs +1 -1
  117. package/dist/overlays.d.ts +10 -0
  118. package/dist/overlays.mjs +36 -36
  119. package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
  120. package/dist/pickerCommons-CORo9j2a.js +2119 -0
  121. package/dist/pickerCommons-COiSUiP2.js +1122 -0
  122. package/dist/pickerCommons-D3WShRrR.cjs +1 -0
  123. package/dist/style.css +6 -6
  124. package/dist/vendor-BPVpdtPp.js +271 -0
  125. package/dist/vendor-Bo2Q64AF.cjs +1 -0
  126. package/package.json +17 -17
@@ -0,0 +1,672 @@
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { o as g } from "./charts-DO2z6Ziu.js";
3
+ import { forwardRef as _e, useRef as O, useState as f, useMemo as xe, useCallback as s, useEffect as U, useImperativeHandle as ye } from "react";
4
+ function ke(n, r) {
5
+ const o = n.split(".").pop()?.toLowerCase().split("?")[0] ?? "";
6
+ return o === "pdf" ? "pdf" : ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "ico", "tiff", "tif"].includes(o) ? "image" : ["mp4", "webm", "ogg", "mov", "avi", "mkv"].includes(o) ? "video" : ["mp3", "wav", "flac", "aac", "m4a", "ogg"].includes(o) ? "audio" : ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "odt", "ods", "odp"].includes(o) ? "office" : o === "html" || o === "htm" ? "html" : ["txt", "log", "md", "json", "xml", "csv", "yaml", "yml"].includes(o) ? "text" : "unknown";
7
+ }
8
+ function Ce(n) {
9
+ if (n === 0)
10
+ return "0 B";
11
+ const r = 1024, o = ["B", "KB", "MB", "GB"], t = Math.floor(Math.log(n) / Math.log(r));
12
+ return parseFloat((n / Math.pow(r, t)).toFixed(1)) + " " + o[t];
13
+ }
14
+ function Ne(n) {
15
+ const r = Math.floor(n / 3600), o = Math.floor(n % 3600 / 60), t = Math.floor(n % 60);
16
+ return r > 0 ? `${r}:${o.toString().padStart(2, "0")}:${t.toString().padStart(2, "0")}` : `${o}:${t.toString().padStart(2, "0")}`;
17
+ }
18
+ function Pe({
19
+ src: n,
20
+ page: r,
21
+ zoom: o,
22
+ rotation: t,
23
+ onPageChange: p,
24
+ onLoad: c,
25
+ onError: h,
26
+ workerUrl: u
27
+ }) {
28
+ const w = O(null), N = O(null), [b, G] = f(0), [Z, $] = f(!1);
29
+ return U(() => {
30
+ let x = !1;
31
+ return (async () => {
32
+ try {
33
+ let l;
34
+ if (l = window.pdfjsLib, !l)
35
+ try {
36
+ l = await new Function("m", "return import(m)")("pdfjs-dist");
37
+ } catch {
38
+ throw new Error(
39
+ 'PDF.js library not found. Please install pdfjs-dist or include it via CDN: <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"><\/script>'
40
+ );
41
+ }
42
+ u ? l.GlobalWorkerOptions.workerSrc = u : l.version && (l.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${l.version}/pdf.worker.min.js`);
43
+ const _ = await l.getDocument(n).promise;
44
+ if (x)
45
+ return;
46
+ N.current = _, G(_.numPages), c({
47
+ name: n.split("/").pop() ?? "document.pdf",
48
+ type: "pdf",
49
+ mimeType: "application/pdf",
50
+ pageCount: _.numPages
51
+ });
52
+ } catch (l) {
53
+ x || h(l instanceof Error ? l : new Error("Failed to load PDF"));
54
+ }
55
+ })(), () => {
56
+ x = !0;
57
+ };
58
+ }, [n, u, c, h]), U(() => {
59
+ const x = N.current, P = w.current;
60
+ if (!x || !P || b === 0)
61
+ return;
62
+ let l = !1;
63
+ return (async () => {
64
+ if (!Z) {
65
+ $(!0);
66
+ try {
67
+ const _ = Math.max(1, Math.min(r, b)), E = await x.getPage(_);
68
+ if (l)
69
+ return;
70
+ const L = E.getViewport({ scale: o, rotation: t }), D = P.getContext("2d");
71
+ if (!D)
72
+ return;
73
+ P.height = L.height, P.width = L.width, await E.render({
74
+ canvasContext: D,
75
+ viewport: L
76
+ }).promise;
77
+ } catch (_) {
78
+ console.error("Error rendering PDF page:", _);
79
+ } finally {
80
+ l || $(!1);
81
+ }
82
+ }
83
+ })(), () => {
84
+ l = !0;
85
+ };
86
+ }, [r, o, t, b, Z]), /* @__PURE__ */ e("div", { className: "nice-document-viewer__pdf", children: /* @__PURE__ */ e("canvas", { ref: w, className: "nice-document-viewer__pdf-canvas" }) });
87
+ }
88
+ function ze({
89
+ src: n,
90
+ zoom: r,
91
+ rotation: o,
92
+ onLoad: t,
93
+ onError: p
94
+ }) {
95
+ const [c, h] = f(!1), u = s(
96
+ (N) => {
97
+ const b = N.currentTarget;
98
+ h(!0), t({
99
+ name: n.split("/").pop() ?? "image",
100
+ type: "image",
101
+ width: b.naturalWidth,
102
+ height: b.naturalHeight
103
+ });
104
+ },
105
+ [n, t]
106
+ ), w = s(() => {
107
+ p(new Error("Failed to load image"));
108
+ }, [p]);
109
+ return /* @__PURE__ */ e("div", { className: "nice-document-viewer__image", children: /* @__PURE__ */ e(
110
+ "img",
111
+ {
112
+ src: n,
113
+ alt: "Document",
114
+ onLoad: u,
115
+ onError: w,
116
+ style: {
117
+ transform: `scale(${r}) rotate(${o}deg)`,
118
+ opacity: c ? 1 : 0
119
+ },
120
+ draggable: !1
121
+ }
122
+ ) });
123
+ }
124
+ function Ee({ src: n, type: r, onLoad: o, onError: t }) {
125
+ const p = O(null), c = s(() => {
126
+ const u = p.current;
127
+ if (!u)
128
+ return;
129
+ const w = {
130
+ name: n.split("/").pop() ?? (r === "video" ? "video" : "audio"),
131
+ type: r,
132
+ duration: u.duration
133
+ };
134
+ r === "video" && "videoWidth" in u && (w.width = u.videoWidth, w.height = u.videoHeight), o(w);
135
+ }, [n, r, o]), h = s(() => {
136
+ t(new Error(`Failed to load ${r}`));
137
+ }, [r, t]);
138
+ return r === "video" ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__video", children: /* @__PURE__ */ e(
139
+ "video",
140
+ {
141
+ ref: p,
142
+ src: n,
143
+ controls: !0,
144
+ onLoadedMetadata: c,
145
+ onError: h
146
+ }
147
+ ) }) : /* @__PURE__ */ e("div", { className: "nice-document-viewer__audio", children: /* @__PURE__ */ e(
148
+ "audio",
149
+ {
150
+ ref: p,
151
+ src: n,
152
+ controls: !0,
153
+ onLoadedMetadata: c,
154
+ onError: h
155
+ }
156
+ ) });
157
+ }
158
+ function Le({ src: n, viewerUrl: r, onLoad: o }) {
159
+ const [t, p] = f(!1), h = `${r ?? "https://view.officeapps.live.com/op/embed.aspx?src="}${encodeURIComponent(n)}`, u = s(() => {
160
+ p(!0), o({
161
+ name: n.split("/").pop() ?? "document",
162
+ type: "office"
163
+ });
164
+ }, [n, o]);
165
+ return /* @__PURE__ */ e("div", { className: "nice-document-viewer__office", children: /* @__PURE__ */ e(
166
+ "iframe",
167
+ {
168
+ src: h,
169
+ onLoad: u,
170
+ title: "Office Document",
171
+ style: { opacity: t ? 1 : 0 }
172
+ }
173
+ ) });
174
+ }
175
+ function je({ src: n, onLoad: r, onError: o }) {
176
+ const [t, p] = f(null);
177
+ return U(() => {
178
+ fetch(n).then((c) => {
179
+ if (!c.ok)
180
+ throw new Error("Failed to fetch text");
181
+ return c.text();
182
+ }).then((c) => {
183
+ p(c), r({
184
+ name: n.split("/").pop() ?? "text",
185
+ type: "text",
186
+ size: c.length
187
+ });
188
+ }).catch((c) => {
189
+ o(c instanceof Error ? c : new Error("Failed to load text"));
190
+ });
191
+ }, [n, r, o]), t === null ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__loading", children: "Loading..." }) : /* @__PURE__ */ e("div", { className: "nice-document-viewer__text", children: /* @__PURE__ */ e("pre", { children: t }) });
192
+ }
193
+ function De({ src: n, onLoad: r }) {
194
+ const o = s(() => {
195
+ r({
196
+ name: n.split("/").pop() ?? "page.html",
197
+ type: "html"
198
+ });
199
+ }, [n, r]);
200
+ return /* @__PURE__ */ e("div", { className: "nice-document-viewer__html", children: /* @__PURE__ */ e(
201
+ "iframe",
202
+ {
203
+ src: n,
204
+ onLoad: o,
205
+ title: "HTML Document",
206
+ sandbox: "allow-same-origin allow-scripts"
207
+ }
208
+ ) });
209
+ }
210
+ const Re = _e(
211
+ function(r, o) {
212
+ const {
213
+ src: t,
214
+ type: p,
215
+ name: c,
216
+ height: h = 600,
217
+ width: u = "100%",
218
+ zoom: w = 1,
219
+ minZoom: N = 0.25,
220
+ maxZoom: b = 4,
221
+ page: G = 1,
222
+ showToolbar: Z = !0,
223
+ showPageNav: $ = !0,
224
+ showZoomControls: x = !0,
225
+ showFullscreen: P = !0,
226
+ showDownload: l = !0,
227
+ showPrint: A = !0,
228
+ showRotate: _ = !0,
229
+ enableKeyboard: E = !0,
230
+ onLoad: L,
231
+ onError: D,
232
+ onPageChange: Q,
233
+ onZoomChange: X,
234
+ pdfWorkerUrl: ie,
235
+ officeViewerUrl: ae,
236
+ loading: ce,
237
+ errorContent: q,
238
+ className: de,
239
+ "data-testid": se
240
+ } = r, Y = O(null), [a, le] = f(null), [y, ue] = f(G), [z, me] = f(w), [ee, pe] = f(0), [K, ne] = f(!1), [V, fe] = f(null), [he, te] = f(!0), k = xe(() => p ?? ke(t), [t, p]), j = s(
241
+ (i) => {
242
+ le(i), te(!1), L?.(i);
243
+ },
244
+ [L]
245
+ ), W = s(
246
+ (i) => {
247
+ fe(i), te(!1), D?.(i);
248
+ },
249
+ [D]
250
+ ), v = s(
251
+ (i) => {
252
+ const d = a?.pageCount ?? 1, oe = Math.max(1, Math.min(i, d));
253
+ ue(oe), Q?.(oe);
254
+ },
255
+ [a?.pageCount, Q]
256
+ ), M = s(() => v(y + 1), [y, v]), F = s(() => v(y - 1), [y, v]), C = s(
257
+ (i) => {
258
+ const d = Math.max(N, Math.min(i, b));
259
+ me(d), X?.(d);
260
+ },
261
+ [N, b, X]
262
+ ), I = s(() => C(z * 1.25), [z, C]), R = s(() => C(z / 1.25), [z, C]), S = s(() => C(1), [C]), B = s((i) => {
263
+ pe((d) => (d + i) % 360);
264
+ }, []), H = s(() => {
265
+ const i = document.createElement("a");
266
+ i.href = t, i.download = c ?? a?.name ?? "document", document.body.appendChild(i), i.click(), document.body.removeChild(i);
267
+ }, [t, c, a?.name]), J = s(() => {
268
+ const i = window.open(t, "_blank");
269
+ i && (i.onload = () => i.print());
270
+ }, [t]), T = s(() => {
271
+ Y.current && (K ? (document.exitFullscreen?.(), ne(!1)) : (Y.current.requestFullscreen?.(), ne(!0)));
272
+ }, [K]);
273
+ U(() => {
274
+ if (!E)
275
+ return;
276
+ const i = (d) => {
277
+ switch (d.key) {
278
+ case "ArrowRight":
279
+ case "PageDown":
280
+ M();
281
+ break;
282
+ case "ArrowLeft":
283
+ case "PageUp":
284
+ F();
285
+ break;
286
+ case "Home":
287
+ v(1);
288
+ break;
289
+ case "End":
290
+ v(a?.pageCount ?? 1);
291
+ break;
292
+ case "+":
293
+ case "=":
294
+ (d.ctrlKey || d.metaKey) && (d.preventDefault(), I());
295
+ break;
296
+ case "-":
297
+ (d.ctrlKey || d.metaKey) && (d.preventDefault(), R());
298
+ break;
299
+ case "0":
300
+ (d.ctrlKey || d.metaKey) && (d.preventDefault(), S());
301
+ break;
302
+ case "f":
303
+ (d.ctrlKey || d.metaKey) && (d.preventDefault(), T());
304
+ break;
305
+ }
306
+ };
307
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
308
+ }, [
309
+ E,
310
+ M,
311
+ F,
312
+ v,
313
+ a?.pageCount,
314
+ I,
315
+ R,
316
+ S,
317
+ T
318
+ ]), ye(
319
+ o,
320
+ () => ({
321
+ goToPage: v,
322
+ nextPage: M,
323
+ prevPage: F,
324
+ setZoom: C,
325
+ zoomIn: I,
326
+ zoomOut: R,
327
+ resetZoom: S,
328
+ rotate: B,
329
+ download: H,
330
+ print: J,
331
+ toggleFullscreen: T,
332
+ getInfo: () => a
333
+ }),
334
+ [
335
+ v,
336
+ M,
337
+ F,
338
+ C,
339
+ I,
340
+ R,
341
+ S,
342
+ B,
343
+ H,
344
+ J,
345
+ T,
346
+ a
347
+ ]
348
+ );
349
+ const ve = () => {
350
+ if (V)
351
+ return (typeof q == "function" ? q(V) : q) ?? /* @__PURE__ */ e("div", { className: "nice-document-viewer__error", children: /* @__PURE__ */ m("span", { children: [
352
+ /* @__PURE__ */ e(g, { name: "warning", size: 14 }),
353
+ " ",
354
+ V.message
355
+ ] }) });
356
+ switch (k) {
357
+ case "pdf":
358
+ return /* @__PURE__ */ e(
359
+ Pe,
360
+ {
361
+ src: t,
362
+ page: y,
363
+ zoom: z,
364
+ rotation: ee,
365
+ onPageChange: v,
366
+ onLoad: j,
367
+ onError: W,
368
+ workerUrl: ie
369
+ }
370
+ );
371
+ case "image":
372
+ return /* @__PURE__ */ e(
373
+ ze,
374
+ {
375
+ src: t,
376
+ zoom: z,
377
+ rotation: ee,
378
+ onLoad: j,
379
+ onError: W
380
+ }
381
+ );
382
+ case "video":
383
+ case "audio":
384
+ return /* @__PURE__ */ e(Ee, { src: t, type: k, onLoad: j, onError: W });
385
+ case "office":
386
+ return /* @__PURE__ */ e(Le, { src: t, viewerUrl: ae, onLoad: j });
387
+ case "text":
388
+ return /* @__PURE__ */ e(je, { src: t, onLoad: j, onError: W });
389
+ case "html":
390
+ return /* @__PURE__ */ e(De, { src: t, onLoad: j });
391
+ default:
392
+ return /* @__PURE__ */ m("div", { className: "nice-document-viewer__unknown", children: [
393
+ /* @__PURE__ */ m("span", { children: [
394
+ /* @__PURE__ */ e(g, { name: "file", size: 14 }),
395
+ " Unknown document type"
396
+ ] }),
397
+ /* @__PURE__ */ e("button", { type: "button", onClick: H, children: "Download" })
398
+ ] });
399
+ }
400
+ }, we = $ && k === "pdf" && (a?.pageCount ?? 0) > 1, ge = x && (k === "pdf" || k === "image"), be = _ && (k === "pdf" || k === "image");
401
+ return /* @__PURE__ */ m(
402
+ "div",
403
+ {
404
+ ref: Y,
405
+ className: `nice-document-viewer ${K ? "nice-document-viewer--fullscreen" : ""} ${de ?? ""}`,
406
+ style: { height: h, width: u },
407
+ "data-testid": se,
408
+ "data-type": k,
409
+ children: [
410
+ Z && /* @__PURE__ */ m("div", { className: "nice-document-viewer__toolbar", children: [
411
+ /* @__PURE__ */ e("div", { className: "nice-document-viewer__toolbar-left", children: we && /* @__PURE__ */ m("div", { className: "nice-document-viewer__pagination", children: [
412
+ /* @__PURE__ */ e(
413
+ "button",
414
+ {
415
+ type: "button",
416
+ onClick: F,
417
+ disabled: y <= 1,
418
+ "aria-label": "Previous page",
419
+ children: /* @__PURE__ */ e(g, { name: "chevron-left", size: 16 })
420
+ }
421
+ ),
422
+ /* @__PURE__ */ m("span", { children: [
423
+ /* @__PURE__ */ e(
424
+ "input",
425
+ {
426
+ type: "number",
427
+ value: y,
428
+ onChange: (i) => v(parseInt(i.target.value, 10)),
429
+ min: 1,
430
+ max: a?.pageCount ?? 1
431
+ }
432
+ ),
433
+ "/ ",
434
+ a?.pageCount ?? 1
435
+ ] }),
436
+ /* @__PURE__ */ e(
437
+ "button",
438
+ {
439
+ type: "button",
440
+ onClick: M,
441
+ disabled: y >= (a?.pageCount ?? 1),
442
+ "aria-label": "Next page",
443
+ children: /* @__PURE__ */ e(g, { name: "chevron-right", size: 16 })
444
+ }
445
+ )
446
+ ] }) }),
447
+ /* @__PURE__ */ m("div", { className: "nice-document-viewer__toolbar-center", children: [
448
+ ge && /* @__PURE__ */ m("div", { className: "nice-document-viewer__zoom", children: [
449
+ /* @__PURE__ */ e("button", { type: "button", onClick: R, "aria-label": "Zoom out", children: "−" }),
450
+ /* @__PURE__ */ m("span", { children: [
451
+ Math.round(z * 100),
452
+ "%"
453
+ ] }),
454
+ /* @__PURE__ */ e("button", { type: "button", onClick: I, "aria-label": "Zoom in", children: "+" }),
455
+ /* @__PURE__ */ e("button", { type: "button", onClick: S, "aria-label": "Reset zoom", children: /* @__PURE__ */ e(g, { name: "refresh", size: 16 }) })
456
+ ] }),
457
+ be && /* @__PURE__ */ m("div", { className: "nice-document-viewer__rotation", children: [
458
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => B(270), "aria-label": "Rotate left", children: /* @__PURE__ */ e(g, { name: "refresh", size: 16 }) }),
459
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => B(90), "aria-label": "Rotate right", children: /* @__PURE__ */ e(g, { name: "refresh", size: 16 }) })
460
+ ] })
461
+ ] }),
462
+ /* @__PURE__ */ m("div", { className: "nice-document-viewer__toolbar-right", children: [
463
+ l && /* @__PURE__ */ e("button", { type: "button", onClick: H, "aria-label": "Download", children: /* @__PURE__ */ e(g, { name: "download", size: 16 }) }),
464
+ A && /* @__PURE__ */ e("button", { type: "button", onClick: J, "aria-label": "Print", children: /* @__PURE__ */ e(g, { name: "printer", size: 16 }) }),
465
+ P && /* @__PURE__ */ e("button", { type: "button", onClick: T, "aria-label": "Fullscreen", children: /* @__PURE__ */ e(g, { name: K ? "collapse" : "expand", size: 16 }) })
466
+ ] })
467
+ ] }),
468
+ /* @__PURE__ */ m("div", { className: "nice-document-viewer__content", children: [
469
+ he && !V && (ce ?? /* @__PURE__ */ e("div", { className: "nice-document-viewer__loading", children: "Loading..." })),
470
+ ve()
471
+ ] }),
472
+ a && /* @__PURE__ */ m("div", { className: "nice-document-viewer__info", children: [
473
+ /* @__PURE__ */ e("span", { className: "nice-document-viewer__name", children: c ?? a.name }),
474
+ a.size && /* @__PURE__ */ e("span", { className: "nice-document-viewer__size", children: Ce(a.size) }),
475
+ a.width && a.height && /* @__PURE__ */ m("span", { className: "nice-document-viewer__dimensions", children: [
476
+ a.width,
477
+ " × ",
478
+ a.height
479
+ ] }),
480
+ a.duration && /* @__PURE__ */ e("span", { className: "nice-document-viewer__duration", children: Ne(a.duration) })
481
+ ] })
482
+ ]
483
+ }
484
+ );
485
+ }
486
+ ), re = "nice-document-viewer-styles";
487
+ if (typeof document < "u" && !document.getElementById(re)) {
488
+ const n = document.createElement("style");
489
+ n.id = re, n.textContent = `
490
+ .nice-document-viewer {
491
+ display: flex;
492
+ flex-direction: column;
493
+ border: 1px solid var(--border-color, #e5e7eb);
494
+ border-radius: var(--nice-radius-sm, 4px);
495
+ overflow: hidden;
496
+ background: var(--bg-primary, #ffffff);
497
+ }
498
+
499
+ .nice-document-viewer--fullscreen {
500
+ position: fixed;
501
+ top: 0;
502
+ left: 0;
503
+ right: 0;
504
+ bottom: 0;
505
+ z-index: 9999;
506
+ border: none;
507
+ border-radius: 0;
508
+ }
509
+
510
+ .nice-document-viewer__toolbar {
511
+ display: flex;
512
+ align-items: center;
513
+ justify-content: space-between;
514
+ padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
515
+ background: var(--bg-primary, #ffffff);
516
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
517
+ flex-shrink: 0;
518
+ }
519
+
520
+ .nice-document-viewer__toolbar-left,
521
+ .nice-document-viewer__toolbar-center,
522
+ .nice-document-viewer__toolbar-right {
523
+ display: flex;
524
+ align-items: center;
525
+ gap: var(--nice-space-2, 8px);
526
+ }
527
+
528
+ .nice-document-viewer__toolbar button {
529
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
530
+ border: 1px solid var(--border-color, #e5e7eb);
531
+ border-radius: var(--nice-radius-sm, 4px);
532
+ background: var(--bg-primary, #ffffff);
533
+ cursor: pointer;
534
+ font-size: 14px;
535
+ }
536
+
537
+ .nice-document-viewer__toolbar button:hover:not(:disabled) {
538
+ background: var(--hover-bg, color-mix(in srgb, var(--text-primary, #000) 4%, transparent));
539
+ }
540
+
541
+ .nice-document-viewer__toolbar button:disabled {
542
+ opacity: 0.4;
543
+ cursor: not-allowed;
544
+ }
545
+
546
+ .nice-document-viewer__pagination,
547
+ .nice-document-viewer__zoom,
548
+ .nice-document-viewer__rotation {
549
+ display: flex;
550
+ align-items: center;
551
+ gap: var(--nice-space-1-5, 6px);
552
+ }
553
+
554
+ .nice-document-viewer__pagination input {
555
+ width: 50px;
556
+ padding: var(--nice-space-1, 4px);
557
+ border: 1px solid var(--border-color, #e5e7eb);
558
+ border-radius: var(--nice-radius-sm, 4px);
559
+ text-align: center;
560
+ }
561
+
562
+ .nice-document-viewer__zoom span {
563
+ min-width: 50px;
564
+ text-align: center;
565
+ font-size: 13px;
566
+ }
567
+
568
+ .nice-document-viewer__content {
569
+ flex: 1;
570
+ overflow: auto;
571
+ display: flex;
572
+ align-items: center;
573
+ justify-content: center;
574
+ position: relative;
575
+ }
576
+
577
+ .nice-document-viewer__loading,
578
+ .nice-document-viewer__error,
579
+ .nice-document-viewer__unknown {
580
+ display: flex;
581
+ flex-direction: column;
582
+ align-items: center;
583
+ justify-content: center;
584
+ gap: var(--nice-space-3, 12px);
585
+ padding: var(--nice-space-10, 40px);
586
+ color: var(--text-secondary, #475569);
587
+ }
588
+
589
+ .nice-document-viewer__error span {
590
+ color: var(--nice-error, #d32f2f);
591
+ }
592
+
593
+ .nice-document-viewer__pdf,
594
+ .nice-document-viewer__image {
595
+ display: flex;
596
+ align-items: center;
597
+ justify-content: center;
598
+ min-height: 100%;
599
+ min-width: 100%;
600
+ }
601
+
602
+ .nice-document-viewer__pdf-canvas {
603
+ max-width: 100%;
604
+ height: auto;
605
+ }
606
+
607
+ .nice-document-viewer__image img {
608
+ max-width: 100%;
609
+ max-height: 100%;
610
+ object-fit: contain;
611
+ transition: transform 0.2s;
612
+ }
613
+
614
+ .nice-document-viewer__video,
615
+ .nice-document-viewer__audio {
616
+ display: flex;
617
+ align-items: center;
618
+ justify-content: center;
619
+ width: 100%;
620
+ height: 100%;
621
+ }
622
+
623
+ .nice-document-viewer__video video,
624
+ .nice-document-viewer__audio audio {
625
+ max-width: 100%;
626
+ max-height: 100%;
627
+ }
628
+
629
+ .nice-document-viewer__office iframe,
630
+ .nice-document-viewer__html iframe {
631
+ width: 100%;
632
+ height: 100%;
633
+ border: none;
634
+ }
635
+
636
+ .nice-document-viewer__text {
637
+ width: 100%;
638
+ height: 100%;
639
+ overflow: auto;
640
+ padding: var(--nice-space-4, 16px);
641
+ background: var(--bg-primary, #ffffff);
642
+ }
643
+
644
+ .nice-document-viewer__text pre {
645
+ margin: 0;
646
+ font-family: 'Fira Code', monospace;
647
+ font-size: 13px;
648
+ white-space: pre-wrap;
649
+ word-wrap: break-word;
650
+ }
651
+
652
+ .nice-document-viewer__info {
653
+ display: flex;
654
+ align-items: center;
655
+ gap: var(--nice-space-4, 16px);
656
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
657
+ background: var(--bg-primary, #ffffff);
658
+ border-top: 1px solid var(--border-color, #e5e7eb);
659
+ font-size: 12px;
660
+ color: var(--text-secondary, #475569);
661
+ flex-shrink: 0;
662
+ }
663
+
664
+ .nice-document-viewer__name {
665
+ font-weight: 500;
666
+ color: var(--text-primary, #0f172a);
667
+ }
668
+ `, document.head.appendChild(n);
669
+ }
670
+ export {
671
+ Re as NiceDocumentViewer
672
+ };