| 1 |
- import{C as d}from"./index.js";function c(e){const n=e.split(","),o=n[0].match(/:(.*?);/)[1],a=window.atob(n[1]);let t=a.length;const r=new Uint8Array(t);for(;t--;)r[t]=a.charCodeAt(t);return n.length==1?new Blob([r],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}):new Blob([r],{type:o})}function u(e){return new Promise((n,s)=>{e||s();const o=new FileReader;o.readAsDataURL(e),o.onload=function(a){const t=a.target.result;n(t)}})}function w(e,n,s,o){const a=c(e);l(a,n,s,o)}function l(e,n,s,o){const a=typeof o!="undefined"?[o,e]:[e],t=new Blob(a,{type:s||"application/octet-stream"}),r=window.URL.createObjectURL(t),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",n),typeof i.download=="undefined"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function m({url:e,target:n="_blank",fileName:s}){const o=window.navigator.userAgent.toLowerCase().indexOf("chrome")>-1,a=window.navigator.userAgent.toLowerCase().indexOf("safari")>-1;if(/(iP)/g.test(window.navigator.userAgent))return console.error("Your browser does not support download!"),!1;if(o||a){const t=document.createElement("a");if(t.href=e,t.target=n,t.download!==void 0&&(t.download=s||e.substring(e.lastIndexOf("/")+1,e.length)),document.createEvent){const r=document.createEvent("MouseEvents");return r.initEvent("click",!0,!0),t.dispatchEvent(r),!0}}return e.indexOf("?")===-1&&(e+="?download"),d(e,{target:n}),!0}export{c as a,w as b,l as c,m as d,u as f};
|