download-801edd56.js 2.3 KB

1
  1. var w=(i,a,n)=>new Promise((d,e)=>{var o=t=>{try{c(n.next(t))}catch(r){e(r)}},s=t=>{try{c(n.throw(t))}catch(r){e(r)}},c=t=>t.done?d(t.value):Promise.resolve(t.value).then(o,s);c((n=n.apply(i,a)).next())});import{cx as y,E as g,__tla as h}from"./index-b5895273.js";import{u as L,d as v}from"./base64Conver-39fc0d26.js";let l,u,m,p,f,b,E=Promise.all([(()=>{try{return h}catch(i){}})()]).then(()=>w(void 0,null,function*(){m=function(a,n,d,e){L(a).then(o=>{u(o,n,d,e)})},u=function(a,n,d,e){const o=v(a);l(o,n,d,e)},l=function(a,n,d,e){const o=typeof e<"u"?[e,a]:[a],s=new Blob(o,{type:d||"application/octet-stream"}),c=window.URL.createObjectURL(s),t=document.createElement("a");t.style.display="none",t.href=c,t.setAttribute("download",n),typeof t.download>"u"&&t.setAttribute("target","_blank"),document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(c)},p=function({url:a,target:n="_blank",fileName:d}){const e=new window.XMLHttpRequest;return e.open("GET",a,!0),e.responseType="blob",e.onload=()=>{let o=window.URL.createObjectURL(e.response);const s=window.navigator.userAgent.toLowerCase().indexOf("chrome")>-1,c=window.navigator.userAgent.toLowerCase().indexOf("safari")>-1;if(/(iP)/g.test(window.navigator.userAgent))return!1;if(s||c){const t=document.createElement("a");if(t.href=o,t.target=n,t.download!==void 0&&(t.download=d||o.substring(o.lastIndexOf("/")+1,o.length)),document.createEvent){const r=document.createEvent("MouseEvents");return r.initEvent("click",!0,!0),t.dispatchEvent(r),!0}}o.indexOf("?")===-1&&(o+="?download"),y(o,{target:n})},e.send(),!0};let i;b=(a,n)=>{const d=window.URL.createObjectURL(a),e=document.createElement("a");e.download=n!=null?n:`\u4E0B\u8F7D\u6587\u4EF6_${new Date().getTime()}`,e.style.display="none",e.href=d,document.body.appendChild(e),e.click(),document.body.removeChild(e)},{createMessage:i}=g(),f=(a,n)=>{const d=`${a}`,e=new XMLHttpRequest;e.open("GET",d,!0),e.responseType="blob",e.onload=function(){const o=window.URL.createObjectURL(e.response),s=document.createElement("a");s.href=o,s.target="_self",s.download=`${n}`,s.style.display="none",document.body.appendChild(s),i.success(`${n} \u4E0B\u8F7D\u6210\u529F`),setTimeout(()=>{s.click(),document.body.removeChild(s)},66)},e.send()}}));export{E as __tla,l as a,u as b,m as c,p as d,f as e,b as f};