chunk-XZ2PVW7M.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // node_modules/.pnpm/min-dom@4.1.0/node_modules/min-dom/dist/index.esm.js
  2. function _mergeNamespaces(n, m) {
  3. m.forEach(function(e) {
  4. e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
  5. if (k !== "default" && !(k in n)) {
  6. var d = Object.getOwnPropertyDescriptor(e, k);
  7. Object.defineProperty(n, k, d.get ? d : {
  8. enumerable: true,
  9. get: function() {
  10. return e[k];
  11. }
  12. });
  13. }
  14. });
  15. });
  16. return Object.freeze(n);
  17. }
  18. var nativeToString = Object.prototype.toString;
  19. var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
  20. function isUndefined(obj) {
  21. return obj === void 0;
  22. }
  23. function isArray(obj) {
  24. return nativeToString.call(obj) === "[object Array]";
  25. }
  26. function has(target, key) {
  27. return nativeHasOwnProperty.call(target, key);
  28. }
  29. function forEach(collection, iterator) {
  30. let val, result;
  31. if (isUndefined(collection)) {
  32. return;
  33. }
  34. const convertKey = isArray(collection) ? toNum : identity;
  35. for (let key in collection) {
  36. if (has(collection, key)) {
  37. val = collection[key];
  38. result = iterator(val, convertKey(key));
  39. if (result === false) {
  40. return val;
  41. }
  42. }
  43. }
  44. }
  45. function identity(arg) {
  46. return arg;
  47. }
  48. function toNum(arg) {
  49. return Number(arg);
  50. }
  51. function assign(element, ...styleSources) {
  52. const target = element.style;
  53. forEach(styleSources, function(style) {
  54. if (!style) {
  55. return;
  56. }
  57. forEach(style, function(value, key) {
  58. target[key] = value;
  59. });
  60. });
  61. return element;
  62. }
  63. function attr(el, name, val) {
  64. if (arguments.length == 2) {
  65. return el.getAttribute(name);
  66. }
  67. if (val === null) {
  68. return el.removeAttribute(name);
  69. }
  70. el.setAttribute(name, val);
  71. return el;
  72. }
  73. var toString = Object.prototype.toString;
  74. function classes(el) {
  75. return new ClassList(el);
  76. }
  77. function ClassList(el) {
  78. if (!el || !el.nodeType) {
  79. throw new Error("A DOM element reference is required");
  80. }
  81. this.el = el;
  82. this.list = el.classList;
  83. }
  84. ClassList.prototype.add = function(name) {
  85. this.list.add(name);
  86. return this;
  87. };
  88. ClassList.prototype.remove = function(name) {
  89. if ("[object RegExp]" == toString.call(name)) {
  90. return this.removeMatching(name);
  91. }
  92. this.list.remove(name);
  93. return this;
  94. };
  95. ClassList.prototype.removeMatching = function(re) {
  96. const arr = this.array();
  97. for (let i = 0; i < arr.length; i++) {
  98. if (re.test(arr[i])) {
  99. this.remove(arr[i]);
  100. }
  101. }
  102. return this;
  103. };
  104. ClassList.prototype.toggle = function(name, force) {
  105. if ("undefined" !== typeof force) {
  106. if (force !== this.list.toggle(name, force)) {
  107. this.list.toggle(name);
  108. }
  109. } else {
  110. this.list.toggle(name);
  111. }
  112. return this;
  113. };
  114. ClassList.prototype.array = function() {
  115. return Array.from(this.list);
  116. };
  117. ClassList.prototype.has = ClassList.prototype.contains = function(name) {
  118. return this.list.contains(name);
  119. };
  120. function clear(el) {
  121. var c;
  122. while (el.childNodes.length) {
  123. c = el.childNodes[0];
  124. el.removeChild(c);
  125. }
  126. return el;
  127. }
  128. function matches(element, selector) {
  129. return element && typeof element.matches === "function" && element.matches(selector);
  130. }
  131. function closest(element, selector, checkYourSelf) {
  132. var currentElem = checkYourSelf ? element : element.parentNode;
  133. while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
  134. if (matches(currentElem, selector)) {
  135. return currentElem;
  136. }
  137. currentElem = currentElem.parentNode;
  138. }
  139. return matches(currentElem, selector) ? currentElem : null;
  140. }
  141. var componentEvent = {};
  142. var bind$1;
  143. var unbind$1;
  144. var prefix;
  145. function detect() {
  146. bind$1 = window.addEventListener ? "addEventListener" : "attachEvent";
  147. unbind$1 = window.removeEventListener ? "removeEventListener" : "detachEvent";
  148. prefix = bind$1 !== "addEventListener" ? "on" : "";
  149. }
  150. var bind_1 = componentEvent.bind = function(el, type, fn, capture) {
  151. if (!bind$1)
  152. detect();
  153. el[bind$1](prefix + type, fn, capture || false);
  154. return fn;
  155. };
  156. var unbind_1 = componentEvent.unbind = function(el, type, fn, capture) {
  157. if (!unbind$1)
  158. detect();
  159. el[unbind$1](prefix + type, fn, capture || false);
  160. return fn;
  161. };
  162. var event = _mergeNamespaces({
  163. __proto__: null,
  164. bind: bind_1,
  165. unbind: unbind_1,
  166. "default": componentEvent
  167. }, [componentEvent]);
  168. var forceCaptureEvents = ["focus", "blur"];
  169. function bind(el, selector, type, fn, capture) {
  170. if (forceCaptureEvents.indexOf(type) !== -1) {
  171. capture = true;
  172. }
  173. return event.bind(el, type, function(e) {
  174. var target = e.target || e.srcElement;
  175. e.delegateTarget = closest(target, selector, true);
  176. if (e.delegateTarget) {
  177. fn.call(el, e);
  178. }
  179. }, capture);
  180. }
  181. function unbind(el, type, fn, capture) {
  182. if (forceCaptureEvents.indexOf(type) !== -1) {
  183. capture = true;
  184. }
  185. return event.unbind(el, type, fn, capture);
  186. }
  187. var delegate = {
  188. bind,
  189. unbind
  190. };
  191. var domify = parse;
  192. var innerHTMLBug = false;
  193. var bugTestDiv;
  194. if (typeof document !== "undefined") {
  195. bugTestDiv = document.createElement("div");
  196. bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
  197. innerHTMLBug = !bugTestDiv.getElementsByTagName("link").length;
  198. bugTestDiv = void 0;
  199. }
  200. var map = {
  201. legend: [1, "<fieldset>", "</fieldset>"],
  202. tr: [2, "<table><tbody>", "</tbody></table>"],
  203. col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
  204. // for script/link/style tags to work in IE6-8, you have to wrap
  205. // in a div with a non-whitespace character in front, ha!
  206. _default: innerHTMLBug ? [1, "X<div>", "</div>"] : [0, "", ""]
  207. };
  208. map.td = map.th = [3, "<table><tbody><tr>", "</tr></tbody></table>"];
  209. map.option = map.optgroup = [1, '<select multiple="multiple">', "</select>"];
  210. map.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, "<table>", "</table>"];
  211. map.polyline = map.ellipse = map.polygon = map.circle = map.text = map.line = map.path = map.rect = map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', "</svg>"];
  212. function parse(html, doc) {
  213. if ("string" != typeof html)
  214. throw new TypeError("String expected");
  215. if (!doc)
  216. doc = document;
  217. var m = /<([\w:]+)/.exec(html);
  218. if (!m)
  219. return doc.createTextNode(html);
  220. html = html.replace(/^\s+|\s+$/g, "");
  221. var tag = m[1];
  222. if (tag == "body") {
  223. var el = doc.createElement("html");
  224. el.innerHTML = html;
  225. return el.removeChild(el.lastChild);
  226. }
  227. var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
  228. var depth = wrap[0];
  229. var prefix2 = wrap[1];
  230. var suffix = wrap[2];
  231. var el = doc.createElement("div");
  232. el.innerHTML = prefix2 + html + suffix;
  233. while (depth--)
  234. el = el.lastChild;
  235. if (el.firstChild == el.lastChild) {
  236. return el.removeChild(el.firstChild);
  237. }
  238. var fragment = doc.createDocumentFragment();
  239. while (el.firstChild) {
  240. fragment.appendChild(el.removeChild(el.firstChild));
  241. }
  242. return fragment;
  243. }
  244. var domify$1 = domify;
  245. function query(selector, el) {
  246. el = el || document;
  247. return el.querySelector(selector);
  248. }
  249. function all(selector, el) {
  250. el = el || document;
  251. return el.querySelectorAll(selector);
  252. }
  253. function remove(el) {
  254. el.parentNode && el.parentNode.removeChild(el);
  255. }
  256. export {
  257. assign,
  258. attr,
  259. classes,
  260. clear,
  261. matches,
  262. closest,
  263. event,
  264. delegate,
  265. domify$1,
  266. query,
  267. all,
  268. remove
  269. };
  270. //# sourceMappingURL=chunk-XZ2PVW7M.js.map