/*! * bootstrap-fileinput v4.3.2 * http://plugins.krajee.com/file-input * * Author: Kartik Visweswaran * Copyright: 2014 - 2016, 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={};var t,i,a,n,r,o,l,s,d,c,p,u,f,m,g,v,h,w,_,b,C,x,y,T,F,E,k,$,S,I,P,D,z,A,U,j,L,Z,O,B,R,M,N,H,q,W,V,K,G,X,Y,J,Q,ee,te,ie,ae,ne,re,oe,le,se,de,ce,pe,ue,fe,me,ge;t=".fileinput",i="kvFileinputModal",a='style="width:{width};height:{height};"',n='\n\n\n\n\n\n',r='
\n{previewFileIcon}\n
',o=window.URL||window.webkitURL,l=function(e,t,i){return void 0!==e&&(i?e===t:e.match(t))},s=function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,i=document.createElement("div");return i.innerHTML="",t=i.getElementsByTagName("i").length,document.body.appendChild(i),i.parentNode.removeChild(i),t},d=function(){return new RegExp("Edge/[0-9]+","i").test(navigator.userAgent)},c=function(e,i,a,n){var r=n?i:i.split(" ").join(t+" ")+t;e.off(r).on(r,a)},p={data:{},init:function(e){var t=e.initialPreview,i=e.id;t.length>0&&!re(t)&&(t=t.split(e.initialPreviewDelimiter)),p.data[i]={content:t,config:e.initialPreviewConfig,tags:e.initialPreviewThumbTags,delimiter:e.initialPreviewDelimiter,previewFileType:e.initialPreviewFileType,previewAsData:e.initialPreviewAsData,template:e.previewGenericTemplate,showZoom:e.fileActionSettings.showZoom,showDrag:e.fileActionSettings.showDrag,getSize:function(t){return e._getSize(t)},parseTemplate:function(t,i,a,n,r,o,l){var s=" file-preview-initial";return e._generatePreviewTemplate(t,i,a,n,r,!1,null,s,o,l)},msg:function(t){return e._getMsgSelected(t)},initId:e.previewInitId,footer:e._getLayoutTemplate("footer").replace(/\{progress}/g,e._renderThumbProgress()),isDelete:e.initialPreviewShowDelete,caption:e.initialCaption,actions:function(t,i,a,n,r,o,l){return e._renderFileActions(t,i,a,n,r,o,l,!0)}}},fetch:function(e){return p.data[e].content.filter(function(e){return null!==e})},count:function(e,t){return p.data[e]&&p.data[e].content?t?p.data[e].content.length:p.fetch(e).length:0},get:function(t,i,a){var n,r,o,l,s,d,c="init_"+i,u=p.data[t],f=u.config[i],m=u.content[i],g=u.initId+"-"+c,v=" file-preview-initial",h=oe("previewAsData",f,u.previewAsData);return a=void 0===a?!0:a,m?(f&&f.frameClass&&(v+=" "+f.frameClass),h?(o=u.previewAsData?oe("type",f,u.previewFileType||"generic"):"generic",l=oe("caption",f),s=p.footer(t,i,a,f&&f.size||null),d=oe("filetype",f,o),n=u.parseTemplate(o,m,l,d,g,s,c,null)):n=u.template.replace(/\{previewId}/g,g).replace(/\{frameClass}/g,v).replace(/\{fileindex}/g,c).replace(/\{content}/g,u.content[i]).replace(/\{template}/g,oe("type",f,u.previewFileType)).replace(/\{footer}/g,p.footer(t,i,a,f&&f.size||null)),u.tags.length&&u.tags[i]&&(n=de(n,u.tags[i])),ne(f)||ne(f.frameAttr)||(r=e(document.createElement("div")).html(n),r.find(".file-preview-initial").attr(f.frameAttr),n=r.html(),r.remove()),n):""},add:function(t,i,a,n,r){var o,l=e.extend(!0,{},p.data[t]);return re(i)||(i=i.split(l.delimiter)),r?(o=l.content.push(i)-1,l.config[o]=a,l.tags[o]=n):(o=i.length-1,l.content=i,l.config=a,l.tags=n),p.data[t]=l,o},set:function(t,i,a,n,r){var o,l,s=e.extend(!0,{},p.data[t]);if(i&&i.length&&(re(i)||(i=i.split(s.delimiter)),l=i.filter(function(e){return null!==e}),l.length)){if(void 0===s.content&&(s.content=[]),void 0===s.config&&(s.config=[]),void 0===s.tags&&(s.tags=[]),r){for(o=0;or;r++)i+=p.get(e,r);return t=a.msg(p.count(e)),{content:'
'+i+"
",caption:t}},footer:function(e,t,i,a){var n=p.data[e];if(i=void 0===i?!0:i,0===n.config.length||ne(n.config[t]))return"";var r=n.config[t],o=oe("caption",r),l=oe("width",r,"auto"),s=oe("url",r,!1),d=oe("key",r,null),c=oe("showDelete",r,!0),u=oe("showZoom",r,n.showZoom),f=oe("showDrag",r,n.showDrag),m=s===!1&&i,g=n.isDelete?n.actions(!1,c,u,f,m,s,d):"",v=n.footer.replace(/\{actions}/g,g);return v.replace(/\{caption}/g,o).replace(/\{size}/g,n.getSize(a)).replace(/\{width}/g,l).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},u=function(e,t){return t=t||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?t:e)},f=function(){return!(!window.File||!window.FileReader)},m=function(){var e=document.createElement("div");return!s(9)&&!d()&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},g=function(){return f()&&window.FormData},v=function(e,t){e.removeClass(t).addClass(t)},X={showRemove:!0,showUpload:!0,showZoom:!0,showDrag:!0,removeIcon:'',removeClass:"btn btn-xs btn-default",removeTitle:"Remove file",uploadIcon:'',uploadClass:"btn btn-xs btn-default",uploadTitle:"Upload file",zoomIcon:'',zoomClass:"btn btn-xs btn-default",zoomTitle:"View Details",dragIcon:'',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."},h='{preview}\n
\n
\n {caption}\n
\n {remove}\n {cancel}\n {upload}\n {browse}\n
\n
',w='{preview}\n
\n{remove}\n{cancel}\n{upload}\n{browse}\n',_='
\n {close}
\n
\n
\n
\n
\n
\n
',C='
×
\n',b='',x='
\n
\n
\n',y='',T='{icon} {label}',F='
{icon} {label}
',E='',k='\n',$='
\n
\n {percent}%\n
\n
',S="
({sizeText})",I='',P='
\n \n {drag}\n
{indicator}
\n
\n
',D='\n',z='',A='',U='{dragIcon}',j='
\n',Z=j+' title="{caption}" '+a+'>
\n',O="
{footer}\n
\n",B="{content}\n",R='
{data}
\n",M='{caption}\n",N='\n",H='\n",q='\n",W='\n'+n+" "+r+"\n\n",V='\n\n'+n+" "+r+"\n\n",K='\n',G='
\n'+r+"\n
\n",Y={main1:h,main2:w,preview:_,close:C,fileIcon:b,caption:x,modalMain:E,modal:k,progress:$,size:S,footer:I,actions:P,actionDelete:D,actionUpload:z,actionZoom:A,actionDrag:U,btnDefault:y,btnLink:T,btnBrowse:F},J={generic:L+B+O,html:L+R+O,image:L+M+O,text:L+N+O,video:Z+H+O,audio:Z+q+O,flash:Z+W+O,object:Z+V+O,pdf:Z+K+O,other:Z+G+O},ee=["image","html","text","video","audio","flash","object"],ie={image:{width:"auto",height:"160px"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"213px",height:"80px"},flash:{width:"213px",height:"160px"},object:{width:"160px",height:"160px"},pdf:{width:"160px",height:"160px"},other:{width:"160px",height:"160px"}},Q={image:{width:"auto",height:"100%"},html:{width:"100%",height:"100%","min-height":"480px"},text:{width:"100%",height:"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"480px"},pdf:{width:"100%",height:"100%","min-height":"480px"},other:{width:"auto",height:"100%","min-height":"480px"}},ae={image:function(e,t){return l(e,"image.*")||l(t,/\.(gif|png|jpe?g)$/i)},html:function(e,t){return l(e,"text/html")||l(t,/\.(htm|html)$/i)},text:function(e,t){return l(e,"text.*")||l(e,/\.(xml|javascript)$/i)||l(t,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,t){return l(e,"video.*")&&(l(e,/(ogg|mp4|mp?g|webm|3gp)$/i)||l(t,/\.(og?|mp4|webm|mp?g|3gp)$/i))},audio:function(e,t){return l(e,"audio.*")&&(l(e,/(ogg|mp3|mp?g|wav)$/i)||l(t,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,t){return l(e,"application/x-shockwave-flash",!0)||l(t,/\.(swf)$/i)},pdf:function(e,t){return l(e,"application/pdf",!0)||l(t,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},ne=function(t,i){return void 0===t||null===t||0===t.length||i&&""===e.trim(t)},re=function(e){return Array.isArray(e)||"[object Array]"===Object.prototype.toString.call(e)},oe=function(e,t,i){return i=i||"","object"==typeof t&&e in t?t[e]:i},te=function(t,i,a){return ne(t)||ne(t[i])?a:e(t[i])},le=function(){return Math.round((new Date).getTime()+100*Math.random())},se=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},de=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},ce=function(e){var t=e.is("img")?e.attr("src"):e.find("source").attr("src");o.revokeObjectURL(t)},pe=function(e){var t=e.lastIndexOf("/");return-1===t&&(t=e.lastIndexOf("\\")),e.split(e.substring(t,t+1)).pop()},ue=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},fe=function(e){e&&!ue()?document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.msRequestFullscreen?document.documentElement.msRequestFullscreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},me=function(e,t,i){if(i>=e.length)for(var a=i-e.length;a--+1;)e.push(void 0);return e.splice(i,0,e.splice(t,1)[0]),e},ge=function(t,i){var a=this;a.$element=e(t),a._validate()&&(a.isPreviewable=f(),a.isIE9=s(9),a.isIE10=s(10),a.isPreviewable||a.isIE9?(a._init(i),a._listen()):a.$element.removeClass("file-loading"))},ge.prototype={constructor:ge,_init:function(t){var i,a=this,n=a.$element;e.each(t,function(e,t){switch(e){case"minFileCount":case"maxFileCount":case"maxFileSize":a[e]=u(t);break;default:a[e]=t}}),ne(a.allowedPreviewTypes)&&(a.allowedPreviewTypes=ee),a.fileInputCleared=!1,a.fileBatchCompleted=!0,a.isPreviewable||(a.showPreview=!1),a.uploadFileAttr=ne(n.attr("name"))?"file_data":n.attr("name"),a.reader=null,a.formdata={},a.clearStack(),a.uploadCount=0,a.uploadStatus={},a.uploadLog=[],a.uploadAsyncCount=0,a.loadedImages=[],a.totalImagesCount=0,a.ajaxRequests=[],a.isError=!1,a.ajaxAborted=!1,a.cancelling=!1,i=a._getLayoutTemplate("progress"),a.progressTemplate=i.replace("{class}",a.progressClass),a.progressCompleteTemplate=i.replace("{class}",a.progressCompleteClass),a.progressErrorTemplate=i.replace("{class}",a.progressErrorClass),a.dropZoneEnabled=m()&&a.dropZoneEnabled,a.isDisabled=a.$element.attr("disabled")||a.$element.attr("readonly"),a.isUploadable=g()&&!ne(a.uploadUrl),a.slug="function"==typeof t.slugCallback?t.slugCallback:a._slugDefault,a.mainTemplate=a.showCaption?a._getLayoutTemplate("main1"):a._getLayoutTemplate("main2"),a.captionTemplate=a._getLayoutTemplate("caption"),a.previewGenericTemplate=a._getPreviewTemplate("generic"),a.resizeImage&&(a.maxImageWidth||a.maxImageHeight)&&(a.imageCanvas=document.createElement("canvas"),a.imageCanvasContext=a.imageCanvas.getContext("2d")),ne(a.$element.attr("id"))&&a.$element.attr("id",le()),void 0===a.$container?a.$container=a._createContainer():a._refreshContainer(),a.$dropZone=a.$container.find(".file-drop-zone"),a.$progress=a.$container.find(".kv-upload-progress"),a.$btnUpload=a.$container.find(".fileinput-upload"),a.$captionContainer=te(t,"elCaptionContainer",a.$container.find(".file-caption")),a.$caption=te(t,"elCaptionText",a.$container.find(".file-caption-name")),a.$previewContainer=te(t,"elPreviewContainer",a.$container.find(".file-preview")),a.$preview=te(t,"elPreviewImage",a.$container.find(".file-preview-thumbnails")),a.$previewStatus=te(t,"elPreviewStatus",a.$container.find(".file-preview-status")),a.$errorContainer=te(t,"elErrorContainer",a.$previewContainer.find(".kv-fileinput-error")),ne(a.msgErrorClass)||v(a.$errorContainer,a.msgErrorClass),a.$errorContainer.hide(),a.fileActionSettings=e.extend(!0,X,t.fileActionSettings),a.previewInitId="preview-"+le(),a.id=a.$element.attr("id"),p.init(a),a._initPreview(!0),a._initPreviewActions(),a.options=t,a._setFileDropZoneTitle(),a.$element.removeClass("file-loading"),a.$element.attr("disabled")&&a.disable(),a._initZoom()},_validate:function(){var e,t=this;return"file"===t.$element.attr("type")?!0:(e='

Invalid Input Type

You must set an input type = file for bootstrap-fileinput plugin to initialize.
',t.$element.after(e),!1)},_errorsExist:function(){var t,i=this;return i.$errorContainer.find("li").length?!0:(t=e(document.createElement("div")).html(i.$errorContainer.html()),t.find("span.kv-error-close").remove(),t.find("ul").remove(),!!e.trim(t.text()).length)},_errorHandler:function(e,t){var i=this,a=e.target.error;a.code===a.NOT_FOUND_ERR?i._showError(i.msgFileNotFound.replace("{name}",t)):a.code===a.SECURITY_ERR?i._showError(i.msgFileSecured.replace("{name}",t)):a.code===a.NOT_READABLE_ERR?i._showError(i.msgFileNotReadable.replace("{name}",t)):a.code===a.ABORT_ERR?i._showError(i.msgFilePreviewAborted.replace("{name}",t)):i._showError(i.msgFilePreviewError.replace("{name}",t))},_addError:function(e){var t=this,i=t.$errorContainer;e&&i.length&&(i.html(t.errorCloseButton+e),c(i.find(".kv-error-close"),"click",function(){i.fadeOut("slow")}))},_resetErrors:function(e){var t=this,i=t.$errorContainer;t.isError=!1,t.$container.removeClass("has-error"),i.html(""),e?i.fadeOut("slow"):i.hide()},_showFolderError:function(e){var t,i=this,a=i.$errorContainer;e&&(t=i.msgFoldersNotAllowed.replace(/\{n}/g,e),i._addError(t),v(i.$container,"has-error"),a.fadeIn(800),i._raise("filefoldererror",[e,t]))},_showUploadError:function(e,t,i){var a=this,n=a.$errorContainer,r=i||"fileuploaderror",o=t&&t.id?'
  • '+e+"
  • ":"
  • "+e+"
  • ";return 0===n.find("ul").length?a._addError(""):n.find("ul").append(o),n.fadeIn(800),a._raise(r,[t,e]),a.$container.removeClass("file-input-new"),v(a.$container,"has-error"),!0},_showError:function(e,t,i){var a=this,n=a.$errorContainer,r=i||"fileerror";return t=t||{},t.reader=a.reader,a._addError(e),n.fadeIn(800),a._raise(r,[t,e]),a.isUploadable||a._clearFileInput(),a.$container.removeClass("file-input-new"),v(a.$container,"has-error"),a.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this,i=t.minFileCount>1?t.filePlural:t.fileSingle,a=t.msgFilesTooLess.replace("{n}",t.minFileCount).replace("{files}",i),n=t.$errorContainer;t._addError(a),t.isError=!0,t._updateFileDetails(0),n.fadeIn(800),t._raise("fileerror",[e,a]),t._clearFileInput(),v(t.$container,"has-error")},_parseError:function(t,i,a){var n=this,r=e.trim(i+""),o="."===r.slice(-1)?"":".",l=void 0!==t.responseJSON&&void 0!==t.responseJSON.error?t.responseJSON.error:t.responseText;return n.cancelling&&n.msgUploadAborted&&(r=n.msgUploadAborted),n.showAjaxErrorDetails&&l?(l=e.trim(l.replace(/\n\s*\n/g,"\n")),l=l.length>0?"
    "+l+"
    ":"",r+=o+l):r+=o,n.cancelling=!1,a?""+a+": "+r:r},_parseFileType:function(e){var t,i,a,n,r=this;for(n=0;n-1&&(a=i.split(".").pop(),n.previewFileIconSettings&&n.previewFileIconSettings[a]&&(r=n.previewFileIconSettings[a]),n.previewFileExtSettings&&e.each(n.previewFileExtSettings,function(e,t){n.previewFileIconSettings[e]&&t(a)&&(r=n.previewFileIconSettings[e])})),t.indexOf("{previewFileIcon}")>-1?t.replace(/\{previewFileIconClass}/g,n.previewFileIconClass).replace(/\{previewFileIcon}/g,r):t},_raise:function(t,i){var a=this,n=e.Event(t);if(void 0!==i?a.$element.trigger(n,i):a.$element.trigger(n),n.isDefaultPrevented())return!1;if(!n.result)return n.result;switch(t){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:a.ajaxAborted=n.result}return!0},_listenFullScreen:function(e){var t,i,a=this,n=a.$modal;n&&n.length&&(t=n&&n.find(".btn-fullscreen"),i=n&&n.find(".btn-borderless"),t.length&&i.length&&(t.removeClass("active").attr("aria-pressed","false"),i.removeClass("active").attr("aria-pressed","false"),e?t.addClass("active").attr("aria-pressed","true"):i.addClass("active").attr("aria-pressed","true"),n.hasClass("file-zoom-fullscreen")?a._maximizeZoomDialog():e?a._maximizeZoomDialog():i.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var t=this,i=t.$element,a=i.closest("form"),n=t.$container;c(i,"change",e.proxy(t._change,t)),c(t.$btnFile,"click",e.proxy(t._browse,t)),c(a,"reset",e.proxy(t.reset,t)),c(n.find(".fileinput-remove:not([disabled])"),"click",e.proxy(t.clear,t)),c(n.find(".fileinput-cancel"),"click",e.proxy(t.cancel,t)),t._initDragDrop(),t.isUploadable||c(a,"submit",e.proxy(t._submitForm,t)),c(t.$container.find(".fileinput-upload"),"click",e.proxy(t._uploadClick,t)),c(e(window),"resize",function(){t._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),c(e(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){t._listenFullScreen(ue())})},_initDragDrop:function(){var t=this,i=t.$dropZone;t.isUploadable&&t.dropZoneEnabled&&t.showPreview&&(c(i,"dragenter dragover",e.proxy(t._zoneDragEnter,t)),c(i,"dragleave",e.proxy(t._zoneDragLeave,t)),c(i,"drop",e.proxy(t._zoneDrop,t)),c(e(document),"dragenter dragover drop",t._zoneDragDropInit))},_zoneDragDropInit:function(e){e.stopPropagation(),e.preventDefault()},_zoneDragEnter:function(t){var i=this,a=e.inArray("Files",t.originalEvent.dataTransfer.types)>-1;return i._zoneDragDropInit(t),i.isDisabled||!a?(t.originalEvent.dataTransfer.effectAllowed="none",void(t.originalEvent.dataTransfer.dropEffect="none")):void v(i.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){var t=this;t._zoneDragDropInit(e),t.isDisabled||t.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var t=this;e.preventDefault(),t.isDisabled||ne(e.originalEvent.dataTransfer.files)||(t._change(e,"dragdrop"),t.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(e){var t,i=this,a=i.$container.find(".fileinput-upload"),n=!a.hasClass("disabled")&&ne(a.attr("disabled"));if(!e||!e.isDefaultPrevented()){if(!i.isUploadable)return void(n&&"submit"!==a.attr("type")&&(t=a.closest("form"),t.length&&t.trigger("submit"),e.preventDefault()));e.preventDefault(),n&&i.upload()}},_submitForm:function(){var e=this,t=e.$element,i=t.get(0).files;return i&&e.minFileCount>0&&e._getFileCount(i.length)