Files
Web_AUTSDATA_Mvc_Prod/AUTS.Web/Scripts/fileinput.min.js

28 lines
143 KiB
JavaScript
Raw Normal View History

2025-11-20 13:11:05 +08:00
/*!
* bootstrap-fileinput v5.2.3
* http://plugins.krajee.com/file-input
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
*
* Licensed under the BSD-3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
*/!function (e) { "use strict"; "function" == typeof define && define.amd ? define(["jquery"], e) : "object" == typeof module && module.exports ? module.exports = e(require("jquery")) : e(window.jQuery) }(function (e) {
"use strict"; e.fn.fileinputLocales = {}, e.fn.fileinputThemes = {}, e.fn.fileinputBsVersion || (e.fn.fileinputBsVersion = window.Alert && window.Alert.VERSION || window.bootstrap && window.bootstrap.Alert && bootstrap.Alert.VERSION || "3.x.x"), String.prototype.setTokens = function (e) { var t, i, a = this.toString(); for (t in e) e.hasOwnProperty(t) && (i = new RegExp("{" + t + "}", "g"), a = a.replace(i, e[t])); return a }, Array.prototype.flatMap || (Array.prototype.flatMap = function (e) { return [].concat(this.map(e)) }); var t, i; t = { FRAMES: ".kv-preview-thumb", SORT_CSS: "file-sortable", INIT_FLAG: "init-", OBJECT_PARAMS: '<param name="controller" value="true" />\n<param name="allowFullScreen" value="true" />\n<param name="allowScriptAccess" value="always" />\n<param name="autoPlay" value="false" />\n<param name="autoStart" value="false" />\n<param name="quality" value="high" />\n', DEFAULT_PREVIEW: '<div class="file-preview-other">\n<span class="{previewFileIconClass}">{previewFileIcon}</span>\n</div>', MODAL_ID: "kvFileinputModal", MODAL_EVENTS: ["show", "shown", "hide", "hidden", "loaded"], logMessages: { ajaxError: "{status}: {error}. Error Details: {text}.", badDroppedFiles: "Error scanning dropped files!", badExifParser: "Error loading the piexif.js library. {details}", badInputType: 'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.', exifWarning: 'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded the "piexif.js" library correctly on your page before the "fileinput.js" script.', invalidChunkSize: 'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.', invalidThumb: 'Invalid thumb frame with id: "{id}".', noResumableSupport: "The browser does not support resumable or chunk uploads.", noUploadUrl: 'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.', retryStatus: "Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.", chunkQueueError: "Could not push task to ajax pool for chunk index # {index}.", resumableMaxRetriesReached: "Maximum resumable ajax retries ({n}) reached.", resumableRetryError: "Could not retry the resumable request (try # {n})... aborting.", resumableAborting: "Aborting / cancelling the resumable request.", resumableRequestError: "Error processing resumable request. {msg}" }, objUrl: window.URL || window.webkitURL, isBs: function (t) { var i = e.trim((e.fn.fileinputBsVersion || "") + ""); return t = parseInt(t, 10), i ? t === parseInt(i.charAt(0), 10) : 4 === t }, defaultButtonCss: function (e) { return "btn-default btn-" + (e ? "" : "outline-") + "secondary" }, now: function () { return (new Date).getTime() }, round: function (e) { return e = parseFloat(e), isNaN(e) ? 0 : Math.floor(Math.round(e)) }, getArray: function (e) { var t, i = [], a = e && e.length || 0; for (t = 0; a > t; t++)i.push(e[t]); return i }, getFileRelativePath: function (e) { return String(e.newPath || e.relativePath || e.webkitRelativePath || t.getFileName(e) || null) }, getFileId: function (e, i) { var a = t.getFileRelativePath(e); return "function" == typeof i ? i(e) : e && a ? e.size + "_" + encodeURIComponent(a).replace(/%/g, "_") : null }, getFrameSelector: function (e, t) { return t = t || "", '[id="' + e + '"]' + t }, getZoomSelector: function (e, i) { return t.getFrameSelector("zoom-" + e, i) }, getFrameElement: function (e, i, a) { return e.find(t.getFrameSelector(i, a)) }, getZoomElement: function (e, i, a) { return e.find(t.getZoomSelector(i, a)) }, getElapsed: function (i) { var a = i, r = "", n = {}, o = { year: 31536e3, month: 2592e3, week: 604800, day: 86400, hour: 3600, minute: 60, second: 1 }; return t.getObjectKeys(o).forEach(function (e) { n[e] = Math.floor(a / o[e]), a -= n[e] * o[e] }), e.each(n, function (e, t) { t > 0 && (r += (r ? " " : "") + t + e.substring(0, 1)) }), r }, debounce: function (e, t) { var i; return function () { var a = arguments, r = this; clearTimeout(i), i = setTimeout(function () { e.apply(r, a) }, t) } }, stopEvent: fun
constructor: i, _cleanup: function () { var e = this; e.reader = null, e.clearFileStack(), e.fileBatchCompleted = !0, e.isError = !1, e.isDuplicateError = !1, e.isPersistentError = !1, e.cancelling = !1, e.paused = !1, e.lastProgress = 0, e._initAjax() }, _isAborted: function () { var e = this; return e.cancelling || e.paused }, _initAjax: function () { var i = this, a = i.taskManager = { pool: {}, addPool: function (e) { return a.pool[e] = new a.TasksPool(e) }, getPool: function (e) { return a.pool[e] }, addTask: function (e, t) { return new a.Task(e, t) }, TasksPool: function (i) { var r = this; r.id = i, r.cancelled = !1, r.cancelledDeferrer = e.Deferred(), r.tasks = {}, r.addTask = function (e, t) { return r.tasks[e] = new a.Task(e, t) }, r.size = function () { return t.getObjectSize(r.tasks) }, r.run = function (i) { var a, n, o, s = 0, l = !1, d = t.getObjectKeys(r.tasks).map(function (e) { return r.tasks[e] }), c = [], u = e.Deferred(); if (r.cancelled) return r.cancelledDeferrer.resolve(), u.reject(); if (!i) { var p = t.getObjectKeys(r.tasks).map(function (e) { return r.tasks[e].deferred }); return t.whenAll(p).done(function () { var e = t.getArray(arguments); r.cancelled ? (u.reject.apply(null, e), r.cancelledDeferrer.resolve()) : (u.resolve.apply(null, e), r.cancelledDeferrer.reject()) }).fail(function () { var e = t.getArray(arguments); u.reject.apply(null, e), r.cancelled ? r.cancelledDeferrer.resolve() : r.cancelledDeferrer.reject() }), e.each(r.tasks, function (e) { a = r.tasks[e], a.run() }), u } for (n = function (t) { e.when(t.deferred).fail(function () { l = !0, o.apply(null, arguments) }).always(o) }, o = function () { var e = t.getArray(arguments); return u.notify(e), c.push(e), r.cancelled ? (u.reject.apply(null, c), void r.cancelledDeferrer.resolve()) : (c.length === r.size() && (l ? u.reject.apply(null, c) : u.resolve.apply(null, c)), void (d.length && (a = d.shift(), n(a), a.run()))) }; d.length && s++ < i;)a = d.shift(), n(a), a.run(); return u }, r.cancel = function () { return r.cancelled = !0, r.cancelledDeferrer } }, Task: function (i, a) { var r = this; r.id = i, r.deferred = e.Deferred(), r.logic = a, r.context = null, r.run = function () { var e = t.getArray(arguments); return e.unshift(r.deferred), a.apply(r.context, e), r.deferred }, r.runWithContext = function (e) { return r.context = e, r.run() } } }; i.ajaxQueue = [], i.ajaxRequests = [], i.ajaxAborted = !1 }, _init: function (i, a) { var r, n, o, s, l = this, d = l.$element; l.options = i, l.canOrientImage = t.canOrientImage(d), e.each(i, function (e, i) { switch (e) { case "minFileCount": case "maxFileCount": case "maxTotalFileCount": case "minFileSize": case "maxFileSize": case "maxFilePreviewSize": case "resizeQuality": case "resizeIfSizeMoreThan": case "progressUploadThreshold": case "initialPreviewCount": case "zoomModalHeight": case "minImageHeight": case "maxImageHeight": case "minImageWidth": case "maxImageWidth": case "bytesToKB": l[e] = t.getNum(i); break; default: l[e] = i } }), (!l.bytesToKB || l.bytesToKB <= 0) && (l.bytesToKB = 1024), void 0 === l.errorCloseButton && (l.errorCloseButton = t.closeButton("kv-error-close" + (t.isBs(5) ? " float-end" : ""))), l.maxTotalFileCount > 0 && l.maxTotalFileCount < l.maxFileCount && (l.maxTotalFileCount = l.maxFileCount), l.rtl && (s = l.previewZoomButtonIcons.prev, l.previewZoomButtonIcons.prev = l.previewZoomButtonIcons.next, l.previewZoomButtonIcons.next = s), !isNaN(l.maxAjaxThreads) && l.maxAjaxThreads < l.resumableUploadOptions.maxThreads && (l.resumableUploadOptions.maxThreads = l.maxAjaxThreads), l._initFileManager(), "function" == typeof l.autoOrientImage && (l.autoOrientImage = l.autoOrientImage()), "function" == typeof l.autoOrientImageInitial && (l.autoOrientImageInitial = l.autoOrientImageInitial()), a || l._cleanup(), l.duplicateErrors = [], l.$form = d.closest("form"), l._initTemplateDefaults(), l.uploadFileAttr = t.isEmpty(d.attr("name")) ? "file_data" : d.attr("name"), o = l._getLayoutTemplate("progress"), l.progressTemplate = o.replace("{class}", l.prog
var i, a, r, n, o, s, l, d, c, u, p, f, m, g, v, h, w, b, _, C, x, y, T, P, k, F, S, E, I, A, D, z, $, j, U, M, R, B, O, L, N, Z, H, W = this, q = function (e, i) { return '<object class="kv-preview-data file-preview-' + e + '" title="{caption}" data="{data}" type="' + i + '"' + B + ">\n" + t.DEFAULT_PREVIEW + "\n</object>\n" }, V = "btn btn-sm btn-kv " + t.defaultButtonCss(); i = '{preview}\n<div class="kv-upload-progress kv-hidden"></div><div class="clearfix"></div>\n<div class="file-caption {class}">\n <div class="input-group {inputGroupClass}">\n {caption}\n<span class="file-caption-icon"></span>\n' + (t.isBs(5) ? "" : '<div class="input-group-btn input-group-append">\n') + " {remove}\n {cancel}\n {pause}\n {upload}\n {browse}\n" + (t.isBs(5) ? "" : " </div>\n") + " </div>", a = '{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n<span class="{class}">{remove}\n{cancel}\n{upload}\n{browse}\n</span>', r = '<div class="file-preview {class}">\n {close} <div class="{dropClass} clearfix">\n <div class="file-preview-thumbnails clearfix">\n </div>\n <div class="file-preview-status text-center text-success"></div>\n <div class="kv-fileinput-error"></div>\n </div>\n</div>', o = t.closeButton("fileinput-remove"), n = '<i class="bi-file-earmark-arrow-up"></i>', s = '<input readonly class="file-caption-name form-control {class}">\n', l = '<button type="{type}" title="{title}" class="{css}" {status} {tabIndexConfig}>{icon} {label}</button>', d = '<a href="{href}" title="{title}" class="{css}" {status} {tabIndexConfig}>{icon} {label}</a>', c = '<div class="{css}" {status} {tabIndexConfig}>{icon} {label}</div>', Z = t.MODAL_ID + "Label", u = '<div id="' + t.MODAL_ID + '" class="file-zoom-dialog modal fade" aria-labelledby="' + Z + '" {tabIndexConfig}></div>',
p = '<div class="modal-dialog modal-lg{rtl}" role="document">\n <div class="modal-content">\n <div class="modal-header kv-zoom-header">\n <h6 class="modal-title kv-zoom-title" id="' + Z + '"><span class="kv-zoom-caption"></span> <span class="kv-zoom-size"></span></h6>\n <div class="kv-zoom-actions">{toggleheader}{fullscreen}{borderless}{close}</div>\n </div>\n <div class="floating-buttons"></div>\n <div class="kv-zoom-body file-zoom-content {zoomFrameClass}"></div>\n{prev} {next}\n <div class="kv-zoom-description"></div>\n </div>\n</div>\n', H = '<button type="button" class="kv-desc-hide" aria-label="Close">{closeIcon}</button>', f = '<div class="progress">\n <div class="{class}" role="progressbar" aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n {status}\n </div>\n</div>{stats}', N = '<div class="text-primary file-upload-stats"><span class="pending-time">{pendingTime}</span> <span class="upload-speed">{uploadSpeed}</span></div>', m = " <samp>({sizeText})</samp>", g = '<div class="file-thumbnail-footer">\n <div class="file-footer-caption" title="{caption}">\n <div class="file-caption-info">{caption}</div>\n <div class="file-size-info">{size}</div>\n </div>\n {progress}\n{indicator}\n{actions}\n</div>', v = '<div class="file-actions">\n <div class="file-footer-buttons">\n {download} {upload} {delete} {zoom} {other} </div>\n</div>\n{drag}\n<div class="clearfix"></div>', h = '<button type="button" class="kv-file-remove {removeClass}" title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n', w = '<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">{uploadIcon}</button>', b = '<a class="kv-file-download {downloadClass}" title="{downloadTitle}" href="{downloadUrl}" download="{caption}" target="_blank">{downloadIcon}</a>', _ = '<button type="button" class="kv-file-zoom {zoomClass}" title="{zoomTitle}">{zoomIcon}</button>', C = '<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>', x = '<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>', y = '<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-fileid="{fileid}" data-template="{template}" data-zoom="{zoomData}"', T = y + '><div class="kv-file-content">\n', P = y + ' title="{caption}"><div class="kv-file-content">\n', k = "</div>{footer}\n{zoomCache}</div>\n", F = "{content}\n", B = " {style}", S = q("html", "text/html"), I = q("text", "text/plain;charset=UTF-8"), M = q("pdf", "application/pdf"), E = '<img src="{data}" class="file-preview-image kv-preview-data" title="{title}" alt="{alt}"' + B + ">\n", A = '<iframe class="kv-preview-data file-preview-office" src="https://view.officeapps.live.com/op/embed.aspx?src={data}"' + B + "></iframe>", D = '<iframe class="kv-preview-data file-preview-gdocs" src="https://docs.google.com/gview?url={data}&embedded=true"' + B + "></iframe>", z = '<video class="kv-preview-data file-preview-video" controls' + B + '>\n<source src="{data}" type="{type}">\n' + t.DEFAULT_PREVIEW + "\n</video>\n", $ = '<!--suppress ALL --><audio class="kv-preview-data file-preview-audio" controls' + B + '>\n<source src="{data}" type="{type}">\n' + t.DEFAULT_PREVIEW + "\n</audio>\n", j = '<embed class="kv-preview-data file-preview-flash" src="{data}" type="application/x-shockwave-flash"' + B + ">\n", U = '<object class="kv-preview-data file-preview-object file-object {typeCss}" data="{data}" type="{type}"' + B + '>\n<param name="movie" value="{caption}" />\n' + t.OBJECT_PARAMS + " " + t.DEFAULT_PREVIEW + "\n</object>\n", R = '<div class="kv-preview-data file-preview-other-frame"' + B + ">\n" + t.DEFAULT_PREVIEW + "\n</div>\n", O = '<div class="kv-zoom-cache">{zoomContent}</div>', L = { width: "100%", height: "100%", "min-height": "480px" }, W._isPdfRendered() && (M = W.pdfRendererTemplate.replace("{renderer}", W._encodeURI(W.pdfRendererUrl))), W.defaults = { layoutTemplates: { main1: i, main2: a, p
}, _initPreviewTemplates: function () { var i, a = this, r = a.previewMarkupTags, n = r.tagAfter; e.each(a.previewContentTemplates, function (e, o) { t.isEmpty(a.previewTemplates[e]) && (i = r.tagBefore2, "generic" !== e && "image" !== e || (i = r.tagBefore1), a._isPdfRendered() && "pdf" === e && (i = i.replace("kv-file-content", "kv-file-content kv-pdf-rendered")), a.previewTemplates[e] = i + o + n) }) }, _initPreviewCache: function () { var i = this; i.previewCache = { data: {}, init: function () { var e = i.initialPreview; e.length > 0 && !t.isArray(e) && (e = e.split(i.initialPreviewDelimiter)), i.previewCache.data = { content: e, config: i.initialPreviewConfig, tags: i.initialPreviewThumbTags } }, count: function (e) { if (!i.previewCache.data || !i.previewCache.data.content) return 0; if (e) { var t = i.previewCache.data.content.filter(function (e) { return null !== e }); return t.length } return i.previewCache.data.content.length }, get: function (e, a) { var r, n, o, s, l, d, c, u = t.INIT_FLAG + e, p = i.previewCache.data, f = p.config[e], m = p.content[e], g = t.ifSet("previewAsData", f, i.initialPreviewAsData), v = f ? { title: f.title || null, alt: f.alt || null } : { title: null, alt: null }, h = function (e, a, r, n, o, s, l, d) { var c = " file-preview-initial " + t.SORT_CSS + (l ? " " + l : ""), u = i.previewInitId + "-" + s, p = f && f.fileId || u; return i._generatePreviewTemplate(e, a, r, n, u, p, !1, null, c, o, s, d, v, f && f.zoomData || a) }; return m && m.length ? (a = void 0 === a ? !0 : a, o = t.ifSet("type", f, i.initialPreviewFileType || "generic"), l = t.ifSet("filename", f, t.ifSet("caption", f)), d = t.ifSet("filetype", f, o), s = i.previewCache.footer(e, a, f && f.size || null), c = t.ifSet("frameClass", f), r = g ? h(o, m, l, d, s, u, c) : h("generic", m, l, d, s, u, c, o).setTokens({ content: p.content[e] }), p.tags.length && p.tags[e] && (r = t.replaceTags(r, p.tags[e])), t.isEmpty(f) || t.isEmpty(f.frameAttr) || (n = t.createElement(r), n.find(".file-preview-initial").attr(f.frameAttr), r = n.html(), n.remove()), r) : "" }, clean: function (e) { e.content = t.cleanArray(e.content), e.config = t.cleanArray(e.config), e.tags = t.cleanArray(e.tags), i.previewCache.data = e }, add: function (e, a, r, n) { var o, s = i.previewCache.data; return e && e.length ? (o = e.length - 1, t.isArray(e) || (e = e.split(i.initialPreviewDelimiter)), n && s.content ? (o = s.content.push(e[0]) - 1, s.config[o] = a, s.tags[o] = r) : (s.content = e, s.config = a, s.tags = r), i.previewCache.clean(s), o) : 0 }, set: function (e, a, r, n) { var o, s, l = i.previewCache.data; if (e && e.length && (t.isArray(e) || (e = e.split(i.initialPreviewDelimiter)), s = e.filter(function (e) { return null !== e }), s.length)) { if (void 0 === l.content && (l.content = []), void 0 === l.config && (l.config = []), void 0 === l.tags && (l.tags = []), n) { for (o = 0; o < e.length; o++)e[o] && l.content.push(e[o]); for (o = 0; o < a.length; o++)a[o] && l.config.push(a[o]); for (o = 0; o < r.length; o++)r[o] && l.tags.push(r[o]) } else l.content = e, l.config = a, l.tags = r; i.previewCache.clean(l) } }, unset: function (a) { var r = i.previewCache.count(), n = i.reversePreviewOrder; if (r) { if (1 === r) return i.previewCache.data.content = [], i.previewCache.data.config = [], i.previewCache.data.tags = [], i.initialPreview = [], i.initialPreviewConfig = [], void (i.initialPreviewThumbTags = []); i.previewCache.data.content = t.spliceArray(i.previewCache.data.content, a, n), i.previewCache.data.config = t.spliceArray(i.previewCache.data.config, a, n), i.previewCache.data.tags = t.spliceArray(i.previewCache.data.tags, a, n); var o = e.extend(!0, {}, i.previewCache.data); i.previewCache.clean(o) } }, out: function () { var e, t, a, r = "", n = i.previewCache.count(); if (0 === n) return { content: "", caption: "" }; for (t = 0; n > t; t++)a = i.previewCache.get(t), r = i.reversePreviewOrder ? a + r : r + a; return e = i._getMsgSelected(n), { content: r, caption: e } }, footer: function (e, a, r) { var n = i.previewCache
var t, i = this; (i._inputFileCount() || i.isAjaxUpload) && i.showPreview && i.isPreviewable && (i.isAjaxUpload && i.fileManager.count() > 0 ? (t = e.extend(!0, {}, i.getFileList()),
i.fileManager.clear(), i._clearFileInput()) : t = i.$element[0].files, t && t.length && (i.readFiles(t), i._setFileDropZoneTitle()))
}, _clearObjects: function (t) { t.find("video audio").each(function () { this.pause(), e(this).remove() }), t.find("img object div").each(function () { e(this).remove() }) }, _clearFileInput: function () { var t, i, a, r = this, n = r.$element; r._inputFileCount() && (t = n.closest("form"), i = e(document.createElement("form")), a = e(document.createElement("div")), n.before(a), t.length ? t.after(i) : a.after(i), i.append(n).trigger("reset"), a.before(n).remove(), i.remove()) }, _resetUpload: function () { var e = this; e.uploadStartTime = t.now(), e.uploadCache = [], e.$btnUpload.removeAttr("disabled"), e._setProgress(0), e._hideProgress(), e._resetErrors(!1), e._initAjax(), e.fileManager.clearImages(), e._resetCanvas(), e.overwriteInitial && (e.initialPreview = [], e.initialPreviewConfig = [], e.initialPreviewThumbTags = [], e.previewCache.data = { content: [], config: [], tags: [] }) }, _resetCanvas: function () { var e = this; e.imageCanvas && e.imageCanvasContext && e.imageCanvasContext.clearRect(0, 0, e.imageCanvas.width, e.imageCanvas.height) }, _hasInitialPreview: function () { var e = this; return !e.overwriteInitial && e.previewCache.count(!0) }, _resetPreview: function () { var i, a, r, n = this, o = n.showUploadedThumbs, s = !n.removeFromPreviewOnError, l = (o || s) && n.isDuplicateError; n.previewCache.count(!0) ? (i = n.previewCache.out(), l && (r = t.createElement("").insertAfter(n.$container), n.getFrames().each(function () { var t = e(this); (o && t.hasClass("file-preview-success") || s && t.hasClass("file-preview-error")) && r.append(t) })), n._setPreviewContent(i.content), n._setInitThumbAttr(), a = n.initialCaption ? n.initialCaption : i.caption, n._setCaption(a), l && (r.contents().appendTo(n.$preview), r.remove())) : (n._clearPreview(), n._initCaption()), n.showPreview && (n._initZoom(), n._initSortable()), n.isDuplicateError = !1 }, _clearDefaultPreview: function () { var e = this; e.$preview.find(".file-default-preview").remove() }, _validateDefaultPreview: function () { var e = this; e.showPreview && !t.isEmpty(e.defaultPreviewContent) && (e._setPreviewContent('<div class="file-default-preview">' + e.defaultPreviewContent + "</div>"), e.$container.removeClass("file-input-new"), e._initClickable()) }, _resetPreviewThumbs: function (e) { var t, i = this; return e ? (i._clearPreview(), void i.clearFileStack()) : void (i._hasInitialPreview() ? (t = i.previewCache.out(), i._setPreviewContent(t.content), i._setInitThumbAttr(), i._setCaption(t.caption), i._initPreviewActions()) : i._clearPreview()) }, _getLayoutTemplate: function (e) { var i = this, a = i.layoutTemplates[e]; return t.isEmpty(i.customLayoutTags) ? a : t.replaceTags(a, i.customLayoutTags) }, _getPreviewTemplate: function (e) { var i = this, a = i.previewTemplates, r = a[e] || a.other; return t.isEmpty(i.customPreviewTags) ? r : t.replaceTags(r, i.customPreviewTags) }, _getOutData: function (e, t, i, a) { var r = this; return t = t || {}, i = i || {}, a = a || r.fileManager.list(), { formdata: e, files: a, filenames: r.filenames, filescount: r.getFilesCount(), extra: r._getExtraData(), response: i, reader: r.reader, jqXHR: t } }, _getMsgSelected: function (e, t) { var i = this, a = 1 === e ? i.fileSingle : i.filePlural; return e > 0 ? i.msgSelected.replace("{n}", e).replace("{files}", a) : t ? i.msgProcessing : i.msgNoFilesSelected }, _getFrame: function (e, i) { var a = this, r = t.getFrameElement(a.$preview, e); return !a.showPreview || i || r.length || a._log(t.logMessages.invalidThumb, { id: e }), r }, _getZoom: function (e, i) { var a = this, r = t.getZoomElement(a.$preview, e, i); return a.showPreview && !r.length && a._log(t.logMessages.invalidThumb, { id: e }), r }, _getThumbs: function (e) { return e = e || "", this.getFrames(":not(.file-preview-initial)" + e) }, _getThumbId: function (e) { var t = this; return t.previewInitId + "-" + e }, _getExtraData: function (e, t) { var i = this, a = i.uploadExtraData; return "function" == typeof i.uploadExtraData && (a = i.uploadExtraData(e, t)), a }, _initXhr: function (e, i) {
var o, s, l, d, c, u, p, f, m, g, v = this, h = e(a.img)[0], w = h.naturalWidth, b = h.naturalHeight, _ = 1, C = v.maxImageWidth || w, x = v.maxImageHeight || b, y = !(!w || !b), T = v.imageCanvas, P = v.imageCanvasContext, k = a.typ, F = a.pid, S = a.ind, E = a.thumb, I = a.exifObj; if (c = function (e, t, i) { v.isAjaxUpload ? v._showFileError(e, t, i) : v._showError(e, t, i), v._setPreviewError(E) }, f = v.fileManager.getFile(i), m = { id: F, index: S, fileId: i }, g = [i, F, S], (!f || !y || C >= w && x >= b) && (y && f && v._raise("fileimageresized", g), r.val++ , r.val === n && v._raise("fileimagesresized"), !y)) return void c(v.msgImageResizeError, m, "fileimageresizeerror"); k = k || v.resizeDefaultImageType, s = w > C, l = b > x, _ = "width" === v.resizePreference ? s ? C / w : l ? x / b : 1 : l ? x / b : s ? C / w : 1, v._resetCanvas(), w *= _, b *= _, T.width = w, T.height = b; try { P.drawImage(h, 0, 0, w, b), d = T.toDataURL(k, v.resizeQuality), I && (p = window.piexif.dump(I), d = window.piexif.insert(p, d)), o = t.dataURI2Blob(d), v.fileManager.setFile(i, o), v._raise("fileimageresized", g), r.val++ , r.val === n && v._raise("fileimagesresized", [void 0, void 0]), o instanceof Blob || c(v.msgImageResizeError, m, "fileimageresizeerror") } catch (A) {
r.val++ , r.val === n && v._raise("fileimagesresized", [void 0, void 0]), u = v.msgImageResizeException.replace("{errors}", A.message),
c(u, m, "fileimageresizeexception")
}
}, _showProgress: function () { var e = this; e.$progress && e.$progress.length && e.$progress.show() }, _hideProgress: function () { var e = this; e.$progress && e.$progress.length && e.$progress.hide() }, _initBrowse: function (e) { var i = this, a = i.$element; i.showBrowse ? i.$btnFile = e.find(".btn-file").append(a) : (a.appendTo(e).attr("tabindex", -1), t.addCss(a, "file-no-browse")) }, _initClickable: function () { var i, a, r = this; r.isClickable && (i = r.$dropZone, r.isAjaxUpload || (a = r.$preview.find(".file-default-preview"), a.length && (i = a)), t.addCss(i, "clickable"), i.attr("tabindex", -1), r._handler(i, "click", function (t) { var a = e(t.target); r.$errorContainer.is(":visible") || a.parents(".file-preview-thumbnails").length && !a.parents(".file-default-preview").length || (r.$element.data("zoneClicked", !0).trigger("click"), i.blur()) })) }, _initCaption: function () { var e = this, i = e.initialCaption || ""; return e.overwriteInitial || t.isEmpty(i) ? (e.$caption.val(""), !1) : (e._setCaption(i), !0) }, _setCaption: function (i, a) { var r, n, o, s, l, d, c = this; if (c.$caption.length) { if (c.$captionContainer.removeClass("icon-visible"), a) r = e("<div>" + c.msgValidationError + "</div>").text(), s = c.fileManager.count(), s ? (d = c.fileManager.getFirstFile(), l = 1 === s && d ? d.nameFmt : c._getMsgSelected(s)) : l = c._getMsgSelected(c.msgNo), n = t.isEmpty(i) ? l : i, o = '<span class="' + c.msgValidationErrorClass + '">' + c.msgValidationErrorIcon + "</span>"; else { if (t.isEmpty(i)) return void c.$caption.attr("title", ""); r = e("<div>" + i + "</div>").text(), n = r, o = c._getLayoutTemplate("fileIcon") } c.$captionContainer.addClass("icon-visible"), c.$caption.attr("title", r).val(n), t.setHtml(c.$captionIcon, o) } }, _createContainer: function () { var e = this, i = { "class": "file-input file-input-new" + (e.rtl ? " kv-rtl" : "") }, a = t.createElement(t.cspBuffer.stash(e._renderMain())); return t.cspBuffer.apply(a), a.insertBefore(e.$element).attr(i), e._initBrowse(a), e.theme && a.addClass("theme-" + e.theme), a }, _refreshContainer: function () { var e = this, i = e.$container, a = e.$element; a.insertAfter(i), t.setHtml(i, e._renderMain()), e._initBrowse(i), e._validateDisabled() }, _validateDisabled: function () { var e = this; e.$caption.attr({ readonly: e.isDisabled }) }, _setTabIndex: function (e, t) { var i = this, a = i.tabIndexConfig[e]; return t.setTokens({ tabIndexConfig: void 0 === a || null === a ? "" : 'tabindex="' + a + '"' }) }, _renderMain: function () { var e = this, t = e.dropZoneEnabled ? " file-drop-zone" : "file-drop-disabled", i = e.showClose ? e._getLayoutTemplate("close") : "", a = e.showPreview ? e._getLayoutTemplate("preview").setTokens({ "class": e.previewClass, dropClass: t }) : "", r = e.isDisabled ? e.captionClass + " file-caption-disabled" : e.captionClass, n = e.captionTemplate.setTokens({ "class": r + " kv-fileinput-caption" }); return n = e._setTabIndex("caption", n), e.mainTemplate.setTokens({ "class": e.mainClass + (!e.showBrowse && e.showCaption ? " no-browse" : ""), inputGroupClass: e.inputGroupClass, preview: a, close: i, caption: n, upload: e._renderButton("upload"), remove: e._renderButton("remove"), cancel: e._renderButton("cancel"), pause: e._renderButton("pause"), browse: e._renderButton("browse") }) }, _renderButton: function (e) { var i = this, a = i._getLayoutTemplate("btnDefault"), r = i[e + "Class"], n = i[e + "Title"], o = i[e + "Icon"], s = i[e + "Label"], l = i.isDisabled ? " disabled" : "", d = "button"; switch (e) { case "remove": if (!i.showRemove) return ""; break; case "cancel": if (!i.showCancel) return ""; r += " kv-hidden"; break; case "pause": if (!i.showPause) return ""; r += " kv-hidden"; break; case "upload": if (!i.showUpload) return ""; i.isAjaxUpload && !i.isDisabled ? a = i._getLayoutTemplate("btnLink").replace("{href}", i.uploadUrl) : d = "submit"; break; case "browse": if (!i.showBrowse) return ""; a = i._getLayoutTemplate("btnBrowse"); break; default: return "" }return a = i._setTabIndex(e, a), r +=
}, e.fn.fileinput = function (a) { if (t.hasFileAPISupport() || t.isIE(9)) { var r = Array.apply(null, arguments), n = []; switch (r.shift(), this.each(function () { var o, s = e(this), l = s.data("fileinput"), d = "object" == typeof a && a, c = d.theme || s.data("theme"), u = {}, p = {}, f = d.language || s.data("language") || e.fn.fileinput.defaults.language || "en"; l || (c && (p = e.fn.fileinputThemes[c] || {}), "en" === f || t.isEmpty(e.fn.fileinputLocales[f]) || (u = e.fn.fileinputLocales[f] || {}), o = e.extend(!0, {}, e.fn.fileinput.defaults, p, e.fn.fileinputLocales.en, u, d, s.data()), l = new i(this, o), s.data("fileinput", l)), "string" == typeof a && n.push(l[a].apply(l, r)) }), n.length) { case 0: return this; case 1: return n[0]; default: return n } } }; var a = 'class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}', r = "btn btn-sm btn-kv " + t.defaultButtonCss(), n = "btn " + t.defaultButtonCss(!0); e.fn.fileinput.defaults = { language: "en", bytesToKB: 1024, showCaption: !0, showBrowse: !0, showPreview: !0, showRemove: !0, showUpload: !0, showUploadStats: !0, showCancel: null, showPause: null, showClose: !0, showUploadedThumbs: !0, showConsoleLogs: !1, browseOnZoneClick: !1, autoReplace: !1, showDescriptionClose: !0, autoOrientImage: function () { var e = window.navigator.userAgent, t = !!e.match(/WebKit/i), i = !!e.match(/iP(od|ad|hone)/i), a = i && t && !e.match(/CriOS/i); return !a }, autoOrientImageInitial: !0, required: !1, rtl: !1, hideThumbnailContent: !1, encodeUrl: !0, focusCaptionOnBrowse: !0, focusCaptionOnClear: !0, generateFileId: null, previewClass: "", captionClass: "", frameClass: "krajee-default", mainClass: "", inputGroupClass: "", mainTemplate: null, fileSizeGetter: null, initialCaption: "", initialPreview: [], initialPreviewDelimiter: "*$$*", initialPreviewAsData: !1, initialPreviewFileType: "image", initialPreviewConfig: [], initialPreviewThumbTags: [], previewThumbTags: {}, initialPreviewShowDelete: !0, initialPreviewDownloadUrl: "", removeFromPreviewOnError: !1, deleteUrl: "", deleteExtraData: {}, overwriteInitial: !0, sanitizeZoomCache: function (e) { var i = t.createElement(e); return i.find("input,textarea,select,datalist,form,.file-thumbnail-footer").remove(), i.html() }, previewZoomButtonIcons: { prev: '<i class="bi-chevron-left"></i>', next: '<i class="bi-chevron-right"></i>', toggleheader: '<i class="bi-arrows-expand"></i>', fullscreen: '<i class="bi-arrows-fullscreen"></i>', borderless: '<i class="bi-arrows-angle-expand"></i>', close: '<i class="bi-x-lg"></i>' }, previewZoomButtonClasses: { prev: "btn btn-default btn-outline-secondary btn-navigate", next: "btn btn-default btn-outline-secondary btn-navigate", toggleheader: r, fullscreen: r, borderless: r, close: r }, previewTemplates: {}, previewContentTemplates: {}, preferIconicPreview: !1, preferIconicZoomPreview: !1, allowedFileTypes: null, allowedFileExtensions: null, allowedPreviewTypes: void 0, allowedPreviewMimeTypes: null, allowedPreviewExtensions: null, disabledPreviewTypes: void 0, disabledPreviewExtensions: ["msi", "exe", "com", "zip", "rar", "app", "vb", "scr"], disabledPreviewMimeTypes: null, defaultPreviewContent: null, customLayoutTags: {}, customPreviewTags: {}, previewFileIcon: '<i class="bi-file-earmark-fill"></i>', previewFileIconClass: "file-other-icon", previewFileIconSettings: {}, previewFileExtSettings: {}, buttonLabelClass: "hidden-xs", browseIcon: '<i class="bi-folder2-open"></i> ', browseClass: "btn btn-primary", removeIcon: '<i class="bi-trash"></i>', removeClass: n, cancelIcon: '<i class="bi-slash-circle"></i>', cancelClass: n, pauseIcon: '<i class="bi-pause-fill"></i>', pauseClass: n, uploadIcon: '<i class="bi-upload"></i>', uploadClass: n, uploadUrl: null, uploadUrlThumb: null, uploadAsync: !0, uploadParamNames: { chunkCount: "chunkCount", chunkIndex: "chunkIndex", chunkSize: "chunkSize", chunkSizeStart: "chunkSizeStart", chunksUploaded: "chunksUploaded", fileBlob: "fileBlob", fileId: "fileId", fileName: "fileName", fileRelativePath: "fileRelativePath", fileSize: "
sizeUnits: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], bitRateUnits: ["B/s", "KB/s", "MB/s", "GB/s", "TB/s", "PB/s", "EB/s", "ZB/s", "YB/s"], fileSingle: "file", filePlural: "files", browseLabel: "Browse &hellip;", removeLabel: "Remove", removeTitle: "Clear all unprocessed files", cancelLabel: "Cancel", cancelTitle: "Abort ongoing upload", pauseLabel: "Pause", pauseTitle: "Pause ongoing upload", uploadLabel: "Upload", uploadTitle: "Upload selected files", msgNo: "No", msgNoFilesSelected: "No files selected", msgCancelled: "Cancelled", msgPaused: "Paused", msgPlaceholder: "Select {files} ...", msgZoomModalHeading: "Detailed Preview", msgFileRequired: "You must select a file to upload.", msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.', msgSizeTooLarge: 'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.', msgFilesTooLess: "You must select at least <b>{n}</b> {files} to upload.", msgFilesTooMany: "Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.", msgTotalFilesTooMany: "You can upload a maximum of <b>{m}</b> files (<b>{n}</b> files detected).", msgFileNotFound: 'File "{name}" not found!', msgFileSecured: 'Security restrictions prevent reading the file "{name}".', msgFileNotReadable: 'File "{name}" is not readable.', msgFilePreviewAborted: 'File preview aborted for "{name}".', msgFilePreviewError: 'An error occurred while reading the file "{name}".', msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', msgFileTypes: { image: "image", html: "HTML", text: "text", video: "video", audio: "audio", flash: "flash", pdf: "PDF", object: "object" }, msgUploadAborted: "The file upload was aborted", msgUploadThreshold: "Processing &hellip;", msgUploadBegin: "Initializing &hellip;", msgUploadEnd: "Done", msgUploadResume: "Resuming upload &hellip;", msgUploadEmpty: "No valid data available for upload.", msgUploadError: "Upload Error", msgDeleteError: "Delete Error", msgProgressError: "Error", msgValidationError: "Validation Error", msgLoading: "Loading file {index} of {files} &hellip;", msgProgress: "Loading file {index} of {files} - {name} - {percent}% completed.", msgSelected: "{n} {files} selected", msgProcessing: "Processing ...", msgFoldersNotAllowed: "Drag & drop files only! {n} folder(s) dropped were skipped.", msgImageWidthSmall: 'Width of image file "{name}" must be at least {size} px.', msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px.', msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px.', msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px.', msgImageResizeError: "Could not get the image dimensions to resize.", msgImageResizeException: "Error while resizing the image.<pre>{errors}</pre>", msgAjaxError: "Something went wrong with the {operation} operation. Please try again later!", msgAjaxProgressError: "{operation} failed", msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', msgResumableUploadRetriesExceeded: "Upload aborted beyond <b>{max}</b> retries for file <b>{file}</b>! Error Details: <pre>{error}</pre>",
msgPendingTime: "{time} remaining", msgCalculatingTime: "calculating time remaining", ajaxOperations: { deleteThumb: "file delete", uploadThumb: "file upload", uploadBatch: "batch file upload", uploadExtra: "form data upload" }, dropZoneTitle: "Drag & drop files here &hellip;", dropZoneClickTitle: "<br>(or click to select {files})", previewZoomButtonTitles: { prev: "View previous file", next: "View next file", toggleheader: "Toggle header", fullscreen: "Toggle full screen", borderless: "Toggle borderless mode", close: "Close detailed preview" }
}, e.fn.fileinput.Constructor = i, e(document).ready(function () { var t = e("input.file[type=file]"); t.length && t.fileinput() })
});