text: (function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"===typeof define&&define.amd?define(t):(e=e||self,e.bsCustomFileInput=t())})(this,(function(){"use strict";var e={CUSTOMFILE:'.custom-file input[type="file"]',CUSTOMFILELABEL:".custom-file-label",FORM:"form",INPUT:"input"},t=3,n=function(t){var n="",r=t.parentNode.querySelector(e.CUSTOMFILELABEL);return r&&(n=r.innerHTML),n},r=function(e){if(e.childNodes.length>0)for(var n=[].slice.call(e.childNodes),r=0;r<n.length;r++){var i=n[r];if(i.nodeType!==t)return i}return e},i=function(t){var n=t.bsCustomFileInput.defaultText,i=t.parentNode.querySelector(e.CUSTOMFILELABEL);if(i){var l=r(i);l.innerHTML=n}},l=!!window.File,o="fakepath",u="\\",c=function(e){if(e.hasAttribute("multiple")&&l)return[].slice.call(e.files).map((function(e){return e.name})).join(", ");if(-1!==e.value.indexOf(o)){var t=e.value.split(u);return t[t.length-1]}return e.value};function f(){var t=this.parentNode.querySelector(e.CUSTOMFILELABEL);if(t){var n=r(t),l=c(this);l.length?n.innerHTML=l:i(this)}}function a(){for(var t=[].slice.call(this.querySelectorAll(e.INPUT)).filter((function(e){return!!e.bsCustomFileInput})),n=0,r=t.length;n<r;n++)i(t[n])}var s="bsCustomFileInput",d={FORMRESET:"reset",INPUTCHANGE:"change"},v={init:function(t,r){void 0===t&&(t=e.CUSTOMFILE),void 0===r&&(r=e.FORM);for(var i=[].slice.call(document.querySelectorAll(t)),l=[].slice.call(document.querySelectorAll(r)),o=0,u=i.length;o<u;o++){var c=i[o];Object.defineProperty(c,s,{value:{defaultText:n(c)},writable:!0}),f.call(c),c.addEventListener(d.INPUTCHANGE,f)}for(var v=0,p=l.length;v<p;v++)l[v].addEventListener(d.FORMRESET,a),Object.defineProperty(l[v],s,{value:!0,writable:!0})},destroy:function(){for(var t=[].slice.call(document.querySelectorAll(e.FORM)).filter((function(e){return!!e.bsCustomFileInput})),n=[].slice.call(document.querySelectorAll(e.INPUT)).filter((function(e){return!!e.bsCustomFileInput})),r=0,l=n.length;r<l;r++){var o=n[r];i(o),o[s]=void 0,o.removeEventListener(d.INPUTCHANGE,f)}for(var u=0,c=t.length;u<c;u++)t[u].removeEventListener(d.FORMRESET,a),t[u][s]=void 0}};return v})),document.addEventListener("DOMContentLoaded",(function(){bsCustomFileInput.init()}));