sweetalert.min.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. !
  2. function(e, t, n) {
  3. "use strict"; !
  4. function o(e, t, n) {
  5. function a(s, l) {
  6. if (!t[s]) {
  7. if (!e[s]) {
  8. var i = "function" == typeof require && require;
  9. if (!l && i) return i(s, !0);
  10. if (r) return r(s, !0);
  11. var u = new Error("Cannot find module '" + s + "'");
  12. throw u.code = "MODULE_NOT_FOUND",
  13. u
  14. }
  15. var c = t[s] = {
  16. exports: {}
  17. };
  18. e[s][0].call(c.exports,
  19. function(t) {
  20. var n = e[s][1][t];
  21. return a(n ? n: t)
  22. },
  23. c, c.exports, o, e, t, n)
  24. }
  25. return t[s].exports
  26. }
  27. for (var r = "function" == typeof require && require,
  28. s = 0; s < n.length; s++) a(n[s]);
  29. return a
  30. } ({
  31. 1 : [function(o) {
  32. var a, r, s, l, i = function(e) {
  33. return e && e.__esModule ? e: {
  34. "default": e
  35. }
  36. },
  37. u = o("./modules/handle-dom"),
  38. c = o("./modules/utils"),
  39. d = o("./modules/handle-swal-dom"),
  40. f = o("./modules/handle-click"),
  41. p = o("./modules/handle-key"),
  42. m = i(p),
  43. v = o("./modules/default-params"),
  44. y = i(v),
  45. h = o("./modules/set-params"),
  46. g = i(h);
  47. s = l = function() {
  48. function o(e) {
  49. var t = s;
  50. return t[e] === n ? y["default"][e] : t[e]
  51. }
  52. var s = arguments[0];
  53. if (u.addClass(t.body, "stop-scrolling"), d.resetInput(), s === n) return c.logStr("SweetAlert expects at least 1 attribute!"),
  54. !1;
  55. var l = c.extend({},
  56. y["default"]);
  57. switch (typeof s) {
  58. case "string":
  59. l.title = s,
  60. l.text = arguments[1] || "",
  61. l.type = arguments[2] || "";
  62. break;
  63. case "object":
  64. if (s.title === n) return c.logStr('Missing "title" argument!'),
  65. !1;
  66. l.title = s.title;
  67. for (var i in y["default"]) l[i] = o(i);
  68. l.confirmButtonText = l.showCancelButton ? "Confirm": y["default"].confirmButtonText,
  69. l.confirmButtonText = o("confirmButtonText"),
  70. l.doneFunction = arguments[1] || null;
  71. break;
  72. default:
  73. return c.logStr('Unexpected type of argument! Expected "string" or "object", got ' + typeof s),
  74. !1
  75. }
  76. g["default"](l),
  77. d.fixVerticalPosition(),
  78. d.openModal(arguments[1]);
  79. for (var p = d.getModal(), v = p.querySelectorAll("button"), h = ["onclick", "onmouseover", "onmouseout", "onmousedown", "onmouseup", "onfocus"], b = function(e) {
  80. return f.handleButton(e, l, p)
  81. },
  82. w = 0; w < v.length; w++) for (var C = 0; C < h.length; C++) {
  83. var S = h[C];
  84. v[w][S] = b
  85. }
  86. d.getOverlay().onclick = b,
  87. a = e.onkeydown;
  88. var x = function(e) {
  89. return m["default"](e, l, p)
  90. };
  91. e.onkeydown = x,
  92. e.onfocus = function() {
  93. setTimeout(function() {
  94. r !== n && (r.focus(), r = n)
  95. },
  96. 0)
  97. }
  98. },
  99. s.setDefaults = l.setDefaults = function(e) {
  100. if (!e) throw new Error("userParams is required");
  101. if ("object" != typeof e) throw new Error("userParams has to be a object");
  102. c.extend(y["default"], e)
  103. },
  104. s.close = l.close = function() {
  105. var o = d.getModal();
  106. u.fadeOut(d.getOverlay(), 5),
  107. u.fadeOut(o, 5),
  108. u.removeClass(o, "showSweetAlert"),
  109. u.addClass(o, "hideSweetAlert"),
  110. u.removeClass(o, "visible");
  111. var s = o.querySelector(".sa-icon.sa-success");
  112. u.removeClass(s, "animate"),
  113. u.removeClass(s.querySelector(".sa-tip"), "animateSuccessTip"),
  114. u.removeClass(s.querySelector(".sa-long"), "animateSuccessLong");
  115. var l = o.querySelector(".sa-icon.sa-error");
  116. u.removeClass(l, "animateErrorIcon"),
  117. u.removeClass(l.querySelector(".sa-x-mark"), "animateXMark");
  118. var i = o.querySelector(".sa-icon.sa-warning");
  119. return u.removeClass(i, "pulseWarning"),
  120. u.removeClass(i.querySelector(".sa-body"), "pulseWarningIns"),
  121. u.removeClass(i.querySelector(".sa-dot"), "pulseWarningIns"),
  122. setTimeout(function() {
  123. var e = o.getAttribute("data-custom-class");
  124. u.removeClass(o, e)
  125. },
  126. 300),
  127. u.removeClass(t.body, "stop-scrolling"),
  128. e.onkeydown = a,
  129. e.previousActiveElement && e.previousActiveElement.focus(),
  130. r = n,
  131. clearTimeout(o.timeout),
  132. !0
  133. },
  134. s.showInputError = l.showInputError = function(e) {
  135. var t = d.getModal(),
  136. n = t.querySelector(".sa-input-error");
  137. u.addClass(n, "show");
  138. var o = t.querySelector(".sa-error-container");
  139. u.addClass(o, "show"),
  140. o.querySelector("p").innerHTML = e,
  141. t.querySelector("input").focus()
  142. },
  143. s.resetInputError = l.resetInputError = function(e) {
  144. if (e && 13 === e.keyCode) return ! 1;
  145. var t = d.getModal(),
  146. n = t.querySelector(".sa-input-error");
  147. u.removeClass(n, "show");
  148. var o = t.querySelector(".sa-error-container");
  149. u.removeClass(o, "show")
  150. },
  151. "undefined" != typeof e ? e.sweetAlert = e.swal = s: c.logStr("SweetAlert is a frontend module!")
  152. },
  153. {
  154. "./modules/default-params": 2,
  155. "./modules/handle-click": 3,
  156. "./modules/handle-dom": 4,
  157. "./modules/handle-key": 5,
  158. "./modules/handle-swal-dom": 6,
  159. "./modules/set-params": 8,
  160. "./modules/utils": 9
  161. }],
  162. 2 : [function(e, t, n) {
  163. Object.defineProperty(n, "__esModule", {
  164. value: !0
  165. });
  166. var o = {
  167. title: "",
  168. text: "",
  169. type: null,
  170. allowOutsideClick: !1,
  171. showConfirmButton: !0,
  172. showCancelButton: !1,
  173. closeOnConfirm: !0,
  174. closeOnCancel: !0,
  175. confirmButtonText: "OK",
  176. confirmButtonColor: "#AEDEF4",
  177. cancelButtonText: "取消",
  178. imageUrl: null,
  179. imageSize: null,
  180. timer: null,
  181. customClass: "",
  182. html: !1,
  183. animation: !0,
  184. allowEscapeKey: !0,
  185. inputType: "text",
  186. inputPlaceholder: "",
  187. inputValue: ""
  188. };
  189. n["default"] = o,
  190. t.exports = n["default"]
  191. },
  192. {}],
  193. 3 : [function(t, n, o) {
  194. Object.defineProperty(o, "__esModule", {
  195. value: !0
  196. });
  197. var a = t("./utils"),
  198. r = (t("./handle-swal-dom"), t("./handle-dom")),
  199. s = function(t, n, o) {
  200. function s(e) {
  201. m && n.confirmButtonColor && (p.style.backgroundColor = e)
  202. }
  203. var u, c, d, f = t || e.event,
  204. p = f.target || f.srcElement,
  205. m = -1 !== p.className.indexOf("confirm"),
  206. v = -1 !== p.className.indexOf("sweet-overlay"),
  207. y = r.hasClass(o, "visible"),
  208. h = n.doneFunction && "true" === o.getAttribute("data-has-done-function");
  209. switch (m && n.confirmButtonColor && (u = n.confirmButtonColor, c = a.colorLuminance(u, -.04), d = a.colorLuminance(u, -.14)), f.type) {
  210. case "mouseover":
  211. s(c);
  212. break;
  213. case "mouseout":
  214. s(u);
  215. break;
  216. case "mousedown":
  217. s(d);
  218. break;
  219. case "mouseup":
  220. s(c);
  221. break;
  222. case "focus":
  223. var g = o.querySelector("button.confirm"),
  224. b = o.querySelector("button.cancel");
  225. m ? b.style.boxShadow = "none": g.style.boxShadow = "none";
  226. break;
  227. case "click":
  228. var w = o === p,
  229. C = r.isDescendant(o, p);
  230. if (!w && !C && y && !n.allowOutsideClick) break;
  231. m && h && y ? l(o, n) : h && y || v ? i(o, n) : r.isDescendant(o, p) && "BUTTON" === p.tagName && sweetAlert.close()
  232. }
  233. },
  234. l = function(e, t) {
  235. var n = !0;
  236. r.hasClass(e, "show-input") && (n = e.querySelector("input").value, n || (n = "")),
  237. t.doneFunction(n),
  238. t.closeOnConfirm && sweetAlert.close()
  239. },
  240. i = function(e, t) {
  241. var n = String(t.doneFunction).replace(/\s/g, ""),
  242. o = "function(" === n.substring(0, 9) && ")" !== n.substring(9, 10);
  243. o && t.doneFunction(!1),
  244. t.closeOnCancel && sweetAlert.close()
  245. };
  246. o["default"] = {
  247. handleButton: s,
  248. handleConfirm: l,
  249. handleCancel: i
  250. },
  251. n.exports = o["default"]
  252. },
  253. {
  254. "./handle-dom": 4,
  255. "./handle-swal-dom": 6,
  256. "./utils": 9
  257. }],
  258. 4 : [function(n, o, a) {
  259. Object.defineProperty(a, "__esModule", {
  260. value: !0
  261. });
  262. var r = function(e, t) {
  263. return new RegExp(" " + t + " ").test(" " + e.className + " ")
  264. },
  265. s = function(e, t) {
  266. r(e, t) || (e.className += " " + t)
  267. },
  268. l = function(e, t) {
  269. var n = " " + e.className.replace(/[\t\r\n]/g, " ") + " ";
  270. if (r(e, t)) {
  271. for (; n.indexOf(" " + t + " ") >= 0;) n = n.replace(" " + t + " ", " ");
  272. e.className = n.replace(/^\s+|\s+$/g, "")
  273. }
  274. },
  275. i = function(e) {
  276. var n = t.createElement("div");
  277. return n.appendChild(t.createTextNode(e)),
  278. n.innerHTML
  279. },
  280. u = function(e) {
  281. e.style.opacity = "",
  282. e.style.display = "block"
  283. },
  284. c = function(e) {
  285. if (e && !e.length) return u(e);
  286. for (var t = 0; t < e.length; ++t) u(e[t])
  287. },
  288. d = function(e) {
  289. e.style.opacity = "",
  290. e.style.display = "none"
  291. },
  292. f = function(e) {
  293. if (e && !e.length) return d(e);
  294. for (var t = 0; t < e.length; ++t) d(e[t])
  295. },
  296. p = function(e, t) {
  297. for (var n = t.parentNode; null !== n;) {
  298. if (n === e) return ! 0;
  299. n = n.parentNode
  300. }
  301. return ! 1
  302. },
  303. m = function(e) {
  304. e.style.left = "-9999px",
  305. e.style.display = "block";
  306. var t, n = e.clientHeight;
  307. return t = "undefined" != typeof getComputedStyle ? parseInt(getComputedStyle(e).getPropertyValue("padding-top"), 10) : parseInt(e.currentStyle.padding),
  308. e.style.left = "",
  309. e.style.display = "none",
  310. "-" + parseInt((n + t) / 2) + "px"
  311. },
  312. v = function(e, t) {
  313. if ( + e.style.opacity < 1) {
  314. t = t || 16,
  315. e.style.opacity = 0,
  316. e.style.display = "block";
  317. var n = +new Date,
  318. o = function(e) {
  319. function t() {
  320. return e.apply(this, arguments)
  321. }
  322. return t.toString = function() {
  323. return e.toString()
  324. },
  325. t
  326. } (function() {
  327. e.style.opacity = +e.style.opacity + (new Date - n) / 100,
  328. n = +new Date,
  329. +e.style.opacity < 1 && setTimeout(o, t)
  330. });
  331. o()
  332. }
  333. e.style.display = "block"
  334. },
  335. y = function(e, t) {
  336. t = t || 16,
  337. e.style.opacity = 1;
  338. var n = +new Date,
  339. o = function(e) {
  340. function t() {
  341. return e.apply(this, arguments)
  342. }
  343. return t.toString = function() {
  344. return e.toString()
  345. },
  346. t
  347. } (function() {
  348. e.style.opacity = +e.style.opacity - (new Date - n) / 100,
  349. n = +new Date,
  350. +e.style.opacity > 0 ? setTimeout(o, t) : e.style.display = "none"
  351. });
  352. o()
  353. },
  354. h = function(n) {
  355. if ("function" == typeof MouseEvent) {
  356. var o = new MouseEvent("click", {
  357. view: e,
  358. bubbles: !1,
  359. cancelable: !0
  360. });
  361. n.dispatchEvent(o)
  362. } else if (t.createEvent) {
  363. var a = t.createEvent("MouseEvents");
  364. a.initEvent("click", !1, !1),
  365. n.dispatchEvent(a)
  366. } else t.createEventObject ? n.fireEvent("onclick") : "function" == typeof n.onclick && n.onclick()
  367. },
  368. g = function(t) {
  369. "function" == typeof t.stopPropagation ? (t.stopPropagation(), t.preventDefault()) : e.event && e.event.hasOwnProperty("cancelBubble") && (e.event.cancelBubble = !0)
  370. };
  371. a.hasClass = r,
  372. a.addClass = s,
  373. a.removeClass = l,
  374. a.escapeHtml = i,
  375. a._show = u,
  376. a.show = c,
  377. a._hide = d,
  378. a.hide = f,
  379. a.isDescendant = p,
  380. a.getTopMargin = m,
  381. a.fadeIn = v,
  382. a.fadeOut = y,
  383. a.fireClick = h,
  384. a.stopEventPropagation = g
  385. },
  386. {}],
  387. 5 : [function(t, o, a) {
  388. Object.defineProperty(a, "__esModule", {
  389. value: !0
  390. });
  391. var r = t("./handle-dom"),
  392. s = t("./handle-swal-dom"),
  393. l = function(t, o, a) {
  394. var l = t || e.event,
  395. i = l.keyCode || l.which,
  396. u = a.querySelector("button.confirm"),
  397. c = a.querySelector("button.cancel"),
  398. d = a.querySelectorAll("button[tabindex]");
  399. if ( - 1 !== [9, 13, 32, 27].indexOf(i)) {
  400. for (var f = l.target || l.srcElement,
  401. p = -1,
  402. m = 0; m < d.length; m++) if (f === d[m]) {
  403. p = m;
  404. break
  405. }
  406. 9 === i ? (f = -1 === p ? u: p === d.length - 1 ? d[0] : d[p + 1], r.stopEventPropagation(l), f.focus(), o.confirmButtonColor && s.setFocusStyle(f, o.confirmButtonColor)) : 13 === i ? ("INPUT" === f.tagName && (f = u, u.focus()), f = -1 === p ? u: n) : 27 === i && o.allowEscapeKey === !0 ? (f = c, r.fireClick(f, l)) : f = n
  407. }
  408. };
  409. a["default"] = l,
  410. o.exports = a["default"]
  411. },
  412. {
  413. "./handle-dom": 4,
  414. "./handle-swal-dom": 6
  415. }],
  416. 6 : [function(n, o, a) {
  417. var r = function(e) {
  418. return e && e.__esModule ? e: {
  419. "default": e
  420. }
  421. };
  422. Object.defineProperty(a, "__esModule", {
  423. value: !0
  424. });
  425. var s = n("./utils"),
  426. l = n("./handle-dom"),
  427. i = n("./default-params"),
  428. u = r(i),
  429. c = n("./injected-html"),
  430. d = r(c),
  431. f = ".sweet-alert",
  432. p = ".sweet-overlay",
  433. m = function() {
  434. var e = t.createElement("div");
  435. for (e.innerHTML = d["default"]; e.firstChild;) t.body.appendChild(e.firstChild)
  436. },
  437. v = function(e) {
  438. function t() {
  439. return e.apply(this, arguments)
  440. }
  441. return t.toString = function() {
  442. return e.toString()
  443. },
  444. t
  445. } (function() {
  446. var e = t.querySelector(f);
  447. return e || (m(), e = v()),
  448. e
  449. }),
  450. y = function() {
  451. var e = v();
  452. return e ? e.querySelector("input") : void 0
  453. },
  454. h = function() {
  455. return t.querySelector(p)
  456. },
  457. g = function(e, t) {
  458. var n = s.hexToRgb(t);
  459. e.style.boxShadow = "0 0 2px rgba(" + n + ", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"
  460. },
  461. b = function(n) {
  462. var o = v();
  463. l.fadeIn(h(), 10),
  464. l.show(o),
  465. l.addClass(o, "showSweetAlert"),
  466. l.removeClass(o, "hideSweetAlert"),
  467. e.previousActiveElement = t.activeElement;
  468. var a = o.querySelector("button.confirm");
  469. a.focus(),
  470. setTimeout(function() {
  471. l.addClass(o, "visible")
  472. },
  473. 500);
  474. var r = o.getAttribute("data-timer");
  475. if ("null" !== r && "" !== r) {
  476. var s = n;
  477. o.timeout = setTimeout(function() {
  478. var e = (s || null) && "true" === o.getAttribute("data-has-done-function");
  479. e ? s(null) : sweetAlert.close()
  480. },
  481. r)
  482. }
  483. },
  484. w = function() {
  485. var e = v(),
  486. t = y();
  487. l.removeClass(e, "show-input"),
  488. t.value = u["default"].inputValue,
  489. t.setAttribute("type", u["default"].inputType),
  490. t.setAttribute("placeholder", u["default"].inputPlaceholder),
  491. C()
  492. },
  493. C = function(e) {
  494. if (e && 13 === e.keyCode) return ! 1;
  495. var t = v(),
  496. n = t.querySelector(".sa-input-error");
  497. l.removeClass(n, "show");
  498. var o = t.querySelector(".sa-error-container");
  499. l.removeClass(o, "show")
  500. },
  501. S = function() {
  502. var e = v();
  503. e.style.marginTop = l.getTopMargin(v())
  504. };
  505. a.sweetAlertInitialize = m,
  506. a.getModal = v,
  507. a.getOverlay = h,
  508. a.getInput = y,
  509. a.setFocusStyle = g,
  510. a.openModal = b,
  511. a.resetInput = w,
  512. a.resetInputError = C,
  513. a.fixVerticalPosition = S
  514. },
  515. {
  516. "./default-params": 2,
  517. "./handle-dom": 4,
  518. "./injected-html": 7,
  519. "./utils": 9
  520. }],
  521. 7 : [function(e, t, n) {
  522. Object.defineProperty(n, "__esModule", {
  523. value: !0
  524. });
  525. var o = '<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n <span class="sa-x-mark">\n <span class="sa-line sa-left"></span>\n <span class="sa-line sa-right"></span>\n </span>\n </div><div class="sa-icon sa-warning">\n <span class="sa-body"></span>\n <span class="sa-dot"></span>\n </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n <span class="sa-line sa-tip"></span>\n <span class="sa-line sa-long"></span>\n\n <div class="sa-placeholder"></div>\n <div class="sa-fix"></div>\n </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n <p>Text</p>\n <fieldset>\n <input type="text" tabIndex="3" />\n <div class="sa-input-error"></div>\n </fieldset><div class="sa-error-container">\n <div class="icon">!</div>\n <p>Not valid!</p>\n </div><div class="sa-button-container">\n <button class="cancel" tabIndex="2">取消</button>\n <button class="confirm" tabIndex="1">OK</button>\n </div></div>';
  526. n["default"] = o,
  527. t.exports = n["default"]
  528. },
  529. {}],
  530. 8 : [function(e, t, o) {
  531. Object.defineProperty(o, "__esModule", {
  532. value: !0
  533. });
  534. var a = e("./utils"),
  535. r = e("./handle-swal-dom"),
  536. s = e("./handle-dom"),
  537. l = ["error", "warning", "info", "success", "input", "prompt"],
  538. i = function(e) {
  539. var t = r.getModal(),
  540. o = t.querySelector("h2"),
  541. i = t.querySelector("p"),
  542. u = t.querySelector("button.cancel"),
  543. c = t.querySelector("button.confirm");
  544. if (o.innerHTML = e.html ? e.title: s.escapeHtml(e.title).split("\n").join("<br>"), i.innerHTML = e.html ? e.text: s.escapeHtml(e.text || "").split("\n").join("<br>"), e.text && s.show(i), e.customClass) s.addClass(t, e.customClass),
  545. t.setAttribute("data-custom-class", e.customClass);
  546. else {
  547. var d = t.getAttribute("data-custom-class");
  548. s.removeClass(t, d),
  549. t.setAttribute("data-custom-class", "")
  550. }
  551. if (s.hide(t.querySelectorAll(".sa-icon")), e.type && !a.isIE8()) {
  552. var f = function() {
  553. for (var o = !1,
  554. a = 0; a < l.length; a++) if (e.type === l[a]) {
  555. o = !0;
  556. break
  557. }
  558. if (!o) return logStr("Unknown alert type: " + e.type),
  559. {
  560. v: !1
  561. };
  562. var i = ["success", "error", "warning", "info"],
  563. u = n; - 1 !== i.indexOf(e.type) && (u = t.querySelector(".sa-icon.sa-" + e.type), s.show(u));
  564. var c = r.getInput();
  565. switch (e.type) {
  566. case "success":
  567. s.addClass(u, "animate"),
  568. s.addClass(u.querySelector(".sa-tip"), "animateSuccessTip"),
  569. s.addClass(u.querySelector(".sa-long"), "animateSuccessLong");
  570. break;
  571. case "error":
  572. s.addClass(u, "animateErrorIcon"),
  573. s.addClass(u.querySelector(".sa-x-mark"), "animateXMark");
  574. break;
  575. case "warning":
  576. s.addClass(u, "pulseWarning"),
  577. s.addClass(u.querySelector(".sa-body"), "pulseWarningIns"),
  578. s.addClass(u.querySelector(".sa-dot"), "pulseWarningIns");
  579. break;
  580. case "input":
  581. case "prompt":
  582. c.setAttribute("type", e.inputType),
  583. c.value = e.inputValue,
  584. c.setAttribute("placeholder", e.inputPlaceholder),
  585. s.addClass(t, "show-input"),
  586. setTimeout(function() {
  587. c.focus(),
  588. c.addEventListener("keyup", swal.resetInputError)
  589. },
  590. 400)
  591. }
  592. } ();
  593. if ("object" == typeof f) return f.v
  594. }
  595. if (e.imageUrl) {
  596. var p = t.querySelector(".sa-icon.sa-custom");
  597. p.style.backgroundImage = "url(" + e.imageUrl + ")",
  598. s.show(p);
  599. var m = 80,
  600. v = 80;
  601. if (e.imageSize) {
  602. var y = e.imageSize.toString().split("x"),
  603. h = y[0],
  604. g = y[1];
  605. h && g ? (m = h, v = g) : logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got " + e.imageSize)
  606. }
  607. p.setAttribute("style", p.getAttribute("style") + "width:" + m + "px; height:" + v + "px")
  608. }
  609. t.setAttribute("data-has-cancel-button", e.showCancelButton),
  610. e.showCancelButton ? u.style.display = "inline-block": s.hide(u),
  611. t.setAttribute("data-has-confirm-button", e.showConfirmButton),
  612. e.showConfirmButton ? c.style.display = "inline-block": s.hide(c),
  613. e.cancelButtonText && (u.innerHTML = s.escapeHtml(e.cancelButtonText)),
  614. e.confirmButtonText && (c.innerHTML = s.escapeHtml(e.confirmButtonText)),
  615. e.confirmButtonColor && (c.style.backgroundColor = e.confirmButtonColor, r.setFocusStyle(c, e.confirmButtonColor)),
  616. t.setAttribute("data-allow-outside-click", e.allowOutsideClick);
  617. var b = e.doneFunction ? !0 : !1;
  618. t.setAttribute("data-has-done-function", b),
  619. e.animation ? "string" == typeof e.animation ? t.setAttribute("data-animation", e.animation) : t.setAttribute("data-animation", "pop") : t.setAttribute("data-animation", "none"),
  620. t.setAttribute("data-timer", e.timer)
  621. };
  622. o["default"] = i,
  623. t.exports = o["default"]
  624. },
  625. {
  626. "./handle-dom": 4,
  627. "./handle-swal-dom": 6,
  628. "./utils": 9
  629. }],
  630. 9 : [function(t, n, o) {
  631. Object.defineProperty(o, "__esModule", {
  632. value: !0
  633. });
  634. var a = function(e, t) {
  635. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
  636. return e
  637. },
  638. r = function(e) {
  639. var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
  640. return t ? parseInt(t[1], 16) + ", " + parseInt(t[2], 16) + ", " + parseInt(t[3], 16) : null
  641. },
  642. s = function() {
  643. return e.attachEvent && !e.addEventListener
  644. },
  645. l = function(t) {
  646. e.console && e.console.log("SweetAlert: " + t)
  647. },
  648. i = function(e, t) {
  649. e = String(e).replace(/[^0-9a-f]/gi, ""),
  650. e.length < 6 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]),
  651. t = t || 0;
  652. var n, o, a = "#";
  653. for (o = 0; 3 > o; o++) n = parseInt(e.substr(2 * o, 2), 16),
  654. n = Math.round(Math.min(Math.max(0, n + n * t), 255)).toString(16),
  655. a += ("00" + n).substr(n.length);
  656. return a
  657. };
  658. o.extend = a,
  659. o.hexToRgb = r,
  660. o.isIE8 = s,
  661. o.logStr = l,
  662. o.colorLuminance = i
  663. },
  664. {}]
  665. },
  666. {},
  667. [1]),
  668. "function" == typeof define && define.amd ? define(function() {
  669. return sweetAlert
  670. }) : "undefined" != typeof module && module.exports && (module.exports = sweetAlert)
  671. } (window, document);