1!(function (t, n) { 2 "object" == typeof exports && "undefined" != typeof module 3 ? (module.exports = n()) 4 : "function" == typeof define && define.amd 5 ? define(n) 6 : (t.Macy = n()); 7})(this, function () { 8 "use strict"; 9 function t(t, n) { 10 var e = void 0; 11 return function () { 12 e && clearTimeout(e), (e = setTimeout(t, n)); 13 }; 14 } 15 function n(t, n) { 16 for (var e = t.length, r = e, o = []; e--; ) o.push(n(t[r - e - 1])); 17 return o; 18 } 19 function e(t, n) { 20 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 21 if (window.Promise) return A(t, n, e); 22 t.recalculate(!0, !0); 23 } 24 function r(t) { 25 for ( 26 var n = t.options, 27 e = t.responsiveOptions, 28 r = t.keys, 29 o = t.docWidth, 30 i = void 0, 31 s = 0; 32 s < r.length; 33 s++ 34 ) { 35 var a = parseInt(r[s], 10); 36 o >= a && ((i = n.breakAt[a]), O(i, e)); 37 } 38 return e; 39 } 40 function o(t) { 41 for ( 42 var n = t.options, 43 e = t.responsiveOptions, 44 r = t.keys, 45 o = t.docWidth, 46 i = void 0, 47 s = r.length - 1; 48 s >= 0; 49 s-- 50 ) { 51 var a = parseInt(r[s], 10); 52 o <= a && ((i = n.breakAt[a]), O(i, e)); 53 } 54 return e; 55 } 56 function i(t) { 57 var n = t.useContainerForBreakpoints 58 ? t.container.clientWidth 59 : window.innerWidth, 60 e = { columns: t.columns }; 61 b(t.margin) 62 ? (e.margin = { x: t.margin.x, y: t.margin.y }) 63 : (e.margin = { x: t.margin, y: t.margin }); 64 var i = Object.keys(t.breakAt); 65 return t.mobileFirst 66 ? r({ options: t, responsiveOptions: e, keys: i, docWidth: n }) 67 : o({ options: t, responsiveOptions: e, keys: i, docWidth: n }); 68 } 69 function s(t) { 70 return i(t).columns; 71 } 72 function a(t) { 73 return i(t).margin; 74 } 75 function c(t) { 76 var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], 77 e = s(t), 78 r = a(t).x, 79 o = 100 / e; 80 if (!n) return o; 81 if (1 === e) return "100%"; 82 var i = "px"; 83 if ("string" == typeof r) { 84 var c = parseFloat(r); 85 (i = r.replace(c, "")), (r = c); 86 } 87 return ( 88 (r = ((e - 1) * r) / e), 89 "%" === i ? o - r + "%" : "calc(" + o + "% - " + r + i + ")" 90 ); 91 } 92 function u(t, n) { 93 var e = s(t.options), 94 r = 0, 95 o = void 0, 96 i = void 0; 97 if (1 === ++n) return 0; 98 i = a(t.options).x; 99 var u = "px"; 100 if ("string" == typeof i) { 101 var l = parseFloat(i, 10); 102 (u = i.replace(l, "")), (i = l); 103 } 104 return ( 105 (o = (i - ((e - 1) * i) / e) * (n - 1)), 106 (r += c(t.options, !1) * (n - 1)), 107 "%" === u ? r + o + "%" : "calc(" + r + "% + " + o + u + ")" 108 ); 109 } 110 function l(t) { 111 var n = 0, 112 e = t.container, 113 r = t.rows; 114 v(r, function (t) { 115 n = t > n ? t : n; 116 }), 117 (e.style.height = n + "px"); 118 } 119 function p(t, n) { 120 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], 121 r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], 122 o = s(t.options), 123 i = a(t.options).y; 124 M(t, o, e), 125 v(n, function (n) { 126 var e = 0, 127 o = parseInt(n.offsetHeight, 10); 128 isNaN(o) || 129 (t.rows.forEach(function (n, r) { 130 n < t.rows[e] && (e = r); 131 }), 132 (n.style.position = "absolute"), 133 (n.style.top = t.rows[e] + "px"), 134 (n.style.left = "" + t.cols[e]), 135 (t.rows[e] += isNaN(o) ? 0 : o + i), 136 r && (n.dataset.macyComplete = 1)); 137 }), 138 r && (t.tmpRows = null),
139 l(t); 140 } 141 function f(t, n) { 142 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], 143 r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], 144 o = s(t.options), 145 i = a(t.options).y; 146 M(t, o, e), 147 v(n, function (n) { 148 t.lastcol === o && (t.lastcol = 0); 149 var e = C(n, "height"); 150 (e = parseInt(n.offsetHeight, 10)), 151 isNaN(e) || 152 ((n.style.position = "absolute"), 153 (n.style.top = t.rows[t.lastcol] + "px"), 154 (n.style.left = "" + t.cols[t.lastcol]), 155 (t.rows[t.lastcol] += isNaN(e) ? 0 : e + i), 156 (t.lastcol += 1), 157 r && (n.dataset.macyComplete = 1)); 158 }), 159 r && (t.tmpRows = null), 160 l(t); 161 } 162 var h = function t(n, e) { 163 if (!(this instanceof t)) return new t(n, e); 164 if (n && n.nodeName) return n; 165 if (((n = n.replace(/^\s*/, "").replace(/\s*$/, "")), e)) 166 return this.byCss(n, e); 167 for (var r in this.selectors) 168 if (((e = r.split("/")), new RegExp(e[1], e[2]).test(n))) 169 return this.selectors[r](n); 170 return this.byCss(n); 171 }; 172 (h.prototype.byCss = function (t, n) { 173 return (n || document).querySelectorAll(t); 174 }), 175 (h.prototype.selectors = {}), 176 (h.prototype.selectors[/^\.[\w\-]+$/] = function (t) { 177 return document.getElementsByClassName(t.substring(1)); 178 }), 179 (h.prototype.selectors[/^\w+$/] = function (t) { 180 return document.getElementsByTagName(t); 181 }), 182 (h.prototype.selectors[/^\#[\w\-]+$/] = function (t) { 183 return document.getElementById(t.substring(1)); 184 }); 185 var v = function (t, n) { 186 for (var e = t.length, r = e; e--; ) n(t[r - e - 1]); 187 }, 188 m = function () { 189 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 190 (this.running = !1), (this.events = []), this.add(t); 191 }; 192 (m.prototype.run = function () { 193 if (!this.running && this.events.length > 0) { 194 var t = this.events.shift(); 195 (this.running = !0), t(), (this.running = !1), this.run(); 196 } 197 }), 198 (m.prototype.add = function () { 199 var t = this, 200 n = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 201 return ( 202 !!n && 203 (Array.isArray(n) 204 ? v(n, function (n) { 205 return t.add(n); 206 }) 207 : (this.events.push(n), void this.run())) 208 ); 209 }), 210 (m.prototype.clear = function () { 211 this.events = []; 212 }); 213 var d = function (t) { 214 var n = 215 arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 216 return (this.instance = t), (this.data = n), this; 217 }, 218 y = function () { 219 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 220 (this.events = {}), (this.instance = t); 221 }; 222 (y.prototype.on = function () { 223 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 224 n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; 225 return ( 226 !(!t || !n) && 227 (Array.isArray(this.events[t]) || (this.events[t] = []), 228 this.events[t].push(n)) 229 ); 230 }), 231 (y.prototype.emit = function () { 232 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 233 n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 234 if (!t || !Array.isArray(this.events[t])) return !1; 235 var e = new d(this.instance, n); 236 v(this.events[t], function (t) { 237 return t(e); 238 }); 239 }); 240 var g = function (t) { 241 return ( 242 !("naturalHeight" in t && t.naturalHeight + t.naturalWidth === 0) || 243 t.width + t.height !== 0 244 ); 245 }, 246 E = function (t, n) { 247 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 248 return new Promise(function (t, e) { 249 if (n.complete) return g(n) ? t(n) : e(n); 250 n.addEventListener("load", function () { 251 return g(n) ? t(n) : e(n); 252 }), 253 n.addEventListener("error", function () { 254 return e(n); 255 }); 256 }) 257 .then(function (n) { 258 e && t.emit(t.constants.EVENT_IMAGE_LOAD, { img: n }); 259 }) 260 .catch(function (n) { 261 return t.emit(t.constants.EVENT_IMAGE_ERROR, { img: n }); 262 }); 263 }, 264 w = function (t, e) { 265 var r = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 266 return n(e, function (n) { 267 return E(t, n, r); 268 }); 269 }, 270 A = function (t, n) { 271 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 272 return Promise.all(w(t, n, e)).then(function () { 273 t.emit(t.constants.EVENT_IMAGE_COMPLETE); 274 }); 275 }, 276 I = function (n) { 277 return t(function () { 278 n.emit(n.constants.EVENT_RESIZE), 279 n.queue.add(function () { 280 return n.recalculate(!0, !0); 281 }); 282 }, 100); 283 }, 284 N = function (t) { 285 if ( 286 ((t.container = h(t.options.container)), 287 t.container instanceof h || !t.container) 288 ) 289 return !!t.options.debug && console.error("Error: Container not found"); 290 t.container.length && (t.container = t.container[0]), 291 (t.options.container = t.container), 292 (t.container.style.position = "relative"); 293 }, 294 T = function (t) { 295 (t.queue = new m()), 296 (t.events = new y(t)), 297 (t.rows = []), 298 (t.resizer = I(t)); 299 }, 300 L = function (t) { 301 var n = h("img", t.container); 302 window.addEventListener("resize", t.resizer), 303 t.on(t.constants.EVENT_IMAGE_LOAD, function () { 304 return t.recalculate(!1, !1); 305 }), 306 t.on(t.constants.EVENT_IMAGE_COMPLETE, function () { 307 return t.recalculate(!0, !0); 308 }), 309 t.options.useOwnImageLoader || e(t, n, !t.options.waitForImages), 310 t.emit(t.constants.EVENT_INITIALIZED); 311 }, 312 _ = function (t) { 313 N(t), T(t), L(t); 314 }, 315 b = function (t) { 316 return ( 317 t === Object(t) && 318 "[object Array]" !== Object.prototype.toString.call(t) 319 ); 320 }, 321 O = function (t, n) { 322 b(t) || (n.columns = t), 323 b(t) && t.columns && (n.columns = t.columns), 324 b(t) && 325 t.margin && 326 !b(t.margin) && 327 (n.margin = { x: t.margin, y: t.margin }), 328 b(t) && 329 t.margin && 330 b(t.margin) && 331 t.margin.x && 332 (n.margin.x = t.margin.x), 333 b(t) && 334 t.margin && 335 b(t.margin) && 336 t.margin.y && 337 (n.margin.y = t.margin.y); 338 }, 339 C = function (t, n) { 340 return window.getComputedStyle(t, null).getPropertyValue(n); 341 }, 342 M = function (t, n) { 343 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 344 if ((t.lastcol || (t.lastcol = 0), t.rows.length < 1 && (e = !0), e)) { 345 (t.rows = []), (t.cols = []), (t.lastcol = 0); 346 for (var r = n - 1; r >= 0; r--) (t.rows[r] = 0), (t.cols[r] = u(t, r)); 347 } else if (t.tmpRows) { 348 t.rows = []; 349 for (var r = n - 1; r >= 0; r--) t.rows[r] = t.tmpRows[r]; 350 } else { 351 t.tmpRows = []; 352 for (var r = n - 1; r >= 0; r--) t.tmpRows[r] = t.rows[r]; 353 } 354 }, 355 V = function (t) { 356 var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], 357 e = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], 358 r = n 359 ? t.container.children 360 : h(':scope > *:not([data-macy-complete="1"])', t.container); 361 r = Array.from(r).filter(function (t) { 362 return null !== t.offsetParent; 363 }); 364 var o = c(t.options); 365 return ( 366 v(r, function (t) { 367 n && (t.dataset.macyComplete = 0), (t.style.width = o); 368 }), 369 t.options.trueOrder 370 ? (f(t, r, n, e), t.emit(t.constants.EVENT_RECALCULATED)) 371 : (p(t, r, n, e), t.emit(t.constants.EVENT_RECALCULATED)) 372 ); 373 }, 374 R = function () { 375 return !!window.Promise; 376 }, 377 x = 378 Object.assign || 379 function (t) { 380 for (var n = 1; n < arguments.length; n++) { 381 var e = arguments[n]; 382 for (var r in e) 383 Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); 384 } 385 return t; 386 }; 387 Array.from || 388 (Array.from = function (t) { 389 for (var n = 0, e = []; n < t.length; ) e.push(t[n++]); 390 return e; 391 }); 392 var k = { 393 columns: 4, 394 margin: 2, 395 trueOrder: !1, 396 waitForImages: !1, 397 useImageLoader: !0, 398 breakAt: {}, 399 useOwnImageLoader: !1, 400 onInit: !1, 401 cancelLegacy: !1, 402 useContainerForBreakpoints: !1, 403 }; 404 !(function () { 405 try { 406 document.createElement("a").querySelector(":scope *"); 407 } catch (t) { 408 !(function () { 409 function t(t) { 410 return function (e) { 411 if (e && n.test(e)) { 412 var r = this.getAttribute("id"); 413 r || (this.id = "q" + Math.floor(9e6 * Math.random()) + 1e6), 414 (arguments[0] = e.replace(n, "#" + this.id)); 415 var o = t.apply(this, arguments); 416 return ( 417 null === r ? this.removeAttribute("id") : r || (this.id = r), o 418 ); 419 } 420 return t.apply(this, arguments); 421 }; 422 } 423 var n = /:scope\b/gi, 424 e = t(Element.prototype.querySelector); 425 Element.prototype.querySelector = function (t) { 426 return e.apply(this, arguments); 427 }; 428 var r = t(Element.prototype.querySelectorAll); 429 Element.prototype.querySelectorAll = function (t) { 430 return r.apply(this, arguments); 431 }; 432 })(); 433 } 434 })(); 435 var q = function t() { 436 var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : k; 437 if (!(this instanceof t)) return new t(n); 438 (this.options = {}), 439 x(this.options, k, n), 440 (this.options.cancelLegacy && !R()) || _(this); 441 }; 442 return ( 443 (q.init = function (t) { 444 return ( 445 console.warn( 446 "Depreciated: Macy.init will be removed in v3.0.0 opt to use Macy directly like so Macy({ /*options here*/ }) " 447 ), 448 new q(t) 449 ); 450 }), 451 (q.prototype.recalculateOnImageLoad = function () { 452 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 453 return e(this, h("img", this.container), !t); 454 }), 455 (q.prototype.runOnImageLoad = function (t) { 456 var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], 457 r = h("img", this.container); 458 return ( 459 this.on(this.constants.EVENT_IMAGE_COMPLETE, t), 460 n && this.on(this.constants.EVENT_IMAGE_LOAD, t), 461 e(this, r, n) 462 ); 463 }), 464 (q.prototype.recalculate = function () { 465 var t = this, 466 n = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 467 e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; 468 return ( 469 e && this.queue.clear(), 470 this.queue.add(function () { 471 return V(t, n, e); 472 }) 473 ); 474 }), 475 (q.prototype.remove = function () { 476 window.removeEventListener("resize", this.resizer), 477 v(this.container.children, function (t) { 478 t.removeAttribute("data-macy-complete"), t.removeAttribute("style"); 479 }), 480 this.container.removeAttribute("style"); 481 }), 482 (q.prototype.reInit = function () { 483 this.recalculate(!0, !0),
484 this.emit(this.constants.EVENT_INITIALIZED), 485 window.addEventListener("resize", this.resizer), 486 (this.container.style.position = "relative"); 487 }), 488 (q.prototype.on = function (t, n) { 489 this.events.on(t, n); 490 }), 491 (q.prototype.emit = function (t, n) { 492 this.events.emit(t, n); 493 }), 494 (q.constants = { 495 EVENT_INITIALIZED: "macy.initialized", 496 EVENT_RECALCULATED: "macy.recalculated", 497 EVENT_IMAGE_LOAD: "macy.image.load", 498 EVENT_IMAGE_ERROR: "macy.image.error", 499 EVENT_IMAGE_COMPLETE: "macy.images.complete", 500 EVENT_RESIZE: "macy.resize", 501 }), 502 (q.prototype.constants = q.constants), 503 q 504 ); 505});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.