index8.js 47 KB

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