Le blog de Victor Héry https://blog.victor-hery.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1194 lines
47 KiB

  1. !(function(e, t) {
  2. "object" == typeof exports && "undefined" != typeof module
  3. ? t()
  4. : "function" == typeof define && define.amd
  5. ? define(t)
  6. : t();
  7. })(0, function() {
  8. "use strict";
  9. var e =
  10. "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
  11. ? function(e) {
  12. return typeof e;
  13. }
  14. : function(e) {
  15. return e &&
  16. "function" == typeof Symbol &&
  17. e.constructor === Symbol &&
  18. e !== Symbol.prototype
  19. ? "symbol"
  20. : typeof e;
  21. },
  22. t = function(e, t) {
  23. if (!(e instanceof t))
  24. throw new TypeError("Cannot call a class as a function");
  25. },
  26. n = (function() {
  27. function e(e, t) {
  28. for (var n = 0; n < t.length; n++) {
  29. var r = t[n];
  30. (r.enumerable = r.enumerable || !1),
  31. (r.configurable = !0),
  32. "value" in r && (r.writable = !0),
  33. Object.defineProperty(e, r.key, r);
  34. }
  35. }
  36. return function(t, n, r) {
  37. return n && e(t.prototype, n), r && e(t, r), t;
  38. };
  39. })(),
  40. r = function(e, t) {
  41. if ("function" != typeof t && null !== t)
  42. throw new TypeError(
  43. "Super expression must either be null or a function, not " + typeof t
  44. );
  45. (e.prototype = Object.create(t && t.prototype, {
  46. constructor: {
  47. value: e,
  48. enumerable: !1,
  49. writable: !0,
  50. configurable: !0
  51. }
  52. })),
  53. t &&
  54. (Object.setPrototypeOf
  55. ? Object.setPrototypeOf(e, t)
  56. : (e.__proto__ = t));
  57. },
  58. o = function(e, t) {
  59. if (!e)
  60. throw new ReferenceError(
  61. "this hasn't been initialised - super() hasn't been called"
  62. );
  63. return !t || ("object" != typeof t && "function" != typeof t) ? e : t;
  64. };
  65. !(function(t, n) {
  66. var r = t.document,
  67. o = t.Object,
  68. l = (function(e) {
  69. var t,
  70. n,
  71. r,
  72. l,
  73. i = /^[A-Z]+[a-z]/,
  74. a = function(e, t) {
  75. (t = t.toLowerCase()) in u ||
  76. ((u[e] = (u[e] || []).concat(t)),
  77. (u[t] = u[t.toUpperCase()] = e));
  78. },
  79. u = (o.create || o)(null),
  80. c = {};
  81. for (n in e)
  82. for (l in e[n])
  83. for (r = e[n][l], u[l] = r, t = 0; t < r.length; t++)
  84. u[r[t].toLowerCase()] = u[r[t].toUpperCase()] = l;
  85. return (
  86. (c.get = function(e) {
  87. return "string" == typeof e
  88. ? u[e] || (i.test(e) ? [] : "")
  89. : (function(e) {
  90. var t,
  91. n = [];
  92. for (t in u) e.test(t) && n.push(t);
  93. return n;
  94. })(e);
  95. }),
  96. (c.set = function(e, t) {
  97. return i.test(e) ? a(e, t) : a(t, e), c;
  98. }),
  99. c
  100. );
  101. })({
  102. collections: {
  103. HTMLAllCollection: ["all"],
  104. HTMLCollection: ["forms"],
  105. HTMLFormControlsCollection: ["elements"],
  106. HTMLOptionsCollection: ["options"]
  107. },
  108. elements: {
  109. Element: ["element"],
  110. HTMLAnchorElement: ["a"],
  111. HTMLAppletElement: ["applet"],
  112. HTMLAreaElement: ["area"],
  113. HTMLAttachmentElement: ["attachment"],
  114. HTMLAudioElement: ["audio"],
  115. HTMLBRElement: ["br"],
  116. HTMLBaseElement: ["base"],
  117. HTMLBodyElement: ["body"],
  118. HTMLButtonElement: ["button"],
  119. HTMLCanvasElement: ["canvas"],
  120. HTMLContentElement: ["content"],
  121. HTMLDListElement: ["dl"],
  122. HTMLDataElement: ["data"],
  123. HTMLDataListElement: ["datalist"],
  124. HTMLDetailsElement: ["details"],
  125. HTMLDialogElement: ["dialog"],
  126. HTMLDirectoryElement: ["dir"],
  127. HTMLDivElement: ["div"],
  128. HTMLDocument: ["document"],
  129. HTMLElement: [
  130. "element",
  131. "abbr",
  132. "address",
  133. "article",
  134. "aside",
  135. "b",
  136. "bdi",
  137. "bdo",
  138. "cite",
  139. "code",
  140. "command",
  141. "dd",
  142. "dfn",
  143. "dt",
  144. "em",
  145. "figcaption",
  146. "figure",
  147. "footer",
  148. "header",
  149. "i",
  150. "kbd",
  151. "mark",
  152. "nav",
  153. "noscript",
  154. "rp",
  155. "rt",
  156. "ruby",
  157. "s",
  158. "samp",
  159. "section",
  160. "small",
  161. "strong",
  162. "sub",
  163. "summary",
  164. "sup",
  165. "u",
  166. "var",
  167. "wbr"
  168. ],
  169. HTMLEmbedElement: ["embed"],
  170. HTMLFieldSetElement: ["fieldset"],
  171. HTMLFontElement: ["font"],
  172. HTMLFormElement: ["form"],
  173. HTMLFrameElement: ["frame"],
  174. HTMLFrameSetElement: ["frameset"],
  175. HTMLHRElement: ["hr"],
  176. HTMLHeadElement: ["head"],
  177. HTMLHeadingElement: ["h1", "h2", "h3", "h4", "h5", "h6"],
  178. HTMLHtmlElement: ["html"],
  179. HTMLIFrameElement: ["iframe"],
  180. HTMLImageElement: ["img"],
  181. HTMLInputElement: ["input"],
  182. HTMLKeygenElement: ["keygen"],
  183. HTMLLIElement: ["li"],
  184. HTMLLabelElement: ["label"],
  185. HTMLLegendElement: ["legend"],
  186. HTMLLinkElement: ["link"],
  187. HTMLMapElement: ["map"],
  188. HTMLMarqueeElement: ["marquee"],
  189. HTMLMediaElement: ["media"],
  190. HTMLMenuElement: ["menu"],
  191. HTMLMenuItemElement: ["menuitem"],
  192. HTMLMetaElement: ["meta"],
  193. HTMLMeterElement: ["meter"],
  194. HTMLModElement: ["del", "ins"],
  195. HTMLOListElement: ["ol"],
  196. HTMLObjectElement: ["object"],
  197. HTMLOptGroupElement: ["optgroup"],
  198. HTMLOptionElement: ["option"],
  199. HTMLOutputElement: ["output"],
  200. HTMLParagraphElement: ["p"],
  201. HTMLParamElement: ["param"],
  202. HTMLPictureElement: ["picture"],
  203. HTMLPreElement: ["pre"],
  204. HTMLProgressElement: ["progress"],
  205. HTMLQuoteElement: ["blockquote", "q", "quote"],
  206. HTMLScriptElement: ["script"],
  207. HTMLSelectElement: ["select"],
  208. HTMLShadowElement: ["shadow"],
  209. HTMLSlotElement: ["slot"],
  210. HTMLSourceElement: ["source"],
  211. HTMLSpanElement: ["span"],
  212. HTMLStyleElement: ["style"],
  213. HTMLTableCaptionElement: ["caption"],
  214. HTMLTableCellElement: ["td", "th"],
  215. HTMLTableColElement: ["col", "colgroup"],
  216. HTMLTableElement: ["table"],
  217. HTMLTableRowElement: ["tr"],
  218. HTMLTableSectionElement: ["thead", "tbody", "tfoot"],
  219. HTMLTemplateElement: ["template"],
  220. HTMLTextAreaElement: ["textarea"],
  221. HTMLTimeElement: ["time"],
  222. HTMLTitleElement: ["title"],
  223. HTMLTrackElement: ["track"],
  224. HTMLUListElement: ["ul"],
  225. HTMLUnknownElement: ["unknown", "vhgroupv", "vkeygen"],
  226. HTMLVideoElement: ["video"]
  227. },
  228. nodes: {
  229. Attr: ["node"],
  230. Audio: ["audio"],
  231. CDATASection: ["node"],
  232. CharacterData: ["node"],
  233. Comment: ["#comment"],
  234. Document: ["#document"],
  235. DocumentFragment: ["#document-fragment"],
  236. DocumentType: ["node"],
  237. HTMLDocument: ["#document"],
  238. Image: ["img"],
  239. Option: ["option"],
  240. ProcessingInstruction: ["node"],
  241. ShadowRoot: ["#shadow-root"],
  242. Text: ["#text"],
  243. XMLDocument: ["xml"]
  244. }
  245. });
  246. "object" !== (void 0 === n ? "undefined" : e(n)) &&
  247. (n = {
  248. type: n || "auto"
  249. });
  250. var i,
  251. a,
  252. u,
  253. c,
  254. s,
  255. m,
  256. f,
  257. p,
  258. d,
  259. h = "registerElement",
  260. L = "__" + h + ((1e5 * t.Math.random()) >> 0),
  261. C = "addEventListener",
  262. v = "attached",
  263. T = "Callback",
  264. M = "detached",
  265. E = "extends",
  266. b = "attributeChanged" + T,
  267. g = v + T,
  268. y = "connected" + T,
  269. H = "disconnected" + T,
  270. w = "created" + T,
  271. A = M + T,
  272. O = "ADDITION",
  273. _ = "REMOVAL",
  274. N = "DOMAttrModified",
  275. S = "DOMContentLoaded",
  276. D = "DOMSubtreeModified",
  277. k = "<",
  278. I = "=",
  279. P = /^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,
  280. F = [
  281. "ANNOTATION-XML",
  282. "COLOR-PROFILE",
  283. "FONT-FACE",
  284. "FONT-FACE-SRC",
  285. "FONT-FACE-URI",
  286. "FONT-FACE-FORMAT",
  287. "FONT-FACE-NAME",
  288. "MISSING-GLYPH"
  289. ],
  290. R = [],
  291. x = [],
  292. V = "",
  293. z = r.documentElement,
  294. U =
  295. R.indexOf ||
  296. function(e) {
  297. for (var t = this.length; t-- && this[t] !== e; );
  298. return t;
  299. },
  300. j = o.prototype,
  301. q = j.hasOwnProperty,
  302. B = j.isPrototypeOf,
  303. Z = o.defineProperty,
  304. G = [],
  305. K = o.getOwnPropertyDescriptor,
  306. X = o.getOwnPropertyNames,
  307. J = o.getPrototypeOf,
  308. Q = o.setPrototypeOf,
  309. W = !!o.__proto__,
  310. Y = "__dreCEv1",
  311. $ = t.customElements,
  312. ee =
  313. !/^force/.test(n.type) && !!($ && $.define && $.get && $.whenDefined),
  314. te = o.create || o,
  315. ne =
  316. t.Map ||
  317. function() {
  318. var e,
  319. t = [],
  320. n = [];
  321. return {
  322. get: function(e) {
  323. return n[U.call(t, e)];
  324. },
  325. set: function(r, o) {
  326. (e = U.call(t, r)) < 0 ? (n[t.push(r) - 1] = o) : (n[e] = o);
  327. }
  328. };
  329. },
  330. re =
  331. t.Promise ||
  332. function(e) {
  333. var t = [],
  334. n = !1,
  335. r = {
  336. catch: function() {
  337. return r;
  338. },
  339. then: function(e) {
  340. return t.push(e), n && setTimeout(o, 1), r;
  341. }
  342. };
  343. function o(e) {
  344. for (n = !0; t.length; ) t.shift()(e);
  345. }
  346. return e(o), r;
  347. },
  348. oe = !1,
  349. le = te(null),
  350. ie = te(null),
  351. ae = new ne(),
  352. ue = function(e) {
  353. return e.toLowerCase();
  354. },
  355. ce =
  356. o.create ||
  357. function e(t) {
  358. return t ? ((e.prototype = t), new e()) : this;
  359. },
  360. se =
  361. Q ||
  362. (W
  363. ? function(e, t) {
  364. return (e.__proto__ = t), e;
  365. }
  366. : X && K
  367. ? (function() {
  368. function e(e, t) {
  369. for (var n, r = X(t), o = 0, l = r.length; o < l; o++)
  370. (n = r[o]), q.call(e, n) || Z(e, n, K(t, n));
  371. }
  372. return function(t, n) {
  373. do {
  374. e(t, n);
  375. } while ((n = J(n)) && !B.call(n, t));
  376. return t;
  377. };
  378. })()
  379. : function(e, t) {
  380. for (var n in t) e[n] = t[n];
  381. return e;
  382. }),
  383. me = t.MutationObserver || t.WebKitMutationObserver,
  384. fe = (t.HTMLElement || t.Element || t.Node).prototype,
  385. pe = !B.call(fe, z),
  386. de = pe
  387. ? function(e, t, n) {
  388. return (e[t] = n.value), e;
  389. }
  390. : Z,
  391. he = pe
  392. ? function(e) {
  393. return 1 === e.nodeType;
  394. }
  395. : function(e) {
  396. return B.call(fe, e);
  397. },
  398. Le = pe && [],
  399. Ce = fe.attachShadow,
  400. ve = fe.cloneNode,
  401. Te = fe.dispatchEvent,
  402. Me = fe.getAttribute,
  403. Ee = fe.hasAttribute,
  404. be = fe.removeAttribute,
  405. ge = fe.setAttribute,
  406. ye = r.createElement,
  407. He = ye,
  408. we = me && {
  409. attributes: !0,
  410. characterData: !0,
  411. attributeOldValue: !0
  412. },
  413. Ae =
  414. me ||
  415. function(e) {
  416. (De = !1), z.removeEventListener(N, Ae);
  417. },
  418. Oe = 0,
  419. _e = h in r && !/^force-all/.test(n.type),
  420. Ne = !0,
  421. Se = !1,
  422. De = !0,
  423. ke = !0,
  424. Ie = !0;
  425. function Pe() {
  426. var e = i.splice(0, i.length);
  427. for (Oe = 0; e.length; ) e.shift().call(null, e.shift());
  428. }
  429. function Fe(e, t) {
  430. for (var n = 0, r = e.length; n < r; n++) Ge(e[n], t);
  431. }
  432. function Re(e) {
  433. return function(t) {
  434. he(t) && (Ge(t, e), V.length && Fe(t.querySelectorAll(V), e));
  435. };
  436. }
  437. function xe(e) {
  438. var t = Me.call(e, "is"),
  439. n = e.nodeName.toUpperCase(),
  440. r = U.call(R, t ? I + t.toUpperCase() : k + n);
  441. return t && -1 < r && !Ve(n, t) ? -1 : r;
  442. }
  443. function Ve(e, t) {
  444. return -1 < V.indexOf(e + '[is="' + t + '"]');
  445. }
  446. function ze(e) {
  447. var t = e.currentTarget,
  448. n = e.attrChange,
  449. r = e.attrName,
  450. o = e.target,
  451. l = e[O] || 2,
  452. i = e[_] || 3;
  453. !Ie ||
  454. (o && o !== t) ||
  455. !t[b] ||
  456. "style" === r ||
  457. (e.prevValue === e.newValue &&
  458. ("" !== e.newValue || (n !== l && n !== i))) ||
  459. t[b](r, n === l ? null : e.prevValue, n === i ? null : e.newValue);
  460. }
  461. function Ue(e) {
  462. var t = Re(e);
  463. return function(e) {
  464. i.push(t, e.target), Oe && clearTimeout(Oe), (Oe = setTimeout(Pe, 1));
  465. };
  466. }
  467. function je(e) {
  468. ke && ((ke = !1), e.currentTarget.removeEventListener(S, je)),
  469. V.length &&
  470. Fe((e.target || r).querySelectorAll(V), e.detail === M ? M : v),
  471. pe &&
  472. (function() {
  473. for (var e, t = 0, n = Le.length; t < n; t++)
  474. (e = Le[t]), z.contains(e) || (n--, Le.splice(t--, 1), Ge(e, M));
  475. })();
  476. }
  477. function qe(e, t) {
  478. ge.call(this, e, t),
  479. a.call(this, {
  480. target: this
  481. });
  482. }
  483. function Be(e, t) {
  484. se(e, t),
  485. s
  486. ? s.observe(e, we)
  487. : (De && ((e.setAttribute = qe), (e[L] = c(e)), e[C](D, a)),
  488. e[C](N, ze)),
  489. e[w] && Ie && ((e.created = !0), e[w](), (e.created = !1));
  490. }
  491. function Ze(e) {
  492. throw new Error("A " + e + " type is already registered");
  493. }
  494. function Ge(e, t) {
  495. var n,
  496. r,
  497. o = xe(e);
  498. -1 < o &&
  499. (f(e, x[o]),
  500. (o = 0),
  501. t !== v || e[v]
  502. ? t !== M ||
  503. e[M] ||
  504. ((e[v] = !1), (e[M] = !0), (r = "disconnected"), (o = 1))
  505. : ((e[M] = !1),
  506. (e[v] = !0),
  507. (r = "connected"),
  508. (o = 1),
  509. pe && U.call(Le, e) < 0 && Le.push(e)),
  510. o && (n = e[t + T] || e[r + T]) && n.call(e));
  511. }
  512. function Ke() {}
  513. function Xe(e, t, n) {
  514. var o = (n && n[E]) || "",
  515. l = t.prototype,
  516. i = ce(l),
  517. a = t.observedAttributes || G,
  518. u = {
  519. prototype: i
  520. };
  521. de(i, w, {
  522. value: function() {
  523. if (oe) oe = !1;
  524. else if (!this[Y]) {
  525. (this[Y] = !0), new t(this), l[w] && l[w].call(this);
  526. var e = le[ae.get(t)];
  527. (!ee || e.create.length > 1) && We(this);
  528. }
  529. }
  530. }),
  531. de(i, b, {
  532. value: function(e) {
  533. -1 < U.call(a, e) && l[b].apply(this, arguments);
  534. }
  535. }),
  536. l[y] &&
  537. de(i, g, {
  538. value: l[y]
  539. }),
  540. l[H] &&
  541. de(i, A, {
  542. value: l[H]
  543. }),
  544. o && (u[E] = o),
  545. (e = e.toUpperCase()),
  546. (le[e] = {
  547. constructor: t,
  548. create: o ? [o, ue(e)] : [e]
  549. }),
  550. ae.set(t, e),
  551. r[h](e.toLowerCase(), u),
  552. Ye(e),
  553. ie[e].r();
  554. }
  555. function Je(e) {
  556. var t = le[e.toUpperCase()];
  557. return t && t.constructor;
  558. }
  559. function Qe(e) {
  560. return "string" == typeof e ? e : (e && e.is) || "";
  561. }
  562. function We(e) {
  563. for (var t, n = e[b], r = n ? e.attributes : G, o = r.length; o--; )
  564. (t = r[o]),
  565. n.call(e, t.name || t.nodeName, null, t.value || t.nodeValue);
  566. }
  567. function Ye(e) {
  568. return (
  569. (e = e.toUpperCase()) in ie ||
  570. ((ie[e] = {}),
  571. (ie[e].p = new re(function(t) {
  572. ie[e].r = t;
  573. }))),
  574. ie[e].p
  575. );
  576. }
  577. function $e() {
  578. $ && delete t.customElements,
  579. Z(t, "customElements", {
  580. configurable: !0,
  581. value: new Ke()
  582. }),
  583. Z(t, "CustomElementRegistry", {
  584. configurable: !0,
  585. value: Ke
  586. });
  587. for (
  588. var e = function(e) {
  589. var n = t[e];
  590. if (n) {
  591. (t[e] = function(e) {
  592. var t, o;
  593. return (
  594. e || (e = this),
  595. e[Y] ||
  596. ((oe = !0),
  597. (t = le[ae.get(e.constructor)]),
  598. ((e = (o = ee && 1 === t.create.length)
  599. ? Reflect.construct(n, G, t.constructor)
  600. : r.createElement.apply(r, t.create))[Y] = !0),
  601. (oe = !1),
  602. o || We(e)),
  603. e
  604. );
  605. }),
  606. (t[e].prototype = n.prototype);
  607. try {
  608. n.prototype.constructor = t[e];
  609. } catch (r) {
  610. Z(n, Y, {
  611. value: t[e]
  612. });
  613. }
  614. }
  615. },
  616. n = l.get(/^HTML[A-Z]*[a-z]/),
  617. o = n.length;
  618. o--;
  619. e(n[o])
  620. );
  621. (r.createElement = function(e, t) {
  622. var n = Qe(t);
  623. return n ? He.call(this, e, ue(n)) : He.call(this, e);
  624. }),
  625. _e || ((Se = !0), r[h](""));
  626. }
  627. if (
  628. (me &&
  629. (((d = r.createElement("div")).innerHTML = "<div><div></div></div>"),
  630. new me(function(e, t) {
  631. if (
  632. e[0] &&
  633. "childList" == e[0].type &&
  634. !e[0].removedNodes[0].childNodes.length
  635. ) {
  636. var n = (d = K(fe, "innerHTML")) && d.set;
  637. n &&
  638. Z(fe, "innerHTML", {
  639. set: function(e) {
  640. for (; this.lastChild; ) this.removeChild(this.lastChild);
  641. n.call(this, e);
  642. }
  643. });
  644. }
  645. t.disconnect(), (d = null);
  646. }).observe(d, {
  647. childList: !0,
  648. subtree: !0
  649. }),
  650. (d.innerHTML = "")),
  651. _e ||
  652. (Q || W
  653. ? ((f = function(e, t) {
  654. B.call(t, e) || Be(e, t);
  655. }),
  656. (p = Be))
  657. : (p = f = function(e, t) {
  658. e[L] || ((e[L] = o(!0)), Be(e, t));
  659. }),
  660. pe
  661. ? ((De = !1),
  662. (function() {
  663. var e = K(fe, C),
  664. t = e.value,
  665. n = function(e) {
  666. var t = new CustomEvent(N, {
  667. bubbles: !0
  668. });
  669. (t.attrName = e),
  670. (t.prevValue = Me.call(this, e)),
  671. (t.newValue = null),
  672. (t[_] = t.attrChange = 2),
  673. be.call(this, e),
  674. Te.call(this, t);
  675. },
  676. r = function(e, t) {
  677. var n = Ee.call(this, e),
  678. r = n && Me.call(this, e),
  679. o = new CustomEvent(N, {
  680. bubbles: !0
  681. });
  682. ge.call(this, e, t),
  683. (o.attrName = e),
  684. (o.prevValue = n ? r : null),
  685. (o.newValue = t),
  686. n
  687. ? (o.MODIFICATION = o.attrChange = 1)
  688. : (o[O] = o.attrChange = 0),
  689. Te.call(this, o);
  690. },
  691. o = function(e) {
  692. var t,
  693. n = e.currentTarget,
  694. r = n[L],
  695. o = e.propertyName;
  696. r.hasOwnProperty(o) &&
  697. ((r = r[o]),
  698. ((t = new CustomEvent(N, {
  699. bubbles: !0
  700. })).attrName = r.name),
  701. (t.prevValue = r.value || null),
  702. (t.newValue = r.value = n[o] || null),
  703. null == t.prevValue
  704. ? (t[O] = t.attrChange = 0)
  705. : (t.MODIFICATION = t.attrChange = 1),
  706. Te.call(n, t));
  707. };
  708. (e.value = function(e, l, i) {
  709. e === N &&
  710. this[b] &&
  711. this.setAttribute !== r &&
  712. ((this[L] = {
  713. className: {
  714. name: "class",
  715. value: this.className
  716. }
  717. }),
  718. (this.setAttribute = r),
  719. (this.removeAttribute = n),
  720. t.call(this, "propertychange", o)),
  721. t.call(this, e, l, i);
  722. }),
  723. Z(fe, C, e);
  724. })())
  725. : me ||
  726. (z[C](N, Ae),
  727. z.setAttribute(L, 1),
  728. z.removeAttribute(L),
  729. De &&
  730. ((a = function(e) {
  731. var t, n, r;
  732. if (this === e.target) {
  733. for (r in ((t = this[L]), (this[L] = n = c(this)), n)) {
  734. if (!(r in t)) return u(0, this, r, t[r], n[r], O);
  735. if (n[r] !== t[r])
  736. return u(1, this, r, t[r], n[r], "MODIFICATION");
  737. }
  738. for (r in t)
  739. if (!(r in n)) return u(2, this, r, t[r], n[r], _);
  740. }
  741. }),
  742. (u = function(e, t, n, r, o, l) {
  743. var i = {
  744. attrChange: e,
  745. currentTarget: t,
  746. attrName: n,
  747. prevValue: r,
  748. newValue: o
  749. };
  750. (i[l] = e), ze(i);
  751. }),
  752. (c = function(e) {
  753. for (
  754. var t, n, r = {}, o = e.attributes, l = 0, i = o.length;
  755. l < i;
  756. l++
  757. )
  758. "setAttribute" !== (n = (t = o[l]).name) && (r[n] = t.value);
  759. return r;
  760. }))),
  761. (r[h] = function(e, t) {
  762. if (
  763. ((n = e.toUpperCase()),
  764. Ne &&
  765. ((Ne = !1),
  766. me
  767. ? ((s = (function(e, t) {
  768. function n(e, t) {
  769. for (var n = 0, r = e.length; n < r; t(e[n++]));
  770. }
  771. return new me(function(r) {
  772. for (var o, l, i, a = 0, u = r.length; a < u; a++)
  773. "childList" === (o = r[a]).type
  774. ? (n(o.addedNodes, e), n(o.removedNodes, t))
  775. : ((l = o.target),
  776. Ie &&
  777. l[b] &&
  778. "style" !== o.attributeName &&
  779. (i = Me.call(l, o.attributeName)) !==
  780. o.oldValue &&
  781. l[b](o.attributeName, o.oldValue, i));
  782. });
  783. })(Re(v), Re(M))),
  784. (m = function(e) {
  785. return (
  786. s.observe(e, {
  787. childList: !0,
  788. subtree: !0
  789. }),
  790. e
  791. );
  792. })(r),
  793. Ce &&
  794. (fe.attachShadow = function() {
  795. return m(Ce.apply(this, arguments));
  796. }))
  797. : ((i = []),
  798. r[C]("DOMNodeInserted", Ue(v)),
  799. r[C]("DOMNodeRemoved", Ue(M))),
  800. r[C](S, je),
  801. r[C]("readystatechange", je),
  802. (fe.cloneNode = function(e) {
  803. var t = ve.call(this, !!e),
  804. n = xe(t);
  805. return (
  806. -1 < n && p(t, x[n]),
  807. e &&
  808. V.length &&
  809. (function(e) {
  810. for (var t, n = 0, r = e.length; n < r; n++)
  811. (t = e[n]), p(t, x[xe(t)]);
  812. })(t.querySelectorAll(V)),
  813. t
  814. );
  815. })),
  816. Se)
  817. )
  818. return (Se = !1);
  819. if (
  820. (-2 < U.call(R, I + n) + U.call(R, k + n) && Ze(e),
  821. !P.test(n) || -1 < U.call(F, n))
  822. )
  823. throw new Error("The type " + e + " is invalid");
  824. var n,
  825. o,
  826. l = function() {
  827. return u ? r.createElement(c, n) : r.createElement(c);
  828. },
  829. a = t || j,
  830. u = q.call(a, E),
  831. c = u ? t[E].toUpperCase() : n;
  832. return (
  833. u && -1 < U.call(R, k + c) && Ze(c),
  834. (o = R.push((u ? I : k) + n) - 1),
  835. (V = V.concat(
  836. V.length ? "," : "",
  837. u ? c + '[is="' + e.toLowerCase() + '"]' : c
  838. )),
  839. (l.prototype = x[o] = q.call(a, "prototype")
  840. ? a.prototype
  841. : ce(fe)),
  842. V.length && Fe(r.querySelectorAll(V), v),
  843. l
  844. );
  845. }),
  846. (r.createElement = He = function(e, t) {
  847. var n = Qe(t),
  848. o = n ? ye.call(r, e, ue(n)) : ye.call(r, e),
  849. l = "" + e,
  850. i = U.call(R, (n ? I : k) + (n || l).toUpperCase()),
  851. a = -1 < i;
  852. return (
  853. n &&
  854. (o.setAttribute("is", (n = n.toLowerCase())),
  855. a && (a = Ve(l.toUpperCase(), n))),
  856. (Ie = !r.createElement.innerHTMLHelper),
  857. a && p(o, x[i]),
  858. o
  859. );
  860. })),
  861. (Ke.prototype = {
  862. constructor: Ke,
  863. define: ee
  864. ? function(e, t, n) {
  865. if (n) Xe(e, t, n);
  866. else {
  867. var r = e.toUpperCase();
  868. (le[r] = {
  869. constructor: t,
  870. create: [r]
  871. }),
  872. ae.set(t, r),
  873. $.define(e, t);
  874. }
  875. }
  876. : Xe,
  877. get: ee
  878. ? function(e) {
  879. return $.get(e) || Je(e);
  880. }
  881. : Je,
  882. whenDefined: ee
  883. ? function(e) {
  884. return re.race([$.whenDefined(e), Ye(e)]);
  885. }
  886. : Ye
  887. }),
  888. !$ || /^force/.test(n.type))
  889. )
  890. $e();
  891. else if (!n.noBuiltIn)
  892. try {
  893. !(function(e, n, o) {
  894. if (
  895. ((n[E] = "a"),
  896. ((e.prototype = ce(HTMLAnchorElement.prototype)).constructor = e),
  897. t.customElements.define(o, e, n),
  898. Me.call(
  899. r.createElement("a", {
  900. is: o
  901. }),
  902. "is"
  903. ) !== o ||
  904. (ee && Me.call(new e(), "is") !== o))
  905. )
  906. throw n;
  907. })(
  908. function e() {
  909. return Reflect.construct(HTMLAnchorElement, [], e);
  910. },
  911. {},
  912. "document-register-element-a"
  913. );
  914. } catch (e) {
  915. $e();
  916. }
  917. if (!n.noBuiltIn)
  918. try {
  919. ye.call(r, "a", "a");
  920. } catch (e) {
  921. ue = function(e) {
  922. return {
  923. is: e.toLowerCase()
  924. };
  925. };
  926. }
  927. })(window);
  928. var l = function(e) {
  929. return e.toLocaleString("en");
  930. },
  931. i = (function(e) {
  932. function l(e) {
  933. var n;
  934. return (
  935. t(this, l),
  936. ((n = o(
  937. this,
  938. (l.__proto__ || Object.getPrototypeOf(l)).call(this, e)
  939. )),
  940. (e = n)).init(),
  941. o(n, e)
  942. );
  943. }
  944. return (
  945. r(l, e),
  946. n(l, [
  947. {
  948. key: "init",
  949. value: function() {}
  950. }
  951. ]),
  952. l
  953. );
  954. })(HTMLElement),
  955. a = (function(e) {
  956. function a() {
  957. return (
  958. t(this, a),
  959. o(
  960. this,
  961. (a.__proto__ || Object.getPrototypeOf(a)).apply(this, arguments)
  962. )
  963. );
  964. }
  965. return (
  966. r(a, i),
  967. n(
  968. a,
  969. [
  970. {
  971. key: "connectedCallback",
  972. value: function() {
  973. var e = this;
  974. if (!this._connected) {
  975. var t;
  976. this.classList.add("loading"),
  977. (this.style.display = "block"),
  978. (this.innerHTML =
  979. '\n <div class="style-root">\n <div class="shockwave"></div>\n <div class="count-container">\n <div class="count"></div>\n </div>\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">\n <g class="flat">\n <path d="M57.0443547 6.86206897C57.6058817 6.46227795 57.7389459 5.67962382 57.3416215 5.11431557 56.9442971 4.54900731 56.1672933 4.41483804 55.6055588 4.81504702L52.4950525 7.030721C51.9335255 7.43051202 51.8004613 8.21316614 52.1977857 8.7784744 52.4404567 9.12371996 52.8251182 9.30825496 53.2153846 9.30825496 53.4640757 9.30825496 53.7152578 9.23343783 53.9338485 9.07753396L57.0443547 6.86206897zM48.8035059 6.1414838C48.94778 6.19623824 49.0959982 6.22215256 49.2415177 6.22215256 49.7455426 6.22215256 50.2198824 5.91201672 50.4075424 5.40898642L51.7485642 1.81818182C51.9906124 1.17011494 51.664906.447021944 51.0209664.203343783 50.3772345-.0405433647 49.6587706.287774295 49.4167224.93584117L48.0757006 4.52664577C47.83386 5.17471264 48.1595664 5.89780564 48.8035059 6.1414838zM58.5931726 11.6219436C58.5846615 11.6219436 58.5761504 11.6219436 58.5674317 11.6219436L54.7579749 11.6541275C54.0702341 11.6681296 53.5240687 12.1985371 53.5379772 12.8909091 53.551678 13.5745037 54.1065621 14.1297806 54.7828855 14.1297806 54.7913966 14.1297806 54.7999077 14.1297806 54.8086265 14.1297806L58.6180833 14.0643678C59.305824 14.0501567 59.8519894 13.4934169 59.838081 12.8010449 59.8243801 12.1174504 59.269496 11.6219436 58.5931726 11.6219436z"/>\n <path d="M37.1910045 6.68944619C37.7313574 6.14566353 38.4431784 5.8737722 39.155207 5.8737722 39.967916 5.8737722 40.7808327 6.22800418 41.3380002 6.93667712 42.2214969 8.06039707 42.0666359 9.69111808 41.0600392 10.7042842L39.777765 11.9949843C39.5801407 12.1276907 39.3877061 12.2695925 39.2075193 12.430303 39.0619998 11.5985371 38.7167801 10.7954023 38.1668781 10.0961338 37.4907623 9.23636364 36.588375 8.62424242 35.5772114 8.31410658L37.1910045 6.68944619zM28.5289586 3.66394984C29.0691039 3.12016719 29.7811325 2.84827586 30.4931611 2.84827586 31.3060777 2.84848485 32.1187868 3.20271682 32.6759543 3.91138976 33.559451 5.03510972 33.40459 6.66562173 32.3979933 7.67878788L17.6760235 22.3467085 17.6276554 20.6499478C17.6149925 19.014629 16.8595779 17.554441 15.6854573 16.5945664L28.5289586 3.66394984zM.624996757 36.9889537C.491717597 36.554099.508245877 35.7327064.906400646 35.2666667L3.45579518 32.2829676C3.45662553 32.2819923 4.33763118 25.8376176 6.09881213 12.9498433 6.09881213 11.4271682 7.33624726 10.1814002 8.84873717 10.1814002 10.3612271 10.1814002 11.5988698 11.4271682 11.5988698 12.9498433L11.6704878 15.4649948C9.18191673 15.8089864 7.24428555 17.9170324 7.14921001 20.492581L4.62804751 38.9475444 3.8946373 39.8060606C3.04504924 39.4926018 2.3776139 39.1458968 1.89233128 38.7659456 1.16440735 38.1960189.758275917 37.4238085.624996757 36.9889537z"/>\n <path d="M49.6070811,36.8942529 L42.4182909,44.1316614 C36.2784454,50.3128527 29.8604313,55.2743992 24.2225349,56.5113898 C24.0512744,56.5492163 23.8901857,56.6217346 23.7511014,56.7293626 L20.5013032,59.2417973 C20.2908084,59.4045977 20.1673015,59.6181154 19.5026647,59.6181154 C18.8380279,59.6181154 13.0160695,55.8303982 10.3595306,53.2846814 C7.96626306,50.9912532 3.77432047,43.9549368 4.44453927,43.0079415 L6.99372621,40.0244514 C6.99469496,40.0233368 7.87570061,33.578962 9.63674317,20.6913271 C9.63674317,19.168652 10.8743859,17.922675 12.3868758,17.922675 C13.8993657,17.922675 15.1368008,19.168652 15.1368008,20.6913271 L15.2667512,25.2522466 C15.2883404,26.0100313 15.907577,26.5034483 16.5519317,26.5034483 C16.8662207,26.5034483 17.1867374,26.3857889 17.4464306,26.1245559 L32.0670972,11.4054336 C32.6074501,10.861442 33.3190635,10.5897597 34.0312997,10.5897597 C34.8440088,10.5897597 35.6569254,10.9439916 36.214093,11.6526646 C37.0975897,12.7763845 36.942521,14.4071055 35.9359243,15.4202717 L25.8641449,25.5598746 C25.3412294,26.0865204 25.3412294,26.9398119 25.8641449,27.4660397 C26.1288202,27.7324974 26.4757006,27.865
  980. ((t = 5), new Array(t).fill(void 0))
  981. .map(function(e) {
  982. return '<g><circle cx="0" cy="0" r="1"/></g>';
  983. })
  984. .join("") +
  985. "\n </g>\n </svg>\n </div>\n "),
  986. (this._styleRootElement = this.querySelector(
  987. ".style-root"
  988. )),
  989. (this._countElement = this.querySelector(".count")),
  990. this._updateRootColor(),
  991. (this._totalClaps = 0);
  992. var n,
  993. r,
  994. o,
  995. i,
  996. a,
  997. u = void 0;
  998. (this._initialClapCount = new Promise(function(e) {
  999. return (u = e);
  1000. })),
  1001. (this._bufferedClaps = 0),
  1002. (this._updateClaps =
  1003. ((n = function() {
  1004. if (e._totalClaps < 10) {
  1005. var t = Math.min(
  1006. e._bufferedClaps,
  1007. 10 - e._totalClaps
  1008. );
  1009. (n = e.api),
  1010. (r = t),
  1011. (o = e.url),
  1012. fetch(
  1013. n + "/update-claps" + (o ? "?url=" + o : ""),
  1014. {
  1015. method: "POST",
  1016. headers: {
  1017. "Content-Type": "text/plain"
  1018. },
  1019. body: JSON.stringify(r + ",3.3.0")
  1020. }
  1021. ).then(function(e) {
  1022. return e.text();
  1023. }),
  1024. (e._totalClaps += t),
  1025. (e._bufferedClaps = 0);
  1026. }
  1027. var n, r, o;
  1028. }),
  1029. (r = 2e3),
  1030. (o = null),
  1031. function() {
  1032. var e = this,
  1033. t = arguments;
  1034. clearTimeout(o),
  1035. (o = setTimeout(function() {
  1036. return n.apply(e, t);
  1037. }, r));
  1038. })),
  1039. this.addEventListener("mousedown", function(t) {
  1040. if (
  1041. 0 === t.button &&
  1042. (e.classList.add("clapped"),
  1043. !e.classList.contains("clap-limit-exceeded"))
  1044. ) {
  1045. var n,
  1046. r,
  1047. o =
  1048. Number(e._countElement.innerHTML.replace(",", "")) +
  1049. 1;
  1050. e.dispatchEvent(
  1051. new CustomEvent("clapped", {
  1052. bubbles: !0,
  1053. detail: {
  1054. clapCount: o
  1055. }
  1056. })
  1057. ),
  1058. (r = "clap"),
  1059. (n = e).classList.remove(r),
  1060. setTimeout(function() {
  1061. n.classList.add(r);
  1062. }, 100),
  1063. setTimeout(function() {
  1064. n.classList.remove(r);
  1065. }, 1e3),
  1066. e._bufferedClaps++,
  1067. e._updateClaps(),
  1068. setTimeout(function() {
  1069. e._countElement.innerHTML = l(o);
  1070. }, 250),
  1071. e.multiclap
  1072. ? e._bufferedClaps + e._totalClaps >= 10 &&
  1073. e.classList.add("clap-limit-exceeded")
  1074. : e.classList.add("clap-limit-exceeded");
  1075. }
  1076. }),
  1077. ((i = this.api),
  1078. (a = this.url),
  1079. fetch(i + "/get-claps" + (a ? "?url=" + a : ""), {
  1080. headers: {
  1081. "Content-Type": "text/plain"
  1082. }
  1083. }).then(function(e) {
  1084. return e.text();
  1085. })).then(function(t) {
  1086. e.classList.remove("loading");
  1087. var n = Number(t);
  1088. u(n), n > 0 && (e._countElement.innerHTML = l(n));
  1089. }),
  1090. (this._connected = !0);
  1091. }
  1092. }
  1093. },
  1094. {
  1095. key: "attributeChangedCallback",
  1096. value: function(e, t, n) {
  1097. this._updateRootColor();
  1098. }
  1099. },
  1100. {
  1101. key: "_updateRootColor",
  1102. value: function() {
  1103. if (this._styleRootElement) {
  1104. var e = this.getAttribute("color") || "green",
  1105. t = this._styleRootElement.style;
  1106. (t.fill = e), (t.stroke = e), (t.color = e);
  1107. }
  1108. }
  1109. },
  1110. {
  1111. key: "initialClapCount",
  1112. get: function() {
  1113. return this._initialClapCount;
  1114. }
  1115. },
  1116. {
  1117. key: "color",
  1118. get: function() {
  1119. return this.getAttribute("color");
  1120. },
  1121. set: function(e) {
  1122. e
  1123. ? this.setAttribute("color", e)
  1124. : this.removeAttribute("color"),
  1125. this._updateRootColor();
  1126. }
  1127. },
  1128. {
  1129. key: "api",
  1130. set: function(e) {
  1131. e ? this.setAttribute("api", e) : this.removeAttribute("api");
  1132. },
  1133. get: function() {
  1134. return (
  1135. this.getAttribute("api") || "https://api.applause-button.com"
  1136. );
  1137. }
  1138. },
  1139. {
  1140. key: "url",
  1141. set: function(e) {
  1142. e ? this.setAttribute("url", e) : this.removeAttribute("url"),
  1143. this._updateRootColor();
  1144. },
  1145. get: function() {
  1146. return this.getAttribute("url");
  1147. }
  1148. },
  1149. {
  1150. key: "multiclap",
  1151. get: function() {
  1152. return "true" === this.getAttribute("multiclap");
  1153. },
  1154. set: function(e) {
  1155. e
  1156. ? this.setAttribute("multiclap", e ? "true" : "false")
  1157. : this.removeAttribute("multiclap");
  1158. }
  1159. }
  1160. ],
  1161. [
  1162. {
  1163. key: "observedAttributes",
  1164. get: function() {
  1165. return ["color"];
  1166. }
  1167. }
  1168. ]
  1169. ),
  1170. a
  1171. );
  1172. })();
  1173. customElements.define("applause-button", a);
  1174. });