handy-uploader 2.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +290 -292
  2. package/dist/components/handyUploader.vue.d.ts +3 -3
  3. package/dist/composables/deprecation.d.ts +2 -0
  4. package/dist/composables/useErrorHandler.d.ts +4 -0
  5. package/dist/composables/useFileUpload.d.ts +5 -0
  6. package/dist/core/attachments.d.ts +91 -0
  7. package/dist/core/fileUtils.d.ts +56 -0
  8. package/dist/core/index.d.ts +3 -0
  9. package/dist/core/videoThumbnail.d.ts +32 -0
  10. package/dist/element/HandyUploaderElement.d.ts +20 -0
  11. package/dist/element/index.d.ts +21 -0
  12. package/dist/element/types.d.ts +108 -0
  13. package/dist/element.mjs +6178 -0
  14. package/dist/handy-uploader.cjs +1 -0
  15. package/dist/handy-uploader.css +1 -1
  16. package/dist/handy-uploader.mjs +1110 -0
  17. package/dist/language-CYpPw-mk.mjs +551 -0
  18. package/dist/language-fvWXvWRx.js +1 -0
  19. package/dist/lib/index.d.ts +8 -19
  20. package/dist/lib/language.d.ts +3 -0
  21. package/dist/lib/shared.d.ts +5 -0
  22. package/dist/lib/vuetify.d.ts +15 -0
  23. package/dist/types/index.d.ts +4 -0
  24. package/dist/utils/fileUtils.d.ts +1 -56
  25. package/dist/vue/components/HandyDialog.vue.d.ts +31 -0
  26. package/dist/vue/components/HandyDropzone.vue.d.ts +38 -0
  27. package/dist/vue/components/HandyFileIcon.vue.d.ts +9 -0
  28. package/dist/vue/components/HandyFileList.vue.d.ts +65 -0
  29. package/dist/vue/components/HandyIcon.vue.d.ts +10 -0
  30. package/dist/vue/components/HandyUploader.vue.d.ts +137 -0
  31. package/dist/vue/index.d.ts +9 -0
  32. package/dist/vue/types.d.ts +5 -0
  33. package/dist/vue/useUploader.d.ts +46 -0
  34. package/dist/vuetify.cjs +1 -0
  35. package/dist/vuetify.mjs +1875 -0
  36. package/package.json +59 -16
  37. package/dist/handy-uploader.es.js +0 -2308
  38. package/dist/handy-uploader.umd.js +0 -1
