vue-simple-uploader.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. import "./chunk-MKUMB4YM.js";
  2. import {
  3. vShow
  4. } from "./chunk-S6VK5PVK.js";
  5. import {
  6. Fragment,
  7. computed,
  8. createBlock,
  9. createTextVNode,
  10. createVNode,
  11. getCurrentInstance,
  12. inject,
  13. nextTick,
  14. onBeforeUnmount,
  15. onMounted,
  16. onUnmounted,
  17. openBlock,
  18. provide,
  19. reactive,
  20. ref,
  21. renderList,
  22. renderSlot,
  23. resolveComponent,
  24. toRaw,
  25. watch,
  26. withCtx,
  27. withDirectives
  28. } from "./chunk-YVHZHMSQ.js";
  29. import {
  30. toDisplayString
  31. } from "./chunk-VNBICN6T.js";
  32. import "./chunk-2LSFTFF7.js";
  33. // node_modules/.pnpm/vue-simple-uploader@1.0.0_vue@3.4.27/node_modules/vue-simple-uploader/dist/vue-simple-uploader.es.js
  34. function F(e2) {
  35. throw new Error('Could not dynamically require "' + e2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
  36. }
  37. var E = { exports: {} };
  38. var x = E.exports = function e(t, i, s) {
  39. function r(o2, a) {
  40. if (!i[o2]) {
  41. if (!t[o2]) {
  42. if (!a && F)
  43. return F(o2);
  44. if (n)
  45. return n(o2, true);
  46. throw new Error("Cannot find module '" + o2 + "'");
  47. }
  48. var l = i[o2] = { exports: {} };
  49. t[o2][0].call(l.exports, function(e2) {
  50. var i2 = t[o2][1][e2];
  51. return r(i2 || e2);
  52. }, l, l.exports, e, t, i, s);
  53. }
  54. return i[o2].exports;
  55. }
  56. for (var n = F, o = 0; o < s.length; o++)
  57. r(s[o]);
  58. return r;
  59. }({ 1: [function(e2, t, i) {
  60. var s = e2("./utils");
  61. function r(e3, t2, i2) {
  62. s.defineNonEnumerable(this, "uploader", e3), s.defineNonEnumerable(this, "file", t2), s.defineNonEnumerable(this, "bytes", null), this.offset = i2, this.tested = false, this.retries = 0, this.pendingRetry = false, this.preprocessState = 0, this.readState = 0, this.loaded = 0, this.total = 0, this.chunkSize = s.evalOpts(e3.opts.chunkSize, t2, this), this.startByte = this.offset * this.chunkSize, this.endByte = this.computeEndByte(), this.xhr = null;
  63. }
  64. var n = r.STATUS = { PENDING: "pending", UPLOADING: "uploading", READING: "reading", SUCCESS: "success", ERROR: "error", COMPLETE: "complete", PROGRESS: "progress", RETRY: "retry" };
  65. s.extend(r.prototype, { _event: function(e3, t2) {
  66. (t2 = s.toArray(arguments)).unshift(this), this.file._chunkEvent.apply(this.file, t2);
  67. }, computeEndByte: function() {
  68. var e3 = Math.min(this.file.size, (this.offset + 1) * this.chunkSize);
  69. return this.file.size - e3 < this.chunkSize && !this.uploader.opts.forceChunkSize && (e3 = this.file.size), e3;
  70. }, getParams: function() {
  71. return { chunkNumber: this.offset + 1, chunkSize: this.chunkSize, currentChunkSize: this.endByte - this.startByte, totalSize: this.file.size, identifier: this.file.uniqueIdentifier, filename: this.file.name, relativePath: this.file.relativePath, totalChunks: this.file.chunks.length };
  72. }, getTarget: function(e3, t2) {
  73. return t2.length ? (e3.indexOf("?") < 0 ? e3 += "?" : e3 += "&", e3 + t2.join("&")) : e3;
  74. }, test: function() {
  75. this.xhr = new XMLHttpRequest(), this.xhr.addEventListener("load", r2, false), this.xhr.addEventListener("error", r2, false);
  76. var e3 = s.evalOpts(this.uploader.opts.testMethod, this.file, this), t2 = this.prepareXhrRequest(e3, true);
  77. this.xhr.send(t2);
  78. var i2 = this;
  79. function r2(e4) {
  80. var t3 = i2.status(true);
  81. t3 === n.ERROR ? (i2._event(t3, i2.message()), i2.uploader.uploadNextChunk()) : t3 === n.SUCCESS ? (i2._event(t3, i2.message()), i2.tested = true) : i2.file.paused || (i2.tested = true, i2.send());
  82. }
  83. }, preprocessFinished: function() {
  84. this.endByte = this.computeEndByte(), this.preprocessState = 2, this.send();
  85. }, readFinished: function(e3) {
  86. this.readState = 2, this.bytes = e3, this.send();
  87. }, send: function() {
  88. var e3 = this.uploader.opts.preprocess, t2 = this.uploader.opts.readFileFn;
  89. if (s.isFunction(e3))
  90. switch (this.preprocessState) {
  91. case 0:
  92. return this.preprocessState = 1, void e3(this);
  93. case 1:
  94. return;
  95. }
  96. switch (this.readState) {
  97. case 0:
  98. return this.readState = 1, void t2(this.file, this.file.fileType, this.startByte, this.endByte, this);
  99. case 1:
  100. return;
  101. }
  102. if (!this.uploader.opts.testChunks || this.tested) {
  103. this.loaded = 0, this.total = 0, this.pendingRetry = false, this.xhr = new XMLHttpRequest(), this.xhr.upload.addEventListener("progress", a, false), this.xhr.addEventListener("load", l, false), this.xhr.addEventListener("error", l, false);
  104. var i2 = s.evalOpts(this.uploader.opts.uploadMethod, this.file, this), r2 = this.prepareXhrRequest(i2, false, this.uploader.opts.method, this.bytes);
  105. this.xhr.send(r2);
  106. var o = this;
  107. } else
  108. this.test();
  109. function a(e4) {
  110. e4.lengthComputable && (o.loaded = e4.loaded, o.total = e4.total), o._event(n.PROGRESS, e4);
  111. }
  112. function l(e4) {
  113. var t3 = o.message();
  114. o.processingResponse = true, o.uploader.opts.processResponse(t3, function(e5, t4) {
  115. if (o.processingResponse = false, o.xhr) {
  116. o.processedState = { err: e5, res: t4 };
  117. var i3 = o.status();
  118. if (i3 === n.SUCCESS || i3 === n.ERROR)
  119. o._event(i3, t4), i3 === n.ERROR && o.uploader.uploadNextChunk();
  120. else {
  121. o._event(n.RETRY, t4), o.pendingRetry = true, o.abort(), o.retries++;
  122. var s2 = o.uploader.opts.chunkRetryInterval;
  123. null !== s2 ? setTimeout(function() {
  124. o.send();
  125. }, s2) : o.send();
  126. }
  127. }
  128. }, o.file, o);
  129. }
  130. }, abort: function() {
  131. var e3 = this.xhr;
  132. this.xhr = null, this.processingResponse = false, this.processedState = null, e3 && e3.abort();
  133. }, status: function(e3) {
  134. if (1 === this.readState)
  135. return n.READING;
  136. if (this.pendingRetry || 1 === this.preprocessState)
  137. return n.UPLOADING;
  138. if (this.xhr) {
  139. if (this.xhr.readyState < 4 || this.processingResponse)
  140. return n.UPLOADING;
  141. var t2;
  142. this.uploader.opts.successStatuses.indexOf(this.xhr.status) > -1 ? t2 = n.SUCCESS : this.uploader.opts.permanentErrors.indexOf(this.xhr.status) > -1 || !e3 && this.retries >= this.uploader.opts.maxChunkRetries ? t2 = n.ERROR : (this.abort(), t2 = n.PENDING);
  143. var i2 = this.processedState;
  144. return i2 && i2.err && (t2 = n.ERROR), t2;
  145. }
  146. return n.PENDING;
  147. }, message: function() {
  148. return this.xhr ? this.xhr.responseText : "";
  149. }, progress: function() {
  150. if (this.pendingRetry)
  151. return 0;
  152. var e3 = this.status();
  153. return e3 === n.SUCCESS || e3 === n.ERROR ? 1 : e3 === n.PENDING ? 0 : this.total > 0 ? this.loaded / this.total : 0;
  154. }, sizeUploaded: function() {
  155. var e3 = this.endByte - this.startByte;
  156. return this.status() !== n.SUCCESS && (e3 = this.progress() * e3), e3;
  157. }, prepareXhrRequest: function(e3, t2, i2, r2) {
  158. var n2 = s.evalOpts(this.uploader.opts.query, this.file, this, t2);
  159. n2 = s.extend(this.getParams(), n2), n2 = this.uploader.opts.processParams(n2, this.file, this, t2);
  160. var o = s.evalOpts(this.uploader.opts.target, this.file, this, t2), a = null;
  161. if ("GET" === e3 || "octet" === i2) {
  162. var l = [];
  163. s.each(n2, function(e4, t3) {
  164. l.push([encodeURIComponent(t3), encodeURIComponent(e4)].join("="));
  165. }), o = this.getTarget(o, l), a = r2 || null;
  166. } else
  167. a = new FormData(), s.each(n2, function(e4, t3) {
  168. a.append(t3, e4);
  169. }), void 0 !== r2 && a.append(this.uploader.opts.fileParameterName, r2, this.file.name);
  170. return this.xhr.open(e3, o, true), this.xhr.withCredentials = this.uploader.opts.withCredentials, s.each(s.evalOpts(this.uploader.opts.headers, this.file, this, t2), function(e4, t3) {
  171. this.xhr.setRequestHeader(t3, e4);
  172. }, this), a;
  173. } }), t.exports = r;
  174. }, { "./utils": 5 }], 2: [function(e2, t, i) {
  175. var s = e2("./utils").each, r = { _eventData: null, on: function(e3, t2) {
  176. this._eventData || (this._eventData = {}), this._eventData[e3] || (this._eventData[e3] = []);
  177. var i2 = false;
  178. s(this._eventData[e3], function(e4) {
  179. if (e4 === t2)
  180. return i2 = true, false;
  181. }), i2 || this._eventData[e3].push(t2);
  182. }, off: function(e3, t2) {
  183. this._eventData || (this._eventData = {}), this._eventData[e3] && this._eventData[e3].length && (t2 ? s(this._eventData[e3], function(i2, s2) {
  184. if (i2 === t2)
  185. return this._eventData[e3].splice(s2, 1), false;
  186. }, this) : this._eventData[e3] = []);
  187. }, trigger: function(e3) {
  188. if (this._eventData || (this._eventData = {}), !this._eventData[e3])
  189. return true;
  190. var t2 = this._eventData[e3].slice.call(arguments, 1), i2 = false;
  191. return s(this._eventData[e3], function(e4) {
  192. i2 = false === e4.apply(this, t2) || i2;
  193. }, this), !i2;
  194. } };
  195. t.exports = r;
  196. }, { "./utils": 5 }], 3: [function(e2, t, i) {
  197. var s = e2("./utils"), r = e2("./event"), n = e2("./file"), o = e2("./chunk"), a = "0.6.0", l = "undefined" == typeof window, u = !l && window.navigator.msPointerEnabled, h = function() {
  198. if (l)
  199. return false;
  200. var e3 = "slice", t2 = s.isDefined(window.File) && s.isDefined(window.Blob) && s.isDefined(window.FileList), i2 = null;
  201. return t2 && (i2 = window.Blob.prototype, s.each(["slice", "webkitSlice", "mozSlice"], function(t3) {
  202. if (i2[t3])
  203. return e3 = t3, false;
  204. }), t2 = !!i2[e3]), t2 && (d.sliceName = e3), i2 = null, t2;
  205. }(), p = function() {
  206. if (l)
  207. return false;
  208. var e3 = window.document.createElement("input");
  209. e3.type = "file";
  210. var t2 = "webkitdirectory" in e3 || "directory" in e3;
  211. return e3 = null, t2;
  212. }();
  213. function d(e3) {
  214. this.support = h, this.support && (this.supportDirectory = p, s.defineNonEnumerable(this, "filePaths", {}), this.opts = s.extend({}, d.defaults, e3 || {}), this.preventEvent = s.bind(this._preventEvent, this), n.call(this, this));
  215. }
  216. var f = function(e3, t2, i2, s2, r2) {
  217. r2.readFinished(e3.file[d.sliceName](i2, s2, t2));
  218. };
  219. d.version = a, d.defaults = { chunkSize: 1048576, forceChunkSize: false, simultaneousUploads: 3, singleFile: false, fileParameterName: "file", progressCallbacksInterval: 500, speedSmoothingFactor: 0.1, query: {}, headers: {}, withCredentials: false, preprocess: null, method: "multipart", testMethod: "GET", uploadMethod: "POST", prioritizeFirstAndLastChunk: false, allowDuplicateUploads: false, target: "/", testChunks: true, generateUniqueIdentifier: null, maxChunkRetries: 0, chunkRetryInterval: null, permanentErrors: [404, 415, 500, 501], successStatuses: [200, 201, 202], onDropStopPropagation: false, initFileFn: null, readFileFn: f, checkChunkUploadedByResponse: null, initialPaused: false, processResponse: function(e3, t2) {
  220. t2(null, e3);
  221. }, processParams: function(e3) {
  222. return e3;
  223. } }, d.utils = s, d.event = r, d.File = n, d.Chunk = o, d.prototype = s.extend({}, n.prototype), s.extend(d.prototype, r), s.extend(d.prototype, { constructor: d, _trigger: function(e3) {
  224. var t2 = s.toArray(arguments), i2 = !this.trigger.apply(this, arguments);
  225. return "catchAll" !== e3 && (t2.unshift("catchAll"), i2 = !this.trigger.apply(this, t2) || i2), !i2;
  226. }, _triggerAsync: function() {
  227. var e3 = arguments;
  228. s.nextTick(function() {
  229. this._trigger.apply(this, e3);
  230. }, this);
  231. }, addFiles: function(e3, t2) {
  232. var i2 = [], r2 = this.fileList.length;
  233. s.each(e3, function(e4) {
  234. if ((!u || u && e4.size > 0) && (e4.size % 4096 != 0 || "." !== e4.name && "." !== e4.fileName)) {
  235. var s2 = this.generateUniqueIdentifier(e4);
  236. if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(s2)) {
  237. var r3 = new n(this, e4, this);
  238. r3.uniqueIdentifier = s2, this._trigger("fileAdded", r3, t2) ? i2.push(r3) : n.prototype.removeFile.call(this, r3);
  239. }
  240. }
  241. }, this);
  242. var o2 = this.fileList.slice(r2);
  243. this._trigger("filesAdded", i2, o2, t2) ? (s.each(i2, function(e4) {
  244. this.opts.singleFile && this.files.length > 0 && this.removeFile(this.files[0]), this.files.push(e4);
  245. }, this), this._trigger("filesSubmitted", i2, o2, t2)) : s.each(o2, function(e4) {
  246. n.prototype.removeFile.call(this, e4);
  247. }, this);
  248. }, addFile: function(e3, t2) {
  249. this.addFiles([e3], t2);
  250. }, cancel: function() {
  251. for (var e3 = this.fileList.length - 1; e3 >= 0; e3--)
  252. this.fileList[e3].cancel();
  253. }, removeFile: function(e3) {
  254. n.prototype.removeFile.call(this, e3), this._trigger("fileRemoved", e3);
  255. }, generateUniqueIdentifier: function(e3) {
  256. var t2 = this.opts.generateUniqueIdentifier;
  257. if (s.isFunction(t2))
  258. return t2(e3);
  259. var i2 = e3.relativePath || e3.webkitRelativePath || e3.fileName || e3.name;
  260. return e3.size + "-" + i2.replace(/[^0-9a-zA-Z_-]/gim, "");
  261. }, getFromUniqueIdentifier: function(e3) {
  262. var t2 = false;
  263. return s.each(this.files, function(i2) {
  264. if (i2.uniqueIdentifier === e3)
  265. return t2 = i2, false;
  266. }), t2;
  267. }, uploadNextChunk: function(e3) {
  268. var t2 = false, i2 = o.STATUS.PENDING, r2 = this.uploader.opts.checkChunkUploadedByResponse;
  269. if (this.opts.prioritizeFirstAndLastChunk && (s.each(this.files, function(e4) {
  270. if (!e4.paused && (!r2 || e4._firstResponse || !e4.isUploading()))
  271. return e4.chunks.length && e4.chunks[0].status() === i2 ? (e4.chunks[0].send(), t2 = true, false) : e4.chunks.length > 1 && e4.chunks[e4.chunks.length - 1].status() === i2 ? (e4.chunks[e4.chunks.length - 1].send(), t2 = true, false) : void 0;
  272. }), t2))
  273. return t2;
  274. if (s.each(this.files, function(e4) {
  275. if (!e4.paused) {
  276. if (r2 && !e4._firstResponse && e4.isUploading())
  277. return;
  278. s.each(e4.chunks, function(e5) {
  279. if (e5.status() === i2)
  280. return e5.send(), t2 = true, false;
  281. });
  282. }
  283. if (t2)
  284. return false;
  285. }), t2)
  286. return true;
  287. var n2 = false;
  288. return s.each(this.files, function(e4) {
  289. if (!e4.isComplete())
  290. return n2 = true, false;
  291. }), n2 || e3 || !this.files.length || this._triggerAsync("complete"), n2;
  292. }, upload: function(e3) {
  293. var t2 = this._shouldUploadNext();
  294. if (false !== t2) {
  295. !e3 && this._trigger("uploadStart");
  296. for (var i2 = false, s2 = 1; s2 <= this.opts.simultaneousUploads - t2 && ((i2 = this.uploadNextChunk(!e3) || i2) || !e3); s2++)
  297. ;
  298. i2 || e3 || this._triggerAsync("complete");
  299. }
  300. }, _shouldUploadNext: function() {
  301. var e3 = 0, t2 = true, i2 = this.opts.simultaneousUploads, r2 = o.STATUS.UPLOADING;
  302. return s.each(this.files, function(n2) {
  303. return s.each(n2.chunks, function(s2) {
  304. if (s2.status() === r2 && ++e3 >= i2)
  305. return t2 = false, false;
  306. }), t2;
  307. }), t2 && e3;
  308. }, assignBrowse: function(e3, t2, i2, r2) {
  309. void 0 === e3.length && (e3 = [e3]), s.each(e3, function(e4) {
  310. var n2;
  311. "INPUT" === e4.tagName && "file" === e4.type ? n2 = e4 : ((n2 = document.createElement("input")).setAttribute("type", "file"), s.extend(n2.style, { visibility: "hidden", position: "absolute", width: "1px", height: "1px" }), e4.appendChild(n2), e4.addEventListener("click", function(t3) {
  312. "label" !== e4.tagName.toLowerCase() && n2.click();
  313. }, false)), this.opts.singleFile || i2 || n2.setAttribute("multiple", "multiple"), t2 && n2.setAttribute("webkitdirectory", "webkitdirectory"), r2 && s.each(r2, function(e5, t3) {
  314. n2.setAttribute(t3, e5);
  315. });
  316. var o2 = this;
  317. n2.addEventListener("change", function(e5) {
  318. o2._trigger(e5.type, e5), e5.target.value && (o2.addFiles(e5.target.files, e5), e5.target.value = "");
  319. }, false);
  320. }, this);
  321. }, onDrop: function(e3) {
  322. this._trigger(e3.type, e3), this.opts.onDropStopPropagation && e3.stopPropagation(), e3.preventDefault(), this._parseDataTransfer(e3.dataTransfer, e3);
  323. }, _parseDataTransfer: function(e3, t2) {
  324. e3.items && e3.items[0] && e3.items[0].webkitGetAsEntry ? this.webkitReadDataTransfer(e3, t2) : this.addFiles(e3.files, t2);
  325. }, webkitReadDataTransfer: function(e3, t2) {
  326. var i2 = this, r2 = e3.items.length, n2 = [];
  327. function o2(e4) {
  328. e4.readEntries(function(t3) {
  329. t3.length ? (r2 += t3.length, s.each(t3, function(e5) {
  330. if (e5.isFile) {
  331. var t4 = e5.fullPath;
  332. e5.file(function(e6) {
  333. a2(e6, t4);
  334. }, l2);
  335. } else
  336. e5.isDirectory && o2(e5.createReader());
  337. }), o2(e4)) : u2();
  338. }, l2);
  339. }
  340. function a2(e4, t3) {
  341. e4.relativePath = t3.substring(1), n2.push(e4), u2();
  342. }
  343. function l2(e4) {
  344. throw e4;
  345. }
  346. function u2() {
  347. 0 == --r2 && i2.addFiles(n2, t2);
  348. }
  349. s.each(e3.items, function(e4) {
  350. var t3 = e4.webkitGetAsEntry();
  351. t3 ? t3.isFile ? a2(e4.getAsFile(), t3.fullPath) : o2(t3.createReader()) : u2();
  352. });
  353. }, _assignHelper: function(e3, t2, i2) {
  354. void 0 === e3.length && (e3 = [e3]);
  355. var r2 = i2 ? "removeEventListener" : "addEventListener";
  356. s.each(e3, function(e4) {
  357. s.each(t2, function(t3, i3) {
  358. e4[r2](i3, t3, false);
  359. }, this);
  360. }, this);
  361. }, _preventEvent: function(e3) {
  362. s.preventEvent(e3), this._trigger(e3.type, e3);
  363. }, assignDrop: function(e3) {
  364. this._onDrop = s.bind(this.onDrop, this), this._assignHelper(e3, { dragover: this.preventEvent, dragenter: this.preventEvent, dragleave: this.preventEvent, drop: this._onDrop });
  365. }, unAssignDrop: function(e3) {
  366. this._assignHelper(e3, { dragover: this.preventEvent, dragenter: this.preventEvent, dragleave: this.preventEvent, drop: this._onDrop }, true), this._onDrop = null;
  367. } }), t.exports = d;
  368. }, { "./chunk": 1, "./event": 2, "./file": 4, "./utils": 5 }], 4: [function(e2, t, i) {
  369. var s = e2("./utils"), r = e2("./chunk");
  370. function n(e3, t2, i2) {
  371. s.defineNonEnumerable(this, "uploader", e3), this.isRoot = this.isFolder = e3 === this, s.defineNonEnumerable(this, "parent", i2 || null), s.defineNonEnumerable(this, "files", []), s.defineNonEnumerable(this, "fileList", []), s.defineNonEnumerable(this, "chunks", []), s.defineNonEnumerable(this, "_errorFiles", []), s.defineNonEnumerable(this, "file", null), this.id = s.uid(), this.isRoot || !t2 ? this.file = null : s.isString(t2) ? (this.isFolder = true, this.file = null, this.path = t2, this.parent.path && (t2 = t2.substr(this.parent.path.length)), this.name = "/" === t2.charAt(t2.length - 1) ? t2.substr(0, t2.length - 1) : t2) : (this.file = t2, this.fileType = this.file.type, this.name = t2.fileName || t2.name, this.size = t2.size, this.relativePath = t2.relativePath || t2.webkitRelativePath || this.name, this._parseFile()), this.paused = e3.opts.initialPaused, this.error = false, this.allError = false, this.aborted = false, this.completed = false, this.averageSpeed = 0, this.currentSpeed = 0, this._lastProgressCallback = Date.now(), this._prevUploadedSize = 0, this._prevProgress = 0, this.bootstrap();
  372. }
  373. function o(e3) {
  374. var t2 = [], i2 = e3.split("/"), s2 = i2.length, r2 = 1;
  375. if (i2.splice(s2 - 1, 1), s2--, i2.length)
  376. for (; r2 <= s2; )
  377. t2.push(i2.slice(0, r2++).join("/") + "/");
  378. return t2;
  379. }
  380. s.extend(n.prototype, { _parseFile: function() {
  381. var e3 = o(this.relativePath);
  382. if (e3.length) {
  383. var t2 = this.uploader.filePaths;
  384. s.each(e3, function(i2, s2) {
  385. var r2 = t2[i2];
  386. r2 || (r2 = new n(this.uploader, i2, this.parent), t2[i2] = r2, this._updateParentFileList(r2)), this.parent = r2, r2.files.push(this), e3[s2 + 1] || r2.fileList.push(this);
  387. }, this);
  388. } else
  389. this._updateParentFileList();
  390. }, _updateParentFileList: function(e3) {
  391. e3 || (e3 = this);
  392. var t2 = this.parent;
  393. t2 && t2.fileList.push(e3);
  394. }, _eachAccess: function(e3, t2) {
  395. this.isFolder ? s.each(this.files, function(t3, i2) {
  396. return e3.call(this, t3, i2);
  397. }, this) : t2.call(this, this);
  398. }, bootstrap: function() {
  399. if (!this.isFolder) {
  400. var e3 = this.uploader.opts;
  401. s.isFunction(e3.initFileFn) && e3.initFileFn.call(this, this), this.abort(true), this._resetError(), this._prevProgress = 0;
  402. for (var t2 = e3.forceChunkSize ? Math.ceil : Math.floor, i2 = Math.max(t2(this.size / e3.chunkSize), 1), n2 = 0; n2 < i2; n2++)
  403. this.chunks.push(new r(this.uploader, this, n2));
  404. }
  405. }, _measureSpeed: function() {
  406. var e3 = this.uploader.opts.speedSmoothingFactor, t2 = Date.now() - this._lastProgressCallback;
  407. if (t2) {
  408. var i2 = this.sizeUploaded();
  409. this.currentSpeed = Math.max((i2 - this._prevUploadedSize) / t2 * 1e3, 0), this.averageSpeed = e3 * this.currentSpeed + (1 - e3) * this.averageSpeed, this._prevUploadedSize = i2, this.parent && this.parent._checkProgress() && this.parent._measureSpeed();
  410. }
  411. }, _checkProgress: function(e3) {
  412. return Date.now() - this._lastProgressCallback >= this.uploader.opts.progressCallbacksInterval;
  413. }, _chunkEvent: function(e3, t2, i2) {
  414. var s2 = this.uploader, n2 = r.STATUS, o2 = this, a = this.getRoot(), l = function() {
  415. o2._measureSpeed(), s2._trigger("fileProgress", a, o2, e3), o2._lastProgressCallback = Date.now();
  416. };
  417. switch (t2) {
  418. case n2.PROGRESS:
  419. this._checkProgress() && l();
  420. break;
  421. case n2.ERROR:
  422. this._error(), this.abort(true), s2._trigger("fileError", a, this, i2, e3);
  423. break;
  424. case n2.SUCCESS:
  425. if (this._updateUploadedChunks(i2, e3), this.error)
  426. return;
  427. clearTimeout(this._progeressId), this._progeressId = 0;
  428. var u = Date.now() - this._lastProgressCallback;
  429. u < s2.opts.progressCallbacksInterval && (this._progeressId = setTimeout(l, s2.opts.progressCallbacksInterval - u)), this.isComplete() ? (clearTimeout(this._progeressId), l(), this.currentSpeed = 0, this.averageSpeed = 0, s2._trigger("fileSuccess", a, this, i2, e3), a.isComplete() && s2._trigger("fileComplete", a, this)) : this._progeressId || l();
  430. break;
  431. case n2.RETRY:
  432. s2._trigger("fileRetry", a, this, e3);
  433. }
  434. }, _updateUploadedChunks: function(e3, t2) {
  435. var i2 = this.uploader.opts.checkChunkUploadedByResponse;
  436. if (i2) {
  437. var r2 = t2.xhr;
  438. s.each(this.chunks, function(s2) {
  439. if (!s2.tested) {
  440. var n2 = i2.call(this, s2, e3);
  441. s2 !== t2 || n2 || (s2.xhr = null), n2 && (s2.xhr = r2), s2.tested = true;
  442. }
  443. }, this), this._firstResponse ? this.uploader.uploadNextChunk() : (this._firstResponse = true, this.uploader.upload(true));
  444. } else
  445. this.uploader.uploadNextChunk();
  446. }, _error: function() {
  447. this.error = this.allError = true;
  448. for (var e3 = this.parent; e3 && e3 !== this.uploader; )
  449. e3._errorFiles.push(this), e3.error = true, e3._errorFiles.length === e3.files.length && (e3.allError = true), e3 = e3.parent;
  450. }, _resetError: function() {
  451. this.error = this.allError = false;
  452. for (var e3 = this.parent, t2 = -1; e3 && e3 !== this.uploader; )
  453. t2 = e3._errorFiles.indexOf(this), e3._errorFiles.splice(t2, 1), e3.allError = false, e3._errorFiles.length || (e3.error = false), e3 = e3.parent;
  454. }, isComplete: function() {
  455. if (!this.completed) {
  456. var e3 = false;
  457. this._eachAccess(function(t2) {
  458. if (!t2.isComplete())
  459. return e3 = true, false;
  460. }, function() {
  461. if (this.error)
  462. e3 = true;
  463. else {
  464. var t2 = r.STATUS;
  465. s.each(this.chunks, function(i2) {
  466. var s2 = i2.status();
  467. if (s2 === t2.ERROR || s2 === t2.PENDING || s2 === t2.UPLOADING || s2 === t2.READING || 1 === i2.preprocessState || 1 === i2.readState)
  468. return e3 = true, false;
  469. });
  470. }
  471. }), this.completed = !e3;
  472. }
  473. return this.completed;
  474. }, isUploading: function() {
  475. var e3 = false;
  476. return this._eachAccess(function(t2) {
  477. if (t2.isUploading())
  478. return e3 = true, false;
  479. }, function() {
  480. var t2 = r.STATUS.UPLOADING;
  481. s.each(this.chunks, function(i2) {
  482. if (i2.status() === t2)
  483. return e3 = true, false;
  484. });
  485. }), e3;
  486. }, resume: function() {
  487. this._eachAccess(function(e3) {
  488. e3.resume();
  489. }, function() {
  490. this.paused = false, this.aborted = false, this.uploader.upload();
  491. }), this.paused = false, this.aborted = false;
  492. }, pause: function() {
  493. this._eachAccess(function(e3) {
  494. e3.pause();
  495. }, function() {
  496. this.paused = true, this.abort();
  497. }), this.paused = true;
  498. }, cancel: function() {
  499. this.uploader.removeFile(this);
  500. }, retry: function(e3) {
  501. var t2 = function(e4) {
  502. e4.error && e4.bootstrap();
  503. };
  504. e3 ? e3.bootstrap() : this._eachAccess(t2, function() {
  505. this.bootstrap();
  506. }), this.uploader.upload();
  507. }, abort: function(e3) {
  508. if (!this.aborted) {
  509. this.currentSpeed = 0, this.averageSpeed = 0, this.aborted = !e3;
  510. var t2 = this.chunks;
  511. e3 && (this.chunks = []);
  512. var i2 = r.STATUS.UPLOADING;
  513. s.each(t2, function(e4) {
  514. e4.status() === i2 && (e4.abort(), this.uploader.uploadNextChunk());
  515. }, this);
  516. }
  517. }, progress: function() {
  518. var e3 = 0, t2 = 0, i2 = 0;
  519. return this._eachAccess(function(s2, r2) {
  520. e3 += s2.progress() * s2.size, t2 += s2.size, r2 === this.files.length - 1 && (i2 = t2 > 0 ? e3 / t2 : this.isComplete() ? 1 : 0);
  521. }, function() {
  522. if (this.error)
  523. i2 = 1;
  524. else {
  525. if (1 === this.chunks.length)
  526. return this._prevProgress = Math.max(this._prevProgress, this.chunks[0].progress()), void (i2 = this._prevProgress);
  527. var e4 = 0;
  528. s.each(this.chunks, function(t4) {
  529. e4 += t4.progress() * (t4.endByte - t4.startByte);
  530. });
  531. var t3 = e4 / this.size;
  532. this._prevProgress = Math.max(this._prevProgress, t3 > 0.9999 ? 1 : t3), i2 = this._prevProgress;
  533. }
  534. }), i2;
  535. }, getSize: function() {
  536. var e3 = 0;
  537. return this._eachAccess(function(t2) {
  538. e3 += t2.size;
  539. }, function() {
  540. e3 += this.size;
  541. }), e3;
  542. }, getFormatSize: function() {
  543. var e3 = this.getSize();
  544. return s.formatSize(e3);
  545. }, getRoot: function() {
  546. if (this.isRoot)
  547. return this;
  548. for (var e3 = this.parent; e3; ) {
  549. if (e3.parent === this.uploader)
  550. return e3;
  551. e3 = e3.parent;
  552. }
  553. return this;
  554. }, sizeUploaded: function() {
  555. var e3 = 0;
  556. return this._eachAccess(function(t2) {
  557. e3 += t2.sizeUploaded();
  558. }, function() {
  559. s.each(this.chunks, function(t2) {
  560. e3 += t2.sizeUploaded();
  561. });
  562. }), e3;
  563. }, timeRemaining: function() {
  564. var e3 = 0, t2 = 0, i2 = 0;
  565. return this._eachAccess(function(r2, n2) {
  566. r2.paused || r2.error || (t2 += r2.size - r2.sizeUploaded(), i2 += r2.averageSpeed), n2 === this.files.length - 1 && (e3 = s2(t2, i2));
  567. }, function() {
  568. if (this.paused || this.error)
  569. e3 = 0;
  570. else {
  571. var t3 = this.size - this.sizeUploaded();
  572. e3 = s2(t3, this.averageSpeed);
  573. }
  574. }), e3;
  575. function s2(e4, t3) {
  576. return e4 && !t3 ? Number.POSITIVE_INFINITY : e4 || t3 ? Math.floor(e4 / t3) : 0;
  577. }
  578. }, removeFile: function(e3) {
  579. if (e3.isFolder)
  580. for (; e3.files.length; ) {
  581. var t2 = e3.files[e3.files.length - 1];
  582. this._removeFile(t2);
  583. }
  584. this._removeFile(e3);
  585. }, _delFilePath: function(e3) {
  586. e3.path && this.filePaths && delete this.filePaths[e3.path], s.each(e3.fileList, function(e4) {
  587. this._delFilePath(e4);
  588. }, this);
  589. }, _removeFile: function(e3) {
  590. if (!e3.isFolder) {
  591. s.each(this.files, function(t3, i3) {
  592. if (t3 === e3)
  593. return this.files.splice(i3, 1), false;
  594. }, this), e3.abort();
  595. for (var t2, i2 = e3.parent; i2 && i2 !== this; )
  596. t2 = i2.parent, i2._removeFile(e3), i2 = t2;
  597. }
  598. e3.parent === this && s.each(this.fileList, function(t3, i3) {
  599. if (t3 === e3)
  600. return this.fileList.splice(i3, 1), false;
  601. }, this), this.isRoot || !this.isFolder || this.files.length || (this.parent._removeFile(this), this.uploader._delFilePath(this)), e3.parent = null;
  602. }, getType: function() {
  603. return this.isFolder ? "folder" : this.file.type && this.file.type.split("/")[1];
  604. }, getExtension: function() {
  605. return this.isFolder ? "" : this.name.substr(2 + (~-this.name.lastIndexOf(".") >>> 0)).toLowerCase();
  606. } }), t.exports = n;
  607. }, { "./chunk": 1, "./utils": 5 }], 5: [function(e2, t, i) {
  608. var s = Object.prototype, r = Array.prototype, n = s.toString, o = function(e3) {
  609. return "[object Function]" === n.call(e3);
  610. }, a = Array.isArray || function(e3) {
  611. return "[object Array]" === n.call(e3);
  612. }, l = function(e3) {
  613. return "[object Object]" === n.call(e3) && Object.getPrototypeOf(e3) === s;
  614. }, u = 0, h = { uid: function() {
  615. return ++u;
  616. }, noop: function() {
  617. }, bind: function(e3, t2) {
  618. return function() {
  619. return e3.apply(t2, arguments);
  620. };
  621. }, preventEvent: function(e3) {
  622. e3.preventDefault();
  623. }, stop: function(e3) {
  624. e3.preventDefault(), e3.stopPropagation();
  625. }, nextTick: function(e3, t2) {
  626. setTimeout(h.bind(e3, t2), 0);
  627. }, toArray: function(e3, t2, i2) {
  628. return void 0 === t2 && (t2 = 0), void 0 === i2 && (i2 = e3.length), r.slice.call(e3, t2, i2);
  629. }, isPlainObject: l, isFunction: o, isArray: a, isObject: function(e3) {
  630. return Object(e3) === e3;
  631. }, isString: function(e3) {
  632. return "string" == typeof e3;
  633. }, isUndefined: function(e3) {
  634. return void 0 === e3;
  635. }, isDefined: function(e3) {
  636. return void 0 !== e3;
  637. }, each: function(e3, t2, i2) {
  638. if (h.isDefined(e3.length))
  639. for (var s2 = 0, r2 = e3.length; s2 < r2 && false !== t2.call(i2, e3[s2], s2, e3); s2++)
  640. ;
  641. else
  642. for (var n2 in e3)
  643. if (false === t2.call(i2, e3[n2], n2, e3))
  644. break;
  645. }, evalOpts: function(e3, t2) {
  646. return h.isFunction(e3) && (t2 = h.toArray(arguments), e3 = e3.apply(null, t2.slice(1))), e3;
  647. }, extend: function() {
  648. var e3, t2, i2, s2, r2, n2, u2 = arguments[0] || {}, p = 1, d = arguments.length, f = false;
  649. for ("boolean" == typeof u2 && (f = u2, u2 = arguments[1] || {}, p++), "object" == typeof u2 || o(u2) || (u2 = {}), p === d && (u2 = this, p--); p < d; p++)
  650. if (null != (e3 = arguments[p]))
  651. for (t2 in e3)
  652. i2 = u2[t2], u2 !== (s2 = e3[t2]) && (f && s2 && (l(s2) || (r2 = a(s2))) ? (r2 ? (r2 = false, n2 = i2 && a(i2) ? i2 : []) : n2 = i2 && l(i2) ? i2 : {}, u2[t2] = h.extend(f, n2, s2)) : void 0 !== s2 && (u2[t2] = s2));
  653. return u2;
  654. }, formatSize: function(e3) {
  655. return e3 < 1024 ? e3.toFixed(0) + " bytes" : e3 < 1048576 ? (e3 / 1024).toFixed(0) + " KB" : e3 < 1073741824 ? (e3 / 1024 / 1024).toFixed(1) + " MB" : (e3 / 1024 / 1024 / 1024).toFixed(1) + " GB";
  656. }, defineNonEnumerable: function(e3, t2, i2) {
  657. Object.defineProperty(e3, t2, { enumerable: false, configurable: true, writable: true, value: i2 });
  658. } };
  659. t.exports = h;
  660. }, {}] }, {}, [3])(3);
  661. function C(e2) {
  662. return e2.replace(/[A-Z]/g, (e3) => `-${e3.toLowerCase()}`);
  663. }
  664. var A = { name: "uploader-btn", props: { directory: { type: Boolean, default: false }, single: { type: Boolean, default: false }, attrs: { type: Object, default: () => ({}) } }, setup(r) {
  665. const n = ref(null), o = inject("uploader"), a = o.support;
  666. return onMounted(() => {
  667. nextTick(() => {
  668. o.assignBrowse(n.value, r.directory, r.single, r.attrs);
  669. });
  670. }), { btn: n, support: a };
  671. } };
  672. var P = { class: "uploader-btn", ref: "btn" };
  673. A.render = function(e2, t, i, s, u, h) {
  674. return withDirectives((openBlock(), createBlock("label", P, [renderSlot(e2.$slots, "default")], 512)), [[vShow, s.support]]);
  675. };
  676. var U = { name: "uploader-drop", setup() {
  677. const i = inject("uploader");
  678. let r = ref(null), n = ref("");
  679. const o = i.support, a = () => {
  680. n = "uploader-dragover";
  681. }, l = () => {
  682. n = "";
  683. }, h = () => {
  684. n = "uploader-droped";
  685. };
  686. return nextTick(() => {
  687. const e2 = r.value;
  688. i.assignDrop(e2), i.on("dragenter", a), i.on("dragleave", l), i.on("drop", h);
  689. }), onBeforeUnmount(() => {
  690. const e2 = r.value;
  691. i.off("dragenter", a), i.off("dragleave", l), i.off("drop", h), i.unAssignDrop(e2);
  692. }), { drop: r, dropClass: n, support: o, onDragEnter: a, onDragLeave: l, onDrop: h };
  693. } };
  694. U.render = function(e2, t, i, s, u, h) {
  695. return withDirectives((openBlock(), createBlock("div", { class: ["uploader-drop", s.dropClass], ref: "drop" }, [renderSlot(e2.$slots, "default")], 2)), [[vShow, s.support]]);
  696. };
  697. var w = { name: "uploader-unsupport", setup: () => ({ support: inject("uploader").support }) };
  698. var D = { class: "uploader-unsupport" };
  699. var z = createVNode("p", null, [createTextVNode(" Your browser, unfortunately, is not supported by Uploader.js. The library requires support for "), createVNode("a", { href: "http://www.w3.org/TR/FileAPI/" }, "the HTML5 File API"), createTextVNode(" along with "), createVNode("a", { href: "http://www.w3.org/TR/FileAPI/#normalization-of-params" }, "file slicing"), createTextVNode(". ")], -1);
  700. w.render = function(e2, t, i, s, u, h) {
  701. return withDirectives((openBlock(), createBlock("div", D, [renderSlot(e2.$slots, "default", {}, () => [z])], 512)), [[vShow, !s.support]]);
  702. };
  703. var T = ["fileProgress", "fileSuccess", "fileComplete", "fileError"];
  704. var N = { name: "uploader-file", props: { file: { type: Object, default: () => ({}) }, list: { type: Boolean, default: false } }, setup(t) {
  705. const s = getCurrentInstance();
  706. let r = {}, n = 0;
  707. const o = ref(null), a = ref(false), l = ref(false), u = ref(0), h = ref(0), p = ref(false), g = ref(false), S = ref(0), y = ref(""), _ = ref(0), b = ref(0), k = ref(0), R = ref(""), F2 = ref(""), E2 = ref(""), C2 = computed(() => {
  708. let e2 = t.file.isFolder ? "folder" : "unknown";
  709. const i = t.file.uploader.opts.categoryMap || { image: ["gif", "jpg", "jpeg", "png", "bmp", "webp"], video: ["mp4", "m3u8", "rmvb", "avi", "swf", "3gp", "mkv", "flv"], audio: ["mp3", "wav", "wma", "ogg", "aac", "flac"], document: ["doc", "txt", "docx", "pages", "epub", "pdf", "numbers", "csv", "xls", "xlsx", "keynote", "ppt", "pptx"] };
  710. return Object.keys(i).forEach((t2) => {
  711. i[t2].indexOf(F2.value) > -1 && (e2 = t2);
  712. }), e2;
  713. }), A2 = computed(() => {
  714. b.value = Math.floor(100 * b.value);
  715. const e2 = `translateX(${Math.floor(b.value - 100)}%)`;
  716. return { progress: `${b.value}%`, webkitTransform: e2, mozTransform: e2, msTransform: e2, transform: e2 };
  717. }), P2 = computed(() => `${x.utils.formatSize(u.value)} / s`), U2 = computed(() => {
  718. let e2 = l;
  719. return p.value ? "success" : e2.value ? "error" : g.value ? "uploading" : a.value ? "paused" : "waiting";
  720. }), w2 = computed(() => {
  721. const e2 = t.file.uploader.fileStatusText;
  722. let i = U2.value;
  723. return i = "function" == typeof e2 ? e2(U2.value, o.value) : e2[U2.value], i || U2;
  724. }), D2 = computed(() => {
  725. const e2 = t.file;
  726. if (k.value === Number.POSITIVE_INFINITY || 0 === k.value)
  727. return "";
  728. let i = function(e3) {
  729. const t2 = Math.floor(e3 / 31536e3);
  730. if (t2)
  731. return t2 + " year" + o2(t2);
  732. const i2 = Math.floor((e3 %= 31536e3) / 86400);
  733. if (i2)
  734. return i2 + " day" + o2(i2);
  735. const s3 = Math.floor((e3 %= 86400) / 3600);
  736. if (s3)
  737. return s3 + " hour" + o2(s3);
  738. const r2 = Math.floor((e3 %= 3600) / 60);
  739. if (r2)
  740. return r2 + " minute" + o2(r2);
  741. const n2 = e3 % 60;
  742. return n2 + " second" + o2(n2);
  743. function o2(e4) {
  744. return e4 > 1 ? "s" : "";
  745. }
  746. }(k.value);
  747. const s2 = e2.uploader.opts.parseTimeRemaining;
  748. return s2 && (i = s2(k.value, i)), i;
  749. }), z2 = () => {
  750. a.value = t.file.paused, l.value = t.file.error, g.value = t.file.isUploading();
  751. }, N2 = (e2) => {
  752. let t2 = e2;
  753. try {
  754. t2 = JSON.parse(e2);
  755. } catch (i) {
  756. }
  757. o.value = t2;
  758. }, I2 = (e2, i) => {
  759. const r2 = i[0], n2 = i[1], o2 = t.list ? r2 : n2;
  760. if (toRaw(t.file) === toRaw(o2)) {
  761. if (t.list && "fileSuccess" === e2)
  762. return void N2(i[2]);
  763. s.setupState[e2](...i);
  764. }
  765. }, L2 = () => {
  766. b.value = t.file.progress(), u.value = t.file.averageSpeed, h.value = t.file.currentSpeed, k.value = t.file.timeRemaining(), _.value = t.file.sizeUploaded(), z2();
  767. }, O2 = (e2, t2, i) => {
  768. e2 && N2(i), L2(), l.value = false, p.value = true, g.value = false;
  769. };
  770. return watch(U2, (e2, t2) => {
  771. t2 && "uploading" === e2 && "uploading" !== t2 ? n = setTimeout(() => {
  772. E2.value = "uploader-file-progressing";
  773. }, 200) : (clearTimeout(n), E2.value = "");
  774. }), onMounted(() => {
  775. a.value = t.file.paused, l.value = t.file.error, u.value = t.file.averageSpeed, h.value = t.file.currentSpeed, p.value = t.file.isComplete(), g.value = t.file.isUploading(), S.value = t.file.getSize(), y.value = t.file.getFormatSize(), _.value = t.file.sizeUploaded(), b.value = t.file.progress(), k.value = t.file.timeRemaining(), R.value = t.file.getType(), F2.value = t.file.getExtension();
  776. T.forEach((e2) => {
  777. t.file.uploader.on(e2, ((e3) => (r[e3] = (...t2) => {
  778. I2(e3, t2);
  779. }, r[e3]))(e2));
  780. });
  781. }), onUnmounted(() => {
  782. T.forEach((e2) => {
  783. t.file.uploader.off(e2, r[e2]);
  784. }), r = null;
  785. }), { response: o, paused: a, error: l, averageSpeed: u, currentSpeed: h, isComplete: p, isUploading: g, size: S, formatedSize: y, uploadedSize: _, progress: b, timeRemaining: k, type: R, extension: F2, progressingClass: E2, fileCategory: C2, progressStyle: A2, formatedAverageSpeed: P2, status: U2, statusText: w2, formatedTimeRemaining: D2, actionCheck: z2, pause: () => {
  786. t.file.pause(), z2(), L2();
  787. }, resume: () => {
  788. t.file.resume(), z2();
  789. }, remove: () => {
  790. t.file.cancel();
  791. }, retry: () => {
  792. t.file.retry(), z2();
  793. }, processResponse: N2, fileEventsHandler: I2, fileProgress: L2, fileSuccess: O2, fileComplete: () => {
  794. O2();
  795. }, fileError: (e2, t2, i) => {
  796. L2(), N2(i), l.value = true, p.value = false, g.value = false;
  797. } };
  798. } };
  799. var I = { class: "uploader-file-info" };
  800. var L = { class: "uploader-file-name" };
  801. var O = { class: "uploader-file-size" };
  802. var B = createVNode("div", { class: "uploader-file-meta" }, null, -1);
  803. var G = { class: "uploader-file-status" };
  804. var M = { class: "uploader-file-actions" };
  805. N.render = function(e2, t, i, s, u, d) {
  806. return openBlock(), createBlock("div", { class: "uploader-file", status: s.status }, [renderSlot(e2.$slots, "default", { file: i.file, list: i.list, status: s.status, paused: s.paused, error: s.error, response: s.response, averageSpeed: s.averageSpeed, formatedAverageSpeed: s.formatedAverageSpeed, currentSpeed: s.currentSpeed, isComplete: s.isComplete, isUploading: s.isUploading, size: s.size, formatedSize: s.formatedSize, uploadedSize: s.uploadedSize, progress: s.progress, progressStyle: s.progressStyle, progressingClass: s.progressingClass, timeRemaining: s.timeRemaining, formatedTimeRemaining: s.formatedTimeRemaining, type: s.type, extension: s.extension, fileCategory: s.fileCategory }, () => [createVNode("div", { class: ["uploader-file-progress", s.progressingClass], style: s.progressStyle }, null, 6), createVNode("div", I, [createVNode("div", L, [createVNode("i", { class: "uploader-file-icon", icon: s.fileCategory }, null, 8, ["icon"]), createTextVNode(toDisplayString(i.file.name), 1)]), createVNode("div", O, toDisplayString(s.formatedSize), 1), B, createVNode("div", G, [withDirectives(createVNode("span", null, toDisplayString(s.statusText), 513), [[vShow, "uploading" !== s.status]]), withDirectives(createVNode("span", null, [createVNode("span", null, toDisplayString(s.progressStyle.progress) + " ", 1), createVNode("em", null, toDisplayString(s.formatedAverageSpeed) + " ", 1), createVNode("i", null, toDisplayString(s.formatedTimeRemaining), 1)], 512), [[vShow, "uploading" === s.status]])]), createVNode("div", M, [createVNode("span", { class: "uploader-file-pause", onClick: t[1] || (t[1] = (...e3) => s.pause && s.pause(...e3)) }), createVNode("span", { class: "uploader-file-resume", onClick: t[2] || (t[2] = (...e3) => s.resume && s.resume(...e3)) }, "️"), createVNode("span", { class: "uploader-file-retry", onClick: t[3] || (t[3] = (...e3) => s.retry && s.retry(...e3)) }), createVNode("span", { class: "uploader-file-remove", onClick: t[4] || (t[4] = (...e3) => s.remove && s.remove(...e3)) })])])])], 8, ["status"]);
  807. };
  808. var j = { name: "uploader-list", components: { UploaderFile: N }, setup: () => ({ fileList: inject("uploader").fileList }) };
  809. var q = { class: "uploader-list" };
  810. j.render = function(e2, t, i, s, r, l) {
  811. const u = resolveComponent("uploader-file");
  812. return openBlock(), createBlock("div", q, [renderSlot(e2.$slots, "default", { fileList: s.fileList }, () => [createVNode("ul", null, [(openBlock(true), createBlock(Fragment, null, renderList(s.fileList, (e3) => (openBlock(), createBlock("li", { key: e3.id }, [createVNode(u, { file: e3, list: true }, null, 8, ["file"])]))), 128))])])]);
  813. };
  814. var $ = { name: "uploader-files", components: { UploaderFile: N }, setup: () => ({ files: inject("uploader").files }) };
  815. var H = { class: "uploader-files" };
  816. $.render = function(e2, t, i, s, r, l) {
  817. const u = resolveComponent("uploader-file");
  818. return openBlock(), createBlock("div", H, [renderSlot(e2.$slots, "default", { files: s.files }, () => [createVNode("ul", null, [(openBlock(true), createBlock(Fragment, null, renderList(s.files, (e3) => (openBlock(), createBlock("li", { key: e3.id }, [createVNode(u, { file: e3 }, null, 8, ["file"])]))), 128))])])]);
  819. };
  820. var X = { name: "uploader", props: { options: { type: Object, default: () => ({}) }, autoStart: { type: Boolean, default: true }, fileStatusText: { type: [Object, Function], default: () => ({ success: "success", error: "error", uploading: "uploading", paused: "paused", waiting: "waiting" }) }, onFileAdded: Function, onFilesAdded: Function }, setup(t, { emit: i }) {
  821. const s = ref(null), r = ref(false), n = ref([]), o = ref([]), a = getCurrentInstance();
  822. let l = new x(t.options);
  823. const u = (e2) => {
  824. const s2 = reactive(e2);
  825. if (t.onFileAdded) {
  826. if (false === t.onFileAdded(s2))
  827. return false;
  828. }
  829. if (i(C("fileAdded"), s2), s2.ignored)
  830. return false;
  831. }, h = (e2, s2) => {
  832. if (t.onFilesAdded) {
  833. if (false === t.onFilesAdded(e2, s2))
  834. return false;
  835. }
  836. if (i(C("filesAdded"), e2, s2), e2.ignored || s2.ignored)
  837. return false;
  838. }, p = () => {
  839. n.value = l.files, o.value = l.fileList;
  840. }, f = () => {
  841. n.value = l.files, o.value = l.fileList, t.autoStart && l.upload();
  842. }, c = (...e2) => {
  843. const t2 = e2[0], s2 = { fileAdded: true, filesAdded: true, uploadStart: "uploadStart" }[t2];
  844. if (s2) {
  845. if (true === s2)
  846. return;
  847. a.setupState[s2](...e2.slice(1));
  848. }
  849. e2[0] = C(t2), i(...e2);
  850. };
  851. return t.options.initialPaused = !t.autoStart, l.fileStatusText = t.fileStatusText, l.on("catchAll", c), l.on("fileAdded", u), l.on("filesAdded", h), l.on("fileRemoved", p), l.on("filesSubmitted", f), onUnmounted(() => {
  852. l.off("catchAll", c), l.off("fileAdded", u), l.off("filesAdded", h), l.off("fileRemoved", p), l.off("filesSubmitted", f), l = null;
  853. }), provide("uploader", reactive(l)), { uploader: l, started: r, files: n, fileList: o, uploadStart: () => {
  854. r.value = true;
  855. }, fileAdded: u, filesAdded: h, fileRemoved: p, filesSubmitted: f, allEvent: c, uploaderList: s };
  856. }, components: { UploaderBtn: A, UploaderDrop: U, UploaderUnsupport: w, UploaderList: j, UploaderFiles: $, UploaderFile: N } };
  857. var Y = { class: "uploader" };
  858. var V = createVNode("p", null, "Drop files here to upload or", -1);
  859. var Z = createTextVNode("select files");
  860. var J = createTextVNode("select folder");
  861. X.render = function(e2, t, i, s, r, l) {
  862. const u = resolveComponent("uploader-unsupport"), p = resolveComponent("uploader-btn"), d = resolveComponent("uploader-drop"), f = resolveComponent("uploader-list");
  863. return openBlock(), createBlock("div", Y, [renderSlot(e2.$slots, "default", { files: s.files, fileList: s.fileList, started: s.started }, () => [createVNode(u), createVNode(d, null, { default: withCtx(() => [V, createVNode(p, null, { default: withCtx(() => [Z]), _: 1 }), createVNode(p, { directory: true }, { default: withCtx(() => [J]), _: 1 })]), _: 1 }), createVNode(f)])]);
  864. };
  865. var K = { version: "1.0.0", install: function(e2, t) {
  866. e2.component(X.name, X), e2.component(A.name, A), e2.component(U.name, U), e2.component(w.name, w), e2.component(j.name, j), e2.component($.name, $), e2.component(N.name, N);
  867. }, Uploader: X, UploaderBtn: A, UploaderDrop: U, UploaderUnsupport: w, UploaderList: j, UploaderFiles: $, UploaderFile: N };
  868. var vue_simple_uploader_es_default = K;
  869. export {
  870. vue_simple_uploader_es_default as default
  871. };
  872. /*! Bundled license information:
  873. vue-simple-uploader/dist/vue-simple-uploader.es.js:
  874. (*!
  875. * Uploader - Uploader library implements html5 file upload and provides multiple simultaneous, stable, fault tolerant and resumable uploads
  876. * @version v0.6.0
  877. * @author dolymood <dolymood@gmail.com>
  878. * @link https://github.com/simple-uploader/Uploader
  879. * @license MIT
  880. *)
  881. */
  882. //# sourceMappingURL=vue-simple-uploader.js.map