/*!
* 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: '\n\n\n\n\n\n', DEFAULT_PREVIEW: '
\n{previewFileIcon}\n
', 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: function (e) { e.stopPropagation(), e.preventDefault() }, getFileName: function (e) { return e ? e.fileName || e.name || "" : "" }, createObjectURL: function (e) { return t.objUrl && t.objUrl.createObjectURL && e ? t.objUrl.createObjectURL(e) : "" }, revokeObjectURL: function (e) { t.objUrl && t.objUrl.revokeObjectURL && e && t.objUrl.revokeObjectURL(e) }, compare: function (e, t, i) { return void 0 !== e && (i ? e === t : e.match(t)) }, isIE: function (e) { var t, i; return "Microsoft Internet Explorer" !== navigator.appName ? !1 : 10 === e ? new RegExp("msie\\s" + e, "i").test(navigator.userAgent) : (t = document.createElement("div"), t.innerHTML = "", i = t.getElementsByTagName("i").length, document.body.appendChild(t), t.parentNode.removeChild(t), i) }, canOrientImage: function (t) { var i = e(document.createElement("img")).css({ width: "1px", height: "1px" }).insertAfter(t), a = i.css("image-orientation"); return i.remove(), !!a }, canAssignFilesToInput: function () { var e = document.createElement("input"); try { return e.type = "file", e.files = null, !0 } catch (t) { return !1 } }, getDragDropFolders: function (e) { var t, i, a = e ? e.length : 0, r = 0; if (a > 0 && e[0].webkitGetAsEntry()) for (t = 0; a > t; t++)i = e[t].webkitGetAsEntry(), i && i.isDirectory && r++; return r }, initModal: function (t) { var i = e("body"); i.length && t.appendTo(i) }, isFunction: function (e) { return "function" == typeof e }, isEmpty: function (i, a) { return void 0 === i || null === i || "" === i ? !0 : t.isString(i) && a ? "" === e.trim(i) : t.isArray(i) ? 0 === i.length : !(!e.isPlainObject(i) || !e.isEmptyObject(i)) }, isArray: function (e) { return Array.isArray(e) || "[object Array]" === Object.prototype.toString.call(e) }, isString: function (e) { return "[object String]" === Object.prototype.toString.call(e) }, ifSet: function (e, t, i) { return i = i || "", t && "object" == typeof t && e in t ? t[e] : i }, cleanArray: function (e) { return e instanceof Array || (e = []), e.filter(function (e) { return void 0 !== e && null !== e }) }, spliceArray: function (t, i, a) { var r, n, o = 0, s = []; if (!(t instanceof Array)) return []; for (n = e.extend(!0, [], t), a && n.reverse(), r = 0; r < n.length; r++)r !== i && (s[o] = n[r], o++); return a && s.reverse(), s }, getNum: function (e, t) { return t = t || 0, "number" == typeof e ? e : ("string" == typeof e && (e = parseFloat(e)), isNaN(e) ? t : e) }, hasFileAPISupport: function () { return !(!window.File || !window.FileReader) }, hasDragDropSupport: function () { var e = document.createElement("div"); return !t.isIE(9) && (void 0 !== e.draggable || void 0 !== e.ondragstart && void 0 !== e.ondrop) }, hasFileUploadSupport: function () { return t.hasFileAPISupport() && window.FormData }, hasBlobSupport: function () { try { return !!window.Blob && Boolean(new Blob) } catch (e) { return !1 } }, hasArrayBufferViewSupport: function () { try { return 100 === new Blob([new Uint8Array(100)]).size } catch (e) { return !1 } }, hasResumableUploadSupport: function () { return t.hasFileUploadSupport() && t.hasBlobSupport() && t.hasArrayBufferViewSupport() && (!!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || !!Blob.prototype.slice || !1) }, dataURI2Blob: function (e) { var i, a, r, n, o, s, l = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, d = t.hasBlobSupport(), c = (d || l) && window.atob && window.ArrayBuffer && window.Uint8Array; if (!c) return null; for (i = e.split(",")[0].indexOf("base64") >= 0 ? atob(e.split(",")[1]) : decodeURIComponent(e.split(",")[1]), a = new ArrayBuffer(i.length), r = new Uint8Array(a), n = 0; n < i.length; n += 1)r[n] = i.charCodeAt(n); return o = e.split(",")[0].split(":")[1].split(";")[0], d ? new Blob([t.hasArrayBufferViewSupport() ? r : a], { type: o }) : (s = new l, s.append(a), s.getBlob(o)) }, arrayBuffer2String: function (e) { if (window.TextDecoder) return new TextDecoder("utf-8").decode(e); var t, i, a, r, n = Array.prototype.slice.apply(new Uint8Array(e)), o = "", s = 0; for (t = n.length; t > s;)switch (i = n[s++], i >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: o += String.fromCharCode(i); break; case 12: case 13: a = n[s++], o += String.fromCharCode((31 & i) << 6 | 63 & a); break; case 14: a = n[s++], r = n[s++], o += String.fromCharCode((15 & i) << 12 | (63 & a) << 6 | (63 & r) << 0) }return o }, isHtml: function (e) { var t = document.createElement("div"); t.innerHTML = e; for (var i = t.childNodes, a = i.length; a--;)if (1 === i[a].nodeType) return !0; return !1 }, isSvg: function (e) { return e.match(/^\s*<\?xml/i) && (e.match(/" + t + "" + i + ">")) }, uniqId: function () { return ((new Date).getTime() + Math.floor(Math.random() * Math.pow(10, 15))).toString(36) }, cspBuffer: { CSP_ATTRIB: "data-csp-01928735", domElementsStyles: {}, stash: function (i) { var a = this, r = e.parseHTML("
" + i + "
"), n = e(r); n.find("[style]").each(function (i, r) { var n = e(r), o = n[0].style, s = t.uniqId(), l = {}; o && o.length && (e(o).each(function () { l[this] = o[this] }), a.domElementsStyles[s] = l, n.removeAttr("style").attr(a.CSP_ATTRIB, s)) }), n.filter("*").removeAttr("style"); var o = Object.values ? Object.values(r) : Object.keys(r).map(function (e) { return r[e] }); return o.flatMap(function (e) { return e.innerHTML }).join("") }, apply: function (t) { var i = this, a = e(t); a.find("[" + i.CSP_ATTRIB + "]").each(function (t, a) { var r = e(a), n = r.attr(i.CSP_ATTRIB), o = i.domElementsStyles[n]; o && r.css(o), r.removeAttr(i.CSP_ATTRIB) }), i.domElementsStyles = {} } }, setHtml: function (e, i) { var a = t.cspBuffer; return e.html(a.stash(i)), a.apply(e), e }, htmlEncode: function (e, t) { return void 0 === e ? t || null : e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'") }, replaceTags: function (t, i) { var a = t; return i ? (e.each(i, function (e, t) { "function" == typeof t && (t = t()), a = a.split(e).join(t) }), a) : a }, cleanMemory: function (e) { var i = e.is("img") ? e.attr("src") : e.find("source").attr("src"); t.revokeObjectURL(i) }, findFileName: function (e) { var t = e.lastIndexOf("/"); return -1 === t && (t = e.lastIndexOf("\\")), e.split(e.substring(t, t + 1)).pop() }, checkFullScreen: function () { return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement }, toggleFullScreen: function (e) { var i = document, a = i.documentElement, r = t.checkFullScreen(); a && e && !r ? a.requestFullscreen ? a.requestFullscreen() : a.msRequestFullscreen ? a.msRequestFullscreen() : a.mozRequestFullScreen ? a.mozRequestFullScreen() : a.webkitRequestFullscreen && a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : r && (i.exitFullscreen ? i.exitFullscreen() : i.msExitFullscreen ? i.msExitFullscreen() : i.mozCancelFullScreen ? i.mozCancelFullScreen() : i.webkitExitFullscreen && i.webkitExitFullscreen()) }, moveArray: function (t, i, a, r) { var n = e.extend(!0, [], t); if (r && n.reverse(), a >= n.length) for (var o = a - n.length; o-- + 1;)n.push(void 0); return n.splice(a, 0, n.splice(i, 1)[0]), r && n.reverse(), n }, closeButton: function (e) { return e = (t.isBs(5) ? "btn-close" : "close") + (e ? " " + e : ""), '" }, getRotation: function (e) { switch (e) { case 2: return "rotateY(180deg)"; case 3: return "rotate(180deg)"; case 4: return "rotate(180deg) rotateY(180deg)"; case 5: return "rotate(270deg) rotateY(180deg)"; case 6: return "rotate(90deg)"; case 7: return "rotate(90deg) rotateY(180deg)"; case 8: return "rotate(270deg)"; default: return "" } }, setTransform: function (e, t) { e && (e.style.transform = t, e.style.webkitTransform = t, e.style["-moz-transform"] = t, e.style["-ms-transform"] = t, e.style["-o-transform"] = t) }, getObjectKeys: function (t) { var i = []; return t && e.each(t, function (e) { i.push(e) }), i }, getObjectSize: function (e) { return t.getObjectKeys(e).length }, whenAll: function (i) { var a, r, n, o, s, l, d = [].slice, c = 1 === arguments.length && t.isArray(i) ? i : d.call(arguments), u = e.Deferred(), p = 0, f = c.length, m = f; for (n = o = s = Array(f), l = function (e, t, i) { return function () { i !== c && p++ , u.notifyWith(t[e] = this, i[e] = d.call(arguments)), --m || u[(p ? "reject" : "resolve") + "With"](t, i) } }, a = 0; f > a; a++)(r = c[a]) && e.isFunction(r.promise) ? r.promise().done(l(a, s, c)).fail(l(a, n, o)) : (u.notifyWith(this, r), --m); return m || u.resolveWith(s, c), u.promise() } }, i = function (i, a) { var r = this; r.$element = e(i), r.$parent = r.$element.parent(), r._validate() && (r.isPreviewable = t.hasFileAPISupport(), r.isIE9 = t.isIE(9), r.isIE10 = t.isIE(10), (r.isPreviewable || r.isIE9) && (r._init(a), r._listen()), r.$element.removeClass("file-loading")) }, i.prototype = {
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.progressClass), l.progressInfoTemplate = o.replace("{class}", l.progressInfoClass), l.progressPauseTemplate = o.replace("{class}", l.progressPauseClass), l.progressCompleteTemplate = o.replace("{class}", l.progressCompleteClass), l.progressErrorTemplate = o.replace("{class}", l.progressErrorClass), l.isDisabled = d.attr("disabled") || d.attr("readonly"), l.isDisabled && d.attr("disabled", !0), l.isClickable = l.browseOnZoneClick && l.showPreview && (l.dropZoneEnabled || !t.isEmpty(l.defaultPreviewContent)), l.isAjaxUpload = t.hasFileUploadSupport() && !t.isEmpty(l.uploadUrl), l.dropZoneEnabled = t.hasDragDropSupport() && l.dropZoneEnabled, l.isAjaxUpload || (l.dropZoneEnabled = l.dropZoneEnabled && t.canAssignFilesToInput()), l.slug = "function" == typeof i.slugCallback ? i.slugCallback : l._slugDefault, l.mainTemplate = l.showCaption ? l._getLayoutTemplate("main1") : l._getLayoutTemplate("main2"), l.captionTemplate = l._getLayoutTemplate("caption"), l.previewGenericTemplate = l._getPreviewTemplate("generic"), !l.imageCanvas && l.resizeImage && (l.maxImageWidth || l.maxImageHeight) && (l.imageCanvas = document.createElement("canvas"), l.imageCanvasContext = l.imageCanvas.getContext("2d")), t.isEmpty(d.attr("id")) && d.attr("id", t.uniqId()), l.namespace = ".fileinput_" + d.attr("id").replace(/-/g, "_"), void 0 === l.$container ? l.$container = l._createContainer() : l._refreshContainer(), n = l.$container, l.$dropZone = n.find(".file-drop-zone"), l.$progress = n.find(".kv-upload-progress"), l.$btnUpload = n.find(".fileinput-upload"), l.$captionContainer = t.getElement(i, "elCaptionContainer", n.find(".file-caption")), l.$caption = t.getElement(i, "elCaptionText", n.find(".file-caption-name")), t.isEmpty(l.msgPlaceholder) || (r = d.attr("multiple") ? l.filePlural : l.fileSingle, l.$caption.attr("placeholder", l.msgPlaceholder.replace("{files}", r))), l.$captionIcon = l.$captionContainer.find(".file-caption-icon"), l.$previewContainer = t.getElement(i, "elPreviewContainer", n.find(".file-preview")), l.$preview = t.getElement(i, "elPreviewImage", n.find(".file-preview-thumbnails")), l.$previewStatus = t.getElement(i, "elPreviewStatus", n.find(".file-preview-status")), l.$errorContainer = t.getElement(i, "elErrorContainer", l.$previewContainer.find(".kv-fileinput-error")), l._validateDisabled(), t.isEmpty(l.msgErrorClass) || t.addCss(l.$errorContainer, l.msgErrorClass), a ? l._errorsExist() || l.$errorContainer.hide() : (l._resetErrors(), l.$errorContainer.hide(), l.previewInitId = "thumb-" + d.attr("id"), l._initPreviewCache(), l._initPreview(!0), l._initPreviewActions(), l.$parent.hasClass("file-loading") && (l.$container.insertBefore(l.$parent), l.$parent.remove())), l._setFileDropZoneTitle(), d.attr("disabled") && l.disable(), l._initZoom(), l.hideThumbnailContent && t.addCss(l.$preview, "hide-content") }, _initFileManager: function () { var i = this; i.uploadStartTime = t.now(), i.fileManager = { stack: {}, filesProcessed: [], errors: [], loadedImages: {}, totalImages: 0, totalFiles: null, totalSize: null, uploadedSize: 0, stats: {}, bpsLog: [], bps: 0, initStats: function (e) { var a = { started: t.now() }; e ? i.fileManager.stats[e] = a : i.fileManager.stats = a }, getUploadStats: function (e, a, r) { var n, o = i.fileManager, s = e ? o.stats[e] && o.stats[e].started || t.now() : i.uploadStartTime, l = (t.now() - s) / 1e3, d = Math.ceil(l ? a / l : 0), c = r - a, u = o.bpsLog.length ? i.bitrateUpdateDelay : 0; return setTimeout(function () { var e, t, i, a = 0, r = 0; for (o.bpsLog.push(d), o.bpsLog.sort(function (e, t) { return e - t }), t = o.bpsLog.length, i = t > 10 ? t - 10 : Math.ceil(t / 2), e = t; e > i; e--)r = parseFloat(o.bpsLog[e]), a++; o.bps = 64 * (a > 0 ? r / a : 0) }, u), n = { fileId: e, started: s, elapsed: l, loaded: a, total: r, bps: o.bps, bitrate: i._getSize(o.bps, i.bitRateUnits), pendingBytes: c }, e ? o.stats[e] = n : o.stats = n, n }, exists: function (t) { return -1 !== e.inArray(t, i.fileManager.getIdList()) }, count: function () { return i.fileManager.getIdList().length }, total: function () { var e = i.fileManager; return e.totalFiles || (e.totalFiles = e.count()), e.totalFiles }, getTotalSize: function () { var t = i.fileManager; return t.totalSize ? t.totalSize : (t.totalSize = 0, e.each(i.getFileStack(), function (e, i) { var a = parseFloat(i.size); t.totalSize += isNaN(a) ? 0 : a }), t.totalSize) }, add: function (e, a) { a || (a = i.fileManager.getId(e)), a && (i.fileManager.stack[a] = { file: e, name: t.getFileName(e), relativePath: t.getFileRelativePath(e), size: e.size, nameFmt: i._getFileName(e, ""), sizeFmt: i._getSize(e.size) }) }, remove: function (e) { var t = i._getThumbFileId(e); i.fileManager.removeFile(t) }, removeFile: function (e) { var t = i.fileManager; e && (delete t.stack[e], delete t.loadedImages[e]) }, move: function (t, a) { var r = {}, n = i.fileManager.stack; (t || a) && t !== a && (e.each(n, function (e, i) { e !== t && (r[e] = i), e === a && (r[t] = n[t]) }), i.fileManager.stack = r) }, list: function () { var t = []; return e.each(i.getFileStack(), function (e, i) { i && i.file && t.push(i.file) }), t }, isPending: function (t) { return -1 === e.inArray(t, i.fileManager.filesProcessed) && i.fileManager.exists(t) }, isProcessed: function () { var t = !0, a = i.fileManager; return e.each(i.getFileStack(), function (e) { a.isPending(e) && (t = !1) }), t }, clear: function () { var e = i.fileManager; i.isDuplicateError = !1, i.isPersistentError = !1, e.totalFiles = null, e.totalSize = null, e.uploadedSize = 0, e.stack = {}, e.errors = [], e.filesProcessed = [], e.stats = {}, e.bpsLog = [], e.bps = 0, e.clearImages() }, clearImages: function () { i.fileManager.loadedImages = {}, i.fileManager.totalImages = 0 }, addImage: function (e, t) { i.fileManager.loadedImages[e] = t }, removeImage: function (e) { delete i.fileManager.loadedImages[e] }, getImageIdList: function () { return t.getObjectKeys(i.fileManager.loadedImages) }, getImageCount: function () { return i.fileManager.getImageIdList().length }, getId: function (e) { return i._getFileId(e) }, getIndex: function (e) { return i.fileManager.getIdList().indexOf(e) }, getThumb: function (t) { var a = null; return i._getThumbs().each(function () { var r = e(this); i._getThumbFileId(r) === t && (a = r) }), a }, getThumbIndex: function (e) { var t = i._getThumbFileId(e); return i.fileManager.getIndex(t) }, getIdList: function () { return t.getObjectKeys(i.fileManager.stack) }, getFile: function (e) { return i.fileManager.stack[e] || null }, getFileName: function (e, t) { var a = i.fileManager.getFile(e); return a ? t ? a.nameFmt || "" : a.name || "" : "" }, getFirstFile: function () { var e = i.fileManager.getIdList(), t = e && e.length ? e[0] : null; return i.fileManager.getFile(t) }, setFile: function (e, t) { i.fileManager.getFile(e) ? i.fileManager.stack[e].file = t : i.fileManager.add(t, e) }, setProcessed: function (e) { i.fileManager.filesProcessed.push(e) }, getProgress: function () { var e = i.fileManager.total(), t = i.fileManager.filesProcessed.length; return e ? Math.ceil(t / e * 100) : 0 }, setProgress: function (e, t) { var a = i.fileManager.getFile(e); !isNaN(t) && a && (a.progress = t) } } }, _setUploadData: function (i, a) { var r = this; e.each(a, function (e, a) { var n = r.uploadParamNames[e] || e; t.isArray(a) ? i.append(n, a[0], a[1]) : i.append(n, a) }) }, _initResumableUpload: function () { var i, a = this, r = a.resumableUploadOptions, n = t.logMessages, o = a.fileManager; if (a.enableResumableUpload) { if (r.fallback !== !1 && "function" != typeof r.fallback && (r.fallback = function (e) { e._log(n.noResumableSupport), e.enableResumableUpload = !1 }), !t.hasResumableUploadSupport() && r.fallback !== !1) return void r.fallback(a); if (!a.uploadUrl && a.enableResumableUpload) return a._log(n.noUploadUrl), void (a.enableResumableUpload = !1); if (r.chunkSize = parseFloat(r.chunkSize), r.chunkSize <= 0 || isNaN(r.chunkSize)) return a._log(n.invalidChunkSize, { chunkSize: r.chunkSize }), void (a.enableResumableUpload = !1); i = a.resumableManager = { init: function (e, t, n) { i.logs = [], i.stack = [], i.error = "", i.id = e, i.file = t.file, i.fileName = t.name, i.fileIndex = n, i.completed = !1, i.lastProgress = 0, a.showPreview && (i.$thumb = o.getThumb(e) || null, i.$progress = i.$btnDelete = null, i.$thumb && i.$thumb.length && (i.$progress = i.$thumb.find(".file-thumb-progress"), i.$btnDelete = i.$thumb.find(".kv-file-remove"))), i.chunkSize = r.chunkSize * a.bytesToKB, i.chunkCount = i.getTotalChunks() }, setAjaxError: function (e, t, o, s) { e.responseJSON && e.responseJSON.error && (o = e.responseJSON.error.toString()), s || (i.error = o), r.showErrorLog && a._log(n.ajaxError, { status: e.status, error: o, text: e.responseText || "" }) }, reset: function () { i.stack = [], i.chunksProcessed = {} }, setProcessed: function (t) { var n, s, l = i.id, d = i.$thumb, c = i.$progress, u = d && d.length, p = { id: u ? d.attr("id") : "", index: o.getIndex(l), fileId: l }, f = a.resumableUploadOptions.skipErrorsAndProceed; i.completed = !0, i.lastProgress = 0, u && d.removeClass("file-uploading"), "success" === t ? (o.uploadedSize += i.file.size, a.showPreview && (a._setProgress(101, c), a._setThumbStatus(d, "Success"), a._initUploadSuccess(i.chunksProcessed[l].data, d)), o.removeFile(l), delete i.chunksProcessed[l], a._raise("fileuploaded", [p.id, p.index, p.fileId]), o.isProcessed() && a._setProgress(101)) : "cancel" !== t && (a.showPreview && (a._setThumbStatus(d, "Error"), a._setPreviewError(d, !0), a._setProgress(101, c, a.msgProgressError), a._setProgress(101, a.$progress, a.msgProgressError), a.cancelling = !f), a.$errorContainer.find('li[data-file-id="' + p.fileId + '"]').length || (s = { file: i.fileName, max: r.maxRetries, error: i.error }, n = a.msgResumableUploadRetriesExceeded.setTokens(s), e.extend(p, s), a._showFileError(n, p, "filemaxretries"), f && (o.removeFile(l), delete i.chunksProcessed[l], o.isProcessed() && a._setProgress(101)))), o.isProcessed() && i.reset() }, check: function () { var t = !0; e.each(i.logs, function (e, i) { return i ? void 0 : (t = !1, !1) }) }, processedResumables: function () { var e, t = i.logs, a = 0; if (!t || !t.length) return 0; for (e = 0; e < t.length; e++)t[e] === !0 && a++; return a }, getUploadedSize: function () { var e = i.processedResumables() * i.chunkSize; return e > i.file.size ? i.file.size : e }, getTotalChunks: function () { var e = parseFloat(i.chunkSize); return !isNaN(e) && e > 0 ? Math.ceil(i.file.size / e) : 0 }, getProgress: function () { var e = i.processedResumables(), t = i.chunkCount; return 0 === t ? 0 : Math.ceil(e / t * 100) }, checkAborted: function (e) { a._isAborted() && (clearInterval(e), a.unlock()) }, upload: function () { var e, r = o.getIdList(), n = "new"; e = setInterval(function () { var s; if (i.checkAborted(e), "new" === n && (a.lock(), n = "processing", s = r.shift(), o.initStats(s), o.stack[s] && (i.init(s, o.stack[s], o.getIndex(s)), i.processUpload())), !o.isPending(s) && i.completed && (n = "new"), o.isProcessed()) { var l = a.$preview.find(".file-preview-initial"); l.length && (t.addCss(l, t.SORT_CSS), a._initSortable()), clearInterval(e), a._clearFileInput(), a.unlock(), setTimeout(function () { var e = a.previewCache.data; e && (a.initialPreview = e.content, a.initialPreviewConfig = e.config, a.initialPreviewThumbTags = e.tags), a._raise("filebatchuploadcomplete", [a.initialPreview, a.initialPreviewConfig, a.initialPreviewThumbTags, a._getExtraData()]) }, a.processDelay) } }, a.processDelay) }, uploadResumable: function () { var e, t, n = a.taskManager, o = i.chunkCount; for (t = n.addPool(i.id), e = 0; o > e; e++)i.logs[e] = !(!i.chunksProcessed[i.id] || !i.chunksProcessed[i.id][e]), i.logs[e] || i.pushAjax(e, 0); t.run(r.maxThreads).done(function () { i.setProcessed("success") }).fail(function () { i.setProcessed(t.cancelled ? "cancel" : "error") }) }, processUpload: function () { var n, s, l, d, c, u, p, f = i.id; return r.testUrl ? (n = new FormData, s = o.stack[f], a._setUploadData(n, { fileId: f, fileName: s.fileName, fileSize: s.size, fileRelativePath: s.relativePath, chunkSize: i.chunkSize, chunkCount: i.chunkCount }), l = function (e) { p = a._getOutData(n, e), a._raise("filetestbeforesend", [f, o, i, p]) }, d = function (r, s, l) { p = a._getOutData(n, l, r); var d = a.uploadParamNames, c = d.chunksUploaded || "chunksUploaded", u = [f, o, i, p]; r[c] && t.isArray(r[c]) ? (i.chunksProcessed[f] || (i.chunksProcessed[f] = {}), e.each(r[c], function (e, t) { i.logs[t] = !0, i.chunksProcessed[f][t] = !0 }), i.chunksProcessed[f].data = r, a._raise("filetestsuccess", u)) : a._raise("filetesterror", u), i.uploadResumable() }, c = function (e, t, r) { p = a._getOutData(n, e), a._raise("filetestajaxerror", [f, o, i, p]), i.setAjaxError(e, t, r, !0), i.uploadResumable() }, u = function () { a._raise("filetestcomplete", [f, o, i, a._getOutData(n)]) }, void a._ajaxSubmit(l, d, u, c, n, f, i.fileIndex, r.testUrl)) : void i.uploadResumable() }, pushAjax: function (e, t) { var r = a.taskManager, o = r.getPool(i.id); o.addTask(o.size() + 1, function (e) { var t, r = i.stack.shift(); t = r[0], i.chunksProcessed[i.id] && i.chunksProcessed[i.id][t] ? a._log(n.chunkQueueError, { index: t }) : i.sendAjax(t, r[1], e) }), i.stack.push([e, t]) }, sendAjax: function (e, s, l) { var d, c = i.chunkSize, u = i.id, p = i.file, f = i.$thumb, m = t.logMessages, g = i.$btnDelete, v = function (e, t) { t && (e = e.setTokens(t)), e = m.resumableRequestError.setTokens({ msg: e }), a._log(e), l.reject(e) }; if (!i.chunksProcessed[u] || !i.chunksProcessed[u][e]) { if (s > r.maxRetries) return v(m.resumableMaxRetriesReached, { n: r.maxRetries }), void i.setProcessed("error"); var h, w, b, _, C, x, y = p.slice ? "slice" : p.mozSlice ? "mozSlice" : p.webkitSlice ? "webkitSlice" : "slice", T = p[y](c * e, c * (e + 1)); h = new FormData, d = o.stack[u], a._setUploadData(h, { chunkCount: i.chunkCount, chunkIndex: e, chunkSize: c, chunkSizeStart: c * e, fileBlob: [T, i.fileName], fileId: u, fileName: i.fileName, fileRelativePath: d.relativePath, fileSize: p.size, retryCount: s }), i.$progress && i.$progress.length && i.$progress.show(), b = function (r) { w = a._getOutData(h, r), a.showPreview && (f.hasClass("file-preview-success") || (a._setThumbStatus(f, "Loading"), t.addCss(f, "file-uploading")), g.attr("disabled", !0)), a._raise("filechunkbeforesend", [u, e, s, o, i, w]) }, _ = function (t, d, c) { if (a._isAborted()) return void v(m.resumableAborting); w = a._getOutData(h, c, t); var p = a.uploadParamNames, f = p.chunkIndex || "chunkIndex", g = [u, e, s, o, i, w]; t.error ? (r.showErrorLog && a._log(n.retryStatus, { retry: s + 1, filename: i.fileName, chunk: e }), a._raise("filechunkerror", g), i.pushAjax(e, s + 1), i.error = t.error, v(t.error)) : (i.logs[t[f]] = !0, i.chunksProcessed[u] || (i.chunksProcessed[u] = {}), i.chunksProcessed[u][t[f]] = !0, i.chunksProcessed[u].data = t, l.resolve.call(null, t), a._raise("filechunksuccess", g), i.check()) }, C = function (t, r, n) { return a._isAborted() ? void v(m.resumableAborting) : (w = a._getOutData(h, t), i.setAjaxError(t, r, n), a._raise("filechunkajaxerror", [u, e, s, o, i, w]), i.pushAjax(e, s + 1), void v(m.resumableRetryError, { n: s - 1 })) }, x = function () { a._isAborted() || a._raise("filechunkcomplete", [u, e, s, o, i, a._getOutData(h)]) }, a._ajaxSubmit(b, _, x, C, h, u, i.fileIndex) } } }, i.reset() } }, _initTemplateDefaults: function () {
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 '\n" }, V = "btn btn-sm btn-kv " + t.defaultButtonCss(); i = '{preview}\n\n
", a = '{preview}\n\n\n{remove}\n{cancel}\n{upload}\n{browse}\n', r = '
\n {close}
\n
\n
\n \n \n
\n
', o = t.closeButton("fileinput-remove"), n = '', s = '\n', l = '', d = '{icon} {label}', c = '
{icon} {label}
', Z = t.MODAL_ID + "Label", u = '',
p = '
\n
\n
\n
\n
{toggleheader}{fullscreen}{borderless}{close}
\n
\n \n \n{prev} {next}\n \n
\n
\n', H = '', f = '
\n
\n {status}\n
\n
{stats}', N = '
{pendingTime}{uploadSpeed}
', m = " ({sizeText})", g = '', v = '
\n \n
\n{drag}\n', h = '\n', w = '', b = '{downloadIcon}', _ = '', C = '{dragIcon}', x = '
{indicator}
', y = '
\n', P = y + ' title="{caption}">
\n', k = "
{footer}\n{zoomCache}
\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 = '\n", A = '", D = '", z = '\n", $ = '\n", j = '