@@ -1,56 +1 @@
1
- import type { FileSizeResult, FileIconProps, MimeType } from '../types';
2
- /**
3
- * Formats file size into human-readable format with appropriate color coding
4
- */
5
- export declare function formatFileSize(size: number): FileSizeResult;
6
- /**
7
- * Determines file type based on file extension or MIME type
8
- */
9
- export declare function getFileType(fileName: string, mimeType?: string): string;
10
- /**
11
- * Gets appropriate icon and color for file type (legacy function for backward compatibility)
12
- */
13
- export declare function getFileIcon(fileName: string, mimeType?: string): FileIconProps;
14
- /**
15
- * Gets detailed icon and color for specific file extension
16
- */
17
- export declare function getDetailedFileIcon(fileName: string): {
18
- icon: string;
19
- color: string;
20
- };
21
- /**
22
- * Gets only the icon name for a file extension
23
- */
24
- export declare function getFileIconName(fileName: string): string;
25
- /**
26
- * Gets only the color for a file extension
27
- */
28
- export declare function getFileIconColor(fileName: string): string;
29
- /**
30
- * Checks if file is an image type
31
- */
32
- export declare function isImageFile(fileName: string, mimeType?: string): boolean;
33
- /**
34
- * Validates file size against maximum allowed size
35
- */
36
- export declare function validateFileSize(fileSize: number, maxSize: number): boolean;
37
- /**
38
- * Validates file count against maximum allowed count
39
- */
40
- export declare function validateFileCount(currentCount: number, maxCount: number): boolean;
41
- /**
42
- * Gets MIME type from file extension
43
- */
44
- export declare function getMimeTypeFromExtension(fileName: string): MimeType;
45
- /**
46
- * Constructs proper data URL for base64 image data
47
- */
48
- export declare function constructImageDataUrl(base64: string | undefined, format: string | undefined): string;
49
- /**
50
- * Compresses image using canvas
51
- */
52
- export declare function compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<string>;
53
- /**
54
- * Converts file to base64 string
55
- */
56
- export declare function fileToBase64(file: File): Promise<string>;
1
+ export * from '../core/fileUtils';
@@ -0,0 +1,31 @@
1
+ type __VLS_Props = {
2
+ open: boolean;
3
+ title?: string;
4
+ closeLabel?: string;
5
+ size?: 'small' | 'medium';
6
+ };
7
+ declare const __VLS_template: () => {
8
+ __VLS_Slots: {
9
+ default?: (props: {}) => any;
10
+ } & {
11
+ actions?: (props: {}) => any;
12
+ };
13
+ };
14
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
16
+ "update:open": (value: boolean) => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ "onUpdate:open"?: (value: boolean) => any;
19
+ }>, {
20
+ title: string;
21
+ size: "small" | "medium";
22
+ closeLabel: string;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,38 @@
1
+ type __VLS_Props = {
2
+ accept?: string;
3
+ multiple?: boolean;
4
+ disabled?: boolean;
5
+ label?: string;
6
+ hint?: string;
7
+ };
8
+ /** Opens the native file picker. */
9
+ declare function open(): void;
10
+ declare const __VLS_template: () => {
11
+ __VLS_Slots: {
12
+ default?: (props: {
13
+ isDragging: boolean;
14
+ }) => any;
15
+ };
16
+ };
17
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
19
+ open: typeof open;
20
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
21
+ files: (files: File[]) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ onFiles?: (files: File[]) => any;
24
+ }>, {
25
+ label: string;
26
+ accept: string;
27
+ multiple: boolean;
28
+ disabled: boolean;
29
+ hint: string;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
31
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
34
+ type __VLS_WithSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ fileName: string;
3
+ size?: number;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ size: number;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,65 @@
1
+ import type { DocumentAttachment, Translation } from '../../types';
2
+ import type { CardStyle, FileUploaderView } from '../types';
3
+ type __VLS_Props = {
4
+ files: DocumentAttachment[];
5
+ /** Resolved translation for the current language. */
6
+ t: Translation;
7
+ view?: FileUploaderView;
8
+ /** Show image previews and video thumbnails (the Vuetify version's `thumb`). */
9
+ thumb?: boolean;
10
+ /** Thumbnail view: card width out of 12 columns, like Vuetify's `md` (3 = 4 per row). */
11
+ cols?: number;
12
+ cardType?: CardStyle;
13
+ editable?: boolean;
14
+ removable?: boolean;
15
+ tableThumbColumn?: boolean;
16
+ tableFixedHeader?: boolean;
17
+ tableHeight?: number;
18
+ };
19
+ declare const __VLS_template: () => {
20
+ __VLS_Slots: {
21
+ empty?: (props: {}) => any;
22
+ } & {
23
+ actions?: (props: {
24
+ attachment: DocumentAttachment;
25
+ index: number;
26
+ }) => any;
27
+ } & {
28
+ item?: (props: {
29
+ attachment: DocumentAttachment;
30
+ index: number;
31
+ remove: () => void;
32
+ }) => any;
33
+ } & {
34
+ actions?: (props: {
35
+ attachment: DocumentAttachment;
36
+ index: number;
37
+ }) => any;
38
+ };
39
+ };
40
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
41
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
42
+ remove: (index: number) => any;
43
+ edit: (index: number) => any;
44
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
45
+ onRemove?: (index: number) => any;
46
+ onEdit?: (index: number) => any;
47
+ }>, {
48
+ tableThumbColumn: boolean;
49
+ tableFixedHeader: boolean;
50
+ tableHeight: number;
51
+ thumb: boolean;
52
+ cols: number;
53
+ view: FileUploaderView;
54
+ cardType: CardStyle;
55
+ editable: boolean;
56
+ removable: boolean;
57
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
59
+ declare const _default: typeof __VLS_export;
60
+ export default _default;
61
+ type __VLS_WithSlots<T, S> = T & {
62
+ new (): {
63
+ $slots: S;
64
+ };
65
+ };
@@ -0,0 +1,10 @@
1
+ import type { IconName } from '../types';
2
+ type __VLS_Props = {
3
+ name: IconName;
4
+ size?: number | string;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
+ size: string | number;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,137 @@
1
+ import type { CardType, DocumentAttachment, FileUploaderType, LanguageCode, LanguageCollection } from '../../types';
2
+ type __VLS_Props = {
3
+ documentAttachment?: DocumentAttachment[];
4
+ /** A built-in language code, or a key you added with customLang. */
5
+ lang?: LanguageCode | (string & {});
6
+ /** Maximum size per file, in bytes. */
7
+ maxFileSize?: number;
8
+ fileUploaderType?: FileUploaderType;
9
+ maxFileCount?: number;
10
+ badgeCounter?: boolean;
11
+ /** A colour for the buttons: a Vuetify name (primary, info, success…) or any CSS colour. */
12
+ btnColor?: string;
13
+ imageCompressor?: boolean;
14
+ imageCompressLevel?: number;
15
+ /** HTML accept format, e.g. ".pdf,image/*". Also applied to dropped files. */
16
+ fileAccept?: string;
17
+ thumb?: boolean;
18
+ tableThumbColumn?: boolean;
19
+ tableFixedHeader?: boolean;
20
+ tableHeight?: number;
21
+ rtlSupport?: boolean;
22
+ changeFileName?: boolean;
23
+ addFileDescription?: boolean;
24
+ addFileTag?: boolean;
25
+ tags?: string[];
26
+ customLang?: LanguageCollection | null;
27
+ insertPermission?: boolean;
28
+ cols?: number;
29
+ editPermission?: boolean;
30
+ deletePermission?: boolean;
31
+ cardType?: CardType;
32
+ };
33
+ declare function openInsert(): void;
34
+ /** Programmatic add (via a template ref): validates, reads and adds, emitting `add`. */
35
+ declare function addFiles(picked: FileList | File[]): Promise<DocumentAttachment[]>;
36
+ /** Programmatic remove (via a template ref), without the confirmation dialog. */
37
+ declare function removeAt(index: number): void;
38
+ declare const __VLS_template: () => {
39
+ __VLS_Slots: {
40
+ item?: (props: {
41
+ attachment: DocumentAttachment;
42
+ index: number;
43
+ remove: () => void;
44
+ }) => any;
45
+ } & {
46
+ actions?: (props: {
47
+ attachment: DocumentAttachment;
48
+ index: number;
49
+ }) => any;
50
+ } & {
51
+ empty?: (props: {}) => any;
52
+ };
53
+ };
54
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
55
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
56
+ add: typeof addFiles;
57
+ remove: typeof removeAt;
58
+ update: (index: number, changes: import("../useUploader").EditableFields) => void;
59
+ clear: () => void;
60
+ openInsert: typeof openInsert;
61
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
62
+ remove: (...args: any[]) => void;
63
+ add: (...args: any[]) => void;
64
+ updateDocumentAttachment: (...args: any[]) => void;
65
+ "update:documentAttachment": (...args: any[]) => void;
66
+ error: (...args: any[]) => void;
67
+ updateCardType: (...args: any[]) => void;
68
+ updateBadgeCounter: (...args: any[]) => void;
69
+ updateMaxFileCount: (...args: any[]) => void;
70
+ updateMaxFileSize: (...args: any[]) => void;
71
+ updateImageCompressor: (...args: any[]) => void;
72
+ updateImageCompressLevel: (...args: any[]) => void;
73
+ updateFileAccept: (...args: any[]) => void;
74
+ updateThumb: (...args: any[]) => void;
75
+ updateChangeFileName: (...args: any[]) => void;
76
+ updateAddFileDescription: (...args: any[]) => void;
77
+ updateAddFileTag: (...args: any[]) => void;
78
+ updateTableThumbColumn: (...args: any[]) => void;
79
+ updateTableFixedHeader: (...args: any[]) => void;
80
+ updateTableHeight: (...args: any[]) => void;
81
+ updateLang: (...args: any[]) => void;
82
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
83
+ onRemove?: (...args: any[]) => any;
84
+ onAdd?: (...args: any[]) => any;
85
+ onUpdateDocumentAttachment?: (...args: any[]) => any;
86
+ "onUpdate:documentAttachment"?: (...args: any[]) => any;
87
+ onError?: (...args: any[]) => any;
88
+ onUpdateCardType?: (...args: any[]) => any;
89
+ onUpdateBadgeCounter?: (...args: any[]) => any;
90
+ onUpdateMaxFileCount?: (...args: any[]) => any;
91
+ onUpdateMaxFileSize?: (...args: any[]) => any;
92
+ onUpdateImageCompressor?: (...args: any[]) => any;
93
+ onUpdateImageCompressLevel?: (...args: any[]) => any;
94
+ onUpdateFileAccept?: (...args: any[]) => any;
95
+ onUpdateThumb?: (...args: any[]) => any;
96
+ onUpdateChangeFileName?: (...args: any[]) => any;
97
+ onUpdateAddFileDescription?: (...args: any[]) => any;
98
+ onUpdateAddFileTag?: (...args: any[]) => any;
99
+ onUpdateTableThumbColumn?: (...args: any[]) => any;
100
+ onUpdateTableFixedHeader?: (...args: any[]) => any;
101
+ onUpdateTableHeight?: (...args: any[]) => any;
102
+ onUpdateLang?: (...args: any[]) => any;
103
+ }>, {
104
+ maxFileSize: number;
105
+ fileUploaderType: FileUploaderType;
106
+ maxFileCount: number;
107
+ badgeCounter: boolean;
108
+ btnColor: string;
109
+ imageCompressor: boolean;
110
+ imageCompressLevel: number;
111
+ fileAccept: string;
112
+ tableThumbColumn: boolean;
113
+ tableFixedHeader: boolean;
114
+ tableHeight: number;
115
+ rtlSupport: boolean;
116
+ changeFileName: boolean;
117
+ addFileDescription: boolean;
118
+ addFileTag: boolean;
119
+ tags: string[];
120
+ customLang: LanguageCollection;
121
+ insertPermission: boolean;
122
+ documentAttachment: DocumentAttachment[];
123
+ lang: LanguageCode | (string & {});
124
+ thumb: boolean;
125
+ cols: number;
126
+ editPermission: boolean;
127
+ deletePermission: boolean;
128
+ cardType: CardType;
129
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
130
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
131
+ declare const _default: typeof __VLS_export;
132
+ export default _default;
133
+ type __VLS_WithSlots<T, S> = T & {
134
+ new (): {
135
+ $slots: S;
136
+ };
137
+ };
@@ -0,0 +1,9 @@
1
+ import './theme.css';
2
+ export { default as HandyUploader } from './components/HandyUploader.vue';
3
+ export { default as HandyDropzone } from './components/HandyDropzone.vue';
4
+ export { default as HandyFileList } from './components/HandyFileList.vue';
5
+ export { default as HandyDialog } from './components/HandyDialog.vue';
6
+ export { default as HandyFileIcon } from './components/HandyFileIcon.vue';
7
+ export type { FileUploaderView, CardStyle } from './types';
8
+ export { useUploader, DEFAULT_UPLOADER_OPTIONS } from './useUploader';
9
+ export type { UploaderOptions, EditableFields } from './useUploader';
@@ -0,0 +1,5 @@
1
+ /** Same values as the Vuetify version's fileUploaderType prop. */
2
+ export type FileUploaderView = 'thumbnail' | 'simple' | 'table';
3
+ /** Same values as the Vuetify version's cardType prop. */
4
+ export type CardStyle = 'default' | 'outlined' | 'shaped' | 'raised' | 'tile';
5
+ export type IconName = 'trash' | 'pencil' | 'chevron' | 'close' | 'play' | 'upload' | 'disk';
@@ -0,0 +1,46 @@
1
+ import { type Ref } from 'vue';
2
+ import type { DocumentAttachment, FileData } from '../types';
3
+ import { type AttachmentError } from '../core';
4
+ export interface UploaderOptions {
5
+ /** Maximum size per file, in bytes. Default 5 MB. */
6
+ maxFileSize?: number;
7
+ /** Maximum number of files in the list. Default 10. */
8
+ maxFileCount?: number;
9
+ /** Same format as the HTML accept attribute, e.g. ".pdf,image/*". Default: everything. */
10
+ accept?: string;
11
+ /** Re-encode JPEG/PNG/WebP images as JPEG when that makes them smaller. */
12
+ imageCompressor?: boolean;
13
+ /** JPEG quality between 0 and 1. Default 0.8. */
14
+ imageCompressLevel?: number;
15
+ }
16
+ export declare const DEFAULT_UPLOADER_OPTIONS: Required<UploaderOptions>;
17
+ type MaybeRefOrGetter<T> = T | Ref<T> | (() => T);
18
+ export type EditableFields = Partial<Pick<FileData, 'name' | 'description' | 'tags'>>;
19
+ /**
20
+ * Vue adapter over the framework-agnostic core. Owns no UI: pass it the attachment list
21
+ * (e.g. a v-model ref) and build any markup on top. The list is always replaced, never
22
+ * mutated, so it works with props/emit, Pinia and plain refs alike.
23
+ */
24
+ export declare function useUploader(attachments: Ref<DocumentAttachment[]>, options?: MaybeRefOrGetter<UploaderOptions>): {
25
+ isProcessing: Ref<boolean, boolean>;
26
+ errors: Ref<{
27
+ code: import("../core").AttachmentErrorCode;
28
+ fileName?: string;
29
+ limit?: number;
30
+ }[], AttachmentError[] | {
31
+ code: import("../core").AttachmentErrorCode;
32
+ fileName?: string;
33
+ limit?: number;
34
+ }[]>;
35
+ count: import("vue").ComputedRef<number>;
36
+ canAddMore: import("vue").ComputedRef<boolean>;
37
+ options: import("vue").ComputedRef<Required<UploaderOptions>>;
38
+ add: (files: FileList | File[]) => Promise<DocumentAttachment[]>;
39
+ stage: (files: FileList | File[], pending?: number | (() => number)) => Promise<DocumentAttachment[]>;
40
+ commit: (staged: DocumentAttachment[]) => Promise<DocumentAttachment[]>;
41
+ remove: (index: number) => void;
42
+ update: (index: number, changes: EditableFields) => void;
43
+ clear: () => void;
44
+ dismissErrors: () => void;
45
+ };
46
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./language-fvWXvWRx.js"),I=e.defineComponent({__name:"SelectFileIconType",props:{fileFormat:{},size:{default:30}},setup(l){const r=l,o=e.computed(()=>{const t=`file.${r.fileFormat}`;return u.getDetailedFileIcon(t)});return(t,d)=>{const C=e.resolveComponent("v-icon");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(C,{size:r.size,color:o.value.color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.icon),1)]),_:1},8,["size","color"])])}}}),le={key:0,style:{height:"200px",display:"flex","align-items":"center","justify-content":"center","background-color":"#f5f5f5",overflow:"hidden"}},ne=["src","onError"],ae={key:1,style:{height:"200px","background-color":"#f5f5f5",position:"relative",overflow:"hidden",display:"flex","align-items":"center","justify-content":"center"}},re=["src","onError"],ie={key:1,style:{width:"100%",height:"100%",background:"#e0e0e0",display:"flex","align-items":"center","justify-content":"center"}},se={class:"d-flex justify-center align-center",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.7)","border-radius":"50%",width:"60px",height:"60px",cursor:"pointer"}},ce={key:2,class:"d-flex justify-center align-center",style:{height:"200px","background-color":"#f5f5f5"}},de={class:"BYekan"},ue={class:"BYekan"},me={key:0},R=e.defineComponent({__name:"ThumbnailUploader",props:{lang:{default:"en"},documentAttachment:{},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},selectedLang:{},cardType:{},outlined:{type:Boolean,default:!1},raised:{type:Boolean,default:!1},shaped:{type:Boolean,default:!1},tile:{type:Boolean,default:!1}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=n=>{const a=u.isImageFile(n);return console.log("🔍 isImageFile check:",n,"→",a),a},t=l,d=r,C=n=>{const a=u.getFileType(n)==="video";return console.log("🎥 Checking if video file:",n,"result:",a,"fileType:",u.getFileType(n)),a},_=n=>{var i;if(!n.base64||!n.format)return console.error("❌ Missing base64 or format for:",n.name,{base64:!!n.base64,format:n.format}),"";const a=u.constructImageDataUrl(n.base64,n.format);return console.log("🖼️ Image source for:",n.name,{format:n.format,base64Length:((i=n.base64)==null?void 0:i.length)||0,srcLength:a.length,srcPreview:a.substring(0,100)+"..."}),a},x=n=>{var a;console.error("Image failed to load:",{name:n.name,format:n.format,base64Length:((a=n.base64)==null?void 0:a.length)||0})},k=e.ref(0),p=u.createVideoThumbnailCache(()=>k.value++),f=n=>(k.value,p.get(n)),B=n=>{console.error("Video thumbnail failed to load:",{name:n.name,format:n.format}),p.invalidate(n)},b=n=>({icon:u.getFileIconName(n),color:u.getFileIconColor(n)}),w=n=>n.tags.length>0||!!n.description,T=n=>{n.showDetailState=!n.showDetailState},F=(n,a)=>{d("openDeleteDialog",n,a)},E=(n,a)=>{d("openEditDocumentDialog",n,a)},s=()=>{if(p.retain(t.documentAttachment.map(a=>a.file)),!t.thumb)return;console.log("🎯 Generating thumbnails for videos, total attachments:",t.documentAttachment.length);const n=t.documentAttachment.filter(a=>C(a.file.name));console.log("📹 Found video attachments:",n.length,n.map(a=>a.file.name)),n.forEach(a=>{console.log("🎬 Processing video:",a.file.name),f(a.file)})};return e.watch(()=>t.documentAttachment,s,{immediate:!0}),e.onMounted(s),(n,a)=>{const i=e.resolveComponent("v-icon"),c=e.resolveComponent("v-card-subtitle"),h=e.resolveComponent("v-chip"),g=e.resolveComponent("v-divider"),V=e.resolveComponent("v-btn"),v=e.resolveComponent("v-tooltip"),S=e.resolveComponent("v-spacer"),U=e.resolveComponent("v-card-actions"),P=e.resolveComponent("v-chip-group"),L=e.resolveComponent("v-card-text"),j=e.resolveComponent("v-expand-transition"),M=e.resolveComponent("v-card"),H=e.resolveComponent("v-col"),O=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(O,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.documentAttachment,(y,$)=>(e.openBlock(),e.createBlock(H,{key:`attachment-${$}`,cols:"12",md:l.cols,xs:"12"},{default:e.withCtx(()=>[e.createVNode(M,{shaped:l.shaped,outlined:l.outlined,raised:l.raised,tile:l.tile,class:"mx-auto","max-width":"344"},{default:e.withCtx(()=>[l.thumb&&o(y.file.name)?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("img",{src:_(y.file),style:{"max-width":"100%","max-height":"100%","object-fit":"contain"},onError:N=>x(y.file)},null,40,ne)])):l.thumb&&C(y.file.name)?(e.openBlock(),e.createElementBlock("div",ae,[f(y.file)?(e.openBlock(),e.createElementBlock("img",{key:0,src:f(y.file),style:{width:"100%",height:"100%","object-fit":"cover"},onError:N=>B(y.file)},null,40,re)):(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(i,{size:"60",color:"grey"},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode("mdi-video",-1)])]),_:1})])),e.createElementVNode("div",se,[e.createVNode(i,{color:"white",size:"30"},{default:e.withCtx(()=>[...a[1]||(a[1]=[e.createTextVNode("mdi-play",-1)])]),_:1})])])):(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(i,{size:"120",color:b(y.file.name).color},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b(y.file.name).icon),1)]),_:2},1032,["color"])])),e.createVNode(c,{class:"text-truncate py-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.name),1)]),_:2},1024),e.createVNode(c,{class:"pt-2 pb-3"},{default:e.withCtx(()=>[e.createVNode(h,{color:e.unref(u.formatFileSize)(y.file.size).color,label:"","text-color":"white"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.formatFileSize)(y.file.size).text)+" ",1),e.createVNode(i,{right:""},{default:e.withCtx(()=>[...a[2]||(a[2]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1})]),_:2},1032,["color"])]),_:2},1024),e.createVNode(g,{class:"mx-4"}),e.createVNode(U,{style:{padding:"0"}},{default:e.withCtx(()=>[e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.deletePermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>F($,"")}),{default:e.withCtx(()=>[e.createVNode(i,{color:"red"},{default:e.withCtx(()=>[...a[3]||(a[3]=[e.createTextVNode("mdi-trash-can-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",de,e.toDisplayString(l.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(v,{right:""},{activator:e.withCtx(({props:N})=>[l.editPermission?(e.openBlock(),e.createBlock(V,e.mergeProps({key:0,text:"",fab:""},{ref_for:!0},N,{onClick:z=>E(y,$)}),{default:e.withCtx(()=>[e.createVNode(i,{color:"green"},{default:e.withCtx(()=>[...a[4]||(a[4]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",ue,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024),e.createVNode(S),w(y.file)?(e.openBlock(),e.createBlock(V,{key:0,icon:"",onClick:N=>T(y.file)},{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.showDetailState?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[w(y.file)?e.withDirectives((e.openBlock(),e.createElementBlock("div",me,[e.createVNode(g),y.file.tags.length?(e.openBlock(),e.createBlock(P,{key:0,multiple:"","active-class":"primary--text",class:"pa-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.file.tags,(N,z)=>(e.openBlock(),e.createBlock(h,{key:`tag-${z}`,class:"ma-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(N),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),y.file.description?(e.openBlock(),e.createBlock(L,{key:1,class:"text-justify"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512)),[[e.vShow,y.file.showDetailState]]):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1032,["md"]))),128))]),_:1})])}}}),pe={class:"text-left",style:{width:"80px"}},fe={class:"text-center"},ge={class:"text-left",style:{width:"120px"}},he={class:"text-left",style:{width:"120px"}},ve={class:"text-center pa-3"},Ce={class:"text-left pa-3"},xe={class:"text-left pa-3"},ye={class:"text-center pa-2"},be={class:"d-flex justify-center ga-1"},_e=e.defineComponent({__name:"TableUploader",props:{documentAttachment:{},thumb:{type:Boolean,default:!0},lang:{default:"en"},cols:{default:4},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},selectedLang:{}},emits:["openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=p=>p?u.isImageFile(p):!1,C=p=>{const f=p/1e3,B=f/1024;return B>=1?`${B.toFixed(1)} MB`:`${f.toFixed(1)} KB`},_=p=>{const f=p/1024e3;return f<1?"success":f<5?"warning":"error"},x=(p,f)=>{t("openDeleteDialog",p,f)},k=(p,f)=>{t("openEditDocumentDialog",p,f)};return(p,f)=>{const B=e.resolveComponent("v-img"),b=e.resolveComponent("v-icon"),w=e.resolveComponent("v-tooltip"),T=e.resolveComponent("v-chip"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-table"),s=e.resolveComponent("v-col"),n=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(s,{cols:"12"},{default:e.withCtx(()=>[e.createVNode(E,{"fixed-header":o.tableFixedHeader,height:o.tableHeight+"px",class:"elevation-1"},{default:e.withCtx(()=>[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",pe,e.toDisplayString(o.selectedLang[l.lang].table.thumb),1),e.createElementVNode("th",fe,e.toDisplayString(o.selectedLang[l.lang].table.name),1),e.createElementVNode("th",ge,e.toDisplayString(o.selectedLang[l.lang].table.size),1),e.createElementVNode("th",he,e.toDisplayString(o.selectedLang[l.lang].table.action.action),1)])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(a,i)=>(e.openBlock(),e.createElementBlock("tr",{key:`attachment-${i}`,class:"table-row"},[e.createElementVNode("td",ve,[e.createVNode(w,{location:"top"},{activator:e.withCtx(({props:c})=>[e.createElementVNode("div",e.mergeProps({class:"d-flex justify-center align-center",style:{height:"60px",width:"60px"}},{ref_for:!0},c),[d(a.file.name)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.thumb&&a.file.base64?(e.openBlock(),e.createBlock(B,{key:0,style:{height:"40px",width:"40px"},src:"data:"+a.file.format+";base64,"+a.file.base64,height:"40",width:"40",class:"rounded",contain:""},null,8,["src"])):(e.openBlock(),e.createBlock(b,{key:1,size:"40",color:"deep-purple"},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode(" mdi-file-image-outline ",-1)])]),_:1}))],64)):(e.openBlock(),e.createBlock(b,{key:1,icon:e.unref(u.getFileIconName)(a.file.name),color:e.unref(u.getFileIconColor)(a.file.name),size:"40"},null,8,["icon","color"]))],16)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",Ce,[e.createVNode(w,{location:"top"},{activator:e.withCtx(({props:c})=>[e.createElementVNode("span",e.mergeProps({ref_for:!0},c),e.toDisplayString((()=>{const h=a.file.name.split(".").pop(),g=a.file.name.slice(0,a.file.name.lastIndexOf("."));return`${g.length>10?g.slice(0,10)+"...":g}.${h}`})()),17)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(a.file.name),1)]),_:2},1024)]),e.createElementVNode("td",xe,[e.createVNode(T,{color:_(a.file.size),variant:"tonal",size:"small",class:"text-caption"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(a.file.size)),1)]),_:2},1032,["color"])]),e.createElementVNode("td",ye,[e.createElementVNode("div",be,[l.editPermission?(e.openBlock(),e.createBlock(w,{key:0,location:"top"},{activator:e.withCtx(({props:c})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"success",variant:"text"},{ref_for:!0},c,{onClick:h=>k(a,i)}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].edit),1)]),_:2},1024)):e.createCommentVNode("",!0),l.deletePermission?(e.openBlock(),e.createBlock(w,{key:1,location:"top"},{activator:e.withCtx(({props:c})=>[e.createVNode(F,e.mergeProps({icon:"",size:"small",color:"error",variant:"text"},{ref_for:!0},c,{onClick:h=>x(i,"")}),{default:e.withCtx(()=>[e.createVNode(b,{size:"18"},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("mdi-delete",-1)])]),_:1})]),_:1},16,["onClick"])]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(l.selectedLang[l.lang].table.action.deleteTooltip),1)]),_:2},1024)):e.createCommentVNode("",!0)])])]))),128))])]),_:1},8,["fixed-header","height"])]),_:1})]),_:1})])}}}),K=(l,r)=>{const o=l.__vccOpts||l;for(const[t,d]of r)o[t]=d;return o},W=K(_e,[["__scopeId","data-v-d05b814b"]]),Ve={class:"d-flex align-center pa-3",style:{height:"100%"}},ke={class:"flex-grow-1 pr-4",style:{"max-width":"60%"}},we={class:"text-subtitle-1 font-weight-medium mb-2",style:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","max-width":"100%"}},Be={class:"flex-shrink-0",style:{"min-width":"80px"}},Fe={key:0,class:"thumbnail-container"},Ne={key:1,class:"d-flex align-center justify-center"},De={class:"d-flex gap-2 pb-1"},Te=e.defineComponent({__name:"SimpleUploader",props:{documentAttachment:{},lang:{default:"en"},thumb:{type:Boolean,default:!0},cols:{default:4},editPermission:{type:Boolean,default:!0},cardType:{},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean},deletePermission:{type:Boolean,default:!0},selectedLang:{}},emits:["setCardTheme","openDeleteDialog","openEditDocumentDialog"],setup(l,{emit:r}){const o=l,t=r,d=p=>{const f=p/1e3;return f<1024?`${f.toFixed(1)} ${o.selectedLang[o.lang].size.kb}`:`${(f/1024).toFixed(1)} ${o.selectedLang[o.lang].size.mb}`},C=p=>{var f;return["jpg","jpeg","png","tif","bmp"].includes(((f=p.split(".").pop())==null?void 0:f.toLowerCase())||"")},_=p=>p.base64?p.base64.startsWith("data:")?p.base64:`data:${p.format};base64,${p.base64}`:"",x=(p,f)=>t("openDeleteDialog",p,f),k=(p,f)=>t("openEditDocumentDialog",p,f);return(p,f)=>{const B=e.resolveComponent("v-icon"),b=e.resolveComponent("v-chip"),w=e.resolveComponent("v-img"),T=e.resolveComponent("v-divider"),F=e.resolveComponent("v-btn"),E=e.resolveComponent("v-tooltip"),s=e.resolveComponent("v-chip-group"),n=e.resolveComponent("v-card-text"),a=e.resolveComponent("v-expand-transition"),i=e.resolveComponent("v-card"),c=e.resolveComponent("v-col"),h=e.resolveComponent("v-row");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.documentAttachment,(g,V)=>(e.openBlock(),e.createBlock(c,{key:`attachment-${V}`,cols:"12",sm:"6",md:"4",lg:"3"},{default:e.withCtx(()=>[e.createVNode(i,{class:"file-card",shaped:o.shaped,outlined:o.outlined,raised:o.raised,tile:o.tile,height:"180"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,[e.createElementVNode("div",ke,[e.createElementVNode("div",we,e.toDisplayString(g.file.name),1),e.createVNode(b,{color:"teal",variant:"flat",size:"small",class:"text-white mb-2"},{default:e.withCtx(()=>[e.createVNode(B,{start:"",size:"16"},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode("mdi-harddisk",-1)])]),_:1}),e.createTextVNode(" "+e.toDisplayString(d(g.file.size)),1)]),_:2},1024)]),e.createElementVNode("div",Be,[C(g.file.name)&&o.thumb?(e.openBlock(),e.createElementBlock("div",Fe,[e.createVNode(w,{src:_(g.file),height:"80",width:"80",cover:"",class:"rounded"},null,8,["src"])])):(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(B,{color:e.unref(u.getFileIconColor)(g.file.name),size:"60"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.getFileIconName)(g.file.name)),1)]),_:2},1032,["color"])]))])]),e.createVNode(T,{class:"my-2"}),e.createElementVNode("div",De,[e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.deletePermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>x(V,"")}),{default:e.withCtx(()=>[e.createVNode(B,{color:"red",size:"20"},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("mdi-delete-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].delete),1)]),_:2},1024),e.createVNode(E,{bottom:""},{activator:e.withCtx(({props:v})=>[o.editPermission?(e.openBlock(),e.createBlock(F,e.mergeProps({key:0,icon:"",variant:"text",size:"small"},{ref_for:!0},v,{onClick:S=>k(g,V)}),{default:e.withCtx(()=>[e.createVNode(B,{color:"green",size:"20"},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("mdi-pencil-outline",-1)])]),_:1})]),_:1},16,["onClick"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(o.selectedLang[l.lang].edit),1)]),_:2},1024)]),e.createVNode(a,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",null,[e.createVNode(T),g.file.tags.length?(e.openBlock(),e.createBlock(s,{key:0,multiple:"","active-class":"primary--text",style:{padding:"8px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.file.tags,(v,S)=>(e.openBlock(),e.createBlock(b,{key:`tag-${S}`,style:{margin:"5px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v),1)]),_:2},1024))),128))]),_:2},1024)):e.createCommentVNode("",!0),g.file.description?(e.openBlock(),e.createBlock(n,{key:1,style:{"text-align":"justify"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.file.description),1)]),_:2},1024)):e.createCommentVNode("",!0)],512),[[e.vShow,g.file.showDetailState]])]),_:2},1024)]),_:2},1032,["shaped","outlined","raised","tile"])]),_:2},1024))),128))]),_:1})])}}}),X=K(Te,[["__scopeId","data-v-f7000da4"]]),Y=e.defineComponent({__name:"InsertButton",props:{documentAttachment:{},badgeCounter:{type:Boolean},btnColor:{},lang:{},maxFileCount:{},selectedLang:{}},emits:["openInputDocumentModal"],setup(l,{emit:r}){const o=r,t=l,d=e.computed(()=>t.documentAttachment.length>=t.maxFileCount),C=()=>{o("openInputDocumentModal")};return(_,x)=>{const k=e.resolveComponent("v-btn"),p=e.resolveComponent("v-badge");return e.openBlock(),e.createElementBlock("div",null,[t.badgeCounter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.documentAttachment.length>0?(e.openBlock(),e.createBlock(p,{key:0,bordered:"",color:d.value?"error":"success",overlap:"",content:l.documentAttachment.length},{default:e.withCtx(()=>[e.createVNode(k,{color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"])]),_:1},8,["color","content"])):(e.openBlock(),e.createBlock(k,{key:1,color:t.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))],64)):e.createCommentVNode("",!0),t.badgeCounter?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,color:l.btnColor,disabled:d.value,onClick:C,class:"mb-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].insertFile),1)]),_:1},8,["color","disabled"]))])}}});function Ee(l){const r=["simple","thumbnail","table"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("File uploader type must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`File uploader type must be one of: ${r.join(", ")}`)),o}function Se(l){const r=["default","outlined","shaped","raised","tile"],o={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(o.isValid=!1,o.errors.push("Card type must be a string")):l&&!r.includes(l)&&(o.isValid=!1,o.errors.push(`Card type must be one of: ${r.join(", ")}`)),o}function Ae(l){const r=["en","fa","fr","ch","ar"],o={isValid:!0,errors:[],warnings:[]};return typeof l!="string"?(o.isValid=!1,o.errors.push("Language code must be a string")):r.includes(l)||(o.isValid=!1,o.errors.push(`Language code must be one of: ${r.join(", ")}`)),o}function Le(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File size must be a number")):l<=0?(r.isValid=!1,r.errors.push("File size must be greater than 0")):l>100*1024*1024&&r.warnings.push("File size limit is very large (>100MB), consider reducing for better performance"),r}function $e(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("File count must be a number")):l<0?(r.isValid=!1,r.errors.push("File count cannot be negative")):l>100&&r.warnings.push("File count limit is very high (>100), consider reducing for better performance"),r}function ze(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Compression level must be a number")):l<0||l>1?(r.isValid=!1,r.errors.push("Compression level must be between 0 and 1")):l<.1?r.warnings.push("Very low compression level may result in poor image quality"):l>.9&&r.warnings.push("Very high compression level may not reduce file size significantly"),r}function Ue(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="string"?(r.isValid=!1,r.errors.push("File accept pattern must be a string")):l&&l.trim()===""&&r.warnings.push("Empty file accept pattern will accept all files"),r}function Ie(l){const r={isValid:!0,errors:[],warnings:[]};return typeof l!="number"?(r.isValid=!1,r.errors.push("Columns count must be a number")):(l<1||l>12)&&(r.isValid=!1,r.errors.push("Columns count must be between 1 and 12")),r}function Pe(l){const r={isValid:!0,errors:[],warnings:[]};return l!==void 0&&typeof l!="number"?(r.isValid=!1,r.errors.push("Table height must be a number")):l&&l<100?r.warnings.push("Table height is very small (<100px), content may not be visible"):l&&l>1e3&&r.warnings.push("Table height is very large (>1000px), consider reducing for better UX"),r}function je(l){const r={isValid:!0,errors:[],warnings:[]};return Array.isArray(l)?(l.forEach((o,t)=>{if(!o||typeof o!="object"){r.errors.push(`Attachment at index ${t} must be an object`);return}if(!o.file||typeof o.file!="object"){r.errors.push(`Attachment at index ${t} must have a file property`);return}const d=o.file;["name","format","base64","size"].forEach(_=>{_ in d||r.errors.push(`File at index ${t} is missing required field: ${_}`)}),d.name&&typeof d.name!="string"&&r.errors.push(`File name at index ${t} must be a string`),d.format&&typeof d.format!="string"&&r.errors.push(`File format at index ${t} must be a string`),d.base64&&typeof d.base64!="string"&&r.errors.push(`File base64 at index ${t} must be a string`),d.size&&typeof d.size!="number"&&r.errors.push(`File size at index ${t} must be a number`),d.tags&&!Array.isArray(d.tags)&&r.errors.push(`File tags at index ${t} must be an array`)}),r.errors.length>0&&(r.isValid=!1),r):(r.isValid=!1,r.errors.push("Document attachment must be an array"),r)}function Me(l){const r={isValid:!0,errors:[],warnings:[]};return[{key:"fileUploaderType",validator:Ee},{key:"cardType",validator:Se},{key:"lang",validator:Ae},{key:"maxFileSize",validator:Le},{key:"maxFileCount",validator:$e},{key:"imageCompressLevel",validator:ze},{key:"fileAccept",validator:Ue},{key:"cols",validator:Ie},{key:"tableHeight",validator:Pe},{key:"documentAttachment",validator:je}].forEach(({key:t,validator:d})=>{if(t in l){const C=d(l[t]);r.errors.push(...C.errors.map(_=>`${t}: ${_}`)),r.warnings.push(...C.warnings.map(_=>`${t}: ${_}`)),C.isValid||(r.isValid=!1)}}),r}const J=e.defineComponent({__name:"handyUploader",props:{documentAttachment:{},lang:{default:"en"},maxFileSize:{default:5242880},fileUploaderType:{default:"thumbnail"},maxFileCount:{default:10},badgeCounter:{type:Boolean,default:!0},btnColor:{default:"info"},imageCompressor:{type:Boolean},imageCompressLevel:{default:.8},fileAccept:{},thumb:{type:Boolean,default:!0},tableThumbColumn:{type:Boolean},tableFixedHeader:{type:Boolean,default:!0},tableHeight:{default:400},rtlSupport:{type:Boolean,default:!1},changeFileName:{type:Boolean,default:!1},addFileDescription:{type:Boolean,default:!1},addFileTag:{type:Boolean,default:!1},tags:{},customLang:{default:null},insertPermission:{type:Boolean,default:!0},cols:{default:3},editPermission:{type:Boolean,default:!0},deletePermission:{type:Boolean,default:!0},cardType:{default:"default"},outlined:{type:Boolean},raised:{type:Boolean},shaped:{type:Boolean},tile:{type:Boolean}},emits:["updateCardType","updateBadgeCounter","updateMaxFileCount","updateMaxFileSize","updateImageCompressor","updateImageCompressLevel","updateFileAccept","updateThumb","updateChangeFileName","updateAddFileDescription","updateTableThumbColumn","updateTableFixedHeader","updateTableHeight","updateLang","updateDocumentAttachment"],setup(l,{emit:r}){const o=l;if(process.env.NODE_ENV==="development"){const s=Me(o);s.isValid||console.error("HandyUploader prop validation failed:",s.errors),s.warnings.length>0&&console.warn("HandyUploader prop validation warnings:",s.warnings)}const t=e.reactive({insertDocumentDialog:!1,editDocumentDialog:!1,deleteDocumentDialog:!1,tempAttachment:[],tempAttachmentChanged:[],fileUploaderSnackBarAlert:!1,fileUploaderSnackText:"",fileUploaderSnackBarAlertColor:"green",readerFile:null,registryDocFile:[],documentAttachmentAPI:[],btnLoader:!1,showDetail:!1,showDetailState:[],selectedIndex:0,selectedId:"",returnedRecord:{},outlined:!1,raised:!1,shaped:!1,tile:!1,selectedLang:{},beforeInsertAttachments:{},attachmentIndex:0}),d=r;e.onBeforeMount(()=>{x(),t.registryDocFile=o.documentAttachment,o.rtlSupport&&k(),p()});let C=0;e.watch(()=>t.tempAttachment,async s=>{const n=++C;if(s&&s.length>0){t.btnLoader=!0;const a=await u.readFiles(s);if(n!==C||!t.insertDocumentDialog)return;t.tempAttachmentChanged=a,t.btnLoader=!1}else t.tempAttachmentChanged=[]}),e.watch(()=>o.cardType,s=>{d("updateCardType",s),p()}),e.watch(()=>o.badgeCounter,s=>{d("updateBadgeCounter",s)}),e.watch(()=>o.maxFileCount,s=>{d("updateMaxFileCount",s)}),e.watch(()=>o.maxFileSize,s=>{d("updateMaxFileSize",s)}),e.watch(()=>o.maxFileSize,s=>{d("updateMaxFileSize",s)}),e.watch(()=>o.imageCompressor,s=>{d("updateImageCompressor",s)}),e.watch(()=>o.imageCompressLevel,s=>{d("updateImageCompressLevel",s)}),e.watch(()=>o.fileAccept,s=>{d("updateFileAccept",s)}),e.watch(()=>o.thumb,s=>{d("updateThumb",s)}),e.watch(()=>o.changeFileName,s=>{d("updateChangeFileName",s)}),e.watch(()=>o.addFileDescription,s=>{d("updateAddFileDescription",s)}),e.watch(()=>o.addFileTag,s=>{d("updateAddFileDescription",s)}),e.watch(()=>o.tableThumbColumn,s=>{d("updateTableThumbColumn",s)}),e.watch(()=>o.tableFixedHeader,s=>{d("updateTableFixedHeader",s)}),e.watch(()=>o.tableHeight,s=>{d("updateTableHeight",s)}),e.watch(()=>o.lang,s=>{d("updateLang",s)}),e.onDeactivated(()=>{t.registryDocFile=[]});const _=()=>{t.btnLoader=!1,t.tempAttachment=[],t.insertDocumentDialog=!0},x=()=>{o.customLang!==null?t.selectedLang=o.customLang:t.selectedLang=u.languages},k=()=>{},p=()=>{const n={default:{outlined:!1,raised:!1,shaped:!1,tile:!1},outlined:{outlined:!0,raised:!1,shaped:!1,tile:!1},shaped:{outlined:!1,raised:!1,shaped:!0,tile:!1},raised:{outlined:!1,raised:!0,shaped:!1,tile:!1},tile:{outlined:!1,raised:!1,shaped:!1,tile:!0}}[o.cardType||"default"];t.outlined=n.outlined,t.raised=n.raised,t.shaped=n.shaped,t.tile=n.tile},f=(s,n)=>{t.fileUploaderSnackText=s,t.fileUploaderSnackBarAlertColor=n,t.fileUploaderSnackBarAlert=!0},B=s=>{const n=t.selectedLang[o.lang];switch(s.code){case"maxFileCount":return`${n.maxFileCountAlert} ${o.maxFileCount}`;case"maxFileSize":return`${n.maxFileSizeAlert} ${Number((o.maxFileSize/(1024*1024)).toFixed(1))} ${n.size.mb}`;default:return"File could not be processed due to an invalid format."}},b=async()=>{t.btnLoader=!0;const{accepted:s,errors:n}=await u.prepareAttachments(t.tempAttachmentChanged,{currentCount:o.documentAttachment.length,maxFileCount:o.maxFileCount,maxFileSize:o.maxFileSize,imageCompressor:o.imageCompressor,imageCompressLevel:o.imageCompressLevel});s.length>0&&(t.registryDocFile.push(...s),d("updateDocumentAttachment",t.registryDocFile));const a=n[n.length-1];a&&f(B(a),"red"),t.documentAttachmentAPI=[],t.tempAttachmentChanged=[],t.insertDocumentDialog=!1,t.btnLoader=!1},w=(s,n)=>{t.btnLoader=!1,t.selectedIndex=s,t.selectedId=n,t.deleteDocumentDialog=!0},T=()=>{t.registryDocFile.splice(t.selectedIndex,1),d("updateDocumentAttachment",t.registryDocFile),t.deleteDocumentDialog=!1},F=(s,n)=>{C++,t.btnLoader=!1,t.attachmentIndex=n,t.editDocumentDialog=!0,t.tempAttachmentChanged=[s]},E=()=>{const s=[...o.documentAttachment];s.splice(t.attachmentIndex,1,t.tempAttachmentChanged[0]),d("updateDocumentAttachment",s),t.editDocumentDialog=!1};return(s,n)=>{const a=e.resolveComponent("v-col"),i=e.resolveComponent("v-row"),c=e.resolveComponent("v-icon"),h=e.resolveComponent("v-card-title"),g=e.resolveComponent("v-file-input"),V=e.resolveComponent("v-expansion-panel-title"),v=e.resolveComponent("v-text-field"),S=e.resolveComponent("v-textarea"),U=e.resolveComponent("v-autocomplete"),P=e.resolveComponent("v-img"),L=e.resolveComponent("v-card"),j=e.resolveComponent("v-expansion-panel-text"),M=e.resolveComponent("v-expansion-panel"),H=e.resolveComponent("v-expansion-panels"),O=e.resolveComponent("v-list-item-title"),y=e.resolveComponent("v-list-item"),$=e.resolveComponent("v-card-text"),N=e.resolveComponent("v-btn"),z=e.resolveComponent("v-card-actions"),q=e.resolveComponent("v-dialog"),ee=e.resolveComponent("v-snackbar"),te=e.resolveComponent("v-spacer"),oe=e.resolveComponent("v-container");return e.openBlock(),e.createBlock(oe,null,{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",md:"12",xs:"12"},{default:e.withCtx(()=>[o.insertPermission?(e.openBlock(),e.createBlock(Y,{key:0,documentAttachment:o.documentAttachment,selectedLang:t.selectedLang,lang:o.lang,badgeCounter:o.badgeCounter,btnColor:o.btnColor,maxFileCount:o.maxFileCount,onOpenInputDocumentModal:_},null,8,["documentAttachment","selectedLang","lang","badgeCounter","btnColor","maxFileCount"])):e.createCommentVNode("",!0),o.fileUploaderType==="simple"?(e.openBlock(),e.createBlock(X,{key:1,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:w,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="thumbnail"?(e.openBlock(),e.createBlock(R,{key:2,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:n[0]||(n[0]=(m,A)=>w(m,A)),onOpenEditDocumentDialog:n[1]||(n[1]=(m,A)=>F(m,A))},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0),o.fileUploaderType==="table"?(e.openBlock(),e.createBlock(W,{key:3,documentAttachment:o.documentAttachment,cols:o.cols,thumb:o.thumb,outlined:t.outlined,raised:t.raised,shaped:t.shaped,tile:t.tile,lang:o.lang,tableThumbColumn:o.tableThumbColumn,tableFixedHeader:o.tableFixedHeader,tableHeight:o.tableHeight,cardType:o.cardType,deletePermission:o.deletePermission,editPermission:o.editPermission,selectedLang:t.selectedLang,onSetCardTheme:p,onOpenDeleteDialog:w,onOpenEditDocumentDialog:F},null,8,["documentAttachment","cols","thumb","outlined","raised","shaped","tile","lang","tableThumbColumn","tableFixedHeader","tableHeight","cardType","deletePermission","editPermission","selectedLang"])):e.createCommentVNode("",!0)]),_:1})]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.insertDocumentDialog,"onUpdate:modelValue":n[5]||(n[5]=m=>t.insertDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{onClick:n[2]||(n[2]=m=>t.insertDocumentDialog=!1)},{default:e.withCtx(()=>[...n[12]||(n[12]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[t.tempAttachment.length===0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.fileAccept!==""?(e.openBlock(),e.createBlock(g,{key:0,multiple:"",accept:o.fileAccept,chip:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[3]||(n[3]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["accept","modelValue","label"])):(e.openBlock(),e.createBlock(g,{key:1,multiple:"",modelValue:t.tempAttachment,"onUpdate:modelValue":n[4]||(n[4]=m=>t.tempAttachment=m),label:t.selectedLang[l.lang].insertNewFile},null,8,["modelValue","label"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.addFileTag||o.addFileDescription||o.changeFileName?(e.openBlock(),e.createBlock(H,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(M,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.file.name),1)]),_:2},1024),e.createVNode(j,null,{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>[m.file.format==="jpg"||m.file.format==="jpeg"||m.file.format==="png"||m.file.format==="tif"||m.file.format==="bmp"?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1})):(e.openBlock(),e.createBlock(L,{key:1,class:"mx-auto",tile:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock(y,{key:`attachment-${A}`,style:{"border-bottom":"1px solid #E0E0E0"}},{default:e.withCtx(()=>[e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(I,{"file-format":m.file.format,size:24},null,8,["file-format"]),e.createTextVNode(" "+e.toDisplayString(e.unref(u.joinFileName)(m.file.name,m.file.format)),1)]),_:2},1024)]),_:2},1024))),128))]),_:1}))],64))]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment==null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].add),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.editDocumentDialog,"onUpdate:modelValue":n[7]||(n[7]=m=>t.editDocumentDialog=m),scrollable:!1,persistent:"",width:"50%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{onClick:n[6]||(n[6]=m=>t.editDocumentDialog=!1)},{default:e.withCtx(()=>[...n[13]||(n[13]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tempAttachmentChanged,(m,A)=>(e.openBlock(),e.createBlock($,{key:`attachment-${A}`},{default:e.withCtx(()=>[e.createVNode(i,{align:"center",justify:"center"},{default:e.withCtx(()=>[e.createVNode(a,{cols:"12",lg:"9",md:"9",xs:"12"},{default:e.withCtx(()=>[o.changeFileName?(e.openBlock(),e.createBlock(v,{key:0,label:t.selectedLang[l.lang].fileName,modelValue:m.file.name,"onUpdate:modelValue":D=>m.file.name=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileDescription?(e.openBlock(),e.createBlock(S,{key:1,label:t.selectedLang[l.lang].fileDescription,"auto-grow":"","row-height":"1",modelValue:m.file.description,"onUpdate:modelValue":D=>m.file.description=D},null,8,["label","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),o.addFileTag?(e.openBlock(),e.createBlock(U,{key:2,modelValue:m.file.tags,"onUpdate:modelValue":D=>m.file.tags=D,items:o.tags,dense:"",chips:"",label:t.selectedLang[l.lang].fileTags,multiple:""},null,8,["modelValue","onUpdate:modelValue","items","label"])):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(a,{align:"center",cols:"12",lg:"3",md:"3",xs:"12"},{default:e.withCtx(()=>{var D;return[m.file.name&&["jpg","jpeg","png","tif","bmp"].includes(((D=m.file.name.split(".").pop())==null?void 0:D.toLowerCase())||"")?(e.openBlock(),e.createBlock(L,{key:0},{default:e.withCtx(()=>[e.createVNode(P,{src:"data:"+m.file.format+";base64,"+m.file.base64},null,8,["src"])]),_:2},1024)):(e.openBlock(),e.createBlock(I,{key:1,"file-format":m.file.format,size:60},null,8,["file-format"]))]}),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(N,{disabled:t.tempAttachment===null||t.btnLoader,loading:t.btnLoader,color:o.btnColor,onClick:E},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].edit),1)]),_:1},8,["disabled","loading","color"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),e.createVNode(ee,{modelValue:t.fileUploaderSnackBarAlert,"onUpdate:modelValue":n[9]||(n[9]=m=>t.fileUploaderSnackBarAlert=m),right:"",bottom:"",color:t.fileUploaderSnackBarAlertColor,timeout:3e3},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.fileUploaderSnackText)+" ",1),e.createVNode(N,{color:"white",text:"",onClick:n[8]||(n[8]=m=>t.fileUploaderSnackBarAlert=!1)},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[...n[14]||(n[14]=[e.createTextVNode("mdi-close",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue","color"]),e.createVNode(i,{justify:"center"},{default:e.withCtx(()=>[e.createVNode(q,{modelValue:t.deleteDocumentDialog,"onUpdate:modelValue":n[11]||(n[11]=m=>t.deleteDocumentDialog=m),persistent:"",width:"30%"},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(c,{color:"red"})]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.message),1)]),_:1}),e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(te),e.createVNode(N,{color:"green darken-1",text:"",onClick:n[10]||(n[10]=m=>t.deleteDocumentDialog=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].deleteDialog.cancel),1)]),_:1}),e.createVNode(N,{color:"primary",disabled:t.btnLoader,loading:t.btnLoader,onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectedLang[l.lang].delete),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),G=new Set;function Q(l,r){G.has(l)||(G.add(l),console.warn(`[handy-uploader] ${l}() is deprecated and will be removed in the next major version. Use ${r} instead.`))}function He(l,r={}){Q("useFileUpload","useUploader");const{maxFileSize:o=5*1024*1024,maxFileCount:t=10,imageCompressor:d=!1,imageCompressLevel:C=.8,fileAccept:_="*"}=r,x=e.ref(!1),k=e.ref({show:!1,text:"",color:"success"}),p=e.computed(()=>l.value.length),f=e.computed(()=>p.value<t),B=e.computed(()=>l.value.reduce((a,i)=>a+i.file.size,0));function b(a,i="success"){k.value={show:!0,text:a,color:i}}function w(a){var i;if(!u.validateFileSize(a.size,o))return{valid:!1,error:`File size exceeds maximum allowed size of ${(o/1048576).toFixed(1)}MB`};if(!u.validateFileCount(p.value,t))return{valid:!1,error:`Maximum file count of ${t} reached`};if(_!=="*"){const c=_.split(",").map(v=>v.trim()),h=`.${(i=a.name.split(".").pop())==null?void 0:i.toLowerCase()}`,g=a.type;if(!c.some(v=>v.startsWith(".")?v===h:v.includes("/*")?g.startsWith(v.replace("/*","")):v===g))return{valid:!1,error:`File type not accepted. Allowed types: ${_}`}}return{valid:!0}}async function T(a){let i;if(d&&u.isImageFile(a.name,a.type))try{i=(await u.compressImage(a,C)).split(",")[1]}catch(g){console.warn("Image compression failed, using original file:",g),i=await u.fileToBase64(a)}else i=await u.fileToBase64(a);const c=u.formatFileSize(a.size),h=u.getMimeTypeFromExtension(a.name);return{base64:i,size:c.text,name:a.name,tags:[],description:"",showDetailState:!1,format:h}}async function F(a){if(x.value)return!1;x.value=!0;const i=Array.from(a),c=[];for(const h of i){const g=w(h);g.valid?c.push(h):b(g.error,"error")}if(c.length===0)return x.value=!1,!1;try{const g=(await Promise.all(c.map(v=>T(v)))).map(v=>{var S;return{file:{name:v.name,format:v.format,base64:v.base64,size:((S=c.find(U=>U.name===v.name))==null?void 0:S.size)||0,tags:v.tags,description:v.description,showDetailState:v.showDetailState}}});l.value.push(...g);const V=c.length===1?`File "${c[0].name}" uploaded successfully`:`${c.length} files uploaded successfully`;return b(V,"success"),!0}catch(h){return console.error("File upload error:",h),b("Failed to upload files. Please try again.","error"),!1}finally{x.value=!1}}function E(a){if(a>=0&&a<l.value.length){const i=l.value[a];return l.value.splice(a,1),b(`File "${i.file.name}" removed`,"warning"),!0}return!1}function s(a,i){if(a>=0&&a<l.value.length){const c=l.value[a].file;return Object.assign(c,i),b("File updated successfully","success"),!0}return!1}function n(){const a=l.value.length;l.value.splice(0),b(`${a} files cleared`,"warning")}return{isUploading:x,snackbar:k,fileCount:p,canAddMoreFiles:f,totalSize:B,uploadFiles:F,removeFile:E,updateFileMetadata:s,clearAllFiles:n,validateFile:w,showSnackbar:b}}function Oe(l={}){Q("useErrorHandler","the errors from useUploader");const{maxErrors:r=10,autoRemoveTimeout:o=5e3,logToConsole:t=!0}=l,d=e.ref([]),C=e.ref(!1);function _(){return`error_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function x(i,c="error",h,g){const V={id:_(),message:i,type:c,timestamp:new Date,context:h,action:g};return t&&(c==="error"?console.error:c==="warning"?console.warn:c==="info"?console.info:console.log)(`[${c.toUpperCase()}] ${i}`,h||""),d.value.unshift(V),d.value.length>r&&(d.value=d.value.slice(0,r)),o>0&&setTimeout(()=>{k(V.id)},o),V.id}function k(i){const c=d.value.findIndex(h=>h.id===i);return c!==-1?(d.value.splice(c,1),!0):!1}function p(){d.value=[]}function f(i){d.value=d.value.filter(c=>c.type!==i)}async function B(i,c,h){C.value=!0;try{return await i()}catch(g){const V=c||(g instanceof Error?g.message:"An unexpected error occurred");return x(V,"error",{...h,originalError:g instanceof Error?g.message:String(g)}),null}finally{C.value=!1}}function b(i,c,h){return i||x(c,"error",h),i}function w(i,c){return x(i,"success",c)}function T(i,c){return x(i,"warning",c)}function F(i,c){return x(i,"info",c)}function E(i){return d.value.filter(c=>c.type===i)}function s(){return d.value[0]||null}function n(i){return i?d.value.some(c=>c.type===i):d.value.length>0}const a={fileSizeExceeded:(i,c)=>x(`File "${i}" exceeds maximum size of ${(c/(1024*1024)).toFixed(1)}MB`,"error",{fileName:i,maxSize:c,category:"file-upload"}),fileCountExceeded:i=>x(`Maximum file count of ${i} reached`,"error",{maxCount:i,category:"file-upload"}),invalidFileType:(i,c)=>x(`File "${i}" type not allowed. Accepted types: ${c}`,"error",{fileName:i,allowedTypes:c,category:"file-upload"}),uploadFailed:(i,c)=>x(`Failed to upload "${i}"${c?`: ${c}`:""}`,"error",{fileName:i,reason:c,category:"file-upload"}),compressionFailed:i=>x(`Image compression failed for "${i}", using original file`,"warning",{fileName:i,category:"file-upload"})};return{errors:d,isLoading:C,addError:x,removeError:k,clearErrors:p,clearErrorsByType:f,handleAsync:B,validate:b,showSuccess:w,showWarning:T,showInfo:F,getErrorsByType:E,getLatestError:s,hasErrors:n,fileUploadErrors:a}}const Z={ThumbnailUploader:R,TableUploader:W,SimpleUploader:X,HandyUploader:J,InsertButton:Y,SelectFileIconType:I};function qe(l){for(const[r,o]of Object.entries(Z))l.component(r,o)}exports.COMPRESSIBLE_EXTENSIONS=u.COMPRESSIBLE_EXTENSIONS;exports.base64ByteLength=u.base64ByteLength;exports.compressDataUrl=u.compressDataUrl;exports.compressImage=u.compressImage;exports.constructImageDataUrl=u.constructImageDataUrl;exports.createVideoThumbnailCache=u.createVideoThumbnailCache;exports.fileToBase64=u.fileToBase64;exports.filterByAccept=u.filterByAccept;exports.formatBytes=u.formatBytes;exports.formatFileSize=u.formatFileSize;exports.generateVideoThumbnail=u.generateVideoThumbnail;exports.getFileIcon=u.getFileIcon;exports.getFileType=u.getFileType;exports.getMimeTypeFromExtension=u.getMimeTypeFromExtension;exports.getVideoDataUrl=u.getVideoDataUrl;exports.isImageFile=u.isImageFile;exports.joinFileName=u.joinFileName;exports.languageData=u.languages;exports.matchesAccept=u.matchesAccept;exports.precheckFiles=u.precheckFiles;exports.prepareAttachments=u.prepareAttachments;exports.readFileAsDataUrl=u.readFileAsDataUrl;exports.readFiles=u.readFiles;exports.splitFileName=u.splitFileName;exports.validateFileCount=u.validateFileCount;exports.validateFileSize=u.validateFileSize;exports.HandyUploader=J;exports.InsertButton=Y;exports.SelectFileIconType=I;exports.SimpleUploader=X;exports.TableUploader=W;exports.ThumbnailUploader=R;exports.default=Z;exports.install=qe;exports.useErrorHandler=Oe;exports.useFileUpload=He;