1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 1430: 5/***/ (function(module, exports) { 6 7var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(function(root, factory) { 8 true ? ( 9 // AMD. Register as an anonymous module unless amdModuleId is set 10 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 11 return root.svg4everybody = factory(); 12 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 13 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) 14 ) : 0; 15})(this, function() { 16 /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */ 17 function embed(parent, svg, target) { 18 if (target) { 19 var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox"); 20 viewBox && svg.setAttribute("viewBox", viewBox); 21 for (var clone = target.cloneNode(true); clone.childNodes.length; ) { 22 fragment.appendChild(clone.firstChild); 23 } 24 parent.appendChild(fragment); 25 } 26 } 27 function loadreadystatechange(xhr) { 28 xhr.onreadystatechange = function() { 29 if (4 === xhr.readyState) { 30 var cachedDocument = xhr._cachedDocument; 31 cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""), cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item 32 xhr._embeds.splice(0).map(function(item) { 33 var target = xhr._cachedTarget[item.id]; 34 target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), // embed the target into the svg 35 embed(item.parent, item.svg, target); 36 }); 37 } 38 }, // test the ready state change immediately 39 xhr.onreadystatechange(); 40 } 41 function svg4everybody(rawopts) { 42 function oninterval() { 43 for (var index = 0; index < uses.length; ) { 44 var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href"); 45 if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), svg && src) { 46 if (polyfill) { 47 if (!opts.validate || opts.validate(src, svg, use)) { 48 parent.removeChild(use); 49 var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#"); 50 if (url.length) { 51 var xhr = requests[url]; 52 xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), xhr._embeds = []), // add the svg and id as an item to the xhr embeds list 53 xhr._embeds.push({ 54 parent, 55 svg, 56 id 57 }), // prepare the xhr ready state change event 58 loadreadystatechange(xhr); 59 } else { 60 embed(parent, svg, document.getElementById(id)); 61 } 62 } else { 63 ++index, ++numberOfSvgUseElementsToBypass; 64 } 65 } 66 } else { 67 ++index; 68 } 69 } 70 (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67); 71 } 72 var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self; 73 polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe; 74 var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0; 75 polyfill && oninterval(); 76 } 77 function getSVGAncestor(node) { 78 for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) { 79 } 80 return svg; 81 } 82 return svg4everybody; 83}); 84 85 86/***/ }), 87 88/***/ 9645: 89/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 90 91"use strict"; 92/* harmony export */ __webpack_require__.d(__webpack_exports__, { 93/* harmony export */ Jt: () => (/* binding */ get), 94/* harmony export */ hQ: () => (/* binding */ handleJson) 95/* harmony export */ }); 96/* unused harmony exports post, put, del, timeoutPromise, reloadOn401, defaultErrorHandler, handleWithoutBody */ 97/* harmony import */ var whatwg_fetch_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32868); 98/* harmony import */ var whatwg_fetch_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(whatwg_fetch_fetch__WEBPACK_IMPORTED_MODULE_0__); 99/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(88386); 100/* harmony import */ var _Admin_Common_api_helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(91737); 101 102 103 104function post(path, data, headers) { 105 return fetch("/api" + path, { 106 method: "POST", 107 headers: addInternalHeaders(headers), 108 credentials: "same-origin", 109 body: JSON.stringify(data) 110 }); 111} 112function put(path, data, headers) { 113 return fetch("/api" + path, { 114 method: "PUT", 115 headers: addInternalHeaders(headers), 116 credentials: "same-origin", 117 body: JSON.stringify(data) 118 }); 119} 120function get(path, data, headers) { 121 return fetch("/api" + path, { 122 method: "GET", 123 headers: (0,_Admin_Common_api_helper__WEBPACK_IMPORTED_MODULE_2__/* .addInternalHeaders */ .J)(headers), 124 credentials: "same-origin" 125 }); 126} 127function del(path, data, headers) { 128 if (!headers) { 129 headers = {}; 130 } 131 return fetch("/api" + path, { 132 method: "DELETE", 133 headers: addInternalHeaders(headers), 134 credentials: "same-origin", 135 body: JSON.stringify(data) 136 }); 137} 138function handleJson(response) { 139 if (response.ok) { 140 return response.json(); 141 } else { 142 if (isJson(response.headers.get("Content-Type"))) { 143 return handleJsonError(response); 144 } 145 const errorInfo = responseDetails(response); 146 return Promise.reject(errorInfo); 147 } 148} 149function handleWithoutBody(response) { 150 if (response.ok) { 151 return Promise.resolve(response); 152 } else { 153 if (isJson(response.headers.get("Content-Type"))) { 154 return handleJsonError(response); 155 } 156 const errorInfo = responseDetails(response); 157 return Promise.reject(errorInfo); 158 } 159} 160function handleJsonError(response) { 161 const errorInfo = responseDetails(response); 162 return new Promise((resolve, reject) => { 163 response.json().then((data) => reject(Object.assign({}, { 164 errorType: "server", 165 data, 166 // for backward compatibility 167 httpStatus: errorInfo.status 168 }, errorInfo))).catch((error) => reject(Object.assign({}, { 169 errorType: "server", 170 data: error, 171 // for backward compatibility 172 httpStatus: errorInfo.status 173 }, errorInfo))); 174 }); 175} 176function timeoutPromise(r, timeout = 500) { 177 return new Promise(() => { 178 setTimeout(() => { 179 r(); 180 }, timeout); 181 }); 182} 183function reloadOn401(response) { 184 if (response.status == 401) { 185 window.location.reload(); 186 const errorInfo = responseDetails(response); 187 return Promise.reject(errorInfo); 188 } 189 return Promise.resolve(response); 190} 191function responseDetails(response) { 192 return { 193 url: response.url, 194 status: response.status, 195 statusText: response.statusText 196 }; 197} 198function defaultErrorHandler(error) { 199 if (error.status == 401) { 200 return; 201 } 202 if (error.data) { 203 console.error(error.data); 204 } 205 let dumpResponse = ""; 206 try { 207 dumpResponse = JSON.stringify(error, null, 2); 208 } catch (e) { 209 dumpResponse = "Can't parse error data to JSON."; 210 } 211 logger.error(dumpResponse); 212} 213const JSON_TYPE = "application/json"; 214function isJson(type) { 215 return (type || "").startsWith(JSON_TYPE); 216} 217 218 219 220/***/ }), 221 222/***/ 21957: 223/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 224 225"use strict"; 226/* harmony export */ __webpack_require__.d(__webpack_exports__, { 227/* harmony export */ IF: () => (/* binding */ getFlashSaleData), 228/* harmony export */ Jn: () => (/* binding */ formatCalculatedTime), 229/* harmony export */ Ye: () => (/* binding */ calculateTime), 230/* harmony export */ to: () => (/* binding */ getFlashSaleTimerData) 231/* harmony export */ }); 232/* harmony import */ var _common_api_helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9645); 233/* harmony import */ var _common_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47578); 234 235 236let fetchFlashSaleDataPromise; 237const getFlashSaleTimerData = (remainingTime) => { 238 const currentTime = (/* @__PURE__ */ new Date()).getTime(); 239 const finishTime = currentTime + remainingTime; 240 return { 241 currentTime, 242 finishTime 243 }; 244}; 245const getFlashSaleData = () => { 246 if (!fetchFlashSaleDataPromise) { 247 fetchFlashSaleDataPromise = (0,_common_api_helper__WEBPACK_IMPORTED_MODULE_0__/* .get */ .Jt)("/v1/fulmvendo").then(_common_api_helper__WEBPACK_IMPORTED_MODULE_0__/* .handleJson */ .hQ).c
247atch((error) => { 248 throw Error("Error while fetching FlashSale", { cause: error }); 249 }); 250 } 251 return fetchFlashSaleDataPromise; 252}; 253const calculateTime = (finishTime, currentTime) => { 254 const diffInMillis = finishTime - currentTime; 255 if (diffInMillis < 0) { 256 return { 257 days: 0, 258 hours: 0, 259 minutes: 0, 260 seconds: 0 261 }; 262 } 263 const secondsToDeadline = diffInMillis / 1e3; 264 let hours = Math.floor(secondsToDeadline / 3600); 265 const secondsInHour = secondsToDeadline - hours * 3600; 266 const minutes = Math.floor(secondsInHour / 60); 267 const seconds = Math.floor(secondsInHour % 60); 268 let days = 0; 269 if (hours > 48) { 270 days = Math.floor(hours / 24); 271 hours = hours - days * 24; 272 } 273 return { 274 days, 275 hours, 276 minutes, 277 seconds 278 }; 279}; 280const formatTime = (unit) => `0${unit}`.slice(-2); 281const formatCalculatedTime = (t) => { 282 const { days, hours, minutes, seconds } = t; 283 if (days == 0) { 284 return _common_i18n__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.format("common.flash_sale.time_left", hours + "", formatTime(minutes), formatTime(seconds)); 285 } 286 return _common_i18n__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.format("common.flash_sale.time_left_with_days", days + "", hours + "", formatTime(minutes), formatTime(seconds)); 287}; 288 289 290/***/ }), 291 292/***/ 26035: 293/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 294 295"use strict"; 296/* harmony export */ __webpack_require__.d(__webpack_exports__, { 297/* harmony export */ A: () => (/* binding */ addTabGidHeader), 298/* harmony export */ I: () => (/* binding */ getTabGid) 299/* harmony export */ }); 300function getTabGid() { 301 if (window["tabGid"] == void 0) { 302 return "na"; 303 } 304 return window["tabGid"]; 305} 306function addTabGidHeader(headers) { 307 headers["x-lsc-tabGid"] = getTabGid(); 308 return headers; 309} 310 311 312 313/***/ }), 314 315/***/ 32868: 316/***/ (function() { 317 318(function(self2) { 319 "use strict"; 320 if (self2.fetch) { 321 return; 322 } 323 var support = { 324 searchParams: "URLSearchParams" in self2, 325 iterable: "Symbol" in self2 && "iterator" in Symbol, 326 blob: "FileReader" in self2 && "Blob" in self2 && (function() { 327 try { 328 new Blob(); 329 return true; 330 } catch (e) { 331 return false; 332 } 333 })(), 334 formData: "FormData" in self2, 335 arrayBuffer: "ArrayBuffer" in self2 336 }; 337 if (support.arrayBuffer) { 338 var viewClasses = [ 339 "[object Int8Array]", 340 "[object Uint8Array]", 341 "[object Uint8ClampedArray]", 342 "[object Int16Array]", 343 "[object Uint16Array]", 344 "[object Int32Array]", 345 "[object Uint32Array]", 346 "[object Float32Array]", 347 "[object Float64Array]" 348 ]; 349 var isDataView = function(obj) { 350 return obj && DataView.prototype.isPrototypeOf(obj); 351 }; 352 var isArrayBufferView = ArrayBuffer.isView || function(obj) { 353 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; 354 }; 355 } 356 function normalizeName(name) { 357 if (typeof name !== "string") { 358 name = String(name); 359 } 360 if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { 361 throw new TypeError("Invalid character in header field name"); 362 } 363 return name.toLowerCase(); 364 } 365 function normalizeValue(value) { 366 if (typeof value !== "string") { 367 value = String(value); 368 } 369 return value; 370 } 371 function iteratorFor(items) { 372 var iterator = { 373 next: function() { 374 var value = items.shift(); 375 return { done: value === void 0, value }; 376 } 377 }; 378 if (support.iterable) { 379 iterator[Symbol.iterator] = function() { 380 return iterator; 381 }; 382 } 383 return iterator; 384 } 385 function Headers(headers) { 386 this.map = {}; 387 if (headers instanceof Headers) { 388 headers.forEach(function(value, name) { 389 this.append(name, value); 390 }, this); 391 } else if (Array.isArray(headers)) { 392 headers.forEach(function(header) { 393 this.append(header[0], header[1]); 394 }, this); 395 } else if (headers) { 396 Object.getOwnPropertyNames(headers).forEach(function(name) { 397 this.append(name, headers[name]); 398 }, this); 399 } 400 } 401 Headers.prototype.append = function(name, value) { 402 name = normalizeName(name); 403 value = normalizeValue(value); 404 var oldValue = this.map[name]; 405 this.map[name] = oldValue ? oldValue + "," + value : value; 406 }; 407 Headers.prototype["delete"] = function(name) { 408 delete this.map[normalizeName(name)]; 409 }; 410 Headers.prototype.get = function(name) { 411 name = normalizeName(name); 412 return this.has(name) ? this.map[name] : null; 413 }; 414 Headers.prototype.has = function(name) { 415 return this.map.hasOwnProperty(normalizeName(name)); 416 }; 417 Headers.prototype.set = function(name, value) { 418 this.map[normalizeName(name)] = normalizeValue(value); 419 }; 420 Headers.prototype.forEach = function(callback, thisArg) { 421 for (var name in this.map) { 422 if (this.map.hasOwnProperty(name)) { 423 callback.call(thisArg, this.map[name], name, this); 424 } 425 } 426 }; 427 Headers.prototype.keys = function() { 428 var items = []; 429 this.forEach(function(value, name) { 430 items.push(name); 431 }); 432 return iteratorFor(items); 433 }; 434 Headers.prototype.values = function() { 435 var items = []; 436 this.forEach(function(value) { 437 items.push(value); 438 }); 439 return iteratorFor(items); 440 }; 441 Headers.prototype.entries = function() { 442 var items = []; 443 this.forEach(function(value, name) { 444 items.push([name, value]); 445 }); 446 return iteratorFor(items); 447 }; 448 if (support.iterable) { 449 Headers.prototype[Symbol.iterator] = Headers.prototype.entries; 450 } 451 function consumed(body) { 452 if (body.bodyUsed) { 453 return Promise.reject(new TypeError("Already read")); 454 } 455 body.bodyUsed = true; 456 } 457 function fileReaderReady(reader) { 458 return new Promise(function(resolve, reject) { 459 reader.onload = function() { 460 resolve(reader.result); 461 }; 462 reader.onerror = function() { 463 reject(reader.error); 464 }; 465 }); 466 } 467 function readBlobAsArrayBuffer(blob) { 468 var reader = new FileReader(); 469 var promise = fileReaderReady(reader); 470 reader.readAsArrayBuffer(blob); 471 return promise; 472 } 473 function readBlobAsText(blob) { 474 var reader = new FileReader(); 475 var promise = fileReaderReady(reader); 476 reader.readAsText(blob); 477 return promise; 478 } 479 function readArrayBufferAsText(buf) { 480 var view = new Uint8Array(buf); 481 var chars = new Array(view.length); 482 for (var i = 0; i < view.length; i++) { 483 chars[i] = String.fromCharCode(view[i]); 484 } 485 return chars.join(""); 486 } 487 function bufferClone(buf) { 488 if (buf.slice) { 489 return buf.slice(0); 490 } else { 491 var view = new Uint8Array(buf.byteLength); 492 view.set(new Uint8Array(buf)); 493 return view.buffer; 494 } 495 } 496 function Body() { 497 this.bodyUsed = false;
vendor: 7,411 bytes, lines 498-705
498 this._initBody = function(body) { 499 this._bodyInit = body; 500 if (!body) { 501 this._bodyText = ""; 502 } else if (typeof body === "string") { 503 this._bodyText = body; 504 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { 505 this._bodyBlob = body; 506 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { 507 this._bodyFormData = body; 508 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 509 this._bodyText = body.toString(); 510 } else if (support.arrayBuffer && support.blob && isDataView(body)) { 511 this._bodyArrayBuffer = bufferClone(body.buffer); 512 this._bodyInit = new Blob([this._bodyArrayBuffer]); 513 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { 514 this._bodyArrayBuffer = bufferClone(body); 515 } else { 516 throw new Error("unsupported BodyInit type"); 517 } 518 if (!this.headers.get("content-type")) { 519 if (typeof body === "string") { 520 this.headers.set("content-type", "text/plain;charset=UTF-8"); 521 } else if (this._bodyBlob && this._bodyBlob.type) { 522 this.headers.set("content-type", this._bodyBlob.type); 523 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 524 this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"); 525 } 526 } 527 }; 528 if (support.blob) { 529 this.blob = function() { 530 var rejected = consumed(this); 531 if (rejected) { 532 return rejected; 533 } 534 if (this._bodyBlob) { 535 return Promise.resolve(this._bodyBlob); 536 } else if (this._bodyArrayBuffer) { 537 return Promise.resolve(new Blob([this._bodyArrayBuffer])); 538 } else if (this._bodyFormData) { 539 throw new Error("could not read FormData body as blob"); 540 } else { 541 return Promise.resolve(new Blob([this._bodyText])); 542 } 543 }; 544 this.arrayBuffer = function() { 545 if (this._bodyArrayBuffer) { 546 return consumed(this) || Promise.resolve(this._bodyArrayBuffer); 547 } else { 548 return this.blob().then(readBlobAsArrayBuffer); 549 } 550 }; 551 } 552 this.text = function() { 553 var rejected = consumed(this); 554 if (rejected) { 555 return rejected; 556 } 557 if (this._bodyBlob) { 558 return readBlobAsText(this._bodyBlob); 559 } else if (this._bodyArrayBuffer) { 560 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); 561 } else if (this._bodyFormData) { 562 throw new Error("could not read FormData body as text"); 563 } else { 564 return Promise.resolve(this._bodyText); 565 } 566 }; 567 if (support.formData) { 568 this.formData = function() { 569 return this.text().then(decode); 570 }; 571 } 572 this.json = function() { 573 return this.text().then(JSON.parse); 574 }; 575 return this; 576 } 577 var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; 578 function normalizeMethod(method) { 579 var upcased = method.toUpperCase(); 580 return methods.indexOf(upcased) > -1 ? upcased : method; 581 } 582 function Request(input, options) { 583 options = options || {}; 584 var body = options.body; 585 if (input instanceof Request) { 586 if (input.bodyUsed) { 587 throw new TypeError("Already read"); 588 } 589 this.url = input.url; 590 this.credentials = input.credentials; 591 if (!options.headers) { 592 this.headers = new Headers(input.headers); 593 } 594 this.method = input.method; 595 this.mode = input.mode; 596 if (!body && input._bodyInit != null) { 597 body = input._bodyInit; 598 input.bodyUsed = true; 599 } 600 } else { 601 this.url = String(input); 602 } 603 this.credentials = options.credentials || this.credentials || "omit"; 604 if (options.headers || !this.headers) { 605 this.headers = new Headers(options.headers); 606 } 607 this.method = normalizeMethod(options.method || this.method || "GET"); 608 this.mode = options.mode || this.mode || null; 609 this.referrer = null; 610 if ((this.method === "GET" || this.method === "HEAD") && body) { 611 throw new TypeError("Body not allowed for GET or HEAD requests"); 612 } 613 this._initBody(body); 614 } 615 Request.prototype.clone = function() { 616 return new Request(this, { body: this._bodyInit }); 617 }; 618 function decode(body) { 619 var form = new FormData(); 620 body.trim().split("&").forEach(function(bytes) { 621 if (bytes) { 622 var split = bytes.split("="); 623 var name = split.shift().replace(/\+/g, " "); 624 var value = split.join("=").replace(/\+/g, " "); 625 form.append(decodeURIComponent(name), decodeURIComponent(value)); 626 } 627 }); 628 return form; 629 } 630 function parseHeaders(rawHeaders) { 631 var headers = new Headers(); 632 rawHeaders.split(/\r?\n/).forEach(function(line) { 633 var parts = line.split(":"); 634 var key = parts.shift().trim(); 635 if (key) { 636 var value = parts.join(":").trim(); 637 headers.append(key, value); 638 } 639 }); 640 return headers; 641 } 642 Body.call(Request.prototype); 643 function Response(bodyInit, options) { 644 if (!options) { 645 options = {}; 646 } 647 this.type = "default"; 648 this.status = "status" in options ? options.status : 200; 649 this.ok = this.status >= 200 && this.status < 300; 650 this.statusText = "statusText" in options ? options.statusText : "OK"; 651 this.headers = new Headers(options.headers); 652 this.url = options.url || ""; 653 this._initBody(bodyInit); 654 } 655 Body.call(Response.prototype); 656 Response.prototype.clone = function() { 657 return new Response(this._bodyInit, { 658 status: this.status, 659 statusText: this.statusText, 660 headers: new Headers(this.headers), 661 url: this.url 662 }); 663 }; 664 Response.error = function() { 665 var response = new Response(null, { status: 0, statusText: "" }); 666 response.type = "error"; 667 return response; 668 }; 669 var redirectStatuses = [301, 302, 303, 307, 308]; 670 Response.redirect = function(url, status) { 671 if (redirectStatuses.indexOf(status) === -1) { 672 throw new RangeError("Invalid status code"); 673 } 674 return new Response(null, { status, headers: { location: url } }); 675 }; 676 self2.Headers = Headers; 677 self2.Request = Request; 678 self2.Response = Response; 679 self2.fetch = function(input, init) { 680 return new Promise(function(resolve, reject) { 681 var request = new Request(input, init); 682 var xhr = new XMLHttpRequest(); 683 xhr.onload = function() { 684 var options = { 685 status: xhr.status, 686 statusText: xhr.statusText, 687 headers: parseHeaders(xhr.getAllResponseHeaders() || "") 688 }; 689 options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL"); 690 var body = "response" in xhr ? xhr.response : xhr.responseText; 691 resolve(new Response(body, options)); 692 }; 693 xhr.onerror = function() { 694 reject(new TypeError("Network request failed")); 695 }; 696 xhr.ontimeout = function() { 697 reject(new TypeError("Network request failed")); 698 }; 699 xhr.open(request.method, request.url, true); 700 if (request.credentials === "include") { 701 xhr.withCredentials = true; 702 } 703 if ("responseType" in xhr && support.blob) { 704 xhr.responseType = "blob"; 705 }
706 request.headers.forEach(function(value, name) { 707 xhr.setRequestHeader(name, value); 708 }); 709 xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit); 710 }); 711 }; 712 self2.fetch.polyfill = true; 713})(typeof self !== "undefined" ? self : this); 714 715 716/***/ }), 717 718/***/ 47578: 719/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 720 721"use strict"; 722/* harmony export */ __webpack_require__.d(__webpack_exports__, { 723/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) 724/* harmony export */ }); 725class I18N { 726 get(key) { 727 const res = window["lscI18N"][key]; 728 if (res == void 0) { 729 throw Error("No such i18n key: " + key); 730 } 731 return res; 732 } 733 format(key, ...args) { 734 let pattern = this.get(key); 735 for (let i = 0; i < args.length; i++) { 736 const re = new RegExp("\\{" + i + "\\}", "g"); 737 pattern = pattern.replace(re, args[i]); 738 } 739 return pattern; 740 } 741} 742const i18n = new I18N(); 743/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (i18n); 744 745 746/***/ }), 747 748/***/ 52852: 749/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 750 751"use strict"; 752/* harmony export */ __webpack_require__.d(__webpack_exports__, { 753/* harmony export */ A: () => (/* binding */ Timer) 754/* harmony export */ }); 755var __defProp = Object.defineProperty; 756var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 757var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 758class Timer { 759 constructor(currentTime, finishTime, callback, autoStart = true) { 760 __publicField(this, "lastCall"); 761 __publicField(this, "lastTime"); 762 __publicField(this, "intervalId"); 763 __publicField(this, "stop", () => { 764 if (this.intervalId) { 765 clearInterval(this.intervalId); 766 this.intervalId = void 0; 767 } 768 }); 769 const getCallBackData = () => ({ currentTime: this.lastTime, finishTime }); 770 this.lastTime = currentTime; 771 this.lastCall = 0; 772 this.callTimer(); 773 callback(getCallBackData()); 774 if (autoStart) { 775 this.intervalId = setInterval(() => { 776 this.callTimer(); 777 callback(getCallBackData()); 778 }, 1e3); 779 } 780 } 781 callTimer() { 782 const currentDate = new Date(this.lastTime); 783 const now = performance.now(); 784 const timeDiff = now - this.lastCall; 785 this.lastCall = now; 786 currentDate.setTime(currentDate.getTime() + timeDiff); 787 this.lastTime = currentDate.getTime(); 788 } 789} 790 791 792/***/ }), 793 794/***/ 75578: 795/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 796 797"use strict"; 798/* harmony export */ __webpack_require__.d(__webpack_exports__, { 799/* harmony export */ e: () => (/* binding */ RESOURCE_PREFIX) 800/* harmony export */ }); 801/* unused harmony export CDN_PREFIX */ 802const CDN_PREFIX = window.cdnLearnSQLPrefix; 803const RESOURCE_PREFIX = window.resourcePrefix; 804 805 806/***/ }), 807 808/***/ 88386: 809/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => { 810 811"use strict"; 812/* harmony import */ var _TabGid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26035); 813var __defProp = Object.defineProperty; 814var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 815var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 816 817class Logger { 818 constructor() { 819 __publicField(this, "url", "/api/v1/logger"); 820 } 821 info(msg) { 822 if (typeof Sentry !== "undefined") { 823 Sentry.captureMessage(msg, { 824 level: "info" 825 }); 826 } else { 827 console.warn("Sentry not available"); 828 console.warn(msg); 829 } 830 } 831 warn(msg) { 832 if (typeof Sentry !== "undefined") { 833 Sentry.captureMessage(msg, { 834 level: "warning" 835 }); 836 } else { 837 console.warn("Sentry not available"); 838 console.warn(msg); 839 } 840 } 841 error(msg) { 842 if (typeof Sentry !== "undefined") { 843 Sentry.captureMessage(msg, { 844 level: "error" 845 }); 846 } else { 847 console.warn("Sentry not available"); 848 console.warn(msg); 849 } 850 } 851 sent(msg, level) { 852 const errMsg = [{ 853 path: window.location.pathname, 854 level, 855 msg 856 }]; 857 try { 858 return fetch(this.url, { 859 method: "POST", 860 body: JSON.stringify(errMsg), 861 headers: (0,_TabGid__WEBPACK_IMPORTED_MODULE_0__/* .addTabGidHeader */ .A)({ 862 "Content-Type": "application/json" 863 }), 864 credentials: "same-origin" 865 }); 866 } catch (error) { 867 if (error instanceof TypeError && error.message === "Load failed") { 868 throw Error("Error while send request to /api/v1/logger", { cause: error }); 869 } else { 870 throw error; 871 } 872 } 873 } 874} 875const logger = new Logger(); 876/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (logger))); 877 878 879/***/ }), 880 881/***/ 91737: 882/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 883 884"use strict"; 885/* harmony export */ __webpack_require__.d(__webpack_exports__, { 886/* harmony export */ J: () => (/* binding */ addInternalHeaders) 887/* harmony export */ }); 888/* unused harmony exports post, put, get, del, handleJson, timeoutPromise, displayError, reloadOn401, openNewWindowWithPostRequest, getCsrfToken */ 889/* harmony import */ var _common_TabGid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26035); 890 891function get(path, data, headers) { 892 if (!headers) { 893 headers = {}; 894 } 895 return fetch("/api" + path, { 896 method: "GET", 897 headers, 898 credentials: "same-origin" 899 }); 900} 901function post(path, data, headers) { 902 return fetch("/api" + path, { 903 method: "POST", 904 headers: addInternalHeaders(headers), 905 credentials: "same-origin", 906 body: JSON.stringify(data) 907 }); 908} 909function put(path, data, headers) { 910 return fetch("/api" + path, { 911 method: "PUT", 912 headers: addInternalHeaders(headers), 913 credentials: "same-origin", 914 body: JSON.stringify(data) 915 }); 916} 917function del(path, data, headers) { 918 return fetch("/api" + path, { 919 method: "DELETE", 920 headers: addInternalHeaders(headers), 921 credentials: "same-origin", 922 body: JSON.stringify(data) 923 }); 924} 925function getCsrfToken() { 926 if (document.documentElement.dataset.csrfToken == null) { 927 throw new Error("csrfToken is missing"); 928 } 929 return document.documentElement.dataset.csrfToken; 930} 931function addInternalHeaders(headers) { 932 if (!headers) { 933 headers = {}; 934 } 935 return Object.assign({ 936 "Content-Type": "application/json", 937 "x-lsc-tabGid": (0,_common_TabGid__WEBPACK_IMPORTED_MODULE_0__/* .getTabGid */ .I)(), 938 "X-CSRF-TOKEN": getCsrfToken() 939 }, headers); 940} 941function handleJson(response) { 942 if (response.ok) { 943 return response.json(); 944 } else { 945 if (isJson(response.headers.get("Content-Type"))) { 946 return handleJsonError(response); 947 } 948 const errorInfo = responseDetails(response); 949 return Promise.reject(errorInfo); 950 } 951} 952function handleJsonError(response) { 953 const errorInfo = responseDetails(response); 954 return new Promise((resolve, reject) => { 955 response.json().then((data) => reject(Object.assign({}, { 956 errorType: "server", 957 data, 958 // for backward compatibility 959 httpStatusCode: errorInfo.status, 960 httpStatusText: errorInfo.statusText 961 }, errorInfo))).catch((error) => reject(Object.assign({}, { 962 errorType: "server", 963 data: error, 964 // for backward compatibility 965 httpStatusCode: errorInfo.status, 966 httpStatusText: errorInfo.statusText 967 }, errorInfo))); 968 }); 969} 970function timeoutPromise(r, timeout = 500) { 971 return new Promise(() => { 972 setTimeout(() => { 973 r(); 974 }, timeout); 975 }); 976} 977function reloadOn401(response) { 978 if (response.status == 401) { 979 window.location.reload(); 980 const errorInfo = responseDetails(response); 981 return Promise.reject(errorInfo); 982 } 983 return Promise.resolve(response); 984} 985function responseDetails(response) { 986 return { 987 url: response.url, 988 status: response.status, 989 statusText: response.statusText 990 }; 991} 992function defaultErrorHandler(error) { 993 if (error.status == 401) { 994 return; 995 } 996 if (error.data) { 997 console.error(error.data); 998 } 999} 1000const JSON_TYPE = "application/json"; 1001function isJson(type) { 1002 return (type || "").startsWith(JSON_TYPE); 1003} 1004function openNewWindowWithPostRequest(targetUrl, parameters) { 1005 const form = document.createElement("form"); 1006 form.method = "POST"; 1007 form.action = targetUrl; 1008 form.target = "_blank";
1009 Object.keys(parameters).forEach((key) => { 1010 const input = document.createElement("input"); 1011 input.type = "hidden"; 1012 input.name = key; 1013 input.value = parameters[key]; 1014 form.appendChild(input); 1015 }); 1016 document.body.appendChild(form); 1017 form.submit(); 1018 document.body.removeChild(form); 1019} 1020 1021 1022 1023/***/ }) 1024 1025/******/ }); 1026/************************************************************************/ 1027/******/ // The module cache 1028/******/ var __webpack_module_cache__ = {}; 1029/******/ 1030/******/ // The require function 1031/******/ function __webpack_require__(moduleId) { 1032/******/ // Check if module is in cache 1033/******/ var cachedModule = __webpack_module_cache__[moduleId]; 1034/******/ if (cachedModule !== undefined) { 1035/******/ return cachedModule.exports; 1036/******/ } 1037/******/ // Create a new module (and put it into the cache) 1038/******/ var module = __webpack_module_cache__[moduleId] = { 1039/******/ // no module.id needed 1040/******/ // no module.loaded needed 1041/******/ exports: {} 1042/******/ }; 1043/******/ 1044/******/ // Execute the module function 1045/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1046/******/ 1047/******/ // Return the exports of the module 1048/******/ return module.exports; 1049/******/ } 1050/******/ 1051/************************************************************************/ 1052/******/ /* webpack/runtime/compat get default export */ 1053/******/ (() => { 1054/******/ // getDefaultExport function for compatibility with non-harmony modules 1055/******/ __webpack_require__.n = (module) => { 1056/******/ var getter = module && module.__esModule ? 1057/******/ () => (module['default']) : 1058/******/ () => (module); 1059/******/ __webpack_require__.d(getter, { a: getter }); 1060/******/ return getter; 1061/******/ }; 1062/******/ })(); 1063/******/ 1064/******/ /* webpack/runtime/define property getters */ 1065/******/ (() => { 1066/******/ // define getter functions for harmony exports 1067/******/ __webpack_require__.d = (exports, definition) => { 1068/******/ for(var key in definition) { 1069/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1070/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1071/******/ } 1072/******/ } 1073/******/ }; 1074/******/ })(); 1075/******/ 1076/******/ /* webpack/runtime/hasOwnProperty shorthand */ 1077/******/ (() => { 1078/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 1079/******/ })(); 1080/******/ 1081/******/ /* webpack/runtime/make namespace object */ 1082/******/ (() => { 1083/******/ // define __esModule on exports 1084/******/ __webpack_require__.r = (exports) => { 1085/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1086/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1087/******/ } 1088/******/ Object.defineProperty(exports, '__esModule', { value: true }); 1089/******/ }; 1090/******/ })(); 1091/******/ 1092/************************************************************************/ 1093var __webpack_exports__ = {}; 1094// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 1095(() => { 1096 1097})(); 1098 1099// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 1100(() => { 1101"use strict"; 1102/* harmony import */ var svg4everybody_dist_svg4everybody__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1430); 1103/* harmony import */ var svg4everybody_dist_svg4everybody__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(svg4everybody_dist_svg4everybody__WEBPACK_IMPORTED_MODULE_0__); 1104 1105svg4everybody_dist_svg4everybody__WEBPACK_IMPORTED_MODULE_0__(); 1106document.addEventListener("DOMContentLoaded", () => { 1107 setTimeout(() => { 1108 const topSticky = document.querySelector("body > .sticky"); 1109 const other = Array.from(document.querySelectorAll(".sticky, .checkout-flex .Subscribe__wrapper")).filter((el) => el !== topSticky); 1110 const menuContent = document.getElementById("menu-content"); 1111 (other.length || menuContent) && setInterval(() => { 1112 const height = topSticky && topSticky.offsetHeight || 0; 1113 other.forEach((el) => { 1114 let modif = 0; 1115 if (el.className.indexOf("Subscribe") > -1) { 1116 modif = 34; 1117 } 1118 el.style.top = `${height + modif}px`; 1119 }); 1120 document.body.style.setProperty("--topStickyHeight", `${height}px`); 1121 }, 500); 1122 }, 1e3); 1123}); 1124 1125})(); 1126 1127// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 1128(() => { 1129"use strict";
1130// ESM COMPAT FLAG 1131__webpack_require__.r(__webpack_exports__); 1132 1133// EXPORTS 1134__webpack_require__.d(__webpack_exports__, { 1135 initFlashSaleBox: () => (/* binding */ initFlashSaleBox), 1136 initFlashSaleCounter: () => (/* binding */ initFlashSaleCounter) 1137}); 1138 1139// EXTERNAL MODULE: ./js/common/ResourcePrefix.ts 1140var ResourcePrefix = __webpack_require__(75578); 1141// EXTERNAL MODULE: ./js/common/i18n.ts 1142var i18n = __webpack_require__(47578); 1143// EXTERNAL MODULE: ./js/assessment_task/Timer.ts 1144var Timer = __webpack_require__(52852); 1145// EXTERNAL MODULE: ./js/flash-sale-box/flash-sale.ts 1146var flash_sale = __webpack_require__(21957); 1147;// ./js/flash-sale-box/FlashSaleBox.ts 1148var __defProp = Object.defineProperty; 1149var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 1150var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 1151 1152 1153 1154 1155const SHOW_DELAY = 2e3; 1156const createElement = function(tag, classes, ids) { 1157 const newElement = document.createElement(tag); 1158 if (classes) { 1159 classes.split(" ").forEach((htmlClass) => { 1160 htmlClass.trim() && newElement.classList.add(htmlClass.trim()); 1161 }); 1162 } 1163 if (ids) { 1164 ids.split(" ").forEach((htmlId) => { 1165 newElement.id += htmlId + " "; 1166 }); 1167 } 1168 return newElement; 1169}; 1170const FLASH_SALE_BOX_CLOSED_KEY = "isFlashSaleBoxClosed"; 1171const delayPromise = (delay) => new Promise((resolve) => setTimeout(resolve, delay)); 1172class FlashSaleBox { 1173 constructor(parent) { 1174 __publicField(this, "parent"); 1175 __publicField(this, "rootElement", null); 1176 __publicField(this, "timerElement", null); 1177 __publicField(this, "state"); 1178 __publicField(this, "timer", null); 1179 __publicField(this, "setState", (partialState) => { 1180 this.state = Object.assign({}, this.state, partialState); 1181 this.renderComponent(); 1182 }); 1183 __publicField(this, "timerCallback", (data) => { 1184 const t = (0,flash_sale/* calculateTime */.Ye)(data.finishTime, data.currentTime); 1185 const { days, hours, minutes, seconds } = t; 1186 if (hours === 0 && minutes === 0 && seconds === 0) { 1187 this.close(); 1188 return; 1189 } 1190 if (this.timerElement) { 1191 const placeholder = days === 0 ? i18n/* default */.A.format("common.flash_sale.time_left", hours + "", "00", "00") : i18n/* default */.A.format("common.flash_sale.time_left_with_days", days + "", hours + "", "00", "00"); 1192 this.timerElement.innerHTML = `${(0,flash_sale/* formatCalculatedTime */.Jn)(t)}<span class="flash-sale-box__timerPlaceholder" aria-hidden="true">${placeholder}</span>`; 1193 } 1194 }); 1195 __publicField(this, "onClose", () => { 1196 window.sessionStorage.setItem(FLASH_SALE_BOX_CLOSED_KEY, "true"); 1197 this.close(); 1198 }); 1199 __publicField(this, "handleRedirect", () => { 1200 window.location.href = this.state.promoUrl; 1201 }); 1202 this.parent = parent; 1203 this.state = { 1204 visible: false, 1205 closed: false, 1206 name: "", 1207 description: "", 1208 promoUrl: "", 1209 currentTime: NaN, 1210 finishTime: NaN, 1211 discountInPercentage: null 1212 }; 1213 this.init(); 1214 } 1215 renderComponent() { 1216 const hasRootElement = !!this.rootElement; 1217 const el = this.render(); 1218 if (el) { 1219 if (!hasRootElement) { 1220 this.parent.appendChild(el); 1221 } 1222 } else { 1223 if (this.rootElement) { 1224 this.parent.removeChild(this.rootElement); 1225 this.rootElement = null; 1226 } 1227 } 1228 } 1229 close() { 1230 var _a; 1231 (_a = this.timer) == null ? void 0 : _a.stop(); 1232 this.setState({ closed: true }); 1233 } 1234 init() { 1235 if (window.sessionStorage.getItem(FLASH_SALE_BOX_CLOSED_KEY) !== "true") { 1236 this.renderComponent(); 1237 Promise.all([ 1238 delayPromise(SHOW_DELAY), 1239 (0,flash_sale/* getFlashSaleData */.IF)() 1240 ]).then(([, flashSaleResp]) => { 1241 if (!flashSaleResp.isFlashSaleActive) { 1242 return; 1243 } 1244 const flashSaleActive = flashSaleResp; 1245 const currentTime = (/* @__PURE__ */ new Date()).getTime(); 1246 const finishTime = currentTime + flashSaleResp.flashSaleRemainingTime; 1247 this.setState({ 1248 name: flashSaleActive.name,
1249 description: flashSaleActive.description, 1250 promoUrl: flashSaleActive.promoUrl, 1251 visible: flashSaleActive.isFlashSaleActive, 1252 currentTime, 1253 finishTime, 1254 discountInPercentage: flashSaleResp.discountInPercentage 1255 }); 1256 this.timer = new Timer/* default */.A( 1257 currentTime, 1258 finishTime, 1259 this.timerCallback 1260 ); 1261 }); 1262 } 1263 } 1264 getPromoNameHTML(name, deadlineTsUtc, currentTime) { 1265 const { days, hours } = (0,flash_sale/* calculateTime */.Ye)(deadlineTsUtc, currentTime); 1266 let label = ""; 1267 let value = ""; 1268 if (days == 0) { 1269 switch (hours) { 1270 case 0: 1271 label = "common.flash_sale.duration_label.minutes"; 1272 break; 1273 case 1: 1274 label = "common.flash_sale.duration_label.one_hour"; 1275 break; 1276 default: 1277 label = "common.flash_sale.duration_label.hours"; 1278 } 1279 value = hours + ""; 1280 } else { 1281 label = "common.flash_sale.duration_label.days"; 1282 value = days + ""; 1283 } 1284 return `<span class="flash-sale-box__name">${name} - <span class='flash-sale-box__duration'>${i18n/* default */.A.format(label, value)}</span></span>`; 1285 } 1286 getTimerElement() { 1287 return createElement("span", "flash-sale-box__timer"); 1288 } 1289 render() { 1290 var _a, _b, _c, _d, _e, _f; 1291 const getRootElement = () => { 1292 const rootElement = this.rootElement || createElement("div", "flash-sale-box__wrapper"); 1293 rootElement.classList.toggle("state-collapsed", !this.state.visible); 1294 return this.rootElement = rootElement; 1295 }; 1296 (_a = document.querySelector(".container")) == null ? void 0 : _a.classList.toggle("flash-sale-show", this.state.visible); 1297 this.timerElement = null; 1298 if (this.state.closed) { 1299 return null; 1300 } 1301 const discount = this.state.discountInPercentage ? this.state.discountInPercentage + "" : ""; 1302 const el = getRootElement(); 1303 el.innerHTML = `<div class='flash-sale-box redesign'> 1304 <p class='flash-sale-box__badgeWrapper'> 1305 ${discount ? `<span class='flash-sale-box__badge'>${i18n/* default */.A.format("common.flash_sale.badge", discount)}</span>` : ""} 1306 </p> 1307 <p class='flash-sale-box__content'> 1308 ${this.getPromoNameHTML(this.state.name, this.state.finishTime, this.state.currentTime)} 1309 <span class='flash-sale-box__description'> 1310 ${this.state.description} 1311 </span> 1312 </p> 1313 <p class='flash-sale-box__countdown'></p> 1314 <button class='flash-sale-box__close-button' aria-label="Close"> 1315 <svg role='img' 1316 xmlns="http://www.w3.org/2000/svg" 1317 xmlns:xlink="http://www.w3.org/1999/xlink" 1318 class="flash-sale-box__close-icon icon icon--ico_close" 1319 color="white"> 1320 <use xlink:href=${ResourcePrefix/* RESOURCE_PREFIX */.e}/img/sprite.svg#ico_close></use> 1321 </svg> 1322 </div>`; 1323 if (this.state.visible) { 1324 this.timerElement = this.getTimerElement(); 1325 (_b = el.querySelector(".flash-sale-box__countdown")) == null ? void 0 : _b.insertAdjacentElement("beforeend", this.timerElement); 1326 (_c = el.querySelector(".flash-sale-box__close-button")) == null ? void 0 : _c.addEventListener("click", (event) => event.stopPropagation()); 1327 (_d = el.querySelector(".flash-sale-box__close-button")) == null ? void 0 : _d.addEventListener("click", this.onClose); 1328 if (this.state.promoUrl) { 1329 (_e = el.querySelector(".flash-sale-box")) == null ? void 0 : _e.addEventListener("click", this.handleRedirect); 1330 (_f = el.querySelector(".flash-sale-box")) == null ? void 0 : _f.classList.add("flash-sale-box__clickable"); 1331 } 1332 } 1333 return el; 1334 } 1335} 1336/* harmony default export */ const flash_sale_box_FlashSaleBox = (FlashSaleBox); 1337 1338;// ./js/flash-sale-box/init.ts 1339 1340 1341 1342 1343function initFlashSaleBox(contentRootId, atBottom) { 1344 const container = document.getElementById(contentRootId); 1345 if (container) { 1346 if (atBottom) { 1347 const relocateContainer = document.querySelector("body"); 1348 relocateContainer == null ? void 0 : relocateContainer.appendChild(container); 1349 container.classList.add("sticky"); 1350 container.classList.add("flash-sale-box--bottom"); 1351 } 1352 new flash_sale_box_FlashSaleBox(container); 1353 } 1354} 1355function initFlashSaleCounter(millisecondsLeft, containerSelector) { 1356 document.querySelectorAll(containerSelector).forEach((el) => { 1357 if (millisecondsLeft > 0) { 1358 const timerData = (0,flash_sale/* getFlashSaleTimerData */.to)(millisecondsLeft); 1359 const timer = new Timer/* default */.A( 1360 timerData.currentTime, 1361 timerData.finishTime, 1362 ({ currentTime, finishTime }) => { 1363 el.innerHTML = (0,flash_sale/* formatCalculatedTime */.Jn)((0,flash_sale/* calculateTime */.Ye)(finishTime, currentTime)); 1364 if (currentTime >= finishTime) { 1365 timer.stop(); 1366 } 1367 } 1368 ); 1369 } else { 1370 if (el.parentElement) { 1371 el.parentElement.style.display = "none"; 1372 } 1373 } 1374 }); 1375} 1376 1377})(); 1378 1379FlashSaleBox = __webpack_exports__; 1380/******/ })() 1381;
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.