UNPKG

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

1,149 lines 107 kB
var Ce = Object.defineProperty; var ke = (f, e, t) => e in f ? Ce(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t; var c = (f, e, t) => (ke(f, typeof e != "symbol" ? e + "" : e, t), t); import { defineComponent as P, openBlock as E, createElementBlock as A, unref as w, createElementVNode as _, withModifiers as De, renderSlot as I, normalizeClass as de, normalizeStyle as re, createCommentVNode as L, createBlock as W, resolveDynamicComponent as ae, withCtx as T, Fragment as Z, withDirectives as he, vModelText as ge, createTextVNode as se, createSlots as pe, renderList as ie, createVNode as K, TransitionGroup as Se, toDisplayString as Ae } from "vue"; import { inject as H, reactive as O, getCurrentInstance as fe, shallowRef as N, watch as ne, provide as Be } from "vue-demi"; import _e from "spark-md5"; var q = /* @__PURE__ */ ((f) => (f.\u5168\u81EA\u52A8 = "AT", f.\u624B\u52A8\u6321 = "MT", f.\u534A\u81EA\u52A8 = "AMT", f))(q || {}), X = /* @__PURE__ */ ((f) => (f.\u5361\u7247 = "Card", f.\u6E05\u5355 = "Detailedly", f))(X || {}); class $ { constructor(e, t, n, a) { 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 = a; } static convertFrom(e) { return new $(e.r, e.g, e.b, e.a); } } const te = 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", X.\u5361\u7247); c(this, "runMode", q.\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, 0.5)); c(this, "statusUploadingColor", new $(144, 206, 255, 0.5)); c(this, "statusPausedColor", new $(158, 158, 158, 0.5)); c(this, "statusPausedSubColor", new $(244, 154, 3, 0.5)); c(this, "statusDoneColor", new $(76, 175, 80, 0.1)); c(this, "statusDoneSubColor", new $(3, 169, 244, 0.5)); c(this, "statusErrorColor", new $(255, 0, 30, 0.35)); c(this, "statusErrorSubColor", new $(232, 31, 31, 0.5)); c(this, "dragReadyColor", new $(255, 152, 0, 0.8)); c(this, "dragMovingColor", new $(255, 152, 0, 0.5)); c(this, "dragOverColor", new $(255, 87, 34, 0.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 Y = te; c(Y, "default", () => new te()), c(Y, "defaultWithConfigCode", (e) => new te().setup((t) => t.configCode = e)); const Le = ["title"], ve = ["multiple", "accept"], $e = { class: "upload-box-content" }, Fe = /* @__PURE__ */ P({ __name: "FileInput.vue3", setup(f) { const e = H("upload")(); O({}); let t; const n = (l) => { l && (t = l); }, a = (l) => { e.limited() || t == null || t.click(); }, u = (l) => { if (t && t.files) for (let g = 0; g < t.files.length; g++) e.append(t.files[g]); t && (t.value = ""); }; return (async () => e.getSettings().debug && console.debug("Piece: File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(), (l, g) => (E(), A("div", { class: "upload-btn", onClick: a, title: w(e).getSettings().tip }, [ _("div", { onClick: g[0] || (g[0] = De(() => { }, ["stop"])) }, [ _("input", { type: "file", multiple: w(e).getConfig().upperLimit > 1, ref: n, accept: w(e).getAllowedTypes(), onChange: u }, null, 40, ve) ]), _("div", $e, [ I(l.$slots, "default") ]) ], 8, Le)); } }); var C = /* @__PURE__ */ ((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))(C || {}); const Ue = ["title"], Te = { key: 0, class: "item-body" }, Pe = { class: "item-image" }, Me = ["src", "alt"], xe = { key: 0, class: "item-tools" }, He = { key: 1, class: "item-sub sub-paused" }, Ie = { key: 2, class: "item-sub sub-done" }, Oe = { key: 3, class: "item-sub sub-error" }, be = /* @__PURE__ */ P({ __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 } = fe(), a = H("upload")(); let u = O({ hover: !1, container: { style: () => `item-container ${t.selectedFile.done && !a.getSettings().readonly ? " item-done" : ""} ${t.selectedFile.error ? " item-error" : ""} ${u.hover && !u.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": a.getSettings().statusCheckingColor.toString(), "--statusUploadingColor": a.getSettings().statusUploadingColor.toString(), "--statusPausedColor": a.getSettings().statusPausedColor.toString(), "--statusPausedSubColor": a.getSettings().statusPausedSubColor.toString(), "--statusDoneColor": a.getSettings().statusDoneColor.toString(), "--statusDoneSubColor": a.getSettings().statusDoneSubColor.toString(), "--statusErrorColor": a.getSettings().statusErrorColor.toString(), "--statusErrorSubColor": a.getSettings().statusErrorSubColor.toString(), "--dragPreparationTime": `${(a.getSettings().dragPreparationTime / 1e3).toFixed(2)}s`, "--dragChangePositionTime": `${(a.getSettings().dragChangePositionTime / 1e3).toFixed(2)}s`, "--dragReadyColor": a.getSettings().dragReadyColor.toString(), "--dragMovingColor": a.getSettings().dragMovingColor.toString(), "--dragOverColor": a.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: () => !u.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: () => u.hover && t.dragging === !1 && !u.rename.active && !t.selectedFile.checking && !t.selectedFile.uploading }, rename: { enable: () => !t.selectedFile.uploading, active: !1, value: "" }, view: { enable: () => { switch (t.selectedFile.fileType) { case C.\u56FE\u7247: case C.\u97F3\u9891: return t.selectedFile.extensionLower !== ".flac"; case C.\u89C6\u9891: return !0; case C.\u6587\u672C\u6587\u4EF6: return !0; case C.\u7535\u5B50\u6587\u6863: return t.selectedFile.extensionLower === ".pdf" || t.selectedFile.extensionLower === ".doc" || t.selectedFile.extensionLower === ".docx"; default: return !1; } } }, save: { enable: () => !0 } }), l; const g = (o) => { o && e("setContainerRef", o); }, p = (o) => { o && (l = o); }, k = (o) => { t.readyDrag || t.startDrag ? (e("mouseEnter", o), u.hover = !1) : u.hover = !0; }, b = (o) => { (t.readyDrag || t.startDrag) && e("mouseLeave", o), u.hover = !1; }, y = (o) => { e("mouseDown", o); }, m = (o) => { e("mouseUp", o); }, F = () => { u.rename.active = !0, n.$nextTick(() => { l && l.focus(); }); }, D = (o) => { o.key == "Enter" && h(); }, h = () => { a.rename(t.selectedFile.token, u.rename.value).then(() => { u.rename.active = !1; }).catch(() => { u.rename.active = !1; }); }, d = () => { const o = a.getRawFile(t.selectedFile), r = "margin:0px;text-align: center;display: flex;flex-direction: row;justify-content: center;align-items: center"; switch (t.selectedFile.fileType) { case C.\u56FE\u7247: let B = window.open(); B == null || B.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${r};background-color: black;"><img style="max-width: 100%;max-height: 100%;" src="${o.objectURL}" alt="${t.selectedFile.fullname()}"></body>` ); break; case C.\u97F3\u9891: if (t.selectedFile.extensionLower === ".flac") return; let v = window.open(); v == null || v.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${r};background-color: black;"><audio style="max-width: 100%;max-height: 100%;" src="${o.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</audio></body>` ); break; case C.\u89C6\u9891: let U = window.open(); U == null || U.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${r};background-color: black;"><video style="max-width: 100%;max-height: 100%;" src="${o.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</video></body>` ); break; default: let Q = window.open(); Q == null || Q.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${r};"><object style="max-width: 100%;max-height: 100%;" data="${o.objectURL}" type="${t.selectedFile.extensionLower === ".txt" ? "text/plain" : t.selectedFile.extensionLower === ".pdf" ? "application/pdf" : "application/octet-stream"}" width="100%" height="100%"><iframe src="${o.objectURL}" width="100%" height="100%" ></iframe></object></body>` ); break; } }, s = () => { const o = a.getRawFile(t.selectedFile), r = document.createElement("a"); r.style.display = "none", r.href = a.getDownloadUrl(t.selectedFile), o.file && (r.download = t.selectedFile.fullname()), document.body.appendChild(r), r.click(), document.body.removeChild(r); }, i = () => { a.remove(t.selectedFile.token); }; return (async () => a.getSettings().debug && console.debug("Piece: Selected File Info Component(vue3) \u5DF2\u52A0\u8F7D"))(), (o, r) => (E(), A("div", { class: de(w(u).container.style()), style: re(w(u).container.styleVar()), title: w(u).container.info(), onMouseenter: k, onMouseleave: b, onMousedown: y, onMouseup: m, onTouchstart: y, onTouchend: m, onTouchcancel: m, ref: g }, [ t.selectedFile.canceled ? L("", !0) : (E(), A("div", Te, [ _("div", Pe, [ _("img", { src: t.selectedFile.thumbnail, loading: "lazy", alt: t.selectedFile.fullname() }, null, 8, Me) ]), w(u).tools.show() ? (E(), A("span", xe, [ w(u).rename.enable() && !w(a).getSettings().readonly ? (E(), A("span", { key: 0, class: "upload-icon icon-rename", title: "\u91CD\u547D\u540D", onClick: r[0] || (r[0] = (B) => F()) })) : L("", !0), w(u).view.enable() ? (E(), A("span", { key: 1, class: "upload-icon icon-view", title: "\u67E5\u770B", onClick: r[1] || (r[1] = (B) => d()) })) : L("", !0), w(u).save.enable() ? (E(), A("span", { key: 2, class: "upload-icon icon-download", title: "\u4FDD\u5B58", onClick: r[2] || (r[2] = (B) => s()) })) : L("", !0), w(a).getSettings().readonly ? L("", !0) : (E(), A("span", { key: 3, class: "upload-icon icon-remove", title: "\u5220\u9664", onClick: r[3] || (r[3] = (B) => i()) })) ])) : L("", !0), I(o.$slots, "default", { selectedFile: t.selectedFile, rename: w(u).rename, funs: { setRenameInputRef: p, renameKeydown: D, renameDone: h }, loading: w(u).loading }), t.selectedFile.paused ? (E(), A("div", He, " \u6682\u505C ")) : L("", !0), t.selectedFile.done && !w(a).getSettings().readonly ? (E(), A("div", Ie, " \u5B8C\u6210 ")) : L("", !0), t.selectedFile.error ? (E(), A("div", Oe, "\u9519\u8BEF")) : L("", !0) ])) ], 46, Ue)); } }), Re = { class: "upload-container independent" }, ze = { class: "upload-list" }, We = /* @__PURE__ */ P({ __name: "index.vue3", setup(f) { const e = H("upload")(); return (async () => e.getSettings().debug && console.debug("Layout: Card Index Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, n) => (E(), A("div", Re, [ I(t.$slots, "uploadContainer", {}, void 0, !0), _("div", ze, [ I(t.$slots, "listContainer", {}, void 0, !0) ]) ])); } }); const ye = (f, e) => { const t = f.__vccOpts || f; for (const [n, a] of e) t[n] = a; return t; }, je = /* @__PURE__ */ ye(We, [["__scopeId", "data-v-dfb9d6ed"]]), Qe = { class: "upload-container independent" }, Ne = { class: "upload-list" }, Xe = /* @__PURE__ */ P({ __name: "index.vue3", setup(f) { const e = H("upload")(); return (async () => e.getSettings().debug && console.debug("Layout: Detailedly Index Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, n) => (E(), A("div", Qe, [ I(t.$slots, "uploadContainer", {}, void 0, !0), _("div", Ne, [ I(t.$slots, "listContainer", {}, void 0, !0) ]) ])); } }); const Ye = /* @__PURE__ */ ye(Xe, [["__scopeId", "data-v-ae4f85bd"]]), Ve = { key: 0 }, me = /* @__PURE__ */ P({ __name: "index.vue3", setup(f) { const e = H("upload")(); let t = O({ loading: !0, currentThemeIndex: null }); return (async () => { const n = (a) => { switch (t.loading = !0, a) { case X.\u5361\u7247: t.currentThemeIndex = N(je); break; case X.\u6E05\u5355: t.currentThemeIndex = N(Ye); 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, a) => w(t).loading ? L("", !0) : (E(), A("div", Ve, [ (E(), W(ae(w(t).currentThemeIndex), null, { uploadContainer: T(() => [ I(n.$slots, "uploadContainer") ]), listContainer: T(() => [ I(n.$slots, "listContainer") ]), _: 3 })) ])); } }), Ke = { class: "item-info" }, qe = ["title", "innerHTML"], Je = ["title"], Ge = /* @__PURE__ */ P({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = H("upload")(); let n = O({ 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"))(), (a, u) => (E(), A(Z, null, [ _("div", Ke, [ e.slotProps.rename.active ? L("", !0) : (E(), A("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, qe)), e.slotProps.rename.active ? he((E(), A("input", { key: 1, class: "item-rename-input", type: "text", "onUpdate:modelValue": u[0] || (u[0] = (l) => e.slotProps.rename.value = l), ref: e.slotProps.funs.setRenameInputRef, onKeydown: u[1] || (u[1] = (l) => e.slotProps.funs.renameKeydown(l)), onBlur: u[2] || (u[2] = (l) => e.slotProps.funs.renameDone()) }, null, 544)), [ [ge, e.slotProps.rename.value] ]) : L("", !0) ]), e.slotProps.loading.show() ? (E(), A("div", { key: 0, class: "item-loading", style: re(w(n).lodingStyle()), title: e.slotProps.loading.info() }, null, 12, Je)) : L("", !0) ], 64)); } }), Ze = { class: "item-info" }, et = { class: "single-text-omitted item-name" }, tt = ["title", "innerHTML"], st = { class: "single-text-omitted item-size" }, nt = ["title", "innerHTML"], it = { class: "single-text-omitted item-filetype" }, ut = ["title", "innerHTML"], rt = ["title"], at = /* @__PURE__ */ P({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = H("upload")(); let n = O({ 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"))(), (a, u) => (E(), A(Z, null, [ _("div", Ze, [ _("span", et, [ se(" \u540D\u79F0\uFF1A"), e.slotProps.rename.active ? L("", !0) : (E(), A("span", { key: 0, title: e.slotProps.selectedFile.fullname(), innerHTML: e.slotProps.selectedFile.fullname() }, null, 8, tt)), e.slotProps.rename.value ? he((E(), A("input", { key: 1, class: "item-rename-input", type: "text", "onUpdate:modelValue": u[0] || (u[0] = (l) => e.slotProps.selectedFile.newName = l), ref: e.slotProps.funs.setRenameInputRef, onKeydown: u[1] || (u[1] = (l) => e.slotProps.funs.renameKeydown(l)), onBlur: u[2] || (u[2] = (l) => e.slotProps.funs.renameDone()) }, null, 544)), [ [ge, e.slotProps.selectedFile.newName] ]) : L("", !0) ]), _("span", st, [ se(" \u5927\u5C0F\uFF1A"), _("span", { title: e.slotProps.selectedFile.size, innerHTML: e.slotProps.selectedFile.size }, null, 8, nt) ]), _("span", it, [ se(" \u7C7B\u578B\uFF1A"), _("span", { title: e.slotProps.selectedFile.fileType, innerHTML: e.slotProps.selectedFile.fileType }, null, 8, ut) ]) ]), e.slotProps.loading.show() ? (E(), A("div", { key: 0, class: "item-loading", style: re(w(n).lodingStyle()), title: e.slotProps.loading.info() }, null, 12, rt)) : L("", !0) ], 64)); } }), ot = { key: 0 }, we = /* @__PURE__ */ P({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = H("upload")(); let n = O({ loading: !0, currentThemeInfo: null }); return (async () => (((u) => { switch (n.loading = !0, t.getSettings().layout) { case X.\u5361\u7247: n.currentThemeInfo = N(Ge); break; case X.\u6E05\u5355: n.currentThemeInfo = N(at); 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")))(), (a, u) => w(n).loading ? L("", !0) : (E(), A("div", ot, [ (E(), W(ae(w(n).currentThemeInfo), { slotProps: e.slotProps }, null, 8, ["slotProps"])) ])); } }), lt = /* @__PURE__ */ _("p", { class: "upload-icon icon-select-file" }, null, -1), ct = /* @__PURE__ */ P({ __name: "SingleUpload.vue3", setup(f) { const e = H("upload")(); return (async () => e.getSettings().debug && console.debug("Piece: Single Upload Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, n) => (E(), W(me, null, pe({ listContainer: T(() => [ (E(!0), A(Z, null, ie(w(e).getSelectedFileSortMap().size, (a) => (E(), W(be, { key: a, selectedFile: w(e).getSelectedFile(a) }, { default: T((u) => [ K(we, { class: "item-info-container", slotProps: u }, null, 8, ["slotProps"]) ]), _: 2 }, 1032, ["selectedFile"]))), 128)) ]), _: 2 }, [ w(e).getSettings().readonly ? void 0 : { name: "uploadContainer", fn: T(() => [ w(e).anyFile() ? L("", !0) : (E(), W(Fe, { key: 0, class: "upload-box-container single", title: w(e).getConfig().explain }, { default: T(() => [ lt ]), _: 1 }, 8, ["title"])) ]), key: "0" } ]), 1024)); } }), dt = ["title"], ht = /* @__PURE__ */ P({ __name: "DropFileInput.vue3", setup(f) { const e = H("upload")(), t = (a) => { a.preventDefault(); }, n = (a) => { if (a.preventDefault(), a.dataTransfer) for (let u = 0; u < a.dataTransfer.files.length; u++) e.append(a.dataTransfer.files[u]); }; return (async () => e.getSettings().debug && console.debug("Piece: Drop File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(), (a, u) => (E(), A("div", { class: de(w(e).getSelectCLass()), onDrop: n, onDragover: t, title: w(e).getSelectFileAlarmInfo() }, [ K(Fe, null, { default: T(() => [ I(a.$slots, "default") ]), _: 3 }) ], 42, dt)); } }); class J { 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 J.equalError(this.x, this.currentX, this.restoreError[0]) && J.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, a) { let u = new J(); return u.els = t, u.el = t.get(n), u.key = n, u.containerEl = e, u.isMobile = a, u; } start(e, t, n) { this.flag = !0, this.currentX = e, this.currentY = t, this.save(), this.el.style.zIndex = "999"; let a = !1; this.mouseMove = (u) => { if (!this.flag || a) return; const l = this.isMobile ? u.targetTouches[0].clientX : u.clientX, g = this.isMobile ? u.targetTouches[0].clientY : u.clientY; if (u.preventDefault(), a = !0, this.moving(l, g), n && this.els) { let p = !1; this.els.forEach((k, b) => { if (b == this.key) return; const y = this.el.offsetTop + this.transY, m = this.el.offsetLeft + this.transX; y > k.offsetTop && y < k.offsetTop + k.offsetHeight && m > k.offsetLeft && m < k.offsetLeft + k.offsetWidth && (n(b, l, g), p = !0); }), p || n(-1, l, g); } a = !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 gt = /* @__PURE__ */ _("p", { class: "upload-icon icon-inbox" }, null, -1), pt = ["innerHTML"], ft = ["innerHTML"], Ft = { class: "upload-error-list pretty-scrollbar" }, bt = /* @__PURE__ */ P({ __name: "MultipleUpload.vue3", setup(f) { const { proxy: e } = fe(), t = H("upload")(); let n = O({ scrollLock: !1, readyDraggingSortKey: null, currentDraggingSortKey: null, lastDraggingSortKey: null, errors: [] }), a, u = /* @__PURE__ */ new Map(), l = { startTick: null, changeTick: null, draggingHelper: null, ready2start: (F, D, h) => { 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: ${F}` ), l.startTick && clearTimeout(l.startTick), l.startTick = setTimeout(() => { n.readyDraggingSortKey = F, l.startTick = setTimeout(() => { !a || (n.readyDraggingSortKey = null, n.currentDraggingSortKey = F, l.draggingHelper = J.getInstance( a, u, n.currentDraggingSortKey, t.getSettings().isMobile ), l.draggingHelper.start(D, h, (d, s, i) => { t.getSettings().debug && console.debug( `Piece: Multiple Upload Component(vue3) \u9F20\u6807\u79FB\u52A8\u4E8B\u4EF6, sortKey: ${F}, clientX: ${s}, clientY: ${i}, targetKey: ${d}` ), d == -1 ? m() : y(d); })); }, t.getSettings().dragPreparationTime); }, 500)); }, ready2change: (F) => { n.lastDraggingSortKey = F, n.currentDraggingSortKey !== n.lastDraggingSortKey && (t.getSettings().debug && console.debug( `Piece: Multiple Upload Component(vue3) \u5EF6\u65F6\u91CD\u65B0\u6392\u5E8F, targetKey: ${F}` ), l.changeTick && clearTimeout(l.changeTick), l.changeTick = setTimeout(() => { t.changeSort( n.currentDraggingSortKey, n.lastDraggingSortKey ), l.end(); }, t.getSettings().dragChangePositionTime)); }, cancelChange: () => { t.getSettings().debug && console.debug( "Piece: Multiple Upload Component(vue3) \u53D6\u6D88\u91CD\u65B0\u6392\u5E8F" ), l.changeTick && clearTimeout(l.changeTick), n.lastDraggingSortKey = null; }, end: () => { l.startTick && clearTimeout(l.startTick), l.changeTick && clearTimeout(l.changeTick), n.readyDraggingSortKey = null, l.draggingHelper && (t.getSettings().debug && console.debug( "Piece: Multiple Upload Component(vue3) \u7ED3\u675F\u62D6\u52A8\u5E76\u590D\u539F\u5BB9\u5668\u4F4D\u7F6E" ), l.draggingHelper.end(!0), l.draggingHelper = null, u.forEach((F, D) => { D !== n.currentDraggingSortKey && (F.style.zIndex = ""); }), n.lastDraggingSortKey = null, n.currentDraggingSortKey = null); } }; const g = (F) => { F && (a = F); }, p = (F, D) => { !a || u.set(F, D); }, k = (F, D, h) => { t.getSettings().debug && console.debug( `Piece: Multiple Upload Component(vue3) \u6309\u4E0B\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: ${F}` ); const d = h ? D.targetTouches[0].clientX : D.clientX, s = h ? D.targetTouches[0].clientY : D.clientY; l.ready2start(F, d, s); }, b = (F, D, h) => { t.getSettings().debug && console.debug( `Piece: Multiple Upload Component(vue3) \u677E\u5F00\u9F20\u6807\u7684\u4E8B\u4EF6, sortKey: ${F}` ), l.end(); }, y = (F) => { t.getSettings().debug && console.debug( `Piece: Multiple Upload Component(vue3) \u8FDB\u5165\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6, targetKey: ${F}` ), l.ready2change(F); }, m = () => { t.getSettings().debug && console.debug( "Piece: Multiple Upload Component(vue3) \u79BB\u5F00\u76EE\u6807\u8303\u56F4\u7684\u4E8B\u4EF6" ), l.cancelChange(); }; return (async () => { const F = (h) => { n.scrollLock || h.length == 0 || e.$nextTick(() => { let d = null, s = !1; for (let i = 0; i < h.length; i++) { let o = h[i]; if (!s && o.checking && (s = !0, d = u.get(i)), o.uploading) { d = u.get(i); break; } } !d || a && (a.scrollTop = d.offsetTop - a.offsetTop - 20); }); }; t.registerSelectedFileListChanged(F); const D = (h) => { n.errors.push(h.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"); })(), (F, D) => (E(), W(me, null, pe({ listContainer: T(() => [ _("div", { class: "scroll-container pretty-scrollbar", ref: g, onMouseenter: D[0] || (D[0] = (h) => w(n).scrollLock = !0), onMouseleave: D[1] || (D[1] = (h) => w(n).scrollLock = !1) }, [ K(Se, { name: "fade" }, { default: T(() => [ (E(!0), A(Z, null, ie(w(t).getSelectedFileSortMap().size, (h) => { var d; return E(), W(be, { key: (d = w(t).getSelectedFileSortMap().get(h)) != null ? d : -1, selectedFile: w(t).getSelectedFile(h), readyDrag: w(n).readyDraggingSortKey === h, startDrag: w(n).currentDraggingSortKey !== null, dragging: w(n).currentDraggingSortKey === h, dragover: w(n).lastDraggingSortKey === h && w(n).currentDraggingSortKey !== h, onSetContainerRef: (s) => p(h, s), onMouseDown: (s) => k(h, s, !1), onMouseUp: (s) => b(h), onTouchstart: (s) => k(h, s, !0), onTouchend: (s) => b(h), onTouchcancel: (s) => b(h) }, { default: T((s) => [ K(we, { 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 }, [ w(t).getSettings().readonly ? void 0 : { name: "uploadContainer", fn: T(() => [ K(ht, { class: "upload-box-container" }, { default: T(() => [ gt, _("p", { class: "upload-text", innerHTML: w(t).getConfig().explain }, null, 8, pt), _("p", { class: "upload-hint", innerHTML: w(t).getSettings().tip }, null, 8, ft), _("div", Ft, [ (E(!0), A(Z, null, ie(w(n).errors, (h, d) => (E(), A("p", { class: "error-info", key: d }, Ae(h), 1))), 128)) ]) ]), _: 1 }) ]), key: "0" } ]), 1024)); } }); class S 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 S && t.innerError && S.consoleWriteWithIndex(t.innerError, ++n); } static consoleWrite(t) { S.consoleWriteWithIndex(t, 1); } } class ue { 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 ee { 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 ce { 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 ? ee.getByMIME(e.type) : ee.getByExtension(this.extension); } } class x { static s4() { return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1); } static new() { return `${x.s4()}${x.s4()}-${x.s4()}-${x.s4()}-${x.s4()}-${x.s4()}${x.s4()}${x.s4()}`; } } const j = class { static getSize(e, t = 1024, n = 2) { if (e <= 0) return "0 KB"; for (let a = 0; a < j.formats.length; a++) { let u = e / Math.pow(t, a + 1); if (u < t) return `${u.toFixed(n)} ${j.formats[a]}`; } return `${(e / Math.pow(t, j.formats.length)).toFixed(n)} ${j.formats[j.formats.length - 1]}`; } }; let z = j; c(z, "formats", [ "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ]); class yt { 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 mt = () => { let f = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; function e(h, d) { let s = h[0], i = h[1], o = h[2], r = h[3]; s += (i & o | ~i & r) + d[0] - 680876936 | 0, s = (s << 7 | s >>> 25) + i | 0, r += (s & i | ~s & o) + d[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + s | 0, o += (r & s | ~r & i) + d[2] + 606105819 | 0, o = (o << 17 | o >>> 15) + r | 0, i += (o & r | ~o & s) + d[3] - 1044525330 | 0, i = (i << 22 | i >>> 10) + o | 0, s += (i & o | ~i & r) + d[4] - 176418897 | 0, s = (s << 7 | s >>> 25) + i | 0, r += (s & i | ~s & o) + d[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + s | 0, o += (r & s | ~r & i) + d[6] - 1473231341 | 0, o = (o << 17 | o >>> 15) + r | 0, i += (o & r | ~o & s) + d[7] - 45705983 | 0, i = (i << 22 | i >>> 10) + o | 0, s += (i & o | ~i & r) + d[8] + 1770035416 | 0, s = (s << 7 | s >>> 25) + i | 0, r += (s & i | ~s & o) + d[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + s | 0, o += (r & s | ~r & i) + d[10] - 42063 | 0, o = (o << 17 | o >>> 15) + r | 0, i += (o & r | ~o & s) + d[11] - 1990404162 | 0, i = (i << 22 | i >>> 10) + o | 0, s += (i & o | ~i & r) + d[12] + 1804603682 | 0, s = (s << 7 | s >>> 25) + i | 0, r += (s & i | ~s & o) + d[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + s | 0, o += (r & s | ~r & i) + d[14] - 1502002290 | 0, o = (o << 17 | o >>> 15) + r | 0, i += (o & r | ~o & s) + d[15] + 1236535329 | 0, i = (i << 22 | i >>> 10) + o | 0, s += (i & r | o & ~r) + d[1] - 165796510 | 0, s = (s << 5 | s >>> 27) + i | 0, r += (s & o | i & ~o) + d[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + s | 0, o += (r & i | s & ~i) + d[11] + 643717713 | 0, o = (o << 14 | o >>> 18) + r | 0, i += (o & s | r & ~s) + d[0] - 373897302 | 0, i = (i << 20 | i >>> 12) + o | 0, s += (i & r | o & ~r) + d[5] - 701558691 | 0, s = (s << 5 | s >>> 27) + i | 0, r += (s & o | i & ~o) + d[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + s | 0, o += (r & i | s & ~i) + d[15] - 660478335 | 0, o = (o << 14 | o >>> 18) + r | 0, i += (o & s | r & ~s) + d[4] - 405537848 | 0, i = (i << 20 | i >>> 12) + o | 0, s += (i & r | o & ~r) + d[9] + 568446438 | 0, s = (s << 5 | s >>> 27) + i | 0, r += (s & o | i & ~o) + d[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + s | 0, o += (r & i | s & ~i) + d[3] - 187363961 | 0, o = (o << 14 | o >>> 18) + r | 0, i += (o & s | r & ~s) + d[8] + 1163531501 | 0, i = (i << 20 | i >>> 12) + o | 0, s += (i & r | o & ~r) + d[13] - 1444681467 | 0, s = (s << 5 | s >>> 27) + i | 0, r += (s & o | i & ~o) + d[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + s | 0, o += (r & i | s & ~i) + d[7] + 1735328473 | 0, o = (o << 14 | o >>> 18) + r | 0, i += (o & s | r & ~s) + d[12] - 1926607734 | 0, i = (i << 20 | i >>> 12) + o | 0, s += (i ^ o ^ r) + d[5] - 378558 | 0, s = (s << 4 | s >>> 28) + i | 0, r += (s ^ i ^ o) + d[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + s | 0, o += (r ^ s ^ i) + d[11] + 1839030562 | 0, o = (o << 16 | o >>> 16) + r | 0, i += (o ^ r ^ s) + d[14] - 35309556 | 0, i = (i << 23 | i >>> 9) + o | 0, s += (i ^ o ^ r) + d[1] - 1530992060 | 0, s = (s << 4 | s >>> 28) + i | 0, r += (s ^ i ^ o) + d[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + s | 0, o += (r ^ s ^ i) + d[7] - 155497632 | 0, o = (o << 16 | o >>> 16) + r | 0, i += (o ^ r ^ s) + d[10] - 1094730640 | 0, i = (i << 23 | i >>> 9) + o | 0, s += (i ^ o ^ r) + d[13] + 681279174 | 0, s = (s << 4 | s >>> 28) + i | 0, r += (s ^ i ^ o) + d[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + s | 0, o += (r ^ s ^ i) + d[3] - 722521979 | 0, o = (o << 16 | o >>> 16) + r | 0, i += (o ^ r ^ s) + d[6] + 76029189 | 0, i = (i << 23 | i >>> 9) + o | 0, s += (i ^ o ^ r) + d[9] - 640364487 | 0, s = (s << 4 | s >>> 28) + i | 0, r += (s ^ i ^ o) + d[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + s | 0, o += (r ^ s ^ i) + d[15] + 530742520 | 0, o = (o << 16 | o >>> 16) + r | 0, i += (o ^ r ^ s) + d[2] - 995338651 | 0, i = (i << 23 | i >>> 9) + o | 0, s += (o ^ (i | ~r)) + d[0] - 198630844 | 0, s = (s << 6 | s >>> 26) + i | 0, r += (i ^ (s | ~o)) + d[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + s | 0, o += (s ^ (r | ~i)) + d[14] - 1416354905 | 0, o = (o << 15 | o >>> 17) + r | 0, i += (r ^ (o | ~s)) + d[5] - 57434055 | 0, i = (i << 21 | i >>> 11) + o | 0, s += (o ^ (i | ~r)) + d[12] + 1700485571 | 0, s = (s << 6 | s >>> 26) + i | 0, r += (i ^ (s | ~o)) + d[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + s | 0, o += (s ^ (r | ~i)) + d[10] - 1051523 | 0, o = (o << 15 | o >>> 17) + r | 0, i += (r ^ (o | ~s)) + d[1] - 2054922799 | 0, i = (i << 21 | i >>> 11) + o | 0, s += (o ^ (i | ~r)) + d[8] + 1873313359 | 0, s = (s << 6 | s >>> 26) + i | 0, r += (i ^ (s | ~o)) + d[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + s | 0, o += (s ^ (r | ~i)) + d[6] - 1560198380 | 0, o = (o << 15 | o >>> 17) + r | 0, i += (r ^ (o | ~s)) + d[13] + 1309151649 | 0, i = (i << 21 | i >>> 11) + o | 0, s += (o ^ (i | ~r)) + d[4] - 145523070 | 0, s = (s << 6 | s >>> 26) + i | 0, r += (i ^ (s | ~o)) + d[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + s | 0, o += (s ^ (r | ~i)) + d[2] + 718787259 | 0, o = (o << 15 | o >>> 17) + r | 0, i += (r ^ (o | ~s)) + d[9] - 343485551 | 0, i = (i << 21 | i >>> 11) + o | 0, h[0] = s + h[0] | 0, h[1] = i + h[1] | 0, h[2] = o + h[2] | 0, h[3] = r + h[3] | 0; } function t(h) { let d = [], s; for (s = 0; s < 64; s += 4) d[s >> 2] = h.charCodeAt(s) + (h.charCodeAt(s + 1) << 8) + (h.charCodeAt(s + 2) << 16) + (h.charCodeAt(s + 3) << 24); return d; } function n(h) { let d = [], s; for (s = 0; s < 64; s += 4) d[s >> 2] = h[s] + (h[s + 1] << 8) + (h[s + 2] << 16) + (h[s + 3] << 24); return d; } function a(h) { let d = h.length, s = [1732584193, -271733879, -1732584194, 271733878], i, o, r, B, v, U; for (i = 64; i <= d; i += 64) e(s, t(h.substring(i - 64, i))); for (h = h.substring(i - 64), o = h.length, r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < o; i += 1) r[i >> 2] |= h.charCodeAt(i) << (i % 4 << 3); if (r[i >> 2] |= 128 << (i % 4 << 3), i > 55) for (e(s, r), i = 0; i < 16; i += 1) r[i] = 0; return B = d * 8, B = B.toString(16).match(/(.*?)(.{0,8})$/), v = parseInt(B[2], 16), U = parseInt(B[1], 16) || 0, r[14] = v, r[15] = U, e(s, r), s; } function u(h) { let d = h.length, s = [1732584193, -271733879, -1732584194, 271733878], i, o, r, B, v, U; for (i = 64; i <= d; i += 64) e(s, n(h.subarray(i - 64, i))); for (h = i - 64 < d ? h.subarray(i - 64) : new Uint8Array(0), o = h.length, r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < o; i += 1) r[i >> 2] |= h[i] << (i % 4 << 3); if (r[i >> 2] |= 128 << (i % 4 << 3), i > 55) for (e(s, r), i = 0; i < 16; i += 1) r[i] = 0; return B = d * 8, B = B.toString(16).match(/(.*?)(.{0,8})$/), v = parseInt(B[2], 16), U = parseInt(B[1], 16) || 0, r[14] = v, r[15] = U, e(s, r), s; } function l(h) { let d = "", s; for (s = 0; s < 4; s += 1) d += f[h >> s * 8 + 4 & 15] + f[h >> s * 8 & 15]; return d; } function g(h) { let d; for (d = 0; d < h.length; d += 1) h[d] = l(h[d]); return h.join(""); } g(a("hello")), typeof ArrayBuffer < "u" && !ArrayBuffer.prototype.slice && function() { function h(d, s) { return d = d | 0 || 0, d < 0 ? Math.max(d + s, 0) : Math.min(d, s); } ArrayBuffer.prototype.slice = function(d, s) { let i = this.byteLength, o = h(d, i), r = i, B, v, U, Q; return s !== void 0 && (r = h(s, i)), o > r ? new ArrayBuffer(0) : (B = r - o, v = new ArrayBuffer(B), U = new Uint8Array(v), Q = new Uint8Array(this, o, B), U.set(Q), v); }; }(); function p(h) { return /[\u0080-\uFFFF]/.test(h) && (h = unescape(encodeURIComponent(h))), h; } function k(h, d) { let s = h.length, i = new ArrayBuffer(s), o = new Uint8Array(i), r; for (r = 0; r < s; r += 1) o[r] = h.charCodeAt(r); return d ? o : i; } function b(h) { return String.fromCharCode.apply(null, new Uint8Array(h)); } function y(h, d, s) { let i = new Uint8Array(h.byteLength + d.byteLength); return i.set(new Uint8Array(h)), i.set(new Uint8Array(d), h.byteLength), s ? i : i.buffer; } function m(h) { let d = [], s = h.length, i; for (i = 0; i < s - 1; i += 2) d.push(parseInt(h.substr(i, 2), 16)); return Strin