index16.js 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775
  1. import { X as He, Y as qe, Z as We, $ as Ge, n as Ve, _ as O, a0 as Ke, i as ve, a1 as Q, a2 as J, j as se, a3 as B, f as V, a4 as w, d as S, u as he, a5 as Je, a6 as Ye, a7 as Ze, a8 as Qe, a9 as ke, aa as et, ab as tt, ac as nt, ad as ot, ae as rt, N as be, af as it, p as at, U as $e, ag as Re, t as Pe, ah as De, ai as lt, g as st, m as ct, aj as dt, r as ut, E as pt, I as ft, z as mt, h as ue, ak as gt, al as vt, c as k, am as ht } from "./index2.js";
  2. import { defineComponent as Y, ref as ne, onMounted as ce, onBeforeUnmount as Oe, createVNode as m, shallowRef as te, watch as Te, computed as oe, Transition as wt, withDirectives as _e, vShow as Ue, watchEffect as yt, triggerRef as bt, TransitionGroup as $t, toRef as It } from "vue";
  3. import { P as Ct } from "./index18.js";
  4. function St(e, t, n, o) {
  5. for (var i = -1, a = e == null ? 0 : e.length; ++i < a; ) {
  6. var r = e[i];
  7. t(o, r, n(r), e);
  8. }
  9. return o;
  10. }
  11. function xt(e) {
  12. return function(t, n, o) {
  13. for (var i = -1, a = Object(t), r = o(t), s = r.length; s--; ) {
  14. var y = r[++i];
  15. if (n(a[y], y, a) === !1)
  16. break;
  17. }
  18. return t;
  19. };
  20. }
  21. var Ft = xt();
  22. function Rt(e, t) {
  23. return e && Ft(e, t, He);
  24. }
  25. function Pt(e, t) {
  26. return function(n, o) {
  27. if (n == null)
  28. return n;
  29. if (!qe(n))
  30. return e(n, o);
  31. for (var i = n.length, a = -1, r = Object(n); ++a < i && o(r[a], a, r) !== !1; )
  32. ;
  33. return n;
  34. };
  35. }
  36. var Dt = Pt(Rt);
  37. function Ot(e, t, n, o) {
  38. return Dt(e, function(i, a, r) {
  39. t(o, i, n(i), r);
  40. }), o;
  41. }
  42. function Tt(e, t) {
  43. return function(n, o) {
  44. var i = Ge(n) ? St : Ot, a = t ? t() : {};
  45. return i(n, e, We(o), a);
  46. };
  47. }
  48. var _t = Tt(function(e, t, n) {
  49. e[n ? 0 : 1].push(t);
  50. }, function() {
  51. return [[], []];
  52. });
  53. function Ut(e, t) {
  54. const n = `cannot ${e.method} ${e.action} ${t.status}'`, o = new Error(n);
  55. return o.status = t.status, o.method = e.method, o.url = e.action, o;
  56. }
  57. function Ie(e) {
  58. const t = e.responseText || e.response;
  59. if (!t)
  60. return t;
  61. try {
  62. return JSON.parse(t);
  63. } catch (n) {
  64. return t;
  65. }
  66. }
  67. function At(e) {
  68. const t = new XMLHttpRequest();
  69. e.onProgress && t.upload && (t.upload.onprogress = function(a) {
  70. a.total > 0 && (a.percent = a.loaded / a.total * 100), e.onProgress(a);
  71. });
  72. const n = new FormData();
  73. e.data && Object.keys(e.data).forEach((i) => {
  74. const a = e.data[i];
  75. if (Array.isArray(a)) {
  76. a.forEach((r) => {
  77. n.append(`${i}[]`, r);
  78. });
  79. return;
  80. }
  81. n.append(i, a);
  82. }), e.file instanceof Blob ? n.append(e.filename, e.file, e.file.name) : n.append(e.filename, e.file), t.onerror = function(a) {
  83. e.onError(a);
  84. }, t.onload = function() {
  85. return t.status < 200 || t.status >= 300 ? e.onError(Ut(e, t), Ie(t)) : e.onSuccess(Ie(t), t);
  86. }, t.open(e.method, e.action, !0), e.withCredentials && "withCredentials" in t && (t.withCredentials = !0);
  87. const o = e.headers || {};
  88. return o["X-Requested-With"] !== null && t.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(o).forEach((i) => {
  89. o[i] !== null && t.setRequestHeader(i, o[i]);
  90. }), t.send(n), {
  91. abort() {
  92. t.abort();
  93. }
  94. };
  95. }
  96. const Lt = +/* @__PURE__ */ new Date();
  97. let Et = 0;
  98. function pe() {
  99. return `vc-upload-${Lt}-${++Et}`;
  100. }
  101. const fe = (e, t) => {
  102. if (e && t) {
  103. const n = Array.isArray(t) ? t : t.split(","), o = e.name || "", i = e.type || "", a = i.replace(/\/.*$/, "");
  104. return n.some((r) => {
  105. const s = r.trim();
  106. if (/^\*(\/\*)?$/.test(r))
  107. return !0;
  108. if (s.charAt(0) === ".") {
  109. const y = o.toLowerCase(), F = s.toLowerCase();
  110. let g = [F];
  111. return (F === ".jpg" || F === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((T) => y.endsWith(T));
  112. }
  113. return /\/\*$/.test(s) ? a === s.replace(/\/.*$/, "") : i === s ? !0 : /^\w+$/.test(s) ? (Ve(!1, `Upload takes an invalidate 'accept' type '${s}'.Skip for check.`), !0) : !1;
  114. });
  115. }
  116. return !0;
  117. };
  118. function jt(e, t) {
  119. const n = e.createReader();
  120. let o = [];
  121. function i() {
  122. n.readEntries((a) => {
  123. const r = Array.prototype.slice.apply(a);
  124. o = o.concat(r), !r.length ? t(o) : i();
  125. });
  126. }
  127. i();
  128. }
  129. const Mt = (e, t, n) => {
  130. const o = (i, a) => {
  131. i.path = a || "", i.isFile ? i.file((r) => {
  132. n(r) && (i.fullPath && !r.webkitRelativePath && (Object.defineProperties(r, {
  133. webkitRelativePath: {
  134. writable: !0
  135. }
  136. }), r.webkitRelativePath = i.fullPath.replace(/^\//, ""), Object.defineProperties(r, {
  137. webkitRelativePath: {
  138. writable: !1
  139. }
  140. })), t([r]));
  141. }) : i.isDirectory && jt(i, (r) => {
  142. r.forEach((s) => {
  143. o(s, `${a}${i.name}/`);
  144. });
  145. });
  146. };
  147. e.forEach((i) => {
  148. o(i.webkitGetAsEntry());
  149. });
  150. }, Ae = () => ({
  151. capture: [Boolean, String],
  152. multipart: {
  153. type: Boolean,
  154. default: void 0
  155. },
  156. name: String,
  157. disabled: {
  158. type: Boolean,
  159. default: void 0
  160. },
  161. componentTag: String,
  162. action: [String, Function],
  163. method: String,
  164. directory: {
  165. type: Boolean,
  166. default: void 0
  167. },
  168. data: [Object, Function],
  169. headers: Object,
  170. accept: String,
  171. multiple: {
  172. type: Boolean,
  173. default: void 0
  174. },
  175. onBatchStart: Function,
  176. onReject: Function,
  177. onStart: Function,
  178. onError: Function,
  179. onSuccess: Function,
  180. onProgress: Function,
  181. beforeUpload: Function,
  182. customRequest: Function,
  183. withCredentials: {
  184. type: Boolean,
  185. default: void 0
  186. },
  187. openFileDialogOnClick: {
  188. type: Boolean,
  189. default: void 0
  190. },
  191. prefixCls: String,
  192. id: String,
  193. onMouseenter: Function,
  194. onMouseleave: Function,
  195. onClick: Function
  196. });
  197. var Bt = function(e, t, n, o) {
  198. function i(a) {
  199. return a instanceof n ? a : new n(function(r) {
  200. r(a);
  201. });
  202. }
  203. return new (n || (n = Promise))(function(a, r) {
  204. function s(g) {
  205. try {
  206. F(o.next(g));
  207. } catch (T) {
  208. r(T);
  209. }
  210. }
  211. function y(g) {
  212. try {
  213. F(o.throw(g));
  214. } catch (T) {
  215. r(T);
  216. }
  217. }
  218. function F(g) {
  219. g.done ? a(g.value) : i(g.value).then(s, y);
  220. }
  221. F((o = o.apply(e, t || [])).next());
  222. });
  223. }, zt = function(e, t) {
  224. var n = {};
  225. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  226. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  227. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  228. return n;
  229. };
  230. const Nt = Y({
  231. compatConfig: {
  232. MODE: 3
  233. },
  234. name: "AjaxUploader",
  235. inheritAttrs: !1,
  236. props: Ae(),
  237. setup(e, t) {
  238. let {
  239. slots: n,
  240. attrs: o,
  241. expose: i
  242. } = t;
  243. const a = ne(pe()), r = {}, s = ne();
  244. let y = !1;
  245. const F = (d, v) => Bt(this, void 0, void 0, function* () {
  246. const {
  247. beforeUpload: $
  248. } = e;
  249. let I = d;
  250. if ($) {
  251. try {
  252. I = yield $(d, v);
  253. } catch (p) {
  254. I = !1;
  255. }
  256. if (I === !1)
  257. return {
  258. origin: d,
  259. parsedFile: null,
  260. action: null,
  261. data: null
  262. };
  263. }
  264. const {
  265. action: P
  266. } = e;
  267. let U;
  268. typeof P == "function" ? U = yield P(d) : U = P;
  269. const {
  270. data: j
  271. } = e;
  272. let A;
  273. typeof j == "function" ? A = yield j(d) : A = j;
  274. const M = (
  275. // string type is from legacy `transformFile`.
  276. // Not sure if this will work since no related test case works with it
  277. (typeof I == "object" || typeof I == "string") && I ? I : d
  278. );
  279. let c;
  280. M instanceof File ? c = M : c = new File([M], d.name, {
  281. type: d.type
  282. });
  283. const u = c;
  284. return u.uid = d.uid, {
  285. origin: d,
  286. data: A,
  287. parsedFile: u,
  288. action: U
  289. };
  290. }), g = (d) => {
  291. let {
  292. data: v,
  293. origin: $,
  294. action: I,
  295. parsedFile: P
  296. } = d;
  297. if (!y)
  298. return;
  299. const {
  300. onStart: U,
  301. customRequest: j,
  302. name: A,
  303. headers: M,
  304. withCredentials: c,
  305. method: u
  306. } = e, {
  307. uid: p
  308. } = $, f = j || At, h = {
  309. action: I,
  310. filename: A,
  311. data: v,
  312. file: P,
  313. headers: M,
  314. withCredentials: c,
  315. method: u || "post",
  316. onProgress: (C) => {
  317. const {
  318. onProgress: D
  319. } = e;
  320. D == null || D(C, P);
  321. },
  322. onSuccess: (C, D) => {
  323. const {
  324. onSuccess: x
  325. } = e;
  326. x == null || x(C, P, D), delete r[p];
  327. },
  328. onError: (C, D) => {
  329. const {
  330. onError: x
  331. } = e;
  332. x == null || x(C, D, P), delete r[p];
  333. }
  334. };
  335. U($), r[p] = f(h);
  336. }, T = () => {
  337. a.value = pe();
  338. }, R = (d) => {
  339. if (d) {
  340. const v = d.uid ? d.uid : d;
  341. r[v] && r[v].abort && r[v].abort(), delete r[v];
  342. } else
  343. Object.keys(r).forEach((v) => {
  344. r[v] && r[v].abort && r[v].abort(), delete r[v];
  345. });
  346. };
  347. ce(() => {
  348. y = !0;
  349. }), Oe(() => {
  350. y = !1, R();
  351. });
  352. const _ = (d) => {
  353. const v = [...d], $ = v.map((I) => (I.uid = pe(), F(I, v)));
  354. Promise.all($).then((I) => {
  355. const {
  356. onBatchStart: P
  357. } = e;
  358. P == null || P(I.map((U) => {
  359. let {
  360. origin: j,
  361. parsedFile: A
  362. } = U;
  363. return {
  364. file: j,
  365. parsedFile: A
  366. };
  367. })), I.filter((U) => U.parsedFile !== null).forEach((U) => {
  368. g(U);
  369. });
  370. });
  371. }, z = (d) => {
  372. const {
  373. accept: v,
  374. directory: $
  375. } = e, {
  376. files: I
  377. } = d.target, P = [...I].filter((U) => !$ || fe(U, v));
  378. _(P), T();
  379. }, l = (d) => {
  380. const v = s.value;
  381. if (!v)
  382. return;
  383. const {
  384. onClick: $
  385. } = e;
  386. v.click(), $ && $(d);
  387. }, b = (d) => {
  388. d.key === "Enter" && l(d);
  389. }, L = (d) => {
  390. const {
  391. multiple: v
  392. } = e;
  393. if (d.preventDefault(), d.type !== "dragover")
  394. if (e.directory)
  395. Mt(Array.prototype.slice.call(d.dataTransfer.items), _, ($) => fe($, e.accept));
  396. else {
  397. const $ = _t(Array.prototype.slice.call(d.dataTransfer.files), (U) => fe(U, e.accept));
  398. let I = $[0];
  399. const P = $[1];
  400. v === !1 && (I = I.slice(0, 1)), _(I), P.length && e.onReject && e.onReject(P);
  401. }
  402. };
  403. return i({
  404. abort: R
  405. }), () => {
  406. var d;
  407. const {
  408. componentTag: v,
  409. prefixCls: $,
  410. disabled: I,
  411. id: P,
  412. multiple: U,
  413. accept: j,
  414. capture: A,
  415. directory: M,
  416. openFileDialogOnClick: c,
  417. onMouseenter: u,
  418. onMouseleave: p
  419. } = e, f = zt(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), h = {
  420. [$]: !0,
  421. [`${$}-disabled`]: I,
  422. [o.class]: !!o.class
  423. }, C = M ? {
  424. directory: "directory",
  425. webkitdirectory: "webkitdirectory"
  426. } : {};
  427. return m(v, O(O({}, I ? {} : {
  428. onClick: c ? l : () => {
  429. },
  430. onKeydown: c ? b : () => {
  431. },
  432. onMouseenter: u,
  433. onMouseleave: p,
  434. onDrop: L,
  435. onDragover: L,
  436. tabindex: "0"
  437. }), {}, {
  438. class: h,
  439. role: "button",
  440. style: o.style
  441. }), {
  442. default: () => [m("input", O(O(O({}, Ke(f, {
  443. aria: !0,
  444. data: !0
  445. })), {}, {
  446. id: P,
  447. type: "file",
  448. ref: s,
  449. onClick: (x) => x.stopPropagation(),
  450. onCancel: (x) => x.stopPropagation(),
  451. key: a.value,
  452. style: {
  453. display: "none"
  454. },
  455. accept: j
  456. }, C), {}, {
  457. multiple: U,
  458. onChange: z
  459. }, A != null ? {
  460. capture: A
  461. } : {}), null), (d = n.default) === null || d === void 0 ? void 0 : d.call(n)]
  462. });
  463. };
  464. }
  465. });
  466. function me() {
  467. }
  468. const Ce = Y({
  469. compatConfig: {
  470. MODE: 3
  471. },
  472. name: "Upload",
  473. inheritAttrs: !1,
  474. props: ve(Ae(), {
  475. componentTag: "span",
  476. prefixCls: "rc-upload",
  477. data: {},
  478. headers: {},
  479. name: "file",
  480. multipart: !1,
  481. onStart: me,
  482. onError: me,
  483. onSuccess: me,
  484. multiple: !1,
  485. beforeUpload: null,
  486. customRequest: null,
  487. withCredentials: !1,
  488. openFileDialogOnClick: !0
  489. }),
  490. setup(e, t) {
  491. let {
  492. slots: n,
  493. attrs: o,
  494. expose: i
  495. } = t;
  496. const a = ne();
  497. return i({
  498. abort: (s) => {
  499. var y;
  500. (y = a.value) === null || y === void 0 || y.abort(s);
  501. }
  502. }), () => m(Nt, O(O(O({}, e), o), {}, {
  503. ref: a
  504. }), n);
  505. }
  506. });
  507. function Le() {
  508. return {
  509. capture: Q([Boolean, String]),
  510. type: J(),
  511. name: String,
  512. defaultFileList: se(),
  513. fileList: se(),
  514. action: Q([String, Function]),
  515. directory: B(),
  516. data: Q([Object, Function]),
  517. method: J(),
  518. headers: V(),
  519. showUploadList: Q([Boolean, Object]),
  520. multiple: B(),
  521. accept: String,
  522. beforeUpload: w(),
  523. onChange: w(),
  524. "onUpdate:fileList": w(),
  525. onDrop: w(),
  526. listType: J(),
  527. onPreview: w(),
  528. onDownload: w(),
  529. onReject: w(),
  530. onRemove: w(),
  531. /** @deprecated Please use `onRemove` directly */
  532. remove: w(),
  533. supportServerRender: B(),
  534. disabled: B(),
  535. prefixCls: String,
  536. customRequest: w(),
  537. withCredentials: B(),
  538. openFileDialogOnClick: B(),
  539. locale: V(),
  540. id: String,
  541. previewFile: w(),
  542. /** @deprecated Please use `beforeUpload` directly */
  543. transformFile: w(),
  544. iconRender: w(),
  545. isImageUrl: w(),
  546. progress: V(),
  547. itemRender: w(),
  548. /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
  549. maxCount: Number,
  550. height: Q([Number, String]),
  551. removeIcon: w(),
  552. downloadIcon: w(),
  553. previewIcon: w()
  554. };
  555. }
  556. function Xt() {
  557. return {
  558. listType: J(),
  559. onPreview: w(),
  560. onDownload: w(),
  561. onRemove: w(),
  562. items: se(),
  563. progress: V(),
  564. prefixCls: J(),
  565. showRemoveIcon: B(),
  566. showDownloadIcon: B(),
  567. showPreviewIcon: B(),
  568. removeIcon: w(),
  569. downloadIcon: w(),
  570. previewIcon: w(),
  571. locale: V(void 0),
  572. previewFile: w(),
  573. iconRender: w(),
  574. isImageUrl: w(),
  575. appendAction: w(),
  576. appendActionVisible: B(),
  577. itemRender: w()
  578. };
  579. }
  580. function re(e) {
  581. return S(S({}, e), {
  582. lastModified: e.lastModified,
  583. lastModifiedDate: e.lastModifiedDate,
  584. name: e.name,
  585. size: e.size,
  586. type: e.type,
  587. uid: e.uid,
  588. percent: 0,
  589. originFileObj: e
  590. });
  591. }
  592. function ie(e, t) {
  593. const n = [...t], o = n.findIndex((i) => {
  594. let {
  595. uid: a
  596. } = i;
  597. return a === e.uid;
  598. });
  599. return o === -1 ? n.push(e) : n[o] = e, n;
  600. }
  601. function ge(e, t) {
  602. const n = e.uid !== void 0 ? "uid" : "name";
  603. return t.filter((o) => o[n] === e[n])[0];
  604. }
  605. function Ht(e, t) {
  606. const n = e.uid !== void 0 ? "uid" : "name", o = t.filter((i) => i[n] !== e[n]);
  607. return o.length === t.length ? null : o;
  608. }
  609. const qt = function() {
  610. const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), o = t[t.length - 1].split(/#|\?/)[0];
  611. return (/\.[^./\\]*$/.exec(o) || [""])[0];
  612. }, Ee = (e) => e.indexOf("image/") === 0, Wt = (e) => {
  613. if (e.type && !e.thumbUrl)
  614. return Ee(e.type);
  615. const t = e.thumbUrl || e.url || "", n = qt(t);
  616. return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n) ? !0 : !(/^data:/.test(t) || n);
  617. }, G = 200;
  618. function Gt(e) {
  619. return new Promise((t) => {
  620. if (!e.type || !Ee(e.type)) {
  621. t("");
  622. return;
  623. }
  624. const n = document.createElement("canvas");
  625. n.width = G, n.height = G, n.style.cssText = `position: fixed; left: 0; top: 0; width: ${G}px; height: ${G}px; z-index: 9999; display: none;`, document.body.appendChild(n);
  626. const o = n.getContext("2d"), i = new Image();
  627. if (i.onload = () => {
  628. const {
  629. width: a,
  630. height: r
  631. } = i;
  632. let s = G, y = G, F = 0, g = 0;
  633. a > r ? (y = r * (G / a), g = -(y - s) / 2) : (s = a * (G / r), F = -(s - y) / 2), o.drawImage(i, F, g, s, y);
  634. const T = n.toDataURL();
  635. document.body.removeChild(n), t(T);
  636. }, i.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
  637. const a = new FileReader();
  638. a.addEventListener("load", () => {
  639. a.result && (i.src = a.result);
  640. }), a.readAsDataURL(e);
  641. } else
  642. i.src = window.URL.createObjectURL(e);
  643. });
  644. }
  645. const Vt = () => ({
  646. prefixCls: String,
  647. locale: V(void 0),
  648. file: V(),
  649. items: se(),
  650. listType: J(),
  651. isImgUrl: w(),
  652. showRemoveIcon: B(),
  653. showDownloadIcon: B(),
  654. showPreviewIcon: B(),
  655. removeIcon: w(),
  656. downloadIcon: w(),
  657. previewIcon: w(),
  658. iconRender: w(),
  659. actionIconRender: w(),
  660. itemRender: w(),
  661. onPreview: w(),
  662. onClose: w(),
  663. onDownload: w(),
  664. progress: V()
  665. }), Kt = Y({
  666. compatConfig: {
  667. MODE: 3
  668. },
  669. name: "ListItem",
  670. inheritAttrs: !1,
  671. props: Vt(),
  672. setup(e, t) {
  673. let {
  674. slots: n,
  675. attrs: o
  676. } = t;
  677. var i;
  678. const a = te(!1), r = te();
  679. ce(() => {
  680. r.value = setTimeout(() => {
  681. a.value = !0;
  682. }, 300);
  683. }), Oe(() => {
  684. clearTimeout(r.value);
  685. });
  686. const s = te((i = e.file) === null || i === void 0 ? void 0 : i.status);
  687. Te(() => {
  688. var g;
  689. return (g = e.file) === null || g === void 0 ? void 0 : g.status;
  690. }, (g) => {
  691. g !== "removed" && (s.value = g);
  692. });
  693. const {
  694. rootPrefixCls: y
  695. } = he("upload", e), F = oe(() => Je(`${y.value}-fade`));
  696. return () => {
  697. var g, T;
  698. const {
  699. prefixCls: R,
  700. locale: _,
  701. listType: z,
  702. file: l,
  703. items: b,
  704. progress: L,
  705. iconRender: d = n.iconRender,
  706. actionIconRender: v = n.actionIconRender,
  707. itemRender: $ = n.itemRender,
  708. isImgUrl: I,
  709. showPreviewIcon: P,
  710. showRemoveIcon: U,
  711. showDownloadIcon: j,
  712. previewIcon: A = n.previewIcon,
  713. removeIcon: M = n.removeIcon,
  714. downloadIcon: c = n.downloadIcon,
  715. onPreview: u,
  716. onDownload: p,
  717. onClose: f
  718. } = e, {
  719. class: h,
  720. style: C
  721. } = o, D = d({
  722. file: l
  723. });
  724. let x = m("div", {
  725. class: `${R}-text-icon`
  726. }, [D]);
  727. if (z === "picture" || z === "picture-card")
  728. if (s.value === "uploading" || !l.thumbUrl && !l.url) {
  729. const N = {
  730. [`${R}-list-item-thumbnail`]: !0,
  731. [`${R}-list-item-file`]: s.value !== "uploading"
  732. };
  733. x = m("div", {
  734. class: N
  735. }, [D]);
  736. } else {
  737. const N = I != null && I(l) ? m("img", {
  738. src: l.thumbUrl || l.url,
  739. alt: l.name,
  740. class: `${R}-list-item-image`,
  741. crossorigin: l.crossOrigin
  742. }, null) : D, Ne = {
  743. [`${R}-list-item-thumbnail`]: !0,
  744. [`${R}-list-item-file`]: I && !I(l)
  745. };
  746. x = m("a", {
  747. class: Ne,
  748. onClick: (Xe) => u(l, Xe),
  749. href: l.url || l.thumbUrl,
  750. target: "_blank",
  751. rel: "noopener noreferrer"
  752. }, [N]);
  753. }
  754. const E = {
  755. [`${R}-list-item`]: !0,
  756. [`${R}-list-item-${s.value}`]: !0
  757. }, q = typeof l.linkProps == "string" ? JSON.parse(l.linkProps) : l.linkProps, K = U ? v({
  758. customIcon: M ? M({
  759. file: l
  760. }) : m(Ye, null, null),
  761. callback: () => f(l),
  762. prefixCls: R,
  763. title: _.removeFile
  764. }) : null, X = j && s.value === "done" ? v({
  765. customIcon: c ? c({
  766. file: l
  767. }) : m(Ze, null, null),
  768. callback: () => p(l),
  769. prefixCls: R,
  770. title: _.downloadFile
  771. }) : null, H = z !== "picture-card" && m("span", {
  772. key: "download-delete",
  773. class: [`${R}-list-item-actions`, {
  774. picture: z === "picture"
  775. }]
  776. }, [X, K]), W = `${R}-list-item-name`, Z = l.url ? [m("a", O(O({
  777. key: "view",
  778. target: "_blank",
  779. rel: "noopener noreferrer",
  780. class: W,
  781. title: l.name
  782. }, q), {}, {
  783. href: l.url,
  784. onClick: (N) => u(l, N)
  785. }), [l.name]), H] : [m("span", {
  786. key: "view",
  787. class: W,
  788. onClick: (N) => u(l, N),
  789. title: l.name
  790. }, [l.name]), H], de = {
  791. pointerEvents: "none",
  792. opacity: 0.5
  793. }, je = P ? m("a", {
  794. href: l.url || l.thumbUrl,
  795. target: "_blank",
  796. rel: "noopener noreferrer",
  797. style: l.url || l.thumbUrl ? void 0 : de,
  798. onClick: (N) => u(l, N),
  799. title: _.previewFile
  800. }, [A ? A({
  801. file: l
  802. }) : m(Qe, null, null)]) : null, Me = z === "picture-card" && s.value !== "uploading" && m("span", {
  803. class: `${R}-list-item-actions`
  804. }, [je, s.value === "done" && X, K]), we = m("div", {
  805. class: E
  806. }, [x, Z, Me, a.value && m(wt, F.value, {
  807. default: () => [_e(m("div", {
  808. class: `${R}-list-item-progress`
  809. }, ["percent" in l ? m(Ct, O(O({}, L), {}, {
  810. type: "line",
  811. percent: l.percent
  812. }), null) : null]), [[Ue, s.value === "uploading"]])]
  813. })]), Be = {
  814. [`${R}-list-item-container`]: !0,
  815. [`${h}`]: !!h
  816. }, ze = l.response && typeof l.response == "string" ? l.response : ((g = l.error) === null || g === void 0 ? void 0 : g.statusText) || ((T = l.error) === null || T === void 0 ? void 0 : T.message) || _.uploadError, ye = s.value === "error" ? m(ke, {
  817. title: ze,
  818. getPopupContainer: (N) => N.parentNode
  819. }, {
  820. default: () => [we]
  821. }) : we;
  822. return m("div", {
  823. class: Be,
  824. style: C
  825. }, [$ ? $({
  826. originNode: ye,
  827. file: l,
  828. fileList: b,
  829. actions: {
  830. download: p.bind(null, l),
  831. preview: u.bind(null, l),
  832. remove: f.bind(null, l)
  833. }
  834. }) : ye]);
  835. };
  836. }
  837. }), Jt = (e, t) => {
  838. let {
  839. slots: n
  840. } = t;
  841. var o;
  842. return nt((o = n.default) === null || o === void 0 ? void 0 : o.call(n))[0];
  843. }, Yt = Y({
  844. compatConfig: {
  845. MODE: 3
  846. },
  847. name: "AUploadList",
  848. props: ve(Xt(), {
  849. listType: "text",
  850. progress: {
  851. strokeWidth: 2,
  852. showInfo: !1
  853. },
  854. showRemoveIcon: !0,
  855. showDownloadIcon: !1,
  856. showPreviewIcon: !0,
  857. previewFile: Gt,
  858. isImageUrl: Wt,
  859. items: [],
  860. appendActionVisible: !0
  861. }),
  862. setup(e, t) {
  863. let {
  864. slots: n,
  865. expose: o
  866. } = t;
  867. const i = te(!1);
  868. ce(() => {
  869. i.value == !0;
  870. });
  871. const a = te([]);
  872. Te(() => e.items, function() {
  873. let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  874. a.value = l.slice();
  875. }, {
  876. immediate: !0,
  877. deep: !0
  878. }), yt(() => {
  879. if (e.listType !== "picture" && e.listType !== "picture-card")
  880. return;
  881. let l = !1;
  882. (e.items || []).forEach((b, L) => {
  883. typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(b.originFileObj instanceof File || b.originFileObj instanceof Blob) || b.thumbUrl !== void 0 || (b.thumbUrl = "", e.previewFile && e.previewFile(b.originFileObj).then((d) => {
  884. const v = d || "";
  885. v !== b.thumbUrl && (a.value[L].thumbUrl = v, l = !0);
  886. }));
  887. }), l && bt(a);
  888. });
  889. const r = (l, b) => {
  890. if (e.onPreview)
  891. return b == null || b.preventDefault(), e.onPreview(l);
  892. }, s = (l) => {
  893. typeof e.onDownload == "function" ? e.onDownload(l) : l.url && window.open(l.url);
  894. }, y = (l) => {
  895. var b;
  896. (b = e.onRemove) === null || b === void 0 || b.call(e, l);
  897. }, F = (l) => {
  898. let {
  899. file: b
  900. } = l;
  901. const L = e.iconRender || n.iconRender;
  902. if (L)
  903. return L({
  904. file: b,
  905. listType: e.listType
  906. });
  907. const d = b.status === "uploading", v = e.isImageUrl && e.isImageUrl(b) ? m(ot, null, null) : m(rt, null, null);
  908. let $ = d ? m(be, null, null) : m(it, null, null);
  909. return e.listType === "picture" ? $ = d ? m(be, null, null) : v : e.listType === "picture-card" && ($ = d ? e.locale.uploading : v), $;
  910. }, g = (l) => {
  911. const {
  912. customIcon: b,
  913. callback: L,
  914. prefixCls: d,
  915. title: v
  916. } = l, $ = {
  917. type: "text",
  918. size: "small",
  919. title: v,
  920. onClick: () => {
  921. L();
  922. },
  923. class: `${d}-list-item-action`
  924. };
  925. return at(b) ? m($e, $, {
  926. icon: () => b
  927. }) : m($e, $, {
  928. default: () => [m("span", null, [b])]
  929. });
  930. };
  931. o({
  932. handlePreview: r,
  933. handleDownload: s
  934. });
  935. const {
  936. prefixCls: T,
  937. rootPrefixCls: R
  938. } = he("upload", e), _ = oe(() => ({
  939. [`${T.value}-list`]: !0,
  940. [`${T.value}-list-${e.listType}`]: !0
  941. })), z = oe(() => {
  942. const l = S({}, et(`${R.value}-motion-collapse`));
  943. delete l.onAfterAppear, delete l.onAfterEnter, delete l.onAfterLeave;
  944. const b = S(S({}, tt(`${T.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
  945. class: _.value,
  946. appear: i.value
  947. });
  948. return e.listType !== "picture-card" ? S(S({}, l), b) : b;
  949. });
  950. return () => {
  951. const {
  952. listType: l,
  953. locale: b,
  954. isImageUrl: L,
  955. showPreviewIcon: d,
  956. showRemoveIcon: v,
  957. showDownloadIcon: $,
  958. removeIcon: I,
  959. previewIcon: P,
  960. downloadIcon: U,
  961. progress: j,
  962. appendAction: A,
  963. itemRender: M,
  964. appendActionVisible: c
  965. } = e, u = A == null ? void 0 : A(), p = a.value;
  966. return m($t, O(O({}, z.value), {}, {
  967. tag: "div"
  968. }), {
  969. default: () => [p.map((f) => {
  970. const {
  971. uid: h
  972. } = f;
  973. return m(Kt, {
  974. key: h,
  975. locale: b,
  976. prefixCls: T.value,
  977. file: f,
  978. items: p,
  979. progress: j,
  980. listType: l,
  981. isImgUrl: L,
  982. showPreviewIcon: d,
  983. showRemoveIcon: v,
  984. showDownloadIcon: $,
  985. onPreview: r,
  986. onDownload: s,
  987. onClose: y,
  988. removeIcon: I,
  989. previewIcon: P,
  990. downloadIcon: U,
  991. itemRender: M
  992. }, S(S({}, n), {
  993. iconRender: F,
  994. actionIconRender: g
  995. }));
  996. }), A ? _e(m(Jt, {
  997. key: "__ant_upload_appendAction"
  998. }, {
  999. default: () => u
  1000. }), [[Ue, !!c]]) : null]
  1001. });
  1002. };
  1003. }
  1004. }), Zt = (e) => {
  1005. const {
  1006. componentCls: t,
  1007. iconCls: n
  1008. } = e;
  1009. return {
  1010. [`${t}-wrapper`]: {
  1011. [`${t}-drag`]: {
  1012. position: "relative",
  1013. width: "100%",
  1014. height: "100%",
  1015. textAlign: "center",
  1016. background: e.colorFillAlter,
  1017. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1018. borderRadius: e.borderRadiusLG,
  1019. cursor: "pointer",
  1020. transition: `border-color ${e.motionDurationSlow}`,
  1021. [t]: {
  1022. padding: `${e.padding}px 0`
  1023. },
  1024. [`${t}-btn`]: {
  1025. display: "table",
  1026. width: "100%",
  1027. height: "100%",
  1028. outline: "none"
  1029. },
  1030. [`${t}-drag-container`]: {
  1031. display: "table-cell",
  1032. verticalAlign: "middle"
  1033. },
  1034. [`&:not(${t}-disabled):hover`]: {
  1035. borderColor: e.colorPrimaryHover
  1036. },
  1037. [`p${t}-drag-icon`]: {
  1038. marginBottom: e.margin,
  1039. [n]: {
  1040. color: e.colorPrimary,
  1041. fontSize: e.uploadThumbnailSize
  1042. }
  1043. },
  1044. [`p${t}-text`]: {
  1045. margin: `0 0 ${e.marginXXS}px`,
  1046. color: e.colorTextHeading,
  1047. fontSize: e.fontSizeLG
  1048. },
  1049. [`p${t}-hint`]: {
  1050. color: e.colorTextDescription,
  1051. fontSize: e.fontSize
  1052. },
  1053. // ===================== Disabled =====================
  1054. [`&${t}-disabled`]: {
  1055. cursor: "not-allowed",
  1056. [`p${t}-drag-icon ${n},
  1057. p${t}-text,
  1058. p${t}-hint
  1059. `]: {
  1060. color: e.colorTextDisabled
  1061. }
  1062. }
  1063. }
  1064. }
  1065. };
  1066. }, Qt = (e) => {
  1067. const {
  1068. componentCls: t,
  1069. antCls: n,
  1070. iconCls: o,
  1071. fontSize: i,
  1072. lineHeight: a
  1073. } = e, r = `${t}-list-item`, s = `${r}-actions`, y = `${r}-action`, F = Math.round(i * a);
  1074. return {
  1075. [`${t}-wrapper`]: {
  1076. [`${t}-list`]: S(S({}, Re()), {
  1077. lineHeight: e.lineHeight,
  1078. [r]: {
  1079. position: "relative",
  1080. height: e.lineHeight * i,
  1081. marginTop: e.marginXS,
  1082. fontSize: i,
  1083. display: "flex",
  1084. alignItems: "center",
  1085. transition: `background-color ${e.motionDurationSlow}`,
  1086. "&:hover": {
  1087. backgroundColor: e.controlItemBgHover
  1088. },
  1089. [`${r}-name`]: S(S({}, Pe), {
  1090. padding: `0 ${e.paddingXS}px`,
  1091. lineHeight: a,
  1092. flex: "auto",
  1093. transition: `all ${e.motionDurationSlow}`
  1094. }),
  1095. [s]: {
  1096. [y]: {
  1097. opacity: 0
  1098. },
  1099. [`${y}${n}-btn-sm`]: {
  1100. height: F,
  1101. border: 0,
  1102. lineHeight: 1,
  1103. // FIXME: should not override small button
  1104. "> span": {
  1105. transform: "scale(1)"
  1106. }
  1107. },
  1108. [`
  1109. ${y}:focus,
  1110. &.picture ${y}
  1111. `]: {
  1112. opacity: 1
  1113. },
  1114. [o]: {
  1115. color: e.colorTextDescription,
  1116. transition: `all ${e.motionDurationSlow}`
  1117. },
  1118. [`&:hover ${o}`]: {
  1119. color: e.colorText
  1120. }
  1121. },
  1122. [`${t}-icon ${o}`]: {
  1123. color: e.colorTextDescription,
  1124. fontSize: i
  1125. },
  1126. [`${r}-progress`]: {
  1127. position: "absolute",
  1128. bottom: -e.uploadProgressOffset,
  1129. width: "100%",
  1130. paddingInlineStart: i + e.paddingXS,
  1131. fontSize: i,
  1132. lineHeight: 0,
  1133. pointerEvents: "none",
  1134. "> div": {
  1135. margin: 0
  1136. }
  1137. }
  1138. },
  1139. [`${r}:hover ${y}`]: {
  1140. opacity: 1,
  1141. color: e.colorText
  1142. },
  1143. [`${r}-error`]: {
  1144. color: e.colorError,
  1145. [`${r}-name, ${t}-icon ${o}`]: {
  1146. color: e.colorError
  1147. },
  1148. [s]: {
  1149. [`${o}, ${o}:hover`]: {
  1150. color: e.colorError
  1151. },
  1152. [y]: {
  1153. opacity: 1
  1154. }
  1155. }
  1156. },
  1157. [`${t}-list-item-container`]: {
  1158. transition: `opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
  1159. // For smooth removing animation
  1160. "&::before": {
  1161. display: "table",
  1162. width: 0,
  1163. height: 0,
  1164. content: '""'
  1165. }
  1166. }
  1167. })
  1168. }
  1169. };
  1170. }, Se = new De("uploadAnimateInlineIn", {
  1171. from: {
  1172. width: 0,
  1173. height: 0,
  1174. margin: 0,
  1175. padding: 0,
  1176. opacity: 0
  1177. }
  1178. }), xe = new De("uploadAnimateInlineOut", {
  1179. to: {
  1180. width: 0,
  1181. height: 0,
  1182. margin: 0,
  1183. padding: 0,
  1184. opacity: 0
  1185. }
  1186. }), kt = (e) => {
  1187. const {
  1188. componentCls: t
  1189. } = e, n = `${t}-animate-inline`;
  1190. return [{
  1191. [`${t}-wrapper`]: {
  1192. [`${n}-appear, ${n}-enter, ${n}-leave`]: {
  1193. animationDuration: e.motionDurationSlow,
  1194. animationTimingFunction: e.motionEaseInOutCirc,
  1195. animationFillMode: "forwards"
  1196. },
  1197. [`${n}-appear, ${n}-enter`]: {
  1198. animationName: Se
  1199. },
  1200. [`${n}-leave`]: {
  1201. animationName: xe
  1202. }
  1203. }
  1204. }, Se, xe];
  1205. }, en = (e) => {
  1206. const {
  1207. componentCls: t,
  1208. iconCls: n,
  1209. uploadThumbnailSize: o,
  1210. uploadProgressOffset: i
  1211. } = e, a = `${t}-list`, r = `${a}-item`;
  1212. return {
  1213. [`${t}-wrapper`]: {
  1214. // ${listCls} 增加优先级
  1215. [`${a}${a}-picture, ${a}${a}-picture-card`]: {
  1216. [r]: {
  1217. position: "relative",
  1218. height: o + e.lineWidth * 2 + e.paddingXS * 2,
  1219. padding: e.paddingXS,
  1220. border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
  1221. borderRadius: e.borderRadiusLG,
  1222. "&:hover": {
  1223. background: "transparent"
  1224. },
  1225. [`${r}-thumbnail`]: S(S({}, Pe), {
  1226. width: o,
  1227. height: o,
  1228. lineHeight: `${o + e.paddingSM}px`,
  1229. textAlign: "center",
  1230. flex: "none",
  1231. [n]: {
  1232. fontSize: e.fontSizeHeading2,
  1233. color: e.colorPrimary
  1234. },
  1235. img: {
  1236. display: "block",
  1237. width: "100%",
  1238. height: "100%",
  1239. overflow: "hidden"
  1240. }
  1241. }),
  1242. [`${r}-progress`]: {
  1243. bottom: i,
  1244. width: `calc(100% - ${e.paddingSM * 2}px)`,
  1245. marginTop: 0,
  1246. paddingInlineStart: o + e.paddingXS
  1247. }
  1248. },
  1249. [`${r}-error`]: {
  1250. borderColor: e.colorError,
  1251. // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
  1252. [`${r}-thumbnail ${n}`]: {
  1253. "svg path[fill='#e6f7ff']": {
  1254. fill: e.colorErrorBg
  1255. },
  1256. "svg path[fill='#1890ff']": {
  1257. fill: e.colorError
  1258. }
  1259. }
  1260. },
  1261. [`${r}-uploading`]: {
  1262. borderStyle: "dashed",
  1263. [`${r}-name`]: {
  1264. marginBottom: i
  1265. }
  1266. }
  1267. }
  1268. }
  1269. };
  1270. }, tn = (e) => {
  1271. const {
  1272. componentCls: t,
  1273. iconCls: n,
  1274. fontSizeLG: o,
  1275. colorTextLightSolid: i
  1276. } = e, a = `${t}-list`, r = `${a}-item`, s = e.uploadPicCardSize;
  1277. return {
  1278. [`${t}-wrapper${t}-picture-card-wrapper`]: S(S({}, Re()), {
  1279. display: "inline-block",
  1280. width: "100%",
  1281. [`${t}${t}-select`]: {
  1282. width: s,
  1283. height: s,
  1284. marginInlineEnd: e.marginXS,
  1285. marginBottom: e.marginXS,
  1286. textAlign: "center",
  1287. verticalAlign: "top",
  1288. backgroundColor: e.colorFillAlter,
  1289. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1290. borderRadius: e.borderRadiusLG,
  1291. cursor: "pointer",
  1292. transition: `border-color ${e.motionDurationSlow}`,
  1293. [`> ${t}`]: {
  1294. display: "flex",
  1295. alignItems: "center",
  1296. justifyContent: "center",
  1297. height: "100%",
  1298. textAlign: "center"
  1299. },
  1300. [`&:not(${t}-disabled):hover`]: {
  1301. borderColor: e.colorPrimary
  1302. }
  1303. },
  1304. // list
  1305. [`${a}${a}-picture-card`]: {
  1306. [`${a}-item-container`]: {
  1307. display: "inline-block",
  1308. width: s,
  1309. height: s,
  1310. marginBlock: `0 ${e.marginXS}px`,
  1311. marginInline: `0 ${e.marginXS}px`,
  1312. verticalAlign: "top"
  1313. },
  1314. "&::after": {
  1315. display: "none"
  1316. },
  1317. [r]: {
  1318. height: "100%",
  1319. margin: 0,
  1320. "&::before": {
  1321. position: "absolute",
  1322. zIndex: 1,
  1323. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1324. height: `calc(100% - ${e.paddingXS * 2}px)`,
  1325. backgroundColor: e.colorBgMask,
  1326. opacity: 0,
  1327. transition: `all ${e.motionDurationSlow}`,
  1328. content: '" "'
  1329. }
  1330. },
  1331. [`${r}:hover`]: {
  1332. [`&::before, ${r}-actions`]: {
  1333. opacity: 1
  1334. }
  1335. },
  1336. [`${r}-actions`]: {
  1337. position: "absolute",
  1338. insetInlineStart: 0,
  1339. zIndex: 10,
  1340. width: "100%",
  1341. whiteSpace: "nowrap",
  1342. textAlign: "center",
  1343. opacity: 0,
  1344. transition: `all ${e.motionDurationSlow}`,
  1345. [`${n}-eye, ${n}-download, ${n}-delete`]: {
  1346. zIndex: 10,
  1347. width: o,
  1348. margin: `0 ${e.marginXXS}px`,
  1349. fontSize: o,
  1350. cursor: "pointer",
  1351. transition: `all ${e.motionDurationSlow}`
  1352. }
  1353. },
  1354. [`${r}-actions, ${r}-actions:hover`]: {
  1355. [`${n}-eye, ${n}-download, ${n}-delete`]: {
  1356. color: new lt(i).setAlpha(0.65).toRgbString(),
  1357. "&:hover": {
  1358. color: i
  1359. }
  1360. }
  1361. },
  1362. [`${r}-thumbnail, ${r}-thumbnail img`]: {
  1363. position: "static",
  1364. display: "block",
  1365. width: "100%",
  1366. height: "100%",
  1367. objectFit: "contain"
  1368. },
  1369. [`${r}-name`]: {
  1370. display: "none",
  1371. textAlign: "center"
  1372. },
  1373. [`${r}-file + ${r}-name`]: {
  1374. position: "absolute",
  1375. bottom: e.margin,
  1376. display: "block",
  1377. width: `calc(100% - ${e.paddingXS * 2}px)`
  1378. },
  1379. [`${r}-uploading`]: {
  1380. [`&${r}`]: {
  1381. backgroundColor: e.colorFillAlter
  1382. },
  1383. [`&::before, ${n}-eye, ${n}-download, ${n}-delete`]: {
  1384. display: "none"
  1385. }
  1386. },
  1387. [`${r}-progress`]: {
  1388. bottom: e.marginXL,
  1389. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1390. paddingInlineStart: 0
  1391. }
  1392. }
  1393. })
  1394. };
  1395. }, nn = (e) => {
  1396. const {
  1397. componentCls: t
  1398. } = e;
  1399. return {
  1400. [`${t}-rtl`]: {
  1401. direction: "rtl"
  1402. }
  1403. };
  1404. }, on = (e) => {
  1405. const {
  1406. componentCls: t,
  1407. colorTextDisabled: n
  1408. } = e;
  1409. return {
  1410. [`${t}-wrapper`]: S(S({}, ut(e)), {
  1411. [t]: {
  1412. outline: 0,
  1413. "input[type='file']": {
  1414. cursor: "pointer"
  1415. }
  1416. },
  1417. [`${t}-select`]: {
  1418. display: "inline-block"
  1419. },
  1420. [`${t}-disabled`]: {
  1421. color: n,
  1422. cursor: "not-allowed"
  1423. }
  1424. })
  1425. };
  1426. }, rn = st("Upload", (e) => {
  1427. const {
  1428. fontSizeHeading3: t,
  1429. fontSize: n,
  1430. lineHeight: o,
  1431. lineWidth: i,
  1432. controlHeightLG: a
  1433. } = e, r = Math.round(n * o), s = ct(e, {
  1434. uploadThumbnailSize: t * 2,
  1435. uploadProgressOffset: r / 2 + i,
  1436. uploadPicCardSize: a * 2.55
  1437. });
  1438. return [on(s), Zt(s), en(s), tn(s), Qt(s), kt(s), nn(s), dt(s)];
  1439. });
  1440. var an = function(e, t, n, o) {
  1441. function i(a) {
  1442. return a instanceof n ? a : new n(function(r) {
  1443. r(a);
  1444. });
  1445. }
  1446. return new (n || (n = Promise))(function(a, r) {
  1447. function s(g) {
  1448. try {
  1449. F(o.next(g));
  1450. } catch (T) {
  1451. r(T);
  1452. }
  1453. }
  1454. function y(g) {
  1455. try {
  1456. F(o.throw(g));
  1457. } catch (T) {
  1458. r(T);
  1459. }
  1460. }
  1461. function F(g) {
  1462. g.done ? a(g.value) : i(g.value).then(s, y);
  1463. }
  1464. F((o = o.apply(e, t || [])).next());
  1465. });
  1466. }, ln = function(e, t) {
  1467. var n = {};
  1468. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1469. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  1470. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  1471. return n;
  1472. };
  1473. const ee = `__LIST_IGNORE_${Date.now()}__`, ae = Y({
  1474. compatConfig: {
  1475. MODE: 3
  1476. },
  1477. name: "AUpload",
  1478. inheritAttrs: !1,
  1479. props: ve(Le(), {
  1480. type: "select",
  1481. multiple: !1,
  1482. action: "",
  1483. data: {},
  1484. accept: "",
  1485. showUploadList: !0,
  1486. listType: "text",
  1487. supportServerRender: !0
  1488. }),
  1489. setup(e, t) {
  1490. let {
  1491. slots: n,
  1492. attrs: o,
  1493. expose: i
  1494. } = t;
  1495. const a = pt(), {
  1496. prefixCls: r,
  1497. direction: s,
  1498. disabled: y
  1499. } = he("upload", e), [F, g] = rn(r), T = ft(), R = oe(() => {
  1500. var c;
  1501. return (c = y.value) !== null && c !== void 0 ? c : T.value;
  1502. }), [_, z] = mt(e.defaultFileList || [], {
  1503. value: It(e, "fileList"),
  1504. postState: (c) => {
  1505. const u = Date.now();
  1506. return (c != null ? c : []).map((p, f) => (!p.uid && !Object.isFrozen(p) && (p.uid = `__AUTO__${u}_${f}__`), p));
  1507. }
  1508. }), l = ne("drop"), b = ne(null);
  1509. ce(() => {
  1510. ue(e.fileList !== void 0 || o.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), ue(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), ue(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event.");
  1511. });
  1512. const L = (c, u, p) => {
  1513. var f, h;
  1514. let C = [...u];
  1515. e.maxCount === 1 ? C = C.slice(-1) : e.maxCount && (C = C.slice(0, e.maxCount)), z(C);
  1516. const D = {
  1517. file: c,
  1518. fileList: C
  1519. };
  1520. p && (D.event = p), (f = e["onUpdate:fileList"]) === null || f === void 0 || f.call(e, D.fileList), (h = e.onChange) === null || h === void 0 || h.call(e, D), a.onFieldChange();
  1521. }, d = (c, u) => an(this, void 0, void 0, function* () {
  1522. const {
  1523. beforeUpload: p,
  1524. transformFile: f
  1525. } = e;
  1526. let h = c;
  1527. if (p) {
  1528. const C = yield p(c, u);
  1529. if (C === !1)
  1530. return !1;
  1531. if (delete c[ee], C === ee)
  1532. return Object.defineProperty(c, ee, {
  1533. value: !0,
  1534. configurable: !0
  1535. }), !1;
  1536. typeof C == "object" && C && (h = C);
  1537. }
  1538. return f && (h = yield f(h)), h;
  1539. }), v = (c) => {
  1540. const u = c.filter((h) => !h.file[ee]);
  1541. if (!u.length)
  1542. return;
  1543. const p = u.map((h) => re(h.file));
  1544. let f = [..._.value];
  1545. p.forEach((h) => {
  1546. f = ie(h, f);
  1547. }), p.forEach((h, C) => {
  1548. let D = h;
  1549. if (u[C].parsedFile)
  1550. h.status = "uploading";
  1551. else {
  1552. const {
  1553. originFileObj: x
  1554. } = h;
  1555. let E;
  1556. try {
  1557. E = new File([x], x.name, {
  1558. type: x.type
  1559. });
  1560. } catch (q) {
  1561. E = new Blob([x], {
  1562. type: x.type
  1563. }), E.name = x.name, E.lastModifiedDate = /* @__PURE__ */ new Date(), E.lastModified = (/* @__PURE__ */ new Date()).getTime();
  1564. }
  1565. E.uid = h.uid, D = E;
  1566. }
  1567. L(D, f);
  1568. });
  1569. }, $ = (c, u, p) => {
  1570. try {
  1571. typeof c == "string" && (c = JSON.parse(c));
  1572. } catch (C) {
  1573. }
  1574. if (!ge(u, _.value))
  1575. return;
  1576. const f = re(u);
  1577. f.status = "done", f.percent = 100, f.response = c, f.xhr = p;
  1578. const h = ie(f, _.value);
  1579. L(f, h);
  1580. }, I = (c, u) => {
  1581. if (!ge(u, _.value))
  1582. return;
  1583. const p = re(u);
  1584. p.status = "uploading", p.percent = c.percent;
  1585. const f = ie(p, _.value);
  1586. L(p, f, c);
  1587. }, P = (c, u, p) => {
  1588. if (!ge(p, _.value))
  1589. return;
  1590. const f = re(p);
  1591. f.error = c, f.response = u, f.status = "error";
  1592. const h = ie(f, _.value);
  1593. L(f, h);
  1594. }, U = (c) => {
  1595. let u;
  1596. const p = e.onRemove || e.remove;
  1597. Promise.resolve(typeof p == "function" ? p(c) : p).then((f) => {
  1598. var h, C;
  1599. if (f === !1)
  1600. return;
  1601. const D = Ht(c, _.value);
  1602. D && (u = S(S({}, c), {
  1603. status: "removed"
  1604. }), (h = _.value) === null || h === void 0 || h.forEach((x) => {
  1605. const E = u.uid !== void 0 ? "uid" : "name";
  1606. x[E] === u[E] && !Object.isFrozen(x) && (x.status = "removed");
  1607. }), (C = b.value) === null || C === void 0 || C.abort(u), L(u, D));
  1608. });
  1609. }, j = (c) => {
  1610. var u;
  1611. l.value = c.type, c.type === "drop" && ((u = e.onDrop) === null || u === void 0 || u.call(e, c));
  1612. };
  1613. i({
  1614. onBatchStart: v,
  1615. onSuccess: $,
  1616. onProgress: I,
  1617. onError: P,
  1618. fileList: _,
  1619. upload: b
  1620. });
  1621. const [A] = gt("Upload", vt.Upload, oe(() => e.locale)), M = (c, u) => {
  1622. const {
  1623. removeIcon: p,
  1624. previewIcon: f,
  1625. downloadIcon: h,
  1626. previewFile: C,
  1627. onPreview: D,
  1628. onDownload: x,
  1629. isImageUrl: E,
  1630. progress: q,
  1631. itemRender: K,
  1632. iconRender: X,
  1633. showUploadList: H
  1634. } = e, {
  1635. showDownloadIcon: W,
  1636. showPreviewIcon: Z,
  1637. showRemoveIcon: de
  1638. } = typeof H == "boolean" ? {} : H;
  1639. return H ? m(Yt, {
  1640. prefixCls: r.value,
  1641. listType: e.listType,
  1642. items: _.value,
  1643. previewFile: C,
  1644. onPreview: D,
  1645. onDownload: x,
  1646. onRemove: U,
  1647. showRemoveIcon: !R.value && de,
  1648. showPreviewIcon: Z,
  1649. showDownloadIcon: W,
  1650. removeIcon: p,
  1651. previewIcon: f,
  1652. downloadIcon: h,
  1653. iconRender: X,
  1654. locale: A.value,
  1655. isImageUrl: E,
  1656. progress: q,
  1657. itemRender: K,
  1658. appendActionVisible: u,
  1659. appendAction: c
  1660. }, S({}, n)) : c == null ? void 0 : c();
  1661. };
  1662. return () => {
  1663. var c, u, p;
  1664. const {
  1665. listType: f,
  1666. type: h
  1667. } = e, {
  1668. class: C,
  1669. style: D
  1670. } = o, x = ln(o, ["class", "style"]), E = S(S(S({
  1671. onBatchStart: v,
  1672. onError: P,
  1673. onProgress: I,
  1674. onSuccess: $
  1675. }, x), e), {
  1676. id: (c = e.id) !== null && c !== void 0 ? c : a.id.value,
  1677. prefixCls: r.value,
  1678. beforeUpload: d,
  1679. onChange: void 0,
  1680. disabled: R.value
  1681. });
  1682. delete E.remove, (!n.default || R.value) && delete E.id;
  1683. const q = {
  1684. [`${r.value}-rtl`]: s.value === "rtl"
  1685. };
  1686. if (h === "drag") {
  1687. const W = k(r.value, {
  1688. [`${r.value}-drag`]: !0,
  1689. [`${r.value}-drag-uploading`]: _.value.some((Z) => Z.status === "uploading"),
  1690. [`${r.value}-drag-hover`]: l.value === "dragover",
  1691. [`${r.value}-disabled`]: R.value,
  1692. [`${r.value}-rtl`]: s.value === "rtl"
  1693. }, o.class, g.value);
  1694. return F(m("span", O(O({}, o), {}, {
  1695. class: k(`${r.value}-wrapper`, q, C, g.value)
  1696. }), [m("div", {
  1697. class: W,
  1698. onDrop: j,
  1699. onDragover: j,
  1700. onDragleave: j,
  1701. style: o.style
  1702. }, [m(Ce, O(O({}, E), {}, {
  1703. ref: b,
  1704. class: `${r.value}-btn`
  1705. }), O({
  1706. default: () => [m("div", {
  1707. class: `${r.value}-drag-container`
  1708. }, [(u = n.default) === null || u === void 0 ? void 0 : u.call(n)])]
  1709. }, n))]), M()]));
  1710. }
  1711. const K = k(r.value, {
  1712. [`${r.value}-select`]: !0,
  1713. [`${r.value}-select-${f}`]: !0,
  1714. [`${r.value}-disabled`]: R.value,
  1715. [`${r.value}-rtl`]: s.value === "rtl"
  1716. }), X = ht((p = n.default) === null || p === void 0 ? void 0 : p.call(n)), H = (W) => m("div", {
  1717. class: K,
  1718. style: W
  1719. }, [m(Ce, O(O({}, E), {}, {
  1720. ref: b
  1721. }), n)]);
  1722. return F(f === "picture-card" ? m("span", O(O({}, o), {}, {
  1723. class: k(`${r.value}-wrapper`, `${r.value}-picture-card-wrapper`, q, o.class, g.value)
  1724. }), [M(H, !!(X && X.length))]) : m("span", O(O({}, o), {}, {
  1725. class: k(`${r.value}-wrapper`, q, o.class, g.value)
  1726. }), [H(X && X.length ? void 0 : {
  1727. display: "none"
  1728. }), M()]));
  1729. };
  1730. }
  1731. });
  1732. var Fe = function(e, t) {
  1733. var n = {};
  1734. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1735. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  1736. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  1737. return n;
  1738. };
  1739. const le = Y({
  1740. compatConfig: {
  1741. MODE: 3
  1742. },
  1743. name: "AUploadDragger",
  1744. inheritAttrs: !1,
  1745. props: Le(),
  1746. setup(e, t) {
  1747. let {
  1748. slots: n,
  1749. attrs: o
  1750. } = t;
  1751. return () => {
  1752. const {
  1753. height: i
  1754. } = e, a = Fe(e, ["height"]), {
  1755. style: r
  1756. } = o, s = Fe(o, ["style"]), y = S(S(S({}, a), s), {
  1757. type: "drag",
  1758. style: S(S({}, r), {
  1759. height: typeof i == "number" ? `${i}px` : i
  1760. })
  1761. });
  1762. return m(ae, y, n);
  1763. };
  1764. }
  1765. }), un = le, pn = S(ae, {
  1766. Dragger: le,
  1767. LIST_IGNORE: ee,
  1768. install(e) {
  1769. return e.component(ae.name, ae), e.component(le.name, le), e;
  1770. }
  1771. });
  1772. export {
  1773. un as U,
  1774. pn as _
  1775. };