naive-upload
Version:
<p align="left"> <a href="https://www.npmjs.org/package/naive-upload"> <img src="https://img.shields.io/npm/v/naive-upload.svg"> </a> <a href="https://bundlephobia.com/package/naive-upload@latest"> <img src="https://img.shields.io/bundl
3 lines • 82.4 kB
JavaScript
(function(C,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("vue-demi"),require("spark-md5")):typeof define=="function"&&define.amd?define(["exports","vue","vue-demi","spark-md5"],i):(C=typeof globalThis<"u"?globalThis:C||self,i(C.NaiveUpload={},C.Vue,C.vueDemi,C.SparkMD5))})(this,function(C,i,E,ie){"use strict";var tt=Object.defineProperty;var st=(C,i,E)=>i in C?tt(C,i,{enumerable:!0,configurable:!0,writable:!0,value:E}):C[i]=E;var d=(C,i,E)=>(st(C,typeof i!="symbol"?i+"":i,E),E);const oe=(F=>F&&typeof F=="object"&&"default"in F?F:{default:F})(ie);var x=(F=>(F.\u5168\u81EA\u52A8="AT",F.\u624B\u52A8\u6321="MT",F.\u534A\u81EA\u52A8="AMT",F))(x||{}),H=(F=>(F.\u5361\u7247="Card",F.\u6E05\u5355="Detailedly",F))(H||{});class _{constructor(e,t,n,u){d(this,"r");d(this,"g");d(this,"b");d(this,"a");d(this,"toString",()=>`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`);this.r=e,this.g=t,this.b=n,this.a=u}static convertFrom(e){return new _(e.r,e.g,e.b,e.a)}}const Y=class{constructor(){d(this,"build",e=>(e(this),this));d(this,"setup",e=>(e(this),this));d(this,"configCode","default");d(this,"concurrentFile",3);d(this,"concurrentChunkFile",3);d(this,"tip","\u5355\u51FB\u6216\u62D6\u52A8\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u5373\u53EF\u4E0A\u4F20");d(this,"layout",H.\u5361\u7247);d(this,"runMode",x.\u5168\u81EA\u52A8);d(this,"enableChunk",!0);d(this,"chunkSize",2097152);d(this,"retry",3);d(this,"enableWorker",!0);d(this,"readonly",!1);d(this,"debug",!1);d(this,"alertErrorInfo",!1);d(this,"enableDrag",!0);d(this,"statusCheckingColor",new _(255,235,59,.5));d(this,"statusUploadingColor",new _(144,206,255,.5));d(this,"statusPausedColor",new _(158,158,158,.5));d(this,"statusPausedSubColor",new _(244,154,3,.5));d(this,"statusDoneColor",new _(76,175,80,.1));d(this,"statusDoneSubColor",new _(3,169,244,.5));d(this,"statusErrorColor",new _(255,0,30,.35));d(this,"statusErrorSubColor",new _(232,31,31,.5));d(this,"dragReadyColor",new _(255,152,0,.8));d(this,"dragMovingColor",new _(255,152,0,.5));d(this,"dragOverColor",new _(255,87,34,.8));d(this,"dragPreparationTime",800);d(this,"dragChangePositionTime",1e3);d(this,"isMobile",/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent))}};let R=Y;d(R,"default",()=>new Y),d(R,"defaultWithConfigCode",e=>new Y().setup(t=>t.configCode=e));const ae=["title"],ue=["multiple","accept"],le={class:"upload-box-content"},K=i.defineComponent({__name:"FileInput.vue3",setup(F){const e=E.inject("upload")();E.reactive({});let t;const n=c=>{c&&(t=c)},u=c=>{e.limited()||t==null||t.click()},o=c=>{if(t&&t.files)for(let p=0;p<t.files.length;p++)e.append(t.files[p]);t&&(t.value="")};return(async()=>e.getSettings().debug&&console.debug("Piece: File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(),(c,p)=>(i.openBlock(),i.createElementBlock("div",{class:"upload-btn",onClick:u,title:i.unref(e).getSettings().tip},[i.createElementVNode("div",{onClick:p[0]||(p[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("input",{type:"file",multiple:i.unref(e).getConfig().upperLimit>1,ref:n,accept:i.unref(e).getAllowedTypes(),onChange:o},null,40,ue)]),i.createElementVNode("div",le,[i.renderSlot(c.$slots,"default")])],8,ae))}});var k=(F=>(F.\u7535\u5B50\u6587\u6863="\u7535\u5B50\u6587\u6863",F.\u7535\u5B50\u8868\u683C="\u7535\u5B50\u8868\u683C",F.\u6587\u672C\u6587\u4EF6="\u6587\u672C\u6587\u4EF6",F.\u56FE\u7247="\u56FE\u7247",F.\u97F3\u9891="\u97F3\u9891",F.\u89C6\u9891="\u89C6\u9891",F.\u538B\u7F29\u5305="\u538B\u7F29\u5305",F.\u672A\u77E5="\u672A\u77E5",F.\u5916\u94FE\u8D44\u6E90="\u5916\u94FE\u8D44\u6E90",F))(k||{});const ce=["title"],de={key:0,class:"item-body"},he={class:"item-image"},ge=["src","alt"],pe={key:0,class:"item-tools"},fe={key:1,class:"item-sub sub-paused"},Fe={key:2,class:"item-sub sub-done"},be={key:3,class:"item-sub sub-error"},G=i.defineComponent({__name:"SelectedFileInfo.vue3",props:{key:null,selectedFile:null,readyDrag:{type:Boolean},startDrag:{type:Boolean},dragging:{type:Boolean},dragover:{type:Boolean}},emits:["setContainerRef","mouseDown","mouseUp","mouseEnter","mouseLeave"],setup(F,{emit:e}){const t=F,{proxy:n}=E.getCurrentInstance(),u=E.inject("upload")();let o=E.reactive({hover:!1,container:{style:()=>`item-container ${t.selectedFile.done&&!u.getSettings().readonly?" item-done":""} ${t.selectedFile.error?" item-error":""} ${o.hover&&!o.rename.active&&!t.selectedFile.checking&&!t.selectedFile.uploading&&!t.readyDrag&&!t.startDrag?" item-hover":""} ${t.selectedFile.checking?" item-checking":""} ${t.selectedFile.uploading?" item-uploading":""} ${t.selectedFile.canceled?" item-canceled":""} ${t.selectedFile.paused?" item-paused":""} ${t.readyDrag?" item-ready-drag":""} ${t.dragging?" item-dragging":""} ${t.dragover?" item-drag-over":""}`,styleVar:()=>({"--statusCheckingColor":u.getSettings().statusCheckingColor.toString(),"--statusUploadingColor":u.getSettings().statusUploadingColor.toString(),"--statusPausedColor":u.getSettings().statusPausedColor.toString(),"--statusPausedSubColor":u.getSettings().statusPausedSubColor.toString(),"--statusDoneColor":u.getSettings().statusDoneColor.toString(),"--statusDoneSubColor":u.getSettings().statusDoneSubColor.toString(),"--statusErrorColor":u.getSettings().statusErrorColor.toString(),"--statusErrorSubColor":u.getSettings().statusErrorSubColor.toString(),"--dragPreparationTime":`${(u.getSettings().dragPreparationTime/1e3).toFixed(2)}s`,"--dragChangePositionTime":`${(u.getSettings().dragChangePositionTime/1e3).toFixed(2)}s`,"--dragReadyColor":u.getSettings().dragReadyColor.toString(),"--dragMovingColor":u.getSettings().dragMovingColor.toString(),"--dragOverColor":u.getSettings().dragOverColor.toString()}),info:()=>`${t.selectedFile.done?"\u4E0A\u4F20\u6210\u529F":""} ${t.selectedFile.error?t.selectedFile.errorMessage:""} ${t.selectedFile.paused?"\u5DF2\u6682\u505C":""}`},loading:{show:()=>!o.rename.active&&(t.selectedFile.checking||t.selectedFile.uploading),info:()=>`${t.selectedFile.checking?"\u626B\u63CF\u4E2D..."+t.selectedFile.percent+"%":""} ${t.selectedFile.uploading?"\u4E0A\u4F20\u4E2D..."+t.selectedFile.percent+"%":""}`},tools:{show:()=>o.hover&&t.dragging===!1&&!o.rename.active&&!t.selectedFile.checking&&!t.selectedFile.uploading},rename:{enable:()=>!t.selectedFile.uploading,active:!1,value:""},view:{enable:()=>{switch(t.selectedFile.fileType){case k.\u56FE\u7247:case k.\u97F3\u9891:return t.selectedFile.extensionLower!==".flac";case k.\u89C6\u9891:return!0;case k.\u6587\u672C\u6587\u4EF6:return!0;case k.\u7535\u5B50\u6587\u6863:return t.selectedFile.extensionLower===".pdf"||t.selectedFile.extensionLower===".doc"||t.selectedFile.extensionLower===".docx";default:return!1}}},save:{enable:()=>!0}}),c;const p=l=>{l&&e("setContainerRef",l)},f=l=>{l&&(c=l)},S=l=>{t.readyDrag||t.startDrag?(e("mouseEnter",l),o.hover=!1):o.hover=!0},m=l=>{(t.readyDrag||t.startDrag)&&e("mouseLeave",l),o.hover=!1},y=l=>{e("mouseDown",l)},w=l=>{e("mouseUp",l)},b=()=>{o.rename.active=!0,n.$nextTick(()=>{c&&c.focus()})},D=l=>{l.key=="Enter"&&g()},g=()=>{u.rename(t.selectedFile.token,o.rename.value).then(()=>{o.rename.active=!1}).catch(()=>{o.rename.active=!1})},h=()=>{const l=u.getRawFile(t.selectedFile),a="margin:0px;text-align: center;display: flex;flex-direction: row;justify-content: center;align-items: center";switch(t.selectedFile.fileType){case k.\u56FE\u7247:let A=window.open();A==null||A.document.write(`<head><title>${t.selectedFile.fullname()}</title></head><body style="${a};background-color: black;"><img style="max-width: 100%;max-height: 100%;" src="${l.objectURL}" alt="${t.selectedFile.fullname()}"></body>`);break;case k.\u97F3\u9891:if(t.selectedFile.extensionLower===".flac")return;let L=window.open();L==null||L.document.write(`<head><title>${t.selectedFile.fullname()}</title></head><body style="${a};background-color: black;"><audio style="max-width: 100%;max-height: 100%;" src="${l.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</audio></body>`);break;case k.\u89C6\u9891:let U=window.open();U==null||U.document.write(`<head><title>${t.selectedFile.fullname()}</title></head><body style="${a};background-color: black;"><video style="max-width: 100%;max-height: 100%;" src="${l.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</video></body>`);break;default:let N=window.open();N==null||N.document.write(`<head><title>${t.selectedFile.fullname()}</title></head><body style="${a};"><object style="max-width: 100%;max-height: 100%;" data="${l.objectURL}" type="${t.selectedFile.extensionLower===".txt"?"text/plain":t.selectedFile.extensionLower===".pdf"?"application/pdf":"application/octet-stream"}" width="100%" height="100%"><iframe src="${l.objectURL}" width="100%" height="100%" ></iframe></object></body>`);break}},s=()=>{const l=u.getRawFile(t.selectedFile),a=document.createElement("a");a.style.display="none",a.href=u.getDownloadUrl(t.selectedFile),l.file&&(a.download=t.selectedFile.fullname()),document.body.appendChild(a),a.click(),document.body.removeChild(a)},r=()=>{u.remove(t.selectedFile.token)};return(async()=>u.getSettings().debug&&console.debug("Piece: Selected File Info Component(vue3) \u5DF2\u52A0\u8F7D"))(),(l,a)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(o).container.style()),style:i.normalizeStyle(i.unref(o).container.styleVar()),title:i.unref(o).container.info(),onMouseenter:S,onMouseleave:m,onMousedown:y,onMouseup:w,onTouchstart:y,onTouchend:w,onTouchcancel:w,ref:p},[t.selectedFile.canceled?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",de,[i.createElementVNode("div",he,[i.createElementVNode("img",{src:t.selectedFile.thumbnail,loading:"lazy",alt:t.selectedFile.fullname()},null,8,ge)]),i.unref(o).tools.show()?(i.openBlock(),i.createElementBlock("span",pe,[i.unref(o).rename.enable()&&!i.unref(u).getSettings().readonly?(i.openBlock(),i.createElementBlock("span",{key:0,class:"upload-icon icon-rename",title:"\u91CD\u547D\u540D",onClick:a[0]||(a[0]=A=>b())})):i.createCommentVNode("",!0),i.unref(o).view.enable()?(i.openBlock(),i.createElementBlock("span",{key:1,class:"upload-icon icon-view",title:"\u67E5\u770B",onClick:a[1]||(a[1]=A=>h())})):i.createCommentVNode("",!0),i.unref(o).save.enable()?(i.openBlock(),i.createElementBlock("span",{key:2,class:"upload-icon icon-download",title:"\u4FDD\u5B58",onClick:a[2]||(a[2]=A=>s())})):i.createCommentVNode("",!0),i.unref(u).getSettings().readonly?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",{key:3,class:"upload-icon icon-remove",title:"\u5220\u9664",onClick:a[3]||(a[3]=A=>r())}))])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"default",{selectedFile:t.selectedFile,rename:i.unref(o).rename,funs:{setRenameInputRef:f,renameKeydown:D,renameDone:g},loading:i.unref(o).loading}),t.selectedFile.paused?(i.openBlock(),i.createElementBlock("div",fe," \u6682\u505C ")):i.createCommentVNode("",!0),t.selectedFile.done&&!i.unref(u).getSettings().readonly?(i.openBlock(),i.createElementBlock("div",Fe," \u5B8C\u6210 ")):i.createCommentVNode("",!0),t.selectedFile.error?(i.openBlock(),i.createElementBlock("div",be,"\u9519\u8BEF")):i.createCommentVNode("",!0)]))],46,ce))}}),me={class:"upload-container independent"},ye={class:"upload-list"},we=i.defineComponent({__name:"index.vue3",setup(F){const e=E.inject("upload")();return(async()=>e.getSettings().debug&&console.debug("Layout: Card Index Component(vue3) \u5DF2\u52A0\u8F7D"))(),(t,n)=>(i.openBlock(),i.createElementBlock("div",me,[i.renderSlot(t.$slots,"uploadContainer",{},void 0,!0),i.createElementVNode("div",ye,[i.renderSlot(t.$slots,"listContainer",{},void 0,!0)])]))}}),rt="",J=(F,e)=>{const t=F.__vccOpts||F;for(const[n,u]of e)t[n]=u;return t},Ee=J(we,[["__scopeId","data-v-dfb9d6ed"]]),Ce={class:"upload-container independent"},ke={class:"upload-list"},Se=i.defineComponent({__name:"index.vue3",setup(F){const e=E.inject("upload")();return(async()=>e.getSettings().debug&&console.debug("Layout: Detailedly Index Component(vue3) \u5DF2\u52A0\u8F7D"))(),(t,n)=>(i.openBlock(),i.createElementBlock("div",Ce,[i.renderSlot(t.$slots,"uploadContainer",{},void 0,!0),i.createElementVNode("div",ke,[i.renderSlot(t.$slots,"listContainer",{},void 0,!0)])]))}}),it="",Be=J(Se,[["__scopeId","data-v-ae4f85bd"]]),De={key:0},Z=i.defineComponent({__name:"index.vue3",setup(F){const e=E.inject("upload")();let t=E.reactive({loading:!0,currentThemeIndex:null});return(async()=>{const n=u=>{switch(t.loading=!0,u){case H.\u5361\u7247:t.currentThemeIndex=E.shallowRef(Ee);break;case H.\u6E05\u5355:t.currentThemeIndex=E.shallowRef(Be);break}t.loading=!1,e.getSettings().debug&&console.debug("Layout: Index Component(vue3) \u5DF2\u53D8\u66F4")};e.registerLayoutChanged(n),n(e.getSettings().layout),e.getSettings().debug&&console.debug("Layout: Index Component(vue3) \u5DF2\u52A0\u8F7D")})(),(n,u)=>i.unref(t).loading?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",De,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(t).currentThemeIndex),null,{uploadContainer:i.withCtx(()=>[i.renderSlot(n.$slots,"uploadContainer")]),listContainer:i.withCtx(()=>[i.renderSlot(n.$slots,"listContainer")]),_:3}))]))}}),Ae={class:"item-info"},_e=["title","innerHTML"],Le=["title"],$e=i.defineComponent({__name:"info.vue3",props:{slotProps:null},setup(F){const e=F,t=E.inject("upload")();let n=E.reactive({selectedFileSortMap:t.getSelectedFileSortMap(),lodingStyle:()=>`${e.slotProps.selectedFile.checking?t.getGradientStyle("conic","rgba(255, 236, 201, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""} ${e.slotProps.selectedFile.uploading?t.getGradientStyle("conic","rgba(144, 206, 255, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""} ${e.slotProps.selectedFile.paused?t.getGradientStyle("conic","rgba(158, 158, 158, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""}`});return(async()=>t.getSettings().debug&&console.debug("Layout: Card Info Component(vue3) \u5DF2\u52A0\u8F7D"))(),(u,o)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",Ae,[e.slotProps.rename.active?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",{key:0,class:"single-text-omitted item-name",title:e.slotProps.selectedFile.fileType+`\r
`+e.slotProps.selectedFile.size+`\r
`+e.slotProps.selectedFile.fullname(),innerHTML:e.slotProps.selectedFile.fullname()},null,8,_e)),e.slotProps.rename.active?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:1,class:"item-rename-input",type:"text","onUpdate:modelValue":o[0]||(o[0]=c=>e.slotProps.rename.value=c),ref:e.slotProps.funs.setRenameInputRef,onKeydown:o[1]||(o[1]=c=>e.slotProps.funs.renameKeydown(c)),onBlur:o[2]||(o[2]=c=>e.slotProps.funs.renameDone())},null,544)),[[i.vModelText,e.slotProps.rename.value]]):i.createCommentVNode("",!0)]),e.slotProps.loading.show()?(i.openBlock(),i.createElementBlock("div",{key:0,class:"item-loading",style:i.normalizeStyle(i.unref(n).lodingStyle()),title:e.slotProps.loading.info()},null,12,Le)):i.createCommentVNode("",!0)],64))}}),Ue={class:"item-info"},Te={class:"single-text-omitted item-name"},Pe=["title","innerHTML"],Me={class:"single-text-omitted item-size"},He=["title","innerHTML"],Ie={class:"single-text-omitted item-filetype"},xe=["title","innerHTML"],Re=["title"],Oe=i.defineComponent({__name:"info.vue3",props:{slotProps:null},setup(F){const e=F,t=E.inject("upload")();let n=E.reactive({selectedFileSortMap:t.getSelectedFileSortMap(),lodingStyle:()=>`${e.slotProps.selectedFile.checking?t.getGradientStyle("linear","rgba(255, 236, 201, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""} ${e.slotProps.selectedFile.uploading?t.getGradientStyle("linear","rgba(144, 206, 255, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""} ${e.slotProps.selectedFile.paused?t.getGradientStyle("linear","rgba(158, 158, 158, 0.5)",e.slotProps.selectedFile.percent,e.slotProps.selectedFile.virtualPercent):""}`});return(async()=>t.getSettings().debug&&console.debug("Layout: Detailedly Info Component(vue3) \u5DF2\u52A0\u8F7D"))(),(u,o)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",Ue,[i.createElementVNode("span",Te,[i.createTextVNode(" \u540D\u79F0\uFF1A"),e.slotProps.rename.active?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",{key:0,title:e.slotProps.selectedFile.fullname(),innerHTML:e.slotProps.selectedFile.fullname()},null,8,Pe)),e.slotProps.rename.value?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:1,class:"item-rename-input",type:"text","onUpdate:modelValue":o[0]||(o[0]=c=>e.slotProps.selectedFile.newName=c),ref:e.slotProps.funs.setRenameInputRef,onKeydown:o[1]||(o[1]=c=>e.slotProps.funs.renameKeydown(c)),onBlur:o[2]||(o[2]=c=>e.slotProps.funs.renameDone())},null,544)),[[i.vModelText,e.slotProps.selectedFile.newName]]):i.createCommentVNode("",!0)]),i.createElementVNode("span",Me,[i.createTextVNode(" \u5927\u5C0F\uFF1A"),i.createElementVNode("span",{title:e.slotProps.selectedFile.size,innerHTML:e.slotProps.selectedFile.size},null,8,He)]),i.createElementVNode("span",Ie,[i.createTextVNode(" \u7C7B\u578B\uFF1A"),i.createElementVNode("span",{title:e.slotProps.selectedFile.fileType,innerHTML:e.slotProps.selectedFile.fileType},null,8,xe)])]),e.slotProps.loading.show()?(i.openBlock(),i.createElementBlock("div",{key:0,class:"item-loading",style:i.normalizeStyle(i.unref(n).lodingStyle()),title:e.slotProps.loading.info()},null,12,Re)):i.createCommentVNode("",!0)],64))}}),ze={key:0},v=i.defineComponent({__name:"info.vue3",props:{slotProps:null},setup(F){const e=F,t=E.inject("upload")();let n=E.reactive({loading:!0,currentThemeInfo:null});return(async()=>((o=>{switch(n.loading=!0,t.getSettings().layout){case H.\u5361\u7247:n.currentThemeInfo=E.shallowRef($e);break;case H.\u6E05\u5355:n.currentThemeInfo=E.shallowRef(Oe);break}n.loading=!1,t.getSettings().debug&&console.debug("Layout: Info Component(vue3) \u5DF2\u53D8\u66F4")})(),t.getSettings().debug&&console.debug("Layout: Info Component(vue3) \u5DF2\u52A0\u8F7D")))(),(u,o)=>i.unref(n).loading?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",ze,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(n).currentThemeInfo),{slotProps:e.slotProps},null,8,["slotProps"]))]))}}),Ne=i.createElementVNode("p",{class:"upload-icon icon-select-file"},null,-1),je=i.defineComponent({__name:"SingleUpload.vue3",setup(F){const e=E.inject("upload")();return(async()=>e.getSettings().debug&&console.debug("Piece: Single Upload Component(vue3) \u5DF2\u52A0\u8F7D"))(),(t,n)=>(i.openBlock(),i.createBlock(Z,null,i.createSlots({listContainer:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(e).getSelectedFileSortMap().size,u=>(i.openBlock(),i.createBlock(G,{key:u,selectedFile:i.unref(e).getSelectedFile(u)},{default:i.withCtx(o=>[i.createVNode(v,{class:"item-info-container",slotProps:o},null,8,["slotProps"])]),_:2},1032,["selectedFile"]))),128))]),_:2},[i.unref(e).getSettings().readonly?void 0:{name:"uploadContainer",fn:i.withCtx(()=>[i.unref(e).anyFile()?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(K,{key:0,class:"upload-box-container single",title:i.unref(e).getConfig().explain},{default:i.withCtx(()=>[Ne]),_:1},8,["title"]))]),key:"0"}]),1024))}}),We=["title"],Ve=i.defineComponent({__name:"DropFileInput.vue3",setup(F){const e=E.inject("upload")(),t=u=>{u.preventDefault()},n=u=>{if(u.preventDefault(),u.dataTransfer)for(let o=0;o<u.dataTransfer.files.length;o++)e.append(u.dataTransfer.files[o])};return(async()=>e.getSettings().debug&&console.debug("Piece: Drop File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(),(u,o)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(e).getSelectCLass()),onDrop:n,onDragover:t,title:i.unref(e).getSelectFileAlarmInfo()},[i.createVNode(K,null,{default:i.withCtx(()=>[i.renderSlot(u.$slots,"default")]),_:3})],42,We))}});class O{constructor(){d(this,"containerEl");d(this,"el");d(this,"key",-1);d(this,"els");d(this,"isMobile",!1);d(this,"flag",!1);d(this,"x",0);d(this,"y",0);d(this,"currentX",0);d(this,"currentY",0);d(this,"offsetX",0);d(this,"offsetY",0);d(this,"scrollX",0);d(this,"scrollY",0);d(this,"transX",0);d(this,"transY",0);d(this,"lastTransX",0);d(this,"lastTransY",0);d(this,"zIndex","");d(this,"position","");d(this,"transform","");d(this,"transLate",1);d(this,"restoreError",[20,10]);d(this,"mouseMove");d(this,"scroll")}moving(e,t){this.currentX=e,this.currentY=t,this.checkRestore()?(this.transX=0,this.transY=0,this.el.style.transform=this.transform):(this.transX=this.currentX-this.x+this.scrollX+this.offsetX,this.transY=this.currentY-this.y+this.scrollY+this.offsetY,(Math.abs(this.transX-this.lastTransX)>=this.transLate||Math.abs(this.transY-this.lastTransY)>=this.transLate)&&(this.el.style.transform=`translate(${this.transX}px, ${this.transY}px)`)),this.lastTransX=this.transX,this.lastTransY=this.transY}checkRestore(){return O.equalError(this.x,this.currentX,this.restoreError[0])&&O.equalError(this.y,this.currentY,this.restoreError[1])}static equalError(e,t,n){return t+n>=e&&t-n<=e}static getInstance(e,t,n,u){let o=new O;return o.els=t,o.el=t.get(n),o.key=n,o.containerEl=e,o.isMobile=u,o}start(e,t,n){this.flag=!0,this.currentX=e,this.currentY=t,this.save(),this.el.style.zIndex="999";let u=!1;this.mouseMove=o=>{if(!this.flag||u)return;const c=this.isMobile?o.targetTouches[0].clientX:o.clientX,p=this.isMobile?o.targetTouches[0].clientY:o.clientY;if(o.preventDefault(),u=!0,this.moving(c,p),n&&this.els){let f=!1;this.els.forEach((S,m)=>{if(m==this.key)return;const y=this.el.offsetTop+this.transY,w=this.el.offsetLeft+this.transX;y>S.offsetTop&&y<S.offsetTop+S.offsetHeight&&w>S.offsetLeft&&w<S.offsetLeft+S.offsetWidth&&(n(m,c,p),f=!0)}),f||n(-1,c,p)}u=!1},this.isMobile?this.containerEl.addEventListener("touchmove",this.mouseMove):this.containerEl.addEventListener("mousemove",this.mouseMove),this.scroll=o=>{this.scrollX=this.containerEl.scrollLeft,this.scrollY=this.containerEl.scrollTop},this.containerEl.addEventListener("scroll",this.scroll)}offset(e,t){this.offsetX=e,this.offsetY=t}save(){this.x=this.currentX,this.y=this.currentY,this.zIndex=this.el.style.zIndex,this.position=this.el.style.position,this.transform=this.el.style.transform}restore(){this.flag=!1,this.x=this.currentX,this.y=this.currentY,this.el.style.zIndex=this.zIndex,this.el.style.position=this.position,this.el.style.transform=this.transform}end(e){e&&this.restore(),this.isMobile?this.containerEl.removeEventListener("touchmove",this.mouseMove):this.containerEl.removeEventListener("mousemove",this.mouseMove),this.containerEl.removeEventListener("scroll",this.scroll)}}const Qe=i.createElementVNode("p",{class:"upload-icon icon-inbox"},null,-1),Xe=["innerHTML"],Ye=["innerHTML"],qe={class:"upload-error-list pretty-scrollbar"},Ke=i.defineComponent({__name:"MultipleUpload.vue3",setup(F){const{proxy:e}=E.getCurrentInstance(),t=E.inject("upload")();let n=E.reactive({scrollLock:!1,readyDraggingSortKey:null,currentDraggingSortKey:null,lastDraggingSortKey:null,errors:[]}),u,o=new Map,c={startTick:null,changeTick:null,draggingHelper:null,ready2start:(b,D,g)=>{if(!t.getSettings().enableDrag){t.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue3) \u672A\u542F\u7528\u62D6\u52A8\u6392\u5E8F\u529F\u80FD");return}t.getSelectedFileList(!1).length<=1||(t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u5EF6\u65F6\u5F00\u542F\u62D6\u52A8\u529F\u80FD, sortKey: ${b}`),c.startTick&&clearTimeout(c.startTick),c.startTick=setTimeout(()=>{n.readyDraggingSortKey=b,c.startTick=setTimeout(()=>{!u||(n.readyDraggingSortKey=null,n.currentDraggingSortKey=b,c.draggingHelper=O.getInstance(u,o,n.currentDraggingSortKey,t.getSettings().isMobile),c.draggingHelper.start(D,g,(h,s,r)=>{t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u9F20\u6807\u79FB\u52A8\u4E8B\u4EF6, sortKey: ${b}, clientX: ${s}, clientY: ${r}, targetKey: ${h}`),h==-1?w():y(h)}))},t.getSettings().dragPreparationTime)},500))},ready2change:b=>{n.lastDraggingSortKey=b,n.currentDraggingSortKey!==n.lastDraggingSortKey&&(t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u5EF6\u65F6\u91CD\u65B0\u6392\u5E8F, targetKey: ${b}`),c.changeTick&&clearTimeout(c.changeTick),c.changeTick=setTimeout(()=>{t.changeSort(n.currentDraggingSortKey,n.lastDraggingSortKey),c.end()},t.getSettings().dragChangePositionTime))},cancelChange:()=>{t.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue3) \u53D6\u6D88\u91CD\u65B0\u6392\u5E8F"),c.changeTick&&clearTimeout(c.changeTick),n.lastDraggingSortKey=null},end:()=>{c.startTick&&clearTimeout(c.startTick),c.changeTick&&clearTimeout(c.changeTick),n.readyDraggingSortKey=null,c.draggingHelper&&(t.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue3) \u7ED3\u675F\u62D6\u52A8\u5E76\u590D\u539F\u5BB9\u5668\u4F4D\u7F6E"),c.draggingHelper.end(!0),c.draggingHelper=null,o.forEach((b,D)=>{D!==n.currentDraggingSortKey&&(b.style.zIndex="")}),n.lastDraggingSortKey=null,n.currentDraggingSortKey=null)}};const p=b=>{b&&(u=b)},f=(b,D)=>{!u||o.set(b,D)},S=(b,D,g)=>{t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u6309\u4E0B\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: ${b}`);const h=g?D.targetTouches[0].clientX:D.clientX,s=g?D.targetTouches[0].clientY:D.clientY;c.ready2start(b,h,s)},m=(b,D,g)=>{t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u677E\u5F00\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: ${b}`),c.end()},y=b=>{t.getSettings().debug&&console.debug(`Piece: Multiple Upload Component(vue3) \u8FDB\u5165\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6, targetKey: ${b}`),c.ready2change(b)},w=()=>{t.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue3) \u79BB\u5F00\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6"),c.cancelChange()};return(async()=>{const b=g=>{n.scrollLock||g.length==0||e.$nextTick(()=>{let h=null,s=!1;for(let r=0;r<g.length;r++){let l=g[r];if(!s&&l.checking&&(s=!0,h=o.get(r)),l.uploading){h=o.get(r);break}}!h||u&&(u.scrollTop=h.offsetTop-u.offsetTop-20)})};t.registerSelectedFileListChanged(b);const D=g=>{n.errors.push(g.message),setTimeout(()=>{n.errors.shift()},5e3)};t.getSettings().alertErrorInfo&&t.registerAlertError(D),t.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue3) \u5DF2\u52A0\u8F7D")})(),(b,D)=>(i.openBlock(),i.createBlock(Z,null,i.createSlots({listContainer:i.withCtx(()=>[i.createElementVNode("div",{class:"scroll-container pretty-scrollbar",ref:p,onMouseenter:D[0]||(D[0]=g=>i.unref(n).scrollLock=!0),onMouseleave:D[1]||(D[1]=g=>i.unref(n).scrollLock=!1)},[i.createVNode(i.TransitionGroup,{name:"fade"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(t).getSelectedFileSortMap().size,g=>{var h;return i.openBlock(),i.createBlock(G,{key:(h=i.unref(t).getSelectedFileSortMap().get(g))!=null?h:-1,selectedFile:i.unref(t).getSelectedFile(g),readyDrag:i.unref(n).readyDraggingSortKey===g,startDrag:i.unref(n).currentDraggingSortKey!==null,dragging:i.unref(n).currentDraggingSortKey===g,dragover:i.unref(n).lastDraggingSortKey===g&&i.unref(n).currentDraggingSortKey!==g,onSetContainerRef:s=>f(g,s),onMouseDown:s=>S(g,s,!1),onMouseUp:s=>m(g),onTouchstart:s=>S(g,s,!0),onTouchend:s=>m(g),onTouchcancel:s=>m(g)},{default:i.withCtx(s=>[i.createVNode(v,{class:"item-info-container",slotProps:s},null,8,["slotProps"])]),_:2},1032,["selectedFile","readyDrag","startDrag","dragging","dragover","onSetContainerRef","onMouseDown","onMouseUp","onTouchstart","onTouchend","onTouchcancel"])}),128))]),_:1})],32)]),_:2},[i.unref(t).getSettings().readonly?void 0:{name:"uploadContainer",fn:i.withCtx(()=>[i.createVNode(Ve,{class:"upload-box-container"},{default:i.withCtx(()=>[Qe,i.createElementVNode("p",{class:"upload-text",innerHTML:i.unref(t).getConfig().explain},null,8,Xe),i.createElementVNode("p",{class:"upload-hint",innerHTML:i.unref(t).getSettings().tip},null,8,Ye),i.createElementVNode("div",qe,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(n).errors,(g,h)=>(i.openBlock(),i.createElementBlock("p",{class:"error-info",key:h},i.toDisplayString(g),1))),128))])]),_:1})]),key:"0"}]),1024))}});class B extends Error{constructor(t,n){super(t);d(this,"innerError");this.innerError=n}static consoleWriteWithIndex(t,n){console.error(`\u7B2C${n}\u5C42\u9519\u8BEF`,t),t instanceof B&&t.innerError&&B.consoleWriteWithIndex(t.innerError,++n)}static consoleWrite(t){B.consoleWriteWithIndex(t,1)}}class V{constructor(e){d(this,"file");d(this,"size",0);d(this,"checkPosition",0);d(this,"uploadPosition",0);d(this,"objectURL");d(this,"md5",null);d(this,"extension");d(this,"name");d(this,"needSection",!1);d(this,"specs");d(this,"key");d(this,"chunks",[]);d(this,"chunkIndexQueue",[]);d(this,"userFileInfo");d(this,"configCode");d(this,"token");d(this,"echo",!1);e!=null&&(this.file=e,this.size=e.size,this.objectURL=URL.createObjectURL(e))}}class j{static getByExtension(e){switch(e){case".webp":case".jpg":case".png":case".ioc":case".bmp":case".gif":case".tif":case".tga":case".jpeg":return k.\u56FE\u7247;case".mp2":case".ac3":case".mp3":case".m4a":case".m4r":case".mmf":case".ogg":case".amr":case".aac":case".vqf":case".wma":case".ape":case".wav":case".flac":case".cda":case".dts":return k.\u97F3\u9891;case".swf":case".3gp":case".3g2":case".mp4":case".mpeg":case".mpg":case".dat":case".mov":case".vob":case".qt":case".rm":case".asf":case".avi":case".navi":case".divx":case".flv":case".f4v":case".qsv":case".wmv":case".mkv":case".rmvb":case".webm":return k.\u89C6\u9891;case".xls":case".xlsx":case".csv":return k.\u7535\u5B50\u8868\u683C;case".pdf":case".doc":case".docx":return k.\u7535\u5B50\u6587\u6863;case".txt":case".js":case".css":case".cs":case".html":case".vue":case".ts":case".xml":case".json":return k.\u6587\u672C\u6587\u4EF6;case".zip":case".rar":case".7z":return k.\u538B\u7F29\u5305;default:return k.\u672A\u77E5}}static getByMIME(e){const t=e.toLocaleLowerCase();if(t.indexOf("image/",0)!=-1)return k.\u56FE\u7247;if(t.indexOf("audio/",0)!=-1)return k.\u97F3\u9891;if(t.indexOf("video/",0)!=-1)return k.\u89C6\u9891;if(t.indexOf("text/",0)!=-1)return k.\u6587\u672C\u6587\u4EF6;switch(e){case"application/ogg":return k.\u97F3\u9891;case"application/mp4":return k.\u89C6\u9891;case"application/vnd.ms-excel":case"vnd.openxmlformats-officedocument.spreadsheetml.sheet":return k.\u7535\u5B50\u8868\u683C;case"application/pdf":case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return k.\u7535\u5B50\u6587\u6863;case"application/json":case"application/javascript":return k.\u6587\u672C\u6587\u4EF6;case"application/x-tar":case"application/zip":case"application/x-compressed":case"application/x-zip-compressed":return k.\u538B\u7F29\u5305;default:return k.\u672A\u77E5}}}class ee{constructor(e){d(this,"rawIndex");d(this,"name");d(this,"newName");d(this,"extension");d(this,"fullname",()=>{var e,t;return`${(e=this.name)!=null?e:""}${(t=this.extension)!=null?t:""}`});d(this,"extensionLower");d(this,"size","");d(this,"fileType",k.\u672A\u77E5);d(this,"thumbnail","/filetypes/empty.png");d(this,"class",[]);d(this,"checking",!1);d(this,"checked",!1);d(this,"uploading",!1);d(this,"uploaded",!1);d(this,"done",!1);d(this,"reTry",0);d(this,"error",!1);d(this,"errorMessage");d(this,"percent",0);d(this,"virtualPercent",0);d(this,"percentBeforPaused",0);d(this,"virtualPercentBeforPaused",0);d(this,"paused",!1);d(this,"canceled",!1);d(this,"token");d(this,"echo",!1);var n;const t=e.name.lastIndexOf(".");this.name=e.name.substring(0,t),this.extension=e.name.substring(t),this.extensionLower=(n=this.extension)==null?void 0:n.toLowerCase(),this.fileType=e.type?j.getByMIME(e.type):j.getByExtension(this.extension)}}class ${static s4(){return((1+Math.random())*65536|0).toString(16).substring(1)}static new(){return`${$.s4()}${$.s4()}-${$.s4()}-${$.s4()}-${$.s4()}-${$.s4()}${$.s4()}${$.s4()}`}}const I=class{static getSize(e,t=1024,n=2){if(e<=0)return"0 KB";for(let u=0;u<I.formats.length;u++){let o=e/Math.pow(t,u+1);if(o<t)return`${o.toFixed(n)} ${I.formats[u]}`}return`${(e/Math.pow(t,I.formats.length)).toFixed(n)} ${I.formats[I.formats.length-1]}`}};let P=I;d(P,"formats",["KB","MB","GB","TB","PB","EB","ZB","YB"]);class te{constructor(e,t){d(this,"index");d(this,"blob");d(this,"size");d(this,"checkPosition",0);d(this,"md5",null);d(this,"forced",!1);d(this,"checking",!1);d(this,"checked",!1);d(this,"uploading",!1);d(this,"uploaded",!1);d(this,"done",!1);d(this,"error",!1);d(this,"errorMessage");this.index=e,this.blob=t,this.size=t.size}}const Ge=()=>{let F=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function e(g,h){let s=g[0],r=g[1],l=g[2],a=g[3];s+=(r&l|~r&a)+h[0]-680876936|0,s=(s<<7|s>>>25)+r|0,a+=(s&r|~s&l)+h[1]-389564586|0,a=(a<<12|a>>>20)+s|0,l+=(a&s|~a&r)+h[2]+606105819|0,l=(l<<17|l>>>15)+a|0,r+=(l&a|~l&s)+h[3]-1044525330|0,r=(r<<22|r>>>10)+l|0,s+=(r&l|~r&a)+h[4]-176418897|0,s=(s<<7|s>>>25)+r|0,a+=(s&r|~s&l)+h[5]+1200080426|0,a=(a<<12|a>>>20)+s|0,l+=(a&s|~a&r)+h[6]-1473231341|0,l=(l<<17|l>>>15)+a|0,r+=(l&a|~l&s)+h[7]-45705983|0,r=(r<<22|r>>>10)+l|0,s+=(r&l|~r&a)+h[8]+1770035416|0,s=(s<<7|s>>>25)+r|0,a+=(s&r|~s&l)+h[9]-1958414417|0,a=(a<<12|a>>>20)+s|0,l+=(a&s|~a&r)+h[10]-42063|0,l=(l<<17|l>>>15)+a|0,r+=(l&a|~l&s)+h[11]-1990404162|0,r=(r<<22|r>>>10)+l|0,s+=(r&l|~r&a)+h[12]+1804603682|0,s=(s<<7|s>>>25)+r|0,a+=(s&r|~s&l)+h[13]-40341101|0,a=(a<<12|a>>>20)+s|0,l+=(a&s|~a&r)+h[14]-1502002290|0,l=(l<<17|l>>>15)+a|0,r+=(l&a|~l&s)+h[15]+1236535329|0,r=(r<<22|r>>>10)+l|0,s+=(r&a|l&~a)+h[1]-165796510|0,s=(s<<5|s>>>27)+r|0,a+=(s&l|r&~l)+h[6]-1069501632|0,a=(a<<9|a>>>23)+s|0,l+=(a&r|s&~r)+h[11]+643717713|0,l=(l<<14|l>>>18)+a|0,r+=(l&s|a&~s)+h[0]-373897302|0,r=(r<<20|r>>>12)+l|0,s+=(r&a|l&~a)+h[5]-701558691|0,s=(s<<5|s>>>27)+r|0,a+=(s&l|r&~l)+h[10]+38016083|0,a=(a<<9|a>>>23)+s|0,l+=(a&r|s&~r)+h[15]-660478335|0,l=(l<<14|l>>>18)+a|0,r+=(l&s|a&~s)+h[4]-405537848|0,r=(r<<20|r>>>12)+l|0,s+=(r&a|l&~a)+h[9]+568446438|0,s=(s<<5|s>>>27)+r|0,a+=(s&l|r&~l)+h[14]-1019803690|0,a=(a<<9|a>>>23)+s|0,l+=(a&r|s&~r)+h[3]-187363961|0,l=(l<<14|l>>>18)+a|0,r+=(l&s|a&~s)+h[8]+1163531501|0,r=(r<<20|r>>>12)+l|0,s+=(r&a|l&~a)+h[13]-1444681467|0,s=(s<<5|s>>>27)+r|0,a+=(s&l|r&~l)+h[2]-51403784|0,a=(a<<9|a>>>23)+s|0,l+=(a&r|s&~r)+h[7]+1735328473|0,l=(l<<14|l>>>18)+a|0,r+=(l&s|a&~s)+h[12]-1926607734|0,r=(r<<20|r>>>12)+l|0,s+=(r^l^a)+h[5]-378558|0,s=(s<<4|s>>>28)+r|0,a+=(s^r^l)+h[8]-2022574463|0,a=(a<<11|a>>>21)+s|0,l+=(a^s^r)+h[11]+1839030562|0,l=(l<<16|l>>>16)+a|0,r+=(l^a^s)+h[14]-35309556|0,r=(r<<23|r>>>9)+l|0,s+=(r^l^a)+h[1]-1530992060|0,s=(s<<4|s>>>28)+r|0,a+=(s^r^l)+h[4]+1272893353|0,a=(a<<11|a>>>21)+s|0,l+=(a^s^r)+h[7]-155497632|0,l=(l<<16|l>>>16)+a|0,r+=(l^a^s)+h[10]-1094730640|0,r=(r<<23|r>>>9)+l|0,s+=(r^l^a)+h[13]+681279174|0,s=(s<<4|s>>>28)+r|0,a+=(s^r^l)+h[0]-358537222|0,a=(a<<11|a>>>21)+s|0,l+=(a^s^r)+h[3]-722521979|0,l=(l<<16|l>>>16)+a|0,r+=(l^a^s)+h[6]+76029189|0,r=(r<<23|r>>>9)+l|0,s+=(r^l^a)+h[9]-640364487|0,s=(s<<4|s>>>28)+r|0,a+=(s^r^l)+h[12]-421815835|0,a=(a<<11|a>>>21)+s|0,l+=(a^s^r)+h[15]+530742520|0,l=(l<<16|l>>>16)+a|0,r+=(l^a^s)+h[2]-995338651|0,r=(r<<23|r>>>9)+l|0,s+=(l^(r|~a))+h[0]-198630844|0,s=(s<<6|s>>>26)+r|0,a+=(r^(s|~l))+h[7]+1126891415|0,a=(a<<10|a>>>22)+s|0,l+=(s^(a|~r))+h[14]-1416354905|0,l=(l<<15|l>>>17)+a|0,r+=(a^(l|~s))+h[5]-57434055|0,r=(r<<21|r>>>11)+l|0,s+=(l^(r|~a))+h[12]+1700485571|0,s=(s<<6|s>>>26)+r|0,a+=(r^(s|~l))+h[3]-1894986606|0,a=(a<<10|a>>>22)+s|0,l+=(s^(a|~r))+h[10]-1051523|0,l=(l<<15|l>>>17)+a|0,r+=(a^(l|~s))+h[1]-2054922799|0,r=(r<<21|r>>>11)+l|0,s+=(l^(r|~a))+h[8]+1873313359|0,s=(s<<6|s>>>26)+r|0,a+=(r^(s|~l))+h[15]-30611744|0,a=(a<<10|a>>>22)+s|0,l+=(s^(a|~r))+h[6]-1560198380|0,l=(l<<15|l>>>17)+a|0,r+=(a^(l|~s))+h[13]+1309151649|0,r=(r<<21|r>>>11)+l|0,s+=(l^(r|~a))+h[4]-145523070|0,s=(s<<6|s>>>26)+r|0,a+=(r^(s|~l))+h[11]-1120210379|0,a=(a<<10|a>>>22)+s|0,l+=(s^(a|~r))+h[2]+718787259|0,l=(l<<15|l>>>17)+a|0,r+=(a^(l|~s))+h[9]-343485551|0,r=(r<<21|r>>>11)+l|0,g[0]=s+g[0]|0,g[1]=r+g[1]|0,g[2]=l+g[2]|0,g[3]=a+g[3]|0}function t(g){let h=[],s;for(s=0;s<64;s+=4)h[s>>2]=g.charCodeAt(s)+(g.charCodeAt(s+1)<<8)+(g.charCodeAt(s+2)<<16)+(g.charCodeAt(s+3)<<24);return h}function n(g){let h=[],s;for(s=0;s<64;s+=4)h[s>>2]=g[s]+(g[s+1]<<8)+(g[s+2]<<16)+(g[s+3]<<24);return h}function u(g){let h=g.length,s=[1732584193,-271733879,-1732584194,271733878],r,l,a,A,L,U;for(r=64;r<=h;r+=64)e(s,t(g.substring(r-64,r)));for(g=g.substring(r-64),l=g.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<l;r+=1)a[r>>2]|=g.charCodeAt(r)<<(r%4<<3);if(a[r>>2]|=128<<(r%4<<3),r>55)for(e(s,a),r=0;r<16;r+=1)a[r]=0;return A=h*8,A=A.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(A[2],16),U=parseInt(A[1],16)||0,a[14]=L,a[15]=U,e(s,a),s}function o(g){let h=g.length,s=[1732584193,-271733879,-1732584194,271733878],r,l,a,A,L,U;for(r=64;r<=h;r+=64)e(s,n(g.subarray(r-64,r)));for(g=r-64<h?g.subarray(r-64):new Uint8Array(0),l=g.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<l;r+=1)a[r>>2]|=g[r]<<(r%4<<3);if(a[r>>2]|=128<<(r%4<<3),r>55)for(e(s,a),r=0;r<16;r+=1)a[r]=0;return A=h*8,A=A.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(A[2],16),U=parseInt(A[1],16)||0,a[14]=L,a[15]=U,e(s,a),s}function c(g){let h="",s;for(s=0;s<4;s+=1)h+=F[g>>s*8+4&15]+F[g>>s*8&15];return h}function p(g){let h;for(h=0;h<g.length;h+=1)g[h]=c(g[h]);return g.join("")}p(u("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function g(h,s){return h=h|0||0,h<0?Math.max(h+s,0):Math.min(h,s)}ArrayBuffer.prototype.slice=function(h,s){let r=this.byteLength,l=g(h,r),a=r,A,L,U,N;return s!==void 0&&(a=g(s,r)),l>a?new ArrayBuffer(0):(A=a-l,L=new ArrayBuffer(A),U=new Uint8Array(L),N=new Uint8Array(this,l,A),U.set(N),L)}}();function f(g){return/[\u0080-\uFFFF]/.test(g)&&(g=unescape(encodeURIComponent(g))),g}function S(g,h){let s=g.length,r=new ArrayBuffer(s),l=new Uint8Array(r),a;for(a=0;a<s;a+=1)l[a]=g.charCodeAt(a);return h?l:r}function m(g){return String.fromCharCode.apply(null,new Uint8Array(g))}function y(g,h,s){let r=new Uint8Array(g.byteLength+h.byteLength);return r.set(new Uint8Array(g)),r.set(new Uint8Array(h),g.byteLength),s?r:r.buffer}function w(g){let h=[],s=g.length,r;for(r=0;r<s-1;r+=2)h.push(parseInt(g.substr(r,2),16));return String.fromCharCode.apply(String,h)}function b(){this.reset()}b.prototype.append=function(g){return this.appendBinary(f(g)),this},b.prototype.appendBinary=function(g){this._buff+=g,this._length+=g.length;let h=this._buff.length,s;for(s=64;s<=h;s+=64)e(this._hash,t(this._buff.substring(s-64,s)));return this._buff=this._buff.substring(s-64),this},b.prototype.end=function(g){let h=this._buff,s=h.length,r,l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a;for(r=0;r<s;r+=1)l[r>>2]|=h.charCodeAt(r)<<(r%4<<3);return this._finish(l,s),a=p(this._hash),g&&(a=w(a)),this.reset(),a},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},b.prototype.setState=function(g){return this._buff=g.buff,this._length=g.length,this._hash=g.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(g,h){let s=h,r,l,a;if(g[s>>2]|=128<<(s%4<<3),s>55)for(e(this._hash,g),s=0;s<16;s+=1)g[s]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),l=parseInt(r[2],16),a=parseInt(r[1],16)||0,g[14]=l,g[15]=a,e(this._hash,g)},b.hash=function(g,h){return b.hashBinary(f(g),h)},b.hashBinary=function(g,h){let s=u(g),r=p(s);return h?w(r):r},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(g){let h=y(this._buff.buffer,g,!0),s=h.length,r;for(this._length+=g.byteLength,r=64;r<=s;r+=64)e(this._hash,n(h.subarray(r-64,r)));return this._buff=r-64<s?new Uint8Array(h.buffer.slice(r-64)):new Uint8Array(0),this},b.ArrayBuffer.prototype.end=function(g){let h=this._buff,s=h.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],l,a;for(l=0;l<s;l+=1)r[l>>2]|=h[l]<<(l%4<<3);return this._finish(r,s),a=p(this._hash),g&&(a=w(a)),this.reset(),a},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){let g=b.prototype.getState.call(this);return g.buff=m(g.buff),g},b.ArrayBuffer.prototype.setState=function(g){return g.buff=S(g.buff,!0),b.prototype.setState.call(this,g)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(g,h){let s=o(new Uint8Array(g)),r=p(s);return h?w(r):r};const D=new b.ArrayBuffer;onmessage=g=>{switch(g.data.type){case"DOWN_APPEND_DATA":const h=g.data.data;D.append(h);break;case"DOWN_GET_RESULT":postMessage(JSON.parse(JSON.stringify({type:"UP_RESULT",data:D.end(!1)})));return;case"DOWN_RESET":D.reset();break;case"DOWN_CLOSE":close();break}postMessage(JSON.parse(JSON.stringify({type:"UP_ACK"})))}},se=new Blob([`(${Ge.toString()})()`]);class q{constructor(){d(this,"Reader");if(typeof FileReader>"u")throw new Error("\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301FileReader.");this.Reader=new FileReader}async readAsArrayBuffer(e){return new Promise((t,n)=>{this.Reader.onload=u=>{const o=u.target.result;t(o)},this.Reader.onerror=u=>{n(u)},this.Reader.readAsArrayBuffer(e)})}close(){this.Reader.abort()}}var M=(F=>(F.\u4E0B\u884C_\u9644\u52A0\u6570\u636E="DOWN_APPEND_DATA",F.\u4E0B\u884C_\u83B7\u53D6\u7ED3\u679C="DOWN_GET_RESULT",F.\u4E0B\u884C_\u91CD\u7F6E="DOWN_RESET",F.\u4E0B\u884C_\u5173\u95ED="DOWN_CLOSE",F.\u4E0A\u884C_\u5E94\u7B54="UP_ACK",F.\u4E0A\u884C_\u7ED3\u679C="UP_RESULT",F))(M||{});class Q{constructor(e,t){d(this,"enableWorker");d(this,"workerSupported");d(this,"debug");d(this,"sparkUnits",[]);d(this,"workerUnits",[]);d(this,"chunkHandlerQueue",[]);d(this,"chunkHandler",[]);d(this,"finished",!1);d(this,"canceled",!1);d(this,"paused",!1);d(this,"waitToContinue",[]);d(this,"fileReaders",[]);this.debug=t,this.enableWorker=e,this.workerSupported=typeof Worker<"u",this.enableWorker&&this.debug&&console.debug(`HashHelper > WebWoeker ${this.workerSupported?"\u5DF2\u542F\u7528":"\u672A\u542F\u7528\uFF08\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\uFF09"}`)}async checkFile(e,t,n){return new Promise(async(u,o)=>{const c=e;e instanceof V&&(c.blob=c.file);let p={preLoaded:0,loaded:0,total:e.size};n(p);const f=1024*1024;for(;c.checkPosition<c.size;){if(this.canceled){await this.reset(),u();break}if(this.paused){const m=async()=>new Promise((w,b)=>{this.waitToContinue[t]=w});this.debug&&console.debug("HashHelper > \u5DF2\u6682\u505C",t);const y=await m();if(this.waitToContinue[t]=null,this.debug&&console.debug("HashHelper > \u5DF2\u6062\u590D",t),!y){u();return}}const S=c.blob.slice(c.checkPosition,Math.min(c.checkPosition+f,c.size));c.checkPosition+=S.size,p.preLoaded+=S.size,n(p),await this.appendData(S,t),p.loaded+=S.size,n(p)}u(await this.getResult(t))})}async appendData(e,t){let n=await this.fileReaders[t].readAsArrayBuffer(e);const u={type:M.\u4E0B\u884C_\u9644\u52A0\u6570\u636E,data:n};this.workerSupported?await this.workerPostMessage(t,u):this.sparkUnits[t].append(n)}async getResult(e){const t={type:M.\u4E0B\u884C_\u83B7\u53D6\u7ED3\u679C};return this.workerSupported?await this.workerPostMessage(e,t):this.sparkUnits[e].end()}async reset(){if(this.enableWorker&&this.workerSupported)for(let e=0;e<this.workerUnits.length;e++)await this.resetByIndex(e);else for(let e=0;e<this.sparkUnits.length;e++)await this.resetByIndex(e)}async resetByIndex(e){if(this.enableWorker&&this.workerSupported){if(!this.workerUnits[e].used)return;await this.workerPostMessage(e,{type:M.\u4E0B\u884C_\u91CD\u7F6E}),this.debug&&console.debug("HashHelper > WebWoeker\u5B50\u7EBF\u7A0B\u8BA1\u7B97\u5355\u5143 \u5DF2\u91CD\u7F6E",Object.assign({},this.workerUnits[e]))}else this.sparkUnits[e].reset(),this.debug&&console.debug("HashHelper > Spark\u8BA1\u7B97\u5355\u5143 \u5DF2\u91CD\u7F6E",Object.assign({},this.sparkUnits[e]))}async closeByIndex(e){this.fileReaders[e].close(),this.debug&&console.debug("HashHelper > FileReadHelper \u5DF2\u5173\u95ED",Object.assign({},this.fileReaders[e])),this.enableWorker&&this.workerSupported?(await this.workerPostMessage(e,{type:M.\u4E0B\u884C_\u5173\u95ED}),this.debug&&console.debug("HashHelper > WebWoeker\u5B50\u7EBF\u7A0B\u8BA1\u7B97\u5355\u5143 \u5DF2\u5173\u95ED",Object.assign({},this.workerUnits[e]))):(this.sparkUnits[e].destroy(),this.debug&&console.debug("HashHelper > Spark\u8BA1\u7B97\u5355\u5143 \u5DF2\u5173\u95ED",Object.assign({},this.sparkUnits[e])))}async workerPostMessage(e,t){let n=this.workerUnits[e];return n.used=!0,new Promise((u,o)=>{n.worker.onmessage=c=>{switch(c.data.type){case M.\u4E0A\u884C_\u7ED3\u679C:u(c.data.data);break;case M.\u4E0A\u884C_\u5E94\u7B54:default:u()}},n.worker.onerror=c=>{n.used=!1,o(new B("WebWorker\u5F02\u5E38",c.error))},n.worker.onmessageerror=c=>{n.used=!1,o(new B(`WebWorker\u901A\u8BAF\u9519\u8BEF\uFF0C${c.data}`))},t.type===M.\u4E0B\u884C_\u9644\u52A0\u6570\u636E?n.worker.postMessage(t,[t.data]):n.worker.postMessage(JSON.parse(JSON.stringify(t)))})}static async getInstance(e=1,t=!0,n=!1){return new Promise(u=>{let o=new Q(t,n);for(;o.fileReaders.length<e;)o.fileReaders.push(new q),o.chunkHandler.push(!1),o.waitToContinue.push(null),o.debug&&console.debug("HashHelper > FileReadHelper \u5DF2\u521B\u5EFA",Object.assign({},o.fileReaders[o.fileReaders.length-1]));if(o.enableWorker&&o.workerSupported){window.URL=window.URL||window.webkitURL;for(let c=0;c<e;c++)o.workerUnits.push({worker:new Worker(window.URL.createObjectURL(se)),used:!1}),o.debug&&console.debug("HashHelper > WebWoeker\u5B50\u7EBF\u7A0B\u8BA1\u7B97\u5355\u5143 \u5DF2\u521B\u5EFA",Object.assign({},o.workerUnits[c].worker))}else for(;o.sparkUnits.length<e;)o.sparkUnits.push(new oe.default.ArrayBuffer),o.debug&&console.debug("HashHelper > Spark\u8BA1\u7B97\u5355\u5143 \u5DF2\u521B\u5EFA",Object.assign({},o.sparkUnits[o.sparkUnits.length-1]));u(o)})}async handler(e,t){return new Promise(async(n,u)=>{this.debug&&console.debug("HashHelper \u5F00\u59CB\u5904\u7406",Object.assign({},e));let o={preLoaded:0,loaded:0,total:e.size*2};const c=(y,w)=>{o.preLoaded+=y.preLoaded-w.preLoaded,o.loaded+=y.loaded-w.loaded,w.preLoaded=y.preLoaded,w.loaded=y.loaded,t(o)},p=async()=>{var w;let y={preLoaded:0,loaded:0,total:e.size};try{e.md5=(w=await this.checkFile(e,0,b=>{c(b,y)}))!=null?w:null}catch(b){u(b)}},f=()=>{this.finished=!0,this.debug&&console.debug("HashHelper \u5904\u7406\u7ED3\u675F",Object.assign({},e)),n()};if(await p(),!e.needSection){f();return}const S=async()=>{var g;if(this.finished)return;if(this.chunkHandlerQueue.length===0){for(let h=0;h<this.chunkHandler.length;h++)if(this.chunkHandler[h])return;f();return}let y=null;for(let h=0;h<this.chunkHandler.length;h++)if(!this.chunkHandler[h]){y=h;break}if(y==null){this.debug&&console.debug(`HashHelper \u5DF2\u8FBE\u5230\u6700\u5927\u5E76\u53D1\u6570\uFF1A${this.chunkHandler.length}\uFF0C\u5F53\u524D\u961F\u5217\u957F\u5EA6\uFF1A${this.chunkHandlerQueue.length}`,Object.assign({},e));return}this.chunkHandler[y]=!0;const w=()=>{if(t(o),this.canceled){this.reset().then(n).catch(n);return}this.chunkHandler[y]=!1,S()},b=this.chunkHandlerQueue.shift();if(b.checked){o.preLoaded+=b.size,o.loaded+=b.size,t(o),w();return}let D={preLoaded:0,loaded:0,total:b.size};t(o),b.md5=(g=await this.checkFile(b,y,h=>{c(h,D)}))!=null?g:null,w()},m=y=>{this.chunkHandlerQueue.push(y),S()};for(const y of e.chunks)m(y)})}async cancel(){if(this.canceled=!0,this.paused){this.paused=!1;for(const e of this.waitToContinue)e&&e(!1)}this.debug&&console.debug("HashHelper \u5DF2\u53D6\u6D88")}async pause(){this.paused=!0,this.debug&&console.debug("HashHelper \u5DF2\u6682\u505C")}async continue(){this.paused=!1;for(const e of this.waitToContinue)e&&e(!0);this.debug&&console.debug("HashHelper \u5DF2\u6062\u590D")}async close(){if(this.enableWorker&&this.workerSupported)for(let e=0;e<this.workerUnits.length;e++)await this.closeByIndex(e);else for(let e=0;e<this.sparkUnits.length;e++)await this.closeByIndex(e);this.debug&&console.debug("HashHelper \u5DF2\u5173\u95ED")}}var T=(F=>(F.\u4E0B\u884C_\u4E0A\u4F20="DOWN_UPLOAD",F.\u4E0B\u884C_\u53D6\u6D88="DOWN_CANCEL",F.\u4E0B\u884C_\u5173\u95ED="DOWN_CLOSE",F.\u4E0A\u884C_\u8FDB\u5EA6="UP_PROGRESS",F.\u4E0A\u884C_\u53D6\u6D88="UP_CANCEL",F.\u4E0A\u884C_\u5B8C\u6210="UP_COMPLETED",F.\u4E0A\u884C_\u5931\u8D25="UP_FAILED",F.\u4E0A\u884C_\u8D85\u65F6="UP_TIMEOUT",F))(T||{}),z=(F=>(F.\u5141\u8BB8\u4E0A\u4F20="\u5141\u8BB8\u4E0A\u4F20",F.\u63A8\u8FDF\u4E0A\u4F20="\u63A8\u8FDF\u4E0A\u4F20",F.\u8DF3\u8FC7="\u8DF3\u8FC7",F.\u5168\u90E8\u8DF3\u8FC7="\u5168\u90E8\u8DF3\u8FC7",F))(z||{});const Je=()=>{let F;const e=(t,n,u)=>{var c;const o=new XMLHttpRequest;if(o.overrideMimeType("application/octet-stream"),n)for(const p of n.keys())o.setRequestHeader(p,(c=n.get(p))!=null?c:"");o.upload.onprogress=p=>{postMessage({type:"UP_PROGRESS",data:{preLoaded:p.total,total:p.total,loaded:p.loaded}})},o.onabort=p=>{postMessage({type:"UP_CANCEL",data:{preLoaded:p.total,total:p.total,loaded:p.loaded}})},o.onreadystatechange=()=>{o.readyState===4&&o.status===200&&postMessage({type:"UP_COMPLETED",data:JSON.parse(o.response)})},o.onerror=p=>{postMessage({type:"UP_FAILED",data:{preLoaded:p.total,total:p.total,loaded:p.loaded}})},o.ontimeout=p=>{postMessage({type:"UP_TIMEOUT",data:{preLoade