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 • 89.3 kB
JavaScript
"use strict";var fe=Object.defineProperty;var Fe=(s,e,t)=>e in s?fe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var c=(s,e,t)=>(Fe(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("vue-demi"),me=require("spark-md5"),be=s=>s&&typeof s=="object"&&"default"in s?s:{default:s},ye=be(me);var T=(s=>(s.\u5168\u81EA\u52A8="AT",s.\u624B\u52A8\u6321="MT",s.\u534A\u81EA\u52A8="AMT",s))(T||{}),M=(s=>(s.\u5361\u7247="Card",s.\u6E05\u5355="Detailedly",s))(M||{});class _{constructor(e,t,n,o){c(this,"r");c(this,"g");c(this,"b");c(this,"a");c(this,"toString",()=>`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`);this.r=e,this.g=t,this.b=n,this.a=o}static convertFrom(e){return new _(e.r,e.g,e.b,e.a)}}const W=class{constructor(){c(this,"build",e=>(e(this),this));c(this,"setup",e=>(e(this),this));c(this,"configCode","default");c(this,"concurrentFile",3);c(this,"concurrentChunkFile",3);c(this,"tip","\u5355\u51FB\u6216\u62D6\u52A8\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u5373\u53EF\u4E0A\u4F20");c(this,"layout",M.\u5361\u7247);c(this,"runMode",T.\u5168\u81EA\u52A8);c(this,"enableChunk",!0);c(this,"chunkSize",2097152);c(this,"retry",3);c(this,"enableWorker",!0);c(this,"readonly",!1);c(this,"debug",!1);c(this,"alertErrorInfo",!1);c(this,"enableDrag",!0);c(this,"statusCheckingColor",new _(255,235,59,.5));c(this,"statusUploadingColor",new _(144,206,255,.5));c(this,"statusPausedColor",new _(158,158,158,.5));c(this,"statusPausedSubColor",new _(244,154,3,.5));c(this,"statusDoneColor",new _(76,175,80,.1));c(this,"statusDoneSubColor",new _(3,169,244,.5));c(this,"statusErrorColor",new _(255,0,30,.35));c(this,"statusErrorSubColor",new _(232,31,31,.5));c(this,"dragReadyColor",new _(255,152,0,.8));c(this,"dragMovingColor",new _(255,152,0,.5));c(this,"dragOverColor",new _(255,87,34,.8));c(this,"dragPreparationTime",800);c(this,"dragChangePositionTime",1e3);c(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 x=W;c(x,"default",()=>new W),c(x,"defaultWithConfigCode",e=>new W().setup(t=>t.configCode=e));const De=v.defineComponent({name:"FileInput",inject:["upload"],computed:{uploadInstance(){return this.upload()}},created(){this.uploadInstance.getSettings().debug&&console.debug("Piece: File Input Component(vue2) \u5DF2\u52A0\u8F7D")},methods:{fileInputRef(){return this.$refs.fileInputRef},chosingFile(s){this.uploadInstance.limited()||this.fileInputRef().click()},choseFile(s){const e=this.fileInputRef();if(e&&e.files)for(let t=0;t<e.files.length;t++)this.uploadInstance.append(e.files[t]);e&&(e.value="")}}});var Ce=function(){var s,e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"upload-btn",attrs:{title:e.uploadInstance.getSettings().tip},on:{click:e.chosingFile}},[n("div",{on:{click:function(o){return o.stopPropagation(),function(){}.apply(null,arguments)}}},[n("input",{ref:"fileInputRef",attrs:{type:"file",multiple:((s=e.uploadInstance.getConfig().upperLimit)!==null&&s!==void 0?s:0)>1,accept:e.uploadInstance.getAllowedTypes()},on:{change:e.choseFile}})]),n("div",{staticClass:"upload-box-content"},[e._t("default")],2)])},we=[];function $(s,e,t,n,o,u,a,p){var g=typeof s=="function"?s.options:s;e&&(g.render=e,g.staticRenderFns=t,g._compiled=!0),n&&(g.functional=!0),u&&(g._scopeId="data-v-"+u);var F;if(a?(F=function(b){b=b||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!b&&typeof __VUE_SSR_CONTEXT__<"u"&&(b=__VUE_SSR_CONTEXT__),o&&o.call(this,b),b&&b._registeredComponents&&b._registeredComponents.add(a)},g._ssrRegister=F):o&&(F=p?function(){o.call(this,(g.functional?this.parent:this).$root.$options.shadowRoot)}:o),F)if(g.functional){g._injectStyles=F;var y=g.render;g.render=function(D,S){return F.call(S),y(D,S)}}else{var m=g.beforeCreate;g.beforeCreate=m?[].concat(m,F):[F]}return{exports:s,options:g}}const K={};var ve=$(De,Ce,we,!1,Ee,null,null,null);function Ee(s){for(let e in K)this[e]=K[e]}const ue=function(){return ve.exports}();var C=(s=>(s.\u7535\u5B50\u6587\u6863="\u7535\u5B50\u6587\u6863",s.\u7535\u5B50\u8868\u683C="\u7535\u5B50\u8868\u683C",s.\u6587\u672C\u6587\u4EF6="\u6587\u672C\u6587\u4EF6",s.\u56FE\u7247="\u56FE\u7247",s.\u97F3\u9891="\u97F3\u9891",s.\u89C6\u9891="\u89C6\u9891",s.\u538B\u7F29\u5305="\u538B\u7F29\u5305",s.\u672A\u77E5="\u672A\u77E5",s.\u5916\u94FE\u8D44\u6E90="\u5916\u94FE\u8D44\u6E90",s))(C||{});const _e=v.defineComponent({name:"SelectedFileInfo",props:{selectedFile:{type:Object,require:!0},readyDrag:{type:Boolean,require:!1},startDrag:{type:Boolean,require:!1},dragging:{type:Boolean,require:!1},dragover:{type:Boolean,require:!1}},emits:["setContainerRef","mouseDown","mouseUp","mouseEnter","mouseLeave"],inject:["upload"],computed:{uploadInstance(){return this.upload()},containerStyle(){var s,e,t,n,o,u,a,p;return`item-container ${((s=this.selectedFile)==null?void 0:s.done)&&!this.uploadInstance.getSettings().readonly?" item-done":""} ${(e=this.selectedFile)!=null&&e.error?" item-error":""} ${this.renderData.hover&&!this.renderData.rename.active&&!((t=this.selectedFile)!=null&&t.checking)&&!((n=this.selectedFile)!=null&&n.uploading)&&!this.readyDrag&&!this.startDrag?" item-hover":""} ${(o=this.selectedFile)!=null&&o.checking?" item-checking":""} ${(u=this.selectedFile)!=null&&u.uploading?" item-uploading":""} ${(a=this.selectedFile)!=null&&a.canceled?" item-canceled":""} ${(p=this.selectedFile)!=null&&p.paused?" item-paused":""} ${this.readyDrag?" item-ready-drag":""} ${this.dragging?" item-dragging":""} ${this.dragover?" item-drag-over":""}`},containerStyleVar(){return{"--statusCheckingColor":this.uploadInstance.getSettings().statusCheckingColor.toString(),"--statusUploadingColor":this.uploadInstance.getSettings().statusUploadingColor.toString(),"--statusPausedColor":this.uploadInstance.getSettings().statusPausedColor.toString(),"--statusPausedSubColor":this.uploadInstance.getSettings().statusPausedSubColor.toString(),"--statusDoneColor":this.uploadInstance.getSettings().statusDoneColor.toString(),"--statusDoneSubColor":this.uploadInstance.getSettings().statusDoneSubColor.toString(),"--statusErrorColor":this.uploadInstance.getSettings().statusErrorColor.toString(),"--statusErrorSubColor":this.uploadInstance.getSettings().statusErrorSubColor.toString(),"--dragPreparationTime":`${(this.uploadInstance.getSettings().dragPreparationTime/1e3).toFixed(2)}s`,"--dragChangePositionTime":`${(this.uploadInstance.getSettings().dragChangePositionTime/1e3).toFixed(2)}s`,"--dragReadyColor":this.uploadInstance.getSettings().dragReadyColor.toString(),"--dragMovingColor":this.uploadInstance.getSettings().dragMovingColor.toString(),"--dragOverColor":this.uploadInstance.getSettings().dragOverColor.toString()}},containerInfo(){var s,e,t;return`${(s=this.selectedFile)!=null&&s.done?"\u4E0A\u4F20\u6210\u529F":""} ${(e=this.selectedFile)!=null&&e.error?this.selectedFile.errorMessage:""} ${(t=this.selectedFile)!=null&&t.paused?"\u5DF2\u6682\u505C":""}`},loadingShow(){return!this.renderData.rename.active&&(this.selectedFile.checking||this.selectedFile.uploading)},loadingInfo(){var s,e;return`${(s=this.selectedFile)!=null&&s.checking?"\u626B\u63CF\u4E2D..."+this.selectedFile.percent+"%":""} ${(e=this.selectedFile)!=null&&e.uploading?"\u4E0A\u4F20\u4E2D..."+this.selectedFile.percent+"%":""}`},toolsShow(){var s,e;return this.renderData.hover&&this.dragging===!1&&!this.renderData.rename.active&&!((s=this.selectedFile)!=null&&s.checking)&&!((e=this.selectedFile)!=null&&e.uploading)},renameEnable(){var s;return!((s=this.selectedFile)!=null&&s.uploading)},viewEnable(){var s;switch((s=this.selectedFile)==null?void 0:s.fileType){case C.\u56FE\u7247:case C.\u97F3\u9891:return this.selectedFile.extensionLower!==".flac";case C.\u89C6\u9891:return!0;case C.\u6587\u672C\u6587\u4EF6:return!0;case C.\u7535\u5B50\u6587\u6863:return this.selectedFile.extensionLower===".pdf"||this.selectedFile.extensionLower===".doc"||this.selectedFile.extensionLower===".docx";default:return!1}},saveEnable(){return!0}},data(){return{renderData:{renameInputRef:null,hover:!1,rename:{active:!1,value:""}}}},created(){this.$nextTick(()=>{this.$emit("setContainerRef",this.$refs.containerRef)}),this.uploadInstance.getSettings().debug&&console.debug("Piece: Selected File Info Component(vue2) \u5DF2\u52A0\u8F7D")},methods:{setRenameInputRef(s){s&&(this.renderData.renameInputRef=s)},mouseEnter(s){this.readyDrag||this.startDrag?(this.$emit("mouseEnter",s),this.renderData.hover=!1):this.renderData.hover=!0},mouseLeave(s){(this.readyDrag||this.startDrag)&&this.$emit("mouseLeave",s),this.renderData.hover=!1},mouseDown(s){this.$emit("mouseDown",s)},mouseUp(s){this.$emit("mouseUp",s)},rename(){this.renderData.rename.active=!0,this.$nextTick(()=>{this.renderData.renameInputRef&&this.renderData.renameInputRef.focus()})},renameKeydown(s){s.key=="Enter"&&this.renameDone()},renameDone(){this.uploadInstance.rename(this.selectedFile.token,this.renderData.rename.value).then(()=>{this.renderData.rename.active=!1}).catch(()=>{this.renderData.rename.active=!1})},view(){const s=this.uploadInstance.getRawFile(this.selectedFile),e="margin:0px;text-align: center;display: flex;flex-direction: row;justify-content: center;align-items: center";switch(this.selectedFile.fileType){case C.\u56FE\u7247:let t=window.open();t==null||t.document.write(`<head><title>${this.selectedFile.fullname()}</title></head><body style="${e};background-color: black;"><img style="max-width: 100%;max-height: 100%;" src="${s.objectURL}" alt="${this.selectedFile.fullname()}"></body>`);break;case C.\u97F3\u9891:if(this.selectedFile.extensionLower===".flac")return;let n=window.open();n==null||n.document.write(`<head><title>${this.selectedFile.fullname()}</title></head><body style="${e};background-color: black;"><audio style="max-width: 100%;max-height: 100%;" src="${s.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</audio></body>`);break;case C.\u89C6\u9891:let o=window.open();o==null||o.document.write(`<head><title>${this.selectedFile.fullname()}</title></head><body style="${e};background-color: black;"><video style="max-width: 100%;max-height: 100%;" src="${s.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</video></body>`);break;default:let u=window.open();u==null||u.document.write(`<head><title>${this.selectedFile.fullname()}</title></head><body style="${e};"><object style="max-width: 100%;max-height: 100%;" data="${s.objectURL}" type="${this.selectedFile.extensionLower===".txt"?"text/plain":this.selectedFile.extensionLower===".pdf"?"application/pdf":"application/octet-stream"}" width="100%" height="100%"><iframe src="${s.objectURL}" width="100%" height="100%" ></iframe></object></body>`);break}},save(){const s=this.uploadInstance.getRawFile(this.selectedFile),e=document.createElement("a");e.style.display="none",e.href=this.uploadInstance.getDownloadUrl(this.selectedFile),s.file&&(e.download=this.selectedFile.fullname()),document.body.appendChild(e),e.click(),document.body.removeChild(e)},remove(){this.uploadInstance.remove(this.selectedFile.token)}}});var Se=function(){var s,e,t,n,o,u,a=this,p=a.$createElement,g=a._self._c||p;return g("div",{ref:"containerRef",class:a.containerStyle,style:a.containerStyleVar,attrs:{title:a.containerInfo},on:{mouseenter:a.mouseEnter,mouseleave:a.mouseLeave,mousedown:a.mouseDown,mouseup:a.mouseUp}},[(s=a.selectedFile)!==null&&s!==void 0&&s.canceled?a._e():g("div",{staticClass:"item-body"},[g("div",{staticClass:"item-image"},[g("img",{attrs:{src:(e=a.selectedFile)===null||e===void 0?void 0:e.thumbnail,loading:"lazy",alt:(t=a.selectedFile)===null||t===void 0?void 0:t.fullname()}})]),a.toolsShow?g("span",{staticClass:"item-tools"},[a.renameEnable&&!a.uploadInstance.getSettings().readonly?g("span",{staticClass:"upload-icon icon-rename",attrs:{title:"\u91CD\u547D\u540D"},on:{click:function(F){return a.rename()}}}):a._e(),a.viewEnable?g("span",{staticClass:"upload-icon icon-view",attrs:{title:"\u67E5\u770B"},on:{click:function(F){return a.view()}}}):a._e(),a.saveEnable?g("span",{staticClass:"upload-icon icon-download",attrs:{title:"\u4FDD\u5B58"},on:{click:function(F){return a.save()}}}):a._e(),a.uploadInstance.getSettings().readonly?a._e():g("span",{staticClass:"upload-icon icon-remove",attrs:{title:"\u5220\u9664"},on:{click:function(F){return a.remove()}}})]):a._e(),a._t("default",null,{selectedFile:a.selectedFile,rename:a.renderData.rename,funs:{setRenameInputRef:a.setRenameInputRef,renameKeydown:a.renameKeydown,renameDone:a.renameDone},loadingInfo:a.loadingInfo,loadingShow:a.loadingShow}),(n=a.selectedFile)!==null&&n!==void 0&&n.paused?g("div",{staticClass:"item-sub sub-paused"},[a._v("\u6682\u505C")]):a._e(),(o=a.selectedFile)!==null&&o!==void 0&&o.done&&!a.uploadInstance.getSettings().readonly?g("div",{staticClass:"item-sub sub-done"},[a._v(" \u5B8C\u6210 ")]):a._e(),(u=a.selectedFile)!==null&&u!==void 0&&u.error?g("div",{staticClass:"item-sub sub-error"},[a._v("\u9519\u8BEF")]):a._e()],2)])},ke=[];const G={};var $e=$(_e,Se,ke,!1,Ae,null,null,null);function Ae(s){for(let e in G)this[e]=G[e]}const oe=function(){return $e.exports}(),Ie=v.defineComponent({name:"CardIndex",inject:["upload"],computed:{uploadInstance(){return this.upload()}},created(){this.uploadInstance.getSettings().debug&&console.debug("Layout: Card Index Component(vue2) \u5DF2\u52A0\u8F7D")}});var Be=function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("div",{staticClass:"upload-container independent"},[s._t("uploadContainer"),t("div",{staticClass:"upload-list"},[s._t("listContainer")],2)],2)},Le=[];const J={};var Pe=$(Ie,Be,Le,!1,Ue,"38de204e",null,null);function Ue(s){for(let e in J)this[e]=J[e]}const Me=function(){return Pe.exports}(),xe=v.defineComponent({name:"DetailedlyIndex",inject:["upload"],computed:{uploadInstance(){return this.upload()}},created(){this.uploadInstance.getSettings().debug&&console.debug("Layout: Detailedly Index Component(vue2) \u5DF2\u52A0\u8F7D")}});var Re=function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("div",{staticClass:"upload-container independent"},[s._t("uploadContainer"),t("div",{staticClass:"upload-list"},[s._t("listContainer")],2)],2)},Te=[];const V={};var He=$(xe,Re,Te,!1,Oe,"167ebfac",null,null);function Oe(s){for(let e in V)this[e]=V[e]}const je=function(){return He.exports}(),ze=v.defineComponent({name:"LayoutIndex",components:{CardIndex:Me,DetailedlyIndex:je},inject:["upload"],computed:{uploadInstance(){return this.upload()}},data(){return{renderData:{loading:!0,currentThemeIndex:null}}},created(){const s=e=>{switch(this.renderData.loading=!0,e){case M.\u5361\u7247:this.renderData.currentThemeIndex="CardIndex";break;case M.\u6E05\u5355:this.renderData.currentThemeIndex="DetailedlyIndex";break}this.renderData.loading=!1,this.uploadInstance.getSettings().debug&&console.debug("Layout: Index Component(vue2) \u5DF2\u53D8\u66F4")};this.uploadInstance.registerLayoutChanged(s),s(this.uploadInstance.getSettings().layout),this.uploadInstance.getSettings().debug&&console.debug("Layout: Index Component(vue2) \u5DF2\u52A0\u8F7D")}});var We=function(){var s=this,e=s.$createElement,t=s._self._c||e;return s.renderData.loading?s._e():t("div",[t(s.renderData.currentThemeIndex,{tag:"component",scopedSlots:s._u([{key:"uploadContainer",fn:function(){return[s._t("uploadContainer")]},proxy:!0},{key:"listContainer",fn:function(){return[s._t("listContainer")]},proxy:!0}],null,!0)})],1)},Qe=[];const Z={};var Ne=$(ze,We,Qe,!1,Xe,null,null,null);function Xe(s){for(let e in Z)this[e]=Z[e]}const le=function(){return Ne.exports}(),Ye=v.defineComponent({name:"CardInfo",props:{slotProps:{type:Object,require:!0}},inject:["upload"],computed:{uploadInstance(){return this.upload()},lodingStyle(){var s,e,t;return((s=this.slotProps)!=null&&s.selectedFile.checking?[this.uploadInstance.getGradientStyleObject("conic","rgba(255, 236, 201, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[]).concat((e=this.slotProps)!=null&&e.selectedFile.uploading?[this.uploadInstance.getGradientStyleObject("conic","rgba(144, 206, 255, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[]).concat((t=this.slotProps)!=null&&t.selectedFile.paused?[this.uploadInstance.getGradientStyleObject("conic","rgba(158, 158, 158, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[])}},created(){this.$nextTick(()=>{var s;(s=this.slotProps)==null||s.funs.setRenameInputRef(this.$refs.renameInputRef)}),this.uploadInstance.getSettings().debug&&console.debug("Layout: Card Info Component(vue2) \u5DF2\u52A0\u8F7D")}});var qe=function(){var s,e,t,n,o,u,a,p=this,g=p.$createElement,F=p._self._c||g;return F("div",[F("div",{staticClass:"item-info"},[(s=p.slotProps)!==null&&s!==void 0&&s.rename.active?p._e():F("span",{staticClass:"single-text-omitted item-name",attrs:{title:((e=p.slotProps)===null||e===void 0?void 0:e.selectedFile.fileType)+`\r
`+((t=p.slotProps)===null||t===void 0?void 0:t.selectedFile.size)+`\r
`+((n=p.slotProps)===null||n===void 0?void 0:n.selectedFile.fullname())},domProps:{innerHTML:p._s((o=p.slotProps)===null||o===void 0?void 0:o.selectedFile.fullname())}}),(u=p.slotProps)!==null&&u!==void 0&&u.rename.active?F("input",{directives:[{name:"model",rawName:"v-model",value:p.slotProps.rename.value,expression:"slotProps.rename.value"}],ref:"renameInputRef",staticClass:"item-rename-input",attrs:{type:"text"},domProps:{value:p.slotProps.rename.value},on:{keydown:function(y){var m;(m=p.slotProps)===null||m===void 0||m.funs.renameKeydown(y)},blur:function(y){var m;(m=p.slotProps)===null||m===void 0||m.funs.renameDone()},input:function(y){y.target.composing||p.$set(p.slotProps.rename,"value",y.target.value)}}}):p._e()]),(a=p.slotProps)!==null&&a!==void 0&&a.loadingShow?F("div",{staticClass:"item-loading",style:p.lodingStyle,attrs:{title:p.slotProps.loadingInfo}}):p._e()])},Ke=[];const ee={};var Ge=$(Ye,qe,Ke,!1,Je,null,null,null);function Je(s){for(let e in ee)this[e]=ee[e]}const Ve=function(){return Ge.exports}(),Ze=v.defineComponent({name:"DetailedlyInfo",props:{slotProps:{type:Object,require:!0}},inject:["upload"],computed:{uploadInstance(){return this.upload()},lodingStyle(){var s,e,t;return((s=this.slotProps)!=null&&s.selectedFile.checking?[this.uploadInstance.getGradientStyleObject("linear","rgba(255, 236, 201, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[]).concat((e=this.slotProps)!=null&&e.selectedFile.uploading?[this.uploadInstance.getGradientStyleObject("linear","rgba(144, 206, 255, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[]).concat((t=this.slotProps)!=null&&t.selectedFile.paused?[this.uploadInstance.getGradientStyleObject("linear","rgba(158, 158, 158, 0.5)",this.slotProps.selectedFile.percent,this.slotProps.selectedFile.virtualPercent)[0]]:[])}},created(){this.$nextTick(()=>{var s;(s=this.slotProps)==null||s.funs.setRenameInputRef(this.$refs.renameInputRef)}),this.uploadInstance.getSettings().debug&&console.debug("Layout: Detailedly Info Component(vue2) \u5DF2\u52A0\u8F7D")}});var et=function(){var s,e,t,n,o,u,a,p,g,F=this,y=F.$createElement,m=F._self._c||y;return m("div",[m("div",{staticClass:"item-info"},[m("span",{staticClass:"single-text-omitted item-name"},[F._v(" \u540D\u79F0\uFF1A"),(s=F.slotProps)!==null&&s!==void 0&&s.rename.active?F._e():m("span",{attrs:{title:(e=F.slotProps)===null||e===void 0?void 0:e.selectedFile.fullname()},domProps:{innerHTML:F._s((t=F.slotProps)===null||t===void 0?void 0:t.selectedFile.fullname())}}),(n=F.slotProps)!==null&&n!==void 0&&n.rename.value?m("input",{directives:[{name:"model",rawName:"v-model",value:F.slotProps.selectedFile.newName,expression:"slotProps.selectedFile.newName"}],ref:"renameInputRef",staticClass:"item-rename-input",attrs:{type:"text"},domProps:{value:F.slotProps.selectedFile.newName},on:{keydown:function(b){var D;(D=F.slotProps)===null||D===void 0||D.funs.renameKeydown(b)},blur:function(b){var D;(D=F.slotProps)===null||D===void 0||D.funs.renameDone()},input:function(b){b.target.composing||F.$set(F.slotProps.selectedFile,"newName",b.target.value)}}}):F._e()]),m("span",{staticClass:"single-text-omitted item-size"},[F._v(" \u5927\u5C0F\uFF1A"),m("span",{attrs:{title:(o=F.slotProps)===null||o===void 0?void 0:o.selectedFile.size},domProps:{innerHTML:F._s((u=F.slotProps)===null||u===void 0?void 0:u.selectedFile.size)}})]),m("span",{staticClass:"single-text-omitted item-filetype"},[F._v(" \u7C7B\u578B\uFF1A"),m("span",{attrs:{title:(a=F.slotProps)===null||a===void 0?void 0:a.selectedFile.fileType},domProps:{innerHTML:F._s((p=F.slotProps)===null||p===void 0?void 0:p.selectedFile.fileType)}})])]),(g=F.slotProps)!==null&&g!==void 0&&g.loadingShow?m("div",{staticClass:"item-loading",style:F.lodingStyle,attrs:{title:F.slotProps.loadingInfo}}):F._e()])},tt=[];const te={};var st=$(Ze,et,tt,!1,nt,null,null,null);function nt(s){for(let e in te)this[e]=te[e]}const it=function(){return st.exports}(),rt=v.defineComponent({name:"LayoutInfo",components:{CardInfo:Ve,DetailedlyInfo:it},props:{slotProps:{type:Object,require:!0}},inject:["upload"],computed:{uploadInstance(){return this.upload()}},data(){return{renderData:{loading:!0,currentThemeInfo:null}}},created(){(e=>{switch(this.renderData.loading=!0,this.uploadInstance.getSettings().layout){case M.\u5361\u7247:this.renderData.currentThemeInfo="CardInfo";break;case M.\u6E05\u5355:this.renderData.currentThemeInfo="DetailedlyInfo";break}this.renderData.loading=!1,this.uploadInstance.getSettings().debug&&console.debug("Layout: Info Component(vue2) \u5DF2\u53D8\u66F4")})(),this.uploadInstance.getSettings().debug&&console.debug("Layout: Info Component(vue2) \u5DF2\u52A0\u8F7D")}});var at=function(){var s=this,e=s.$createElement,t=s._self._c||e;return s.renderData.loading?s._e():t("div",[t(s.renderData.currentThemeInfo,{tag:"component",attrs:{slotProps:s.slotProps}})],1)},ut=[];const se={};var ot=$(rt,at,ut,!1,lt,null,null,null);function lt(s){for(let e in se)this[e]=se[e]}const ce=function(){return ot.exports}(),ct=v.defineComponent({name:"SingleUpload",components:{FileInput:ue,SelectedFileInfo:oe,LayoutIndex:le,LayoutInfo:ce},inject:["upload"],computed:{uploadInstance(){return this.upload()}},created(){this.uploadInstance.getSettings().debug&&console.debug("Piece: Single Upload Component(vue2) \u5DF2\u52A0\u8F7D")}});var dt=function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("layout-index",{scopedSlots:s._u([s.uploadInstance.getSettings().readonly?null:{key:"uploadContainer",fn:function(){return[s.uploadInstance.anyFile()?s._e():t("file-input",{staticClass:"upload-box-container single",attrs:{title:s.uploadInstance.getConfig().explain}},[t("p",{staticClass:"upload-icon icon-select-file"})])]},proxy:!0},{key:"listContainer",fn:function(){return s._l(s.uploadInstance.getSelectedFileSortMap().size,function(n){return t("selected-file-info",{key:n,attrs:{selectedFile:s.uploadInstance.getSelectedFile(n)},scopedSlots:s._u([{key:"default",fn:function(o){return[t("layout-info",{staticClass:"item-info-container",attrs:{slotProps:o}})]}}],null,!0)})})},proxy:!0}],null,!0)})},ht=[];const ne={};var pt=$(ct,dt,ht,!1,gt,null,null,null);function gt(s){for(let e in ne)this[e]=ne[e]}const ft=function(){return pt.exports}(),Ft=v.defineComponent({name:"DropFileInput",components:{FileInput:ue},inject:["upload"],computed:{uploadInstance(){return this.upload()}},created(){this.uploadInstance.getSettings().debug&&console.debug("Piece: Drop File Input Component(vue2) \u5DF2\u52A0\u8F7D")},methods:{allowDrop(s){s.preventDefault()},dropFile(s){if(s.preventDefault(),s.dataTransfer)for(let e=0;e<s.dataTransfer.files.length;e++)this.uploadInstance.append(s.dataTransfer.files[e])}}});var mt=function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("div",{class:s.uploadInstance.getSelectCLass(),attrs:{title:s.uploadInstance.getSelectFileAlarmInfo()},on:{drop:s.dropFile,dragover:s.allowDrop}},[t("file-input",[s._t("default")],2)],1)},bt=[];const ie={};var yt=$(Ft,mt,bt,!1,Dt,null,null,null);function Dt(s){for(let e in ie)this[e]=ie[e]}const Ct=function(){return yt.exports}();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 C.\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 C.\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 C.\u89C6\u9891;case".xls":case".xlsx":case".csv":return C.\u7535\u5B50\u8868\u683C;case".pdf":case".doc":case".docx":return C.\u7535\u5B50\u6587\u6863;case".txt":case".js":case".css":case".cs":case".html":case".vue":case".ts":case".xml":case".json":return C.\u6587\u672C\u6587\u4EF6;case".zip":case".rar":case".7z":return C.\u538B\u7F29\u5305;default:return C.\u672A\u77E5}}static getByMIME(e){const t=e.toLocaleLowerCase();if(t.indexOf("image/",0)!=-1)return C.\u56FE\u7247;if(t.indexOf("audio/",0)!=-1)return C.\u97F3\u9891;if(t.indexOf("video/",0)!=-1)return C.\u89C6\u9891;if(t.indexOf("text/",0)!=-1)return C.\u6587\u672C\u6587\u4EF6;switch(e){case"application/ogg":return C.\u97F3\u9891;case"application/mp4":return C.\u89C6\u9891;case"application/vnd.ms-excel":case"vnd.openxmlformats-officedocument.spreadsheetml.sheet":return C.\u7535\u5B50\u8868\u683C;case"application/pdf":case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return C.\u7535\u5B50\u6587\u6863;case"application/json":case"application/javascript":return C.\u6587\u672C\u6587\u4EF6;case"application/x-tar":case"application/zip":case"application/x-compressed":case"application/x-zip-compressed":return C.\u538B\u7F29\u5305;default:return C.\u672A\u77E5}}}class X{constructor(e){c(this,"rawIndex");c(this,"name");c(this,"newName");c(this,"extension");c(this,"fullname",()=>{var e,t;return`${(e=this.name)!=null?e:""}${(t=this.extension)!=null?t:""}`});c(this,"extensionLower");c(this,"size","");c(this,"fileType",C.\u672A\u77E5);c(this,"thumbnail","/filetypes/empty.png");c(this,"class",[]);c(this,"checking",!1);c(this,"checked",!1);c(this,"uploading",!1);c(this,"uploaded",!1);c(this,"done",!1);c(this,"reTry",0);c(this,"error",!1);c(this,"errorMessage");c(this,"percent",0);c(this,"virtualPercent",0);c(this,"percentBeforPaused",0);c(this,"virtualPercentBeforPaused",0);c(this,"paused",!1);c(this,"canceled",!1);c(this,"token");c(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 H{constructor(){c(this,"containerEl");c(this,"el");c(this,"key",-1);c(this,"els");c(this,"isMobile",!1);c(this,"flag",!1);c(this,"x",0);c(this,"y",0);c(this,"currentX",0);c(this,"currentY",0);c(this,"offsetX",0);c(this,"offsetY",0);c(this,"scrollX",0);c(this,"scrollY",0);c(this,"transX",0);c(this,"transY",0);c(this,"lastTransX",0);c(this,"lastTransY",0);c(this,"zIndex","");c(this,"position","");c(this,"transform","");c(this,"transLate",1);c(this,"restoreError",[20,10]);c(this,"mouseMove");c(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 H.equalError(this.x,this.currentX,this.restoreError[0])&&H.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,o){let u=new H;return u.els=t,u.el=t.get(n),u.key=n,u.containerEl=e,u.isMobile=o,u}start(e,t,n){this.flag=!0,this.currentX=e,this.currentY=t,this.save(),this.el.style.zIndex="999";let o=!1;this.mouseMove=u=>{if(!this.flag||o)return;const a=this.isMobile?u.targetTouches[0].clientX:u.clientX,p=this.isMobile?u.targetTouches[0].clientY:u.clientY;if(u.preventDefault(),o=!0,this.moving(a,p),n&&this.els){let g=!1;this.els.forEach((F,y)=>{if(y==this.key)return;const m=this.el.offsetTop+this.transY,b=this.el.offsetLeft+this.transX;m>F.offsetTop&&m<F.offsetTop+F.offsetHeight&&b>F.offsetLeft&&b<F.offsetLeft+F.offsetWidth&&(n(y,a,p),g=!0)}),g||n(-1,a,p)}o=!1},this.isMobile?this.containerEl.addEventListener("touchmove",this.mouseMove):this.containerEl.addEventListener("mousemove",this.mouseMove),this.scroll=u=>{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 wt=v.defineComponent({name:"MultipleUpload",components:{DropFileInput:Ct,SelectedFileInfo:oe,LayoutIndex:le,LayoutInfo:ce,SelectedFile:X},inject:["upload"],computed:{uploadInstance(){return this.upload()}},data(){return{renderData:{scrollLock:!1,readyDraggingSortKey:null,currentDraggingSortKey:null,lastDraggingSortKey:null,errors:[],containerRefMap:new Map,drag4sort:{startTick:null,changeTick:null,draggingHelper:null},selectedFileSortMapSize:0}}},created(){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u5DF2\u52A0\u8F7D")},mounted(){this.uploadInstance.registerSelectedFileSortMapChanged(e=>{this.renderData.selectedFileSortMapSize=e.size}),this.uploadInstance.registerSelectedFileListChanged(this.scroll);const s=e=>{this.renderData.errors.push(e.message),setTimeout(()=>{this.renderData.errors.shift()},5e3)};this.uploadInstance.getSettings().alertErrorInfo&&this.uploadInstance.registerAlertError(s)},methods:{listContainerRef(){return this.$refs.listContainerRef.$el},scroll(s){const e=this.listContainerRef();this.renderData.scrollLock||s.length==0||!e||this.$nextTick(()=>{let t=null,n=!1;for(let u=0;u<s.length;u++){let a=s[u];if(!n&&a.checking&&(n=!0,t=this.renderData.containerRefMap.get(u+1)),a.uploading){t=this.renderData.containerRefMap.get(u+1);break}}if(!t)return;const o=t.offsetTop-e.offsetTop-20;o<0||o==e.scrollTop||(e.scrollTop=o)})},setContainerRef(s,e){!e||this.renderData.containerRefMap.set(s,e)},containerMouseDown(s,e,t){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u6309\u4E0B\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: "+s);const n=t?e.targetTouches[0].clientX:e.clientX,o=t?e.targetTouches[0].clientY:e.clientY;this.ready2start(s,n,o)},containerMouseUp(s,e,t){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u677E\u5F00\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: "+s),this.end()},containerMouseEnter(s){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u8FDB\u5165\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6, targetKey: "+s),this.renderData.lastDraggingSortKey=s,this.renderData.currentDraggingSortKey!==this.renderData.lastDraggingSortKey&&(this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u5EF6\u65F6\u91CD\u65B0\u6392\u5E8F, sortKey: "+s),this.renderData.drag4sort.changeTick&&clearTimeout(this.renderData.drag4sort.changeTick),this.renderData.drag4sort.changeTick=setTimeout(this.changeSort,this.uploadInstance.getSettings().dragChangePositionTime))},changeSort(){const s=this.renderData.currentDraggingSortKey,e=this.renderData.lastDraggingSortKey;this.uploadInstance.changeSort(s,e);const t=this.renderData.containerRefMap.get(s);if(s>e)for(let n=s;n>e;n--)setInterval(()=>{},100),this.renderData.containerRefMap.set(n,this.renderData.containerRefMap.get(n-1));else for(let n=s;n<e;n++)this.renderData.containerRefMap.set(n,this.renderData.containerRefMap.get(n+1));this.renderData.containerRefMap.set(e,t),this.end()},containerMouseLeave(){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u79BB\u5F00\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6"),this.cancelChange()},ready2start(s,e,t){if(!this.uploadInstance.getSettings().enableDrag){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u672A\u542F\u7528\u62D6\u52A8\u6392\u5E8F\u529F\u80FD");return}this.uploadInstance.getSelectedFileList(!1).length<=1||(this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u5EF6\u65F6\u5F00\u542F\u62D6\u52A8\u529F\u80FD, sortKey: "+s),this.renderData.drag4sort.startTick&&clearTimeout(this.renderData.drag4sort.startTick),this.renderData.drag4sort.startTick=setTimeout(()=>{this.renderData.readyDraggingSortKey=s,this.renderData.drag4sort.startTick=setTimeout(()=>{!this.listContainerRef()||(this.renderData.readyDraggingSortKey=null,this.renderData.currentDraggingSortKey=s,this.renderData.drag4sort.draggingHelper=H.getInstance(this.listContainerRef(),this.renderData.containerRefMap,this.renderData.currentDraggingSortKey,this.uploadInstance.getSettings().isMobile),this.renderData.drag4sort.draggingHelper.start(e,t,(n,o,u)=>{this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u9F20\u6807\u79FB\u52A8\u4E8B\u4EF6, sortKey: "+s+", clientX: "+o+", clientY: "+u+", targetKey: "+n),n==-1?this.containerMouseLeave():this.containerMouseEnter(n)}))},this.uploadInstance.getSettings().dragPreparationTime)},500))},cancelChange(){this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u53D6\u6D88\u91CD\u65B0\u6392\u5E8F"),this.renderData.drag4sort.changeTick&&clearTimeout(this.renderData.drag4sort.changeTick),this.renderData.lastDraggingSortKey=null},end(){this.renderData.drag4sort.startTick&&clearTimeout(this.renderData.drag4sort.startTick),this.renderData.drag4sort.changeTick&&clearTimeout(this.renderData.drag4sort.changeTick),this.renderData.readyDraggingSortKey=null,this.renderData.drag4sort.draggingHelper&&(this.uploadInstance.getSettings().debug&&console.debug("Piece: Multiple Upload Component(vue2) \u7ED3\u675F\u62D6\u52A8\u5E76\u590D\u539F\u5BB9\u5668\u4F4D\u7F6E"),this.renderData.drag4sort.draggingHelper.end(!0),this.renderData.drag4sort.draggingHelper=null,this.renderData.containerRefMap.forEach((s,e)=>{e!==this.renderData.lastDraggingSortKey&&(s.style.zIndex="")}),this.renderData.lastDraggingSortKey=null,this.renderData.currentDraggingSortKey=null)}}});var vt=function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("layout-index",{scopedSlots:s._u([s.uploadInstance.getSettings().readonly?null:{key:"uploadContainer",fn:function(){return[t("drop-file-input",{staticClass:"upload-box-container"},[t("p",{staticClass:"upload-icon icon-inbox"}),t("p",{staticClass:"upload-text",domProps:{innerHTML:s._s(s.uploadInstance.getConfig().explain)}}),t("p",{staticClass:"upload-hint",domProps:{innerHTML:s._s(s.uploadInstance.getSettings().tip)}}),t("div",{staticClass:"upload-error-list pretty-scrollbar"},s._l(s.renderData.errors,function(n,o){return t("p",{key:o,staticClass:"error-info"},[s._v(" "+s._s(n)+" ")])}),0)])]},proxy:!0},{key:"listContainer",fn:function(){return[t("TransitionGroup",{ref:"listContainerRef",staticClass:"scroll-container pretty-scrollbar",attrs:{tag:"div",name:"fade"},on:{mouseenter:function(n){s.renderData.scrollLock=!0},mouseleave:function(n){s.renderData.scrollLock=!1}}},s._l(s.renderData.selectedFileSortMapSize,function(n){return t("selected-file-info",{key:s.uploadInstance.getSelectedFileSortMap().get(n),attrs:{selectedFile:s.uploadInstance.getSelectedFile(n),readyDrag:s.renderData.readyDraggingSortKey===n,startDrag:s.renderData.currentDraggingSortKey!==null,dragging:s.renderData.currentDraggingSortKey===n,dragover:s.renderData.lastDraggingSortKey===n&&s.renderData.currentDraggingSortKey!==n},on:{setContainerRef:function(o){return s.setContainerRef(n,o)},mouseDown:function(o){return s.containerMouseDown(n,o,!1)},mouseUp:function(o){return s.containerMouseUp(n,o,!1)}},nativeOn:{touchstart:function(o){return o.preventDefault(),function(u){return s.containerMouseDown(n,u,!0)}.apply(null,arguments)},touchend:function(o){return o.preventDefault(),function(u){return s.containerMouseUp(n,u,!0)}.apply(null,arguments)},touchcancel:function(o){return o.preventDefault(),function(u){return s.containerMouseUp(n,u,!0)}.apply(null,arguments)}},scopedSlots:s._u([{key:"default",fn:function(o){return[t("layout-info",{staticClass:"item-info-container",attrs:{slotProps:o}})]}}],null,!0)})}),1)]},proxy:!0}],null,!0)})},Et=[];const re={};var _t=$(wt,vt,Et,!1,St,null,null,null);function St(s){for(let e in re)this[e]=re[e]}const kt=function(){return _t.exports}();class w extends Error{constructor(t,n){super(t);c(this,"innerError");this.innerError=n}static consoleWriteWithIndex(t,n){console.error(`\u7B2C${n}\u5C42\u9519\u8BEF`,t),t instanceof w&&t.innerError&&w.consoleWriteWithIndex(t.innerError,++n)}static consoleWrite(t){w.consoleWriteWithIndex(t,1)}}class z{constructor(e){c(this,"file");c(this,"size",0);c(this,"checkPosition",0);c(this,"uploadPosition",0);c(this,"objectURL");c(this,"md5",null);c(this,"extension");c(this,"name");c(this,"needSection",!1);c(this,"specs");c(this,"key");c(this,"chunks",[]);c(this,"chunkIndexQueue",[]);c(this,"userFileInfo");c(this,"configCode");c(this,"token");c(this,"echo",!1);e!=null&&(this.file=e,this.size=e.size,this.objectURL=URL.createObjectURL(e))}}class k{static s4(){return((1+Math.random())*65536|0).toString(16).substring(1)}static new(){return`${k.s4()}${k.s4()}-${k.s4()}-${k.s4()}-${k.s4()}-${k.s4()}${k.s4()}${k.s4()}`}}const U=class{static getSize(e,t=1024,n=2){if(e<=0)return"0 KB";for(let o=0;o<U.formats.length;o++){let u=e/Math.pow(t,o+1);if(u<t)return`${u.toFixed(n)} ${U.formats[o]}`}return`${(e/Math.pow(t,U.formats.length)).toFixed(n)} ${U.formats[U.formats.length-1]}`}};let B=U;c(B,"formats",["KB","MB","GB","TB","PB","EB","ZB","YB"]);class de{constructor(e,t){c(this,"index");c(this,"blob");c(this,"size");c(this,"checkPosition",0);c(this,"md5",null);c(this,"forced",!1);c(this,"checking",!1);c(this,"checked",!1);c(this,"uploading",!1);c(this,"uploaded",!1);c(this,"done",!1);c(this,"error",!1);c(this,"errorMessage");this.index=e,this.blob=t,this.size=t.size}}const $t=()=>{let s=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function e(f,h){let i=f[0],r=f[1],d=f[2],l=f[3];i+=(r&d|~r&l)+h[0]-680876936|0,i=(i<<7|i>>>25)+r|0,l+=(i&r|~i&d)+h[1]-389564586|0,l=(l<<12|l>>>20)+i|0,d+=(l&i|~l&r)+h[2]+606105819|0,d=(d<<17|d>>>15)+l|0,r+=(d&l|~d&i)+h[3]-1044525330|0,r=(r<<22|r>>>10)+d|0,i+=(r&d|~r&l)+h[4]-176418897|0,i=(i<<7|i>>>25)+r|0,l+=(i&r|~i&d)+h[5]+1200080426|0,l=(l<<12|l>>>20)+i|0,d+=(l&i|~l&r)+h[6]-1473231341|0,d=(d<<17|d>>>15)+l|0,r+=(d&l|~d&i)+h[7]-45705983|0,r=(r<<22|r>>>10)+d|0,i+=(r&d|~r&l)+h[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,l+=(i&r|~i&d)+h[9]-1958414417|0,l=(l<<12|l>>>20)+i|0,d+=(l&i|~l&r)+h[10]-42063|0,d=(d<<17|d>>>15)+l|0,r+=(d&l|~d&i)+h[11]-1990404162|0,r=(r<<22|r>>>10)+d|0,i+=(r&d|~r&l)+h[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,l+=(i&r|~i&d)+h[13]-40341101|0,l=(l<<12|l>>>20)+i|0,d+=(l&i|~l&r)+h[14]-1502002290|0,d=(d<<17|d>>>15)+l|0,r+=(d&l|~d&i)+h[15]+1236535329|0,r=(r<<22|r>>>10)+d|0,i+=(r&l|d&~l)+h[1]-165796510|0,i=(i<<5|i>>>27)+r|0,l+=(i&d|r&~d)+h[6]-1069501632|0,l=(l<<9|l>>>23)+i|0,d+=(l&r|i&~r)+h[11]+643717713|0,d=(d<<14|d>>>18)+l|0,r+=(d&i|l&~i)+h[0]-373897302|0,r=(r<<20|r>>>12)+d|0,i+=(r&l|d&~l)+h[5]-701558691|0,i=(i<<5|i>>>27)+r|0,l+=(i&d|r&~d)+h[10]+38016083|0,l=(l<<9|l>>>23)+i|0,d+=(l&r|i&~r)+h[15]-660478335|0,d=(d<<14|d>>>18)+l|0,r+=(d&i|l&~i)+h[4]-405537848|0,r=(r<<20|r>>>12)+d|0,i+=(r&l|d&~l)+h[9]+568446438|0,i=(i<<5|i>>>27)+r|0,l+=(i&d|r&~d)+h[14]-1019803690|0,l=(l<<9|l>>>23)+i|0,d+=(l&r|i&~r)+h[3]-187363961|0,d=(d<<14|d>>>18)+l|0,r+=(d&i|l&~i)+h[8]+1163531501|0,r=(r<<20|r>>>12)+d|0,i+=(r&l|d&~l)+h[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,l+=(i&d|r&~d)+h[2]-51403784|0,l=(l<<9|l>>>23)+i|0,d+=(l&r|i&~r)+h[7]+1735328473|0,d=(d<<14|d>>>18)+l|0,r+=(d&i|l&~i)+h[12]-1926607734|0,r=(r<<20|r>>>12)+d|0,i+=(r^d^l)+h[5]-378558|0,i=(i<<4|i>>>28)+r|0,l+=(i^r^d)+h[8]-2022574463|0,l=(l<<11|l>>>21)+i|0,d+=(l^i^r)+h[11]+1839030562|0,d=(d<<16|d>>>16)+l|0,r+=(d^l^i)+h[14]-35309556|0,r=(r<<23|r>>>9)+d|0,i+=(r^d^l)+h[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,l+=(i^r^d)+h[4]+1272893353|0,l=(l<<11|l>>>21)+i|0,d+=(l^i^r)+h[7]-155497632|0,d=(d<<16|d>>>16)+l|0,r+=(d^l^i)+h[10]-1094730640|0,r=(r<<23|r>>>9)+d|0,i+=(r^d^l)+h[13]+681279174|0,i=(i<<4|i>>>28)+r|0,l+=(i^r^d)+h[0]-358537222|0,l=(l<<11|l>>>21)+i|0,d+=(l^i^r)+h[3]-722521979|0,d=(d<<16|d>>>16)+l|0,r+=(d^l^i)+h[6]+76029189|0,r=(r<<23|r>>>9)+d|0,i+=(r^d^l)+h[9]-640364487|0,i=(i<<4|i>>>28)+r|0,l+=(i^r^d)+h[12]-421815835|0,l=(l<<11|l>>>21)+i|0,d+=(l^i^r)+h[15]+530742520|0,d=(d<<16|d>>>16)+l|0,r+=(d^l^i)+h[2]-995338651|0,r=(r<<23|r>>>9)+d|0,i+=(d^(r|~l))+h[0]-198630844|0,i=(i<<6|i>>>26)+r|0,l+=(r^(i|~d))+h[7]+1126891415|0,l=(l<<10|l>>>22)+i|0,d+=(i^(l|~r))+h[14]-1416354905|0,d=(d<<15|d>>>17)+l|0,r+=(l^(d|~i))+h[5]-57434055|0,r=(r<<21|r>>>11)+d|0,i+=(d^(r|~l))+h[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,l+=(r^(i|~d))+h[3]-1894986606|0,l=(l<<10|l>>>22)+i|0,d+=(i^(l|~r))+h[10]-1051523|0,d=(d<<15|d>>>17)+l|0,r+=(l^(d|~i))+h[1]-2054922799|0,r=(r<<21|r>>>11)+d|0,i+=(d^(r|~l))+h[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,l+=(r^(i|~d))+h[15]-30611744|0,l=(l<<10|l>>>22)+i|0,d+=(i^(l|~r))+h[6]-1560198380|0,d=(d<<15|d>>>17)+l|0,r+=(l^(d|~i))+h[13]+1309151649|0,r=(r<<21|r>>>11)+d|0,i+=(d^(r|~l))+h[4]-145523070|0,i=(i<<6|i>>>26)+r|0,l+=(r^(i|~d))+h[11]-1120210379|0,l=(l<<10|l>>>22)+i|0,d+=(i^(l|~r))+h[2]+718787259|0,d=(d<<15|d>>>17)+l|0,r+=(l^(d|~i))+h[9]-343485551|0,r=(r<<21|r>>>11)+d|0,f[0]=i+f[0]|0,f[1]=r+f[1]|0,f[2]=d+f[2]|0,f[3]=l+f[3]|0}function t(f){let h=[],i;for(i=0;i<64;i+=4)h[i>>2]=f.charCodeAt(i)+(f.charCodeAt(i+1)<<8)+(f.charCodeAt(i+2)<<16)+(f.charCodeAt(i+3)<<24);return h}function n(f){let h=[],i;for(i=0;i<64;i+=4)h[i>>2]=f[i]+(f[i+1]<<8)+(f[i+2]<<16)+(f[i+3]<<24);return h}function o(f){let h=f.length,i=[1732584193,-271733879,-1732584194,271733878],r,d,l,E,I,L;for(r=64;r<=h;r+=64)e(i,t(f.substring(r-64,r)));for(f=f.substring(r-64),d=f.length,l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<d;r+=1)l[r>>2]|=f.charCodeAt(r)<<(r%4<<3);if(l[r>>2]|=128<<(r%4<<3),r>55)for(e(i,l),r=0;r<16;r+=1)l[r]=0;return E=h*8,E=E.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(E[2],16),L=parseInt(E[1],16)||0,l[14]=I,l[15]=L,e(i,l),i}function u(f){let h=f.length,i=[1732584193,-271733879,-1732584194,271733878],r,d,l,E,I,L;for(r=64;r<=h;r+=64)e(i,n(f.subarray(r-64,r)));for(f=r-64<h?f.subarray(r-64):new Uint8Array(0),d=f.length,l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<d;r+=1)l[r>>2]|=f[r]<<(r%4<<3);if(l[r>>2]|=128<<(r%4<<3),r>55)for(e(i,l),r=0;r<16;r+=1)l[r]=0;return E=h*8,E=E.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(E[2],16),L=parseInt(E[1],16)||0,l[14]=I,l[15]=L,e(i,l),i}function a(f){let h="",i;for(i=0;i<4;i+=1)h+=s[f>>i*8+4&15]+s[f>>i*8&15];return h}function p(f){let h;for(h=0;h<f.length;h+=1)f[h]=a(f[h]);return f.join("")}p(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function f(h,i){return h=h|0||0,h<0?Math.max(h+i,0):Math.min(h,i)}ArrayBuffer.prototype.slice=function(h,i){let r=this.byteLength,d=f(h,r),l=r,E,I,L,q;return i!==void 0&&(l=f(i,r)),d>l?new ArrayBuffer(0):(E=l-d,I=new ArrayBuffer(E),L=new Uint8Array(I),q=new Uint8Array(this,d,E),L.set(q),I)}}();function g(f){return/[\u0080-\uFFFF]/.test(f)&&(f=unescape(encodeURIComponent(f))),f}function F(f,h){let i=f.length,r=new ArrayBuffer(i),d=new Uint8Array(r),l;for(l=0;l<i;l+=1)d[l]=f.charCodeAt(l);return h?d:r}function y(f){return String.fromCharCode.apply(null,new Uint8Array(f))}function m(f,h,i){let r=new Uint8Array(f.byteLength+h.byteLength);return r.set(new Uint8Array(f)),r.set(new Uint8Array(h),f.byteLength),i?r:r.buffer}function b(f){let h=[],i=f.length,r;for(r=0;r<i-1;r+=2)h.push(parseInt(f.substr(r,2),16));return String.fromCharCode.apply(String,h)}function D(){this.reset()}D.prototype.append=function(f){return this.appendBinary(g(f)),this},D.prototype.appendBinary=function(f){this._buff+=f,this._length+=f.length;let h=this._buff.length,i;for(i=64;i<=h;i+=64)e(this._hash,t(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},D.prototype.end=function(f){let h=this._buff,i=h.length,r,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],l;for(r=0;r<i;r+=1)d[r>>2]|=h.charCodeAt(r)<<(r%4<<3);return this._finish(d,i),l=p(this._hash),f&&(l=b(l)),this.reset(),l},D.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},D.prototype.setState=function(f){return this._buff=f.buff,this._length=f.length,this._hash=f.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(f,h){let i=h,r,d,l;if(f[i>>2]|=128<<(i%4<<3),i>55)for(e(this._hash,f),i=0;i<16;i+=1)f[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(r[2],16),l=parseInt(r[1],16)||0,f[14]=d,f[15]=l,e(this._hash,f)},D.hash=function(f,h){return D.hashBinary(g(f),h)},D.hashBinary=function(f,h){let i=o(f),r=p(i);return h?b(r):r},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(f){let h=m(this._buff.buffer,f,!0),i=h.length,r;for(this._length+=f.byteLength,r=64;r<=i;r+=64)e(this._hash,n(h.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(h.buffer.slice(r-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(f){let h=this._buff,i=h.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d,l;for(d=0;d<i;d+=1)r[d>>2]|=h[d]<<(d%4<<3);return this._finish(r,i),l=p(this._hash),f&&(l=b(l)),this.reset(),l},D.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.ArrayBuffer.prototype.getState=function(){let f=D.prototype.getState.call(this);return f.buff=y(f.buff),f},D.ArrayBuffer.prototype.setState=function(f){return f.buff=F(f.buff,!0),D.prototype.setState.call(this,f)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(f,h){let i=u(new Uint8Array(f)),r=p(i);return h?b(r):r};const S=new D.ArrayBuffer;onmessage=f=>{switch(f.data.type){case"DOWN_APPEND_DATA":const h=f.data.data;S.append(h);break;case"DOWN_GET_RESULT":postMessage(JSON.parse(JSON.stringify({type:"UP_RESULT",data:S.end(!1)})));return;case"DOWN_RESET":S.reset();break;case"DOWN_CLOSE":close();break}postMessage(JSON.parse(JSON.stringify({type:"UP_ACK"})))}},he=new Blob([`(${$t.toString()})()`]);class Y{constructor(){c(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=o=>{const u=o.target.result;t(u)},this.Reader.onerror=o=>{n(o)},this.Reader.readAsArrayBuffer(e)})}close(){this.Reader.abort()}}var P=(s=>(s.\u4E0B\u884C_\u9644\u52A0\u6570\u636E="DOWN_APPEND_DATA",s.\u4E0B\u884C_\u83B7\u53D6\u7ED3\u679C="DOWN_GET_RESULT",s.\u4E0B\u884C_\u91CD\u7F6E="DOWN_RESET",s.\u4E0B\u884C_\u5173\u95ED="DOWN_CLOSE",s.\u4E0A\u884C_\u5E94\u7B54="UP_ACK",s.\u4E0A\u884C_\u7ED3\u679C="UP_RESULT",s))(P||{});class Q{constructor(e,t){c(this,"enableWorker");c(this,"workerSupported");c(this,"debug");c(this,"sparkUnits",[]);c(this,"workerUnits",[]);c(this,"chunkHandlerQueue",[]);c(this,"chunkHandler",[]);c(this,"finished",!1);c(this,"canceled",!1);c(this,"paused",!1);c(this,"waitToContinue",[]);c(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(o,u)=>{const a=e;e instanceof z&&(a.blob=a.file);let p={preLoaded:0,loaded:0,total:e.size};n(p);const g=1024*1024;for(;a.checkPosition<a.size;){if(this.canceled){await this.reset(),o();break}if(this.paused){const y=async()=>new Promise((b,D)=>{this.waitToContinue[t]=b});this.debug&&console.debug("HashHelper > \u5DF2\u6682\u505C",t);const m=await y();if(this.waitToContinue[t]=null,this.debug&&console.debug("HashHelper > \u5DF2\u6062\u590D",t),!m){o();return}}const F=a.blob.slice(a.checkPosition,Math.min(a.checkPosition+g,a.size));a.checkPosition+=F.size,p.preLoaded+=F.size,n(p),await this.appendData(F,t),p.loaded+=F.size,n(p)}o(aw