!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.download=t()}(this,function(){return function e(t,n,o){function a(e){var t=e.split(/[:;,]/),n=t[1],o="base64"==t[2]?atob:decodeURIComponent,a=o(t.pop()),r=a.length,i=0,d=new Uint8Array(r);for(i;i<r;++i)d[i]=a.charCodeAt(i);return new h([d],{type:n})}function r(e,t){if("download"in m)return m.href=e,m.setAttribute("download",v),m.className="download-js-link",m.innerHTML="downloading...",b.body.appendChild(m),setTimeout(function(){m.click(),b.body.removeChild(m),t===!0&&setTimeout(function(){s.URL.revokeObjectURL(m.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return e=e.replace(/^data:([\w\/\-\+]+)/,c),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var n=b.createElement("iframe");b.body.appendChild(n),t||(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,c)),n.src=e,setTimeout(function(){b.body.removeChild(n)},333)}var i,d,l,s=window,c="application/octet-stream",f=o||c,u=t,p=!n&&!o&&u,b=document,m=b.createElement("a"),w=function(e){return String(e)},h=s.Blob||s.MozBlob||s.WebKitBlob||w,v=n||"download";if(h=h.call?h.bind(s):Blob,m.style.display="none","true"===String(this)&&(u=[u,f],f=u[0],u=u[1]),p&&p.length<2048&&(v=p.split("/").pop().split("?")[0],m.href=p,m.href.indexOf(p)!==-1)){var l=new XMLHttpRequest;return l.open("GET",p,!0),l.responseType="blob",l.onload=function(t){e(t.target.response,v,c)},l.send(),l}if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(u))return navigator.msSaveBlob?navigator.msSaveBlob(a(u),v):r(u);if(i=u instanceof h?u:new h([u],{type:f}),navigator.msSaveBlob)return navigator.msSaveBlob(i,v);if(s.URL)r(s.URL.createObjectURL(i),!0);else{if("string"==typeof i||i.constructor===w)try{return r("data:"+f+";base64,"+s.btoa(i))}catch(e){return r("data:"+f+","+encodeURIComponent(i))}d=new FileReader,d.onload=function(e){r(this.result)},d.readAsDataURL(i)}return!0}});