vendor: 1,770 bytes, lines 1-12
1var __defProp = Object.defineProperty; 2var __typeError = (msg) => { 3 throw TypeError(msg); 4}; 5var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; 6var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); 7var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); 8var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); 9var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); 10var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); 11var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); 12var _submitter, _resolveRequestPromise, _FetchRequest_instances, allowRequestToBeIntercepted_fn, willDelegateErrorHandling_fn, _prefetchTimeout, _prefetched, _resolveRenderPromise, _resolveInterceptionPromise, _activeElement, _beforeNodeMorphed, _viewTransitionStarted, _lastOperation, _FrameRedirector_instances, shouldSubmit_fn, shouldRedirect_fn, findFrameElement_fn, _prefetchedLink, _enable, _tryToPrefetchRequest, _cancelRequestIfObsolete, _cancelPrefetchRequest, _tryToUsePrefetchedRequest, _LinkPrefetchObserver_instances, cacheTtl_get, isPrefetchable_fn, _Navigator_instances, getActionForFormSubmission_fn, getDefaultAction_fn, _started, _PageRenderer_instances, set
12Language_fn, _preloadAll, _Cache_instances, setCacheControl_fn, _pageRefreshDebouncePeriod, _currentFetchRequest, _resolveVisitPromise, _connected, _hasBeenLoaded, _ignoredAttributes, _shouldMorphFrame, _FrameController_instances, loadSourceURL_fn, loadFrameResponse_fn, visit_fn, navigateFrame_fn, handleUnvisitableFrameResponse_fn, willHandleFrameMissingFromResponse_fn, handleFrameMissingFromResponse_fn, throwFrameMissingError_fn, visitResponse_fn, findFrameElement_fn2, formActionIsVisitable_fn, shouldInterceptNavigation_fn, isIgnoringChangesTo_fn, ignoringChangesToAttribute_fn, withCurrentNavigationElement_fn, _StreamElement_instances, raise_fn, _a, _b; 13var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; 14function getDefaultExportFromCjs(x2) { 15 return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2; 16} 17function getAugmentedNamespace(n2) { 18 if (n2.__esModule) return n2; 19 var f2 = n2.default; 20 if (typeof f2 == "function") { 21 var a2 = function a3() { 22 if (this instanceof a3) { 23 return Reflect.construct(f2, arguments, this.constructor); 24 } 25 return f2.apply(this, arguments); 26 }; 27 a2.prototype = f2.prototype; 28 } else a2 = {}; 29 Object.defineProperty(a2, "__esModule", { value: true }); 30 Object.keys(n2).forEach(function(k2) { 31 var d2 = Object.getOwnPropertyDescriptor(n2, k2); 32 Object.defineProperty(a2, k2, d2.get ? d2 : { 33 enumerable: true, 34 get: function() { 35 return n2[k2]; 36 } 37 }); 38 }); 39 return a2; 40} 41var jquery = { exports: {} }; 42/*! 43 * jQuery JavaScript Library v3.7.1 44 * https://jquery.com/ 45 * 46 * Copyright OpenJS Foundation and other contributors 47 * Released under the MIT license 48 * https://jquery.org/license 49 * 50 * Date: 2023-08-28T13:37Z 51 */ 52(function(module) { 53 (function(global2, factory) { 54 { 55 module.exports = global2.document ? factory(global2, true) : function(w2) { 56 if (!w2.document) { 57 throw new Error("jQuery requires a window with a document"); 58 } 59 return factory(w2); 60 }; 61 } 62 })(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) { 63 var arr = []; 64 var getProto = Object.getPrototypeOf; 65 var slice = arr.slice; 66 var flat3 = arr.flat ? function(array) { 67 return arr.flat.call(array); 68 } : function(array) { 69 return arr.concat.apply([], array); 70 }; 71 var push2 = arr.push; 72 var indexOf = arr.indexOf; 73 var class2type = {}; 74 var toString = class2type.toString; 75 var hasOwn = class2type.hasOwnProperty; 76 var fnToString = hasOwn.toString; 77 var ObjectFunctionString = fnToString.call(Object); 78 var support = {}; 79 var isFunction2 = function isFunction3(obj) { 80 return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function"; 81 }; 82 var isWindow = function isWindow2(obj) { 83 return obj != null && obj === obj.window; 84 }; 85 var document2 = window2.document; 86 var preservedScriptAttributes = { 87 type: true, 88 src: true, 89 nonce: true, 90 noModule: true 91 }; 92 function DOMEval(code, node, doc2) { 93 doc2 = doc2 || document2; 94 var i2, val, script = doc2.createElement("script"); 95 script.text = code; 96 if (node) { 97 for (i2 in preservedScriptAttributes) { 98 val = node[i2] || node.getAttribute && node.getAttribute(i2); 99 if (val) { 100 script.setAttribute(i2, val); 101 } 102 } 103 } 104 doc2.head.appendChild(script).parentNode.removeChild(script); 105 } 106 function toType(obj) { 107 if (obj == null) { 108 return obj + ""; 109 } 110 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj; 111 } 112 var version2 = "3.7.1", rhtmlSuffix = /HTML$/i, jQuery = function(selector3, context3) { 113 return new jQuery.fn.init(selector3, context3); 114 }; 115 jQuery.fn = jQuery.prototype = { 116 // The current version of jQuery being used 117 jquery: version2, 118 constructor: jQuery, 119 // The default length of a jQuery object is 0 120 length: 0, 121 toArray: function() { 122 return slice.call(this); 123 }, 124 // Get the Nth element in the matched element set OR 125 // Get the whole matched element set as a clean array 126 get: function(num) { 127 if (num == null) { 128 return slice.call(this); 129 } 130 return num < 0 ? this[num + this.length] : this[num]; 131 }, 132 // Take an array of elements and push it onto the stack 133 // (returning the new matched element set) 134 pushStack: function(elems) { 135 var ret = jQuery.merge(this.constructor(), elems);
vendor: 5,627 bytes, lines 136-312
136 ret.prevObject = this; 137 return ret; 138 }, 139 // Execute a callback for every element in the matched set. 140 each: function(callback) { 141 return jQuery.each(this, callback); 142 }, 143 map: function(callback) { 144 return this.pushStack(jQuery.map(this, function(elem, i2) { 145 return callback.call(elem, i2, elem); 146 })); 147 }, 148 slice: function() { 149 return this.pushStack(slice.apply(this, arguments)); 150 }, 151 first: function() { 152 return this.eq(0); 153 }, 154 last: function() { 155 return this.eq(-1); 156 }, 157 even: function() { 158 return this.pushStack(jQuery.grep(this, function(_elem, i2) { 159 return (i2 + 1) % 2; 160 })); 161 }, 162 odd: function() { 163 return this.pushStack(jQuery.grep(this, function(_elem, i2) { 164 return i2 % 2; 165 })); 166 }, 167 eq: function(i2) { 168 var len2 = this.length, j2 = +i2 + (i2 < 0 ? len2 : 0); 169 return this.pushStack(j2 >= 0 && j2 < len2 ? [this[j2]] : []); 170 }, 171 end: function() { 172 return this.prevObject || this.constructor(); 173 }, 174 // For internal use only. 175 // Behaves like an Array's method, not like a jQuery method. 176 push: push2, 177 sort: arr.sort, 178 splice: arr.splice 179 }; 180 jQuery.extend = jQuery.fn.extend = function() { 181 var options, name, src, copy, copyIsArray, clone2, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false; 182 if (typeof target === "boolean") { 183 deep = target; 184 target = arguments[i2] || {}; 185 i2++; 186 } 187 if (typeof target !== "object" && !isFunction2(target)) { 188 target = {}; 189 } 190 if (i2 === length) { 191 target = this; 192 i2--; 193 } 194 for (; i2 < length; i2++) { 195 if ((options = arguments[i2]) != null) { 196 for (name in options) { 197 copy = options[name]; 198 if (name === "__proto__" || target === copy) { 199 continue; 200 } 201 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { 202 src = target[name]; 203 if (copyIsArray && !Array.isArray(src)) { 204 clone2 = []; 205 } else if (!copyIsArray && !jQuery.isPlainObject(src)) { 206 clone2 = {}; 207 } else { 208 clone2 = src; 209 } 210 copyIsArray = false; 211 target[name] = jQuery.extend(deep, clone2, copy); 212 } else if (copy !== void 0) { 213 target[name] = copy; 214 } 215 } 216 } 217 } 218 return target; 219 }; 220 jQuery.extend({ 221 // Unique for each copy of jQuery on the page 222 expando: "jQuery" + (version2 + Math.random()).replace(/\D/g, ""), 223 // Assume jQuery is ready without the ready module 224 isReady: true, 225 error: function(msg) { 226 throw new Error(msg); 227 }, 228 noop: function() { 229 }, 230 isPlainObject: function(obj) { 231 var proto, Ctor; 232 if (!obj || toString.call(obj) !== "[object Object]") { 233 return false; 234 } 235 proto = getProto(obj); 236 if (!proto) { 237 return true; 238 } 239 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 240 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 241 }, 242 isEmptyObject: function(obj) { 243 var name; 244 for (name in obj) { 245 return false; 246 } 247 return true; 248 }, 249 // Evaluates a script in a provided context; falls back to the global one 250 // if not specified. 251 globalEval: function(code, options, doc2) { 252 DOMEval(code, { nonce: options && options.nonce }, doc2); 253 }, 254 each: function(obj, callback) { 255 var length, i2 = 0; 256 if (isArrayLike(obj)) { 257 length = obj.length; 258 for (; i2 < length; i2++) { 259 if (callback.call(obj[i2], i2, obj[i2]) === false) { 260 break; 261 } 262 } 263 } else { 264 for (i2 in obj) { 265 if (callback.call(obj[i2], i2, obj[i2]) === false) { 266 break; 267 } 268 } 269 } 270 return obj; 271 }, 272 // Retrieve the text value of an array of DOM nodes 273 text: function(elem) { 274 var node, ret = "", i2 = 0, nodeType = elem.nodeType; 275 if (!nodeType) { 276 while (node = elem[i2++]) { 277 ret += jQuery.text(node); 278 } 279 } 280 if (nodeType === 1 || nodeType === 11) { 281 return elem.textContent; 282 } 283 if (nodeType === 9) { 284 return elem.documentElement.textContent; 285 } 286 if (nodeType === 3 || nodeType === 4) { 287 return elem.nodeValue; 288 } 289 return ret; 290 }, 291 // results is for internal usage only 292 makeArray: function(arr2, results) { 293 var ret = results || []; 294 if (arr2 != null) { 295 if (isArrayLike(Object(arr2))) { 296 jQuery.merge( 297 ret, 298 typeof arr2 === "string" ? [arr2] : arr2 299 ); 300 } else { 301 push2.call(ret, arr2); 302 } 303 } 304 return ret; 305 }, 306 inArray: function(elem, arr2, i2) { 307 return arr2 == null ? -1 : indexOf.call(arr2, elem, i2); 308 }, 309 isXMLDoc: function(elem) { 310 var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement; 311 return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML"); 312 },
vendor: 35,982 bytes, lines 313-1165
313 // Support: Android <=4.0 only, PhantomJS 1 only 314 // push.apply(_, arraylike) throws on ancient WebKit 315 merge: function(first2, second) { 316 var len2 = +second.length, j2 = 0, i2 = first2.length; 317 for (; j2 < len2; j2++) { 318 first2[i2++] = second[j2]; 319 } 320 first2.length = i2; 321 return first2; 322 }, 323 grep: function(elems, callback, invert) { 324 var callbackInverse, matches = [], i2 = 0, length = elems.length, callbackExpect = !invert; 325 for (; i2 < length; i2++) { 326 callbackInverse = !callback(elems[i2], i2); 327 if (callbackInverse !== callbackExpect) { 328 matches.push(elems[i2]); 329 } 330 } 331 return matches; 332 }, 333 // arg is for internal usage only 334 map: function(elems, callback, arg) { 335 var length, value, i2 = 0, ret = []; 336 if (isArrayLike(elems)) { 337 length = elems.length; 338 for (; i2 < length; i2++) { 339 value = callback(elems[i2], i2, arg); 340 if (value != null) { 341 ret.push(value); 342 } 343 } 344 } else { 345 for (i2 in elems) { 346 value = callback(elems[i2], i2, arg); 347 if (value != null) { 348 ret.push(value); 349 } 350 } 351 } 352 return flat3(ret); 353 }, 354 // A global GUID counter for objects 355 guid: 1, 356 // jQuery.support is not used in Core but other projects attach their 357 // properties to it so it needs to exist. 358 support 359 }); 360 if (typeof Symbol === "function") { 361 jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; 362 } 363 jQuery.each( 364 "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 365 function(_i2, name) { 366 class2type["[object " + name + "]"] = name.toLowerCase(); 367 } 368 ); 369 function isArrayLike(obj) { 370 var length = !!obj && "length" in obj && obj.length, type = toType(obj); 371 if (isFunction2(obj) || isWindow(obj)) { 372 return false; 373 } 374 return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; 375 } 376 function nodeName(elem, name) { 377 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 378 } 379 var pop = arr.pop; 380 var sort = arr.sort; 381 var splice = arr.splice; 382 var whitespace = "[\\x20\\t\\r\\n\\f]"; 383 var rtrimCSS = new RegExp( 384 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 385 "g" 386 ); 387 jQuery.contains = function(a2, b2) { 388 var bup = b2 && b2.parentNode; 389 return a2 === bup || !!(bup && bup.nodeType === 1 && // Support: IE 9 - 11+ 390 // IE doesn't have `contains` on SVG. 391 (a2.contains ? a2.contains(bup) : a2.compareDocumentPosition && a2.compareDocumentPosition(bup) & 16)); 392 }; 393 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 394 function fcssescape(ch, asCodePoint) { 395 if (asCodePoint) { 396 if (ch === "\0") { 397 return "�"; 398 } 399 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 400 } 401 return "\\" + ch; 402 } 403 jQuery.escapeSelector = function(sel) { 404 return (sel + "").replace(rcssescape, fcssescape); 405 }; 406 var preferredDoc = document2, pushNative = push2; 407 (function() { 408 var i2, Expr, outermostContext, sortInput, hasDuplicate, push3 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a2, b2) { 409 if (a2 === b2) { 410 hasDuplicate = true; 411 } 412 return 0; 413 }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) 414 "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 415 `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { 416 ID: new RegExp("^#(" + identifier + ")"), 417 CLASS: new RegExp("^\\.(" + identifier + ")"), 418 TAG: new RegExp("^(" + identifier + "|[*])"), 419 ATTR: new RegExp("^" + attributes), 420 PSEUDO: new RegExp("^" + pseudos), 421 CHILD: new RegExp( 422 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", 423 "i" 424 ), 425 bool: new RegExp("^(?:" + booleans + ")$", "i"), 426 // For use in libraries implementing .is() 427 // We use this for POS matching in `select` 428 needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 429 }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) { 430 var high = "0x" + escape2.slice(1) - 65536; 431 if (nonHex) { 432 return nonHex; 433 } 434 return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); 435 }, unloadHandler = function() { 436 setDocument(); 437 }, inDisabledFieldset = addCombinator( 438 function(elem) { 439 return elem.disabled === true && nodeName(elem, "fieldset"); 440 }, 441 { dir: "parentNode", next: "legend" } 442 ); 443 function safeActiveElement() { 444 try { 445 return document3.activeElement; 446 } catch (err) { 447 } 448 } 449 try { 450 push3.apply( 451 arr = slice.call(preferredDoc.childNodes), 452 preferredDoc.childNodes 453 ); 454 arr[preferredDoc.childNodes.length].nodeType; 455 } catch (e2) { 456 push3 = { 457 apply: function(target, els) { 458 pushNative.apply(target, slice.call(els)); 459 }, 460 call: function(target) { 461 pushNative.apply(target, slice.call(arguments, 1)); 462 } 463 }; 464 } 465 function find4(selector3, context3, results, seed) { 466 var m2, i3, elem, nid, match, groups, newSelector, newContext = context3 && context3.ownerDocument, nodeType = context3 ? context3.nodeType : 9; 467 results = results || []; 468 if (typeof selector3 !== "string" || !selector3 || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 469 return results; 470 } 471 if (!seed) { 472 setDocument(context3); 473 context3 = context3 || document3; 474 if (documentIsHTML) { 475 if (nodeType !== 11 && (match = rquickExpr2.exec(selector3))) { 476 if (m2 = match[1]) { 477 if (nodeType === 9) { 478 if (elem = context3.getElementById(m2)) { 479 if (elem.id === m2) { 480 push3.call(results, elem); 481 return results; 482 } 483 } else { 484 return results; 485 } 486 } else { 487 if (newContext && (elem = newContext.getElementById(m2)) && find4.contains(context3, elem) && elem.id === m2) { 488 push3.call(results, elem); 489 return results; 490 } 491 } 492 } else if (match[2]) { 493 push3.apply(results, context3.getElementsByTagName(selector3)); 494 return results; 495 } else if ((m2 = match[3]) && context3.getElementsByClassName) { 496 push3.apply(results, context3.getElementsByClassName(m2)); 497 return results; 498 } 499 } 500 if (!nonnativeSelectorCache[selector3 + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector3))) { 501 newSelector = selector3; 502 newContext = context3; 503 if (nodeType === 1 && (rdescend.test(selector3) || rleadingCombinator.test(selector3))) { 504 newContext = rsibling.test(selector3) && testContext(context3.parentNode) || context3; 505 if (newContext != context3 || !support.scope) { 506 if (nid = context3.getAttribute("id")) { 507 nid = jQuery.escapeSelector(nid); 508 } else { 509 context3.setAttribute("id", nid = expando); 510 } 511 } 512 groups = tokenize2(selector3); 513 i3 = groups.length; 514 while (i3--) { 515 groups[i3] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i3]); 516 } 517 newSelector = groups.join(","); 518 } 519 try { 520 push3.apply( 521 results, 522 newContext.querySelectorAll(newSelector) 523 ); 524 return results; 525 } catch (qsaError) { 526 nonnativeSelectorCache(selector3, true); 527 } finally { 528 if (nid === expando) { 529 context3.removeAttribute("id"); 530 } 531 } 532 } 533 } 534 } 535 return select(selector3.replace(rtrimCSS, "$1"), context3, results, seed); 536 } 537 function createCache() { 538 var keys = []; 539 function cache2(key2, value) { 540 if (keys.push(key2 + " ") > Expr.cacheLength) { 541 delete cache2[keys.shift()]; 542 } 543 return cache2[key2 + " "] = value; 544 } 545 return cache2; 546 } 547 function markFunction(fn) { 548 fn[expando] = true; 549 return fn; 550 } 551 function assert(fn) { 552 var el = document3.createElement("fieldset"); 553 try { 554 return !!fn(el); 555 } catch (e2) { 556 return false; 557 } finally { 558 if (el.parentNode) { 559 el.parentNode.removeChild(el); 560 } 561 el = null; 562 } 563 } 564 function createInputPseudo(type) { 565 return function(elem) { 566 return nodeName(elem, "input") && elem.type === type; 567 }; 568 } 569 function createButtonPseudo(type) { 570 return function(elem) { 571 return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type; 572 }; 573 } 574 function createDisabledPseudo(disabled) { 575 return function(elem) { 576 if ("form" in elem) { 577 if (elem.parentNode && elem.disabled === false) { 578 if ("label" in elem) { 579 if ("label" in elem.parentNode) { 580 return elem.parentNode.disabled === disabled; 581 } else { 582 return elem.disabled === disabled; 583 } 584 } 585 return elem.isDisabled === disabled || // Where there is no isDisabled, check manually 586 elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled; 587 } 588 return elem.disabled === disabled; 589 } else if ("label" in elem) { 590 return elem.disabled === disabled; 591 } 592 return false; 593 }; 594 } 595 function createPositionalPseudo(fn) { 596 return markFunction(function(argument) { 597 argument = +argument; 598 return markFunction(function(seed, matches2) { 599 var j2, matchIndexes = fn([], seed.length, argument), i3 = matchIndexes.length; 600 while (i3--) { 601 if (seed[j2 = matchIndexes[i3]]) { 602 seed[j2] = !(matches2[j2] = seed[j2]); 603 } 604 } 605 }); 606 }); 607 } 608 function testContext(context3) { 609 return context3 && typeof context3.getElementsByTagName !== "undefined" && context3; 610 } 611 function setDocument(node) { 612 var subWindow, doc2 = node ? node.ownerDocument || node : preferredDoc; 613 if (doc2 == document3 || doc2.nodeType !== 9 || !doc2.documentElement) { 614 return document3; 615 } 616 document3 = doc2; 617 documentElement2 = document3.documentElement; 618 documentIsHTML = !jQuery.isXMLDoc(document3); 619 matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector; 620 if (documentElement2.msMatchesSelector && // Support: IE 11+, Edge 17 - 18+ 621 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 622 // two documents; shallow comparisons work. 623 // eslint-disable-next-line eqeqeq 624 preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) { 625 subWindow.addEventListener("unload", unloadHandler); 626 } 627 support.getById = assert(function(el) { 628 documentElement2.appendChild(el).id = jQuery.expando; 629 return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length; 630 }); 631 support.disconnectedMatch = assert(function(el) { 632 return matches.call(el, "*"); 633 }); 634 support.scope = assert(function() { 635 return document3.querySelectorAll(":scope"); 636 }); 637 support.cssHas = assert(function() { 638 try { 639 document3.querySelector(":has(*,:jqfake)"); 640 return false; 641 } catch (e2) { 642 return true; 643 } 644 }); 645 if (support.getById) { 646 Expr.filter.ID = function(id2) { 647 var attrId = id2.replace(runescape, funescape); 648 return function(elem) { 649 return elem.getAttribute("id") === attrId; 650 }; 651 }; 652 Expr.find.ID = function(id2, context3) { 653 if (typeof context3.getElementById !== "undefined" && documentIsHTML) { 654 var elem = context3.getElementById(id2); 655 return elem ? [elem] : []; 656 } 657 }; 658 } else { 659 Expr.filter.ID = function(id2) { 660 var attrId = id2.replace(runescape, funescape); 661 return function(elem) { 662 var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 663 return node2 && node2.value === attrId; 664 }; 665 }; 666 Expr.find.ID = function(id2, context3) { 667 if (typeof context3.getElementById !== "undefined" && documentIsHTML) { 668 var node2, i3, elems, elem = context3.getElementById(id2); 669 if (elem) { 670 node2 = elem.getAttributeNode("id"); 671 if (node2 && node2.value === id2) { 672 return [elem]; 673 } 674 elems = context3.getElementsByName(id2); 675 i3 = 0; 676 while (elem = elems[i3++]) { 677 node2 = elem.getAttributeNode("id"); 678 if (node2 && node2.value === id2) { 679 return [elem]; 680 } 681 } 682 } 683 return []; 684 } 685 }; 686 } 687 Expr.find.TAG = function(tag, context3) { 688 if (typeof context3.getElementsByTagName !== "undefined") { 689 return context3.getElementsByTagName(tag); 690 } else { 691 return context3.querySelectorAll(tag); 692 } 693 }; 694 Expr.find.CLASS = function(className, context3) { 695 if (typeof context3.getElementsByClassName !== "undefined" && documentIsHTML) { 696 return context3.getElementsByClassName(className); 697 } 698 }; 699 rbuggyQSA = []; 700 assert(function(el) { 701 var input; 702 documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a><select id='" + expando + "-\r\\' disabled='disabled'><option selected=''></option></select>"; 703 if (!el.querySelectorAll("[selected]").length) { 704 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 705 } 706 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 707 rbuggyQSA.push("~="); 708 } 709 if (!el.querySelectorAll("a#" + expando + "+*").length) { 710 rbuggyQSA.push(".#.+[+~]"); 711 } 712 if (!el.querySelectorAll(":checked").length) { 713 rbuggyQSA.push(":checked"); 714 } 715 input = document3.createElement("input"); 716 input.setAttribute("type", "hidden"); 717 el.appendChild(input).setAttribute("name", "D"); 718 documentElement2.appendChild(el).disabled = true; 719 if (el.querySelectorAll(":disabled").length !== 2) { 720 rbuggyQSA.push(":enabled", ":disabled"); 721 } 722 input = document3.createElement("input"); 723 input.setAttribute("name", ""); 724 el.appendChild(input); 725 if (!el.querySelectorAll("[name='']").length) { 726 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`); 727 } 728 }); 729 if (!support.cssHas) { 730 rbuggyQSA.push(":has"); 731 } 732 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 733 sortOrder = function(a2, b2) { 734 if (a2 === b2) { 735 hasDuplicate = true; 736 return 0; 737 } 738 var compare = !a2.compareDocumentPosition - !b2.compareDocumentPosition; 739 if (compare) { 740 return compare; 741 } 742 compare = (a2.ownerDocument || a2) == (b2.ownerDocument || b2) ? a2.compareDocumentPosition(b2) : ( 743 // Otherwise we know they are disconnected 744 1 745 ); 746 if (compare & 1 || !support.sortDetached && b2.compareDocumentPosition(a2) === compare) { 747 if (a2 === document3 || a2.ownerDocument == preferredDoc && find4.contains(preferredDoc, a2)) { 748 return -1; 749 } 750 if (b2 === document3 || b2.ownerDocument == preferredDoc && find4.contains(preferredDoc, b2)) { 751 return 1; 752 } 753 return sortInput ? indexOf.call(sortInput, a2) - indexOf.call(sortInput, b2) : 0; 754 } 755 return compare & 4 ? -1 : 1; 756 }; 757 return document3; 758 } 759 find4.matches = function(expr, elements) { 760 return find4(expr, null, null, elements); 761 }; 762 find4.matchesSelector = function(elem, expr) { 763 setDocument(elem); 764 if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) { 765 try { 766 var ret = matches.call(elem, expr); 767 if (ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document 768 // fragment in IE 9 769 elem.document && elem.document.nodeType !== 11) { 770 return ret; 771 } 772 } catch (e2) { 773 nonnativeSelectorCache(expr, true); 774 } 775 } 776 return find4(expr, document3, null, [elem]).length > 0; 777 }; 778 find4.contains = function(context3, elem) { 779 if ((context3.ownerDocument || context3) != document3) { 780 setDocument(context3); 781 } 782 return jQuery.contains(context3, elem); 783 }; 784 find4.attr = function(elem, name) { 785 if ((elem.ownerDocument || elem) != document3) { 786 setDocument(elem); 787 } 788 var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : void 0; 789 if (val !== void 0) { 790 return val; 791 } 792 return elem.getAttribute(name); 793 }; 794 find4.error = function(msg) { 795 throw new Error("Syntax error, unrecognized expression: " + msg); 796 }; 797 jQuery.uniqueSort = function(results) { 798 var elem, duplicates = [], j2 = 0, i3 = 0; 799 hasDuplicate = !support.sortStable; 800 sortInput = !support.sortStable && slice.call(results, 0); 801 sort.call(results, sortOrder); 802 if (hasDuplicate) { 803 while (elem = results[i3++]) { 804 if (elem === results[i3]) { 805 j2 = duplicates.push(i3); 806 } 807 } 808 while (j2--) { 809 splice.call(results, duplicates[j2], 1); 810 } 811 } 812 sortInput = null; 813 return results; 814 }; 815 jQuery.fn.uniqueSort = function() { 816 return this.pushStack(jQuery.uniqueSort(slice.apply(this))); 817 }; 818 Expr = jQuery.expr = { 819 // Can be adjusted by the user 820 cacheLength: 50, 821 createPseudo: markFunction, 822 match: matchExpr, 823 attrHandle: {}, 824 find: {}, 825 relative: { 826 ">": { dir: "parentNode", first: true }, 827 " ": { dir: "parentNode" }, 828 "+": { dir: "previousSibling", first: true }, 829 "~": { dir: "previousSibling" } 830 }, 831 preFilter: { 832 ATTR: function(match) { 833 match[1] = match[1].replace(runescape, funescape); 834 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); 835 if (match[2] === "~=") { 836 match[3] = " " + match[3] + " "; 837 } 838 return match.slice(0, 4); 839 }, 840 CHILD: function(match) { 841 match[1] = match[1].toLowerCase(); 842 if (match[1].slice(0, 3) === "nth") { 843 if (!match[3]) { 844 find4.error(match[0]); 845 } 846 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); 847 match[5] = +(match[7] + match[8] || match[3] === "odd"); 848 } else if (match[3]) { 849 find4.error(match[0]); 850 } 851 return match; 852 }, 853 PSEUDO: function(match) { 854 var excess, unquoted = !match[6] && match[2]; 855 if (matchExpr.CHILD.test(match[0])) { 856 return null; 857 } 858 if (match[3]) { 859 match[2] = match[4] || match[5] || ""; 860 } else if (unquoted && rpseudo.test(unquoted) && // Get excess from tokenize (recursively) 861 (excess = tokenize2(unquoted, true)) && // advance to the next closing parenthesis 862 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 863 match[0] = match[0].slice(0, excess); 864 match[2] = unquoted.slice(0, excess); 865 } 866 return match.slice(0, 3); 867 } 868 }, 869 filter: { 870 TAG: function(nodeNameSelector) { 871 var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 872 return nodeNameSelector === "*" ? function() { 873 return true; 874 } : function(elem) { 875 return nodeName(elem, expectedNodeName); 876 }; 877 }, 878 CLASS: function(className) { 879 var pattern = classCache[className + " "]; 880 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) { 881 return pattern.test( 882 typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" 883 ); 884 }); 885 }, 886 ATTR: function(name, operator, check) { 887 return function(elem) { 888 var result = find4.attr(elem, name); 889 if (result == null) { 890 return operator === "!="; 891 } 892 if (!operator) { 893 return true; 894 } 895 result += ""; 896 if (operator === "=") { 897 return result === check; 898 } 899 if (operator === "!=") { 900 return result !== check; 901 } 902 if (operator === "^=") { 903 return check && result.indexOf(check) === 0; 904 } 905 if (operator === "*=") { 906 return check && result.indexOf(check) > -1; 907 } 908 if (operator === "$=") { 909 return check && result.slice(-check.length) === check; 910 } 911 if (operator === "~=") { 912 return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1; 913 } 914 if (operator === "|=") { 915 return result === check || result.slice(0, check.length + 1) === check + "-"; 916 } 917 return false; 918 }; 919 }, 920 CHILD: function(type, what, _argument, first2, last2) { 921 var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type"; 922 return first2 === 1 && last2 === 0 ? ( 923 // Shortcut for :nth-*(n) 924 function(elem) { 925 return !!elem.parentNode; 926 } 927 ) : function(elem, _context2, xml) { 928 var cache2, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; 929 if (parent) { 930 if (simple) { 931 while (dir2) { 932 node = elem; 933 while (node = node[dir2]) { 934 if (ofType ? nodeName(node, name) : node.nodeType === 1) { 935 return false; 936 } 937 } 938 start2 = dir2 = type === "only" && !start2 && "nextSibling"; 939 } 940 return true; 941 } 942 start2 = [forward ? parent.firstChild : parent.lastChild]; 943 if (forward && useCache) { 944 outerCache = parent[expando] || (parent[expando] = {}); 945 cache2 = outerCache[type] || []; 946 nodeIndex = cache2[0] === dirruns && cache2[1]; 947 diff = nodeIndex && cache2[2]; 948 node = nodeIndex && parent.childNodes[nodeIndex]; 949 while (node = ++nodeIndex && node && node[dir2] || // Fallback to seeking `elem` from the start 950 (diff = nodeIndex = 0) || start2.pop()) { 951 if (node.nodeType === 1 && ++diff && node === elem) { 952 outerCache[type] = [dirruns, nodeIndex, diff]; 953 break; 954 } 955 } 956 } else { 957 if (useCache) { 958 outerCache = elem[expando] || (elem[expando] = {}); 959 cache2 = outerCache[type] || []; 960 nodeIndex = cache2[0] === dirruns && cache2[1]; 961 diff = nodeIndex; 962 } 963 if (diff === false) { 964 while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) { 965 if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) { 966 if (useCache) { 967 outerCache = node[expando] || (node[expando] = {}); 968 outerCache[type] = [dirruns, diff]; 969 } 970 if (node === elem) { 971 break; 972 } 973 } 974 } 975 } 976 } 977 diff -= last2; 978 return diff === first2 || diff % first2 === 0 && diff / first2 >= 0; 979 } 980 }; 981 }, 982 PSEUDO: function(pseudo, argument) { 983 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find4.error("unsupported pseudo: " + pseudo); 984 if (fn[expando]) { 985 return fn(argument); 986 } 987 if (fn.length > 1) { 988 args = [pseudo, pseudo, "", argument]; 989 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) { 990 var idx, matched = fn(seed, argument), i3 = matched.length; 991 while (i3--) { 992 idx = indexOf.call(seed, matched[i3]); 993 seed[idx] = !(matches2[idx] = matched[i3]); 994 } 995 }) : function(elem) { 996 return fn(elem, 0, args); 997 }; 998 } 999 return fn; 1000 } 1001 }, 1002 pseudos: { 1003 // Potentially complex pseudos 1004 not: markFunction(function(selector3) { 1005 var input = [], results = [], matcher = compile(selector3.replace(rtrimCSS, "$1")); 1006 return matcher[expando] ? markFunction(function(seed, matches2, _context2, xml) { 1007 var elem, unmatched = matcher(seed, null, xml, []), i3 = seed.length; 1008 while (i3--) { 1009 if (elem = unmatched[i3]) { 1010 seed[i3] = !(matches2[i3] = elem); 1011 } 1012 } 1013 }) : function(elem, _context2, xml) { 1014 input[0] = elem; 1015 matcher(input, null, xml, results); 1016 input[0] = null; 1017 return !results.pop(); 1018 }; 1019 }), 1020 has: markFunction(function(selector3) { 1021 return function(elem) { 1022 return find4(selector3, elem).length > 0; 1023 }; 1024 }), 1025 contains: markFunction(function(text) { 1026 text = text.replace(runescape, funescape); 1027 return function(elem) { 1028 return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1; 1029 }; 1030 }), 1031 // "Whether an element is represented by a :lang() selector 1032 // is based solely on the element's language value 1033 // being equal to the identifier C, 1034 // or beginning with the identifier C immediately followed by "-". 1035 // The matching of C against the element's language value is performed case-insensitively. 1036 // The identifier C does not have to be a valid language name." 1037 // https://www.w3.org/TR/selectors/#lang-pseudo 1038 lang: markFunction(function(lang) { 1039 if (!ridentifier.test(lang || "")) { 1040 find4.error("unsupported lang: " + lang); 1041 } 1042 lang = lang.replace(runescape, funescape).toLowerCase(); 1043 return function(elem) { 1044 var elemLang; 1045 do { 1046 if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { 1047 elemLang = elemLang.toLowerCase(); 1048 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 1049 } 1050 } while ((elem = elem.parentNode) && elem.nodeType === 1); 1051 return false; 1052 }; 1053 }), 1054 // Miscellaneous 1055 target: function(elem) { 1056 var hash = window2.location && window2.location.hash; 1057 return hash && hash.slice(1) === elem.id; 1058 }, 1059 root: function(elem) { 1060 return elem === documentElement2; 1061 }, 1062 focus: function(elem) { 1063 return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex); 1064 }, 1065 // Boolean properties 1066 enabled: createDisabledPseudo(false), 1067 disabled: createDisabledPseudo(true), 1068 checked: function(elem) { 1069 return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected; 1070 }, 1071 selected: function(elem) { 1072 if (elem.parentNode) { 1073 elem.parentNode.selectedIndex; 1074 } 1075 return elem.selected === true; 1076 }, 1077 // Contents 1078 empty: function(elem) { 1079 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1080 if (elem.nodeType < 6) { 1081 return false; 1082 } 1083 } 1084 return true; 1085 }, 1086 parent: function(elem) { 1087 return !Expr.pseudos.empty(elem); 1088 }, 1089 // Element/input types 1090 header: function(elem) { 1091 return rheader.test(elem.nodeName); 1092 }, 1093 input: function(elem) { 1094 return rinputs.test(elem.nodeName); 1095 }, 1096 button: function(elem) { 1097 return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button"); 1098 }, 1099 text: function(elem) { 1100 var attr; 1101 return nodeName(elem, "input") && elem.type === "text" && // Support: IE <10 only 1102 // New HTML5 attribute values (e.g., "search") appear 1103 // with elem.type === "text" 1104 ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); 1105 }, 1106 // Position-in-collection 1107 first: createPositionalPseudo(function() { 1108 return [0]; 1109 }), 1110 last: createPositionalPseudo(function(_matchIndexes, length) { 1111 return [length - 1]; 1112 }), 1113 eq: createPositionalPseudo(function(_matchIndexes, length, argument) { 1114 return [argument < 0 ? argument + length : argument]; 1115 }), 1116 even: createPositionalPseudo(function(matchIndexes, length) { 1117 var i3 = 0; 1118 for (; i3 < length; i3 += 2) { 1119 matchIndexes.push(i3); 1120 } 1121 return matchIndexes; 1122 }), 1123 odd: createPositionalPseudo(function(matchIndexes, length) { 1124 var i3 = 1; 1125 for (; i3 < length; i3 += 2) { 1126 matchIndexes.push(i3); 1127 } 1128 return matchIndexes; 1129 }), 1130 lt: createPositionalPseudo(function(matchIndexes, length, argument) { 1131 var i3; 1132 if (argument < 0) { 1133 i3 = argument + length; 1134 } else if (argument > length) { 1135 i3 = length; 1136 } else { 1137 i3 = argument; 1138 } 1139 for (; --i3 >= 0; ) { 1140 matchIndexes.push(i3); 1141 } 1142 return matchIndexes; 1143 }), 1144 gt: createPositionalPseudo(function(matchIndexes, length, argument) { 1145 var i3 = argument < 0 ? argument + length : argument; 1146 for (; ++i3 < length; ) { 1147 matchIndexes.push(i3); 1148 } 1149 return matchIndexes; 1150 }) 1151 } 1152 }; 1153 Expr.pseudos.nth = Expr.pseudos.eq; 1154 for (i2 in { radio: true, checkbox: true, file: true, password: true, image: true }) { 1155 Expr.pseudos[i2] = createInputPseudo(i2); 1156 } 1157 for (i2 in { submit: true, reset: true }) { 1158 Expr.pseudos[i2] = createButtonPseudo(i2); 1159 } 1160 function setFilters() { 1161 } 1162 setFilters.prototype = Expr.filters = Expr.pseudos; 1163 Expr.setFilters = new setFilters(); 1164 function tokenize2(selector3, parseOnly) { 1165 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[
vendor: 13,571 bytes, lines 1165-1510
1165selector3 + " "]; 1166 if (cached) { 1167 return parseOnly ? 0 : cached.slice(0); 1168 } 1169 soFar = selector3; 1170 groups = []; 1171 preFilters = Expr.preFilter; 1172 while (soFar) { 1173 if (!matched || (match = rcomma.exec(soFar))) { 1174 if (match) { 1175 soFar = soFar.slice(match[0].length) || soFar; 1176 } 1177 groups.push(tokens = []); 1178 } 1179 matched = false; 1180 if (match = rleadingCombinator.exec(soFar)) { 1181 matched = match.shift(); 1182 tokens.push({ 1183 value: matched, 1184 // Cast descendant combinators to space 1185 type: match[0].replace(rtrimCSS, " ") 1186 }); 1187 soFar = soFar.slice(matched.length); 1188 } 1189 for (type in Expr.filter) { 1190 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { 1191 matched = match.shift(); 1192 tokens.push({ 1193 value: matched, 1194 type, 1195 matches: match 1196 }); 1197 soFar = soFar.slice(matched.length); 1198 } 1199 } 1200 if (!matched) { 1201 break; 1202 } 1203 } 1204 if (parseOnly) { 1205 return soFar.length; 1206 } 1207 return soFar ? find4.error(selector3) : ( 1208 // Cache the tokens 1209 tokenCache(selector3, groups).slice(0) 1210 ); 1211 } 1212 function toSelector(tokens) { 1213 var i3 = 0, len2 = tokens.length, selector3 = ""; 1214 for (; i3 < len2; i3++) { 1215 selector3 += tokens[i3].value; 1216 } 1217 return selector3; 1218 } 1219 function addCombinator(matcher, combinator, base) { 1220 var dir2 = combinator.dir, skip = combinator.next, key2 = skip || dir2, checkNonElements = base && key2 === "parentNode", doneName = done++; 1221 return combinator.first ? ( 1222 // Check against closest ancestor/preceding element 1223 function(elem, context3, xml) { 1224 while (elem = elem[dir2]) { 1225 if (elem.nodeType === 1 || checkNonElements) { 1226 return matcher(elem, context3, xml); 1227 } 1228 } 1229 return false; 1230 } 1231 ) : ( 1232 // Check against all ancestor/preceding elements 1233 function(elem, context3, xml) { 1234 var oldCache, outerCache, newCache = [dirruns, doneName]; 1235 if (xml) { 1236 while (elem = elem[dir2]) { 1237 if (elem.nodeType === 1 || checkNonElements) { 1238 if (matcher(elem, context3, xml)) { 1239 return true; 1240 } 1241 } 1242 } 1243 } else { 1244 while (elem = elem[dir2]) { 1245 if (elem.nodeType === 1 || checkNonElements) { 1246 outerCache = elem[expando] || (elem[expando] = {}); 1247 if (skip && nodeName(elem, skip)) { 1248 elem = elem[dir2] || elem; 1249 } else if ((oldCache = outerCache[key2]) && oldCache[0] === dirruns && oldCache[1] === doneName) { 1250 return newCache[2] = oldCache[2]; 1251 } else { 1252 outerCache[key2] = newCache; 1253 if (newCache[2] = matcher(elem, context3, xml)) { 1254 return true; 1255 } 1256 } 1257 } 1258 } 1259 } 1260 return false; 1261 } 1262 ); 1263 } 1264 function elementMatcher(matchers) { 1265 return matchers.length > 1 ? function(elem, context3, xml) { 1266 var i3 = matchers.length; 1267 while (i3--) { 1268 if (!matchers[i3](elem, context3, xml)) { 1269 return false; 1270 } 1271 } 1272 return true; 1273 } : matchers[0]; 1274 } 1275 function multipleContexts(selector3, contexts, results) { 1276 var i3 = 0, len2 = contexts.length; 1277 for (; i3 < len2; i3++) { 1278 find4(selector3, contexts[i3], results); 1279 } 1280 return results; 1281 } 1282 function condense(unmatched, map, filter, context3, xml) { 1283 var elem, newUnmatched = [], i3 = 0, len2 = unmatched.length, mapped = map != null; 1284 for (; i3 < len2; i3++) { 1285 if (elem = unmatched[i3]) { 1286 if (!filter || filter(elem, context3, xml)) { 1287 newUnmatched.push(elem); 1288 if (mapped) { 1289 map.push(i3); 1290 } 1291 } 1292 } 1293 } 1294 return newUnmatched; 1295 } 1296 function setMatcher(preFilter, selector3, matcher, postFilter, postFinder, postSelector) { 1297 if (postFilter && !postFilter[expando]) { 1298 postFilter = setMatcher(postFilter); 1299 } 1300 if (postFinder && !postFinder[expando]) { 1301 postFinder = setMatcher(postFinder, postSelector); 1302 } 1303 return markFunction(function(seed, results, context3, xml) { 1304 var temp, i3, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts( 1305 selector3 || "*", 1306 context3.nodeType ? [context3] : context3, 1307 [] 1308 ), matcherIn = preFilter && (seed || !selector3) ? condense(elems, preMap, preFilter, context3, xml) : elems; 1309 if (matcher) { 1310 matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? ( 1311 // ...intermediate processing is necessary 1312 [] 1313 ) : ( 1314 // ...otherwise use results directly 1315 results 1316 ); 1317 matcher(matcherIn, matcherOut, context3, xml); 1318 } else { 1319 matcherOut = matcherIn; 1320 } 1321 if (postFilter) { 1322 temp = condense(matcherOut, postMap); 1323 postFilter(temp, [], context3, xml); 1324 i3 = temp.length; 1325 while (i3--) { 1326 if (elem = temp[i3]) { 1327 matcherOut[postMap[i3]] = !(matcherIn[postMap[i3]] = elem); 1328 } 1329 } 1330 } 1331 if (seed) { 1332 if (postFinder || preFilter) { 1333 if (postFinder) { 1334 temp = []; 1335 i3 = matcherOut.length; 1336 while (i3--) { 1337 if (elem = matcherOut[i3]) { 1338 temp.push(matcherIn[i3] = elem); 1339 } 1340 } 1341 postFinder(null, matcherOut = [], temp, xml); 1342 } 1343 i3 = matcherOut.length; 1344 while (i3--) { 1345 if ((elem = matcherOut[i3]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i3]) > -1) { 1346 seed[temp] = !(results[temp] = elem); 1347 } 1348 } 1349 } 1350 } else { 1351 matcherOut = condense( 1352 matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut 1353 ); 1354 if (postFinder) { 1355 postFinder(null, results, matcherOut, xml); 1356 } else { 1357 push3.apply(results, matcherOut); 1358 } 1359 } 1360 }); 1361 } 1362 function matcherFromTokens(tokens) { 1363 var checkContext, matcher, j2, len2 = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i3 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) { 1364 return elem === checkContext; 1365 }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) { 1366 return indexOf.call(checkContext, elem) > -1; 1367 }, implicitRelative, true), matchers = [function(elem, context3, xml) { 1368 var ret = !leadingRelative && (xml || context3 != outermostContext) || ((checkContext = context3).nodeType ? matchContext(elem, context3, xml) : matchAnyContext(elem, context3, xml)); 1369 checkContext = null; 1370 return ret; 1371 }]; 1372 for (; i3 < len2; i3++) { 1373 if (matcher = Expr.relative[tokens[i3].type]) { 1374 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 1375 } else { 1376 matcher = Expr.filter[tokens[i3].type].apply(null, tokens[i3].matches); 1377 if (matcher[expando]) { 1378 j2 = ++i3; 1379 for (; j2 < len2; j2++) { 1380 if (Expr.relative[tokens[j2].type]) { 1381 break; 1382 } 1383 } 1384 return setMatcher( 1385 i3 > 1 && elementMatcher(matchers), 1386 i3 > 1 && toSelector( 1387 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 1388 tokens.slice(0, i3 - 1).concat({ value: tokens[i3 - 2].type === " " ? "*" : "" }) 1389 ).replace(rtrimCSS, "$1"), 1390 matcher, 1391 i3 < j2 && matcherFromTokens(tokens.slice(i3, j2)), 1392 j2 < len2 && matcherFromTokens(tokens = tokens.slice(j2)), 1393 j2 < len2 && toSelector(tokens) 1394 ); 1395 } 1396 matchers.push(matcher); 1397 } 1398 } 1399 return elementMatcher(matchers); 1400 } 1401 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 1402 var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context3, xml, results, outermost) { 1403 var elem, j2, matcher, matchedCount = 0, i3 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len2 = elems.length; 1404 if (outermost) { 1405 outermostContext = context3 == document3 || context3 || outermost; 1406 } 1407 for (; i3 !== len2 && (elem = elems[i3]) != null; i3++) { 1408 if (byElement && elem) { 1409 j2 = 0; 1410 if (!context3 && elem.ownerDocument != document3) { 1411 setDocument(elem); 1412 xml = !documentIsHTML; 1413 } 1414 while (matcher = elementMatchers[j2++]) { 1415 if (matcher(elem, context3 || document3, xml)) { 1416 push3.call(results, elem); 1417 break; 1418 } 1419 } 1420 if (outermost) { 1421 dirruns = dirrunsUnique; 1422 } 1423 } 1424 if (bySet) { 1425 if (elem = !matcher && elem) { 1426 matchedCount--; 1427 } 1428 if (seed) { 1429 unmatched.push(elem); 1430 } 1431 } 1432 } 1433 matchedCount += i3; 1434 if (bySet && i3 !== matchedCount) { 1435 j2 = 0; 1436 while (matcher = setMatchers[j2++]) { 1437 matcher(unmatched, setMatched, context3, xml); 1438 } 1439 if (seed) { 1440 if (matchedCount > 0) { 1441 while (i3--) { 1442 if (!(unmatched[i3] || setMatched[i3])) { 1443 setMatched[i3] = pop.call(results); 1444 } 1445 } 1446 } 1447 setMatched = condense(setMatched); 1448 } 1449 push3.apply(results, setMatched); 1450 if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { 1451 jQuery.uniqueSort(results); 1452 } 1453 } 1454 if (outermost) { 1455 dirruns = dirrunsUnique; 1456 outermostContext = contextBackup; 1457 } 1458 return unmatched; 1459 }; 1460 return bySet ? markFunction(superMatcher) : superMatcher; 1461 } 1462 function compile(selector3, match) { 1463 var i3, setMatchers = [], elementMatchers = [], cached = compilerCache[selector3 + " "]; 1464 if (!cached) { 1465 if (!match) { 1466 match = tokenize2(selector3); 1467 } 1468 i3 = match.length; 1469 while (i3--) { 1470 cached = matcherFromTokens(match[i3]); 1471 if (cached[expando]) { 1472 setMatchers.push(cached); 1473 } else { 1474 elementMatchers.push(cached); 1475 } 1476 } 1477 cached = compilerCache( 1478 selector3, 1479 matcherFromGroupMatchers(elementMatchers, setMatchers) 1480 ); 1481 cached.selector = selector3; 1482 } 1483 return cached; 1484 } 1485 function select(selector3, context3, results, seed) { 1486 var i3, tokens, token, type, find5, compiled = typeof selector3 === "function" && selector3, match = !seed && tokenize2(selector3 = compiled.selector || selector3); 1487 results = results || []; 1488 if (match.length === 1) { 1489 tokens = match[0] = match[0].slice(0); 1490 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context3.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 1491 context3 = (Expr.find.ID( 1492 token.matches[0].replace(runescape, funescape), 1493 context3 1494 ) || [])[0]; 1495 if (!context3) { 1496 return results; 1497 } else if (compiled) { 1498 context3 = context3.parentNode; 1499 } 1500 selector3 = selector3.slice(tokens.shift().value.length); 1501 } 1502 i3 = matchExpr.needsContext.test(selector3) ? 0 : tokens.length; 1503 while (i3--) { 1504 token = tokens[i3]; 1505 if (Expr.relative[type = token.type]) { 1506 break; 1507 } 1508 if (find5 = Expr.find[type]) { 1509 if (seed = find5( 1510 token.matches[0].replace(runescape, funescape),
vendor: 98,863 bytes, lines 1511-4266
1511 rsibling.test(tokens[0].type) && testContext(context3.parentNode) || context3 1512 )) { 1513 tokens.splice(i3, 1); 1514 selector3 = seed.length && toSelector(tokens); 1515 if (!selector3) { 1516 push3.apply(results, seed); 1517 return results; 1518 } 1519 break; 1520 } 1521 } 1522 } 1523 } 1524 (compiled || compile(selector3, match))( 1525 seed, 1526 context3, 1527 !documentIsHTML, 1528 results, 1529 !context3 || rsibling.test(selector3) && testContext(context3.parentNode) || context3 1530 ); 1531 return results; 1532 } 1533 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 1534 setDocument(); 1535 support.sortDetached = assert(function(el) { 1536 return el.compareDocumentPosition(document3.createElement("fieldset")) & 1; 1537 }); 1538 jQuery.find = find4; 1539 jQuery.expr[":"] = jQuery.expr.pseudos; 1540 jQuery.unique = jQuery.uniqueSort; 1541 find4.compile = compile; 1542 find4.select = select; 1543 find4.setDocument = setDocument; 1544 find4.tokenize = tokenize2; 1545 find4.escape = jQuery.escapeSelector; 1546 find4.getText = jQuery.text; 1547 find4.isXML = jQuery.isXMLDoc; 1548 find4.selectors = jQuery.expr; 1549 find4.support = jQuery.support; 1550 find4.uniqueSort = jQuery.uniqueSort; 1551 })(); 1552 var dir = function(elem, dir2, until) { 1553 var matched = [], truncate = until !== void 0; 1554 while ((elem = elem[dir2]) && elem.nodeType !== 9) { 1555 if (elem.nodeType === 1) { 1556 if (truncate && jQuery(elem).is(until)) { 1557 break; 1558 } 1559 matched.push(elem); 1560 } 1561 } 1562 return matched; 1563 }; 1564 var siblings = function(n2, elem) { 1565 var matched = []; 1566 for (; n2; n2 = n2.nextSibling) { 1567 if (n2.nodeType === 1 && n2 !== elem) { 1568 matched.push(n2); 1569 } 1570 } 1571 return matched; 1572 }; 1573 var rneedsContext = jQuery.expr.match.needsContext; 1574 var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; 1575 function winnow(elements, qualifier, not) { 1576 if (isFunction2(qualifier)) { 1577 return jQuery.grep(elements, function(elem, i2) { 1578 return !!qualifier.call(elem, i2, elem) !== not; 1579 }); 1580 } 1581 if (qualifier.nodeType) { 1582 return jQuery.grep(elements, function(elem) { 1583 return elem === qualifier !== not; 1584 }); 1585 } 1586 if (typeof qualifier !== "string") { 1587 return jQuery.grep(elements, function(elem) { 1588 return indexOf.call(qualifier, elem) > -1 !== not; 1589 }); 1590 } 1591 return jQuery.filter(qualifier, elements, not); 1592 } 1593 jQuery.filter = function(expr, elems, not) { 1594 var elem = elems[0]; 1595 if (not) { 1596 expr = ":not(" + expr + ")"; 1597 } 1598 if (elems.length === 1 && elem.nodeType === 1) { 1599 return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; 1600 } 1601 return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) { 1602 return elem2.nodeType === 1; 1603 })); 1604 }; 1605 jQuery.fn.extend({ 1606 find: function(selector3) { 1607 var i2, ret, len2 = this.length, self2 = this; 1608 if (typeof selector3 !== "string") { 1609 return this.pushStack(jQuery(selector3).filter(function() { 1610 for (i2 = 0; i2 < len2; i2++) { 1611 if (jQuery.contains(self2[i2], this)) { 1612 return true; 1613 } 1614 } 1615 })); 1616 } 1617 ret = this.pushStack([]); 1618 for (i2 = 0; i2 < len2; i2++) { 1619 jQuery.find(selector3, self2[i2], ret); 1620 } 1621 return len2 > 1 ? jQuery.uniqueSort(ret) : ret; 1622 }, 1623 filter: function(selector3) { 1624 return this.pushStack(winnow(this, selector3 || [], false)); 1625 }, 1626 not: function(selector3) { 1627 return this.pushStack(winnow(this, selector3 || [], true)); 1628 }, 1629 is: function(selector3) { 1630 return !!winnow( 1631 this, 1632 // If this is a positional/relative selector, check membership in the returned set 1633 // so $("p:first").is("p:last") won't return true for a doc with two "p". 1634 typeof selector3 === "string" && rneedsContext.test(selector3) ? jQuery(selector3) : selector3 || [], 1635 false 1636 ).length; 1637 } 1638 }); 1639 var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init7 = jQuery.fn.init = function(selector3, context3, root) { 1640 var match, elem; 1641 if (!selector3) { 1642 return this; 1643 } 1644 root = root || rootjQuery; 1645 if (typeof selector3 === "string") { 1646 if (selector3[0] === "<" && selector3[selector3.length - 1] === ">" && selector3.length >= 3) { 1647 match = [null, selector3, null]; 1648 } else { 1649 match = rquickExpr.exec(selector3); 1650 } 1651 if (match && (match[1] || !context3)) { 1652 if (match[1]) { 1653 context3 = context3 instanceof jQuery ? context3[0] : context3; 1654 jQuery.merge(this, jQuery.parseHTML( 1655 match[1], 1656 context3 && context3.nodeType ? context3.ownerDocument || context3 : document2, 1657 true 1658 )); 1659 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context3)) { 1660 for (match in context3) { 1661 if (isFunction2(this[match])) { 1662 this[match](context3[match]); 1663 } else { 1664 this.attr(match, context3[match]); 1665 } 1666 } 1667 } 1668 return this; 1669 } else { 1670 elem = document2.getElementById(match[2]); 1671 if (elem) { 1672 this[0] = elem; 1673 this.length = 1; 1674 } 1675 return this; 1676 } 1677 } else if (!context3 || context3.jquery) { 1678 return (context3 || root).find(selector3); 1679 } else { 1680 return this.constructor(context3).find(selector3); 1681 } 1682 } else if (selector3.nodeType) { 1683 this[0] = selector3; 1684 this.length = 1; 1685 return this; 1686 } else if (isFunction2(selector3)) { 1687 return root.ready !== void 0 ? root.ready(selector3) : ( 1688 // Execute immediately if ready is not present 1689 selector3(jQuery) 1690 ); 1691 } 1692 return jQuery.makeArray(selector3, this); 1693 }; 1694 init7.prototype = jQuery.fn; 1695 rootjQuery = jQuery(document2); 1696 var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = { 1697 children: true, 1698 contents: true, 1699 next: true, 1700 prev: true 1701 }; 1702 jQuery.fn.extend({ 1703 has: function(target) { 1704 var targets = jQuery(target, this), l2 = targets.length; 1705 return this.filter(function() { 1706 var i2 = 0; 1707 for (; i2 < l2; i2++) { 1708 if (jQuery.contains(this, targets[i2])) { 1709 return true; 1710 } 1711 } 1712 }); 1713 }, 1714 closest: function(selectors, context3) { 1715 var cur, i2 = 0, l2 = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors); 1716 if (!rneedsContext.test(selectors)) { 1717 for (; i2 < l2; i2++) { 1718 for (cur = this[i2]; cur && cur !== context3; cur = cur.parentNode) { 1719 if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : ( 1720 // Don't pass non-elements to jQuery#find 1721 cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors) 1722 ))) { 1723 matched.push(cur); 1724 break; 1725 } 1726 } 1727 } 1728 } 1729 return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched); 1730 }, 1731 // Determine the position of an element within the set 1732 index: function(elem) { 1733 if (!elem) { 1734 return this[0] && this[0].parentNode ? this.first().prevAll().length : -1; 1735 } 1736 if (typeof elem === "string") { 1737 return indexOf.call(jQuery(elem), this[0]); 1738 } 1739 return indexOf.call( 1740 this, 1741 // If it receives a jQuery object, the first element is used 1742 elem.jquery ? elem[0] : elem 1743 ); 1744 }, 1745 add: function(selector3, context3) { 1746 return this.pushStack( 1747 jQuery.uniqueSort( 1748 jQuery.merge(this.get(), jQuery(selector3, context3)) 1749 ) 1750 ); 1751 }, 1752 addBack: function(selector3) { 1753 return this.add( 1754 selector3 == null ? this.prevObject : this.prevObject.filter(selector3) 1755 ); 1756 } 1757 }); 1758 function sibling(cur, dir2) { 1759 while ((cur = cur[dir2]) && cur.nodeType !== 1) { 1760 } 1761 return cur; 1762 } 1763 jQuery.each({ 1764 parent: function(elem) { 1765 var parent = elem.parentNode; 1766 return parent && parent.nodeType !== 11 ? parent : null; 1767 }, 1768 parents: function(elem) { 1769 return dir(elem, "parentNode"); 1770 }, 1771 parentsUntil: function(elem, _i2, until) { 1772 return dir(elem, "parentNode", until); 1773 }, 1774 next: function(elem) { 1775 return sibling(elem, "nextSibling"); 1776 }, 1777 prev: function(elem) { 1778 return sibling(elem, "previousSibling"); 1779 }, 1780 nextAll: function(elem) { 1781 return dir(elem, "nextSibling"); 1782 }, 1783 prevAll: function(elem) { 1784 return dir(elem, "previousSibling"); 1785 }, 1786 nextUntil: function(elem, _i2, until) { 1787 return dir(elem, "nextSibling", until); 1788 }, 1789 prevUntil: function(elem, _i2, until) { 1790 return dir(elem, "previousSibling", until); 1791 }, 1792 siblings: function(elem) { 1793 return siblings((elem.parentNode || {}).firstChild, elem); 1794 }, 1795 children: function(elem) { 1796 return siblings(elem.firstChild); 1797 }, 1798 contents: function(elem) { 1799 if (elem.contentDocument != null && // Support: IE 11+ 1800 // <object> elements with no `data` attribute has an object 1801 // `contentDocument` with a `null` prototype. 1802 getProto(elem.contentDocument)) { 1803 return elem.contentDocument; 1804 } 1805 if (nodeName(elem, "template")) { 1806 elem = elem.content || elem; 1807 } 1808 return jQuery.merge([], elem.childNodes); 1809 } 1810 }, function(name, fn) { 1811 jQuery.fn[name] = function(until, selector3) { 1812 var matched = jQuery.map(this, fn, until); 1813 if (name.slice(-5) !== "Until") { 1814 selector3 = until; 1815 } 1816 if (selector3 && typeof selector3 === "string") { 1817 matched = jQuery.filter(selector3, matched); 1818 } 1819 if (this.length > 1) { 1820 if (!guaranteedUnique[name]) { 1821 jQuery.uniqueSort(matched); 1822 } 1823 if (rparentsprev.test(name)) { 1824 matched.reverse(); 1825 } 1826 } 1827 return this.pushStack(matched); 1828 }; 1829 }); 1830 var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; 1831 function createOptions(options) { 1832 var object = {}; 1833 jQuery.each(options.match(rnothtmlwhite) || [], function(_2, flag) { 1834 object[flag] = true; 1835 }); 1836 return object; 1837 } 1838 jQuery.Callbacks = function(options) { 1839 options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options); 1840 var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() { 1841 locked = locked || options.once; 1842 fired = firing = true; 1843 for (; queue.length; firingIndex = -1) { 1844 memory = queue.shift(); 1845 while (++firingIndex < list.length) { 1846 if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) { 1847 firingIndex = list.length; 1848 memory = false; 1849 } 1850 } 1851 } 1852 if (!options.memory) { 1853 memory = false; 1854 } 1855 firing = false; 1856 if (locked) { 1857 if (memory) { 1858 list = []; 1859 } else { 1860 list = ""; 1861 } 1862 } 1863 }, self2 = { 1864 // Add a callback or a collection of callbacks to the list 1865 add: function() { 1866 if (list) { 1867 if (memory && !firing) { 1868 firingIndex = list.length - 1; 1869 queue.push(memory); 1870 } 1871 (function add2(args) { 1872 jQuery.each(args, function(_2, arg) { 1873 if (isFunction2(arg)) { 1874 if (!options.unique || !self2.has(arg)) { 1875 list.push(arg); 1876 } 1877 } else if (arg && arg.length && toType(arg) !== "string") { 1878 add2(arg); 1879 } 1880 }); 1881 })(arguments); 1882 if (memory && !firing) { 1883 fire(); 1884 } 1885 } 1886 return this; 1887 }, 1888 // Remove a callback from the list 1889 remove: function() { 1890 jQuery.each(arguments, function(_2, arg) { 1891 var index3; 1892 while ((index3 = jQuery.inArray(arg, list, index3)) > -1) { 1893 list.splice(index3, 1); 1894 if (index3 <= firingIndex) { 1895 firingIndex--; 1896 } 1897 } 1898 }); 1899 return this; 1900 }, 1901 // Check if a given callback is in the list. 1902 // If no argument is given, return whether or not list has callbacks attached. 1903 has: function(fn) { 1904 return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0; 1905 }, 1906 // Remove all callbacks from the list 1907 empty: function() { 1908 if (list) { 1909 list = []; 1910 } 1911 return this; 1912 }, 1913 // Disable .fire and .add 1914 // Abort any current/pending executions 1915 // Clear all callbacks and values 1916 disable: function() { 1917 locked = queue = []; 1918 list = memory = ""; 1919 return this; 1920 }, 1921 disabled: function() { 1922 return !list; 1923 }, 1924 // Disable .fire 1925 // Also disable .add unless we have memory (since it would have no effect) 1926 // Abort any pending executions 1927 lock: function() { 1928 locked = queue = []; 1929 if (!memory && !firing) { 1930 list = memory = ""; 1931 } 1932 return this; 1933 }, 1934 locked: function() { 1935 return !!locked; 1936 }, 1937 // Call all callbacks with the given context and arguments 1938 fireWith: function(context3, args) { 1939 if (!locked) { 1940 args = args || []; 1941 args = [context3, args.slice ? args.slice() : args]; 1942 queue.push(args); 1943 if (!firing) { 1944 fire(); 1945 } 1946 } 1947 return this; 1948 }, 1949 // Call all the callbacks with the given arguments 1950 fire: function() { 1951 self2.fireWith(this, arguments); 1952 return this; 1953 }, 1954 // To know if the callbacks have already been called at least once 1955 fired: function() { 1956 return !!fired; 1957 } 1958 }; 1959 return self2; 1960 }; 1961 function Identity(v2) { 1962 return v2; 1963 } 1964 function Thrower(ex) { 1965 throw ex; 1966 } 1967 function adoptValue(value, resolve, reject, noValue) { 1968 var method; 1969 try { 1970 if (value && isFunction2(method = value.promise)) { 1971 method.call(value).done(resolve).fail(reject); 1972 } else if (value && isFunction2(method = value.then)) { 1973 method.call(value, resolve, reject); 1974 } else { 1975 resolve.apply(void 0, [value].slice(noValue)); 1976 } 1977 } catch (value2) { 1978 reject.apply(void 0, [value2]); 1979 } 1980 } 1981 jQuery.extend({ 1982 Deferred: function(func) { 1983 var tuples = [ 1984 // action, add listener, callbacks, 1985 // ... .then handlers, argument index, [final state] 1986 [ 1987 "notify", 1988 "progress", 1989 jQuery.Callbacks("memory"), 1990 jQuery.Callbacks("memory"), 1991 2 1992 ], 1993 [ 1994 "resolve", 1995 "done", 1996 jQuery.Callbacks("once memory"), 1997 jQuery.Callbacks("once memory"), 1998 0, 1999 "resolved" 2000 ], 2001 [ 2002 "reject", 2003 "fail", 2004 jQuery.Callbacks("once memory"), 2005 jQuery.Callbacks("once memory"), 2006 1, 2007 "rejected" 2008 ] 2009 ], state = "pending", promise = { 2010 state: function() { 2011 return state; 2012 }, 2013 always: function() { 2014 deferred.done(arguments).fail(arguments); 2015 return this; 2016 }, 2017 "catch": function(fn) { 2018 return promise.then(null, fn); 2019 }, 2020 // Keep pipe for back-compat 2021 pipe: function() { 2022 var fns = arguments; 2023 return jQuery.Deferred(function(newDefer) { 2024 jQuery.each(tuples, function(_i2, tuple) { 2025 var fn = isFunction2(fns[tuple[4]]) && fns[tuple[4]]; 2026 deferred[tuple[1]](function() { 2027 var returned = fn && fn.apply(this, arguments); 2028 if (returned && isFunction2(returned.promise)) { 2029 returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject); 2030 } else { 2031 newDefer[tuple[0] + "With"]( 2032 this, 2033 fn ? [returned] : arguments 2034 ); 2035 } 2036 }); 2037 }); 2038 fns = null; 2039 }).promise(); 2040 }, 2041 then: function(onFulfilled, onRejected, onProgress) { 2042 var maxDepth = 0; 2043 function resolve(depth, deferred2, handler, special) { 2044 return function() { 2045 var that = this, args = arguments, mightThrow = function() { 2046 var returned, then; 2047 if (depth < maxDepth) { 2048 return; 2049 } 2050 returned = handler.apply(that, args); 2051 if (returned === deferred2.promise()) { 2052 throw new TypeError("Thenable self-resolution"); 2053 } 2054 then = returned && // Support: Promises/A+ section 2.3.4 2055 // https://promisesaplus.com/#point-64 2056 // Only check objects and functions for thenability 2057 (typeof returned === "object" || typeof returned === "function") && returned.then; 2058 if (isFunction2(then)) { 2059 if (special) { 2060 then.call( 2061 returned, 2062 resolve(maxDepth, deferred2, Identity, special), 2063 resolve(maxDepth, deferred2, Thrower, special) 2064 ); 2065 } else { 2066 maxDepth++; 2067 then.call( 2068 returned, 2069 resolve(maxDepth, deferred2, Identity, special), 2070 resolve(maxDepth, deferred2, Thrower, special), 2071 resolve( 2072 maxDepth, 2073 deferred2, 2074 Identity, 2075 deferred2.notifyWith 2076 ) 2077 ); 2078 } 2079 } else { 2080 if (handler !== Identity) { 2081 that = void 0; 2082 args = [returned]; 2083 } 2084 (special || deferred2.resolveWith)(that, args); 2085 } 2086 }, process2 = special ? mightThrow : function() { 2087 try { 2088 mightThrow(); 2089 } catch (e2) { 2090 if (jQuery.Deferred.exceptionHook) { 2091 jQuery.Deferred.exceptionHook( 2092 e2, 2093 process2.error 2094 ); 2095 } 2096 if (depth + 1 >= maxDepth) { 2097 if (handler !== Thrower) { 2098 that = void 0; 2099 args = [e2]; 2100 } 2101 deferred2.rejectWith(that, args); 2102 } 2103 } 2104 }; 2105 if (depth) { 2106 process2(); 2107 } else { 2108 if (jQuery.Deferred.getErrorHook) { 2109 process2.error = jQuery.Deferred.getErrorHook(); 2110 } else if (jQuery.Deferred.getStackHook) { 2111 process2.error = jQuery.Deferred.getStackHook(); 2112 } 2113 window2.setTimeout(process2); 2114 } 2115 }; 2116 } 2117 return jQuery.Deferred(function(newDefer) { 2118 tuples[0][3].add( 2119 resolve( 2120 0, 2121 newDefer, 2122 isFunction2(onProgress) ? onProgress : Identity, 2123 newDefer.notifyWith 2124 ) 2125 ); 2126 tuples[1][3].add( 2127 resolve( 2128 0, 2129 newDefer, 2130 isFunction2(onFulfilled) ? onFulfilled : Identity 2131 ) 2132 ); 2133 tuples[2][3].add( 2134 resolve( 2135 0, 2136 newDefer, 2137 isFunction2(onRejected) ? onRejected : Thrower 2138 ) 2139 ); 2140 }).promise(); 2141 }, 2142 // Get a promise for this deferred 2143 // If obj is provided, the promise aspect is added to the object 2144 promise: function(obj) { 2145 return obj != null ? jQuery.extend(obj, promise) : promise; 2146 } 2147 }, deferred = {}; 2148 jQuery.each(tuples, function(i2, tuple) { 2149 var list = tuple[2], stateString = tuple[5]; 2150 promise[tuple[1]] = list.add; 2151 if (stateString) { 2152 list.add( 2153 function() { 2154 state = stateString; 2155 }, 2156 // rejected_callbacks.disable 2157 // fulfilled_callbacks.disable 2158 tuples[3 - i2][2].disable, 2159 // rejected_handlers.disable 2160 // fulfilled_handlers.disable 2161 tuples[3 - i2][3].disable, 2162 // progress_callbacks.lock 2163 tuples[0][2].lock, 2164 // progress_handlers.lock 2165 tuples[0][3].lock 2166 ); 2167 } 2168 list.add(tuple[3].fire); 2169 deferred[tuple[0]] = function() { 2170 deferred[tuple[0] + "With"](this === deferred ? void 0 : this, arguments); 2171 return this; 2172 }; 2173 deferred[tuple[0] + "With"] = list.fireWith; 2174 }); 2175 promise.promise(deferred); 2176 if (func) { 2177 func.call(deferred, deferred); 2178 } 2179 return deferred; 2180 }, 2181 // Deferred helper 2182 when: function(singleValue) { 2183 var remaining = arguments.length, i2 = remaining, resolveContexts = Array(i2), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i3) { 2184 return function(value) { 2185 resolveContexts[i3] = this; 2186 resolveValues[i3] = arguments.length > 1 ? slice.call(arguments) : value; 2187 if (!--remaining) { 2188 primary.resolveWith(resolveContexts, resolveValues); 2189 } 2190 }; 2191 }; 2192 if (remaining <= 1) { 2193 adoptValue( 2194 singleValue, 2195 primary.done(updateFunc(i2)).resolve, 2196 primary.reject, 2197 !remaining 2198 ); 2199 if (primary.state() === "pending" || isFunction2(resolveValues[i2] && resolveValues[i2].then)) { 2200 return primary.then(); 2201 } 2202 } 2203 while (i2--) { 2204 adoptValue(resolveValues[i2], updateFunc(i2), primary.reject); 2205 } 2206 return primary.promise(); 2207 } 2208 }); 2209 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 2210 jQuery.Deferred.exceptionHook = function(error2, asyncError) { 2211 if (window2.console && window2.console.warn && error2 && rerrorNames.test(error2.name)) { 2212 window2.console.warn( 2213 "jQuery.Deferred exception: " + error2.message, 2214 error2.stack, 2215 asyncError 2216 ); 2217 } 2218 }; 2219 jQuery.readyException = function(error2) { 2220 window2.setTimeout(function() { 2221 throw error2; 2222 }); 2223 }; 2224 var readyList = jQuery.Deferred(); 2225 jQuery.fn.ready = function(fn) { 2226 readyList.then(fn).catch(function(error2) { 2227 jQuery.readyException(error2); 2228 }); 2229 return this; 2230 }; 2231 jQuery.extend({ 2232 // Is the DOM ready to be used? Set to true once it occurs. 2233 isReady: false, 2234 // A counter to track how many items to wait for before 2235 // the ready event fires. See trac-6781 2236 readyWait: 1, 2237 // Handle when the DOM is ready 2238 ready: function(wait) { 2239 if (wait === true ? --jQuery.readyWait : jQuery.isReady) { 2240 return; 2241 } 2242 jQuery.isReady = true; 2243 if (wait !== true && --jQuery.readyWait > 0) { 2244 return; 2245 } 2246 readyList.resolveWith(document2, [jQuery]); 2247 } 2248 }); 2249 jQuery.ready.then = readyList.then; 2250 function completed() { 2251 document2.removeEventListener("DOMContentLoaded", completed); 2252 window2.removeEventListener("load", completed); 2253 jQuery.ready(); 2254 } 2255 if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) { 2256 window2.setTimeout(jQuery.ready); 2257 } else { 2258 document2.addEventListener("DOMContentLoaded", completed); 2259 window2.addEventListener("load", completed); 2260 } 2261 var access = function(elems, fn, key2, value, chainable, emptyGet, raw) { 2262 var i2 = 0, len2 = elems.length, bulk = key2 == null; 2263 if (toType(key2) === "object") { 2264 chainable = true; 2265 for (i2 in key2) { 2266 access(elems, fn, i2, key2[i2], true, emptyGet, raw); 2267 } 2268 } else if (value !== void 0) { 2269 chainable = true; 2270 if (!isFunction2(value)) { 2271 raw = true; 2272 } 2273 if (bulk) { 2274 if (raw) { 2275 fn.call(elems, value); 2276 fn = null; 2277 } else { 2278 bulk = fn; 2279 fn = function(elem, _key, value2) { 2280 return bulk.call(jQuery(elem), value2); 2281 }; 2282 } 2283 } 2284 if (fn) { 2285 for (; i2 < len2; i2++) { 2286 fn( 2287 elems[i2], 2288 key2, 2289 raw ? value : value.call(elems[i2], i2, fn(elems[i2], key2)) 2290 ); 2291 } 2292 } 2293 } 2294 if (chainable) { 2295 return elems; 2296 } 2297 if (bulk) { 2298 return fn.call(elems); 2299 } 2300 return len2 ? fn(elems[0], key2) : emptyGet; 2301 }; 2302 var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g; 2303 function fcamelCase(_all, letter) { 2304 return letter.toUpperCase(); 2305 } 2306 function camelCase(string) { 2307 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 2308 } 2309 var acceptData = function(owner) { 2310 return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; 2311 }; 2312 function Data() { 2313 this.expando = jQuery.expando + Data.uid++; 2314 } 2315 Data.uid = 1; 2316 Data.prototype = { 2317 cache: function(owner) { 2318 var value = owner[this.expando]; 2319 if (!value) { 2320 value = {}; 2321 if (acceptData(owner)) { 2322 if (owner.nodeType) { 2323 owner[this.expando] = value; 2324 } else { 2325 Object.defineProperty(owner, this.expando, { 2326 value, 2327 configurable: true 2328 }); 2329 } 2330 } 2331 } 2332 return value; 2333 }, 2334 set: function(owner, data, value) { 2335 var prop, cache2 = this.cache(owner); 2336 if (typeof data === "string") { 2337 cache2[camelCase(data)] = value; 2338 } else { 2339 for (prop in data) { 2340 cache2[camelCase(prop)] = data[prop]; 2341 } 2342 } 2343 return cache2; 2344 }, 2345 get: function(owner, key2) { 2346 return key2 === void 0 ? this.cache(owner) : ( 2347 // Always use camelCase key (gh-2257) 2348 owner[this.expando] && owner[this.expando][camelCase(key2)] 2349 ); 2350 }, 2351 access: function(owner, key2, value) { 2352 if (key2 === void 0 || key2 && typeof key2 === "string" && value === void 0) { 2353 return this.get(owner, key2); 2354 } 2355 this.set(owner, key2, value); 2356 return value !== void 0 ? value : key2; 2357 }, 2358 remove: function(owner, key2) { 2359 var i2, cache2 = owner[this.expando]; 2360 if (cache2 === void 0) { 2361 return; 2362 } 2363 if (key2 !== void 0) { 2364 if (Array.isArray(key2)) { 2365 key2 = key2.map(camelCase); 2366 } else { 2367 key2 = camelCase(key2); 2368 key2 = key2 in cache2 ? [key2] : key2.match(rnothtmlwhite) || []; 2369 } 2370 i2 = key2.length; 2371 while (i2--) { 2372 delete cache2[key2[i2]]; 2373 } 2374 } 2375 if (key2 === void 0 || jQuery.isEmptyObject(cache2)) { 2376 if (owner.nodeType) { 2377 owner[this.expando] = void 0; 2378 } else { 2379 delete owner[this.expando]; 2380 } 2381 } 2382 }, 2383 hasData: function(owner) { 2384 var cache2 = owner[this.expando]; 2385 return cache2 !== void 0 && !jQuery.isEmptyObject(cache2); 2386 } 2387 }; 2388 var dataPriv = new Data(); 2389 var dataUser = new Data(); 2390 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; 2391 function getData(data) { 2392 if (data === "true") { 2393 return true; 2394 } 2395 if (data === "false") { 2396 return false; 2397 } 2398 if (data === "null") { 2399 return null; 2400 } 2401 if (data === +data + "") { 2402 return +data; 2403 } 2404 if (rbrace.test(data)) { 2405 return JSON.parse(data); 2406 } 2407 return data; 2408 } 2409 function dataAttr(elem, key2, data) { 2410 var name; 2411 if (data === void 0 && elem.nodeType === 1) { 2412 name = "data-" + key2.replace(rmultiDash, "-$&").toLowerCase(); 2413 data = elem.getAttribute(name); 2414 if (typeof data === "string") { 2415 try { 2416 data = getData(data); 2417 } catch (e2) { 2418 } 2419 dataUser.set(elem, key2, data); 2420 } else { 2421 data = void 0; 2422 } 2423 } 2424 return data; 2425 } 2426 jQuery.extend({ 2427 hasData: function(elem) { 2428 return dataUser.hasData(elem) || dataPriv.hasData(elem); 2429 }, 2430 data: function(elem, name, data) { 2431 return dataUser.access(elem, name, data); 2432 }, 2433 removeData: function(elem, name) { 2434 dataUser.remove(elem, name); 2435 }, 2436 // TODO: Now that all calls to _data and _removeData have been replaced 2437 // with direct calls to dataPriv methods, these can be deprecated. 2438 _data: function(elem, name, data) { 2439 return dataPriv.access(elem, name, data); 2440 }, 2441 _removeData: function(elem, name) { 2442 dataPriv.remove(elem, name); 2443 } 2444 }); 2445 jQuery.fn.extend({ 2446 data: function(key2, value) { 2447 var i2, name, data, elem = this[0], attrs = elem && elem.attributes; 2448 if (key2 === void 0) { 2449 if (this.length) { 2450 data = dataUser.get(elem); 2451 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 2452 i2 = attrs.length; 2453 while (i2--) { 2454 if (attrs[i2]) { 2455 name = attrs[i2].name; 2456 if (name.indexOf("data-") === 0) { 2457 name = camelCase(name.slice(5)); 2458 dataAttr(elem, name, data[name]); 2459 } 2460 } 2461 } 2462 dataPriv.set(elem, "hasDataAttrs", true); 2463 } 2464 } 2465 return data; 2466 } 2467 if (typeof key2 === "object") { 2468 return this.each(function() { 2469 dataUser.set(this, key2); 2470 }); 2471 } 2472 return access(this, function(value2) { 2473 var data2; 2474 if (elem && value2 === void 0) { 2475 data2 = dataUser.get(elem, key2); 2476 if (data2 !== void 0) { 2477 return data2; 2478 } 2479 data2 = dataAttr(elem, key2); 2480 if (data2 !== void 0) { 2481 return data2; 2482 } 2483 return; 2484 } 2485 this.each(function() { 2486 dataUser.set(this, key2, value2); 2487 }); 2488 }, null, value, arguments.length > 1, null, true); 2489 }, 2490 removeData: function(key2) { 2491 return this.each(function() { 2492 dataUser.remove(this, key2); 2493 }); 2494 } 2495 }); 2496 jQuery.extend({ 2497 queue: function(elem, type, data) { 2498 var queue; 2499 if (elem) { 2500 type = (type || "fx") + "queue"; 2501 queue = dataPriv.get(elem, type); 2502 if (data) { 2503 if (!queue || Array.isArray(data)) { 2504 queue = dataPriv.access(elem, type, jQuery.makeArray(data)); 2505 } else { 2506 queue.push(data); 2507 } 2508 } 2509 return queue || []; 2510 } 2511 }, 2512 dequeue: function(elem, type) { 2513 type = type || "fx"; 2514 var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next2 = function() { 2515 jQuery.dequeue(elem, type); 2516 }; 2517 if (fn === "inprogress") { 2518 fn = queue.shift(); 2519 startLength--; 2520 } 2521 if (fn) { 2522 if (type === "fx") { 2523 queue.unshift("inprogress"); 2524 } 2525 delete hooks.stop; 2526 fn.call(elem, next2, hooks); 2527 } 2528 if (!startLength && hooks) { 2529 hooks.empty.fire(); 2530 } 2531 }, 2532 // Not public - generate a queueHooks object, or return the current one 2533 _queueHooks: function(elem, type) { 2534 var key2 = type + "queueHooks"; 2535 return dataPriv.get(elem, key2) || dataPriv.access(elem, key2, { 2536 empty: jQuery.Callbacks("once memory").add(function() { 2537 dataPriv.remove(elem, [type + "queue", key2]); 2538 }) 2539 }); 2540 } 2541 }); 2542 jQuery.fn.extend({ 2543 queue: function(type, data) { 2544 var setter = 2; 2545 if (typeof type !== "string") { 2546 data = type; 2547 type = "fx"; 2548 setter--; 2549 } 2550 if (arguments.length < setter) { 2551 return jQuery.queue(this[0], type); 2552 } 2553 return data === void 0 ? this : this.each(function() { 2554 var queue = jQuery.queue(this, type, data); 2555 jQuery._queueHooks(this, type); 2556 if (type === "fx" && queue[0] !== "inprogress") { 2557 jQuery.dequeue(this, type); 2558 } 2559 }); 2560 }, 2561 dequeue: function(type) { 2562 return this.each(function() { 2563 jQuery.dequeue(this, type); 2564 }); 2565 }, 2566 clearQueue: function(type) { 2567 return this.queue(type || "fx", []); 2568 }, 2569 // Get a promise resolved when queues of a certain type 2570 // are emptied (fx is the type by default) 2571 promise: function(type, obj) { 2572 var tmp, count = 1, defer2 = jQuery.Deferred(), elements = this, i2 = this.length, resolve = function() { 2573 if (!--count) { 2574 defer2.resolveWith(elements, [elements]); 2575 } 2576 }; 2577 if (typeof type !== "string") { 2578 obj = type; 2579 type = void 0; 2580 } 2581 type = type || "fx"; 2582 while (i2--) { 2583 tmp = dataPriv.get(elements[i2], type + "queueHooks"); 2584 if (tmp && tmp.empty) { 2585 count++; 2586 tmp.empty.add(resolve); 2587 } 2588 } 2589 resolve(); 2590 return defer2.promise(obj); 2591 } 2592 }); 2593 var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; 2594 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 2595 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 2596 var documentElement = document2.documentElement; 2597 var isAttached = function(elem) { 2598 return jQuery.contains(elem.ownerDocument, elem); 2599 }, composed = { composed: true }; 2600 if (documentElement.getRootNode) { 2601 isAttached = function(elem) { 2602 return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument; 2603 }; 2604 } 2605 var isHiddenWithinTree = function(elem, el) { 2606 elem = el || elem; 2607 return elem.style.display === "none" || elem.style.display === "" && // Otherwise, check computed style 2608 // Support: Firefox <=43 - 45 2609 // Disconnected elements can have computed display: none, so first confirm that elem is 2610 // in the document. 2611 isAttached(elem) && jQuery.css(elem, "display") === "none"; 2612 }; 2613 function adjustCSS(elem, prop, valueParts, tween) { 2614 var adjusted, scale, maxIterations = 20, currentValue = tween ? function() { 2615 return tween.cur(); 2616 } : function() { 2617 return jQuery.css(elem, prop, ""); 2618 }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop)); 2619 if (initialInUnit && initialInUnit[3] !== unit) { 2620 initial = initial / 2; 2621 unit = unit || initialInUnit[3]; 2622 initialInUnit = +initial || 1; 2623 while (maxIterations--) { 2624 jQuery.style(elem, prop, initialInUnit + unit); 2625 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 2626 maxIterations = 0; 2627 } 2628 initialInUnit = initialInUnit / scale; 2629 } 2630 initialInUnit = initialInUnit * 2; 2631 jQuery.style(elem, prop, initialInUnit + unit); 2632 valueParts = valueParts || []; 2633 } 2634 if (valueParts) { 2635 initialInUnit = +initialInUnit || +initial || 0; 2636 adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2]; 2637 if (tween) { 2638 tween.unit = unit; 2639 tween.start = initialInUnit; 2640 tween.end = adjusted; 2641 } 2642 } 2643 return adjusted; 2644 } 2645 var defaultDisplayMap = {}; 2646 function getDefaultDisplay(elem) { 2647 var temp, doc2 = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2]; 2648 if (display) { 2649 return display; 2650 } 2651 temp = doc2.body.appendChild(doc2.createElement(nodeName2)); 2652 display = jQuery.css(temp, "display"); 2653 temp.parentNode.removeChild(temp); 2654 if (display === "none") { 2655 display = "block"; 2656 } 2657 defaultDisplayMap[nodeName2] = display; 2658 return display; 2659 } 2660 function showHide(elements, show) { 2661 var display, elem, values = [], index3 = 0, length = elements.length; 2662 for (; index3 < length; index3++) { 2663 elem = elements[index3]; 2664 if (!elem.style) { 2665 continue; 2666 } 2667 display = elem.style.display; 2668 if (show) { 2669 if (display === "none") { 2670 values[index3] = dataPriv.get(elem, "display") || null; 2671 if (!values[index3]) { 2672 elem.style.display = ""; 2673 } 2674 } 2675 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 2676 values[index3] = getDefaultDisplay(elem); 2677 } 2678 } else { 2679 if (display !== "none") { 2680 values[index3] = "none"; 2681 dataPriv.set(elem, "display", display); 2682 } 2683 } 2684 } 2685 for (index3 = 0; index3 < length; index3++) { 2686 if (values[index3] != null) { 2687 elements[index3].style.display = values[index3]; 2688 } 2689 } 2690 return elements; 2691 } 2692 jQuery.fn.extend({ 2693 show: function() { 2694 return showHide(this, true); 2695 }, 2696 hide: function() { 2697 return showHide(this); 2698 }, 2699 toggle: function(state) { 2700 if (typeof state === "boolean") { 2701 return state ? this.show() : this.hide(); 2702 } 2703 return this.each(function() { 2704 if (isHiddenWithinTree(this)) { 2705 jQuery(this).show(); 2706 } else { 2707 jQuery(this).hide(); 2708 } 2709 }); 2710 } 2711 }); 2712 var rcheckableType = /^(?:checkbox|radio)$/i; 2713 var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; 2714 var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; 2715 (function() { 2716 var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input"); 2717 input.setAttribute("type", "radio"); 2718 input.setAttribute("checked", "checked"); 2719 input.setAttribute("name", "t"); 2720 div.appendChild(input); 2721 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 2722 div.innerHTML = "<textarea>x</textarea>"; 2723 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 2724 div.innerHTML = "<option></option>"; 2725 support.option = !!div.lastChild; 2726 })(); 2727 var wrapMap = { 2728 // XHTML parsers do not magically insert elements in the 2729 // same way that tag soup parsers do. So we cannot shorten 2730 // this by omitting <tbody> or other required elements. 2731 thead: [1, "<table>", "</table>"], 2732 col: [2, "<table><colgroup>", "</colgroup></table>"], 2733 tr: [2, "<table><tbody>", "</tbody></table>"], 2734 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 2735 _default: [0, "", ""] 2736 }; 2737 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 2738 wrapMap.th = wrapMap.td; 2739 if (!support.option) { 2740 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 2741 } 2742 function getAll(context3, tag) { 2743 var ret; 2744 if (typeof context3.getElementsByTagName !== "undefined") { 2745 ret = context3.getElementsByTagName(tag || "*"); 2746 } else if (typeof context3.querySelectorAll !== "undefined") { 2747 ret = context3.querySelectorAll(tag || "*"); 2748 } else { 2749 ret = []; 2750 } 2751 if (tag === void 0 || tag && nodeName(context3, tag)) { 2752 return jQuery.merge([context3], ret); 2753 } 2754 return ret; 2755 } 2756 function setGlobalEval(elems, refElements) { 2757 var i2 = 0, l2 = elems.length; 2758 for (; i2 < l2; i2++) { 2759 dataPriv.set( 2760 elems[i2], 2761 "globalEval", 2762 !refElements || dataPriv.get(refElements[i2], "globalEval") 2763 ); 2764 } 2765 } 2766 var rhtml = /<|&#?\w+;/; 2767 function buildFragment(elems, context3, scripts, selection, ignored) { 2768 var elem, tmp, tag, wrap3, attached, j2, fragment = context3.createDocumentFragment(), nodes = [], i2 = 0, l2 = elems.length; 2769 for (; i2 < l2; i2++) { 2770 elem = elems[i2]; 2771 if (elem || elem === 0) { 2772 if (toType(elem) === "object") { 2773 jQuery.merge(nodes, elem.nodeType ? [elem] : elem); 2774 } else if (!rhtml.test(elem)) { 2775 nodes.push(context3.createTextNode(elem)); 2776 } else { 2777 tmp = tmp || fragment.appendChild(context3.createElement("div")); 2778 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 2779 wrap3 = wrapMap[tag] || wrapMap._default; 2780 tmp.innerHTML = wrap3[1] + jQuery.htmlPrefilter(elem) + wrap3[2]; 2781 j2 = wrap3[0]; 2782 while (j2--) { 2783 tmp = tmp.lastChild; 2784 } 2785 jQuery.merge(nodes, tmp.childNodes); 2786 tmp = fragment.firstChild; 2787 tmp.textContent = ""; 2788 } 2789 } 2790 } 2791 fragment.textContent = ""; 2792 i2 = 0; 2793 while (elem = nodes[i2++]) { 2794 if (selection && jQuery.inArray(elem, selection) > -1) { 2795 if (ignored) { 2796 ignored.push(elem); 2797 } 2798 continue; 2799 } 2800 attached = isAttached(elem); 2801 tmp = getAll(fragment.appendChild(elem), "script"); 2802 if (attached) { 2803 setGlobalEval(tmp); 2804 } 2805 if (scripts) { 2806 j2 = 0; 2807 while (elem = tmp[j2++]) { 2808 if (rscriptType.test(elem.type || "")) { 2809 scripts.push(elem); 2810 } 2811 } 2812 } 2813 } 2814 return fragment; 2815 } 2816 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 2817 function returnTrue() { 2818 return true; 2819 } 2820 function returnFalse() { 2821 return false; 2822 } 2823 function on(elem, types, selector3, data, fn, one) { 2824 var origFn, type; 2825 if (typeof types === "object") { 2826 if (typeof selector3 !== "string") { 2827 data = data || selector3; 2828 selector3 = void 0; 2829 } 2830 for (type in types) { 2831 on(elem, type, selector3, data, types[type], one); 2832 } 2833 return elem; 2834 } 2835 if (data == null && fn == null) { 2836 fn = selector3; 2837 data = selector3 = void 0; 2838 } else if (fn == null) { 2839 if (typeof selector3 === "string") { 2840 fn = data; 2841 data = void 0; 2842 } else { 2843 fn = data; 2844 data = selector3; 2845 selector3 = void 0; 2846 } 2847 } 2848 if (fn === false) { 2849 fn = returnFalse; 2850 } else if (!fn) { 2851 return elem; 2852 } 2853 if (one === 1) { 2854 origFn = fn; 2855 fn = function(event) { 2856 jQuery().off(event); 2857 return origFn.apply(this, arguments); 2858 }; 2859 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 2860 } 2861 return elem.each(function() { 2862 jQuery.event.add(this, types, fn, data, selector3); 2863 }); 2864 } 2865 jQuery.event = { 2866 global: {}, 2867 add: function(elem, types, handler, data, selector3) { 2868 var handleObjIn, eventHandle, tmp, events2, t2, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem); 2869 if (!acceptData(elem)) { 2870 return; 2871 } 2872 if (handler.handler) { 2873 handleObjIn = handler; 2874 handler = handleObjIn.handler; 2875 selector3 = handleObjIn.selector; 2876 } 2877 if (selector3) { 2878 jQuery.find.matchesSelector(documentElement, selector3); 2879 } 2880 if (!handler.guid) { 2881 handler.guid = jQuery.guid++; 2882 } 2883 if (!(events2 = elemData.events)) { 2884 events2 = elemData.events = /* @__PURE__ */ Object.create(null); 2885 } 2886 if (!(eventHandle = elemData.handle)) { 2887 eventHandle = elemData.handle = function(e2) { 2888 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e2.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0; 2889 }; 2890 } 2891 types = (types || "").match(rnothtmlwhite) || [""]; 2892 t2 = types.length; 2893 while (t2--) { 2894 tmp = rtypenamespace.exec(types[t2]) || []; 2895 type = origType = tmp[1]; 2896 namespaces = (tmp[2] || "").split(".").sort(); 2897 if (!type) { 2898 continue; 2899 } 2900 special = jQuery.event.special[type] || {}; 2901 type = (selector3 ? special.delegateType : special.bindType) || type; 2902 special = jQuery.event.special[type] || {}; 2903 handleObj = jQuery.extend({ 2904 type, 2905 origType, 2906 data, 2907 handler, 2908 guid: handler.guid, 2909 selector: selector3, 2910 needsContext: selector3 && jQuery.expr.match.needsContext.test(selector3), 2911 namespace: namespaces.join(".") 2912 }, handleObjIn); 2913 if (!(handlers = events2[type])) { 2914 handlers = events2[type] = []; 2915 handlers.delegateCount = 0; 2916 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 2917 if (elem.addEventListener) { 2918 elem.addEventListener(type, eventHandle); 2919 } 2920 } 2921 } 2922 if (special.add) { 2923 special.add.call(elem, handleObj); 2924 if (!handleObj.handler.guid) { 2925 handleObj.handler.guid = handler.guid; 2926 } 2927 } 2928 if (selector3) { 2929 handlers.splice(handlers.delegateCount++, 0, handleObj); 2930 } else { 2931 handlers.push(handleObj); 2932 } 2933 jQuery.event.global[type] = true; 2934 } 2935 }, 2936 // Detach an event or set of events from an element 2937 remove: function(elem, types, handler, selector3, mappedTypes) { 2938 var j2, origCount, tmp, events2, t2, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 2939 if (!elemData || !(events2 = elemData.events)) { 2940 return; 2941 } 2942 types = (types || "").match(rnothtmlwhite) || [""]; 2943 t2 = types.length; 2944 while (t2--) { 2945 tmp = rtypenamespace.exec(types[t2]) || []; 2946 type = origType = tmp[1]; 2947 namespaces = (tmp[2] || "").split(".").sort(); 2948 if (!type) { 2949 for (type in events2) { 2950 jQuery.event.remove(elem, type + types[t2], handler, selector3, true); 2951 } 2952 continue; 2953 } 2954 special = jQuery.event.special[type] || {}; 2955 type = (selector3 ? special.delegateType : special.bindType) || type; 2956 handlers = events2[type] || []; 2957 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 2958 origCount = j2 = handlers.length; 2959 while (j2--) { 2960 handleObj = handlers[j2]; 2961 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector3 || selector3 === handleObj.selector || selector3 === "**" && handleObj.selector)) { 2962 handlers.splice(j2, 1); 2963 if (handleObj.selector) { 2964 handlers.delegateCount--; 2965 } 2966 if (special.remove) { 2967 special.remove.call(elem, handleObj); 2968 } 2969 } 2970 } 2971 if (origCount && !handlers.length) { 2972 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { 2973 jQuery.removeEvent(elem, type, elemData.handle); 2974 } 2975 delete events2[type]; 2976 } 2977 } 2978 if (jQuery.isEmptyObject(events2)) { 2979 dataPriv.remove(elem, "handle events"); 2980 } 2981 }, 2982 dispatch: function(nativeEvent) { 2983 var i2, j2, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event.type] || [], special = jQuery.event.special[event.type] || {}; 2984 args[0] = event; 2985 for (i2 = 1; i2 < arguments.length; i2++) { 2986 args[i2] = arguments[i2]; 2987 } 2988 event.delegateTarget = this; 2989 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 2990 return; 2991 } 2992 handlerQueue = jQuery.event.handlers.call(this, event, handlers); 2993 i2 = 0; 2994 while ((matched = handlerQueue[i2++]) && !event.isPropagationStopped()) { 2995 event.currentTarget = matched.elem; 2996 j2 = 0; 2997 while ((handleObj = matched.handlers[j2++]) && !event.isImmediatePropagationStopped()) { 2998 if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) { 2999 event.handleObj = handleObj; 3000 event.data = handleObj.data; 3001 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args); 3002 if (ret !== void 0) { 3003 if ((event.result = ret) === false) { 3004 event.preventDefault(); 3005 event.stopPropagation(); 3006 } 3007 } 3008 } 3009 } 3010 } 3011 if (special.postDispatch) { 3012 special.postDispatch.call(this, event); 3013 } 3014 return event.result; 3015 }, 3016 handlers: function(event, handlers) { 3017 var i2, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; 3018 if (delegateCount && // Support: IE <=9 3019 // Black-hole SVG <use> instance trees (trac-13180) 3020 cur.nodeType && // Support: Firefox <=42 3021 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 3022 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 3023 // Support: IE 11 only 3024 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 3025 !(event.type === "click" && event.button >= 1)) { 3026 for (; cur !== this; cur = cur.parentNode || this) { 3027 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 3028 matchedHandlers = []; 3029 matchedSelectors = {}; 3030 for (i2 = 0; i2 < delegateCount; i2++) { 3031 handleObj = handlers[i2]; 3032 sel = handleObj.selector + " "; 3033 if (matchedSelectors[sel] === void 0) { 3034 matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length; 3035 } 3036 if (matchedSelectors[sel]) { 3037 matchedHandlers.push(handleObj); 3038 } 3039 } 3040 if (matchedHandlers.length) { 3041 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 3042 } 3043 } 3044 } 3045 } 3046 cur = this; 3047 if (delegateCount < handlers.length) { 3048 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 3049 } 3050 return handlerQueue; 3051 }, 3052 addProp: function(name, hook) { 3053 Object.defineProperty(jQuery.Event.prototype, name, { 3054 enumerable: true, 3055 configurable: true, 3056 get: isFunction2(hook) ? function() { 3057 if (this.originalEvent) { 3058 return hook(this.originalEvent); 3059 } 3060 } : function() { 3061 if (this.originalEvent) { 3062 return this.originalEvent[name]; 3063 } 3064 }, 3065 set: function(value) { 3066 Object.defineProperty(this, name, { 3067 enumerable: true, 3068 configurable: true, 3069 writable: true, 3070 value 3071 }); 3072 } 3073 }); 3074 }, 3075 fix: function(originalEvent) { 3076 return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent); 3077 }, 3078 special: { 3079 load: { 3080 // Prevent triggered image.load events from bubbling to window.load 3081 noBubble: true 3082 }, 3083 click: { 3084 // Utilize native event to ensure correct state for checkable inputs 3085 setup: function(data) { 3086 var el = this || data; 3087 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3088 leverageNative(el, "click", true); 3089 } 3090 return false; 3091 }, 3092 trigger: function(data) { 3093 var el = this || data; 3094 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3095 leverageNative(el, "click"); 3096 } 3097 return true; 3098 }, 3099 // For cross-browser consistency, suppress native .click() on links 3100 // Also prevent it if we're currently inside a leveraged native-event stack 3101 _default: function(event) { 3102 var target = event.target; 3103 return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a"); 3104 } 3105 }, 3106 beforeunload: { 3107 postDispatch: function(event) { 3108 if (event.result !== void 0 && event.originalEvent) { 3109 event.originalEvent.returnValue = event.result; 3110 } 3111 } 3112 } 3113 } 3114 }; 3115 function leverageNative(el, type, isSetup) { 3116 if (!isSetup) { 3117 if (dataPriv.get(el, type) === void 0) { 3118 jQuery.event.add(el, type, returnTrue); 3119 } 3120 return; 3121 } 3122 dataPriv.set(el, type, false); 3123 jQuery.event.add(el, type, { 3124 namespace: false, 3125 handler: function(event) { 3126 var result, saved = dataPriv.get(this, type); 3127 if (event.isTrigger & 1 && this[type]) { 3128 if (!saved) { 3129 saved = slice.call(arguments); 3130 dataPriv.set(this, type, saved); 3131 this[type](); 3132 result = dataPriv.get(this, type); 3133 dataPriv.set(this, type, false); 3134 if (saved !== result) { 3135 event.stopImmediatePropagation(); 3136 event.preventDefault(); 3137 return result; 3138 } 3139 } else if ((jQuery.event.special[type] || {}).delegateType) { 3140 event.stopPropagation(); 3141 } 3142 } else if (saved) { 3143 dataPriv.set(this, type, jQuery.event.trigger( 3144 saved[0], 3145 saved.slice(1), 3146 this 3147 )); 3148 event.stopPropagation(); 3149 event.isImmediatePropagationStopped = returnTrue; 3150 } 3151 } 3152 }); 3153 } 3154 jQuery.removeEvent = function(elem, type, handle) { 3155 if (elem.removeEventListener) { 3156 elem.removeEventListener(type, handle); 3157 } 3158 }; 3159 jQuery.Event = function(src, props) { 3160 if (!(this instanceof jQuery.Event)) { 3161 return new jQuery.Event(src, props); 3162 } 3163 if (src && src.type) { 3164 this.originalEvent = src; 3165 this.type = src.type; 3166 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && // Support: Android <=2.3 only 3167 src.returnValue === false ? returnTrue : returnFalse; 3168 this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target; 3169 this.currentTarget = src.currentTarget; 3170 this.relatedTarget = src.relatedTarget; 3171 } else { 3172 this.type = src; 3173 } 3174 if (props) { 3175 jQuery.extend(this, props); 3176 } 3177 this.timeStamp = src && src.timeStamp || Date.now(); 3178 this[jQuery.expando] = true; 3179 }; 3180 jQuery.Event.prototype = { 3181 constructor: jQuery.Event, 3182 isDefaultPrevented: returnFalse, 3183 isPropagationStopped: returnFalse, 3184 isImmediatePropagationStopped: returnFalse, 3185 isSimulated: false, 3186 preventDefault: function() { 3187 var e2 = this.originalEvent; 3188 this.isDefaultPrevented = returnTrue; 3189 if (e2 && !this.isSimulated) { 3190 e2.preventDefault(); 3191 } 3192 }, 3193 stopPropagation: function() { 3194 var e2 = this.originalEvent; 3195 this.isPropagationStopped = returnTrue; 3196 if (e2 && !this.isSimulated) { 3197 e2.stopPropagation(); 3198 } 3199 }, 3200 stopImmediatePropagation: function() { 3201 var e2 = this.originalEvent; 3202 this.isImmediatePropagationStopped = returnTrue; 3203 if (e2 && !this.isSimulated) { 3204 e2.stopImmediatePropagation(); 3205 } 3206 this.stopPropagation(); 3207 } 3208 }; 3209 jQuery.each({ 3210 altKey: true, 3211 bubbles: true, 3212 cancelable: true, 3213 changedTouches: true, 3214 ctrlKey: true, 3215 detail: true, 3216 eventPhase: true, 3217 metaKey: true, 3218 pageX: true, 3219 pageY: true, 3220 shiftKey: true, 3221 view: true, 3222 "char": true, 3223 code: true, 3224 charCode: true, 3225 key: true, 3226 keyCode: true, 3227 button: true, 3228 buttons: true, 3229 clientX: true, 3230 clientY: true, 3231 offsetX: true, 3232 offsetY: true, 3233 pointerId: true, 3234 pointerType: true, 3235 screenX: true, 3236 screenY: true, 3237 targetTouches: true, 3238 toElement: true, 3239 touches: true, 3240 which: true 3241 }, jQuery.event.addProp); 3242 jQuery.each({ focus: "focusin", blur: "focusout" }, function(type, delegateType) { 3243 function focusMappedHandler(nativeEvent) { 3244 if (document2.documentMode) { 3245 var handle = dataPriv.get(this, "handle"), event = jQuery.event.fix(nativeEvent); 3246 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 3247 event.isSimulated = true; 3248 handle(nativeEvent); 3249 if (event.target === event.currentTarget) { 3250 handle(event); 3251 } 3252 } else { 3253 jQuery.event.simulate( 3254 delegateType, 3255 nativeEvent.target, 3256 jQuery.event.fix(nativeEvent) 3257 ); 3258 } 3259 } 3260 jQuery.event.special[type] = { 3261 // Utilize native event if possible so blur/focus sequence is correct 3262 setup: function() { 3263 var attaches; 3264 leverageNative(this, type, true); 3265 if (document2.documentMode) { 3266 attaches = dataPriv.get(this, delegateType); 3267 if (!attaches) { 3268 this.addEventListener(delegateType, focusMappedHandler); 3269 } 3270 dataPriv.set(this, delegateType, (attaches || 0) + 1); 3271 } else { 3272 return false; 3273 } 3274 }, 3275 trigger: function() { 3276 leverageNative(this, type); 3277 return true; 3278 }, 3279 teardown: function() { 3280 var attaches; 3281 if (document2.documentMode) { 3282 attaches = dataPriv.get(this, delegateType) - 1; 3283 if (!attaches) { 3284 this.removeEventListener(delegateType, focusMappedHandler); 3285 dataPriv.remove(this, delegateType); 3286 } else { 3287 dataPriv.set(this, delegateType, attaches); 3288 } 3289 } else { 3290 return false; 3291 } 3292 }, 3293 // Suppress native focus or blur if we're currently inside 3294 // a leveraged native-event stack 3295 _default: function(event) { 3296 return dataPriv.get(event.target, type); 3297 }, 3298 delegateType 3299 }; 3300 jQuery.event.special[delegateType] = { 3301 setup: function() { 3302 var doc2 = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc2, attaches = dataPriv.get(dataHolder, delegateType); 3303 if (!attaches) { 3304 if (document2.documentMode) { 3305 this.addEventListener(delegateType, focusMappedHandler); 3306 } else { 3307 doc2.addEventListener(type, focusMappedHandler, true); 3308 } 3309 } 3310 dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1); 3311 }, 3312 teardown: function() { 3313 var doc2 = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc2, attaches = dataPriv.get(dataHolder, delegateType) - 1; 3314 if (!attaches) { 3315 if (document2.documentMode) { 3316 this.removeEventListener(delegateType, focusMappedHandler); 3317 } else { 3318 doc2.removeEventListener(type, focusMappedHandler, true); 3319 } 3320 dataPriv.remove(dataHolder, delegateType); 3321 } else { 3322 dataPriv.set(dataHolder, delegateType, attaches); 3323 } 3324 } 3325 }; 3326 }); 3327 jQuery.each({ 3328 mouseenter: "mouseover", 3329 mouseleave: "mouseout", 3330 pointerenter: "pointerover", 3331 pointerleave: "pointerout" 3332 }, function(orig, fix) { 3333 jQuery.event.special[orig] = { 3334 delegateType: fix, 3335 bindType: fix, 3336 handle: function(event) { 3337 var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; 3338 if (!related || related !== target && !jQuery.contains(target, related)) { 3339 event.type = handleObj.origType; 3340 ret = handleObj.handler.apply(this, arguments); 3341 event.type = fix; 3342 } 3343 return ret; 3344 } 3345 }; 3346 }); 3347 jQuery.fn.extend({ 3348 on: function(types, selector3, data, fn) { 3349 return on(this, types, selector3, data, fn); 3350 }, 3351 one: function(types, selector3, data, fn) { 3352 return on(this, types, selector3, data, fn, 1); 3353 }, 3354 off: function(types, selector3, fn) { 3355 var handleObj, type; 3356 if (types && types.preventDefault && types.handleObj) { 3357 handleObj = types.handleObj; 3358 jQuery(types.delegateTarget).off( 3359 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 3360 handleObj.selector, 3361 handleObj.handler 3362 ); 3363 return this; 3364 } 3365 if (typeof types === "object") { 3366 for (type in types) { 3367 this.off(type, selector3, types[type]); 3368 } 3369 return this; 3370 } 3371 if (selector3 === false || typeof selector3 === "function") { 3372 fn = selector3; 3373 selector3 = void 0; 3374 } 3375 if (fn === false) { 3376 fn = returnFalse; 3377 } 3378 return this.each(function() { 3379 jQuery.event.remove(this, types, fn, selector3); 3380 }); 3381 } 3382 }); 3383 var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 3384 function manipulationTarget(elem, content) { 3385 if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 3386 return jQuery(elem).children("tbody")[0] || elem; 3387 } 3388 return elem; 3389 } 3390 function disableScript(elem) { 3391 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 3392 return elem; 3393 } 3394 function restoreScript(elem) { 3395 if ((elem.type || "").slice(0, 5) === "true/") { 3396 elem.type = elem.type.slice(5); 3397 } else { 3398 elem.removeAttribute("type"); 3399 } 3400 return elem; 3401 } 3402 function cloneCopyEvent(src, dest) { 3403 var i2, l2, type, pdataOld, udataOld, udataCur, events2; 3404 if (dest.nodeType !== 1) { 3405 return; 3406 } 3407 if (dataPriv.hasData(src)) { 3408 pdataOld = dataPriv.get(src); 3409 events2 = pdataOld.events; 3410 if (events2) { 3411 dataPriv.remove(dest, "handle events"); 3412 for (type in events2) { 3413 for (i2 = 0, l2 = events2[type].length; i2 < l2; i2++) { 3414 jQuery.event.add(dest, type, events2[type][i2]); 3415 } 3416 } 3417 } 3418 } 3419 if (dataUser.hasData(src)) { 3420 udataOld = dataUser.access(src); 3421 udataCur = jQuery.extend({}, udataOld); 3422 dataUser.set(dest, udataCur); 3423 } 3424 } 3425 function fixInput(src, dest) { 3426 var nodeName2 = dest.nodeName.toLowerCase(); 3427 if (nodeName2 === "input" && rcheckableType.test(src.type)) { 3428 dest.checked = src.checked; 3429 } else if (nodeName2 === "input" || nodeName2 === "textarea") { 3430 dest.defaultValue = src.defaultValue; 3431 } 3432 } 3433 function domManip(collection, args, callback, ignored) { 3434 args = flat3(args); 3435 var fragment, first2, scripts, hasScripts, node, doc2, i2 = 0, l2 = collection.length, iNoClone = l2 - 1, value = args[0], valueIsFunction = isFunction2(value); 3436 if (valueIsFunction || l2 > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) { 3437 return collection.each(function(index3) { 3438 var self2 = collection.eq(index3); 3439 if (valueIsFunction) { 3440 args[0] = value.call(this, index3, self2.html()); 3441 } 3442 domManip(self2, args, callback, ignored); 3443 }); 3444 } 3445 if (l2) { 3446 fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); 3447 first2 = fragment.firstChild; 3448 if (fragment.childNodes.length === 1) { 3449 fragment = first2; 3450 } 3451 if (first2 || ignored) { 3452 scripts = jQuery.map(getAll(fragment, "script"), disableScript); 3453 hasScripts = scripts.length; 3454 for (; i2 < l2; i2++) { 3455 node = fragment; 3456 if (i2 !== iNoClone) { 3457 node = jQuery.clone(node, true, true); 3458 if (hasScripts) { 3459 jQuery.merge(scripts, getAll(node, "script")); 3460 } 3461 } 3462 callback.call(collection[i2], node, i2); 3463 } 3464 if (hasScripts) { 3465 doc2 = scripts[scripts.length - 1].ownerDocument; 3466 jQuery.map(scripts, restoreScript); 3467 for (i2 = 0; i2 < hasScripts; i2++) { 3468 node = scripts[i2]; 3469 if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc2, node)) { 3470 if (node.src && (node.type || "").toLowerCase() !== "module") { 3471 if (jQuery._evalUrl && !node.noModule) { 3472 jQuery._evalUrl(node.src, { 3473 nonce: node.nonce || node.getAttribute("nonce") 3474 }, doc2); 3475 } 3476 } else { 3477 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc2); 3478 } 3479 } 3480 } 3481 } 3482 } 3483 } 3484 return collection; 3485 } 3486 function remove(elem, selector3, keepData) { 3487 var node, nodes = selector3 ? jQuery.filter(selector3, elem) : elem, i2 = 0; 3488 for (; (node = nodes[i2]) != null; i2++) { 3489 if (!keepData && node.nodeType === 1) { 3490 jQuery.cleanData(getAll(node)); 3491 } 3492 if (node.parentNode) { 3493 if (keepData && isAttached(node)) { 3494 setGlobalEval(getAll(node, "script")); 3495 } 3496 node.parentNode.removeChild(node); 3497 } 3498 } 3499 return elem; 3500 } 3501 jQuery.extend({ 3502 htmlPrefilter: function(html) { 3503 return html; 3504 }, 3505 clone: function(elem, dataAndEvents, deepDataAndEvents) { 3506 var i2, l2, srcElements, destElements, clone2 = elem.cloneNode(true), inPage = isAttached(elem); 3507 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { 3508 destElements = getAll(clone2); 3509 srcElements = getAll(elem); 3510 for (i2 = 0, l2 = srcElements.length; i2 < l2; i2++) { 3511 fixInput(srcElements[i2], destElements[i2]); 3512 } 3513 } 3514 if (dataAndEvents) { 3515 if (deepDataAndEvents) { 3516 srcElements = srcElements || getAll(elem); 3517 destElements = destElements || getAll(clone2); 3518 for (i2 = 0, l2 = srcElements.length; i2 < l2; i2++) { 3519 cloneCopyEvent(srcElements[i2], destElements[i2]); 3520 } 3521 } else { 3522 cloneCopyEvent(elem, clone2); 3523 } 3524 } 3525 destElements = getAll(clone2, "script"); 3526 if (destElements.length > 0) { 3527 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 3528 } 3529 return clone2; 3530 }, 3531 cleanData: function(elems) { 3532 var data, elem, type, special = jQuery.event.special, i2 = 0; 3533 for (; (elem = elems[i2]) !== void 0; i2++) { 3534 if (acceptData(elem)) { 3535 if (data = elem[dataPriv.expando]) { 3536 if (data.events) { 3537 for (type in data.events) { 3538 if (special[type]) { 3539 jQuery.event.remove(elem, type); 3540 } else { 3541 jQuery.removeEvent(elem, type, data.handle); 3542 } 3543 } 3544 } 3545 elem[dataPriv.expando] = void 0; 3546 } 3547 if (elem[dataUser.expando]) { 3548 elem[dataUser.expando] = void 0; 3549 } 3550 } 3551 } 3552 } 3553 }); 3554 jQuery.fn.extend({ 3555 detach: function(selector3) { 3556 return remove(this, selector3, true); 3557 }, 3558 remove: function(selector3) { 3559 return remove(this, selector3); 3560 }, 3561 text: function(value) { 3562 return access(this, function(value2) { 3563 return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() { 3564 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3565 this.textContent = value2; 3566 } 3567 }); 3568 }, null, value, arguments.length); 3569 }, 3570 append: function() { 3571 return domManip(this, arguments, function(elem) { 3572 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3573 var target = manipulationTarget(this, elem); 3574 target.appendChild(elem); 3575 } 3576 }); 3577 }, 3578 prepend: function() { 3579 return domManip(this, arguments, function(elem) { 3580 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3581 var target = manipulationTarget(this, elem); 3582 target.insertBefore(elem, target.firstChild); 3583 } 3584 }); 3585 }, 3586 before: function() { 3587 return domManip(this, arguments, function(elem) { 3588 if (this.parentNode) { 3589 this.parentNode.insertBefore(elem, this); 3590 } 3591 }); 3592 }, 3593 after: function() { 3594 return domManip(this, arguments, function(elem) { 3595 if (this.parentNode) { 3596 this.parentNode.insertBefore(elem, this.nextSibling); 3597 } 3598 }); 3599 }, 3600 empty: function() { 3601 var elem, i2 = 0; 3602 for (; (elem = this[i2]) != null; i2++) { 3603 if (elem.nodeType === 1) { 3604 jQuery.cleanData(getAll(elem, false)); 3605 elem.textContent = ""; 3606 } 3607 } 3608 return this; 3609 }, 3610 clone: function(dataAndEvents, deepDataAndEvents) { 3611 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 3612 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 3613 return this.map(function() { 3614 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 3615 }); 3616 }, 3617 html: function(value) { 3618 return access(this, function(value2) { 3619 var elem = this[0] || {}, i2 = 0, l2 = this.length; 3620 if (value2 === void 0 && elem.nodeType === 1) { 3621 return elem.innerHTML; 3622 } 3623 if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) { 3624 value2 = jQuery.htmlPrefilter(value2); 3625 try { 3626 for (; i2 < l2; i2++) { 3627 elem = this[i2] || {}; 3628 if (elem.nodeType === 1) { 3629 jQuery.cleanData(getAll(elem, false)); 3630 elem.innerHTML = value2; 3631 } 3632 } 3633 elem = 0; 3634 } catch (e2) { 3635 } 3636 } 3637 if (elem) { 3638 this.empty().append(value2); 3639 } 3640 }, null, value, arguments.length); 3641 }, 3642 replaceWith: function() { 3643 var ignored = []; 3644 return domManip(this, arguments, function(elem) { 3645 var parent = this.parentNode; 3646 if (jQuery.inArray(this, ignored) < 0) { 3647 jQuery.cleanData(getAll(this)); 3648 if (parent) { 3649 parent.replaceChild(elem, this); 3650 } 3651 } 3652 }, ignored); 3653 } 3654 }); 3655 jQuery.each({ 3656 appendTo: "append", 3657 prependTo: "prepend", 3658 insertBefore: "before", 3659 insertAfter: "after", 3660 replaceAll: "replaceWith" 3661 }, function(name, original) { 3662 jQuery.fn[name] = function(selector3) { 3663 var elems, ret = [], insert = jQuery(selector3), last2 = insert.length - 1, i2 = 0; 3664 for (; i2 <= last2; i2++) { 3665 elems = i2 === last2 ? this : this.clone(true); 3666 jQuery(insert[i2])[original](elems); 3667 push2.apply(ret, elems.get()); 3668 } 3669 return this.pushStack(ret); 3670 }; 3671 }); 3672 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 3673 var rcustomProp = /^--/; 3674 var getStyles = function(elem) { 3675 var view = elem.ownerDocument.defaultView; 3676 if (!view || !view.opener) { 3677 view = window2; 3678 } 3679 return view.getComputedStyle(elem); 3680 }; 3681 var swap = function(elem, options, callback) { 3682 var ret, name, old = {}; 3683 for (name in options) { 3684 old[name] = elem.style[name]; 3685 elem.style[name] = options[name]; 3686 } 3687 ret = callback.call(elem); 3688 for (name in options) { 3689 elem.style[name] = old[name]; 3690 } 3691 return ret; 3692 }; 3693 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 3694 (function() { 3695 function computeStyleTests() { 3696 if (!div) { 3697 return; 3698 } 3699 container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0"; 3700 div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%"; 3701 documentElement.appendChild(container).appendChild(div); 3702 var divStyle = window2.getComputedStyle(div); 3703 pixelPositionVal = divStyle.top !== "1%"; 3704 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 3705 div.style.right = "60%"; 3706 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 3707 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 3708 div.style.position = "absolute"; 3709 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 3710 documentElement.removeChild(container); 3711 div = null; 3712 } 3713 function roundPixelMeasures(measure) { 3714 return Math.round(parseFloat(measure)); 3715 } 3716 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div"); 3717 if (!div.style) { 3718 return; 3719 } 3720 div.style.backgroundClip = "content-box"; 3721 div.cloneNode(true).style.backgroundClip = ""; 3722 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 3723 jQuery.extend(support, { 3724 boxSizingReliable: function() { 3725 computeStyleTests(); 3726 return boxSizingReliableVal; 3727 }, 3728 pixelBoxStyles: function() { 3729 computeStyleTests(); 3730 return pixelBoxStylesVal; 3731 }, 3732 pixelPosition: function() { 3733 computeStyleTests(); 3734 return pixelPositionVal; 3735 }, 3736 reliableMarginLeft: function() { 3737 computeStyleTests(); 3738 return reliableMarginLeftVal; 3739 }, 3740 scrollboxSize: function() { 3741 computeStyleTests(); 3742 return scrollboxSizeVal; 3743 }, 3744 // Support: IE 9 - 11+, Edge 15 - 18+ 3745 // IE/Edge misreport `getComputedStyle` of table rows with width/height 3746 // set in CSS while `offset*` properties report correct values. 3747 // Behavior in IE 9 is more subtle than in newer versions & it passes 3748 // some versions of this test; make sure not to make it pass there! 3749 // 3750 // Support: Firefox 70+ 3751 // Only Firefox includes border widths 3752 // in computed dimensions. (gh-4529) 3753 reliableTrDimensions: function() { 3754 var table, tr, trChild, trStyle; 3755 if (reliableTrDimensionsVal == null) { 3756 table = document2.createElement("table"); 3757 tr = document2.createElement("tr"); 3758 trChild = document2.createElement("div"); 3759 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 3760 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 3761 tr.style.height = "1px"; 3762 trChild.style.height = "9px"; 3763 trChild.style.display = "block"; 3764 documentElement.appendChild(table).appendChild(tr).appendChild(trChild); 3765 trStyle = window2.getComputedStyle(tr); 3766 reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight; 3767 documentElement.removeChild(table); 3768 } 3769 return reliableTrDimensionsVal; 3770 } 3771 }); 3772 })(); 3773 function curCSS(elem, name, computed) { 3774 var width, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style; 3775 computed = computed || getStyles(elem); 3776 if (computed) { 3777 ret = computed.getPropertyValue(name) || computed[name]; 3778 if (isCustomProp && ret) { 3779 ret = ret.replace(rtrimCSS, "$1") || void 0; 3780 } 3781 if (ret === "" && !isAttached(elem)) { 3782 ret = jQuery.style(elem, name); 3783 } 3784 if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) { 3785 width = style.width; 3786 minWidth = style.minWidth; 3787 maxWidth = style.maxWidth; 3788 style.minWidth = style.maxWidth = style.width = ret; 3789 ret = computed.width; 3790 style.width = width; 3791 style.minWidth = minWidth; 3792 style.maxWidth = maxWidth; 3793 } 3794 } 3795 return ret !== void 0 ? ( 3796 // Support: IE <=9 - 11 only 3797 // IE returns zIndex value as an integer. 3798 ret + "" 3799 ) : ret; 3800 } 3801 function addGetHookIf(conditionFn, hookFn) { 3802 return { 3803 get: function() { 3804 if (conditionFn()) { 3805 delete this.get; 3806 return; 3807 } 3808 return (this.get = hookFn).apply(this, arguments); 3809 } 3810 }; 3811 } 3812 var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {}; 3813 function vendorPropName(name) { 3814 var capName = name[0].toUpperCase() + name.slice(1), i2 = cssPrefixes.length; 3815 while (i2--) { 3816 name = cssPrefixes[i2] + capName; 3817 if (name in emptyStyle) { 3818 return name; 3819 } 3820 } 3821 } 3822 function finalPropName(name) { 3823 var final = jQuery.cssProps[name] || vendorProps[name]; 3824 if (final) { 3825 return final; 3826 } 3827 if (name in emptyStyle) { 3828 return name; 3829 } 3830 return vendorProps[name] = vendorPropName(name) || name; 3831 } 3832 var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { 3833 letterSpacing: "0", 3834 fontWeight: "400" 3835 }; 3836 function setPositiveNumber(_elem, value, subtract) { 3837 var matches = rcssNum.exec(value); 3838 return matches ? ( 3839 // Guard against undefined "subtract", e.g., when used as in cssHooks 3840 Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") 3841 ) : value; 3842 } 3843 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 3844 var i2 = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0; 3845 if (box === (isBorderBox ? "border" : "content")) { 3846 return 0; 3847 } 3848 for (; i2 < 4; i2 += 2) { 3849 if (box === "margin") { 3850 marginDelta += jQuery.css(elem, box + cssExpand[i2], true, styles); 3851 } 3852 if (!isBorderBox) { 3853 delta += jQuery.css(elem, "padding" + cssExpand[i2], true, styles); 3854 if (box !== "padding") { 3855 delta += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles); 3856 } else { 3857 extra += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles); 3858 } 3859 } else { 3860 if (box === "content") { 3861 delta -= jQuery.css(elem, "padding" + cssExpand[i2], true, styles); 3862 } 3863 if (box !== "margin") { 3864 delta -= jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles); 3865 } 3866 } 3867 } 3868 if (!isBorderBox && computedVal >= 0) { 3869 delta += Math.max(0, Math.ceil( 3870 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5 3871 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 3872 // Use an explicit zero to avoid NaN (gh-3964) 3873 )) || 0; 3874 } 3875 return delta + marginDelta; 3876 } 3877 function getWidthOrHeight(elem, dimension, extra) { 3878 var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 3879 if (rnumnonpx.test(val)) { 3880 if (!extra) { 3881 return val; 3882 } 3883 val = "auto"; 3884 } 3885 if ((!support.boxSizingReliable() && isBorderBox || // Support: IE 10 - 11+, Edge 15 - 18+ 3886 // IE/Edge misreport `getComputedStyle` of table rows with width/height 3887 // set in CSS while `offset*` properties report correct values. 3888 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 3889 !support.reliableTrDimensions() && nodeName(elem, "tr") || // Fall back to offsetWidth/offsetHeight when value is "auto" 3890 // This happens for inline elements with no explicit setting (gh-3571) 3891 val === "auto" || // Support: Android <=4.1 - 4.3 only 3892 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 3893 !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && // Make sure the element is visible & connected 3894 elem.getClientRects().length) { 3895 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box"; 3896 valueIsBorderBox = offsetProp in elem; 3897 if (valueIsBorderBox) { 3898 val = elem[offsetProp]; 3899 } 3900 } 3901 val = parseFloat(val) || 0; 3902 return val + boxModelAdjustment( 3903 elem, 3904 dimension, 3905 extra || (isBorderBox ? "border" : "content"), 3906 valueIsBorderBox, 3907 styles, 3908 // Provide the current computed size to request scroll gutter calculation (gh-3589) 3909 val 3910 ) + "px"; 3911 } 3912 jQuery.extend({ 3913 // Add in style property hooks for overriding the default 3914 // behavior of getting and setting a style property 3915 cssHooks: { 3916 opacity: { 3917 get: function(elem, computed) { 3918 if (computed) { 3919 var ret = curCSS(elem, "opacity"); 3920 return ret === "" ? "1" : ret; 3921 } 3922 } 3923 } 3924 }, 3925 // Don't automatically add "px" to these possibly-unitless properties 3926 cssNumber: { 3927 animationIterationCount: true, 3928 aspectRatio: true, 3929 borderImageSlice: true, 3930 columnCount: true, 3931 flexGrow: true, 3932 flexShrink: true, 3933 fontWeight: true, 3934 gridArea: true, 3935 gridColumn: true, 3936 gridColumnEnd: true, 3937 gridColumnStart: true, 3938 gridRow: true, 3939 gridRowEnd: true, 3940 gridRowStart: true, 3941 lineHeight: true, 3942 opacity: true, 3943 order: true, 3944 orphans: true, 3945 scale: true, 3946 widows: true, 3947 zIndex: true, 3948 zoom: true, 3949 // SVG-related 3950 fillOpacity: true, 3951 floodOpacity: true, 3952 stopOpacity: true, 3953 strokeMiterlimit: true, 3954 strokeOpacity: true 3955 }, 3956 // Add in properties whose names you wish to fix before 3957 // setting or getting the value 3958 cssProps: {}, 3959 // Get and set the style property on a DOM Node 3960 style: function(elem, name, value, extra) { 3961 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 3962 return; 3963 } 3964 var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style; 3965 if (!isCustomProp) { 3966 name = finalPropName(origName); 3967 } 3968 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 3969 if (value !== void 0) { 3970 type = typeof value; 3971 if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { 3972 value = adjustCSS(elem, name, ret); 3973 type = "number"; 3974 } 3975 if (value == null || value !== value) { 3976 return; 3977 } 3978 if (type === "number" && !isCustomProp) { 3979 value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px"); 3980 } 3981 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 3982 style[name] = "inherit"; 3983 } 3984 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== void 0) { 3985 if (isCustomProp) { 3986 style.setProperty(name, value); 3987 } else { 3988 style[name] = value; 3989 } 3990 } 3991 } else { 3992 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== void 0) { 3993 return ret; 3994 } 3995 return style[name]; 3996 } 3997 }, 3998 css: function(elem, name, extra, styles) { 3999 var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name); 4000 if (!isCustomProp) { 4001 name = finalPropName(origName); 4002 } 4003 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 4004 if (hooks && "get" in hooks) { 4005 val = hooks.get(elem, true, extra); 4006 } 4007 if (val === void 0) { 4008 val = curCSS(elem, name, styles); 4009 } 4010 if (val === "normal" && name in cssNormalTransform) { 4011 val = cssNormalTransform[name]; 4012 } 4013 if (extra === "" || extra) { 4014 num = parseFloat(val); 4015 return extra === true || isFinite(num) ? num || 0 : val; 4016 } 4017 return val; 4018 } 4019 }); 4020 jQuery.each(["height", "width"], function(_i2, dimension) { 4021 jQuery.cssHooks[dimension] = { 4022 get: function(elem, computed, extra) { 4023 if (computed) { 4024 return rdisplayswap.test(jQuery.css(elem, "display")) && // Support: Safari 8+ 4025 // Table columns in Safari have non-zero offsetWidth & zero 4026 // getBoundingClientRect().width unless display is changed. 4027 // Support: IE <=11 only 4028 // Running getBoundingClientRect on a disconnected node 4029 // in IE throws an error. 4030 (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() { 4031 return getWidthOrHeight(elem, dimension, extra); 4032 }) : getWidthOrHeight(elem, dimension, extra); 4033 } 4034 }, 4035 set: function(elem, value, extra) { 4036 var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment( 4037 elem, 4038 dimension, 4039 extra, 4040 isBorderBox, 4041 styles 4042 ) : 0; 4043 if (isBorderBox && scrollboxSizeBuggy) { 4044 subtract -= Math.ceil( 4045 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5 4046 ); 4047 } 4048 if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") { 4049 elem.style[dimension] = value; 4050 value = jQuery.css(elem, dimension); 4051 } 4052 return setPositiveNumber(elem, value, subtract); 4053 } 4054 }; 4055 }); 4056 jQuery.cssHooks.marginLeft = addGetHookIf( 4057 support.reliableMarginLeft, 4058 function(elem, computed) { 4059 if (computed) { 4060 return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() { 4061 return elem.getBoundingClientRect().left; 4062 })) + "px"; 4063 } 4064 } 4065 ); 4066 jQuery.each({ 4067 margin: "", 4068 padding: "", 4069 border: "Width" 4070 }, function(prefix, suffix) { 4071 jQuery.cssHooks[prefix + suffix] = { 4072 expand: function(value) { 4073 var i2 = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value]; 4074 for (; i2 < 4; i2++) { 4075 expanded[prefix + cssExpand[i2] + suffix] = parts[i2] || parts[i2 - 2] || parts[0]; 4076 } 4077 return expanded; 4078 } 4079 }; 4080 if (prefix !== "margin") { 4081 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; 4082 } 4083 }); 4084 jQuery.fn.extend({ 4085 css: function(name, value) { 4086 return access(this, function(elem, name2, value2) { 4087 var styles, len2, map = {}, i2 = 0; 4088 if (Array.isArray(name2)) { 4089 styles = getStyles(elem); 4090 len2 = name2.length; 4091 for (; i2 < len2; i2++) { 4092 map[name2[i2]] = jQuery.css(elem, name2[i2], false, styles); 4093 } 4094 return map; 4095 } 4096 return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2); 4097 }, name, value, arguments.length > 1); 4098 } 4099 }); 4100 function Tween2(elem, options, prop, end, easing) { 4101 return new Tween2.prototype.init(elem, options, prop, end, easing); 4102 } 4103 jQuery.Tween = Tween2; 4104 Tween2.prototype = { 4105 constructor: Tween2, 4106 init: function(elem, options, prop, end, easing, unit) { 4107 this.elem = elem; 4108 this.prop = prop; 4109 this.easing = easing || jQuery.easing._default; 4110 this.options = options; 4111 this.start = this.now = this.cur(); 4112 this.end = end; 4113 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); 4114 }, 4115 cur: function() { 4116 var hooks = Tween2.propHooks[this.prop]; 4117 return hooks && hooks.get ? hooks.get(this) : Tween2.propHooks._default.get(this); 4118 }, 4119 run: function(percent) { 4120 var eased, hooks = Tween2.propHooks[this.prop]; 4121 if (this.options.duration) { 4122 this.pos = eased = jQuery.easing[this.easing]( 4123 percent, 4124 this.options.duration * percent, 4125 0, 4126 1, 4127 this.options.duration 4128 ); 4129 } else { 4130 this.pos = eased = percent; 4131 } 4132 this.now = (this.end - this.start) * eased + this.start; 4133 if (this.options.step) { 4134 this.options.step.call(this.elem, this.now, this); 4135 } 4136 if (hooks && hooks.set) { 4137 hooks.set(this); 4138 } else { 4139 Tween2.propHooks._default.set(this); 4140 } 4141 return this; 4142 } 4143 }; 4144 Tween2.prototype.init.prototype = Tween2.prototype; 4145 Tween2.propHooks = { 4146 _default: { 4147 get: function(tween) { 4148 var result; 4149 if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 4150 return tween.elem[tween.prop]; 4151 } 4152 result = jQuery.css(tween.elem, tween.prop, ""); 4153 return !result || result === "auto" ? 0 : result; 4154 }, 4155 set: function(tween) { 4156 if (jQuery.fx.step[tween.prop]) { 4157 jQuery.fx.step[tween.prop](tween); 4158 } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) { 4159 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 4160 } else { 4161 tween.elem[tween.prop] = tween.now; 4162 } 4163 } 4164 } 4165 }; 4166 Tween2.propHooks.scrollTop = Tween2.propHooks.scrollLeft = { 4167 set: function(tween) { 4168 if (tween.elem.nodeType && tween.elem.parentNode) { 4169 tween.elem[tween.prop] = tween.now; 4170 } 4171 } 4172 }; 4173 jQuery.easing = { 4174 linear: function(p2) { 4175 return p2; 4176 }, 4177 swing: function(p2) { 4178 return 0.5 - Math.cos(p2 * Math.PI) / 2; 4179 }, 4180 _default: "swing" 4181 }; 4182 jQuery.fx = Tween2.prototype.init; 4183 jQuery.fx.step = {}; 4184 var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; 4185 function schedule() { 4186 if (inProgress) { 4187 if (document2.hidden === false && window2.requestAnimationFrame) { 4188 window2.requestAnimationFrame(schedule); 4189 } else { 4190 window2.setTimeout(schedule, jQuery.fx.interval); 4191 } 4192 jQuery.fx.tick(); 4193 } 4194 } 4195 function createFxNow() { 4196 window2.setTimeout(function() { 4197 fxNow = void 0; 4198 }); 4199 return fxNow = Date.now(); 4200 } 4201 function genFx(type, includeWidth) { 4202 var which, i2 = 0, attrs = { height: type }; 4203 includeWidth = includeWidth ? 1 : 0; 4204 for (; i2 < 4; i2 += 2 - includeWidth) { 4205 which = cssExpand[i2]; 4206 attrs["margin" + which] = attrs["padding" + which] = type; 4207 } 4208 if (includeWidth) { 4209 attrs.opacity = attrs.width = type; 4210 } 4211 return attrs; 4212 } 4213 function createTween(value, prop, animation) { 4214 var tween, collection = (Animation2.tweeners[prop] || []).concat(Animation2.tweeners["*"]), index3 = 0, length = collection.length; 4215 for (; index3 < length; index3++) { 4216 if (tween = collection[index3].call(animation, prop, value)) { 4217 return tween; 4218 } 4219 } 4220 } 4221 function defaultPrefilter(elem, props, opts) { 4222 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow"); 4223 if (!opts.queue) { 4224 hooks = jQuery._queueHooks(elem, "fx"); 4225 if (hooks.unqueued == null) { 4226 hooks.unqueued = 0; 4227 oldfire = hooks.empty.fire; 4228 hooks.empty.fire = function() { 4229 if (!hooks.unqueued) { 4230 oldfire(); 4231 } 4232 }; 4233 } 4234 hooks.unqueued++; 4235 anim.always(function() { 4236 anim.always(function() { 4237 hooks.unqueued--; 4238 if (!jQuery.queue(elem, "fx").length) { 4239 hooks.empty.fire(); 4240 } 4241 }); 4242 }); 4243 } 4244 for (prop in props) { 4245 value = props[prop]; 4246 if (rfxtypes.test(value)) { 4247 delete props[prop]; 4248 toggle = toggle || value === "toggle"; 4249 if (value === (hidden ? "hide" : "show")) { 4250 if (value === "show" && dataShow && dataShow[prop] !== void 0) { 4251 hidden = true; 4252 } else { 4253 continue; 4254 } 4255 } 4256 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); 4257 } 4258 } 4259 propTween = !jQuery.isEmptyObject(props); 4260 if (!propTween && jQuery.isEmptyObject(orig)) { 4261 return; 4262 } 4263 if (isBox && elem.nodeType === 1) { 4264 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 4265 restoreDisplay = dataShow && dataShow.display; 4266 if (restoreDisplay == null) {
vendor: 2,416 bytes, lines 4267-4342
4267 restoreDisplay = dataPriv.get(elem, "display"); 4268 } 4269 display = jQuery.css(elem, "display"); 4270 if (display === "none") { 4271 if (restoreDisplay) { 4272 display = restoreDisplay; 4273 } else { 4274 showHide([elem], true); 4275 restoreDisplay = elem.style.display || restoreDisplay; 4276 display = jQuery.css(elem, "display"); 4277 showHide([elem]); 4278 } 4279 } 4280 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 4281 if (jQuery.css(elem, "float") === "none") { 4282 if (!propTween) { 4283 anim.done(function() { 4284 style.display = restoreDisplay; 4285 }); 4286 if (restoreDisplay == null) { 4287 display = style.display; 4288 restoreDisplay = display === "none" ? "" : display; 4289 } 4290 } 4291 style.display = "inline-block"; 4292 } 4293 } 4294 } 4295 if (opts.overflow) { 4296 style.overflow = "hidden"; 4297 anim.always(function() { 4298 style.overflow = opts.overflow[0]; 4299 style.overflowX = opts.overflow[1]; 4300 style.overflowY = opts.overflow[2]; 4301 }); 4302 } 4303 propTween = false; 4304 for (prop in orig) { 4305 if (!propTween) { 4306 if (dataShow) { 4307 if ("hidden" in dataShow) { 4308 hidden = dataShow.hidden; 4309 } 4310 } else { 4311 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 4312 } 4313 if (toggle) { 4314 dataShow.hidden = !hidden; 4315 } 4316 if (hidden) { 4317 showHide([elem], true); 4318 } 4319 anim.done(function() { 4320 if (!hidden) { 4321 showHide([elem]); 4322 } 4323 dataPriv.remove(elem, "fxshow"); 4324 for (prop in orig) { 4325 jQuery.style(elem, prop, orig[prop]); 4326 } 4327 }); 4328 } 4329 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 4330 if (!(prop in dataShow)) { 4331 dataShow[prop] = propTween.start; 4332 if (hidden) { 4333 propTween.end = propTween.start; 4334 propTween.start = 0; 4335 } 4336 } 4337 } 4338 } 4339 function propFilter(props, specialEasing) { 4340 var index3, name, easing, value, hooks; 4341 for (index3 in props) { 4342 name = camelCase(index3);
vendor: 25,064 bytes, lines 4343-5082
4343 easing = specialEasing[name]; 4344 value = props[index3]; 4345 if (Array.isArray(value)) { 4346 easing = value[1]; 4347 value = props[index3] = value[0]; 4348 } 4349 if (index3 !== name) { 4350 props[name] = value; 4351 delete props[index3]; 4352 } 4353 hooks = jQuery.cssHooks[name]; 4354 if (hooks && "expand" in hooks) { 4355 value = hooks.expand(value); 4356 delete props[name]; 4357 for (index3 in value) { 4358 if (!(index3 in props)) { 4359 props[index3] = value[index3]; 4360 specialEasing[index3] = easing; 4361 } 4362 } 4363 } else { 4364 specialEasing[name] = easing; 4365 } 4366 } 4367 } 4368 function Animation2(elem, properties, options) { 4369 var result, stopped, index3 = 0, length = Animation2.prefilters.length, deferred = jQuery.Deferred().always(function() { 4370 delete tick.elem; 4371 }), tick = function() { 4372 if (stopped) { 4373 return false; 4374 } 4375 var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index4 = 0, length2 = animation.tweens.length; 4376 for (; index4 < length2; index4++) { 4377 animation.tweens[index4].run(percent); 4378 } 4379 deferred.notifyWith(elem, [animation, percent, remaining]); 4380 if (percent < 1 && length2) { 4381 return remaining; 4382 } 4383 if (!length2) { 4384 deferred.notifyWith(elem, [animation, 1, 0]); 4385 } 4386 deferred.resolveWith(elem, [animation]); 4387 return false; 4388 }, animation = deferred.promise({ 4389 elem, 4390 props: jQuery.extend({}, properties), 4391 opts: jQuery.extend(true, { 4392 specialEasing: {}, 4393 easing: jQuery.easing._default 4394 }, options), 4395 originalProperties: properties, 4396 originalOptions: options, 4397 startTime: fxNow || createFxNow(), 4398 duration: options.duration, 4399 tweens: [], 4400 createTween: function(prop, end) { 4401 var tween = jQuery.Tween( 4402 elem, 4403 animation.opts, 4404 prop, 4405 end, 4406 animation.opts.specialEasing[prop] || animation.opts.easing 4407 ); 4408 animation.tweens.push(tween); 4409 return tween; 4410 }, 4411 stop: function(gotoEnd) { 4412 var index4 = 0, length2 = gotoEnd ? animation.tweens.length : 0; 4413 if (stopped) { 4414 return this; 4415 } 4416 stopped = true; 4417 for (; index4 < length2; index4++) { 4418 animation.tweens[index4].run(1); 4419 } 4420 if (gotoEnd) { 4421 deferred.notifyWith(elem, [animation, 1, 0]); 4422 deferred.resolveWith(elem, [animation, gotoEnd]); 4423 } else { 4424 deferred.rejectWith(elem, [animation, gotoEnd]); 4425 } 4426 return this; 4427 } 4428 }), props = animation.props; 4429 propFilter(props, animation.opts.specialEasing); 4430 for (; index3 < length; index3++) { 4431 result = Animation2.prefilters[index3].call(animation, elem, props, animation.opts); 4432 if (result) { 4433 if (isFunction2(result.stop)) { 4434 jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result); 4435 } 4436 return result; 4437 } 4438 } 4439 jQuery.map(props, createTween, animation); 4440 if (isFunction2(animation.opts.start)) { 4441 animation.opts.start.call(elem, animation); 4442 } 4443 animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always); 4444 jQuery.fx.timer( 4445 jQuery.extend(tick, { 4446 elem, 4447 anim: animation, 4448 queue: animation.opts.queue 4449 }) 4450 ); 4451 return animation; 4452 } 4453 jQuery.Animation = jQuery.extend(Animation2, { 4454 tweeners: { 4455 "*": [function(prop, value) { 4456 var tween = this.createTween(prop, value); 4457 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 4458 return tween; 4459 }] 4460 }, 4461 tweener: function(props, callback) { 4462 if (isFunction2(props)) { 4463 callback = props; 4464 props = ["*"]; 4465 } else { 4466 props = props.match(rnothtmlwhite); 4467 } 4468 var prop, index3 = 0, length = props.length; 4469 for (; index3 < length; index3++) { 4470 prop = props[index3]; 4471 Animation2.tweeners[prop] = Animation2.tweeners[prop] || []; 4472 Animation2.tweeners[prop].unshift(callback); 4473 } 4474 }, 4475 prefilters: [defaultPrefilter], 4476 prefilter: function(callback, prepend) { 4477 if (prepend) { 4478 Animation2.prefilters.unshift(callback); 4479 } else { 4480 Animation2.prefilters.push(callback); 4481 } 4482 } 4483 }); 4484 jQuery.speed = function(speed, easing, fn) { 4485 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 4486 complete: fn || !fn && easing || isFunction2(speed) && speed, 4487 duration: speed, 4488 easing: fn && easing || easing && !isFunction2(easing) && easing 4489 }; 4490 if (jQuery.fx.off) { 4491 opt.duration = 0; 4492 } else { 4493 if (typeof opt.duration !== "number") { 4494 if (opt.duration in jQuery.fx.speeds) { 4495 opt.duration = jQuery.fx.speeds[opt.duration]; 4496 } else { 4497 opt.duration = jQuery.fx.speeds._default; 4498 } 4499 } 4500 } 4501 if (opt.queue == null || opt.queue === true) { 4502 opt.queue = "fx"; 4503 } 4504 opt.old = opt.complete; 4505 opt.complete = function() { 4506 if (isFunction2(opt.old)) { 4507 opt.old.call(this); 4508 } 4509 if (opt.queue) { 4510 jQuery.dequeue(this, opt.queue); 4511 } 4512 }; 4513 return opt; 4514 }; 4515 jQuery.fn.extend({ 4516 fadeTo: function(speed, to, easing, callback) { 4517 return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback); 4518 }, 4519 animate: function(prop, speed, easing, callback) { 4520 var empty2 = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function() { 4521 var anim = Animation2(this, jQuery.extend({}, prop), optall); 4522 if (empty2 || dataPriv.get(this, "finish")) { 4523 anim.stop(true); 4524 } 4525 }; 4526 doAnimation.finish = doAnimation; 4527 return empty2 || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); 4528 }, 4529 stop: function(type, clearQueue, gotoEnd) { 4530 var stopQueue = function(hooks) { 4531 var stop = hooks.stop; 4532 delete hooks.stop; 4533 stop(gotoEnd); 4534 }; 4535 if (typeof type !== "string") { 4536 gotoEnd = clearQueue; 4537 clearQueue = type; 4538 type = void 0; 4539 } 4540 if (clearQueue) { 4541 this.queue(type || "fx", []); 4542 } 4543 return this.each(function() { 4544 var dequeue = true, index3 = type != null && type + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this); 4545 if (index3) { 4546 if (data[index3] && data[index3].stop) { 4547 stopQueue(data[index3]); 4548 } 4549 } else { 4550 for (index3 in data) { 4551 if (data[index3] && data[index3].stop && rrun.test(index3)) { 4552 stopQueue(data[index3]); 4553 } 4554 } 4555 } 4556 for (index3 = timers.length; index3--; ) { 4557 if (timers[index3].elem === this && (type == null || timers[index3].queue === type)) { 4558 timers[index3].anim.stop(gotoEnd); 4559 dequeue = false; 4560 timers.splice(index3, 1); 4561 } 4562 } 4563 if (dequeue || !gotoEnd) { 4564 jQuery.dequeue(this, type); 4565 } 4566 }); 4567 }, 4568 finish: function(type) { 4569 if (type !== false) { 4570 type = type || "fx"; 4571 } 4572 return this.each(function() { 4573 var index3, data = dataPriv.get(this), queue = data[type + "queue"], hooks = data[type + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0; 4574 data.finish = true; 4575 jQuery.queue(this, type, []); 4576 if (hooks && hooks.stop) { 4577 hooks.stop.call(this, true); 4578 } 4579 for (index3 = timers.length; index3--; ) { 4580 if (timers[index3].elem === this && timers[index3].queue === type) { 4581 timers[index3].anim.stop(true); 4582 timers.splice(index3, 1); 4583 } 4584 } 4585 for (index3 = 0; index3 < length; index3++) { 4586 if (queue[index3] && queue[index3].finish) { 4587 queue[index3].finish.call(this); 4588 } 4589 } 4590 delete data.finish; 4591 }); 4592 } 4593 }); 4594 jQuery.each(["toggle", "show", "hide"], function(_i2, name) { 4595 var cssFn = jQuery.fn[name]; 4596 jQuery.fn[name] = function(speed, easing, callback) { 4597 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); 4598 }; 4599 }); 4600 jQuery.each({ 4601 slideDown: genFx("show"), 4602 slideUp: genFx("hide"), 4603 slideToggle: genFx("toggle"), 4604 fadeIn: { opacity: "show" }, 4605 fadeOut: { opacity: "hide" }, 4606 fadeToggle: { opacity: "toggle" } 4607 }, function(name, props) { 4608 jQuery.fn[name] = function(speed, easing, callback) { 4609 return this.animate(props, speed, easing, callback); 4610 }; 4611 }); 4612 jQuery.timers = []; 4613 jQuery.fx.tick = function() { 4614 var timer, i2 = 0, timers = jQuery.timers; 4615 fxNow = Date.now(); 4616 for (; i2 < timers.length; i2++) { 4617 timer = timers[i2]; 4618 if (!timer() && timers[i2] === timer) { 4619 timers.splice(i2--, 1); 4620 } 4621 } 4622 if (!timers.length) { 4623 jQuery.fx.stop(); 4624 } 4625 fxNow = void 0; 4626 }; 4627 jQuery.fx.timer = function(timer) { 4628 jQuery.timers.push(timer); 4629 jQuery.fx.start(); 4630 }; 4631 jQuery.fx.interval = 13; 4632 jQuery.fx.start = function() { 4633 if (inProgress) { 4634 return; 4635 } 4636 inProgress = true; 4637 schedule(); 4638 }; 4639 jQuery.fx.stop = function() { 4640 inProgress = null; 4641 }; 4642 jQuery.fx.speeds = { 4643 slow: 600, 4644 fast: 200, 4645 // Default speed 4646 _default: 400 4647 }; 4648 jQuery.fn.delay = function(time, type) { 4649 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 4650 type = type || "fx"; 4651 return this.queue(type, function(next2, hooks) { 4652 var timeout = window2.setTimeout(next2, time); 4653 hooks.stop = function() { 4654 window2.clearTimeout(timeout); 4655 }; 4656 }); 4657 }; 4658 (function() { 4659 var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option")); 4660 input.type = "checkbox"; 4661 support.checkOn = input.value !== ""; 4662 support.optSelected = opt.selected; 4663 input = document2.createElement("input"); 4664 input.value = "t"; 4665 input.type = "radio"; 4666 support.radioValue = input.value === "t"; 4667 })(); 4668 var boolHook, attrHandle = jQuery.expr.attrHandle; 4669 jQuery.fn.extend({ 4670 attr: function(name, value) { 4671 return access(this, jQuery.attr, name, value, arguments.length > 1); 4672 }, 4673 removeAttr: function(name) { 4674 return this.each(function() { 4675 jQuery.removeAttr(this, name); 4676 }); 4677 } 4678 }); 4679 jQuery.extend({ 4680 attr: function(elem, name, value) { 4681 var ret, hooks, nType = elem.nodeType; 4682 if (nType === 3 || nType === 8 || nType === 2) { 4683 return; 4684 } 4685 if (typeof elem.getAttribute === "undefined") { 4686 return jQuery.prop(elem, name, value); 4687 } 4688 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 4689 hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0); 4690 } 4691 if (value !== void 0) { 4692 if (value === null) { 4693 jQuery.removeAttr(elem, name); 4694 return; 4695 } 4696 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) { 4697 return ret; 4698 } 4699 elem.setAttribute(name, value + ""); 4700 return value; 4701 } 4702 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4703 return ret; 4704 } 4705 ret = jQuery.find.attr(elem, name); 4706 return ret == null ? void 0 : ret; 4707 }, 4708 attrHooks: { 4709 type: { 4710 set: function(elem, value) { 4711 if (!support.radioValue && value === "radio" && nodeName(elem, "input")) { 4712 var val = elem.value; 4713 elem.setAttribute("type", value); 4714 if (val) { 4715 elem.value = val; 4716 } 4717 return value; 4718 } 4719 } 4720 } 4721 }, 4722 removeAttr: function(elem, value) { 4723 var name, i2 = 0, attrNames = value && value.match(rnothtmlwhite); 4724 if (attrNames && elem.nodeType === 1) { 4725 while (name = attrNames[i2++]) { 4726 elem.removeAttribute(name); 4727 } 4728 } 4729 } 4730 }); 4731 boolHook = { 4732 set: function(elem, value, name) { 4733 if (value === false) { 4734 jQuery.removeAttr(elem, name); 4735 } else { 4736 elem.setAttribute(name, name); 4737 } 4738 return name; 4739 } 4740 }; 4741 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i2, name) { 4742 var getter = attrHandle[name] || jQuery.find.attr; 4743 attrHandle[name] = function(elem, name2, isXML) { 4744 var ret, handle, lowercaseName = name2.toLowerCase(); 4745 if (!isXML) { 4746 handle = attrHandle[lowercaseName]; 4747 attrHandle[lowercaseName] = ret; 4748 ret = getter(elem, name2, isXML) != null ? lowercaseName : null; 4749 attrHandle[lowercaseName] = handle; 4750 } 4751 return ret; 4752 }; 4753 }); 4754 var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; 4755 jQuery.fn.extend({ 4756 prop: function(name, value) { 4757 return access(this, jQuery.prop, name, value, arguments.length > 1); 4758 }, 4759 removeProp: function(name) { 4760 return this.each(function() { 4761 delete this[jQuery.propFix[name] || name]; 4762 }); 4763 } 4764 }); 4765 jQuery.extend({ 4766 prop: function(elem, name, value) { 4767 var ret, hooks, nType = elem.nodeType; 4768 if (nType === 3 || nType === 8 || nType === 2) { 4769 return; 4770 } 4771 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 4772 name = jQuery.propFix[name] || name; 4773 hooks = jQuery.propHooks[name]; 4774 } 4775 if (value !== void 0) { 4776 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== void 0) { 4777 return ret; 4778 } 4779 return elem[name] = value; 4780 } 4781 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4782 return ret; 4783 } 4784 return elem[name]; 4785 }, 4786 propHooks: { 4787 tabIndex: { 4788 get: function(elem) { 4789 var tabindex = jQuery.find.attr(elem, "tabindex"); 4790 if (tabindex) { 4791 return parseInt(tabindex, 10); 4792 } 4793 if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) { 4794 return 0; 4795 } 4796 return -1; 4797 } 4798 } 4799 }, 4800 propFix: { 4801 "for": "htmlFor", 4802 "class": "className" 4803 } 4804 }); 4805 if (!support.optSelected) { 4806 jQuery.propHooks.selected = { 4807 get: function(elem) { 4808 var parent = elem.parentNode; 4809 if (parent && parent.parentNode) { 4810 parent.parentNode.selectedIndex; 4811 } 4812 return null; 4813 }, 4814 set: function(elem) { 4815 var parent = elem.parentNode; 4816 if (parent) { 4817 parent.selectedIndex; 4818 if (parent.parentNode) { 4819 parent.parentNode.selectedIndex; 4820 } 4821 } 4822 } 4823 }; 4824 } 4825 jQuery.each([ 4826 "tabIndex", 4827 "readOnly", 4828 "maxLength", 4829 "cellSpacing", 4830 "cellPadding", 4831 "rowSpan", 4832 "colSpan", 4833 "useMap", 4834 "frameBorder", 4835 "contentEditable" 4836 ], function() { 4837 jQuery.propFix[this.toLowerCase()] = this; 4838 }); 4839 function stripAndCollapse(value) { 4840 var tokens = value.match(rnothtmlwhite) || []; 4841 return tokens.join(" "); 4842 } 4843 function getClass(elem) { 4844 return elem.getAttribute && elem.getAttribute("class") || ""; 4845 } 4846 function classesToArray(value) { 4847 if (Array.isArray(value)) { 4848 return value; 4849 } 4850 if (typeof value === "string") { 4851 return value.match(rnothtmlwhite) || []; 4852 } 4853 return []; 4854 } 4855 jQuery.fn.extend({ 4856 addClass: function(value) { 4857 var classNames, cur, curValue, className, i2, finalValue; 4858 if (isFunction2(value)) { 4859 return this.each(function(j2) { 4860 jQuery(this).addClass(value.call(this, j2, getClass(this))); 4861 }); 4862 } 4863 classNames = classesToArray(value); 4864 if (classNames.length) { 4865 return this.each(function() { 4866 curValue = getClass(this); 4867 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4868 if (cur) { 4869 for (i2 = 0; i2 < classNames.length; i2++) { 4870 className = classNames[i2]; 4871 if (cur.indexOf(" " + className + " ") < 0) { 4872 cur += className + " "; 4873 } 4874 } 4875 finalValue = stripAndCollapse(cur); 4876 if (curValue !== finalValue) { 4877 this.setAttribute("class", finalValue); 4878 } 4879 } 4880 }); 4881 } 4882 return this; 4883 }, 4884 removeClass: function(value) { 4885 var classNames, cur, curValue, className, i2, finalValue; 4886 if (isFunction2(value)) { 4887 return this.each(function(j2) { 4888 jQuery(this).removeClass(value.call(this, j2, getClass(this))); 4889 }); 4890 } 4891 if (!arguments.length) { 4892 return this.attr("class", ""); 4893 } 4894 classNames = classesToArray(value); 4895 if (classNames.length) { 4896 return this.each(function() { 4897 curValue = getClass(this); 4898 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4899 if (cur) { 4900 for (i2 = 0; i2 < classNames.length; i2++) { 4901 className = classNames[i2]; 4902 while (cur.indexOf(" " + className + " ") > -1) { 4903 cur = cur.replace(" " + className + " ", " "); 4904 } 4905 } 4906 finalValue = stripAndCollapse(cur); 4907 if (curValue !== finalValue) { 4908 this.setAttribute("class", finalValue); 4909 } 4910 } 4911 }); 4912 } 4913 return this; 4914 }, 4915 toggleClass: function(value, stateVal) { 4916 var classNames, className, i2, self2, type = typeof value, isValidValue = type === "string" || Array.isArray(value); 4917 if (isFunction2(value)) { 4918 return this.each(function(i3) { 4919 jQuery(this).toggleClass( 4920 value.call(this, i3, getClass(this), stateVal), 4921 stateVal 4922 ); 4923 }); 4924 } 4925 if (typeof stateVal === "boolean" && isValidValue) { 4926 return stateVal ? this.addClass(value) : this.removeClass(value); 4927 } 4928 classNames = classesToArray(value); 4929 return this.each(function() { 4930 if (isValidValue) { 4931 self2 = jQuery(this); 4932 for (i2 = 0; i2 < classNames.length; i2++) { 4933 className = classNames[i2]; 4934 if (self2.hasClass(className)) { 4935 self2.removeClass(className); 4936 } else { 4937 self2.addClass(className); 4938 } 4939 } 4940 } else if (value === void 0 || type === "boolean") { 4941 className = getClass(this); 4942 if (className) { 4943 dataPriv.set(this, "__className__", className); 4944 } 4945 if (this.setAttribute) { 4946 this.setAttribute( 4947 "class", 4948 className || value === false ? "" : dataPriv.get(this, "__className__") || "" 4949 ); 4950 } 4951 } 4952 }); 4953 }, 4954 hasClass: function(selector3) { 4955 var className, elem, i2 = 0; 4956 className = " " + selector3 + " "; 4957 while (elem = this[i2++]) { 4958 if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 4959 return true; 4960 } 4961 } 4962 return false; 4963 } 4964 }); 4965 var rreturn = /\r/g; 4966 jQuery.fn.extend({ 4967 val: function(value) { 4968 var hooks, ret, valueIsFunction, elem = this[0]; 4969 if (!arguments.length) { 4970 if (elem) { 4971 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; 4972 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== void 0) { 4973 return ret; 4974 } 4975 ret = elem.value; 4976 if (typeof ret === "string") { 4977 return ret.replace(rreturn, ""); 4978 } 4979 return ret == null ? "" : ret; 4980 } 4981 return; 4982 } 4983 valueIsFunction = isFunction2(value); 4984 return this.each(function(i2) { 4985 var val; 4986 if (this.nodeType !== 1) { 4987 return; 4988 } 4989 if (valueIsFunction) { 4990 val = value.call(this, i2, jQuery(this).val()); 4991 } else { 4992 val = value; 4993 } 4994 if (val == null) { 4995 val = ""; 4996 } else if (typeof val === "number") { 4997 val += ""; 4998 } else if (Array.isArray(val)) { 4999 val = jQuery.map(val, function(value2) { 5000 return value2 == null ? "" : value2 + ""; 5001 }); 5002 } 5003 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 5004 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === void 0) { 5005 this.value = val; 5006 } 5007 }); 5008 } 5009 }); 5010 jQuery.extend({ 5011 valHooks: { 5012 option: { 5013 get: function(elem) { 5014 var val = jQuery.find.attr(elem, "value"); 5015 return val != null ? val : ( 5016 // Support: IE <=10 - 11 only 5017 // option.text throws exceptions (trac-14686, trac-14858) 5018 // Strip and collapse whitespace 5019 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 5020 stripAndCollapse(jQuery.text(elem)) 5021 ); 5022 } 5023 }, 5024 select: { 5025 get: function(elem) { 5026 var value, option, i2, options = elem.options, index3 = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], max = one ? index3 + 1 : options.length; 5027 if (index3 < 0) { 5028 i2 = max; 5029 } else { 5030 i2 = one ? index3 : 0; 5031 } 5032 for (; i2 < max; i2++) { 5033 option = options[i2]; 5034 if ((option.selected || i2 === index3) && // Don't return options that are disabled or in a disabled optgroup 5035 !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) { 5036 value = jQuery(option).val(); 5037 if (one) { 5038 return value; 5039 } 5040 values.push(value); 5041 } 5042 } 5043 return values; 5044 }, 5045 set: function(elem, value) { 5046 var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i2 = options.length; 5047 while (i2--) { 5048 option = options[i2]; 5049 if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) { 5050 optionSet = true; 5051 } 5052 } 5053 if (!optionSet) { 5054 elem.selectedIndex = -1; 5055 } 5056 return values; 5057 } 5058 } 5059 } 5060 }); 5061 jQuery.each(["radio", "checkbox"], function() { 5062 jQuery.valHooks[this] = { 5063 set: function(elem, value) { 5064 if (Array.isArray(value)) { 5065 return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1; 5066 } 5067 } 5068 }; 5069 if (!support.checkOn) { 5070 jQuery.valHooks[this].get = function(elem) { 5071 return elem.getAttribute("value") === null ? "on" : elem.value; 5072 }; 5073 } 5074 }); 5075 var location2 = window2.location; 5076 var nonce = { guid: Date.now() }; 5077 var rquery = /\?/; 5078 jQuery.parseXML = function(data) { 5079 var xml, parserErrorElem; 5080 if (!data || typeof data !== "string") { 5081 return null; 5082 }
vendor: 2,712 bytes, lines 5083-5143
5083 try { 5084 xml = new window2.DOMParser().parseFromString(data, "text/xml"); 5085 } catch (e2) { 5086 } 5087 parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0]; 5088 if (!xml || parserErrorElem) { 5089 jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function(el) { 5090 return el.textContent; 5091 }).join("\n") : data)); 5092 } 5093 return xml; 5094 }; 5095 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e2) { 5096 e2.stopPropagation(); 5097 }; 5098 jQuery.extend(jQuery.event, { 5099 trigger: function(event, data, elem, onlyHandlers) { 5100 var i2, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document2], type = hasOwn.call(event, "type") ? event.type : event, namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 5101 cur = lastElement = tmp = elem = elem || document2; 5102 if (elem.nodeType === 3 || elem.nodeType === 8) { 5103 return; 5104 } 5105 if (rfocusMorph.test(type + jQuery.event.triggered)) { 5106 return; 5107 } 5108 if (type.indexOf(".") > -1) { 5109 namespaces = type.split("."); 5110 type = namespaces.shift(); 5111 namespaces.sort(); 5112 } 5113 ontype = type.indexOf(":") < 0 && "on" + type; 5114 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event); 5115 event.isTrigger = onlyHandlers ? 2 : 3; 5116 event.namespace = namespaces.join("."); 5117 event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 5118 event.result = void 0; 5119 if (!event.target) { 5120 event.target = elem; 5121 } 5122 data = data == null ? [event] : jQuery.makeArray(data, [event]); 5123 special = jQuery.event.special[type] || {}; 5124 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 5125 return; 5126 } 5127 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 5128 bubbleType = special.delegateType || type; 5129 if (!rfocusMorph.test(bubbleType + type)) { 5130 cur = cur.parentNode; 5131 } 5132 for (; cur; cur = cur.parentNode) { 5133 eventPath.push(cur); 5134 tmp = cur; 5135 } 5136 if (tmp === (elem.ownerDocument || document2)) { 5137 eventPath.push(tmp.defaultView || tmp.parentWindow || window2); 5138 } 5139 } 5140 i2 = 0; 5141 while ((cur = eventPath[i2++]) && !event.isPropagationStopped()) { 5142 lastElement = cur; 5143 event.type = i2 > 1 ? bubbleType : special.bindType || type;
vendor: 41,145 bytes, lines 5144-6260
5144 handle = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event.type] && dataPriv.get(cur, "handle"); 5145 if (handle) { 5146 handle.apply(cur, data); 5147 } 5148 handle = ontype && cur[ontype]; 5149 if (handle && handle.apply && acceptData(cur)) { 5150 event.result = handle.apply(cur, data); 5151 if (event.result === false) { 5152 event.preventDefault(); 5153 } 5154 } 5155 } 5156 event.type = type; 5157 if (!onlyHandlers && !event.isDefaultPrevented()) { 5158 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) { 5159 if (ontype && isFunction2(elem[type]) && !isWindow(elem)) { 5160 tmp = elem[ontype]; 5161 if (tmp) { 5162 elem[ontype] = null; 5163 } 5164 jQuery.event.triggered = type; 5165 if (event.isPropagationStopped()) { 5166 lastElement.addEventListener(type, stopPropagationCallback); 5167 } 5168 elem[type](); 5169 if (event.isPropagationStopped()) { 5170 lastElement.removeEventListener(type, stopPropagationCallback); 5171 } 5172 jQuery.event.triggered = void 0; 5173 if (tmp) { 5174 elem[ontype] = tmp; 5175 } 5176 } 5177 } 5178 } 5179 return event.result; 5180 }, 5181 // Piggyback on a donor event to simulate a different one 5182 // Used only for `focus(in | out)` events 5183 simulate: function(type, elem, event) { 5184 var e2 = jQuery.extend( 5185 new jQuery.Event(), 5186 event, 5187 { 5188 type, 5189 isSimulated: true 5190 } 5191 ); 5192 jQuery.event.trigger(e2, null, elem); 5193 } 5194 }); 5195 jQuery.fn.extend({ 5196 trigger: function(type, data) { 5197 return this.each(function() { 5198 jQuery.event.trigger(type, data, this); 5199 }); 5200 }, 5201 triggerHandler: function(type, data) { 5202 var elem = this[0]; 5203 if (elem) { 5204 return jQuery.event.trigger(type, data, elem, true); 5205 } 5206 } 5207 }); 5208 var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; 5209 function buildParams(prefix, obj, traditional, add2) { 5210 var name; 5211 if (Array.isArray(obj)) { 5212 jQuery.each(obj, function(i2, v2) { 5213 if (traditional || rbracket.test(prefix)) { 5214 add2(prefix, v2); 5215 } else { 5216 buildParams( 5217 prefix + "[" + (typeof v2 === "object" && v2 != null ? i2 : "") + "]", 5218 v2, 5219 traditional, 5220 add2 5221 ); 5222 } 5223 }); 5224 } else if (!traditional && toType(obj) === "object") { 5225 for (name in obj) { 5226 buildParams(prefix + "[" + name + "]", obj[name], traditional, add2); 5227 } 5228 } else { 5229 add2(prefix, obj); 5230 } 5231 } 5232 jQuery.param = function(a2, traditional) { 5233 var prefix, s2 = [], add2 = function(key2, valueOrFunction) { 5234 var value = isFunction2(valueOrFunction) ? valueOrFunction() : valueOrFunction; 5235 s2[s2.length] = encodeURIComponent(key2) + "=" + encodeURIComponent(value == null ? "" : value); 5236 }; 5237 if (a2 == null) { 5238 return ""; 5239 } 5240 if (Array.isArray(a2) || a2.jquery && !jQuery.isPlainObject(a2)) { 5241 jQuery.each(a2, function() { 5242 add2(this.name, this.value); 5243 }); 5244 } else { 5245 for (prefix in a2) { 5246 buildParams(prefix, a2[prefix], traditional, add2); 5247 } 5248 } 5249 return s2.join("&"); 5250 }; 5251 jQuery.fn.extend({ 5252 serialize: function() { 5253 return jQuery.param(this.serializeArray()); 5254 }, 5255 serializeArray: function() { 5256 return this.map(function() { 5257 var elements = jQuery.prop(this, "elements"); 5258 return elements ? jQuery.makeArray(elements) : this; 5259 }).filter(function() { 5260 var type = this.type; 5261 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type)); 5262 }).map(function(_i2, elem) { 5263 var val = jQuery(this).val(); 5264 if (val == null) { 5265 return null; 5266 } 5267 if (Array.isArray(val)) { 5268 return jQuery.map(val, function(val2) { 5269 return { name: elem.name, value: val2.replace(rCRLF, "\r\n") }; 5270 }); 5271 } 5272 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 5273 }).get(); 5274 } 5275 }); 5276 var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = "*/".concat("*"), originAnchor = document2.createElement("a"); 5277 originAnchor.href = location2.href; 5278 function addToPrefiltersOrTransports(structure) { 5279 return function(dataTypeExpression, func) { 5280 if (typeof dataTypeExpression !== "string") { 5281 func = dataTypeExpression; 5282 dataTypeExpression = "*"; 5283 } 5284 var dataType, i2 = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 5285 if (isFunction2(func)) { 5286 while (dataType = dataTypes[i2++]) { 5287 if (dataType[0] === "+") { 5288 dataType = dataType.slice(1) || "*"; 5289 (structure[dataType] = structure[dataType] || []).unshift(func); 5290 } else { 5291 (structure[dataType] = structure[dataType] || []).push(func); 5292 } 5293 } 5294 } 5295 }; 5296 } 5297 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 5298 var inspected = {}, seekingTransport = structure === transports; 5299 function inspect(dataType) { 5300 var selected; 5301 inspected[dataType] = true; 5302 jQuery.each(structure[dataType] || [], function(_2, prefilterOrFactory) { 5303 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 5304 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { 5305 options.dataTypes.unshift(dataTypeOrTransport); 5306 inspect(dataTypeOrTransport); 5307 return false; 5308 } else if (seekingTransport) { 5309 return !(selected = dataTypeOrTransport); 5310 } 5311 }); 5312 return selected; 5313 } 5314 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 5315 } 5316 function ajaxExtend(target, src) { 5317 var key2, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; 5318 for (key2 in src) { 5319 if (src[key2] !== void 0) { 5320 (flatOptions[key2] ? target : deep || (deep = {}))[key2] = src[key2]; 5321 } 5322 } 5323 if (deep) { 5324 jQuery.extend(true, target, deep); 5325 } 5326 return target; 5327 } 5328 function ajaxHandleResponses(s2, jqXHR, responses) { 5329 var ct, type, finalDataType, firstDataType, contents = s2.contents, dataTypes = s2.dataTypes; 5330 while (dataTypes[0] === "*") { 5331 dataTypes.shift(); 5332 if (ct === void 0) { 5333 ct = s2.mimeType || jqXHR.getResponseHeader("Content-Type"); 5334 } 5335 } 5336 if (ct) { 5337 for (type in contents) { 5338 if (contents[type] && contents[type].test(ct)) { 5339 dataTypes.unshift(type); 5340 break; 5341 } 5342 } 5343 } 5344 if (dataTypes[0] in responses) { 5345 finalDataType = dataTypes[0]; 5346 } else { 5347 for (type in responses) { 5348 if (!dataTypes[0] || s2.converters[type + " " + dataTypes[0]]) { 5349 finalDataType = type; 5350 break; 5351 } 5352 if (!firstDataType) { 5353 firstDataType = type; 5354 } 5355 } 5356 finalDataType = finalDataType || firstDataType; 5357 } 5358 if (finalDataType) { 5359 if (finalDataType !== dataTypes[0]) { 5360 dataTypes.unshift(finalDataType); 5361 } 5362 return responses[finalDataType]; 5363 } 5364 } 5365 function ajaxConvert(s2, response, jqXHR, isSuccess) { 5366 var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s2.dataTypes.slice(); 5367 if (dataTypes[1]) { 5368 for (conv in s2.converters) { 5369 converters[conv.toLowerCase()] = s2.converters[conv]; 5370 } 5371 } 5372 current = dataTypes.shift(); 5373 while (current) { 5374 if (s2.responseFields[current]) { 5375 jqXHR[s2.responseFields[current]] = response; 5376 } 5377 if (!prev && isSuccess && s2.dataFilter) { 5378 response = s2.dataFilter(response, s2.dataType); 5379 } 5380 prev = current; 5381 current = dataTypes.shift(); 5382 if (current) { 5383 if (current === "*") { 5384 current = prev; 5385 } else if (prev !== "*" && prev !== current) { 5386 conv = converters[prev + " " + current] || converters["* " + current]; 5387 if (!conv) { 5388 for (conv2 in converters) { 5389 tmp = conv2.split(" "); 5390 if (tmp[1] === current) { 5391 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; 5392 if (conv) { 5393 if (conv === true) { 5394 conv = converters[conv2]; 5395 } else if (converters[conv2] !== true) { 5396 current = tmp[0]; 5397 dataTypes.unshift(tmp[1]); 5398 } 5399 break; 5400 } 5401 } 5402 } 5403 } 5404 if (conv !== true) { 5405 if (conv && s2.throws) { 5406 response = conv(response); 5407 } else { 5408 try { 5409 response = conv(response); 5410 } catch (e2) { 5411 return { 5412 state: "parsererror", 5413 error: conv ? e2 : "No conversion from " + prev + " to " + current 5414 }; 5415 } 5416 } 5417 } 5418 } 5419 } 5420 } 5421 return { state: "success", data: response }; 5422 } 5423 jQuery.extend({ 5424 // Counter for holding the number of active queries 5425 active: 0, 5426 // Last-Modified header cache for next request 5427 lastModified: {}, 5428 etag: {}, 5429 ajaxSettings: { 5430 url: location2.href, 5431 type: "GET", 5432 isLocal: rlocalProtocol.test(location2.protocol), 5433 global: true, 5434 processData: true, 5435 async: true, 5436 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 5437 /* 5438 timeout: 0, 5439 data: null, 5440 dataType: null, 5441 username: null, 5442 password: null, 5443 cache: null, 5444 throws: false, 5445 traditional: false, 5446 headers: {}, 5447 */ 5448 accepts: { 5449 "*": allTypes, 5450 text: "text/plain", 5451 html: "text/html", 5452 xml: "application/xml, text/xml", 5453 json: "application/json, text/javascript" 5454 }, 5455 contents: { 5456 xml: /\bxml\b/, 5457 html: /\bhtml/, 5458 json: /\bjson\b/ 5459 }, 5460 responseFields: { 5461 xml: "responseXML", 5462 text: "responseText", 5463 json: "responseJSON" 5464 }, 5465 // Data converters 5466 // Keys separate source (or catchall "*") and destination types with a single space 5467 converters: { 5468 // Convert anything to text 5469 "* text": String, 5470 // Text to html (true = no transformation) 5471 "text html": true, 5472 // Evaluate text as a json expression 5473 "text json": JSON.parse, 5474 // Parse text as xml 5475 "text xml": jQuery.parseXML 5476 }, 5477 // For options that shouldn't be deep extended: 5478 // you can add your own custom options here if 5479 // and when you create one that shouldn't be 5480 // deep extended (see ajaxExtend) 5481 flatOptions: { 5482 url: true, 5483 context: true 5484 } 5485 }, 5486 // Creates a full fledged settings object into target 5487 // with both ajaxSettings and settings fields. 5488 // If target is omitted, writes into ajaxSettings. 5489 ajaxSetup: function(target, settings) { 5490 return settings ? ( 5491 // Building a settings object 5492 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) 5493 ) : ( 5494 // Extending ajaxSettings 5495 ajaxExtend(jQuery.ajaxSettings, target) 5496 ); 5497 }, 5498 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 5499 ajaxTransport: addToPrefiltersOrTransports(transports), 5500 // Main method 5501 ajax: function(url, options) { 5502 if (typeof url === "object") { 5503 options = url; 5504 url = void 0; 5505 } 5506 options = options || {}; 5507 var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i2, uncached, s2 = jQuery.ajaxSetup({}, options), callbackContext = s2.context || s2, globalEventContext = s2.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s2.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = { 5508 readyState: 0, 5509 // Builds headers hashtable if needed 5510 getResponseHeader: function(key2) { 5511 var match; 5512 if (completed2) { 5513 if (!responseHeaders) { 5514 responseHeaders = {}; 5515 while (match = rheaders.exec(responseHeadersString)) { 5516 responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]); 5517 } 5518 } 5519 match = responseHeaders[key2.toLowerCase() + " "]; 5520 } 5521 return match == null ? null : match.join(", "); 5522 }, 5523 // Raw string 5524 getAllResponseHeaders: function() { 5525 return completed2 ? responseHeadersString : null; 5526 }, 5527 // Caches the header 5528 setRequestHeader: function(name, value) { 5529 if (completed2 == null) { 5530 name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name; 5531 requestHeaders[name] = value; 5532 } 5533 return this; 5534 }, 5535 // Overrides response content-type header 5536 overrideMimeType: function(type) { 5537 if (completed2 == null) { 5538 s2.mimeType = type; 5539 } 5540 return this; 5541 }, 5542 // Status-dependent callbacks 5543 statusCode: function(map) { 5544 var code; 5545 if (map) { 5546 if (completed2) { 5547 jqXHR.always(map[jqXHR.status]); 5548 } else { 5549 for (code in map) { 5550 statusCode[code] = [statusCode[code], map[code]]; 5551 } 5552 } 5553 } 5554 return this; 5555 }, 5556 // Cancel the request 5557 abort: function(statusText) { 5558 var finalText = statusText || strAbort; 5559 if (transport) { 5560 transport.abort(finalText); 5561 } 5562 done(0, finalText); 5563 return this; 5564 } 5565 }; 5566 deferred.promise(jqXHR); 5567 s2.url = ((url || s2.url || location2.href) + "").replace(rprotocol, location2.protocol + "//"); 5568 s2.type = options.method || options.type || s2.method || s2.type; 5569 s2.dataTypes = (s2.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 5570 if (s2.crossDomain == null) { 5571 urlAnchor = document2.createElement("a"); 5572 try { 5573 urlAnchor.href = s2.url; 5574 urlAnchor.href = urlAnchor.href; 5575 s2.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; 5576 } catch (e2) { 5577 s2.crossDomain = true; 5578 } 5579 } 5580 if (s2.data && s2.processData && typeof s2.data !== "string") { 5581 s2.data = jQuery.param(s2.data, s2.traditional); 5582 } 5583 inspectPrefiltersOrTransports(prefilters, s2, options, jqXHR); 5584 if (completed2) { 5585 return jqXHR; 5586 } 5587 fireGlobals = jQuery.event && s2.global; 5588 if (fireGlobals && jQuery.active++ === 0) { 5589 jQuery.event.trigger("ajaxStart"); 5590 } 5591 s2.type = s2.type.toUpperCase(); 5592 s2.hasContent = !rnoContent.test(s2.type); 5593 cacheURL = s2.url.replace(rhash, ""); 5594 if (!s2.hasContent) { 5595 uncached = s2.url.slice(cacheURL.length); 5596 if (s2.data && (s2.processData || typeof s2.data === "string")) { 5597 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s2.data; 5598 delete s2.data; 5599 } 5600 if (s2.cache === false) { 5601 cacheURL = cacheURL.replace(rantiCache, "$1"); 5602 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached; 5603 } 5604 s2.url = cacheURL + uncached; 5605 } else if (s2.data && s2.processData && (s2.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 5606 s2.data = s2.data.replace(r20, "+"); 5607 } 5608 if (s2.ifModified) { 5609 if (jQuery.lastModified[cacheURL]) { 5610 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); 5611 } 5612 if (jQuery.etag[cacheURL]) { 5613 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); 5614 } 5615 } 5616 if (s2.data && s2.hasContent && s2.contentType !== false || options.contentType) { 5617 jqXHR.setRequestHeader("Content-Type", s2.contentType); 5618 } 5619 jqXHR.setRequestHeader( 5620 "Accept", 5621 s2.dataTypes[0] && s2.accepts[s2.dataTypes[0]] ? s2.accepts[s2.dataTypes[0]] + (s2.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s2.accepts["*"] 5622 ); 5623 for (i2 in s2.headers) { 5624 jqXHR.setRequestHeader(i2, s2.headers[i2]); 5625 } 5626 if (s2.beforeSend && (s2.beforeSend.call(callbackContext, jqXHR, s2) === false || completed2)) { 5627 return jqXHR.abort(); 5628 } 5629 strAbort = "abort"; 5630 completeDeferred.add(s2.complete); 5631 jqXHR.done(s2.success); 5632 jqXHR.fail(s2.error); 5633 transport = inspectPrefiltersOrTransports(transports, s2, options, jqXHR); 5634 if (!transport) { 5635 done(-1, "No Transport"); 5636 } else { 5637 jqXHR.readyState = 1; 5638 if (fireGlobals) { 5639 globalEventContext.trigger("ajaxSend", [jqXHR, s2]); 5640 } 5641 if (completed2) { 5642 return jqXHR; 5643 } 5644 if (s2.async && s2.timeout > 0) { 5645 timeoutTimer = window2.setTimeout(function() { 5646 jqXHR.abort("timeout"); 5647 }, s2.timeout); 5648 } 5649 try { 5650 completed2 = false; 5651 transport.send(requestHeaders, done); 5652 } catch (e2) { 5653 if (completed2) { 5654 throw e2; 5655 } 5656 done(-1, e2); 5657 } 5658 } 5659 function done(status, nativeStatusText, responses, headers) { 5660 var isSuccess, success, error2, response, modified, statusText = nativeStatusText; 5661 if (completed2) { 5662 return; 5663 } 5664 completed2 = true; 5665 if (timeoutTimer) { 5666 window2.clearTimeout(timeoutTimer); 5667 } 5668 transport = void 0; 5669 responseHeadersString = headers || ""; 5670 jqXHR.readyState = status > 0 ? 4 : 0; 5671 isSuccess = status >= 200 && status < 300 || status === 304; 5672 if (responses) { 5673 response = ajaxHandleResponses(s2, jqXHR, responses); 5674 } 5675 if (!isSuccess && jQuery.inArray("script", s2.dataTypes) > -1 && jQuery.inArray("json", s2.dataTypes) < 0) { 5676 s2.converters["text script"] = function() { 5677 }; 5678 } 5679 response = ajaxConvert(s2, response, jqXHR, isSuccess); 5680 if (isSuccess) { 5681 if (s2.ifModified) { 5682 modified = jqXHR.getResponseHeader("Last-Modified"); 5683 if (modified) { 5684 jQuery.lastModified[cacheURL] = modified; 5685 } 5686 modified = jqXHR.getResponseHeader("etag"); 5687 if (modified) { 5688 jQuery.etag[cacheURL] = modified; 5689 } 5690 } 5691 if (status === 204 || s2.type === "HEAD") { 5692 statusText = "nocontent"; 5693 } else if (status === 304) { 5694 statusText = "notmodified"; 5695 } else { 5696 statusText = response.state; 5697 success = response.data; 5698 error2 = response.error; 5699 isSuccess = !error2; 5700 } 5701 } else { 5702 error2 = statusText; 5703 if (status || !statusText) { 5704 statusText = "error"; 5705 if (status < 0) { 5706 status = 0; 5707 } 5708 } 5709 } 5710 jqXHR.status = status; 5711 jqXHR.statusText = (nativeStatusText || statusText) + ""; 5712 if (isSuccess) { 5713 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 5714 } else { 5715 deferred.rejectWith(callbackContext, [jqXHR, statusText, error2]); 5716 } 5717 jqXHR.statusCode(statusCode); 5718 statusCode = void 0; 5719 if (fireGlobals) { 5720 globalEventContext.trigger( 5721 isSuccess ? "ajaxSuccess" : "ajaxError", 5722 [jqXHR, s2, isSuccess ? success : error2] 5723 ); 5724 } 5725 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 5726 if (fireGlobals) { 5727 globalEventContext.trigger("ajaxComplete", [jqXHR, s2]); 5728 if (!--jQuery.active) { 5729 jQuery.event.trigger("ajaxStop"); 5730 } 5731 } 5732 } 5733 return jqXHR; 5734 }, 5735 getJSON: function(url, data, callback) { 5736 return jQuery.get(url, data, callback, "json"); 5737 }, 5738 getScript: function(url, callback) { 5739 return jQuery.get(url, void 0, callback, "script"); 5740 } 5741 }); 5742 jQuery.each(["get", "post"], function(_i2, method) { 5743 jQuery[method] = function(url, data, callback, type) { 5744 if (isFunction2(data)) { 5745 type = type || callback; 5746 callback = data; 5747 data = void 0; 5748 } 5749 return jQuery.ajax(jQuery.extend({ 5750 url, 5751 type: method, 5752 dataType: type, 5753 data, 5754 success: callback 5755 }, jQuery.isPlainObject(url) && url)); 5756 }; 5757 }); 5758 jQuery.ajaxPrefilter(function(s2) { 5759 var i2; 5760 for (i2 in s2.headers) { 5761 if (i2.toLowerCase() === "content-type") { 5762 s2.contentType = s2.headers[i2] || ""; 5763 } 5764 } 5765 }); 5766 jQuery._evalUrl = function(url, options, doc2) { 5767 return jQuery.ajax({ 5768 url, 5769 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 5770 type: "GET", 5771 dataType: "script", 5772 cache: true, 5773 async: false, 5774 global: false, 5775 // Only evaluate the response if it is successful (gh-4126) 5776 // dataFilter is not invoked for failure responses, so using it instead 5777 // of the default converter is kludgy but it works. 5778 converters: { 5779 "text script": function() { 5780 } 5781 }, 5782 dataFilter: function(response) { 5783 jQuery.globalEval(response, options, doc2); 5784 } 5785 }); 5786 }; 5787 jQuery.fn.extend({ 5788 wrapAll: function(html) { 5789 var wrap3; 5790 if (this[0]) { 5791 if (isFunction2(html)) { 5792 html = html.call(this[0]); 5793 } 5794 wrap3 = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 5795 if (this[0].parentNode) { 5796 wrap3.insertBefore(this[0]); 5797 } 5798 wrap3.map(function() { 5799 var elem = this; 5800 while (elem.firstElementChild) { 5801 elem = elem.firstElementChild; 5802 } 5803 return elem; 5804 }).append(this); 5805 } 5806 return this; 5807 }, 5808 wrapInner: function(html) { 5809 if (isFunction2(html)) { 5810 return this.each(function(i2) { 5811 jQuery(this).wrapInner(html.call(this, i2)); 5812 }); 5813 } 5814 return this.each(function() { 5815 var self2 = jQuery(this), contents = self2.contents(); 5816 if (contents.length) { 5817 contents.wrapAll(html); 5818 } else { 5819 self2.append(html); 5820 } 5821 }); 5822 }, 5823 wrap: function(html) { 5824 var htmlIsFunction = isFunction2(html); 5825 return this.each(function(i2) { 5826 jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i2) : html); 5827 }); 5828 }, 5829 unwrap: function(selector3) { 5830 this.parent(selector3).not("body").each(function() { 5831 jQuery(this).replaceWith(this.childNodes); 5832 }); 5833 return this; 5834 } 5835 }); 5836 jQuery.expr.pseudos.hidden = function(elem) { 5837 return !jQuery.expr.pseudos.visible(elem); 5838 }; 5839 jQuery.expr.pseudos.visible = function(elem) { 5840 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 5841 }; 5842 jQuery.ajaxSettings.xhr = function() { 5843 try { 5844 return new window2.XMLHttpRequest(); 5845 } catch (e2) { 5846 } 5847 }; 5848 var xhrSuccessStatus = { 5849 // File protocol always yields status code 0, assume 200 5850 0: 200, 5851 // Support: IE <=9 only 5852 // trac-1450: sometimes IE returns 1223 when it should be 204 5853 1223: 204 5854 }, xhrSupported = jQuery.ajaxSettings.xhr(); 5855 support.cors = !!xhrSupported && "withCredentials" in xhrSupported; 5856 support.ajax = xhrSupported = !!xhrSupported; 5857 jQuery.ajaxTransport(function(options) { 5858 var callback, errorCallback; 5859 if (support.cors || xhrSupported && !options.crossDomain) { 5860 return { 5861 send: function(headers, complete) { 5862 var i2, xhr = options.xhr(); 5863 xhr.open( 5864 options.type, 5865 options.url, 5866 options.async, 5867 options.username, 5868 options.password 5869 ); 5870 if (options.xhrFields) { 5871 for (i2 in options.xhrFields) { 5872 xhr[i2] = options.xhrFields[i2]; 5873 } 5874 } 5875 if (options.mimeType && xhr.overrideMimeType) { 5876 xhr.overrideMimeType(options.mimeType); 5877 } 5878 if (!options.crossDomain && !headers["X-Requested-With"]) { 5879 headers["X-Requested-With"] = "XMLHttpRequest"; 5880 } 5881 for (i2 in headers) { 5882 xhr.setRequestHeader(i2, headers[i2]); 5883 } 5884 callback = function(type) { 5885 return function() { 5886 if (callback) { 5887 callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null; 5888 if (type === "abort") { 5889 xhr.abort(); 5890 } else if (type === "error") { 5891 if (typeof xhr.status !== "number") { 5892 complete(0, "error"); 5893 } else { 5894 complete( 5895 // File: protocol always yields status 0; see trac-8605, trac-14207 5896 xhr.status, 5897 xhr.statusText 5898 ); 5899 } 5900 } else { 5901 complete( 5902 xhrSuccessStatus[xhr.status] || xhr.status, 5903 xhr.statusText, 5904 // Support: IE <=9 only 5905 // IE9 has no XHR2 but throws on binary (trac-11426) 5906 // For XHR2 non-text, let the caller handle it (gh-2498) 5907 (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, 5908 xhr.getAllResponseHeaders() 5909 ); 5910 } 5911 } 5912 }; 5913 }; 5914 xhr.onload = callback(); 5915 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 5916 if (xhr.onabort !== void 0) { 5917 xhr.onabort = errorCallback; 5918 } else { 5919 xhr.onreadystatechange = function() { 5920 if (xhr.readyState === 4) { 5921 window2.setTimeout(function() { 5922 if (callback) { 5923 errorCallback(); 5924 } 5925 }); 5926 } 5927 }; 5928 } 5929 callback = callback("abort"); 5930 try { 5931 xhr.send(options.hasContent && options.data || null); 5932 } catch (e2) { 5933 if (callback) { 5934 throw e2; 5935 } 5936 } 5937 }, 5938 abort: function() { 5939 if (callback) { 5940 callback(); 5941 } 5942 } 5943 }; 5944 } 5945 }); 5946 jQuery.ajaxPrefilter(function(s2) { 5947 if (s2.crossDomain) { 5948 s2.contents.script = false; 5949 } 5950 }); 5951 jQuery.ajaxSetup({ 5952 accepts: { 5953 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 5954 }, 5955 contents: { 5956 script: /\b(?:java|ecma)script\b/ 5957 }, 5958 converters: { 5959 "text script": function(text) { 5960 jQuery.globalEval(text); 5961 return text; 5962 } 5963 } 5964 }); 5965 jQuery.ajaxPrefilter("script", function(s2) { 5966 if (s2.cache === void 0) { 5967 s2.cache = false; 5968 } 5969 if (s2.crossDomain) { 5970 s2.type = "GET"; 5971 } 5972 }); 5973 jQuery.ajaxTransport("script", function(s2) { 5974 if (s2.crossDomain || s2.scriptAttrs) { 5975 var script, callback; 5976 return { 5977 send: function(_2, complete) { 5978 script = jQuery("<script>").attr(s2.scriptAttrs || {}).prop({ charset: s2.scriptCharset, src: s2.url }).on("load error", callback = function(evt) { 5979 script.remove(); 5980 callback = null; 5981 if (evt) { 5982 complete(evt.type === "error" ? 404 : 200, evt.type); 5983 } 5984 }); 5985 document2.head.appendChild(script[0]); 5986 }, 5987 abort: function() { 5988 if (callback) { 5989 callback(); 5990 } 5991 } 5992 }; 5993 } 5994 }); 5995 var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; 5996 jQuery.ajaxSetup({ 5997 jsonp: "callback", 5998 jsonpCallback: function() { 5999 var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++; 6000 this[callback] = true; 6001 return callback; 6002 } 6003 }); 6004 jQuery.ajaxPrefilter("json jsonp", function(s2, originalSettings, jqXHR) { 6005 var callbackName, overwritten, responseContainer, jsonProp = s2.jsonp !== false && (rjsonp.test(s2.url) ? "url" : typeof s2.data === "string" && (s2.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s2.data) && "data"); 6006 if (jsonProp || s2.dataTypes[0] === "jsonp") { 6007 callbackName = s2.jsonpCallback = isFunction2(s2.jsonpCallback) ? s2.jsonpCallback() : s2.jsonpCallback; 6008 if (jsonProp) { 6009 s2[jsonProp] = s2[jsonProp].replace(rjsonp, "$1" + callbackName); 6010 } else if (s2.jsonp !== false) { 6011 s2.url += (rquery.test(s2.url) ? "&" : "?") + s2.jsonp + "=" + callbackName; 6012 } 6013 s2.converters["script json"] = function() { 6014 if (!responseContainer) { 6015 jQuery.error(callbackName + " was not called"); 6016 } 6017 return responseContainer[0]; 6018 }; 6019 s2.dataTypes[0] = "json"; 6020 overwritten = window2[callbackName]; 6021 window2[callbackName] = function() { 6022 responseContainer = arguments; 6023 }; 6024 jqXHR.always(function() { 6025 if (overwritten === void 0) { 6026 jQuery(window2).removeProp(callbackName); 6027 } else { 6028 window2[callbackName] = overwritten; 6029 } 6030 if (s2[callbackName]) { 6031 s2.jsonpCallback = originalSettings.jsonpCallback; 6032 oldCallbacks.push(callbackName); 6033 } 6034 if (responseContainer && isFunction2(overwritten)) { 6035 overwritten(responseContainer[0]); 6036 } 6037 responseContainer = overwritten = void 0; 6038 }); 6039 return "script"; 6040 } 6041 }); 6042 support.createHTMLDocument = function() { 6043 var body = document2.implementation.createHTMLDocument("").body; 6044 body.innerHTML = "<form></form><form></form>"; 6045 return body.childNodes.length === 2; 6046 }(); 6047 jQuery.parseHTML = function(data, context3, keepScripts) { 6048 if (typeof data !== "string") { 6049 return []; 6050 } 6051 if (typeof context3 === "boolean") { 6052 keepScripts = context3; 6053 context3 = false; 6054 } 6055 var base, parsed, scripts; 6056 if (!context3) { 6057 if (support.createHTMLDocument) { 6058 context3 = document2.implementation.createHTMLDocument(""); 6059 base = context3.createElement("base"); 6060 base.href = document2.location.href; 6061 context3.head.appendChild(base); 6062 } else { 6063 context3 = document2; 6064 } 6065 } 6066 parsed = rsingleTag.exec(data); 6067 scripts = !keepScripts && []; 6068 if (parsed) { 6069 return [context3.createElement(parsed[1])]; 6070 } 6071 parsed = buildFragment([data], context3, scripts); 6072 if (scripts && scripts.length) { 6073 jQuery(scripts).remove(); 6074 } 6075 return jQuery.merge([], parsed.childNodes); 6076 }; 6077 jQuery.fn.load = function(url, params, callback) { 6078 var selector3, type, response, self2 = this, off = url.indexOf(" "); 6079 if (off > -1) { 6080 selector3 = stripAndCollapse(url.slice(off)); 6081 url = url.slice(0, off); 6082 } 6083 if (isFunction2(params)) { 6084 callback = params; 6085 params = void 0; 6086 } else if (params && typeof params === "object") { 6087 type = "POST"; 6088 } 6089 if (self2.length > 0) { 6090 jQuery.ajax({ 6091 url, 6092 // If "type" variable is undefined, then "GET" method will be used. 6093 // Make value of this field explicit since 6094 // user can override it through ajaxSetup method 6095 type: type || "GET", 6096 dataType: "html", 6097 data: params 6098 }).done(function(responseText) { 6099 response = arguments; 6100 self2.html(selector3 ? ( 6101 // If a selector was specified, locate the right elements in a dummy div 6102 // Exclude scripts to avoid IE 'Permission Denied' errors 6103 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector3) 6104 ) : ( 6105 // Otherwise use the full result 6106 responseText 6107 )); 6108 }).always(callback && function(jqXHR, status) { 6109 self2.each(function() { 6110 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 6111 }); 6112 }); 6113 } 6114 return this; 6115 }; 6116 jQuery.expr.pseudos.animated = function(elem) { 6117 return jQuery.grep(jQuery.timers, function(fn) { 6118 return elem === fn.elem; 6119 }).length; 6120 }; 6121 jQuery.offset = { 6122 setOffset: function(elem, options, i2) { 6123 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {}; 6124 if (position === "static") { 6125 elem.style.position = "relative"; 6126 } 6127 curOffset = curElem.offset(); 6128 curCSSTop = jQuery.css(elem, "top"); 6129 curCSSLeft = jQuery.css(elem, "left"); 6130 calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1; 6131 if (calculatePosition) { 6132 curPosition = curElem.position(); 6133 curTop = curPosition.top; 6134 curLeft = curPosition.left; 6135 } else { 6136 curTop = parseFloat(curCSSTop) || 0; 6137 curLeft = parseFloat(curCSSLeft) || 0; 6138 } 6139 if (isFunction2(options)) { 6140 options = options.call(elem, i2, jQuery.extend({}, curOffset)); 6141 } 6142 if (options.top != null) { 6143 props.top = options.top - curOffset.top + curTop; 6144 } 6145 if (options.left != null) { 6146 props.left = options.left - curOffset.left + curLeft; 6147 } 6148 if ("using" in options) { 6149 options.using.call(elem, props); 6150 } else { 6151 curElem.css(props); 6152 } 6153 } 6154 }; 6155 jQuery.fn.extend({ 6156 // offset() relates an element's border box to the document origin 6157 offset: function(options) { 6158 if (arguments.length) { 6159 return options === void 0 ? this : this.each(function(i2) { 6160 jQuery.offset.setOffset(this, options, i2); 6161 }); 6162 } 6163 var rect, win, elem = this[0]; 6164 if (!elem) { 6165 return; 6166 } 6167 if (!elem.getClientRects().length) { 6168 return { top: 0, left: 0 }; 6169 } 6170 rect = elem.getBoundingClientRect(); 6171 win = elem.ownerDocument.defaultView; 6172 return { 6173 top: rect.top + win.pageYOffset, 6174 left: rect.left + win.pageXOffset 6175 }; 6176 }, 6177 // position() relates an element's margin box to its offset parent's padding box 6178 // This corresponds to the behavior of CSS absolute positioning 6179 position: function() { 6180 if (!this[0]) { 6181 return; 6182 } 6183 var offsetParent, offset, doc2, elem = this[0], parentOffset = { top: 0, left: 0 }; 6184 if (jQuery.css(elem, "position") === "fixed") { 6185 offset = elem.getBoundingClientRect(); 6186 } else { 6187 offset = this.offset(); 6188 doc2 = elem.ownerDocument; 6189 offsetParent = elem.offsetParent || doc2.documentElement; 6190 while (offsetParent && (offsetParent === doc2.body || offsetParent === doc2.documentElement) && jQuery.css(offsetParent, "position") === "static") { 6191 offsetParent = offsetParent.parentNode; 6192 } 6193 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 6194 parentOffset = jQuery(offsetParent).offset(); 6195 parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true); 6196 parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true); 6197 } 6198 } 6199 return { 6200 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), 6201 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) 6202 }; 6203 }, 6204 // This method will return documentElement in the following cases: 6205 // 1) For the element inside the iframe without offsetParent, this method will return 6206 // documentElement of the parent window 6207 // 2) For the hidden or detached element 6208 // 3) For body or html element, i.e. in case of the html node - it will return itself 6209 // 6210 // but those exceptions were never presented as a real life use-cases 6211 // and might be considered as more preferable results. 6212 // 6213 // This logic, however, is not guaranteed and can change at any point in the future 6214 offsetParent: function() { 6215 return this.map(function() { 6216 var offsetParent = this.offsetParent; 6217 while (offsetParent && jQuery.css(offsetParent, "position") === "static") { 6218 offsetParent = offsetParent.offsetParent; 6219 } 6220 return offsetParent || documentElement; 6221 }); 6222 } 6223 }); 6224 jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) { 6225 var top = "pageYOffset" === prop; 6226 jQuery.fn[method] = function(val) { 6227 return access(this, function(elem, method2, val2) { 6228 var win; 6229 if (isWindow(elem)) { 6230 win = elem; 6231 } else if (elem.nodeType === 9) { 6232 win = elem.defaultView; 6233 } 6234 if (val2 === void 0) { 6235 return win ? win[prop] : elem[method2]; 6236 } 6237 if (win) { 6238 win.scrollTo( 6239 !top ? val2 : win.pageXOffset, 6240 top ? val2 : win.pageYOffset 6241 ); 6242 } else { 6243 elem[method2] = val2; 6244 } 6245 }, method, val, arguments.length); 6246 }; 6247 }); 6248 jQuery.each(["top", "left"], function(_i2, prop) { 6249 jQuery.cssHooks[prop] = addGetHookIf( 6250 support.pixelPosition, 6251 function(elem, computed) { 6252 if (computed) { 6253 computed = curCSS(elem, prop); 6254 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed; 6255 } 6256 } 6257 ); 6258 }); 6259 jQuery.each({ Height: "height", Width: "width" }, function(name, type) { 6260 jQuery.each({
6261 padding: "inner" + name, 6262 content: type, 6263 "": "outer" + name 6264 }, function(defaultExtra, funcName) { 6265 jQuery.fn[funcName] = function(margin, value) { 6266 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 6267 return access(this, function(elem, type2, value2) { 6268 var doc2; 6269 if (isWindow(elem)) { 6270 return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name]; 6271 } 6272 if (elem.nodeType === 9) { 6273 doc2 = elem.documentElement; 6274 return Math.max( 6275 elem.body["scroll" + name], 6276 doc2["scroll" + name], 6277 elem.body["offset" + name], 6278 doc2["offset" + name], 6279 doc2["client" + name] 6280 ); 6281 } 6282 return value2 === void 0 ? ( 6283 // Get width or height on the element, requesting but not forcing parseFloat 6284 jQuery.css(elem, type2, extra) 6285 ) : ( 6286 // Set width or height on the element 6287 jQuery.style(elem, type2, value2, extra) 6288 ); 6289 }, type, chainable ? margin : void 0, chainable); 6290 }; 6291 }); 6292 }); 6293 jQuery.each([ 6294 "ajaxStart", 6295 "ajaxStop", 6296 "ajaxComplete", 6297 "ajaxError", 6298 "ajaxSuccess", 6299 "ajaxSend" 6300 ], function(_i2, type) { 6301 jQuery.fn[type] = function(fn) { 6302 return this.on(type, fn); 6303 }; 6304 }); 6305 jQuery.fn.extend({ 6306 bind: function(types, data, fn) { 6307 return this.on(types, null, data, fn); 6308 }, 6309 unbind: function(types, fn) { 6310 return this.off(types, null, fn); 6311 }, 6312 delegate: function(selector3, types, data, fn) { 6313 return this.on(types, selector3, data, fn); 6314 }, 6315 undelegate: function(selector3, types, fn) { 6316 return arguments.length === 1 ? this.off(selector3, "**") : this.off(types, selector3 || "**", fn); 6317 }, 6318 hover: function(fnOver, fnOut) { 6319 return this.on("mouseenter", fnOver).on("mouseleave", fnOut || fnOver); 6320 } 6321 }); 6322 jQuery.each( 6323 "blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), 6324 function(_i2, name) { 6325 jQuery.fn[name] = function(data, fn) { 6326 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name); 6327 }; 6328 } 6329 ); 6330 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 6331 jQuery.proxy = function(fn, context3) { 6332 var tmp, args, proxy; 6333 if (typeof context3 === "string") { 6334 tmp = fn[context3]; 6335 context3 = fn; 6336 fn = tmp; 6337 } 6338 if (!isFunction2(fn)) { 6339 return void 0; 6340 } 6341 args = slice.call(arguments, 2); 6342 proxy = function() { 6343 return fn.apply(context3 || this, args.concat(slice.call(arguments))); 6344 }; 6345 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 6346 return proxy; 6347 }; 6348 jQuery.holdReady = function(hold) { 6349 if (hold) { 6350 jQuery.readyWait++; 6351 } else { 6352 jQuery.ready(true); 6353 } 6354 }; 6355 jQuery.isArray = Array.isArray; 6356 jQuery.parseJSON = JSON.parse; 6357 jQuery.nodeName = nodeName; 6358 jQuery.isFunction = isFunction2; 6359 jQuery.isWindow = isWindow; 6360 jQuery.camelCase = camelCase; 6361 jQuery.type = toType; 6362 jQuery.now = Date.now; 6363 jQuery.isNumeric = function(obj) { 6364 var type = jQuery.type(obj); 6365 return (type === "number" || type === "string") && // parseFloat NaNs numeric-cast false positives ("") 6366 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 6367 // subtraction forces infinities to NaN 6368 !isNaN(obj - parseFloat(obj)); 6369 }; 6370 jQuery.trim = function(text) { 6371 return text == null ? "" : (text + "").replace(rtrim, "$1"); 6372 }; 6373 var _jQuery = window2.jQuery, _$ = window2.$; 6374 jQuery.noConflict = function(deep) { 6375 if (window2.$ === jQuery) { 6376 window2.$ = _$; 6377 } 6378 if (deep && window2.jQuery === jQuery) { 6379 window2.jQuery = _jQuery; 6380 } 6381 return jQuery; 6382 }; 6383 if (typeof noGlobal === "undefined") { 6384 window2.jQuery = window2.$ = jQuery; 6385 } 6386 return jQuery; 6387 }); 6388})(jquery); 6389var jqueryExports = jquery.exports; 6390const $$2 = /* @__PURE__ */ getDefaultExportFromCjs(jqueryExports); 6391/*! 6392Turbo 8.0.12 6393Copyright © 2024 37signals LLC 6394 */ 6395(function(prototype) { 6396 if (typeof prototype.requestSubmit == "function") return; 6397 prototype.requestSubmit = function(submitter2) { 6398 if (submitter2) { 6399 validateSubmitter(submitter2, this); 6400 submitter2.click(); 6401 } else { 6402 submitter2 = document.createElement("input"); 6403 submitter2.type = "submit"; 6404 submitter2.hidden = true; 6405 this.appendChild(submitter2); 6406 submitter2.click(); 6407 this.removeChild(submitter2); 6408 } 6409 }; 6410 function validateSubmitter(submitter2, form) { 6411 submitter2 instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'"); 6412 submitter2.type == "submit" || raise(TypeError, "The specified element is not a submit button"); 6413 submitter2.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError"); 6414 } 6415 function raise(errorConstructor, message, name) { 6416 throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name); 6417 } 6418})(HTMLFormElement.prototype); 6419const submittersByForm = /* @__PURE__ */ new WeakMap(); 6420function findSubmitterFromClickTarget(target) { 6421 const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null; 6422 const candidate = element ? element.closest("input, button") : null; 6423 return (candidate == null ? void 0 : candidate.type) == "submit" ? candidate : null; 6424} 6425function clickCaptured(event) { 6426 const submitter2 = findSubmitterFromClickTarget(event.target); 6427 if (submitter2 && submitter2.form) { 6428 submittersByForm.set(submitter2.form, submitter2); 6429 } 6430} 6431(function() { 6432 if ("submitter" in Event.prototype) return; 6433 let prototype = window.Event.prototype; 6434 if ("SubmitEvent" in window) { 6435 const prototypeOfSubmitEvent = window.SubmitEvent.prototype; 6436 if (/Apple Computer/.test(navigator.vendor) && !("submitter" in prototypeOfSubmitEvent)) { 6437 prototype = prototypeOfSubmitEvent; 6438 } else { 6439 return; 6440 } 6441 } 6442 addEventListener("click", clickCaptured, true); 6443 Object.defineProperty(prototype, "submitter", { 6444 get() {
6445 if (this.type == "submit" && this.target instanceof HTMLFormElement) { 6446 return submittersByForm.get(this.target); 6447 } 6448 } 6449 }); 6450})(); 6451const FrameLoadingStyle = { 6452 eager: "eager", 6453 lazy: "lazy" 6454}; 6455const _FrameElement = class _FrameElement extends HTMLElement { 6456 constructor() { 6457 super(); 6458 __publicField(this, "loaded", Promise.resolve()); 6459 this.delegate = new _FrameElement.delegateConstructor(this); 6460 } 6461 static get observedAttributes() { 6462 return ["disabled", "loading", "src"]; 6463 } 6464 connectedCallback() { 6465 this.delegate.connect(); 6466 } 6467 disconnectedCallback() { 6468 this.delegate.disconnect(); 6469 } 6470 reload() { 6471 return this.delegate.sourceURLReloaded(); 6472 } 6473 attributeChangedCallback(name) { 6474 if (name == "loading") { 6475 this.delegate.loadingStyleChanged(); 6476 } else if (name == "src") { 6477 this.delegate.sourceURLChanged(); 6478 } else if (name == "disabled") { 6479 this.delegate.disabledChanged(); 6480 } 6481 } 6482 /** 6483 * Gets the URL to lazily load source HTML from 6484 */ 6485 get src() { 6486 return this.getAttribute("src"); 6487 } 6488 /** 6489 * Sets the URL to lazily load source HTML from 6490 */ 6491 set src(value) { 6492 if (value) { 6493 this.setAttribute("src", value); 6494 } else { 6495 this.removeAttribute("src"); 6496 } 6497 } 6498 /** 6499 * Gets the refresh mode for the frame. 6500 */ 6501 get refresh() { 6502 return this.getAttribute("refresh"); 6503 } 6504 /** 6505 * Sets the refresh mode for the frame. 6506 */ 6507 set refresh(value) { 6508 if (value) { 6509 this.setAttribute("refresh", value); 6510 } else { 6511 this.removeAttribute("refresh"); 6512 } 6513 } 6514 get shouldReloadWithMorph() { 6515 return this.src && this.refresh === "morph"; 6516 } 6517 /** 6518 * Determines if the element is loading 6519 */ 6520 get loading() { 6521 return frameLoadingStyleFromString(this.getAttribute("loading") || ""); 6522 } 6523 /** 6524 * Sets the value of if the element is loading 6525 */ 6526 set loading(value) { 6527 if (value) { 6528 this.setAttribute("loading", value); 6529 } else { 6530 this.removeAttribute("loading"); 6531 } 6532 } 6533 /** 6534 * Gets the disabled state of the frame. 6535 * 6536 * If disabled, no requests will be intercepted by the frame. 6537 */ 6538 get disabled() { 6539 return this.hasAttribute("disabled"); 6540 } 6541 /** 6542 * Sets the disabled state of the frame. 6543 * 6544 * If disabled, no requests will be intercepted by the frame. 6545 */ 6546 set disabled(value) { 6547 if (value) { 6548 this.setAttribute("disabled", ""); 6549 } else { 6550 this.removeAttribute("disabled"); 6551 } 6552 } 6553 /** 6554 * Gets the autoscroll state of the frame. 6555 * 6556 * If true, the frame will be scrolled into view automatically on update. 6557 */ 6558 get autoscroll() { 6559 return this.hasAttribute("autoscroll"); 6560 } 6561 /** 6562 * Sets the autoscroll state of the frame. 6563 * 6564 * If true, the frame will be scrolled into view automatically on update. 6565 */ 6566 set autoscroll(value) { 6567 if (value) { 6568 this.setAttribute("autoscroll", ""); 6569 } else { 6570 this.removeAttribute("autoscroll"); 6571 } 6572 } 6573 /** 6574 * Determines if the element has finished loading 6575 */ 6576 get complete() { 6577 return !this.delegate.isLoading; 6578 } 6579 /** 6580 * Gets the active state of the frame. 6581 * 6582 * If inactive, source changes will not be observed. 6583 */ 6584 get isActive() { 6585 return this.ownerDocument === document && !this.isPreview; 6586 } 6587 /** 6588 * Sets the active state of the frame. 6589 * 6590 * If inactive, source changes will not be observed. 6591 */ 6592 get isPreview() { 6593 var _a2, _b2; 6594 return (_b2 = (_a2 = this.ownerDocument) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b2.hasAttribute("data-turbo-preview"); 6595 } 6596}; 6597__publicField(_FrameElement, "delegateConstructor"); 6598let FrameElement = _FrameElement; 6599function frameLoadingStyleFromString(style) { 6600 switch (style.toLowerCase()) { 6601 case "lazy": 6602 return FrameLoadingStyle.lazy; 6603 default: 6604 return FrameLoadingStyle.eager; 6605 } 6606} 6607const drive = { 6608 enabled: true, 6609 progressBarDelay: 500, 6610 unvisitableExtensions: /* @__PURE__ */ new Set( 6611 [ 6612 ".7z", 6613 ".aac", 6614 ".apk", 6615 ".avi", 6616 ".bmp", 6617 ".bz2", 6618 ".css", 6619 ".csv", 6620 ".deb", 6621 ".dmg", 6622 ".doc", 6623 ".docx", 6624 ".exe", 6625 ".gif", 6626 ".gz", 6627 ".heic", 6628 ".heif", 6629 ".ico", 6630 ".iso", 6631 ".jpeg", 6632 ".jpg", 6633 ".js", 6634 ".json", 6635 ".m4a", 6636 ".mkv", 6637 ".mov", 6638 ".mp3", 6639 ".mp4", 6640 ".mpeg", 6641 ".mpg", 6642 ".msi", 6643 ".ogg", 6644 ".ogv", 6645 ".pdf", 6646 ".pkg", 6647 ".png", 6648 ".ppt", 6649 ".pptx", 6650 ".rar", 6651 ".rtf", 6652 ".svg", 6653 ".tar", 6654 ".tif", 6655 ".tiff", 6656 ".txt", 6657 ".wav", 6658 ".webm", 6659 ".webp", 6660 ".wma", 6661 ".wmv", 6662 ".xls", 6663 ".xlsx", 6664 ".xml", 6665 ".zip" 6666 ] 6667 ) 6668}; 6669function activateScriptElement(element) { 6670 if (element.getAttribute("data-turbo-eval") == "false") { 6671 return element; 6672 } else { 6673 const createdScriptElement = document.createElement("script"); 6674 const cspNonce = getCspNonce(); 6675 if (cspNonce) { 6676 createdScriptElement.nonce = cspNonce; 6677 } 6678 createdScriptElement.textContent = element.textContent; 6679 createdScriptElement.async = false;
6680 copyElementAttributes(createdScriptElement, element); 6681 return createdScriptElement; 6682 } 6683} 6684function copyElementAttributes(destinationElement, sourceElement) { 6685 for (const { name, value } of sourceElement.attributes) { 6686 destinationElement.setAttribute(name, value); 6687 } 6688} 6689function createDocumentFragment(html) { 6690 const template2 = document.createElement("template"); 6691 template2.innerHTML = html; 6692 return template2.content; 6693} 6694function dispatch(eventName, { target, cancelable, detail } = {}) { 6695 const event = new CustomEvent(eventName, { 6696 cancelable, 6697 bubbles: true, 6698 composed: true, 6699 detail 6700 }); 6701 if (target && target.isConnected) { 6702 target.dispatchEvent(event); 6703 } else { 6704 document.documentElement.dispatchEvent(event); 6705 } 6706 return event; 6707} 6708function cancelEvent(event) { 6709 event.preventDefault(); 6710 event.stopImmediatePropagation(); 6711} 6712function nextRepaint() { 6713 if (document.visibilityState === "hidden") { 6714 return nextEventLoopTick(); 6715 } else { 6716 return nextAnimationFrame(); 6717 } 6718} 6719function nextAnimationFrame() { 6720 return new Promise((resolve) => requestAnimationFrame(() => resolve())); 6721} 6722function nextEventLoopTick() { 6723 return new Promise((resolve) => setTimeout(() => resolve(), 0)); 6724} 6725function nextMicrotask() { 6726 return Promise.resolve(); 6727} 6728function parseHTMLDocument(html = "") { 6729 return new DOMParser().parseFromString(html, "text/html"); 6730} 6731function unindent(strings, ...values) { 6732 const lines = interpolate$1(strings, values).replace(/^\n/, "").split("\n"); 6733 const match = lines[0].match(/^\s+/); 6734 const indent = match ? match[0].length : 0; 6735 return lines.map((line) => line.slice(indent)).join("\n"); 6736} 6737function interpolate$1(strings, values) { 6738 return strings.reduce((result, string, i2) => { 6739 const value = values[i2] == void 0 ? "" : values[i2]; 6740 return result + string + value; 6741 }, ""); 6742} 6743function uuid() { 6744 return Array.from({ length: 36 }).map((_2, i2) => { 6745 if (i2 == 8 || i2 == 13 || i2 == 18 || i2 == 23) { 6746 return "-"; 6747 } else if (i2 == 14) { 6748 return "4"; 6749 } else if (i2 == 19) { 6750 return (Math.floor(Math.random() * 4) + 8).toString(16); 6751 } else { 6752 return Math.floor(Math.random() * 15).toString(16); 6753 } 6754 }).join(""); 6755} 6756function getAttribute(attributeName, ...elements) { 6757 for (const value of elements.map((element) => element == null ? void 0 : element.getAttribute(attributeName))) { 6758 if (typeof value == "string") return value; 6759 } 6760 return null; 6761} 6762function hasAttribute(attributeName, ...elements) { 6763 return elements.some((element) => element && element.hasAttribute(attributeName)); 6764} 6765function markAsBusy(...elements) { 6766 for (const element of elements) { 6767 if (element.localName == "turbo-frame") { 6768 element.setAttribute("busy", ""); 6769 } 6770 element.setAttribute("aria-busy", "true"); 6771 } 6772} 6773function clearBusyState(...elements) { 6774 for (const element of elements) { 6775 if (element.localName == "turbo-frame") { 6776 element.removeAttribute("busy"); 6777 } 6778 element.removeAttribute("aria-busy"); 6779 } 6780} 6781function waitForLoad(element, timeoutInMilliseconds = 2e3) { 6782 return new Promise((resolve) => { 6783 const onComplete = () => { 6784 element.removeEventListener("error", onComplete); 6785 element.removeEventListener("load", onComplete); 6786 resolve(); 6787 }; 6788 element.addEventListener("load", onComplete, { once: true }); 6789 element.addEventListener("error", onComplete, { once: true }); 6790 setTimeout(resolve, timeoutInMilliseconds); 6791 }); 6792} 6793function getHistoryMethodForAction(action) { 6794 switch (action) { 6795 case "replace": 6796 return history.replaceState; 6797 case "advance": 6798 case "restore": 6799 return history.pushState; 6800 } 6801} 6802function isAction(action) { 6803 return action == "advance" || action == "replace" || action == "restore"; 6804} 6805function getVisitAction(...elements) { 6806 const action = getAttribute("data-turbo-action", ...elements); 6807 return isAction(action) ? action : null; 6808} 6809function getMetaElement(name) { 6810 return document.querySelector(`meta[name="${name}"]`); 6811} 6812function getMetaContent(name) { 6813 const element = getMetaElement(name); 6814 return element && element.content; 6815} 6816function getCspNonce() { 6817 const element = getMetaElement("csp-nonce"); 6818 if (element) { 6819 const { nonce, content } = element; 6820 return nonce == "" ? content : nonce; 6821 } 6822} 6823function setMetaContent(name, content) { 6824 let element = getMetaElement(name); 6825 if (!element) { 6826 element = document.createElement("meta"); 6827 element.setAttribute("name", name); 6828 document.head.appendChild(element); 6829 } 6830 element.setAttribute("content", content); 6831 return element; 6832} 6833function findClosestRecursively(element, selector3) { 6834 var _a2; 6835 if (element instanceof Element) { 6836 return element.closest(selector3) || findClosestRecursively(element.assignedSlot || ((_a2 = element.getRootNode()) == null ? void 0 : _a2.host), selector3); 6837 } 6838} 6839function elementIsFocusable(element) { 6840 const inertDisabledOrHidden = "[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"; 6841 return !!element && element.closest(inertDisabledOrHidden) == null && typeof element.focus == "function"; 6842} 6843function queryAutofocusableElement(elementOrDocumentFragment) { 6844 return Array.from(elementOrDocumentFragment.querySelectorAll("[autofocus]")).find(elementIsFocusable); 6845} 6846async function around(callback, reader) { 6847 const before = reader(); 6848 callback(); 6849 await nextAnimationFrame(); 6850 const after = reader(); 6851 return [before, after]; 6852} 6853function doesNotTargetIFrame(name) { 6854 if (name === "_blank") { 6855 return false;
6856 } else if (name) { 6857 for (const element of document.getElementsByName(name)) { 6858 if (element instanceof HTMLIFrameElement) return false; 6859 } 6860 return true; 6861 } else { 6862 return true; 6863 } 6864} 6865function findLinkFromClickTarget(target) { 6866 return findClosestRecursively(target, "a[href]:not([target^=_]):not([download])"); 6867} 6868function getLocationForLink(link) { 6869 return expandURL(link.getAttribute("href") || ""); 6870} 6871function debounce$1(fn, delay) { 6872 let timeoutId = null; 6873 return (...args) => { 6874 const callback = () => fn.apply(this, args); 6875 clearTimeout(timeoutId); 6876 timeoutId = setTimeout(callback, delay); 6877 }; 6878} 6879const submitter = { 6880 "aria-disabled": { 6881 beforeSubmit: (submitter2) => { 6882 submitter2.setAttribute("aria-disabled", "true"); 6883 submitter2.addEventListener("click", cancelEvent); 6884 }, 6885 afterSubmit: (submitter2) => { 6886 submitter2.removeAttribute("aria-disabled"); 6887 submitter2.removeEventListener("click", cancelEvent); 6888 } 6889 }, 6890 "disabled": { 6891 beforeSubmit: (submitter2) => submitter2.disabled = true, 6892 afterSubmit: (submitter2) => submitter2.disabled = false 6893 } 6894}; 6895class Config { 6896 constructor(config4) { 6897 __privateAdd(this, _submitter, null); 6898 Object.assign(this, config4); 6899 } 6900 get submitter() { 6901 return __privateGet(this, _submitter); 6902 } 6903 set submitter(value) { 6904 __privateSet(this, _submitter, submitter[value] || value); 6905 } 6906} 6907_submitter = new WeakMap(); 6908const forms = new Config({ 6909 mode: "on", 6910 submitter: "disabled" 6911}); 6912const config = { 6913 drive, 6914 forms 6915}; 6916function expandURL(locatable) { 6917 return new URL(locatable.toString(), document.baseURI); 6918} 6919function getAnchor(url) { 6920 let anchorMatch; 6921 if (url.hash) { 6922 return url.hash.slice(1); 6923 } else if (anchorMatch = url.href.match(/#(.*)$/)) { 6924 return anchorMatch[1]; 6925 } 6926} 6927function getAction$1(form, submitter2) { 6928 const action = (submitter2 == null ? void 0 : submitter2.getAttribute("formaction")) || form.getAttribute("action") || form.action; 6929 return expandURL(action); 6930} 6931function getExtension(url) { 6932 return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || ""; 6933} 6934function isPrefixedBy(baseURL, url) { 6935 const prefix = getPrefix(url); 6936 return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix); 6937} 6938function locationIsVisitable(location2, rootLocation) { 6939 return isPrefixedBy(location2, rootLocation) && !config.drive.unvisitableExtensions.has(getExtension(location2)); 6940} 6941function getRequestURL(url) { 6942 const anchor = getAnchor(url); 6943 return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href; 6944} 6945function toCacheKey(url) { 6946 return getRequestURL(url); 6947} 6948function urlsAreEqual(left, right) { 6949 return expandURL(left).href == expandURL(right).href; 6950} 6951function getPathComponents(url) { 6952 return url.pathname.split("/").slice(1); 6953} 6954function getLastPathComponent(url) { 6955 return getPathComponents(url).slice(-1)[0]; 6956} 6957function getPrefix(url) { 6958 return addTrailingSlash(url.origin + url.pathname); 6959} 6960function addTrailingSlash(value) { 6961 return value.endsWith("/") ? value : value + "/"; 6962} 6963class FetchResponse { 6964 constructor(response) { 6965 this.response = response; 6966 } 6967 get succeeded() { 6968 return this.response.ok; 6969 } 6970 get failed() { 6971 return !this.succeeded; 6972 } 6973 get clientError() { 6974 return this.statusCode >= 400 && this.statusCode <= 499; 6975 } 6976 get serverError() { 6977 return this.statusCode >= 500 && this.statusCode <= 599; 6978 } 6979 get redirected() { 6980 return this.response.redirected; 6981 } 6982 get location() { 6983 return expandURL(this.response.url); 6984 } 6985 get isHTML() { 6986 return this.contentType && this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/); 6987 } 6988 get statusCode() { 6989 return this.response.status; 6990 } 6991 get contentType() { 6992 return this.header("Content-Type"); 6993 } 6994 get responseText() { 6995 return this.response.clone().text(); 6996 } 6997 get responseHTML() { 6998 if (this.isHTML) { 6999 return this.response.clone().text(); 7000 } else { 7001 return Promise.resolve(void 0); 7002 } 7003 } 7004 header(name) { 7005 return this.response.headers.get(name); 7006 } 7007} 7008class LimitedSet extends Set { 7009 constructor(maxSize) { 7010 super(); 7011 this.maxSize = maxSize; 7012 } 7013 add(value) { 7014 if (this.size >= this.maxSize) { 7015 const iterator = this.values(); 7016 const oldestValue = iterator.next().value; 7017 this.delete(oldestValue); 7018 } 7019 super.add(value); 7020 } 7021} 7022const recentRequests = new LimitedSet(20); 7023const nativeFetch = window.fetch; 7024function fetchWithTurboHeaders(url, options = {}) { 7025 const modifiedHeaders = new Headers(options.headers || {}); 7026 const requestUID = uuid(); 7027 recentRequests.add(requestUID); 7028 modifiedHeaders.append("X-Turbo-Request-Id", requestUID); 7029 return nativeFetch(url, { 7030 ...options, 7031 headers: modifiedHeaders 7032 }); 7033} 7034function fetchMethodFromString(method) { 7035 switch (method.toLowerCase()) { 7036 case "get": 7037 return FetchMethod.get; 7038 case "post": 7039 return FetchMethod.post; 7040 case "put": 7041 return FetchMethod.put; 7042 case "patch": 7043 return FetchMethod.patch; 7044 case "delete": 7045 return FetchMethod.delete; 7046 } 7047} 7048const FetchMethod = { 7049 get: "get", 7050 post: "post", 7051 put: "put", 7052 patch: "patch", 7053 delete: "delete" 7054}; 7055function fetchEnctypeFromString(encoding) { 7056 switch (encoding.toLowerCase()) { 7057 case FetchEnctype.multipart: 7058 return FetchEnctype.multipart; 7059 case FetchEnctype.plain: 7060 return FetchEnctype.plain; 7061 default: 7062 return FetchEnctype.urlEncoded; 7063 } 7064} 7065const FetchEnctype = { 7066 urlEncoded: "application/x-www-form-urlencoded", 7067 multipart: "multipart/form-data", 7068 plain: "text/plain" 7069}; 7070class FetchRequest { 7071 constructor(delegate, method, location2, requestBody = new URLSearchParams(), target = null, enctype = FetchEnctype.urlEncoded) { 7072 __privateAdd(this, _FetchRequest_instances); 7073 __publicField(this, "abortController", new AbortController()); 7074 __privateAdd(this, _resolveRequestPromise, (_value) => { 7075 }); 7076 var _a2;
7077 const [url, body] = buildResourceAndBody(expandURL(location2), method, requestBody, enctype); 7078 this.delegate = delegate; 7079 this.url = url; 7080 this.target = target; 7081 this.fetchOptions = { 7082 credentials: "same-origin", 7083 redirect: "follow", 7084 method: method.toUpperCase(), 7085 headers: { ...this.defaultHeaders }, 7086 body, 7087 signal: this.abortSignal, 7088 referrer: (_a2 = this.delegate.referrer) == null ? void 0 : _a2.href 7089 }; 7090 this.enctype = enctype; 7091 } 7092 get method() { 7093 return this.fetchOptions.method; 7094 } 7095 set method(value) { 7096 const fetchBody = this.isSafe ? this.url.searchParams : this.fetchOptions.body || new FormData(); 7097 const fetchMethod = fetchMethodFromString(value) || FetchMethod.get; 7098 this.url.search = ""; 7099 const [url, body] = buildResourceAndBody(this.url, fetchMethod, fetchBody, this.enctype); 7100 this.url = url; 7101 this.fetchOptions.body = body; 7102 this.fetchOptions.method = fetchMethod.toUpperCase(); 7103 } 7104 get headers() { 7105 return this.fetchOptions.headers; 7106 } 7107 set headers(value) { 7108 this.fetchOptions.headers = value; 7109 } 7110 get body() { 7111 if (this.isSafe) { 7112 return this.url.searchParams; 7113 } else { 7114 return this.fetchOptions.body; 7115 } 7116 } 7117 set body(value) { 7118 this.fetchOptions.body = value; 7119 } 7120 get location() { 7121 return this.url; 7122 } 7123 get params() { 7124 return this.url.searchParams; 7125 } 7126 get entries() { 7127 return this.body ? Array.from(this.body.entries()) : []; 7128 } 7129 cancel() { 7130 this.abortController.abort(); 7131 } 7132 async perform() { 7133 const { fetchOptions } = this; 7134 this.delegate.prepareRequest(this); 7135 const event = await __privateMethod(this, _FetchRequest_instances, allowRequestToBeIntercepted_fn).call(this, fetchOptions); 7136 try { 7137 this.delegate.requestStarted(this); 7138 if (event.detail.fetchRequest) { 7139 this.response = event.detail.fetchRequest.response; 7140 } else { 7141 this.response = fetchWithTurboHeaders(this.url.href, fetchOptions); 7142 } 7143 const response = await this.response; 7144 return await this.receive(response); 7145 } catch (error2) { 7146 if (error2.name !== "AbortError") { 7147 if (__privateMethod(this, _FetchRequest_instances, willDelegateErrorHandling_fn).call(this, error2)) { 7148 this.delegate.requestErrored(this, error2); 7149 } 7150 throw error2; 7151 } 7152 } finally { 7153 this.delegate.requestFinished(this); 7154 } 7155 } 7156 async receive(response) { 7157 const fetchResponse = new FetchResponse(response); 7158 const event = dispatch("turbo:before-fetch-response", { 7159 cancelable: true, 7160 detail: { fetchResponse }, 7161 target: this.target 7162 }); 7163 if (event.defaultPrevented) { 7164 this.delegate.requestPreventedHandlingResponse(this, fetchResponse); 7165 } else if (fetchResponse.succeeded) { 7166 this.delegate.requestSucceededWithResponse(this, fetchResponse); 7167 } else { 7168 this.delegate.requestFailedWithResponse(this, fetchResponse); 7169 } 7170 return fetchResponse; 7171 } 7172 get defaultHeaders() { 7173 return { 7174 Accept: "text/html, application/xhtml+xml" 7175 }; 7176 } 7177 get isSafe() { 7178 return isSafe(this.method); 7179 } 7180 get abortSignal() { 7181 return this.abortController.signal; 7182 } 7183 acceptResponseType(mimeType) { 7184 this.headers["Accept"] = [mimeType, this.headers["Accept"]].join(", "); 7185 } 7186} 7187_resolveRequestPromise = new WeakMap(); 7188_FetchRequest_instances = new WeakSet(); 7189allowRequestToBeIntercepted_fn = async function(fetchOptions) { 7190 const requestInterception = new Promise((resolve) => __privateSet(this, _resolveRequestPromise, resolve)); 7191 const event = dispatch("turbo:before-fetch-request", { 7192 cancelable: true, 7193 detail: { 7194 fetchOptions, 7195 url: this.url, 7196 resume: __privateGet(this, _resolveRequestPromise) 7197 }, 7198 target: this.target 7199 }); 7200 this.url = event.detail.url; 7201 if (event.defaultPrevented) await requestInterception; 7202 return event; 7203}; 7204willDelegateErrorHandling_fn = function(error2) { 7205 const event = dispatch("turbo:fetch-request-error", { 7206 target: this.target, 7207 cancelable: true, 7208 detail: { request: this, error: error2 } 7209 }); 7210 return !event.defaultPrevented; 7211}; 7212function isSafe(fetchMethod) { 7213 return fetchMethodFromString(fetchMethod) == FetchMethod.get; 7214}
7215function buildResourceAndBody(resource, method, requestBody, enctype) { 7216 const searchParams = Array.from(requestBody).length > 0 ? new URLSearchParams(entriesExcludingFiles(requestBody)) : resource.searchParams; 7217 if (isSafe(method)) { 7218 return [mergeIntoURLSearchParams(resource, searchParams), null]; 7219 } else if (enctype == FetchEnctype.urlEncoded) { 7220 return [resource, searchParams]; 7221 } else { 7222 return [resource, requestBody]; 7223 } 7224} 7225function entriesExcludingFiles(requestBody) { 7226 const entries = []; 7227 for (const [name, value] of requestBody) { 7228 if (value instanceof File) continue; 7229 else entries.push([name, value]); 7230 } 7231 return entries; 7232} 7233function mergeIntoURLSearchParams(url, requestBody) { 7234 const searchParams = new URLSearchParams(entriesExcludingFiles(requestBody)); 7235 url.search = searchParams.toString(); 7236 return url; 7237} 7238class AppearanceObserver { 7239 constructor(delegate, element) { 7240 __publicField(this, "started", false); 7241 __publicField(this, "intersect", (entries) => { 7242 const lastEntry = entries.slice(-1)[0]; 7243 if (lastEntry == null ? void 0 : lastEntry.isIntersecting) { 7244 this.delegate.elementAppearedInViewport(this.element); 7245 } 7246 }); 7247 this.delegate = delegate; 7248 this.element = element; 7249 this.intersectionObserver = new IntersectionObserver(this.intersect); 7250 } 7251 start() { 7252 if (!this.started) { 7253 this.started = true; 7254 this.intersectionObserver.observe(this.element); 7255 } 7256 } 7257 stop() { 7258 if (this.started) { 7259 this.started = false; 7260 this.intersectionObserver.unobserve(this.element); 7261 } 7262 } 7263} 7264class StreamMessage { 7265 static wrap(message) { 7266 if (typeof message == "string") { 7267 return new this(createDocumentFragment(message)); 7268 } else { 7269 return message; 7270 } 7271 } 7272 constructor(fragment) { 7273 this.fragment = importStreamElements(fragment); 7274 } 7275} 7276__publicField(StreamMessage, "contentType", "text/vnd.turbo-stream.html"); 7277function importStreamElements(fragment) { 7278 for (const element of fragment.querySelectorAll("turbo-stream")) { 7279 const streamElement = document.importNode(element, true); 7280 for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll("script")) { 7281 inertScriptElement.replaceWith(activateScriptElement(inertScriptElement)); 7282 } 7283 element.replaceWith(streamElement); 7284 } 7285 return fragment; 7286} 7287const PREFETCH_DELAY = 100; 7288class PrefetchCache { 7289 constructor() { 7290 __privateAdd(this, _prefetchTimeout, null); 7291 __privateAdd(this, _prefetched, null); 7292 } 7293 get(url) { 7294 if (__privateGet(this, _prefetched) && __privateGet(this, _prefetched).url === url && __privateGet(this, _prefetched).expire > Date.now()) { 7295 return __privateGet(this, _prefetched).request; 7296 } 7297 } 7298 setLater(url, request, ttl) { 7299 this.clear(); 7300 __privateSet(this, _prefetchTimeout, setTimeout(() => { 7301 request.perform(); 7302 this.set(url, request, ttl); 7303 __privateSet(this, _prefetchTimeout, null); 7304 }, PREFETCH_DELAY)); 7305 } 7306 set(url, request, ttl) { 7307 __privateSet(this, _prefetched, { url, request, expire: new Date((/* @__PURE__ */ new Date()).getTime() + ttl) }); 7308 } 7309 clear() { 7310 if (__privateGet(this, _prefetchTimeout)) clearTimeout(__privateGet(this, _prefetchTimeout)); 7311 __privateSet(this, _prefetched, null); 7312 } 7313} 7314_prefetchTimeout = new WeakMap(); 7315_prefetched = new WeakMap(); 7316const cacheTtl = 10 * 1e3; 7317const prefetchCache = new PrefetchCache(); 7318const FormSubmissionState = { 7319 initialized: "initialized", 7320 requesting: "requesting", 7321 waiting: "waiting", 7322 receiving: "receiving", 7323 stopping: "stopping", 7324 stopped: "stopped" 7325}; 7326class FormSubmission { 7327 constructor(delegate, formElement, submitter2, mustRedirect = false) { 7328 __publicField(this, "state", FormSubmissionState.initialized); 7329 const method = getMethod(formElement, submitter2); 7330 const action = getAction(getFormAction(formElement, submitter2), method); 7331 const body = buildFormData(formElement, submitter2); 7332 const enctype = getEnctype(formElement, submitter2); 7333 this.delegate = delegate; 7334 this.formElement = formElement; 7335 this.submitter = submitter2; 7336 this.fetchRequest = new FetchRequest(this, method, action, body, formElement, enctype); 7337 this.mustRedirect = mustRedirect; 7338 } 7339 static confirmMethod(message) { 7340 return Promise.resolve(confirm(message)); 7341 } 7342 get method() { 7343 return this.fetchRequest.method; 7344 } 7345 set method(value) { 7346 this.fetchRequest.method = value; 7347 } 7348 get action() { 7349 return this.fetchRequest.url.toString(); 7350 } 7351 set action(value) { 7352 this.fetchRequest.url = expandURL(value); 7353 } 7354 get body() { 7355 return this.fetchRequest.body; 7356 } 7357 get enctype() { 7358 return this.fetchRequest.enctype; 7359 } 7360 get isSafe() { 7361 return this.fetchRequest.isSafe; 7362 } 7363 get location() { 7364 return this.fetchRequest.url; 7365 } 7366 // The submission process 7367 async start() { 7368 const { initialized, requesting } = FormSubmissionState; 7369 const confirmationMessage = getAttribute("data-turbo-confirm", this.submitter, this.formElement); 7370 if (typeof confirmationMessage === "string") { 7371 const confirmMethod = typeof config.forms.confirm === "function" ? config.forms.confirm : FormSubmission.confirmMethod; 7372 const answer = await confirmMethod(confirmationMessage, this.formElement, this.submitter); 7373 if (!answer) { 7374 return; 7375 } 7376 } 7377 if (this.state == initialized) { 7378 this.state = requesting; 7379 return this.fetchRequest.perform(); 7380 } 7381 } 7382 stop() { 7383 const { stopping, stopped } = FormSubmissionState; 7384 if (this.state != stopping && this.state != stopped) { 7385 this.state = stopping; 7386 this.fetchRequest.cancel(); 7387 return true; 7388 } 7389 } 7390 // Fetch request delegate 7391 prepareRequest(request) { 7392 if (!request.isSafe) { 7393 const token = getCookieValue(getMetaContent("csrf-param")) || getMetaContent("csrf-token"); 7394 if (token) { 7395 request.headers["X-CSRF-Token"] = token; 7396 } 7397 } 7398 if (this.requestAcceptsTurboStreamResponse(request)) { 7399 request.acceptResponseType(StreamMessage.contentType); 7400 } 7401 } 7402 requestStarted(_request) { 7403 this.state = FormSubmissionState.waiting; 7404 if (this.submitter) config.forms.submitter.beforeSubmit(this.submitter); 7405 this.setSubmitsWith(); 7406 markAsBusy(this.formElement); 7407 dispatch("turbo:submit-start", { 7408 target: this.formElement, 7409 detail: { formSubmission: this } 7410 }); 7411 this.delegate.formSubmissionStarted(this); 7412 } 7413 requestPreventedHandlingResponse(request, response) { 7414 prefetchCache.clear(); 7415 this.result = { success: response.succeeded, fetchResponse: response }; 7416 } 7417 requestSucceededWithResponse(request, response) { 7418 if (response.clientError || response.serverError) { 7419 this.delegate.formSubmissionFailedWithResponse(this, response); 7420 return; 7421 } 7422 prefetchCache.clear(); 7423 if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) { 7424 const error2 = new Error("Form responses must redirect to another location"); 7425 this.delegate.formSubmissionErrored(this, error2); 7426 } else { 7427 this.state = FormSubmissionState.receiving; 7428 this.result = { success: true, fetchResponse: response }; 7429 this.delegate.formSubmissionSucceededWithResponse(this, response); 7430 } 7431 } 7432 requestFailedWithResponse(request, response) { 7433 this.result = { success: false, fetchResponse: response }; 7434 this.delegate.formSubmissionFailedWithResponse(this, response); 7435 } 7436 requestErrored(request, error2) { 7437 this.result = { success: false, error: error2 }; 7438 this.delegate.formSubmissionErrored(this, error2); 7439 } 7440 requestFinished(_request) { 7441 this.state = FormSubmissionState.stopped; 7442 if (this.submitter) config.forms.submitter.afterSubmit(this.submitter); 7443 this.resetSubmitterText(); 7444 clearBusyState(this.formElement); 7445 dispatch("turbo:submit-end", { 7446 target: this.formElement, 7447 detail: { formSubmission: this, ...this.result } 7448 }); 7449 this.delegate.formSubmissionFinished(this); 7450 } 7451 // Private 7452 setSubmitsWith() { 7453 if (!this.submitter || !this.submitsWith) return; 7454 if (this.submitter.matches("button")) { 7455 this.originalSubmitText = this.submitter.innerHTML; 7456 this.submitter.innerHTML = this.submitsWith; 7457 } else if (this.submitter.matches("input")) { 7458 const input = this.submitter; 7459 this.originalSubmitText = input.value; 7460 input.value = this.submitsWith; 7461 } 7462 } 7463 resetSubmitterText() { 7464 if (!this.submitter || !this.originalSubmitText) return; 7465 if (this.submitter.matches("button")) { 7466 this.submitter.innerHTML = this.originalSubmitText; 7467 } else if (this.submitter.matches("input")) { 7468 const input = this.submitter; 7469 input.value = this.originalSubmitText; 7470 } 7471 } 7472 requestMustRedirect(request) { 7473 return !request.isSafe && this.mustRedirect; 7474 } 7475 requestAcceptsTurboStreamResponse(request) { 7476 return !request.isSafe || hasAttribute("data-turbo-stream", this.submitter, this.formElement); 7477 } 7478 get submitsWith() { 7479 var _a2; 7480 return (_a2 = this.submitter) == null ? void 0 : _a2.getAttribute("data-turbo-submits-with"); 7481 } 7482} 7483function buildFormData(formElement, submitter2) { 7484 const formData = new FormData(formElement); 7485 const name = submitter2 == null ? void 0 : submitter2.getAttribute("name"); 7486 const value = submitter2 == null ? void 0 : submitter2.getAttribute("value"); 7487 if (name) { 7488 formData.append(name, value || ""); 7489 } 7490 return formData; 7491} 7492function getCookieValue(cookieName) { 7493 if (cookieName != null) { 7494 const cookies = document.cookie ? document.cookie.split("; ") : []; 7495 const cookie = cookies.find((cookie2) => cookie2.startsWith(cookieName)); 7496 if (cookie) { 7497 const value = cookie.split("=").slice(1).join("="); 7498 return value ? decodeURIComponent(value) : void 0; 7499 } 7500 } 7501} 7502function responseSucceededWithoutRedirect(response) { 7503 return response.statusCode == 200 && !response.redirected; 7504} 7505function getFormAction(formElement, submitter2) { 7506 const formElementAction = typeof formElement.action === "string" ? formElement.action : null; 7507 if (submitter2 == null ? void 0 : submitter2.hasAttribute("formaction")) { 7508 return submitter2.getAttribute("formaction") || ""; 7509 } else { 7510 return formElement.getAttribute("action") || formElementAction || ""; 7511 } 7512} 7513function getAction(formAction, fetchMethod) { 7514 const action = expandURL(formAction); 7515 if (isSafe(fetchMethod)) { 7516 action.search = ""; 7517 } 7518 return action; 7519} 7520function getMethod(formElement, submitter2) { 7521 const method = (submitter2 == null ? void 0 : submitter2.getAttribute("formmethod")) || formElement.getAttribute("method") || ""; 7522 return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get; 7523} 7524function getEnctype(formElement, submitter2) { 7525 return fetchEnctypeFromString((submitter2 == null ? void 0 : submitter2.getAttribute("formenctype")) || formElement.enctype); 7526} 7527class Snapshot { 7528 constructor(element) { 7529 this.element = element; 7530 } 7531 get activeElement() { 7532 return this.element.ownerDocument.activeElement; 7533 } 7534 get children() { 7535 return [...this.element.children]; 7536 }
7537 hasAnchor(anchor) { 7538 return this.getElementForAnchor(anchor) != null; 7539 } 7540 getElementForAnchor(anchor) { 7541 return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null; 7542 } 7543 get isConnected() { 7544 return this.element.isConnected; 7545 } 7546 get firstAutofocusableElement() { 7547 return queryAutofocusableElement(this.element); 7548 } 7549 get permanentElements() { 7550 return queryPermanentElementsAll(this.element); 7551 } 7552 getPermanentElementById(id2) { 7553 return getPermanentElementById(this.element, id2); 7554 } 7555 getPermanentElementMapForSnapshot(snapshot) { 7556 const permanentElementMap = {}; 7557 for (const currentPermanentElement of this.permanentElements) { 7558 const { id: id2 } = currentPermanentElement; 7559 const newPermanentElement = snapshot.getPermanentElementById(id2); 7560 if (newPermanentElement) { 7561 permanentElementMap[id2] = [currentPermanentElement, newPermanentElement]; 7562 } 7563 } 7564 return permanentElementMap; 7565 } 7566} 7567function getPermanentElementById(node, id2) { 7568 return node.querySelector(`#${id2}[data-turbo-permanent]`); 7569} 7570function queryPermanentElementsAll(node) { 7571 return node.querySelectorAll("[id][data-turbo-permanent]"); 7572} 7573class FormSubmitObserver { 7574 constructor(delegate, eventTarget) { 7575 __publicField(this, "started", false); 7576 __publicField(this, "submitCaptured", () => { 7577 this.eventTarget.removeEventListener("submit", this.submitBubbled, false); 7578 this.eventTarget.addEventListener("submit", this.submitBubbled, false); 7579 }); 7580 __publicField(this, "submitBubbled", (event) => { 7581 if (!event.defaultPrevented) { 7582 const form = event.target instanceof HTMLFormElement ? event.target : void 0; 7583 const submitter2 = event.submitter || void 0; 7584 if (form && submissionDoesNotDismissDialog(form, submitter2) && submissionDoesNotTargetIFrame(form, submitter2) && this.delegate.willSubmitForm(form, submitter2)) { 7585 event.preventDefault(); 7586 event.stopImmediatePropagation(); 7587 this.delegate.formSubmitted(form, submitter2); 7588 } 7589 } 7590 }); 7591 this.delegate = delegate; 7592 this.eventTarget = eventTarget; 7593 } 7594 start() { 7595 if (!this.started) { 7596 this.eventTarget.addEventListener("submit", this.submitCaptured, true); 7597 this.started = true; 7598 } 7599 } 7600 stop() { 7601 if (this.started) { 7602 this.eventTarget.removeEventListener("submit", this.submitCaptured, true); 7603 this.started = false; 7604 } 7605 } 7606} 7607function submissionDoesNotDismissDialog(form, submitter2) { 7608 const method = (submitter2 == null ? void 0 : submitter2.getAttribute("formmethod")) || form.getAttribute("method"); 7609 return method != "dialog"; 7610} 7611function submissionDoesNotTargetIFrame(form, submitter2) { 7612 const target = (submitter2 == null ? void 0 : submitter2.getAttribute("formtarget")) || form.getAttribute("target"); 7613 return doesNotTargetIFrame(target); 7614} 7615class View { 7616 constructor(delegate, element) { 7617 __privateAdd(this, _resolveRenderPromise, (_value) => { 7618 }); 7619 __privateAdd(this, _resolveInterceptionPromise, (_value) => { 7620 }); 7621 this.delegate = delegate; 7622 this.element = element; 7623 } 7624 // Scrolling 7625 scrollToAnchor(anchor) { 7626 const element = this.snapshot.getElementForAnchor(anchor); 7627 if (element) { 7628 this.scrollToElement(element); 7629 this.focusElement(element); 7630 } else { 7631 this.scrollToPosition({ x: 0, y: 0 }); 7632 } 7633 } 7634 scrollToAnchorFromLocation(location2) { 7635 this.scrollToAnchor(getAnchor(location2)); 7636 } 7637 scrollToElement(element) { 7638 element.scrollIntoView(); 7639 } 7640 focusElement(element) { 7641 if (element instanceof HTMLElement) { 7642 if (element.hasAttribute("tabindex")) { 7643 element.focus(); 7644 } else { 7645 element.setAttribute("tabindex", "-1"); 7646 element.focus(); 7647 element.removeAttribute("tabindex"); 7648 } 7649 } 7650 } 7651 scrollToPosition({ x: x2, y: y2 }) { 7652 this.scrollRoot.scrollTo(x2, y2); 7653 } 7654 scrollToTop() { 7655 this.scrollToPosition({ x: 0, y: 0 }); 7656 } 7657 get scrollRoot() { 7658 return window; 7659 } 7660 // Rendering 7661 async render(renderer9) {
7662 const { isPreview, shouldRender, willRender, newSnapshot: snapshot } = renderer9; 7663 const shouldInvalidate = willRender; 7664 if (shouldRender) { 7665 try { 7666 this.renderPromise = new Promise((resolve) => __privateSet(this, _resolveRenderPromise, resolve)); 7667 this.renderer = renderer9; 7668 await this.prepareToRenderSnapshot(renderer9); 7669 const renderInterception = new Promise((resolve) => __privateSet(this, _resolveInterceptionPromise, resolve)); 7670 const options = { resume: __privateGet(this, _resolveInterceptionPromise), render: this.renderer.renderElement, renderMethod: this.renderer.renderMethod }; 7671 const immediateRender = this.delegate.allowsImmediateRender(snapshot, options); 7672 if (!immediateRender) await renderInterception; 7673 await this.renderSnapshot(renderer9); 7674 this.delegate.viewRenderedSnapshot(snapshot, isPreview, this.renderer.renderMethod); 7675 this.delegate.preloadOnLoadLinksForView(this.element); 7676 this.finishRenderingSnapshot(renderer9); 7677 } finally { 7678 delete this.renderer; 7679 __privateGet(this, _resolveRenderPromise).call(this, void 0); 7680 delete this.renderPromise; 7681 } 7682 } else if (shouldInvalidate) { 7683 this.invalidate(renderer9.reloadReason); 7684 } 7685 } 7686 invalidate(reason) { 7687 this.delegate.viewInvalidated(reason); 7688 } 7689 async prepareToRenderSnapshot(renderer9) { 7690 this.markAsPreview(renderer9.isPreview); 7691 await renderer9.prepareToRender(); 7692 } 7693 markAsPreview(isPreview) { 7694 if (isPreview) { 7695 this.element.setAttribute("data-turbo-preview", ""); 7696 } else { 7697 this.element.removeAttribute("data-turbo-preview"); 7698 } 7699 } 7700 markVisitDirection(direction) { 7701 this.element.setAttribute("data-turbo-visit-direction", direction); 7702 } 7703 unmarkVisitDirection() { 7704 this.element.removeAttribute("data-turbo-visit-direction"); 7705 } 7706 async renderSnapshot(renderer9) { 7707 await renderer9.render(); 7708 } 7709 finishRenderingSnapshot(renderer9) { 7710 renderer9.finishRendering(); 7711 } 7712} 7713_resolveRenderPromise = new WeakMap(); 7714_resolveInterceptionPromise = new WeakMap(); 7715class FrameView extends View { 7716 missing() { 7717 this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`; 7718 } 7719 get snapshot() { 7720 return new Snapshot(this.element); 7721 } 7722} 7723class LinkInterceptor { 7724 constructor(delegate, element) { 7725 __publicField(this, "clickBubbled", (event) => { 7726 if (this.clickEventIsSignificant(event)) { 7727 this.clickEvent = event; 7728 } else { 7729 delete this.clickEvent; 7730 } 7731 }); 7732 __publicField(this, "linkClicked", (event) => { 7733 if (this.clickEvent && this.clickEventIsSignificant(event)) { 7734 if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) { 7735 this.clickEvent.preventDefault(); 7736 event.preventDefault(); 7737 this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent); 7738 } 7739 } 7740 delete this.clickEvent; 7741 }); 7742 __publicField(this, "willVisit", (_event) => { 7743 delete this.clickEvent; 7744 }); 7745 this.delegate = delegate; 7746 this.element = element; 7747 } 7748 start() { 7749 this.element.addEventListener("click", this.clickBubbled); 7750 document.addEventListener("turbo:click", this.linkClicked); 7751 document.addEventListener("turbo:before-visit", this.willVisit); 7752 } 7753 stop() { 7754 this.element.removeEventListener("click", this.clickBubbled); 7755 document.removeEventListener("turbo:click", this.linkClicked); 7756 document.removeEventListener("turbo:before-visit", this.willVisit); 7757 } 7758 clickEventIsSignificant(event) { 7759 var _a2; 7760 const target = event.composed ? (_a2 = event.target) == null ? void 0 : _a2.parentElement : event.target; 7761 const element = findLinkFromClickTarget(target) || target; 7762 return element instanceof Element && element.closest("turbo-frame, html") == this.element; 7763 } 7764} 7765class LinkClickObserver { 7766 constructor(delegate, eventTarget) { 7767 __publicField(this, "started", false); 7768 __publicField(this, "clickCaptured", () => { 7769 this.eventTarget.removeEventListener("click", this.clickBubbled, false); 7770 this.eventTarget.addEventListener("click", this.clickBubbled, false); 7771 }); 7772 __publicField(this, "clickBubbled", (event) => { 7773 if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) { 7774 const target = event.composedPath && event.composedPath()[0] || event.target; 7775 const link = findLinkFromClickTarget(target); 7776 if (link && doesNotTargetIFrame(link.target)) { 7777 const location2 = getLocationForLink(link); 7778 if (this.delegate.willFollowLinkToLocation(link, location2, event)) { 7779 event.preventDefault(); 7780 this.delegate.followedLinkToLocation(link, location2); 7781 } 7782 } 7783 } 7784 }); 7785 this.delegate = delegate; 7786 this.eventTarget = eventTarget; 7787 } 7788 start() { 7789 if (!this.started) { 7790 this.eventTarget.addEventListener("click", this.clickCaptured, true); 7791 this.started = true; 7792 } 7793 } 7794 stop() { 7795 if (this.started) { 7796 this.eventTarget.removeEventListener("click", this.clickCaptured, true); 7797 this.started = false;
vendor: 4,388 bytes, lines 7798-7903
7798 } 7799 } 7800 clickEventIsSignificant(event) { 7801 return !(event.target && event.target.isContentEditable || event.defaultPrevented || event.which > 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey); 7802 } 7803} 7804class FormLinkClickObserver { 7805 constructor(delegate, element) { 7806 this.delegate = delegate; 7807 this.linkInterceptor = new LinkClickObserver(this, element); 7808 } 7809 start() { 7810 this.linkInterceptor.start(); 7811 } 7812 stop() { 7813 this.linkInterceptor.stop(); 7814 } 7815 // Link hover observer delegate 7816 canPrefetchRequestToLocation(link, location2) { 7817 return false; 7818 } 7819 prefetchAndCacheRequestToLocation(link, location2) { 7820 return; 7821 } 7822 // Link click observer delegate 7823 willFollowLinkToLocation(link, location2, originalEvent) { 7824 return this.delegate.willSubmitFormLinkToLocation(link, location2, originalEvent) && (link.hasAttribute("data-turbo-method") || link.hasAttribute("data-turbo-stream")); 7825 } 7826 followedLinkToLocation(link, location2) { 7827 const form = document.createElement("form"); 7828 const type = "hidden"; 7829 for (const [name, value] of location2.searchParams) { 7830 form.append(Object.assign(document.createElement("input"), { type, name, value })); 7831 } 7832 const action = Object.assign(location2, { search: "" }); 7833 form.setAttribute("data-turbo", "true"); 7834 form.setAttribute("action", action.href); 7835 form.setAttribute("hidden", ""); 7836 const method = link.getAttribute("data-turbo-method"); 7837 if (method) form.setAttribute("method", method); 7838 const turboFrame = link.getAttribute("data-turbo-frame"); 7839 if (turboFrame) form.setAttribute("data-turbo-frame", turboFrame); 7840 const turboAction = getVisitAction(link); 7841 if (turboAction) form.setAttribute("data-turbo-action", turboAction); 7842 const turboConfirm = link.getAttribute("data-turbo-confirm"); 7843 if (turboConfirm) form.setAttribute("data-turbo-confirm", turboConfirm); 7844 const turboStream = link.hasAttribute("data-turbo-stream"); 7845 if (turboStream) form.setAttribute("data-turbo-stream", ""); 7846 this.delegate.submittedFormLinkToLocation(link, location2, form); 7847 document.body.appendChild(form); 7848 form.addEventListener("turbo:submit-end", () => form.remove(), { once: true }); 7849 requestAnimationFrame(() => form.requestSubmit()); 7850 } 7851} 7852class Bardo { 7853 static async preservingPermanentElements(delegate, permanentElementMap, callback) { 7854 const bardo = new this(delegate, permanentElementMap); 7855 bardo.enter(); 7856 await callback(); 7857 bardo.leave(); 7858 } 7859 constructor(delegate, permanentElementMap) { 7860 this.delegate = delegate; 7861 this.permanentElementMap = permanentElementMap; 7862 } 7863 enter() { 7864 for (const id2 in this.permanentElementMap) { 7865 const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id2]; 7866 this.delegate.enteringBardo(currentPermanentElement, newPermanentElement); 7867 this.replaceNewPermanentElementWithPlaceholder(newPermanentElement); 7868 } 7869 } 7870 leave() { 7871 for (const id2 in this.permanentElementMap) { 7872 const [currentPermanentElement] = this.permanentElementMap[id2]; 7873 this.replaceCurrentPermanentElementWithClone(currentPermanentElement); 7874 this.replacePlaceholderWithPermanentElement(currentPermanentElement); 7875 this.delegate.leavingBardo(currentPermanentElement); 7876 } 7877 } 7878 replaceNewPermanentElementWithPlaceholder(permanentElement) { 7879 const placeholder = createPlaceholderForPermanentElement(permanentElement); 7880 permanentElement.replaceWith(placeholder); 7881 } 7882 replaceCurrentPermanentElementWithClone(permanentElement) { 7883 const clone2 = permanentElement.cloneNode(true); 7884 permanentElement.replaceWith(clone2); 7885 } 7886 replacePlaceholderWithPermanentElement(permanentElement) { 7887 const placeholder = this.getPlaceholderById(permanentElement.id); 7888 placeholder == null ? void 0 : placeholder.replaceWith(permanentElement); 7889 } 7890 getPlaceholderById(id2) { 7891 return this.placeholders.find((element) => element.content == id2); 7892 } 7893 get placeholders() { 7894 return [...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]; 7895 } 7896} 7897function createPlaceholderForPermanentElement(permanentElement) { 7898 const element = document.createElement("meta"); 7899 element.setAttribute("name", "turbo-permanent-placeholder"); 7900 element.setAttribute("content", permanentElement.id); 7901 return element; 7902} 7903class Renderer {
7904 constructor(currentSnapshot, newSnapshot, isPreview, willRender = true) { 7905 __privateAdd(this, _activeElement, null); 7906 this.currentSnapshot = currentSnapshot; 7907 this.newSnapshot = newSnapshot; 7908 this.isPreview = isPreview; 7909 this.willRender = willRender; 7910 this.renderElement = this.constructor.renderElement; 7911 this.promise = new Promise((resolve, reject) => this.resolvingFunctions = { resolve, reject }); 7912 } 7913 static renderElement(currentElement, newElement) { 7914 } 7915 get shouldRender() { 7916 return true; 7917 } 7918 get shouldAutofocus() { 7919 return true; 7920 } 7921 get reloadReason() { 7922 return; 7923 } 7924 prepareToRender() { 7925 return; 7926 } 7927 render() { 7928 } 7929 finishRendering() { 7930 if (this.resolvingFunctions) { 7931 this.resolvingFunctions.resolve(); 7932 delete this.resolvingFunctions; 7933 } 7934 } 7935 async preservingPermanentElements(callback) { 7936 await Bardo.preservingPermanentElements(this, this.permanentElementMap, callback); 7937 } 7938 focusFirstAutofocusableElement() { 7939 if (this.shouldAutofocus) { 7940 const element = this.connectedSnapshot.firstAutofocusableElement; 7941 if (element) { 7942 element.focus(); 7943 } 7944 } 7945 } 7946 // Bardo delegate 7947 enteringBardo(currentPermanentElement) { 7948 if (__privateGet(this, _activeElement)) return; 7949 if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) { 7950 __privateSet(this, _activeElement, this.currentSnapshot.activeElement); 7951 } 7952 } 7953 leavingBardo(currentPermanentElement) { 7954 if (currentPermanentElement.contains(__privateGet(this, _activeElement)) && __privateGet(this, _activeElement) instanceof HTMLElement) { 7955 __privateGet(this, _activeElement).focus(); 7956 __privateSet(this, _activeElement, null); 7957 } 7958 } 7959 get connectedSnapshot() { 7960 return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot; 7961 } 7962 get currentElement() { 7963 return this.currentSnapshot.element; 7964 } 7965 get newElement() { 7966 return this.newSnapshot.element; 7967 } 7968 get permanentElementMap() { 7969 return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot); 7970 } 7971 get renderMethod() { 7972 return "replace"; 7973 } 7974} 7975_activeElement = new WeakMap(); 7976class FrameRenderer extends Renderer { 7977 static renderElement(currentElement, newElement) { 7978 var _a2; 7979 const destinationRange = document.createRange(); 7980 destinationRange.selectNodeContents(currentElement); 7981 destinationRange.deleteContents(); 7982 const frameElement = newElement; 7983 const sourceRange = (_a2 = frameElement.ownerDocument) == null ? void 0 : _a2.createRange(); 7984 if (sourceRange) { 7985 sourceRange.selectNodeContents(frameElement); 7986 currentElement.appendChild(sourceRange.extractContents()); 7987 } 7988 } 7989 constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { 7990 super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender); 7991 this.delegate = delegate; 7992 } 7993 get shouldRender() { 7994 return true; 7995 } 7996 async render() { 7997 await nextRepaint(); 7998 this.preservingPermanentElements(() => { 7999 this.loadFrameElement(); 8000 }); 8001 this.scrollFrameIntoView(); 8002 await nextRepaint(); 8003 this.focusFirstAutofocusableElement(); 8004 await nextRepaint(); 8005 this.activateScriptElements(); 8006 } 8007 loadFrameElement() { 8008 this.delegate.willRenderFrame(this.currentElement, this.newElement); 8009 this.renderElement(this.currentElement, this.newElement); 8010 } 8011 scrollFrameIntoView() { 8012 if (this.currentElement.autoscroll || this.newElement.autoscroll) { 8013 const element = this.currentElement.firstElementChild; 8014 const block = readScrollLogicalPosition(this.currentElement.getAttribute("data-autoscroll-block"), "end"); 8015 const behavior = readScrollBehavior(this.currentElement.getAttribute("data-autoscroll-behavior"), "auto"); 8016 if (element) { 8017 element.scrollIntoView({ block, behavior }); 8018 return true; 8019 } 8020 } 8021 return false; 8022 } 8023 activateScriptElements() { 8024 for (const inertScriptElement of this.newScriptElements) { 8025 const activatedScriptElement = activateScriptElement(inertScriptElement); 8026 inertScriptElement.replaceWith(activatedScriptElement); 8027 } 8028 } 8029 get newScriptElements() { 8030 return this.currentElement.querySelectorAll("script"); 8031 } 8032} 8033function readScrollLogicalPosition(value, defaultValue) { 8034 if (value == "end" || value == "start" || value == "center" || value == "nearest") { 8035 return value; 8036 } else { 8037 return defaultValue; 8038 } 8039} 8040function readScrollBehavior(value, defaultValue) { 8041 if (value == "auto" || value == "smooth") { 8042 return value; 8043 } else { 8044 return defaultValue; 8045 } 8046} 8047var Idiomorph = /* @__PURE__ */ function() { 8048 let EMPTY_SET = /* @__PURE__ */ new Set(); 8049 let defaults3 = { 8050 morphStyle: "outerHTML", 8051 callbacks: { 8052 beforeNodeAdded: noOp, 8053 afterNodeAdded: noOp, 8054 beforeNodeMorphed: noOp, 8055 afterNodeMorphed: noOp, 8056 beforeNodeRemoved: noOp, 8057 afterNodeRemoved: noOp, 8058 beforeAttributeUpdated: noOp 8059 }, 8060 head: { 8061 style: "merge", 8062 shouldPreserve: function(elt) { 8063 return elt.getAttribute("im-preserve") === "true"; 8064 }, 8065 shouldReAppend: function(elt) { 8066 return elt.getAttribute("im-re-append") === "true"; 8067 }, 8068 shouldRemove: noOp, 8069 afterHeadMorphed: noOp 8070 } 8071 }; 8072 function morph(oldNode, newContent, config4 = {}) { 8073 if (oldNode instanceof Document) { 8074 oldNode = oldNode.documentElement; 8075 } 8076 if (typeof newContent === "string") { 8077 newContent = parseContent(newContent); 8078 } 8079 let normalizedContent = normalizeContent(newContent);
8080 let ctx2 = createMorphContext(oldNode, normalizedContent, config4); 8081 return morphNormalizedContent(oldNode, normalizedContent, ctx2); 8082 } 8083 function morphNormalizedContent(oldNode, normalizedNewContent, ctx2) { 8084 if (ctx2.head.block) { 8085 let oldHead = oldNode.querySelector("head"); 8086 let newHead = normalizedNewContent.querySelector("head"); 8087 if (oldHead && newHead) { 8088 let promises = handleHeadElement(newHead, oldHead, ctx2); 8089 Promise.all(promises).then(function() { 8090 morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx2, { 8091 head: { 8092 block: false, 8093 ignore: true 8094 } 8095 })); 8096 }); 8097 return; 8098 } 8099 } 8100 if (ctx2.morphStyle === "innerHTML") { 8101 morphChildren2(normalizedNewContent, oldNode, ctx2); 8102 return oldNode.children; 8103 } else if (ctx2.morphStyle === "outerHTML" || ctx2.morphStyle == null) { 8104 let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx2); 8105 let previousSibling = bestMatch == null ? void 0 : bestMatch.previousSibling; 8106 let nextSibling = bestMatch == null ? void 0 : bestMatch.nextSibling; 8107 let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx2); 8108 if (bestMatch) { 8109 return insertSiblings(previousSibling, morphedNode, nextSibling); 8110 } else { 8111 return []; 8112 } 8113 } else { 8114 throw "Do not understand how to morph style " + ctx2.morphStyle; 8115 } 8116 } 8117 function ignoreValueOfActiveElement(possibleActiveElement, ctx2) { 8118 return ctx2.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body; 8119 } 8120 function morphOldNodeTo(oldNode, newContent, ctx2) { 8121 if (ctx2.ignoreActive && oldNode === document.activeElement) ; 8122 else if (newContent == null) { 8123 if (ctx2.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode; 8124 oldNode.remove(); 8125 ctx2.callbacks.afterNodeRemoved(oldNode); 8126 return null; 8127 } else if (!isSoftMatch(oldNode, newContent)) { 8128 if (ctx2.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode; 8129 if (ctx2.callbacks.beforeNodeAdded(newContent) === false) return oldNode; 8130 oldNode.parentElement.replaceChild(newContent, oldNode); 8131 ctx2.callbacks.afterNodeAdded(newContent); 8132 ctx2.callbacks.afterNodeRemoved(oldNode); 8133 return newContent; 8134 } else { 8135 if (ctx2.callbacks.beforeNodeMorphed(oldNode, newContent) === false) return oldNode; 8136 if (oldNode instanceof HTMLHeadElement && ctx2.head.ignore) ; 8137 else if (oldNode instanceof HTMLHeadElement && ctx2.head.style !== "morph") { 8138 handleHeadElement(newContent, oldNode, ctx2); 8139 } else { 8140 syncNodeFrom(newContent, oldNode, ctx2); 8141 if (!ignoreValueOfActiveElement(oldNode, ctx2)) { 8142 morphChildren2(newContent, oldNode, ctx2); 8143 } 8144 } 8145 ctx2.callbacks.afterNodeMorphed(oldNode, newContent); 8146 return oldNode; 8147 } 8148 } 8149 function morphChildren2(newParent, oldParent, ctx2) { 8150 let nextNewChild = newParent.firstChild; 8151 let insertionPoint = oldParent.firstChild; 8152 let newChild; 8153 while (nextNewChild) { 8154 newChild = nextNewChild; 8155 nextNewChild = newChild.nextSibling; 8156 if (insertionPoint == null) { 8157 if (ctx2.callbacks.beforeNodeAdded(newChild) === false) return; 8158 oldParent.appendChild(newChild); 8159 ctx2.callbacks.afterNodeAdded(newChild); 8160 removeIdsFromConsideration(ctx2, newChild); 8161 continue; 8162 } 8163 if (isIdSetMatch(newChild, insertionPoint, ctx2)) { 8164 morphOldNodeTo(insertionPoint, newChild, ctx2); 8165 insertionPoint = insertionPoint.nextSibling; 8166 removeIdsFromConsideration(ctx2, newChild); 8167 continue; 8168 } 8169 let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx2); 8170 if (idSetMatch) { 8171 insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx2); 8172 morphOldNodeTo(idSetMatch, newChild, ctx2); 8173 removeIdsFromConsideration(ctx2, newChild); 8174 continue; 8175 } 8176 let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx2); 8177 if (softMatch) { 8178 insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx2); 8179 morphOldNodeTo(softMatch, newChild, ctx2); 8180 removeIdsFromConsideration(ctx2, newChild); 8181 continue; 8182 } 8183 if (ctx2.callbacks.beforeNodeAdded(newChild) === false) return; 8184 oldParent.insertBefore(newChild, insertionPoint); 8185 ctx2.callbacks.afterNodeAdded(newChild); 8186 removeIdsFromConsideration(ctx2, newChild); 8187 } 8188 while (insertionPoint !== null) { 8189 let tempNode = insertionPoint; 8190 insertionPoint = insertionPoint.nextSibling; 8191 removeNode(tempNode, ctx2); 8192 } 8193 } 8194 function ignoreAttribute(attr, to, updateType, ctx2) { 8195 if (attr === "value" && ctx2.ignoreActiveValue && to === document.activeElement) { 8196 return true; 8197 } 8198 return ctx2.callbacks.beforeAttributeUpdated(attr, to, updateType) === false; 8199 } 8200 function syncNodeFrom(from, to, ctx2) { 8201 let type = from.nodeType; 8202 if (type === 1) { 8203 const fromAttributes = from.attributes; 8204 const toAttributes = to.attributes; 8205 for (const fromAttribute of fromAttributes) { 8206 if (ignoreAttribute(fromAttribute.name, to, "update", ctx2)) { 8207 continue; 8208 } 8209 if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) { 8210 to.setAttribute(fromAttribute.name, fromAttribute.value); 8211 } 8212 } 8213 for (let i2 = toAttributes.length - 1; 0 <= i2; i2--) { 8214 const toAttribute = toAttributes[i2]; 8215 if (ignoreAttribute(toAttribute.name, to, "remove", ctx2)) { 8216 continue; 8217 } 8218 if (!from.hasAttribute(toAttribute.name)) { 8219 to.removeAttribute(toAttribute.name); 8220 } 8221 } 8222 } 8223 if (type === 8 || type === 3) { 8224 if (to.nodeValue !== from.nodeValue) { 8225 to.nodeValue = from.nodeValue; 8226 } 8227 }
vendor: 4,297 bytes, lines 8228-8348
8228 if (!ignoreValueOfActiveElement(to, ctx2)) { 8229 syncInputValue(from, to, ctx2); 8230 } 8231 } 8232 function syncBooleanAttribute(from, to, attributeName, ctx2) { 8233 if (from[attributeName] !== to[attributeName]) { 8234 let ignoreUpdate = ignoreAttribute(attributeName, to, "update", ctx2); 8235 if (!ignoreUpdate) { 8236 to[attributeName] = from[attributeName]; 8237 } 8238 if (from[attributeName]) { 8239 if (!ignoreUpdate) { 8240 to.setAttribute(attributeName, from[attributeName]); 8241 } 8242 } else { 8243 if (!ignoreAttribute(attributeName, to, "remove", ctx2)) { 8244 to.removeAttribute(attributeName); 8245 } 8246 } 8247 } 8248 } 8249 function syncInputValue(from, to, ctx2) { 8250 if (from instanceof HTMLInputElement && to instanceof HTMLInputElement && from.type !== "file") { 8251 let fromValue = from.value; 8252 let toValue = to.value; 8253 syncBooleanAttribute(from, to, "checked", ctx2); 8254 syncBooleanAttribute(from, to, "disabled", ctx2); 8255 if (!from.hasAttribute("value")) { 8256 if (!ignoreAttribute("value", to, "remove", ctx2)) { 8257 to.value = ""; 8258 to.removeAttribute("value"); 8259 } 8260 } else if (fromValue !== toValue) { 8261 if (!ignoreAttribute("value", to, "update", ctx2)) { 8262 to.setAttribute("value", fromValue); 8263 to.value = fromValue; 8264 } 8265 } 8266 } else if (from instanceof HTMLOptionElement) { 8267 syncBooleanAttribute(from, to, "selected", ctx2); 8268 } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) { 8269 let fromValue = from.value; 8270 let toValue = to.value; 8271 if (ignoreAttribute("value", to, "update", ctx2)) { 8272 return; 8273 } 8274 if (fromValue !== toValue) { 8275 to.value = fromValue; 8276 } 8277 if (to.firstChild && to.firstChild.nodeValue !== fromValue) { 8278 to.firstChild.nodeValue = fromValue; 8279 } 8280 } 8281 } 8282 function handleHeadElement(newHeadTag, currentHead, ctx2) { 8283 let added = []; 8284 let removed = []; 8285 let preserved = []; 8286 let nodesToAppend = []; 8287 let headMergeStyle = ctx2.head.style; 8288 let srcToNewHeadNodes = /* @__PURE__ */ new Map(); 8289 for (const newHeadChild of newHeadTag.children) { 8290 srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild); 8291 } 8292 for (const currentHeadElt of currentHead.children) { 8293 let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML); 8294 let isReAppended = ctx2.head.shouldReAppend(currentHeadElt); 8295 let isPreserved = ctx2.head.shouldPreserve(currentHeadElt); 8296 if (inNewContent || isPreserved) { 8297 if (isReAppended) { 8298 removed.push(currentHeadElt); 8299 } else { 8300 srcToNewHeadNodes.delete(currentHeadElt.outerHTML); 8301 preserved.push(currentHeadElt); 8302 } 8303 } else { 8304 if (headMergeStyle === "append") { 8305 if (isReAppended) { 8306 removed.push(currentHeadElt); 8307 nodesToAppend.push(currentHeadElt); 8308 } 8309 } else { 8310 if (ctx2.head.shouldRemove(currentHeadElt) !== false) { 8311 removed.push(currentHeadElt); 8312 } 8313 } 8314 } 8315 } 8316 nodesToAppend.push(...srcToNewHeadNodes.values()); 8317 let promises = []; 8318 for (const newNode of nodesToAppend) { 8319 let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild; 8320 if (ctx2.callbacks.beforeNodeAdded(newElt) !== false) { 8321 if (newElt.href || newElt.src) { 8322 let resolve = null; 8323 let promise = new Promise(function(_resolve) { 8324 resolve = _resolve; 8325 }); 8326 newElt.addEventListener("load", function() { 8327 resolve(); 8328 }); 8329 promises.push(promise); 8330 } 8331 currentHead.appendChild(newElt); 8332 ctx2.callbacks.afterNodeAdded(newElt); 8333 added.push(newElt); 8334 } 8335 } 8336 for (const removedElement of removed) { 8337 if (ctx2.callbacks.beforeNodeRemoved(removedElement) !== false) { 8338 currentHead.removeChild(removedElement); 8339 ctx2.callbacks.afterNodeRemoved(removedElement); 8340 } 8341 } 8342 ctx2.head.afterHeadMorphed(currentHead, { added, kept: preserved, removed }); 8343 return promises; 8344 } 8345 function noOp() { 8346 } 8347 function mergeDefaults(config4) { 8348 let finalConfig = {};
8349 Object.assign(finalConfig, defaults3); 8350 Object.assign(finalConfig, config4); 8351 finalConfig.callbacks = {}; 8352 Object.assign(finalConfig.callbacks, defaults3.callbacks); 8353 Object.assign(finalConfig.callbacks, config4.callbacks); 8354 finalConfig.head = {}; 8355 Object.assign(finalConfig.head, defaults3.head); 8356 Object.assign(finalConfig.head, config4.head); 8357 return finalConfig; 8358 } 8359 function createMorphContext(oldNode, newContent, config4) { 8360 config4 = mergeDefaults(config4); 8361 return { 8362 target: oldNode, 8363 newContent, 8364 config: config4, 8365 morphStyle: config4.morphStyle, 8366 ignoreActive: config4.ignoreActive, 8367 ignoreActiveValue: config4.ignoreActiveValue, 8368 idMap: createIdMap(oldNode, newContent), 8369 deadIds: /* @__PURE__ */ new Set(), 8370 callbacks: config4.callbacks, 8371 head: config4.head 8372 }; 8373 } 8374 function isIdSetMatch(node1, node2, ctx2) { 8375 if (node1 == null || node2 == null) { 8376 return false; 8377 } 8378 if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) { 8379 if (node1.id !== "" && node1.id === node2.id) { 8380 return true; 8381 } else { 8382 return getIdIntersectionCount(ctx2, node1, node2) > 0; 8383 } 8384 } 8385 return false; 8386 } 8387 function isSoftMatch(node1, node2) { 8388 if (node1 == null || node2 == null) { 8389 return false; 8390 } 8391 return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName; 8392 } 8393 function removeNodesBetween(startInclusive, endExclusive, ctx2) { 8394 while (startInclusive !== endExclusive) { 8395 let tempNode = startInclusive; 8396 startInclusive = startInclusive.nextSibling; 8397 removeNode(tempNode, ctx2); 8398 } 8399 removeIdsFromConsideration(ctx2, endExclusive); 8400 return endExclusive.nextSibling; 8401 } 8402 function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx2) { 8403 let newChildPotentialIdCount = getIdIntersectionCount(ctx2, newChild, oldParent); 8404 let potentialMatch = null; 8405 if (newChildPotentialIdCount > 0) { 8406 let potentialMatch2 = insertionPoint; 8407 let otherMatchCount = 0; 8408 while (potentialMatch2 != null) { 8409 if (isIdSetMatch(newChild, potentialMatch2, ctx2)) { 8410 return potentialMatch2; 8411 } 8412 otherMatchCount += getIdIntersectionCount(ctx2, potentialMatch2, newContent); 8413 if (otherMatchCount > newChildPotentialIdCount) { 8414 return null; 8415 } 8416 potentialMatch2 = potentialMatch2.nextSibling; 8417 } 8418 } 8419 return potentialMatch; 8420 } 8421 function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx2) { 8422 let potentialSoftMatch = insertionPoint; 8423 let nextSibling = newChild.nextSibling; 8424 let siblingSoftMatchCount = 0; 8425 while (potentialSoftMatch != null) { 8426 if (getIdIntersectionCount(ctx2, potentialSoftMatch, newContent) > 0) { 8427 return null; 8428 } 8429 if (isSoftMatch(newChild, potentialSoftMatch)) { 8430 return potentialSoftMatch; 8431 } 8432 if (isSoftMatch(nextSibling, potentialSoftMatch)) { 8433 siblingSoftMatchCount++; 8434 nextSibling = nextSibling.nextSibling; 8435 if (siblingSoftMatchCount >= 2) { 8436 return null; 8437 } 8438 } 8439 potentialSoftMatch = potentialSoftMatch.nextSibling; 8440 } 8441 return potentialSoftMatch; 8442 } 8443 function parseContent(newContent) { 8444 let parser = new DOMParser(); 8445 let contentWithSvgsRemoved = newContent.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim, ""); 8446 if (contentWithSvgsRemoved.match(/<\/html>/) || contentWithSvgsRemoved.match(/<\/head>/) || contentWithSvgsRemoved.match(/<\/body>/)) { 8447 let content = parser.parseFromString(newContent, "text/html"); 8448 if (contentWithSvgsRemoved.match(/<\/html>/)) { 8449 content.generatedByIdiomorph = true; 8450 return content; 8451 } else { 8452 let htmlElement = content.firstChild; 8453 if (htmlElement) { 8454 htmlElement.generatedByIdiomorph = true; 8455 return htmlElement; 8456 } else { 8457 return null; 8458 } 8459 } 8460 } else { 8461 let responseDoc = parser.parseFromString("<body><template>" + newContent + "</template></body>", "text/html"); 8462 let content = responseDoc.body.querySelector("template").content; 8463 content.generatedByIdiomorph = true; 8464 return content; 8465 } 8466 } 8467 function normalizeContent(newContent) { 8468 if (newContent == null) { 8469 const dummyParent = document.createElement("div"); 8470 return dummyParent; 8471 } else if (newContent.generatedByIdiomorph) { 8472 return newContent; 8473 } else if (newContent instanceof Node) { 8474 const dummyParent = document.createElement("div"); 8475 dummyParent.append(newContent); 8476 return dummyParent; 8477 } else { 8478 const dummyParent = document.createElement("div"); 8479 for (const elt of [...newContent]) { 8480 dummyParent.append(elt); 8481 } 8482 return dummyParent; 8483 } 8484 } 8485 function insertSiblings(previousSibling, morphedNode, nextSibling) { 8486 let stack = []; 8487 let added = []; 8488 while (previousSibling != null) { 8489 stack.push(previousSibling); 8490 previousSibling = previousSibling.previousSibling; 8491 } 8492 while (stack.length > 0) { 8493 let node = stack.pop(); 8494 added.push(node); 8495 morphedNode.parentElement.insertBefore(node, morphedNode); 8496 } 8497 added.push(morphedNode); 8498 while (nextSibling != null) { 8499 stack.push(nextSibling); 8500 added.push(nextSibling); 8501 nextSibling = nextSibling.nextSibling; 8502 } 8503 while (stack.length > 0) { 8504 morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling); 8505 } 8506 return added; 8507 } 8508 function findBestNodeMatch(newContent, oldNode, ctx2) {
8509 let currentElement; 8510 currentElement = newContent.firstChild; 8511 let bestElement = currentElement; 8512 let score = 0; 8513 while (currentElement) { 8514 let newScore = scoreElement(currentElement, oldNode, ctx2); 8515 if (newScore > score) { 8516 bestElement = currentElement; 8517 score = newScore; 8518 } 8519 currentElement = currentElement.nextSibling; 8520 } 8521 return bestElement; 8522 } 8523 function scoreElement(node1, node2, ctx2) { 8524 if (isSoftMatch(node1, node2)) { 8525 return 0.5 + getIdIntersectionCount(ctx2, node1, node2); 8526 } 8527 return 0; 8528 } 8529 function removeNode(tempNode, ctx2) { 8530 removeIdsFromConsideration(ctx2, tempNode); 8531 if (ctx2.callbacks.beforeNodeRemoved(tempNode) === false) return; 8532 tempNode.remove(); 8533 ctx2.callbacks.afterNodeRemoved(tempNode); 8534 } 8535 function isIdInConsideration(ctx2, id2) { 8536 return !ctx2.deadIds.has(id2); 8537 } 8538 function idIsWithinNode(ctx2, id2, targetNode) { 8539 let idSet = ctx2.idMap.get(targetNode) || EMPTY_SET; 8540 return idSet.has(id2); 8541 } 8542 function removeIdsFromConsideration(ctx2, node) { 8543 let idSet = ctx2.idMap.get(node) || EMPTY_SET; 8544 for (const id2 of idSet) { 8545 ctx2.deadIds.add(id2); 8546 } 8547 } 8548 function getIdIntersectionCount(ctx2, node1, node2) { 8549 let sourceSet = ctx2.idMap.get(node1) || EMPTY_SET; 8550 let matchCount = 0; 8551 for (const id2 of sourceSet) { 8552 if (isIdInConsideration(ctx2, id2) && idIsWithinNode(ctx2, id2, node2)) { 8553 ++matchCount; 8554 } 8555 } 8556 return matchCount; 8557 } 8558 function populateIdMapForNode(node, idMap) { 8559 let nodeParent = node.parentElement; 8560 let idElements = node.querySelectorAll("[id]"); 8561 for (const elt of idElements) { 8562 let current = elt; 8563 while (current !== nodeParent && current != null) { 8564 let idSet = idMap.get(current); 8565 if (idSet == null) { 8566 idSet = /* @__PURE__ */ new Set(); 8567 idMap.set(current, idSet); 8568 } 8569 idSet.add(elt.id); 8570 current = current.parentElement; 8571 } 8572 } 8573 } 8574 function createIdMap(oldContent, newContent) { 8575 let idMap = /* @__PURE__ */ new Map(); 8576 populateIdMapForNode(oldContent, idMap); 8577 populateIdMapForNode(newContent, idMap); 8578 return idMap; 8579 } 8580 return { 8581 morph, 8582 defaults: defaults3 8583 }; 8584}(); 8585function morphElements(currentElement, newElement, { callbacks, ...options } = {}) { 8586 Idiomorph.morph(currentElement, newElement, { 8587 ...options, 8588 callbacks: new DefaultIdiomorphCallbacks(callbacks) 8589 }); 8590} 8591function morphChildren(currentElement, newElement) { 8592 morphElements(currentElement, newElement.children, { 8593 morphStyle: "innerHTML" 8594 }); 8595} 8596class DefaultIdiomorphCallbacks { 8597 constructor({ beforeNodeMorphed } = {}) { 8598 __privateAdd(this, _beforeNodeMorphed); 8599 __publicField(this, "beforeNodeAdded", (node) => { 8600 return !(node.id && node.hasAttribute("data-turbo-permanent") && document.getElementById(node.id)); 8601 }); 8602 __publicField(this, "beforeNodeMorphed", (currentElement, newElement) => { 8603 if (currentElement instanceof Element) { 8604 if (!currentElement.hasAttribute("data-turbo-permanent") && __privateGet(this, _beforeNodeMorphed).call(this, currentElement, newElement)) { 8605 const event = dispatch("turbo:before-morph-element", { 8606 cancelable: true, 8607 target: currentElement, 8608 detail: { currentElement, newElement } 8609 }); 8610 return !event.defaultPrevented; 8611 } else { 8612 return false; 8613 } 8614 } 8615 }); 8616 __publicField(this, "beforeAttributeUpdated", (attributeName, target, mutationType) => { 8617 const event = dispatch("turbo:before-morph-attribute", { 8618 cancelable: true, 8619 target, 8620 detail: { attributeName, mutationType } 8621 }); 8622 return !event.defaultPrevented; 8623 }); 8624 __publicField(this, "beforeNodeRemoved", (node) => { 8625 return this.beforeNodeMorphed(node); 8626 }); 8627 __publicField(this, "afterNodeMorphed", (currentElement, newElement) => { 8628 if (currentElement instanceof Element) { 8629 dispatch("turbo:morph-element", { 8630 target: currentElement, 8631 detail: { currentElement, newElement } 8632 }); 8633 } 8634 }); 8635 __privateSet(this, _beforeNodeMorphed, beforeNodeMorphed || (() => true)); 8636 } 8637} 8638_beforeNodeMorphed = new WeakMap(); 8639class MorphingFrameRenderer extends FrameRenderer { 8640 static renderElement(currentElement, newElement) { 8641 dispatch("turbo:before-frame-morph", { 8642 target: currentElement, 8643 detail: { currentElement, newElement } 8644 }); 8645 morphChildren(currentElement, newElement); 8646 } 8647 async preservingPermanentElements(callback) { 8648 return await callback(); 8649 } 8650} 8651const _ProgressBar = class _ProgressBar { 8652 constructor() { 8653 __publicField(this, "hiding", false); 8654 __publicField(this, "value", 0); 8655 __publicField(this, "visible", false); 8656 __publicField(this, "trickle", () => { 8657 this.setValue(this.value + Math.random() / 100); 8658 }); 8659 this.stylesheetElement = this.createStylesheetElement(); 8660 this.progressElement = this.createProgressElement(); 8661 this.installStylesheetElement(); 8662 this.setValue(0); 8663 } 8664 /*ms*/ 8665 static get defaultCSS() { 8666 return unindent` 8667 .turbo-progress-bar { 8668 position: fixed; 8669 display: block; 8670 top: 0; 8671 left: 0; 8672 height: 3px; 8673 background: #0076ff; 8674 z-index: 2147483647; 8675 transition: 8676 width ${_ProgressBar.animationDuration}ms ease-out, 8677 opacity ${_ProgressBar.animationDuration / 2}ms ${_ProgressBar.animationDuration / 2}ms ease-in; 8678 transform: translate3d(0, 0, 0); 8679 } 8680 `; 8681 } 8682 show() { 8683 if (!this.visible) { 8684 this.visible = true; 8685 this.installProgressElement(); 8686 this.startTrickling(); 8687 } 8688 } 8689 hide() { 8690 if (this.visible && !this.hiding) { 8691 this.hiding = true; 8692 this.fadeProgressElement(() => { 8693 this.uninstallProgressElement(); 8694 this.stopTrickling(); 8695 this.visible = false;
8696 this.hiding = false; 8697 }); 8698 } 8699 } 8700 setValue(value) { 8701 this.value = value; 8702 this.refresh(); 8703 } 8704 // Private 8705 installStylesheetElement() { 8706 document.head.insertBefore(this.stylesheetElement, document.head.firstChild); 8707 } 8708 installProgressElement() { 8709 this.progressElement.style.width = "0"; 8710 this.progressElement.style.opacity = "1"; 8711 document.documentElement.insertBefore(this.progressElement, document.body); 8712 this.refresh(); 8713 } 8714 fadeProgressElement(callback) { 8715 this.progressElement.style.opacity = "0"; 8716 setTimeout(callback, _ProgressBar.animationDuration * 1.5); 8717 } 8718 uninstallProgressElement() { 8719 if (this.progressElement.parentNode) { 8720 document.documentElement.removeChild(this.progressElement); 8721 } 8722 } 8723 startTrickling() { 8724 if (!this.trickleInterval) { 8725 this.trickleInterval = window.setInterval(this.trickle, _ProgressBar.animationDuration); 8726 } 8727 } 8728 stopTrickling() { 8729 window.clearInterval(this.trickleInterval); 8730 delete this.trickleInterval; 8731 } 8732 refresh() { 8733 requestAnimationFrame(() => { 8734 this.progressElement.style.width = `${10 + this.value * 90}%`; 8735 }); 8736 } 8737 createStylesheetElement() { 8738 const element = document.createElement("style"); 8739 element.type = "text/css"; 8740 element.textContent = _ProgressBar.defaultCSS; 8741 const cspNonce = getCspNonce(); 8742 if (cspNonce) { 8743 element.nonce = cspNonce; 8744 } 8745 return element; 8746 } 8747 createProgressElement() { 8748 const element = document.createElement("div"); 8749 element.className = "turbo-progress-bar"; 8750 return element; 8751 } 8752}; 8753__publicField(_ProgressBar, "animationDuration", 300); 8754let ProgressBar = _ProgressBar; 8755class HeadSnapshot extends Snapshot { 8756 constructor() { 8757 super(...arguments); 8758 __publicField(this, "detailsByOuterHTML", this.children.filter((element) => !elementIsNoscript(element)).map((element) => elementWithoutNonce(element)).reduce((result, element) => { 8759 const { outerHTML } = element; 8760 const details = outerHTML in result ? result[outerHTML] : { 8761 type: elementType(element), 8762 tracked: elementIsTracked(element), 8763 elements: [] 8764 }; 8765 return { 8766 ...result, 8767 [outerHTML]: { 8768 ...details, 8769 elements: [...details.elements, element] 8770 } 8771 }; 8772 }, {})); 8773 } 8774 get trackedElementSignature() { 8775 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked).join(""); 8776 } 8777 getScriptElementsNotInSnapshot(snapshot) { 8778 return this.getElementsMatchingTypeNotInSnapshot("script", snapshot); 8779 } 8780 getStylesheetElementsNotInSnapshot(snapshot) { 8781 return this.getElementsMatchingTypeNotInSnapshot("stylesheet", snapshot); 8782 } 8783 getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) { 8784 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML)).map((outerHTML) => this.detailsByOuterHTML[outerHTML]).filter(({ type }) => type == matchedType).map(({ elements: [element] }) => element); 8785 } 8786 get provisionalElements() { 8787 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 8788 const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML]; 8789 if (type == null && !tracked) { 8790 return [...result, ...elements]; 8791 } else if (elements.length > 1) { 8792 return [...result, ...elements.slice(1)]; 8793 } else { 8794 return result; 8795 } 8796 }, []); 8797 } 8798 getMetaValue(name) { 8799 const element = this.findMetaElementByName(name); 8800 return element ? element.getAttribute("content") : null; 8801 } 8802 findMetaElementByName(name) { 8803 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 8804 const { 8805 elements: [element] 8806 } = this.detailsByOuterHTML[outerHTML]; 8807 return elementIsMetaElementWithName(element, name) ? element : result; 8808 }, void 0 | void 0); 8809 } 8810} 8811function elementType(element) { 8812 if (elementIsScript(element)) { 8813 return "script"; 8814 } else if (elementIsStylesheet(element)) { 8815 return "stylesheet"; 8816 } 8817} 8818function elementIsTracked(element) { 8819 return element.getAttribute("data-turbo-track") == "reload"; 8820} 8821function elementIsScript(element) { 8822 const tagName = element.localName; 8823 return tagName == "script"; 8824} 8825function elementIsNoscript(element) { 8826 const tagName = element.localName; 8827 return tagName == "noscript"; 8828} 8829function elementIsStylesheet(element) { 8830 const tagName = element.localName; 8831 return tagName == "style" || tagName == "link" && element.getAttribute("rel") == "stylesheet"; 8832} 8833function elementIsMetaElementWithName(element, name) { 8834 const tagName = element.localName; 8835 return tagName == "meta" && element.getAttribute("name") == name; 8836} 8837function elementWithoutNonce(element) { 8838 if (element.hasAttribute("nonce")) { 8839 element.setAttribute("nonce", ""); 8840 } 8841 return element; 8842} 8843class PageSnapshot extends Snapshot { 8844 static fromHTMLString(html = "") { 8845 return this.fromDocument(parseHTMLDocument(html)); 8846 } 8847 static fromElement(element) { 8848 return this.fromDocument(element.ownerDocument); 8849 } 8850 static fromDocument({ documentElement, body, head }) { 8851 return new this(documentElement, body, new HeadSnapshot(head)); 8852 } 8853 constructor(documentElement, body, headSnapshot) { 8854 super(body); 8855 this.documentElement = documentElement; 8856 this.headSnapshot = headSnapshot; 8857 } 8858 clone() { 8859 const clonedElement = this.element.cloneNode(true); 8860 const selectElements = this.element.querySelectorAll("select"); 8861 const clonedSelectElements = clonedElement.querySelectorAll("select"); 8862 for (const [index3, source] of selectElements.entries()) { 8863 const clone2 = clonedSelectElements[index3]; 8864 for (const option of clone2.selectedOptions) option.selected = false;
8865 for (const option of source.selectedOptions) clone2.options[option.index].selected = true; 8866 } 8867 for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type="password"]')) { 8868 clonedPasswordInput.value = ""; 8869 } 8870 return new PageSnapshot(this.documentElement, clonedElement, this.headSnapshot); 8871 } 8872 get lang() { 8873 return this.documentElement.getAttribute("lang"); 8874 } 8875 get headElement() { 8876 return this.headSnapshot.element; 8877 } 8878 get rootLocation() { 8879 const root = this.getSetting("root") ?? "/"; 8880 return expandURL(root); 8881 } 8882 get cacheControlValue() { 8883 return this.getSetting("cache-control"); 8884 } 8885 get isPreviewable() { 8886 return this.cacheControlValue != "no-preview"; 8887 } 8888 get isCacheable() { 8889 return this.cacheControlValue != "no-cache"; 8890 } 8891 get isVisitable() { 8892 return this.getSetting("visit-control") != "reload"; 8893 } 8894 get prefersViewTransitions() { 8895 return this.headSnapshot.getMetaValue("view-transition") === "same-origin"; 8896 } 8897 get shouldMorphPage() { 8898 return this.getSetting("refresh-method") === "morph"; 8899 } 8900 get shouldPreserveScrollPosition() { 8901 return this.getSetting("refresh-scroll") === "preserve"; 8902 } 8903 // Private 8904 getSetting(name) { 8905 return this.headSnapshot.getMetaValue(`turbo-${name}`); 8906 } 8907} 8908class ViewTransitioner { 8909 constructor() { 8910 __privateAdd(this, _viewTransitionStarted, false); 8911 __privateAdd(this, _lastOperation, Promise.resolve()); 8912 } 8913 renderChange(useViewTransition, render6) { 8914 if (useViewTransition && this.viewTransitionsAvailable && !__privateGet(this, _viewTransitionStarted)) { 8915 __privateSet(this, _viewTransitionStarted, true); 8916 __privateSet(this, _lastOperation, __privateGet(this, _lastOperation).then(async () => { 8917 await document.startViewTransition(render6).finished; 8918 })); 8919 } else { 8920 __privateSet(this, _lastOperation, __privateGet(this, _lastOperation).then(render6)); 8921 } 8922 return __privateGet(this, _lastOperation); 8923 } 8924 get viewTransitionsAvailable() { 8925 return document.startViewTransition; 8926 } 8927} 8928_viewTransitionStarted = new WeakMap(); 8929_lastOperation = new WeakMap(); 8930const defaultOptions = { 8931 action: "advance", 8932 historyChanged: false, 8933 visitCachedSnapshot: () => { 8934 }, 8935 willRender: true, 8936 updateHistory: true, 8937 shouldCacheSnapshot: true, 8938 acceptsStreamResponse: false 8939}; 8940const TimingMetric = { 8941 visitStart: "visitStart", 8942 requestStart: "requestStart", 8943 requestEnd: "requestEnd", 8944 visitEnd: "visitEnd" 8945}; 8946const VisitState = { 8947 initialized: "initialized", 8948 started: "started", 8949 canceled: "canceled", 8950 failed: "failed", 8951 completed: "completed" 8952}; 8953const SystemStatusCode = { 8954 networkFailure: 0, 8955 timeoutFailure: -1, 8956 contentTypeMismatch: -2 8957}; 8958const Direction = { 8959 advance: "forward", 8960 restore: "back", 8961 replace: "none" 8962}; 8963class Visit { 8964 constructor(delegate, location2, restorationIdentifier, options = {}) { 8965 __publicField(this, "identifier", uuid()); 8966 // Required by turbo-ios 8967 __publicField(this, "timingMetrics", {}); 8968 __publicField(this, "followedRedirect", false); 8969 __publicField(this, "historyChanged", false); 8970 __publicField(this, "scrolled", false); 8971 __publicField(this, "shouldCacheSnapshot", true); 8972 __publicField(this, "acceptsStreamResponse", false); 8973 __publicField(this, "snapshotCached", false); 8974 __publicField(this, "state", VisitState.initialized); 8975 __publicField(this, "viewTransitioner", new ViewTransitioner()); 8976 this.delegate = delegate; 8977 this.location = location2; 8978 this.restorationIdentifier = restorationIdentifier || uuid(); 8979 const { 8980 action, 8981 historyChanged, 8982 referrer, 8983 snapshot, 8984 snapshotHTML, 8985 response, 8986 visitCachedSnapshot, 8987 willRender, 8988 updateHistory, 8989 shouldCacheSnapshot, 8990 acceptsStreamResponse, 8991 direction 8992 } = { 8993 ...defaultOptions, 8994 ...options 8995 }; 8996 this.action = action; 8997 this.historyChanged = historyChanged; 8998 this.referrer = referrer; 8999 this.snapshot = snapshot; 9000 this.snapshotHTML = snapshotHTML; 9001 this.response = response; 9002 this.isSamePage = this.delegate.locationWithActionIsSamePage(this.location, this.action); 9003 this.isPageRefresh = this.view.isPageRefresh(this); 9004 this.visitCachedSnapshot = visitCachedSnapshot; 9005 this.willRender = willRender; 9006 this.updateHistory = updateHistory; 9007 this.scrolled = !willRender; 9008 this.shouldCacheSnapshot = shouldCacheSnapshot; 9009 this.acceptsStreamResponse = acceptsStreamResponse; 9010 this.direction = direction || Direction[action]; 9011 } 9012 get adapter() { 9013 return this.delegate.adapter; 9014 } 9015 get view() { 9016 return this.delegate.view; 9017 } 9018 get history() { 9019 return this.delegate.history; 9020 } 9021 get restorationData() { 9022 return this.history.getRestorationDataForIdentifier(this.restorationIdentifier); 9023 } 9024 get silent() { 9025 return this.isSamePage; 9026 } 9027 start() { 9028 if (this.state == VisitState.initialized) { 9029 this.recordTimingMetric(TimingMetric.visitStart); 9030 this.state = VisitState.started; 9031 this.adapter.visitStarted(this); 9032 this.delegate.visitStarted(this); 9033 } 9034 } 9035 cancel() { 9036 if (this.state == VisitState.started) { 9037 if (this.request) { 9038 this.request.cancel(); 9039 } 9040 this.cancelRender(); 9041 this.state = VisitState.canceled; 9042 } 9043 } 9044 complete() { 9045 if (this.state == VisitState.started) { 9046 this.recordTimingMetric(TimingMetric.visitEnd); 9047 this.adapter.visitCompleted(this); 9048 this.state = VisitState.completed; 9049 this.followRedirect(); 9050 if (!this.followedRedirect) { 9051 this.delegate.visitCompleted(this); 9052 } 9053 } 9054 } 9055 fail() { 9056 if (this.state == VisitState.started) { 9057 this.state = VisitState.failed; 9058 this.adapter.visitFailed(this); 9059 this.delegate.visitCompleted(this); 9060 } 9061 } 9062 changeHistory() { 9063 var _a2; 9064 if (!this.historyChanged && this.updateHistory) { 9065 const actionForHistory = this.location.href === ((_a2 = this.referrer) == null ? void 0 : _a2.href) ? "replace" : this.action; 9066 const method = getHistoryMethodForAction(actionForHistory); 9067 this.history.update(method, this.location, this.restorationIdentifier); 9068 this.historyChanged = true; 9069 } 9070 } 9071 issueRequest() { 9072 if (this.hasPreloadedResponse()) { 9073 this.simulateRequest(); 9074 } else if (this.shouldIssueRequest() && !this.request) { 9075 this.request = new FetchRequest(this, FetchMethod.get, this.location); 9076 this.request.perform(); 9077 } 9078 } 9079 simulateRequest() { 9080 if (this.response) {
9081 this.startRequest(); 9082 this.recordResponse(); 9083 this.finishRequest(); 9084 } 9085 } 9086 startRequest() { 9087 this.recordTimingMetric(TimingMetric.requestStart); 9088 this.adapter.visitRequestStarted(this); 9089 } 9090 recordResponse(response = this.response) { 9091 this.response = response; 9092 if (response) { 9093 const { statusCode } = response; 9094 if (isSuccessful(statusCode)) { 9095 this.adapter.visitRequestCompleted(this); 9096 } else { 9097 this.adapter.visitRequestFailedWithStatusCode(this, statusCode); 9098 } 9099 } 9100 } 9101 finishRequest() { 9102 this.recordTimingMetric(TimingMetric.requestEnd); 9103 this.adapter.visitRequestFinished(this); 9104 } 9105 loadResponse() { 9106 if (this.response) { 9107 const { statusCode, responseHTML } = this.response; 9108 this.render(async () => { 9109 if (this.shouldCacheSnapshot) this.cacheSnapshot(); 9110 if (this.view.renderPromise) await this.view.renderPromise; 9111 if (isSuccessful(statusCode) && responseHTML != null) { 9112 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 9113 await this.renderPageSnapshot(snapshot, false); 9114 this.adapter.visitRendered(this); 9115 this.complete(); 9116 } else { 9117 await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this); 9118 this.adapter.visitRendered(this); 9119 this.fail(); 9120 } 9121 }); 9122 } 9123 } 9124 getCachedSnapshot() { 9125 const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot(); 9126 if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) { 9127 if (this.action == "restore" || snapshot.isPreviewable) { 9128 return snapshot; 9129 } 9130 } 9131 } 9132 getPreloadedSnapshot() { 9133 if (this.snapshotHTML) { 9134 return PageSnapshot.fromHTMLString(this.snapshotHTML); 9135 } 9136 } 9137 hasCachedSnapshot() { 9138 return this.getCachedSnapshot() != null; 9139 } 9140 loadCachedSnapshot() { 9141 const snapshot = this.getCachedSnapshot(); 9142 if (snapshot) { 9143 const isPreview = this.shouldIssueRequest(); 9144 this.render(async () => { 9145 this.cacheSnapshot(); 9146 if (this.isSamePage || this.isPageRefresh) { 9147 this.adapter.visitRendered(this); 9148 } else { 9149 if (this.view.renderPromise) await this.view.renderPromise; 9150 await this.renderPageSnapshot(snapshot, isPreview); 9151 this.adapter.visitRendered(this); 9152 if (!isPreview) { 9153 this.complete(); 9154 } 9155 } 9156 }); 9157 } 9158 } 9159 followRedirect() { 9160 var _a2; 9161 if (this.redirectedToLocation && !this.followedRedirect && ((_a2 = this.response) == null ? void 0 : _a2.redirected)) { 9162 this.adapter.visitProposedToLocation(this.redirectedToLocation, { 9163 action: "replace", 9164 response: this.response, 9165 shouldCacheSnapshot: false, 9166 willRender: false 9167 }); 9168 this.followedRedirect = true; 9169 } 9170 } 9171 goToSamePageAnchor() { 9172 if (this.isSamePage) { 9173 this.render(async () => { 9174 this.cacheSnapshot(); 9175 this.performScroll(); 9176 this.changeHistory(); 9177 this.adapter.visitRendered(this); 9178 }); 9179 } 9180 } 9181 // Fetch request delegate 9182 prepareRequest(request) { 9183 if (this.acceptsStreamResponse) { 9184 request.acceptResponseType(StreamMessage.contentType); 9185 } 9186 } 9187 requestStarted() { 9188 this.startRequest(); 9189 } 9190 requestPreventedHandlingResponse(_request, _response) { 9191 } 9192 async requestSucceededWithResponse(request, response) { 9193 const responseHTML = await response.responseHTML; 9194 const { redirected, statusCode } = response; 9195 if (responseHTML == void 0) { 9196 this.recordResponse({ 9197 statusCode: SystemStatusCode.contentTypeMismatch, 9198 redirected 9199 }); 9200 } else { 9201 this.redirectedToLocation = response.redirected ? response.location : void 0; 9202 this.recordResponse({ statusCode, responseHTML, redirected }); 9203 } 9204 } 9205 async requestFailedWithResponse(request, response) { 9206 const responseHTML = await response.responseHTML; 9207 const { redirected, statusCode } = response; 9208 if (responseHTML == void 0) { 9209 this.recordResponse({ 9210 statusCode: SystemStatusCode.contentTypeMismatch, 9211 redirected 9212 }); 9213 } else { 9214 this.recordResponse({ statusCode, responseHTML, redirected }); 9215 } 9216 } 9217 requestErrored(_request, _error) { 9218 this.recordResponse({ 9219 statusCode: SystemStatusCode.networkFailure, 9220 redirected: false 9221 }); 9222 } 9223 requestFinished() { 9224 this.finishRequest(); 9225 } 9226 // Scrolling 9227 performScroll() { 9228 if (!this.scrolled && !this.view.forceReloaded && !this.view.shouldPreserveScrollPosition(this)) { 9229 if (this.action == "restore") { 9230 this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop(); 9231 } else { 9232 this.scrollToAnchor() || this.view.scrollToTop(); 9233 } 9234 if (this.isSamePage) { 9235 this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation, this.location); 9236 } 9237 this.scrolled = true; 9238 } 9239 } 9240 scrollToRestoredPosition() { 9241 const { scrollPosition } = this.restorationData; 9242 if (scrollPosition) { 9243 this.view.scrollToPosition(scrollPosition); 9244 return true; 9245 } 9246 } 9247 scrollToAnchor() { 9248 const anchor = getAnchor(this.location); 9249 if (anchor != null) {
9250 this.view.scrollToAnchor(anchor); 9251 return true; 9252 } 9253 } 9254 // Instrumentation 9255 recordTimingMetric(metric) { 9256 this.timingMetrics[metric] = (/* @__PURE__ */ new Date()).getTime(); 9257 } 9258 getTimingMetrics() { 9259 return { ...this.timingMetrics }; 9260 } 9261 // Private 9262 getHistoryMethodForAction(action) { 9263 switch (action) { 9264 case "replace": 9265 return history.replaceState; 9266 case "advance": 9267 case "restore": 9268 return history.pushState; 9269 } 9270 } 9271 hasPreloadedResponse() { 9272 return typeof this.response == "object"; 9273 } 9274 shouldIssueRequest() { 9275 if (this.isSamePage) { 9276 return false; 9277 } else if (this.action == "restore") { 9278 return !this.hasCachedSnapshot(); 9279 } else { 9280 return this.willRender; 9281 } 9282 } 9283 cacheSnapshot() { 9284 if (!this.snapshotCached) { 9285 this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot)); 9286 this.snapshotCached = true; 9287 } 9288 } 9289 async render(callback) { 9290 this.cancelRender(); 9291 await new Promise((resolve) => { 9292 this.frame = document.visibilityState === "hidden" ? setTimeout(() => resolve(), 0) : requestAnimationFrame(() => resolve()); 9293 }); 9294 await callback(); 9295 delete this.frame; 9296 } 9297 async renderPageSnapshot(snapshot, isPreview) { 9298 await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(snapshot), async () => { 9299 await this.view.renderPage(snapshot, isPreview, this.willRender, this); 9300 this.performScroll(); 9301 }); 9302 } 9303 cancelRender() { 9304 if (this.frame) { 9305 cancelAnimationFrame(this.frame); 9306 delete this.frame; 9307 } 9308 } 9309} 9310function isSuccessful(statusCode) { 9311 return statusCode >= 200 && statusCode < 300; 9312} 9313class BrowserAdapter { 9314 constructor(session2) { 9315 __publicField(this, "progressBar", new ProgressBar()); 9316 __publicField(this, "showProgressBar", () => { 9317 this.progressBar.show(); 9318 }); 9319 this.session = session2; 9320 } 9321 visitProposedToLocation(location2, options) { 9322 if (locationIsVisitable(location2, this.navigator.rootLocation)) { 9323 this.navigator.startVisit(location2, (options == null ? void 0 : options.restorationIdentifier) || uuid(), options); 9324 } else { 9325 window.location.href = location2.toString(); 9326 } 9327 } 9328 visitStarted(visit2) { 9329 this.location = visit2.location; 9330 visit2.loadCachedSnapshot(); 9331 visit2.issueRequest(); 9332 visit2.goToSamePageAnchor(); 9333 } 9334 visitRequestStarted(visit2) { 9335 this.progressBar.setValue(0); 9336 if (visit2.hasCachedSnapshot() || visit2.action != "restore") { 9337 this.showVisitProgressBarAfterDelay(); 9338 } else { 9339 this.showProgressBar(); 9340 } 9341 } 9342 visitRequestCompleted(visit2) { 9343 visit2.loadResponse(); 9344 } 9345 visitRequestFailedWithStatusCode(visit2, statusCode) { 9346 switch (statusCode) { 9347 case SystemStatusCode.networkFailure: 9348 case SystemStatusCode.timeoutFailure: 9349 case SystemStatusCode.contentTypeMismatch: 9350 return this.reload({ 9351 reason: "request_failed", 9352 context: { 9353 statusCode 9354 } 9355 }); 9356 default: 9357 return visit2.loadResponse(); 9358 } 9359 } 9360 visitRequestFinished(_visit) { 9361 } 9362 visitCompleted(_visit) { 9363 this.progressBar.setValue(1); 9364 this.hideVisitProgressBar(); 9365 } 9366 pageInvalidated(reason) { 9367 this.reload(reason); 9368 } 9369 visitFailed(_visit) { 9370 this.progressBar.setValue(1); 9371 this.hideVisitProgressBar(); 9372 } 9373 visitRendered(_visit) { 9374 } 9375 // Form Submission Delegate 9376 formSubmissionStarted(_formSubmission) { 9377 this.progressBar.setValue(0); 9378 this.showFormProgressBarAfterDelay(); 9379 } 9380 formSubmissionFinished(_formSubmission) { 9381 this.progressBar.setValue(1); 9382 this.hideFormProgressBar(); 9383 } 9384 // Private 9385 showVisitProgressBarAfterDelay() { 9386 this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 9387 } 9388 hideVisitProgressBar() { 9389 this.progressBar.hide(); 9390 if (this.visitProgressBarTimeout != null) { 9391 window.clearTimeout(this.visitProgressBarTimeout); 9392 delete this.visitProgressBarTimeout; 9393 } 9394 } 9395 showFormProgressBarAfterDelay() { 9396 if (this.formProgressBarTimeout == null) { 9397 this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 9398 } 9399 } 9400 hideFormProgressBar() { 9401 this.progressBar.hide(); 9402 if (this.formProgressBarTimeout != null) { 9403 window.clearTimeout(this.formProgressBarTimeout); 9404 delete this.formProgressBarTimeout; 9405 } 9406 } 9407 reload(reason) { 9408 var _a2; 9409 dispatch("turbo:reload", { detail: reason }); 9410 window.location.href = ((_a2 = this.location) == null ? void 0 : _a2.toString()) || window.location.href; 9411 } 9412 get navigator() { 9413 return this.session.navigator; 9414 } 9415} 9416class CacheObserver { 9417 constructor() { 9418 __publicField(this, "selector", "[data-turbo-temporary]"); 9419 __publicField(this, "deprecatedSelector", "[data-turbo-cache=false]"); 9420 __publicField(this, "started", false); 9421 __publicField(this, "removeTemporaryElements", (_event) => { 9422 for (const element of this.temporaryElements) { 9423 element.remove(); 9424 } 9425 }); 9426 } 9427 start() { 9428 if (!this.started) { 9429 this.started = true; 9430 addEventListener("turbo:before-cache", this.removeTemporaryElements, false); 9431 } 9432 } 9433 stop() { 9434 if (this.started) { 9435 this.started = false;
9436 removeEventListener("turbo:before-cache", this.removeTemporaryElements, false); 9437 } 9438 } 9439 get temporaryElements() { 9440 return [...document.querySelectorAll(this.selector), ...this.temporaryElementsWithDeprecation]; 9441 } 9442 get temporaryElementsWithDeprecation() { 9443 const elements = document.querySelectorAll(this.deprecatedSelector); 9444 if (elements.length) { 9445 console.warn( 9446 `The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.` 9447 ); 9448 } 9449 return [...elements]; 9450 } 9451} 9452class FrameRedirector { 9453 constructor(session2, element) { 9454 __privateAdd(this, _FrameRedirector_instances); 9455 this.session = session2; 9456 this.element = element; 9457 this.linkInterceptor = new LinkInterceptor(this, element); 9458 this.formSubmitObserver = new FormSubmitObserver(this, element); 9459 } 9460 start() { 9461 this.linkInterceptor.start(); 9462 this.formSubmitObserver.start(); 9463 } 9464 stop() { 9465 this.linkInterceptor.stop(); 9466 this.formSubmitObserver.stop(); 9467 } 9468 // Link interceptor delegate 9469 shouldInterceptLinkClick(element, _location, _event) { 9470 return __privateMethod(this, _FrameRedirector_instances, shouldRedirect_fn).call(this, element); 9471 } 9472 linkClickIntercepted(element, url, event) { 9473 const frame = __privateMethod(this, _FrameRedirector_instances, findFrameElement_fn).call(this, element); 9474 if (frame) { 9475 frame.delegate.linkClickIntercepted(element, url, event); 9476 } 9477 } 9478 // Form submit observer delegate 9479 willSubmitForm(element, submitter2) { 9480 return element.closest("turbo-frame") == null && __privateMethod(this, _FrameRedirector_instances, shouldSubmit_fn).call(this, element, submitter2) && __privateMethod(this, _FrameRedirector_instances, shouldRedirect_fn).call(this, element, submitter2); 9481 } 9482 formSubmitted(element, submitter2) { 9483 const frame = __privateMethod(this, _FrameRedirector_instances, findFrameElement_fn).call(this, element, submitter2); 9484 if (frame) { 9485 frame.delegate.formSubmitted(element, submitter2); 9486 } 9487 } 9488} 9489_FrameRedirector_instances = new WeakSet(); 9490shouldSubmit_fn = function(form, submitter2) { 9491 const action = getAction$1(form, submitter2); 9492 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 9493 const rootLocation = expandURL((meta == null ? void 0 : meta.content) ?? "/"); 9494 return __privateMethod(this, _FrameRedirector_instances, shouldRedirect_fn).call(this, form, submitter2) && locationIsVisitable(action, rootLocation); 9495}; 9496shouldRedirect_fn = function(element, submitter2) { 9497 const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter2) : this.session.elementIsNavigatable(element); 9498 if (isNavigatable) { 9499 const frame = __privateMethod(this, _FrameRedirector_instances, findFrameElement_fn).call(this, element, submitter2); 9500 return frame ? frame != element.closest("turbo-frame") : false; 9501 } else { 9502 return false; 9503 } 9504}; 9505findFrameElement_fn = function(element, submitter2) { 9506 const id2 = (submitter2 == null ? void 0 : submitter2.getAttribute("data-turbo-frame")) || element.getAttribute("data-turbo-frame"); 9507 if (id2 && id2 != "_top") { 9508 const frame = this.element.querySelector(`#${id2}:not([disabled])`); 9509 if (frame instanceof FrameElement) { 9510 return frame; 9511 } 9512 } 9513}; 9514class History { 9515 constructor(delegate) { 9516 __publicField(this, "location"); 9517 __publicField(this, "restorationIdentifier", uuid()); 9518 __publicField(this, "restorationData", {}); 9519 __publicField(this, "started", false); 9520 __publicField(this, "pageLoaded", false); 9521 __publicField(this, "currentIndex", 0); 9522 // Event handlers 9523 __publicField(this, "onPopState", (event) => { 9524 if (this.shouldHandlePopState()) { 9525 const { turbo } = event.state || {}; 9526 if (turbo) { 9527 this.location = new URL(window.location.href); 9528 const { restorationIdentifier, restorationIndex } = turbo; 9529 this.restorationIdentifier = restorationIdentifier; 9530 const direction = restorationIndex > this.currentIndex ? "forward" : "back"; 9531 this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location, restorationIdentifier, direction); 9532 this.currentIndex = restorationIndex; 9533 } 9534 } 9535 }); 9536 __publicField(this, "onPageLoad", async (_event) => { 9537 await nextMicrotask(); 9538 this.pageLoaded = true; 9539 }); 9540 this.delegate = delegate; 9541 } 9542 start() { 9543 var _a2, _b2; 9544 if (!this.started) { 9545 addEventListener("popstate", this.onPopState, false); 9546 addEventListener("load", this.onPageLoad, false); 9547 this.currentIndex = ((_b2 = (_a2 = history.state) == null ? void 0 : _a2.turbo) == null ? void 0 : _b2.restorationIndex) || 0; 9548 this.started = true; 9549 this.replace(new URL(window.location.href)); 9550 } 9551 } 9552 stop() { 9553 if (this.started) { 9554 removeEventListener("popstate", this.onPopState, false); 9555 removeEventListener("load", this.onPageLoad, false); 9556 this.started = false;
9557 } 9558 } 9559 push(location2, restorationIdentifier) { 9560 this.update(history.pushState, location2, restorationIdentifier); 9561 } 9562 replace(location2, restorationIdentifier) { 9563 this.update(history.replaceState, location2, restorationIdentifier); 9564 } 9565 update(method, location2, restorationIdentifier = uuid()) { 9566 if (method === history.pushState) ++this.currentIndex; 9567 const state = { turbo: { restorationIdentifier, restorationIndex: this.currentIndex } }; 9568 method.call(history, state, "", location2.href); 9569 this.location = location2; 9570 this.restorationIdentifier = restorationIdentifier; 9571 } 9572 // Restoration data 9573 getRestorationDataForIdentifier(restorationIdentifier) { 9574 return this.restorationData[restorationIdentifier] || {}; 9575 } 9576 updateRestorationData(additionalData) { 9577 const { restorationIdentifier } = this; 9578 const restorationData = this.restorationData[restorationIdentifier]; 9579 this.restorationData[restorationIdentifier] = { 9580 ...restorationData, 9581 ...additionalData 9582 }; 9583 } 9584 // Scroll restoration 9585 assumeControlOfScrollRestoration() { 9586 if (!this.previousScrollRestoration) { 9587 this.previousScrollRestoration = history.scrollRestoration ?? "auto"; 9588 history.scrollRestoration = "manual"; 9589 } 9590 } 9591 relinquishControlOfScrollRestoration() { 9592 if (this.previousScrollRestoration) { 9593 history.scrollRestoration = this.previousScrollRestoration; 9594 delete this.previousScrollRestoration; 9595 } 9596 } 9597 // Private 9598 shouldHandlePopState() { 9599 return this.pageIsLoaded(); 9600 } 9601 pageIsLoaded() { 9602 return this.pageLoaded || document.readyState == "complete"; 9603 } 9604} 9605class LinkPrefetchObserver { 9606 constructor(delegate, eventTarget) { 9607 __privateAdd(this, _LinkPrefetchObserver_instances); 9608 __publicField(this, "started", false); 9609 __privateAdd(this, _prefetchedLink, null); 9610 __privateAdd(this, _enable, () => { 9611 this.eventTarget.addEventListener("mouseenter", __privateGet(this, _tryToPrefetchRequest), { 9612 capture: true, 9613 passive: true 9614 }); 9615 this.eventTarget.addEventListener("mouseleave", __privateGet(this, _cancelRequestIfObsolete), { 9616 capture: true, 9617 passive: true 9618 }); 9619 this.eventTarget.addEventListener("turbo:before-fetch-request", __privateGet(this, _tryToUsePrefetchedRequest), true); 9620 this.started = true; 9621 }); 9622 __privateAdd(this, _tryToPrefetchRequest, (event) => { 9623 if (getMetaContent("turbo-prefetch") === "false") return; 9624 const target = event.target; 9625 const isLink = target.matches && target.matches("a[href]:not([target^=_]):not([download])"); 9626 if (isLink && __privateMethod(this, _LinkPrefetchObserver_instances, isPrefetchable_fn).call(this, target)) { 9627 const link = target; 9628 const location2 = getLocationForLink(link); 9629 if (this.delegate.canPrefetchRequestToLocation(link, location2)) { 9630 __privateSet(this, _prefetchedLink, link); 9631 const fetchRequest = new FetchRequest( 9632 this, 9633 FetchMethod.get, 9634 location2, 9635 new URLSearchParams(), 9636 target 9637 ); 9638 prefetchCache.setLater(location2.toString(), fetchRequest, __privateGet(this, _LinkPrefetchObserver_instances, cacheTtl_get)); 9639 } 9640 } 9641 }); 9642 __privateAdd(this, _cancelRequestIfObsolete, (event) => { 9643 if (event.target === __privateGet(this, _prefetchedLink)) __privateGet(this, _cancelPrefetchRequest).call(this); 9644 }); 9645 __privateAdd(this, _cancelPrefetchRequest, () => { 9646 prefetchCache.clear(); 9647 __privateSet(this, _prefetchedLink, null); 9648 }); 9649 __privateAdd(this, _tryToUsePrefetchedRequest, (event) => { 9650 if (event.target.tagName !== "FORM" && event.detail.fetchOptions.method === "GET") { 9651 const cached = prefetchCache.get(event.detail.url.toString()); 9652 if (cached) { 9653 event.detail.fetchRequest = cached; 9654 } 9655 prefetchCache.clear(); 9656 } 9657 }); 9658 this.delegate = delegate; 9659 this.eventTarget = eventTarget; 9660 } 9661 start() { 9662 if (this.started) return; 9663 if (this.eventTarget.readyState === "loading") { 9664 this.eventTarget.addEventListener("DOMContentLoaded", __privateGet(this, _enable), { once: true }); 9665 } else { 9666 __privateGet(this, _enable).call(this); 9667 } 9668 } 9669 stop() { 9670 if (!this.started) return; 9671 this.eventTarget.removeEventListener("mouseenter", __privateGet(this, _tryToPrefetchRequest), { 9672 capture: true, 9673 passive: true 9674 }); 9675 this.eventTarget.removeEventListener("mouseleave", __privateGet(this, _cancelRequestIfObsolete), { 9676 capture: true, 9677 passive: true 9678 }); 9679 this.eventTarget.removeEventListener("turbo:before-fetch-request", __privateGet(this, _tryToUsePrefetchedRequest), true); 9680 this.started = false;
9681 } 9682 prepareRequest(request) { 9683 const link = request.target; 9684 request.headers["X-Sec-Purpose"] = "prefetch"; 9685 const turboFrame = link.closest("turbo-frame"); 9686 const turboFrameTarget = link.getAttribute("data-turbo-frame") || (turboFrame == null ? void 0 : turboFrame.getAttribute("target")) || (turboFrame == null ? void 0 : turboFrame.id); 9687 if (turboFrameTarget && turboFrameTarget !== "_top") { 9688 request.headers["Turbo-Frame"] = turboFrameTarget; 9689 } 9690 } 9691 // Fetch request interface 9692 requestSucceededWithResponse() { 9693 } 9694 requestStarted(fetchRequest) { 9695 } 9696 requestErrored(fetchRequest) { 9697 } 9698 requestFinished(fetchRequest) { 9699 } 9700 requestPreventedHandlingResponse(fetchRequest, fetchResponse) { 9701 } 9702 requestFailedWithResponse(fetchRequest, fetchResponse) { 9703 } 9704} 9705_prefetchedLink = new WeakMap(); 9706_enable = new WeakMap(); 9707_tryToPrefetchRequest = new WeakMap(); 9708_cancelRequestIfObsolete = new WeakMap(); 9709_cancelPrefetchRequest = new WeakMap(); 9710_tryToUsePrefetchedRequest = new WeakMap(); 9711_LinkPrefetchObserver_instances = new WeakSet(); 9712cacheTtl_get = function() { 9713 return Number(getMetaContent("turbo-prefetch-cache-time")) || cacheTtl; 9714}; 9715isPrefetchable_fn = function(link) { 9716 const href = link.getAttribute("href"); 9717 if (!href) return false; 9718 if (unfetchableLink(link)) return false; 9719 if (linkToTheSamePage(link)) return false; 9720 if (linkOptsOut(link)) return false; 9721 if (nonSafeLink(link)) return false; 9722 if (eventPrevented(link)) return false; 9723 return true; 9724}; 9725const unfetchableLink = (link) => { 9726 return link.origin !== document.location.origin || !["http:", "https:"].includes(link.protocol) || link.hasAttribute("target"); 9727}; 9728const linkToTheSamePage = (link) => { 9729 return link.pathname + link.search === document.location.pathname + document.location.search || link.href.startsWith("#"); 9730}; 9731const linkOptsOut = (link) => { 9732 if (link.getAttribute("data-turbo-prefetch") === "false") return true; 9733 if (link.getAttribute("data-turbo") === "false") return true; 9734 const turboPrefetchParent = findClosestRecursively(link, "[data-turbo-prefetch]"); 9735 if (turboPrefetchParent && turboPrefetchParent.getAttribute("data-turbo-prefetch") === "false") return true; 9736 return false; 9737}; 9738const nonSafeLink = (link) => { 9739 const turboMethod = link.getAttribute("data-turbo-method"); 9740 if (turboMethod && turboMethod.toLowerCase() !== "get") return true; 9741 if (isUJS(link)) return true; 9742 if (link.hasAttribute("data-turbo-confirm")) return true; 9743 if (link.hasAttribute("data-turbo-stream")) return true; 9744 return false; 9745}; 9746const isUJS = (link) => { 9747 return link.hasAttribute("data-remote") || link.hasAttribute("data-behavior") || link.hasAttribute("data-confirm") || link.hasAttribute("data-method"); 9748}; 9749const eventPrevented = (link) => { 9750 const event = dispatch("turbo:before-prefetch", { target: link, cancelable: true }); 9751 return event.defaultPrevented; 9752}; 9753class Navigator { 9754 constructor(delegate) { 9755 __privateAdd(this, _Navigator_instances); 9756 this.delegate = delegate; 9757 } 9758 proposeVisit(location2, options = {}) { 9759 if (this.delegate.allowsVisitingLocationWithAction(location2, options.action)) { 9760 this.delegate.visitProposedToLocation(location2, options); 9761 } 9762 } 9763 startVisit(locatable, restorationIdentifier, options = {}) { 9764 this.stop(); 9765 this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, { 9766 referrer: this.location, 9767 ...options 9768 }); 9769 this.currentVisit.start(); 9770 } 9771 submitForm(form, submitter2) { 9772 this.stop(); 9773 this.formSubmission = new FormSubmission(this, form, submitter2, true); 9774 this.formSubmission.start(); 9775 } 9776 stop() { 9777 if (this.formSubmission) { 9778 this.formSubmission.stop(); 9779 delete this.formSubmission; 9780 } 9781 if (this.currentVisit) { 9782 this.currentVisit.cancel(); 9783 delete this.currentVisit; 9784 } 9785 } 9786 get adapter() { 9787 return this.delegate.adapter; 9788 } 9789 get view() { 9790 return this.delegate.view; 9791 } 9792 get rootLocation() { 9793 return this.view.snapshot.rootLocation; 9794 } 9795 get history() { 9796 return this.delegate.history; 9797 } 9798 // Form submission delegate 9799 formSubmissionStarted(formSubmission) { 9800 if (typeof this.adapter.formSubmissionStarted === "function") { 9801 this.adapter.formSubmissionStarted(formSubmission); 9802 } 9803 } 9804 async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) { 9805 if (formSubmission == this.formSubmission) { 9806 const responseHTML = await fetchResponse.responseHTML; 9807 if (responseHTML) { 9808 const shouldCacheSnapshot = formSubmission.isSafe; 9809 if (!shouldCacheSnapshot) { 9810 this.view.clearSnapshotCache(); 9811 } 9812 const { statusCode, redirected } = fetchResponse; 9813 const action = __privateMethod(this, _Navigator_instances, getActionForFormSubmission_fn).call(this, formSubmission, fetchResponse); 9814 const visitOptions = { 9815 action, 9816 shouldCacheSnapshot, 9817 response: { statusCode, responseHTML, redirected } 9818 }; 9819 this.proposeVisit(fetchResponse.location, visitOptions); 9820 } 9821 } 9822 } 9823 async formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 9824 const responseHTML = await fetchResponse.responseHTML; 9825 if (responseHTML) { 9826 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 9827 if (fetchResponse.serverError) { 9828 await this.view.renderError(snapshot, this.currentVisit); 9829 } else { 9830 await this.view.renderPage(snapshot, false, true, this.currentVisit); 9831 } 9832 if (!snapshot.shouldPreserveScrollPosition) { 9833 this.view.scrollToTop(); 9834 } 9835 this.view.clearSnapshotCache(); 9836 } 9837 } 9838 formSubmissionErrored(formSubmission, error2) { 9839 console.error(error2); 9840 } 9841 formSubmissionFinished(formSubmission) { 9842 if (typeof this.adapter.formSubmissionFinished === "function") { 9843 this.adapter.formSubmissionFinished(formSubmission); 9844 } 9845 } 9846 // Visit delegate 9847 visitStarted(visit2) { 9848 this.delegate.visitStarted(visit2); 9849 } 9850 visitCompleted(visit2) { 9851 this.delegate.visitCompleted(visit2); 9852 delete this.currentVisit; 9853 } 9854 locationWithActionIsSamePage(location2, action) { 9855 const anchor = getAnchor(location2); 9856 const currentAnchor = getAnchor(this.view.lastRenderedLocation); 9857 const isRestorationToTop = action === "restore" && typeof anchor === "undefined"; 9858 return action !== "replace" && getRequestURL(location2) === getRequestURL(this.view.lastRenderedLocation) && (isRestorationToTop || anchor != null && anchor !== currentAnchor); 9859 } 9860 visitScrolledToSamePageLocation(oldURL, newURL) { 9861 this.delegate.visitScrolledToSamePageLocation(oldURL, newURL); 9862 } 9863 // Visits 9864 get location() { 9865 return this.history.location; 9866 } 9867 get restorationIdentifier() { 9868 return this.history.restorationIdentifier; 9869 } 9870} 9871_Navigator_instances = new WeakSet(); 9872getActionForFormSubmission_fn = function(formSubmission, fetchResponse) { 9873 const { submitter: submitter2, formElement } = formSubmission; 9874 return getVisitAction(submitter2, formElement) || __privateMethod(this, _Navigator_instances, getDefaultAction_fn).call(this, fetchResponse); 9875}; 9876getDefaultAction_fn = function(fetchResponse) { 9877 var _a2; 9878 const sameLocationRedirect = fetchResponse.redirected && fetchResponse.location.href === ((_a2 = this.location) == null ? void 0 : _a2.href); 9879 return sameLocationRedirect ? "replace" : "advance"; 9880}; 9881const PageStage = { 9882 initial: 0, 9883 loading: 1, 9884 interactive: 2, 9885 complete: 3 9886}; 9887class PageObserver { 9888 constructor(delegate) { 9889 __publicField(this, "stage", PageStage.initial); 9890 __publicField(this, "started", false); 9891 __publicField(this, "interpretReadyState", () => { 9892 const { readyState } = this; 9893 if (readyState == "interactive") { 9894 this.pageIsInteractive(); 9895 } else if (readyState == "complete") { 9896 this.pageIsComplete(); 9897 } 9898 }); 9899 __publicField(this, "pageWillUnload", () => { 9900 this.delegate.pageWillUnload(); 9901 }); 9902 this.delegate = delegate; 9903 } 9904 start() { 9905 if (!this.started) { 9906 if (this.stage == PageStage.initial) { 9907 this.stage = PageStage.loading; 9908 } 9909 document.addEventListener("readystatechange", this.interpretReadyState, false); 9910 addEventListener("pagehide", this.pageWillUnload, false); 9911 this.started = true; 9912 } 9913 } 9914 stop() { 9915 if (this.started) { 9916 document.removeEventListener("readystatechange", this.interpretReadyState, false); 9917 removeEventListener("pagehide", this.pageWillUnload, false); 9918 this.started = false;
9919 } 9920 } 9921 pageIsInteractive() { 9922 if (this.stage == PageStage.loading) { 9923 this.stage = PageStage.interactive; 9924 this.delegate.pageBecameInteractive(); 9925 } 9926 } 9927 pageIsComplete() { 9928 this.pageIsInteractive(); 9929 if (this.stage == PageStage.interactive) { 9930 this.stage = PageStage.complete; 9931 this.delegate.pageLoaded(); 9932 } 9933 } 9934 get readyState() { 9935 return document.readyState; 9936 } 9937} 9938class ScrollObserver { 9939 constructor(delegate) { 9940 __publicField(this, "started", false); 9941 __publicField(this, "onScroll", () => { 9942 this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset }); 9943 }); 9944 this.delegate = delegate; 9945 } 9946 start() { 9947 if (!this.started) { 9948 addEventListener("scroll", this.onScroll, false); 9949 this.onScroll(); 9950 this.started = true; 9951 } 9952 } 9953 stop() { 9954 if (this.started) { 9955 removeEventListener("scroll", this.onScroll, false); 9956 this.started = false; 9957 } 9958 } 9959 // Private 9960 updatePosition(position) { 9961 this.delegate.scrollPositionChanged(position); 9962 } 9963} 9964class StreamMessageRenderer { 9965 render({ fragment }) { 9966 Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => { 9967 withAutofocusFromFragment(fragment, () => { 9968 withPreservedFocus(() => { 9969 document.documentElement.appendChild(fragment); 9970 }); 9971 }); 9972 }); 9973 } 9974 // Bardo delegate 9975 enteringBardo(currentPermanentElement, newPermanentElement) { 9976 newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true)); 9977 } 9978 leavingBardo() { 9979 } 9980} 9981function getPermanentElementMapForFragment(fragment) { 9982 const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement); 9983 const permanentElementMap = {}; 9984 for (const permanentElementInDocument of permanentElementsInDocument) { 9985 const { id: id2 } = permanentElementInDocument; 9986 for (const streamElement of fragment.querySelectorAll("turbo-stream")) { 9987 const elementInStream = getPermanentElementById(streamElement.templateElement.content, id2); 9988 if (elementInStream) { 9989 permanentElementMap[id2] = [permanentElementInDocument, elementInStream]; 9990 } 9991 } 9992 } 9993 return permanentElementMap; 9994} 9995async function withAutofocusFromFragment(fragment, callback) { 9996 const generatedID = `turbo-stream-autofocus-${uuid()}`; 9997 const turboStreams = fragment.querySelectorAll("turbo-stream"); 9998 const elementWithAutofocus = firstAutofocusableElementInStreams(turboStreams); 9999 let willAutofocusId = null; 10000 if (elementWithAutofocus) { 10001 if (elementWithAutofocus.id) { 10002 willAutofocusId = elementWithAutofocus.id; 10003 } else { 10004 willAutofocusId = generatedID; 10005 } 10006 elementWithAutofocus.id = willAutofocusId; 10007 } 10008 callback(); 10009 await nextRepaint(); 10010 const hasNoActiveElement = document.activeElement == null || document.activeElement == document.body; 10011 if (hasNoActiveElement && willAutofocusId) { 10012 const elementToAutofocus = document.getElementById(willAutofocusId); 10013 if (elementIsFocusable(elementToAutofocus)) { 10014 elementToAutofocus.focus(); 10015 } 10016 if (elementToAutofocus && elementToAutofocus.id == generatedID) { 10017 elementToAutofocus.removeAttribute("id"); 10018 } 10019 } 10020} 10021async function withPreservedFocus(callback) { 10022 const [activeElementBeforeRender, activeElementAfterRender] = await around(callback, () => document.activeElement); 10023 const restoreFocusTo = activeElementBeforeRender && activeElementBeforeRender.id; 10024 if (restoreFocusTo) { 10025 const elementToFocus = document.getElementById(restoreFocusTo); 10026 if (elementIsFocusable(elementToFocus) && elementToFocus != activeElementAfterRender) { 10027 elementToFocus.focus(); 10028 } 10029 } 10030} 10031function firstAutofocusableElementInStreams(nodeListOfStreamElements) { 10032 for (const streamElement of nodeListOfStreamElements) { 10033 const elementWithAutofocus = queryAutofocusableElement(streamElement.templateElement.content); 10034 if (elementWithAutofocus) return elementWithAutofocus; 10035 } 10036 return null; 10037} 10038class StreamObserver { 10039 constructor(delegate) { 10040 __publicField(this, "sources", /* @__PURE__ */ new Set()); 10041 __privateAdd(this, _started, false); 10042 __publicField(this, "inspectFetchResponse", (event) => { 10043 const response = fetchResponseFromEvent(event); 10044 if (response && fetchResponseIsStream(response)) { 10045 event.preventDefault(); 10046 this.receiveMessageResponse(response); 10047 } 10048 }); 10049 __publicField(this, "receiveMessageEvent", (event) => { 10050 if (__privateGet(this, _started) && typeof event.data == "string") { 10051 this.receiveMessageHTML(event.data); 10052 } 10053 }); 10054 this.delegate = delegate; 10055 } 10056 start() { 10057 if (!__privateGet(this, _started)) { 10058 __privateSet(this, _started, true); 10059 addEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 10060 } 10061 } 10062 stop() { 10063 if (__privateGet(this, _started)) { 10064 __privateSet(this, _started, false); 10065 removeEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 10066 } 10067 } 10068 connectStreamSource(source) { 10069 if (!this.streamSourceIsConnected(source)) { 10070 this.sources.add(source); 10071 source.addEventListener("message", this.receiveMessageEvent, false); 10072 } 10073 } 10074 disconnectStreamSource(source) { 10075 if (this.streamSourceIsConnected(source)) { 10076 this.sources.delete(source); 10077 source.removeEventListener("message", this.receiveMessageEvent, false); 10078 } 10079 } 10080 streamSourceIsConnected(source) { 10081 return this.sources.has(source); 10082 } 10083 async receiveMessageResponse(response) { 10084 const html = await response.responseHTML; 10085 if (html) { 10086 this.receiveMessageHTML(html); 10087 } 10088 } 10089 receiveMessageHTML(html) { 10090 this.delegate.receivedMessageFromStream(StreamMessage.wrap(html)); 10091 } 10092} 10093_started = new WeakMap(); 10094function fetchResponseFromEvent(event) { 10095 var _a2; 10096 const fetchResponse = (_a2 = event.detail) == null ? void 0 : _a2.fetchResponse; 10097 if (fetchResponse instanceof FetchResponse) { 10098 return fetchResponse; 10099 } 10100} 10101function fetchResponseIsStream(response) { 10102 const contentType = response.contentType ?? ""; 10103 return contentType.startsWith(StreamMessage.contentType); 10104} 10105class ErrorRenderer extends Renderer { 10106 static renderElement(currentElement, newElement) { 10107 const { documentElement, body } = document; 10108 documentElement.replaceChild(newElement, body); 10109 } 10110 async render() { 10111 this.replaceHeadAndBody(); 10112 this.activateScriptElements(); 10113 } 10114 replaceHeadAndBody() { 10115 const { documentElement, head } = document; 10116 documentElement.replaceChild(this.newHead, head); 10117 this.renderElement(this.currentElement, this.newElement); 10118 } 10119 activateScriptElements() { 10120 for (const replaceableElement of this.scriptElements) { 10121 const parentNode = replaceableElement.parentNode; 10122 if (parentNode) { 10123 const element = activateScriptElement(replaceableElement); 10124 parentNode.replaceChild(element, replaceableElement); 10125 } 10126 } 10127 } 10128 get newHead() {
10129 return this.newSnapshot.headSnapshot.element; 10130 } 10131 get scriptElements() { 10132 return document.documentElement.querySelectorAll("script"); 10133 } 10134} 10135class PageRenderer extends Renderer { 10136 constructor() { 10137 super(...arguments); 10138 __privateAdd(this, _PageRenderer_instances); 10139 } 10140 static renderElement(currentElement, newElement) { 10141 if (document.body && newElement instanceof HTMLBodyElement) { 10142 document.body.replaceWith(newElement); 10143 } else { 10144 document.documentElement.appendChild(newElement); 10145 } 10146 } 10147 get shouldRender() { 10148 return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical; 10149 } 10150 get reloadReason() { 10151 if (!this.newSnapshot.isVisitable) { 10152 return { 10153 reason: "turbo_visit_control_is_reload" 10154 }; 10155 } 10156 if (!this.trackedElementsAreIdentical) { 10157 return { 10158 reason: "tracked_element_mismatch" 10159 }; 10160 } 10161 } 10162 async prepareToRender() { 10163 __privateMethod(this, _PageRenderer_instances, setLanguage_fn).call(this); 10164 await this.mergeHead(); 10165 } 10166 async render() { 10167 if (this.willRender) { 10168 await this.replaceBody(); 10169 } 10170 } 10171 finishRendering() { 10172 super.finishRendering(); 10173 if (!this.isPreview) { 10174 this.focusFirstAutofocusableElement(); 10175 } 10176 } 10177 get currentHeadSnapshot() { 10178 return this.currentSnapshot.headSnapshot; 10179 } 10180 get newHeadSnapshot() { 10181 return this.newSnapshot.headSnapshot; 10182 } 10183 get newElement() { 10184 return this.newSnapshot.element; 10185 } 10186 async mergeHead() { 10187 const mergedHeadElements = this.mergeProvisionalElements(); 10188 const newStylesheetElements = this.copyNewHeadStylesheetElements(); 10189 this.copyNewHeadScriptElements(); 10190 await mergedHeadElements; 10191 await newStylesheetElements; 10192 if (this.willRender) { 10193 this.removeUnusedDynamicStylesheetElements(); 10194 } 10195 } 10196 async replaceBody() { 10197 await this.preservingPermanentElements(async () => { 10198 this.activateNewBody(); 10199 await this.assignNewBody(); 10200 }); 10201 } 10202 get trackedElementsAreIdentical() { 10203 return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature; 10204 } 10205 async copyNewHeadStylesheetElements() { 10206 const loadingElements = []; 10207 for (const element of this.newHeadStylesheetElements) { 10208 loadingElements.push(waitForLoad(element)); 10209 document.head.appendChild(element); 10210 } 10211 await Promise.all(loadingElements); 10212 } 10213 copyNewHeadScriptElements() { 10214 for (const element of this.newHeadScriptElements) { 10215 document.head.appendChild(activateScriptElement(element)); 10216 } 10217 } 10218 removeUnusedDynamicStylesheetElements() { 10219 for (const element of this.unusedDynamicStylesheetElements) { 10220 document.head.removeChild(element); 10221 } 10222 } 10223 async mergeProvisionalElements() { 10224 const newHeadElements = [...this.newHeadProvisionalElements]; 10225 for (const element of this.currentHeadProvisionalElements) { 10226 if (!this.isCurrentElementInElementList(element, newHeadElements)) { 10227 document.head.removeChild(element); 10228 } 10229 } 10230 for (const element of newHeadElements) { 10231 document.head.appendChild(element); 10232 } 10233 } 10234 isCurrentElementInElementList(element, elementList) { 10235 for (const [index3, newElement] of elementList.entries()) { 10236 if (element.tagName == "TITLE") { 10237 if (newElement.tagName != "TITLE") { 10238 continue; 10239 } 10240 if (element.innerHTML == newElement.innerHTML) { 10241 elementList.splice(index3, 1); 10242 return true; 10243 } 10244 } 10245 if (newElement.isEqualNode(element)) { 10246 elementList.splice(index3, 1); 10247 return true; 10248 } 10249 } 10250 return false; 10251 } 10252 removeCurrentHeadProvisionalElements() { 10253 for (const element of this.currentHeadProvisionalElements) { 10254 document.head.removeChild(element); 10255 } 10256 } 10257 copyNewHeadProvisionalElements() { 10258 for (const element of this.newHeadProvisionalElements) { 10259 document.head.appendChild(element); 10260 } 10261 } 10262 activateNewBody() { 10263 document.adoptNode(this.newElement); 10264 this.activateNewBodyScriptElements(); 10265 } 10266 activateNewBodyScriptElements() { 10267 for (const inertScriptElement of this.newBodyScriptElements) { 10268 const activatedScriptElement = activateScriptElement(inertScriptElement); 10269 inertScriptElement.replaceWith(activatedScriptElement); 10270 } 10271 } 10272 async assignNewBody() { 10273 await this.renderElement(this.currentElement, this.newElement); 10274 } 10275 get unusedDynamicStylesheetElements() { 10276 return this.oldHeadStylesheetElements.filter((element) => { 10277 return element.getAttribute("data-turbo-track") === "dynamic"; 10278 }); 10279 } 10280 get oldHeadStylesheetElements() { 10281 return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot); 10282 } 10283 get newHeadStylesheetElements() { 10284 return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot); 10285 } 10286 get newHeadScriptElements() { 10287 return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot); 10288 } 10289 get currentHeadProvisionalElements() { 10290 return this.currentHeadSnapshot.provisionalElements; 10291 } 10292 get newHeadProvisionalElements() { 10293 return this.newHeadSnapshot.provisionalElements; 10294 } 10295 get newBodyScriptElements() { 10296 return this.newElement.querySelectorAll("script"); 10297 } 10298} 10299_PageRenderer_instances = new WeakSet(); 10300setLanguage_fn = function() { 10301 const { documentElement } = this.currentSnapshot; 10302 const { lang }
10302 = this.newSnapshot; 10303 if (lang) { 10304 documentElement.setAttribute("lang", lang); 10305 } else { 10306 documentElement.removeAttribute("lang"); 10307 } 10308}; 10309class MorphingPageRenderer extends PageRenderer { 10310 static renderElement(currentElement, newElement) { 10311 morphElements(currentElement, newElement, { 10312 callbacks: { 10313 beforeNodeMorphed: (element) => !canRefreshFrame(element) 10314 } 10315 }); 10316 for (const frame of currentElement.querySelectorAll("turbo-frame")) { 10317 if (canRefreshFrame(frame)) frame.reload(); 10318 } 10319 dispatch("turbo:morph", { detail: { currentElement, newElement } }); 10320 } 10321 async preservingPermanentElements(callback) { 10322 return await callback(); 10323 } 10324 get renderMethod() { 10325 return "morph"; 10326 } 10327 get shouldAutofocus() { 10328 return false; 10329 } 10330} 10331function canRefreshFrame(frame) { 10332 return frame instanceof FrameElement && frame.src && frame.refresh === "morph" && !frame.closest("[data-turbo-permanent]"); 10333} 10334class SnapshotCache { 10335 constructor(size) { 10336 __publicField(this, "keys", []); 10337 __publicField(this, "snapshots", {}); 10338 this.size = size; 10339 } 10340 has(location2) { 10341 return toCacheKey(location2) in this.snapshots; 10342 } 10343 get(location2) { 10344 if (this.has(location2)) { 10345 const snapshot = this.read(location2); 10346 this.touch(location2); 10347 return snapshot; 10348 } 10349 } 10350 put(location2, snapshot) { 10351 this.write(location2, snapshot); 10352 this.touch(location2); 10353 return snapshot; 10354 } 10355 clear() { 10356 this.snapshots = {}; 10357 } 10358 // Private 10359 read(location2) { 10360 return this.snapshots[toCacheKey(location2)]; 10361 } 10362 write(location2, snapshot) { 10363 this.snapshots[toCacheKey(location2)] = snapshot; 10364 } 10365 touch(location2) { 10366 const key2 = toCacheKey(location2); 10367 const index3 = this.keys.indexOf(key2); 10368 if (index3 > -1) this.keys.splice(index3, 1); 10369 this.keys.unshift(key2); 10370 this.trim(); 10371 } 10372 trim() { 10373 for (const key2 of this.keys.splice(this.size)) { 10374 delete this.snapshots[key2]; 10375 } 10376 } 10377} 10378class PageView extends View { 10379 constructor() { 10380 super(...arguments); 10381 __publicField(this, "snapshotCache", new SnapshotCache(10)); 10382 __publicField(this, "lastRenderedLocation", new URL(location.href)); 10383 __publicField(this, "forceReloaded", false); 10384 } 10385 shouldTransitionTo(newSnapshot) { 10386 return this.snapshot.prefersViewTransitions && newSnapshot.prefersViewTransitions; 10387 } 10388 renderPage(snapshot, isPreview = false, willRender = true, visit2) { 10389 const shouldMorphPage = this.isPageRefresh(visit2) && this.snapshot.shouldMorphPage; 10390 const rendererClass = shouldMorphPage ? MorphingPageRenderer : PageRenderer; 10391 const renderer9 = new rendererClass(this.snapshot, snapshot, isPreview, willRender); 10392 if (!renderer9.shouldRender) { 10393 this.forceReloaded = true; 10394 } else { 10395 visit2 == null ? void 0 : visit2.changeHistory(); 10396 } 10397 return this.render(renderer9); 10398 } 10399 renderError(snapshot, visit2) { 10400 visit2 == null ? void 0 : visit2.changeHistory(); 10401 const renderer9 = new ErrorRenderer(this.snapshot, snapshot, false); 10402 return this.render(renderer9); 10403 } 10404 clearSnapshotCache() { 10405 this.snapshotCache.clear(); 10406 } 10407 async cacheSnapshot(snapshot = this.snapshot) { 10408 if (snapshot.isCacheable) { 10409 this.delegate.viewWillCacheSnapshot(); 10410 const { lastRenderedLocation: location2 } = this; 10411 await nextEventLoopTick(); 10412 const cachedSnapshot = snapshot.clone(); 10413 this.snapshotCache.put(location2, cachedSnapshot); 10414 return cachedSnapshot; 10415 } 10416 } 10417 getCachedSnapshotForLocation(location2) { 10418 return this.snapshotCache.get(location2); 10419 } 10420 isPageRefresh(visit2) { 10421 return !visit2 || this.lastRenderedLocation.pathname === visit2.location.pathname && visit2.action === "replace"; 10422 } 10423 shouldPreserveScrollPosition(visit2) { 10424 return this.isPageRefresh(visit2) && this.snapshot.shouldPreserveScrollPosition; 10425 } 10426 get snapshot() { 10427 return PageSnapshot.fromElement(this.element); 10428 } 10429} 10430class Preloader { 10431 constructor(delegate, snapshotCache) { 10432 __publicField(this, "selector", "a[data-turbo-preload]"); 10433 __privateAdd(this, _preloadAll, () => { 10434 this.preloadOnLoadLinksForView(document.body); 10435 }); 10436 this.delegate = delegate; 10437 this.snapshotCache = snapshotCache; 10438 } 10439 start() { 10440 if (document.readyState === "loading") { 10441 document.addEventListener("DOMContentLoaded", __privateGet(this, _preloadAll)); 10442 } else { 10443 this.preloadOnLoadLinksForView(document.body); 10444 } 10445 } 10446 stop() { 10447 document.removeEventListener("DOMContentLoaded", __privateGet(this, _preloadAll)); 10448 } 10449 preloadOnLoadLinksForView(element) { 10450 for (const link of element.querySelectorAll(this.selector)) { 10451 if (this.delegate.shouldPreloadLink(link)) { 10452 this.preloadURL(link); 10453 } 10454 } 10455 } 10456 async preloadURL(link) { 10457 const location2 = new URL(link.href); 10458 if (this.snapshotCache.has(location2)) { 10459 return; 10460 } 10461 const fetchRequest = new FetchRequest(this, FetchMethod.get, location2, new URLSearchParams(), link); 10462 await fetchRequest.perform(); 10463 } 10464 // Fetch request delegate 10465 prepareRequest(fetchRequest) { 10466 fetchRequest.headers["X-Sec-Purpose"] = "prefetch"; 10467 } 10468 async requestSucceededWithResponse(fetchRequest, fetchResponse) { 10469 try { 10470 const responseHTML = await fetchResponse.responseHTML; 10471 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 10472 this.snapshotCache.put(fetchRequest.url, snapshot); 10473 } catch (_2) { 10474 } 10475 } 10476 requestStarted(fetchRequest) { 10477 } 10478 requestErrored(fetchRequest) { 10479 } 10480 requestFinished(fetchRequest) { 10481 } 10482 requestPreventedHandlingResponse(fetchRequest, fetchResponse) { 10483 } 10484 requestFailedWithResponse(fetchRequest, fetchResponse) { 10485 } 10486} 10487_preloadAll = new WeakMap(); 10488class Cache { 10489 constructor(session2) { 10490 __privateAdd(this, _Cache_instances); 10491 this.session = session2; 10492 } 10493 clear() { 10494 this.session.clearCache(); 10495 } 10496 resetCacheControl() { 10497 __privateMethod(this, _Cache_instances, setCacheControl_fn).call(this, ""); 10498 } 10499 exemptPageFromCache() { 10500 __privateMethod(this, _Cache_instances, setCacheControl_fn).call(this, "no-cache"); 10501 } 10502 exemptPageFromPreview() { 10503 __privateMethod(this, _Cache_instances, setCacheControl_fn).call(this, "no-preview"); 10504 } 10505} 10506_Cache_instances = new WeakSet(); 10507setCacheControl_fn = function(value) { 10508 setMetaContent("turbo-cache-control", value); 10509}; 10510class Session { 10511 constructor(recentRequests2) { 10512 __publicField(this, "navigator", new Navigator(this)); 10513 __publicField(this, "history", new History(this)); 10514 __publicField(this, "view", new PageView(this, document.documentElement)); 10515 __publicField(this, "adapter", new BrowserAdapter(this));
10516 __publicField(this, "pageObserver", new PageObserver(this)); 10517 __publicField(this, "cacheObserver", new CacheObserver()); 10518 __publicField(this, "linkPrefetchObserver", new LinkPrefetchObserver(this, document)); 10519 __publicField(this, "linkClickObserver", new LinkClickObserver(this, window)); 10520 __publicField(this, "formSubmitObserver", new FormSubmitObserver(this, document)); 10521 __publicField(this, "scrollObserver", new ScrollObserver(this)); 10522 __publicField(this, "streamObserver", new StreamObserver(this)); 10523 __publicField(this, "formLinkClickObserver", new FormLinkClickObserver(this, document.documentElement)); 10524 __publicField(this, "frameRedirector", new FrameRedirector(this, document.documentElement)); 10525 __publicField(this, "streamMessageRenderer", new StreamMessageRenderer()); 10526 __publicField(this, "cache", new Cache(this)); 10527 __publicField(this, "enabled", true); 10528 __publicField(this, "started", false); 10529 __privateAdd(this, _pageRefreshDebouncePeriod, 150); 10530 this.recentRequests = recentRequests2; 10531 this.preloader = new Preloader(this, this.view.snapshotCache); 10532 this.debouncedRefresh = this.refresh; 10533 this.pageRefreshDebouncePeriod = this.pageRefreshDebouncePeriod; 10534 } 10535 start() { 10536 if (!this.started) { 10537 this.pageObserver.start(); 10538 this.cacheObserver.start(); 10539 this.linkPrefetchObserver.start(); 10540 this.formLinkClickObserver.start(); 10541 this.linkClickObserver.start(); 10542 this.formSubmitObserver.start(); 10543 this.scrollObserver.start(); 10544 this.streamObserver.start(); 10545 this.frameRedirector.start(); 10546 this.history.start(); 10547 this.preloader.start(); 10548 this.started = true; 10549 this.enabled = true; 10550 } 10551 } 10552 disable() { 10553 this.enabled = false; 10554 } 10555 stop() { 10556 if (this.started) { 10557 this.pageObserver.stop(); 10558 this.cacheObserver.stop(); 10559 this.linkPrefetchObserver.stop(); 10560 this.formLinkClickObserver.stop(); 10561 this.linkClickObserver.stop(); 10562 this.formSubmitObserver.stop(); 10563 this.scrollObserver.stop(); 10564 this.streamObserver.stop(); 10565 this.frameRedirector.stop(); 10566 this.history.stop(); 10567 this.preloader.stop(); 10568 this.started = false; 10569 } 10570 } 10571 registerAdapter(adapter) { 10572 this.adapter = adapter; 10573 } 10574 visit(location2, options = {}) { 10575 const frameElement = options.frame ? document.getElementById(options.frame) : null; 10576 if (frameElement instanceof FrameElement) { 10577 const action = options.action || getVisitAction(frameElement); 10578 frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement, action); 10579 frameElement.src = location2.toString(); 10580 } else { 10581 this.navigator.proposeVisit(expandURL(location2), options); 10582 } 10583 } 10584 refresh(url, requestId) { 10585 const isRecentRequest = requestId && this.recentRequests.has(requestId); 10586 if (!isRecentRequest && !this.navigator.currentVisit) { 10587 this.visit(url, { action: "replace", shouldCacheSnapshot: false }); 10588 } 10589 } 10590 connectStreamSource(source) { 10591 this.streamObserver.connectStreamSource(source); 10592 } 10593 disconnectStreamSource(source) { 10594 this.streamObserver.disconnectStreamSource(source); 10595 } 10596 renderStreamMessage(message) { 10597 this.streamMessageRenderer.render(StreamMessage.wrap(message)); 10598 } 10599 clearCache() { 10600 this.view.clearSnapshotCache(); 10601 } 10602 setProgressBarDelay(delay) { 10603 console.warn( 10604 "Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`" 10605 ); 10606 this.progressBarDelay = delay; 10607 } 10608 set progressBarDelay(delay) { 10609 config.drive.progressBarDelay = delay; 10610 } 10611 get progressBarDelay() { 10612 return config.drive.progressBarDelay; 10613 } 10614 set drive(value) { 10615 config.drive.enabled = value; 10616 } 10617 get drive() { 10618 return config.drive.enabled; 10619 } 10620 set formMode(value) { 10621 config.forms.mode = value; 10622 } 10623 get formMode() { 10624 return config.forms.mode; 10625 } 10626 get location() { 10627 return this.history.location; 10628 } 10629 get restorationIdentifier() { 10630 return this.history.restorationIdentifier; 10631 } 10632 get pageRefreshDebouncePeriod() { 10633 return __privateGet(this, _pageRefreshDebouncePeriod); 10634 } 10635 set pageRefreshDebouncePeriod(value) { 10636 this.refresh = debounce$1(this.debouncedRefresh.bind(this), value); 10637 __privateSet(this, _pageRefreshDebouncePeriod, value); 10638 } 10639 // Preloader delegate 10640 shouldPreloadLink(element) { 10641 const isUnsafe = element.hasAttribute("data-turbo-method"); 10642 const isStream = element.hasAttribute("data-turbo-stream"); 10643 const frameTarget = element.getAttribute("data-turbo-frame"); 10644 const frame = frameTarget == "_top" ? null : document.getElementById(frameTarget) || findClosestRecursively(element, "turbo-frame:not([disabled])"); 10645 if (isUnsafe || isStream || frame instanceof FrameElement) { 10646 return false;
10647 } else { 10648 const location2 = new URL(element.href); 10649 return this.elementIsNavigatable(element) && locationIsVisitable(location2, this.snapshot.rootLocation); 10650 } 10651 } 10652 // History delegate 10653 historyPoppedToLocationWithRestorationIdentifierAndDirection(location2, restorationIdentifier, direction) { 10654 if (this.enabled) { 10655 this.navigator.startVisit(location2, restorationIdentifier, { 10656 action: "restore", 10657 historyChanged: true, 10658 direction 10659 }); 10660 } else { 10661 this.adapter.pageInvalidated({ 10662 reason: "turbo_disabled" 10663 }); 10664 } 10665 } 10666 // Scroll observer delegate 10667 scrollPositionChanged(position) { 10668 this.history.updateRestorationData({ scrollPosition: position }); 10669 } 10670 // Form click observer delegate 10671 willSubmitFormLinkToLocation(link, location2) { 10672 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation); 10673 } 10674 submittedFormLinkToLocation() { 10675 } 10676 // Link hover observer delegate 10677 canPrefetchRequestToLocation(link, location2) { 10678 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation); 10679 } 10680 // Link click observer delegate 10681 willFollowLinkToLocation(link, location2, event) { 10682 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.applicationAllowsFollowingLinkToLocation(link, location2, event); 10683 } 10684 followedLinkToLocation(link, location2) { 10685 const action = this.getActionForLink(link); 10686 const acceptsStreamResponse = link.hasAttribute("data-turbo-stream"); 10687 this.visit(location2.href, { action, acceptsStreamResponse }); 10688 } 10689 // Navigator delegate 10690 allowsVisitingLocationWithAction(location2, action) { 10691 return this.locationWithActionIsSamePage(location2, action) || this.applicationAllowsVisitingLocation(location2); 10692 } 10693 visitProposedToLocation(location2, options) { 10694 extendURLWithDeprecatedProperties(location2); 10695 this.adapter.visitProposedToLocation(location2, options); 10696 } 10697 // Visit delegate 10698 visitStarted(visit2) { 10699 if (!visit2.acceptsStreamResponse) { 10700 markAsBusy(document.documentElement); 10701 this.view.markVisitDirection(visit2.direction); 10702 } 10703 extendURLWithDeprecatedProperties(visit2.location); 10704 if (!visit2.silent) { 10705 this.notifyApplicationAfterVisitingLocation(visit2.location, visit2.action); 10706 } 10707 } 10708 visitCompleted(visit2) { 10709 this.view.unmarkVisitDirection(); 10710 clearBusyState(document.documentElement); 10711 this.notifyApplicationAfterPageLoad(visit2.getTimingMetrics()); 10712 } 10713 locationWithActionIsSamePage(location2, action) { 10714 return this.navigator.locationWithActionIsSamePage(location2, action); 10715 } 10716 visitScrolledToSamePageLocation(oldURL, newURL) { 10717 this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL); 10718 } 10719 // Form submit observer delegate 10720 willSubmitForm(form, submitter2) { 10721 const action = getAction$1(form, submitter2); 10722 return this.submissionIsNavigatable(form, submitter2) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation); 10723 } 10724 formSubmitted(form, submitter2) { 10725 this.navigator.submitForm(form, submitter2); 10726 } 10727 // Page observer delegate 10728 pageBecameInteractive() { 10729 this.view.lastRenderedLocation = this.location; 10730 this.notifyApplicationAfterPageLoad(); 10731 } 10732 pageLoaded() { 10733 this.history.assumeControlOfScrollRestoration(); 10734 } 10735 pageWillUnload() { 10736 this.history.relinquishControlOfScrollRestoration(); 10737 } 10738 // Stream observer delegate 10739 receivedMessageFromStream(message) { 10740 this.renderStreamMessage(message); 10741 } 10742 // Page view delegate 10743 viewWillCacheSnapshot() { 10744 var _a2; 10745 if (!((_a2 = this.navigator.currentVisit) == null ? void 0 : _a2.silent)) { 10746 this.notifyApplicationBeforeCachingSnapshot(); 10747 } 10748 } 10749 allowsImmediateRender({ element }, options) { 10750 const event = this.notifyApplicationBeforeRender(element, options); 10751 const { 10752 defaultPrevented, 10753 detail: { render: render6 } 10754 } = event; 10755 if (this.view.renderer && render6) { 10756 this.view.renderer.renderElement = render6; 10757 } 10758 return !defaultPrevented; 10759 } 10760 viewRenderedSnapshot(_snapshot, _isPreview, renderMethod) { 10761 this.view.lastRenderedLocation = this.history.location; 10762 this.notifyApplicationAfterRender(renderMethod); 10763 } 10764 preloadOnLoadLinksForView(element) { 10765 this.preloader.preloadOnLoadLinksForView(element); 10766 } 10767 viewInvalidated(reason) { 10768 this.adapter.pageInvalidated(reason); 10769 } 10770 // Frame element 10771 frameLoaded(frame) { 10772 this.notifyApplicationAfterFrameLoad(frame); 10773 } 10774 frameRendered(fetchResponse, frame) { 10775 this.notifyApplicationAfterFrameRender(fetchResponse, frame); 10776 } 10777 // Application events 10778 applicationAllowsFollowingLinkToLocation(link, location2, ev) { 10779 const event = this.notifyApplicationAfterClickingLinkToLocation(link, location2, ev); 10780 return !event.defaultPrevented; 10781 } 10782 applicationAllowsVisitingLocation(location2) { 10783 const event = this.notifyApplicationBeforeVisitingLocation(location2); 10784 return !event.defaultPrevented; 10785 } 10786 notifyApplicationAfterClickingLinkToLocation(link, location2, event) {
10787 return dispatch("turbo:click", { 10788 target: link, 10789 detail: { url: location2.href, originalEvent: event }, 10790 cancelable: true 10791 }); 10792 } 10793 notifyApplicationBeforeVisitingLocation(location2) { 10794 return dispatch("turbo:before-visit", { 10795 detail: { url: location2.href }, 10796 cancelable: true 10797 }); 10798 } 10799 notifyApplicationAfterVisitingLocation(location2, action) { 10800 return dispatch("turbo:visit", { detail: { url: location2.href, action } }); 10801 } 10802 notifyApplicationBeforeCachingSnapshot() { 10803 return dispatch("turbo:before-cache"); 10804 } 10805 notifyApplicationBeforeRender(newBody, options) { 10806 return dispatch("turbo:before-render", { 10807 detail: { newBody, ...options }, 10808 cancelable: true 10809 }); 10810 } 10811 notifyApplicationAfterRender(renderMethod) { 10812 return dispatch("turbo:render", { detail: { renderMethod } }); 10813 } 10814 notifyApplicationAfterPageLoad(timing = {}) { 10815 return dispatch("turbo:load", { 10816 detail: { url: this.location.href, timing } 10817 }); 10818 } 10819 notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL) { 10820 dispatchEvent( 10821 new HashChangeEvent("hashchange", { 10822 oldURL: oldURL.toString(), 10823 newURL: newURL.toString() 10824 }) 10825 ); 10826 } 10827 notifyApplicationAfterFrameLoad(frame) { 10828 return dispatch("turbo:frame-load", { target: frame }); 10829 } 10830 notifyApplicationAfterFrameRender(fetchResponse, frame) { 10831 return dispatch("turbo:frame-render", { 10832 detail: { fetchResponse }, 10833 target: frame, 10834 cancelable: true 10835 }); 10836 } 10837 // Helpers 10838 submissionIsNavigatable(form, submitter2) { 10839 if (config.forms.mode == "off") { 10840 return false; 10841 } else { 10842 const submitterIsNavigatable = submitter2 ? this.elementIsNavigatable(submitter2) : true; 10843 if (config.forms.mode == "optin") { 10844 return submitterIsNavigatable && form.closest('[data-turbo="true"]') != null; 10845 } else { 10846 return submitterIsNavigatable && this.elementIsNavigatable(form); 10847 } 10848 } 10849 } 10850 elementIsNavigatable(element) { 10851 const container = findClosestRecursively(element, "[data-turbo]"); 10852 const withinFrame = findClosestRecursively(element, "turbo-frame"); 10853 if (config.drive.enabled || withinFrame) { 10854 if (container) { 10855 return container.getAttribute("data-turbo") != "false"; 10856 } else { 10857 return true; 10858 } 10859 } else { 10860 if (container) { 10861 return container.getAttribute("data-turbo") == "true"; 10862 } else { 10863 return false; 10864 } 10865 } 10866 } 10867 // Private 10868 getActionForLink(link) { 10869 return getVisitAction(link) || "advance"; 10870 } 10871 get snapshot() { 10872 return this.view.snapshot; 10873 } 10874} 10875_pageRefreshDebouncePeriod = new WeakMap(); 10876function extendURLWithDeprecatedProperties(url) { 10877 Object.defineProperties(url, deprecatedLocationPropertyDescriptors); 10878} 10879const deprecatedLocationPropertyDescriptors = { 10880 absoluteURL: { 10881 get() { 10882 return this.toString(); 10883 } 10884 } 10885}; 10886const session = new Session(recentRequests); 10887const { cache, navigator: navigator$1 } = session; 10888function start() { 10889 session.start(); 10890} 10891function registerAdapter(adapter) { 10892 session.registerAdapter(adapter); 10893} 10894function visit(location2, options) { 10895 session.visit(location2, options); 10896} 10897function connectStreamSource(source) { 10898 session.connectStreamSource(source); 10899} 10900function disconnectStreamSource(source) { 10901 session.disconnectStreamSource(source); 10902}
10903function renderStreamMessage(message) { 10904 session.renderStreamMessage(message); 10905} 10906function clearCache() { 10907 console.warn( 10908 "Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`" 10909 ); 10910 session.clearCache(); 10911} 10912function setProgressBarDelay(delay) { 10913 console.warn( 10914 "Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`" 10915 ); 10916 config.drive.progressBarDelay = delay; 10917} 10918function setConfirmMethod(confirmMethod) { 10919 console.warn( 10920 "Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`" 10921 ); 10922 config.forms.confirm = confirmMethod; 10923} 10924function setFormMode(mode) { 10925 console.warn( 10926 "Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`" 10927 ); 10928 config.forms.mode = mode; 10929} 10930var Turbo$1 = /* @__PURE__ */ Object.freeze({ 10931 __proto__: null, 10932 navigator: navigator$1, 10933 session, 10934 cache, 10935 PageRenderer, 10936 PageSnapshot, 10937 FrameRenderer, 10938 fetch: fetchWithTurboHeaders, 10939 config, 10940 start, 10941 registerAdapter, 10942 visit, 10943 connectStreamSource, 10944 disconnectStreamSource, 10945 renderStreamMessage, 10946 clearCache, 10947 setProgressBarDelay, 10948 setConfirmMethod, 10949 setFormMode 10950}); 10951class TurboFrameMissingError extends Error { 10952} 10953class FrameController { 10954 constructor(element) { 10955 __privateAdd(this, _FrameController_instances); 10956 __publicField(this, "fetchResponseLoaded", (_fetchResponse) => Promise.resolve()); 10957 __privateAdd(this, _currentFetchRequest, null); 10958 __privateAdd(this, _resolveVisitPromise, () => { 10959 }); 10960 __privateAdd(this, _connected, false); 10961 __privateAdd(this, _hasBeenLoaded, false);
10962 __privateAdd(this, _ignoredAttributes, /* @__PURE__ */ new Set()); 10963 __privateAdd(this, _shouldMorphFrame, false); 10964 __publicField(this, "action", null); 10965 __publicField(this, "visitCachedSnapshot", ({ element }) => { 10966 const frame = element.querySelector("#" + this.element.id); 10967 if (frame && this.previousFrameElement) { 10968 frame.replaceChildren(...this.previousFrameElement.children); 10969 } 10970 delete this.previousFrameElement; 10971 }); 10972 this.element = element; 10973 this.view = new FrameView(this, this.element); 10974 this.appearanceObserver = new AppearanceObserver(this, this.element); 10975 this.formLinkClickObserver = new FormLinkClickObserver(this, this.element); 10976 this.linkInterceptor = new LinkInterceptor(this, this.element); 10977 this.restorationIdentifier = uuid(); 10978 this.formSubmitObserver = new FormSubmitObserver(this, this.element); 10979 } 10980 // Frame delegate 10981 connect() { 10982 if (!__privateGet(this, _connected)) { 10983 __privateSet(this, _connected, true); 10984 if (this.loadingStyle == FrameLoadingStyle.lazy) { 10985 this.appearanceObserver.start(); 10986 } else { 10987 __privateMethod(this, _FrameController_instances, loadSourceURL_fn).call(this); 10988 } 10989 this.formLinkClickObserver.start(); 10990 this.linkInterceptor.start(); 10991 this.formSubmitObserver.start(); 10992 } 10993 } 10994 disconnect() { 10995 if (__privateGet(this, _connected)) { 10996 __privateSet(this, _connected, false); 10997 this.appearanceObserver.stop(); 10998 this.formLinkClickObserver.stop(); 10999 this.linkInterceptor.stop(); 11000 this.formSubmitObserver.stop(); 11001 } 11002 } 11003 disabledChanged() { 11004 if (this.loadingStyle == FrameLoadingStyle.eager) { 11005 __privateMethod(this, _FrameController_instances, loadSourceURL_fn).call(this); 11006 } 11007 } 11008 sourceURLChanged() { 11009 if (__privateMethod(this, _FrameController_instances, isIgnoringChangesTo_fn).call(this, "src")) return; 11010 if (this.element.isConnected) { 11011 this.complete = false; 11012 } 11013 if (this.loadingStyle == FrameLoadingStyle.eager || __privateGet(this, _hasBeenLoaded)) { 11014 __privateMethod(this, _FrameController_instances, loadSourceURL_fn).call(this); 11015 } 11016 } 11017 sourceURLReloaded() { 11018 const { refresh, src } = this.element; 11019 __privateSet(this, _shouldMorphFrame, src && refresh === "morph"); 11020 this.element.removeAttribute("complete"); 11021 this.element.src = null; 11022 this.element.src = src; 11023 return this.element.loaded; 11024 } 11025 loadingStyleChanged() { 11026 if (this.loadingStyle == FrameLoadingStyle.lazy) { 11027 this.appearanceObserver.start(); 11028 } else { 11029 this.appearanceObserver.stop(); 11030 __privateMethod(this, _FrameController_instances, loadSourceURL_fn).call(this); 11031 } 11032 } 11033 async loadResponse(fetchResponse) { 11034 if (fetchResponse.redirected || fetchResponse.succeeded && fetchResponse.isHTML) { 11035 this.sourceURL = fetchResponse.response.url; 11036 } 11037 try { 11038 const html = await fetchResponse.responseHTML; 11039 if (html) { 11040 const document2 = parseHTMLDocument(html); 11041 const pageSnapshot = PageSnapshot.fromDocument(document2); 11042 if (pageSnapshot.isVisitable) { 11043 await __privateMethod(this, _FrameController_instances, loadFrameResponse_fn).call(this, fetchResponse, document2); 11044 } else { 11045 await __privateMethod(this, _FrameController_instances, handleUnvisitableFrameResponse_fn).call(this, fetchResponse); 11046 } 11047 } 11048 } finally { 11049 __privateSet(this, _shouldMorphFrame, false); 11050 this.fetchResponseLoaded = () => Promise.resolve(); 11051 } 11052 } 11053 // Appearance observer delegate 11054 elementAppearedInViewport(element) { 11055 this.proposeVisitIfNavigatedWithAction(element, getVisitAction(element)); 11056 __privateMethod(this, _FrameController_instances, loadSourceURL_fn).call(this); 11057 } 11058 // Form link click observer delegate 11059 willSubmitFormLinkToLocation(link) { 11060 return __privateMethod(this, _FrameController_instances, shouldInterceptNavigation_fn).call(this, link); 11061 } 11062 submittedFormLinkToLocation(link, _location, form) { 11063 const frame = __privateMethod(this, _FrameController_instances, findFrameElement_fn2).call(this, link); 11064 if (frame) form.setAttribute("data-turbo-frame", frame.id); 11065 } 11066 // Link interceptor delegate 11067 shouldInterceptLinkClick(element, _location, _event) { 11068 return __privateMethod(this, _FrameController_instances, shouldInterceptNavigation_fn).call(this, element); 11069 } 11070 linkClickIntercepted(element, location2) { 11071 __privateMethod(this, _FrameController_instances, navigateFrame_fn).call(this, element, location2); 11072 } 11073 // Form submit observer delegate 11074 willSubmitForm(element, submitter2) { 11075 return element.closest("turbo-frame") == this.element && __privateMethod(this, _FrameController_instances, shouldInterceptNavigation_fn).call(this, element, submitter2); 11076 } 11077 formSubmitted(element, submitter2) { 11078 if (this.formSubmission) { 11079 this.formSubmission.stop(); 11080 } 11081 this.formSubmission = new FormSubmission(this, element, submitter2); 11082 const { fetchRequest } = this.formSubmission; 11083 this.prepareRequest(fetchRequest); 11084 this.formSubmission.start(); 11085 } 11086 // Fetch request delegate 11087 prepareRequest(request) { 11088 var _a2; 11089 request.headers["Turbo-Frame"] = this.id; 11090 if ((_a2 = this.currentNavigationElement) == null ? void 0 : _a2.hasAttribute("data-turbo-stream")) { 11091 request.acceptResponseType(StreamMessage.contentType); 11092 } 11093 } 11094 requestStarted(_request) { 11095 markAsBusy(this.element); 11096 } 11097 requestPreventedHandlingResponse(_request, _response) { 11098 __privateGet(this, _resolveVisitPromise).call(this); 11099 } 11100 async requestSucceededWithResponse(request, response) { 11101 await this.loadResponse(response); 11102 __privateGet(this, _resolveVisitPromise).call(this); 11103 } 11104 async requestFailedWithResponse(request, response) { 11105 await this.loadResponse(response); 11106 __privateGet(this, _resolveVisitPromise).call(this); 11107 } 11108 requestErrored(request, error2) { 11109 console.error(error2); 11110 __privateGet(this, _resolveVisitPromise).call(this); 11111 } 11112 requestFinished(_request) { 11113 clearBusyState(this.element); 11114 } 11115 // Form submission delegate 11116 formSubmissionStarted({ formElement }) { 11117 markAsBusy(formElement, __privateMethod(this, _FrameController_instances, findFrameElement_fn2).call(this, formElement)); 11118 } 11119 formSubmissionSucceededWithResponse(formSubmission, response) { 11120 const frame = __privateMethod(this, _FrameController_instances, findFrameElement_fn2).call(this, formSubmission.formElement, formSubmission.submitter); 11121 frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(formSubmission.submitter, formSubmission.formElement, frame)); 11122 frame.delegate.loadResponse(response); 11123 if (!formSubmission.isSafe) { 11124 session.clearCache(); 11125 } 11126 } 11127 formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 11128 this.element.delegate.loadResponse(fetchResponse); 11129 session.clearCache(); 11130 } 11131 formSubmissionErrored(formSubmission, error2) { 11132 console.error(error2); 11133 } 11134 formSubmissionFinished({ formElement }) { 11135 clearBusyState(formElement, __privateMethod(this, _FrameController_instances, findFrameElement_fn2).call(this, formElement)); 11136 } 11137 // View delegate 11138 allowsImmediateRender({ element: newFrame }, options) { 11139 const event = dispatch("turbo:before-frame-render", { 11140 target: this.element, 11141 detail: { newFrame, ...options }, 11142 cancelable: true 11143 }); 11144 const { 11145 defaultPrevented, 11146 detail: { render: render6 } 11147 } = event; 11148 if (this.view.renderer && render6) { 11149 this.view.renderer.renderElement = render6; 11150 } 11151 return !defaultPrevented; 11152 } 11153 viewRenderedSnapshot(_snapshot, _isPreview, _renderMethod) { 11154 } 11155 preloadOnLoadLinksForView(element) { 11156 session.preloadOnLoadLinksForView(element); 11157 } 11158 viewInvalidated() { 11159 } 11160 // Frame renderer delegate 11161 willRenderFrame(currentElement, _newElement) { 11162 this.previousFrameElement = currentElement.cloneNode(true); 11163 } 11164 proposeVisitIfNavigatedWithAction(frame, action = null) { 11165 this.action = action; 11166 if (this.action) { 11167 const pageSnapshot = PageSnapshot.fromElement(frame).clone(); 11168 const { visitCachedSnapshot } = frame.delegate; 11169 frame.delegate.fetchResponseLoaded = async (fetchResponse) => {
11170 if (frame.src) { 11171 const { statusCode, redirected } = fetchResponse; 11172 const responseHTML = await fetchResponse.responseHTML; 11173 const response = { statusCode, redirected, responseHTML }; 11174 const options = { 11175 response, 11176 visitCachedSnapshot, 11177 willRender: false, 11178 updateHistory: false, 11179 restorationIdentifier: this.restorationIdentifier, 11180 snapshot: pageSnapshot 11181 }; 11182 if (this.action) options.action = this.action; 11183 session.visit(frame.src, options); 11184 } 11185 }; 11186 } 11187 } 11188 changeHistory() { 11189 if (this.action) { 11190 const method = getHistoryMethodForAction(this.action); 11191 session.history.update(method, expandURL(this.element.src || ""), this.restorationIdentifier); 11192 } 11193 } 11194 async extractForeignFrameElement(container) { 11195 let element; 11196 const id2 = CSS.escape(this.id); 11197 try { 11198 element = activateElement(container.querySelector(`turbo-frame#${id2}`), this.sourceURL); 11199 if (element) { 11200 return element; 11201 } 11202 element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id2}]`), this.sourceURL); 11203 if (element) { 11204 await element.loaded; 11205 return await this.extractForeignFrameElement(element); 11206 } 11207 } catch (error2) { 11208 console.error(error2); 11209 return new FrameElement(); 11210 } 11211 return null; 11212 } 11213 // Computed properties 11214 get id() { 11215 return this.element.id; 11216 } 11217 get enabled() { 11218 return !this.element.disabled; 11219 } 11220 get sourceURL() { 11221 if (this.element.src) { 11222 return this.element.src; 11223 } 11224 } 11225 set sourceURL(sourceURL) { 11226 __privateMethod(this, _FrameController_instances, ignoringChangesToAttribute_fn).call(this, "src", () => { 11227 this.element.src = sourceURL ?? null; 11228 }); 11229 } 11230 get loadingStyle() { 11231 return this.element.loading; 11232 } 11233 get isLoading() { 11234 return this.formSubmission !== void 0 || __privateGet(this, _resolveVisitPromise).call(this) !== void 0; 11235 } 11236 get complete() { 11237 return this.element.hasAttribute("complete"); 11238 } 11239 set complete(value) { 11240 if (value) { 11241 this.element.setAttribute("complete", ""); 11242 } else { 11243 this.element.removeAttribute("complete"); 11244 } 11245 } 11246 get isActive() { 11247 return this.element.isActive && __privateGet(this, _connected); 11248 } 11249 get rootLocation() { 11250 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 11251 const root = (meta == null ? void 0 : meta.content) ?? "/"; 11252 return expandURL(root); 11253 } 11254} 11255_currentFetchRequest = new WeakMap(); 11256_resolveVisitPromise = new WeakMap(); 11257_connected = new WeakMap(); 11258_hasBeenLoaded = new WeakMap(); 11259_ignoredAttributes = new WeakMap(); 11260_shouldMorphFrame = new WeakMap(); 11261_FrameController_instances = new WeakSet(); 11262loadSourceURL_fn = async function() { 11263 if (this.enabled && this.isActive && !this.complete && this.sourceURL) { 11264 this.element.loaded = __privateMethod(this, _FrameController_instances, visit_fn).call(this, expandURL(this.sourceURL)); 11265 this.appearanceObserver.stop(); 11266 await this.element.loaded; 11267 __privateSet(this, _hasBeenLoaded, true); 11268 } 11269}; 11270loadFrameResponse_fn = async function(fetchResponse, document2) { 11271 const newFrameElement = await this.extractForeignFrameElement(document2.body); 11272 const rendererClass = __privateGet(this, _shouldMorphFrame) ? MorphingFrameRenderer : FrameRenderer; 11273 if (newFrameElement) { 11274 const snapshot = new Snapshot(newFrameElement); 11275 const renderer9 = new rendererClass(this, this.view.snapshot, snapshot, false, false); 11276 if (this.view.renderPromise) await this.view.renderPromise; 11277 this.changeHistory(); 11278 await this.view.render(renderer9); 11279 this.complete = true; 11280 session.frameRendered(fetchResponse, this.element); 11281 session.frameLoaded(this.element); 11282 await this.fetchResponseLoaded(fetchResponse); 11283 } else if (__privateMethod(this, _FrameController_instances, willHandleFrameMissingFromResponse_fn).call(this, fetchResponse)) { 11284 __privateMethod(this, _FrameController_instances, handleFrameMissingFromResponse_fn).call(this, fetchResponse); 11285 } 11286}; 11287visit_fn = async function(url) { 11288 var _a2; 11289 const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element); 11290 (_a2 = __privateGet(this, _currentFetchRequest)) == null ? void 0 : _a2.cancel(); 11291 __privateSet(this, _currentFetchRequest, request); 11292 return new Promise((resolve) => { 11293 __privateSet(this, _resolveVisitPromise, () => { 11294 __privateSet(this, _resolveVisitPromise, () => { 11295 }); 11296 __privateSet(this, _currentFetchRequest, null); 11297 resolve(); 11298 }); 11299 request.perform(); 11300 }); 11301}; 11302navigateFrame_fn = function(element, url, submitter2) { 11303 const frame = __privateMethod(this, _FrameController_instances, findFrameElement_fn2).call(this, element, submitter2); 11304 frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter2, element, frame)); 11305 __privateMethod(this, _FrameController_instances, withCurrentNavigationElement_fn).call(this, element, () => { 11306 frame.src = url; 11307 }); 11308}; 11309handleUnvisitableFrameResponse_fn = async function(fetchResponse) { 11310 console.warn(
11311 `The response (${fetchResponse.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.` 11312 ); 11313 await __privateMethod(this, _FrameController_instances, visitResponse_fn).call(this, fetchResponse.response); 11314}; 11315willHandleFrameMissingFromResponse_fn = function(fetchResponse) { 11316 this.element.setAttribute("complete", ""); 11317 const response = fetchResponse.response; 11318 const visit2 = async (url, options) => { 11319 if (url instanceof Response) { 11320 __privateMethod(this, _FrameController_instances, visitResponse_fn).call(this, url); 11321 } else { 11322 session.visit(url, options); 11323 } 11324 }; 11325 const event = dispatch("turbo:frame-missing", { 11326 target: this.element, 11327 detail: { response, visit: visit2 }, 11328 cancelable: true 11329 }); 11330 return !event.defaultPrevented; 11331}; 11332handleFrameMissingFromResponse_fn = function(fetchResponse) { 11333 this.view.missing(); 11334 __privateMethod(this, _FrameController_instances, throwFrameMissingError_fn).call(this, fetchResponse); 11335}; 11336throwFrameMissingError_fn = function(fetchResponse) { 11337 const message = `The response (${fetchResponse.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`; 11338 throw new TurboFrameMissingError(message); 11339}; 11340visitResponse_fn = async function(response) { 11341 const wrapped = new FetchResponse(response); 11342 const responseHTML = await wrapped.responseHTML; 11343 const { location: location2, redirected, statusCode } = wrapped; 11344 return session.visit(location2, { response: { redirected, statusCode, responseHTML } }); 11345}; 11346findFrameElement_fn2 = function(element, submitter2) { 11347 const id2 = getAttribute("data-turbo-frame", submitter2, element) || this.element.getAttribute("target"); 11348 return getFrameElementById(id2) ?? this.element; 11349}; 11350formActionIsVisitable_fn = function(form, submitter2) { 11351 const action = getAction$1(form, submitter2); 11352 return locationIsVisitable(expandURL(action), this.rootLocation); 11353}; 11354shouldInterceptNavigation_fn = function(element, submitter2) { 11355 const id2 = getAttribute("data-turbo-frame", submitter2, element) || this.element.getAttribute("target"); 11356 if (element instanceof HTMLFormElement && !__privateMethod(this, _FrameController_instances, formActionIsVisitable_fn).call(this, element, submitter2)) { 11357 return false; 11358 } 11359 if (!this.enabled || id2 == "_top") { 11360 return false; 11361 } 11362 if (id2) { 11363 const frameElement = getFrameElementById(id2); 11364 if (frameElement) { 11365 return !frameElement.disabled; 11366 } 11367 } 11368 if (!session.elementIsNavigatable(element)) { 11369 return false; 11370 } 11371 if (submitter2 && !session.elementIsNavigatable(submitter2)) { 11372 return false; 11373 } 11374 return true; 11375}; 11376isIgnoringChangesTo_fn = function(attributeName) { 11377 return __privateGet(this, _ignoredAttributes).has(attributeName); 11378}; 11379ignoringChangesToAttribute_fn = function(attributeName, callback) { 11380 __privateGet(this, _ignoredAttributes).add(attributeName); 11381 callback(); 11382 __privateGet(this, _ignoredAttributes).delete(attributeName); 11383}; 11384withCurrentNavigationElement_fn = function(element, callback) { 11385 this.currentNavigationElement = element; 11386 callback(); 11387 delete this.currentNavigationElement; 11388}; 11389function getFrameElementById(id2) { 11390 if (id2 != null) { 11391 const element = document.getElementById(id2); 11392 if (element instanceof FrameElement) { 11393 return element; 11394 } 11395 } 11396} 11397function activateElement(element, currentURL) { 11398 if (element) { 11399 const src = element.getAttribute("src"); 11400 if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) { 11401 throw new Error(`Matching <turbo-frame id="${element.id}"> element has a source URL which references itself`); 11402 } 11403 if (element.ownerDocument !== document) { 11404 element = document.importNode(element, true); 11405 } 11406 if (element instanceof FrameElement) { 11407 element.connectedCallback(); 11408 element.disconnectedCallback(); 11409 return element; 11410 } 11411 } 11412} 11413const StreamActions = { 11414 after() { 11415 this.targetElements.forEach((e2) => { 11416 var _a2; 11417 return (_a2 = e2.parentElement) == null ? void 0 : _a2.insertBefore(this.templateContent, e2.nextSibling); 11418 }); 11419 }, 11420 append() { 11421 this.removeDuplicateTargetChildren();
11422 this.targetElements.forEach((e2) => e2.append(this.templateContent)); 11423 }, 11424 before() { 11425 this.targetElements.forEach((e2) => { 11426 var _a2; 11427 return (_a2 = e2.parentElement) == null ? void 0 : _a2.insertBefore(this.templateContent, e2); 11428 }); 11429 }, 11430 prepend() { 11431 this.removeDuplicateTargetChildren(); 11432 this.targetElements.forEach((e2) => e2.prepend(this.templateContent)); 11433 }, 11434 remove() { 11435 this.targetElements.forEach((e2) => e2.remove()); 11436 }, 11437 replace() { 11438 const method = this.getAttribute("method"); 11439 this.targetElements.forEach((targetElement) => { 11440 if (method === "morph") { 11441 morphElements(targetElement, this.templateContent); 11442 } else { 11443 targetElement.replaceWith(this.templateContent); 11444 } 11445 }); 11446 }, 11447 update() { 11448 const method = this.getAttribute("method"); 11449 this.targetElements.forEach((targetElement) => { 11450 if (method === "morph") { 11451 morphChildren(targetElement, this.templateContent); 11452 } else { 11453 targetElement.innerHTML = ""; 11454 targetElement.append(this.templateContent); 11455 } 11456 }); 11457 }, 11458 refresh() { 11459 session.refresh(this.baseURI, this.requestId); 11460 } 11461}; 11462const _StreamElement = class _StreamElement extends HTMLElement { 11463 constructor() { 11464 super(...arguments); 11465 __privateAdd(this, _StreamElement_instances); 11466 } 11467 static async renderElement(newElement) { 11468 await newElement.performAction(); 11469 } 11470 async connectedCallback() { 11471 try { 11472 await this.render(); 11473 } catch (error2) { 11474 console.error(error2); 11475 } finally { 11476 this.disconnect(); 11477 } 11478 } 11479 async render() { 11480 return this.renderPromise ?? (this.renderPromise = (async () => { 11481 const event = this.beforeRenderEvent; 11482 if (this.dispatchEvent(event)) { 11483 await nextRepaint(); 11484 await event.detail.render(this); 11485 } 11486 })()); 11487 } 11488 disconnect() { 11489 try { 11490 this.remove(); 11491 } catch { 11492 } 11493 } 11494 /** 11495 * Removes duplicate children (by ID) 11496 */ 11497 removeDuplicateTargetChildren() { 11498 this.duplicateChildren.forEach((c2) => c2.remove()); 11499 } 11500 /** 11501 * Gets the list of duplicate children (i.e. those with the same ID) 11502 */ 11503 get duplicateChildren() { 11504 var _a2; 11505 const existingChildren = this.targetElements.flatMap((e2) => [...e2.children]).filter((c2) => !!c2.id); 11506 const newChildrenIds = [...((_a2 = this.templateContent) == null ? void 0 : _a2.children) || []].filter((c2) => !!c2.id).map((c2) => c2.id); 11507 return existingChildren.filter((c2) => newChildrenIds.includes(c2.id)); 11508 } 11509 /** 11510 * Gets the action function to be performed. 11511 */ 11512 get performAction() { 11513 if (this.action) { 11514 const actionFunction = StreamActions[this.action]; 11515 if (actionFunction) { 11516 return actionFunction; 11517 } 11518 __privateMethod(this, _StreamElement_instances, raise_fn).call(this, "unknown action"); 11519 } 11520 __privateMethod(this, _StreamElement_instances, raise_fn).call(this, "action attribute is missing"); 11521 } 11522 /** 11523 * Gets the target elements which the template will be rendered to. 11524 */ 11525 get targetElements() { 11526 if (this.target) { 11527 return this.targetElementsById; 11528 } else if (this.targets) { 11529 return this.targetElementsByQuery; 11530 } else { 11531 __privateMethod(this, _StreamElement_instances, raise_fn).call(this, "target or targets attribute is missing"); 11532 } 11533 } 11534 /** 11535 * Gets the contents of the main `<template>`. 11536 */ 11537 get templateContent() { 11538 return this.templateElement.content.cloneNode(true); 11539 } 11540 /** 11541 * Gets the main `<template>` used for rendering 11542 */ 11543 get templateElement() { 11544 if (this.firstElementChild === null) { 11545 const template2 = this.ownerDocument.createElement("template"); 11546 this.appendChild(template2); 11547 return template2; 11548 } else if (this.firstElementChild instanceof HTMLTemplateElement) { 11549 return this.firstElementChild; 11550 } 11551 __privateMethod(this, _StreamElement_instances, raise_fn).call(this, "first child element must be a <template> element"); 11552 } 11553 /** 11554 * Gets the current action. 11555 */ 11556 get action() { 11557 return this.getAttribute("action"); 11558 } 11559 /** 11560 * Gets the current target (an element ID) to which the result will 11561 * be rendered. 11562 */ 11563 get target() { 11564 return this.getAttribute("target"); 11565 } 11566 /** 11567 * Gets the current "targets" selector (a CSS selector) 11568 */ 11569 get targets() { 11570 return this.getAttribute("targets"); 11571 } 11572 /** 11573 * Reads the request-id attribute 11574 */ 11575 get requestId() { 11576 return this.getAttribute("request-id"); 11577 } 11578 get description() { 11579 return (this.outerHTML.match(/<[^>]+>/) ?? [])[0] ?? "<turbo-stream>"; 11580 } 11581 get beforeRenderEvent() { 11582 return new CustomEvent("turbo:before-stream-render", { 11583 bubbles: true, 11584 cancelable: true, 11585 detail: { newStream: this, render: _StreamElement.renderElement } 11586 }); 11587 } 11588 get targetElementsById() { 11589 var _a2; 11590 const element = (_a2 = this.ownerDocument) == null ? void 0 : _a2.getElementById(this.target); 11591 if (element !== null) { 11592 return [element]; 11593 } else { 11594 return []; 11595 } 11596 } 11597 get targetElementsByQuery() { 11598 var _a2; 11599 const elements = (_a2 = this.ownerDocument) == null ? void 0 : _a2.querySelectorAll(this.targets); 11600 if (elements.length !== 0) { 11601 return Array.prototype.slice.call(elements); 11602 } else { 11603 return []; 11604 } 11605 } 11606}; 11607_StreamElement_instances = new WeakSet(); 11608raise_fn = function(message) { 11609 throw new Error(`${this.description}: ${message}`); 11610}; 11611let StreamElement = _StreamElement; 11612class StreamSourceElement extends HTMLElement { 11613 constructor() { 11614 super(...arguments); 11615 __publicField(this, "streamSource", null); 11616 } 11617 connectedCallback() { 11618 this.streamSource = this.src.match(/^ws{1,2}:/) ? new WebSocket(this.src) : new EventSource(this.src); 11619 connectStreamSource(this.streamSource); 11620 } 11621 disconnectedCallback() { 11622 if (this.streamSource) { 11623 this.streamSource.close(); 11624 disconnectStreamSource(this.streamSource); 11625 } 11626 } 11627 get src() { 11628 return this.getAttribute("src") || ""; 11629 } 11630} 11631FrameElement.delegateConstructor = FrameController; 11632if (customElements.get("turbo-frame") === void 0) { 11633 customElements.define("turbo-frame", FrameElement); 11634}
vendor: 5,247 bytes, lines 11635-11752
11635if (customElements.get("turbo-stream") === void 0) { 11636 customElements.define("turbo-stream", StreamElement); 11637} 11638if (customElements.get("turbo-stream-source") === void 0) { 11639 customElements.define("turbo-stream-source", StreamSourceElement); 11640} 11641(() => { 11642 let element = document.currentScript; 11643 if (!element) return; 11644 if (element.hasAttribute("data-turbo-suppress-warning")) return; 11645 element = element.parentElement; 11646 while (element) { 11647 if (element == document.body) { 11648 return console.warn( 11649 unindent` 11650 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 11651 11652 Load your applicationâs JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 11653 11654 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 11655 11656 ââ 11657 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 11658 `, 11659 element.outerHTML 11660 ); 11661 } 11662 element = element.parentElement; 11663 } 11664})(); 11665window.Turbo = { ...Turbo$1, StreamActions }; 11666start(); 11667function _assertThisInitialized$6(self2) { 11668 if (self2 === void 0) { 11669 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 11670 } 11671 return self2; 11672} 11673function _inheritsLoose(subClass, superClass) { 11674 subClass.prototype = Object.create(superClass.prototype); 11675 subClass.prototype.constructor = subClass; 11676 subClass.__proto__ = superClass; 11677} 11678/*! 11679 * GSAP 3.12.5 11680 * https://gsap.com 11681 * 11682 * @license Copyright 2008-2024, GreenSock. All rights reserved. 11683 * Subject to the terms at https://gsap.com/standard-license or for 11684 * Club GSAP members, the agreement issued with that membership. 11685 * @author: Jack Doyle, [email protected] 11686*/ 11687var _config$1 = { 11688 autoSleep: 120, 11689 force3D: "auto", 11690 nullTargetWarn: 1, 11691 units: { 11692 lineHeight: "" 11693 } 11694}, _defaults$1 = { 11695 duration: 0.5, 11696 overwrite: false, 11697 delay: 0 11698}, _suppressOverwrites$1, _reverting$1, _context$4, _bigNum$2 = 1e8, _tinyNum = 1 / _bigNum$2, _2PI$1 = Math.PI * 2, _HALF_PI = _2PI$1 / 4, _gsID = 0, _sqrt$2 = Math.sqrt, _cos$2 = Math.cos, _sin$2 = Math.sin, _isString$3 = function _isString(value) { 11699 return typeof value === "string"; 11700}, _isFunction$3 = function _isFunction(value) { 11701 return typeof value === "function"; 11702}, _isNumber$2 = function _isNumber(value) { 11703 return typeof value === "number"; 11704}, _isUndefined = function _isUndefined2(value) { 11705 return typeof value === "undefined"; 11706}, _isObject$1 = function _isObject(value) { 11707 return typeof value === "object"; 11708}, _isNotFalse = function _isNotFalse2(value) { 11709 return value !== false; 11710}, _windowExists$4 = function _windowExists() { 11711 return typeof window !== "undefined"; 11712}, _isFuncOrString = function _isFuncOrString2(value) { 11713 return _isFunction$3(value) || _isString$3(value); 11714}, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() { 11715}, _isArray = Array.isArray, _strictNumExp = /(?:-?\.?\d|\.)+/gi, _numExp$1 = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, _relExp = /[+-]=-?[.\d]+/, _delimitedValueExp = /[^,'"\[\]\s]+/gi, _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, _globalTimeline, _win$6, _coreInitted$6, _doc$6, _globals = {}, _installScope = {}, _coreReady, _install = function _install2(scope) { 11716 return (_installScope = _merge$1(scope, _globals)) && gsap$8; 11717}, _missingPlugin = function _missingPlugin2(property, value) { 11718 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 11719}, _warn = function _warn2(message, suppress) { 11720 return !suppress && console.warn(message); 11721}, _addGlobal = function _addGlobal2(name, obj) { 11722 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 11723}, _emptyFunc = function _emptyFunc2() { 11724 return 0; 11725}, _startAtRevertConfig = { 11726 suppressEvents: true, 11727 isStart: true, 11728 kill: false 11729}, _revertConfigNoKill = { 11730 suppressEvents: true, 11731 kill: false 11732}, _revertConfig = { 11733 suppressEvents: true 11734}, _reservedProps = {}, _lazyTweens = [], _lazyLookup = {}, _lastRenderedFrame, _plugins = {}, _effects = {}, _nextGCFrame = 30, _harnessPlugins = [], _callbackNames = "", _harness = function _harness2(targets) { 11735 var target = targets[0], harnessPlugin, i2; 11736 _isObject$1(target) || _isFunction$3(target) || (targets = [targets]); 11737 if (!(harnessPlugin = (target._gsap || {}).harness)) { 11738 i2 = _harnessPlugins.length; 11739 while (i2-- && !_harnessPlugins[i2].targetTest(target)) { 11740 } 11741 harnessPlugin = _harnessPlugins[i2]; 11742 } 11743 i2 = targets.length; 11744 while (i2--) { 11745 targets[i2] && (targets[i2]._gsap || (targets[i2]._gsap = new GSCache(targets[i2], harnessPlugin))) || targets.splice(i2, 1); 11746 } 11747 return targets; 11748}, _getCache = function _getCache2(target) { 11749 return target._gsap || _harness(toArray$1(target))[0]._gsap; 11750}, _getProperty = function _getProperty2(target, property, v2) { 11751 return (v2 = target[property]) && _isFunction$3(v2) ? target[property]() : _isUndefined(v2) && target.getAttribute && target.getAttribute(property) || v2; 11752}
vendor: 19,040 bytes, lines 11752-12148
11752, _forEachName = function _forEachName2(names, func) { 11753 return (names = names.split(",")).forEach(func) || names; 11754}, _round$4 = function _round(value) { 11755 return Math.round(value * 1e5) / 1e5 || 0; 11756}, _roundPrecise = function _roundPrecise2(value) { 11757 return Math.round(value * 1e7) / 1e7 || 0; 11758}, _parseRelative = function _parseRelative2(start2, value) { 11759 var operator = value.charAt(0), end = parseFloat(value.substr(2)); 11760 start2 = parseFloat(start2); 11761 return operator === "+" ? start2 + end : operator === "-" ? start2 - end : operator === "*" ? start2 * end : start2 / end; 11762}, _arrayContainsAny = function _arrayContainsAny2(toSearch, toFind) { 11763 var l2 = toFind.length, i2 = 0; 11764 for (; toSearch.indexOf(toFind[i2]) < 0 && ++i2 < l2; ) { 11765 } 11766 return i2 < l2; 11767}, _lazyRender = function _lazyRender2() { 11768 var l2 = _lazyTweens.length, a2 = _lazyTweens.slice(0), i2, tween; 11769 _lazyLookup = {}; 11770 _lazyTweens.length = 0; 11771 for (i2 = 0; i2 < l2; i2++) { 11772 tween = a2[i2]; 11773 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 11774 } 11775}, _lazySafeRender = function _lazySafeRender2(animation, time, suppressEvents, force) { 11776 _lazyTweens.length && !_reverting$1 && _lazyRender(); 11777 animation.render(time, suppressEvents, _reverting$1 && time < 0 && (animation._initted || animation._startAt)); 11778 _lazyTweens.length && !_reverting$1 && _lazyRender(); 11779}, _numericIfPossible = function _numericIfPossible2(value) { 11780 var n2 = parseFloat(value); 11781 return (n2 || n2 === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n2 : _isString$3(value) ? value.trim() : value; 11782}, _passThrough$1 = function _passThrough(p2) { 11783 return p2; 11784}, _setDefaults$1 = function _setDefaults(obj, defaults3) { 11785 for (var p2 in defaults3) { 11786 p2 in obj || (obj[p2] = defaults3[p2]); 11787 } 11788 return obj; 11789}, _setKeyframeDefaults = function _setKeyframeDefaults2(excludeDuration) { 11790 return function(obj, defaults3) { 11791 for (var p2 in defaults3) { 11792 p2 in obj || p2 === "duration" && excludeDuration || p2 === "ease" || (obj[p2] = defaults3[p2]); 11793 } 11794 }; 11795}, _merge$1 = function _merge(base, toMerge) { 11796 for (var p2 in toMerge) { 11797 base[p2] = toMerge[p2]; 11798 } 11799 return base; 11800}, _mergeDeep = function _mergeDeep2(base, toMerge) { 11801 for (var p2 in toMerge) { 11802 p2 !== "__proto__" && p2 !== "constructor" && p2 !== "prototype" && (base[p2] = _isObject$1(toMerge[p2]) ? _mergeDeep2(base[p2] || (base[p2] = {}), toMerge[p2]) : toMerge[p2]); 11803 } 11804 return base; 11805}, _copyExcluding = function _copyExcluding2(obj, excluding) { 11806 var copy = {}, p2; 11807 for (p2 in obj) { 11808 p2 in excluding || (copy[p2] = obj[p2]); 11809 } 11810 return copy; 11811}, _inheritDefaults = function _inheritDefaults2(vars) { 11812 var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults$1; 11813 if (_isNotFalse(vars.inherit)) { 11814 while (parent) { 11815 func(vars, parent.vars.defaults); 11816 parent = parent.parent || parent._dp; 11817 } 11818 } 11819 return vars; 11820}, _arraysMatch = function _arraysMatch2(a1, a2) { 11821 var i2 = a1.length, match = i2 === a2.length; 11822 while (match && i2-- && a1[i2] === a2[i2]) { 11823 } 11824 return i2 < 0; 11825}, _addLinkedListItem = function _addLinkedListItem2(parent, child, firstProp, lastProp, sortBy3) { 11826 var prev = parent[lastProp], t2; 11827 if (sortBy3) { 11828 t2 = child[sortBy3]; 11829 while (prev && prev[sortBy3] > t2) { 11830 prev = prev._prev; 11831 } 11832 } 11833 if (prev) { 11834 child._next = prev._next; 11835 prev._next = child; 11836 } else { 11837 child._next = parent[firstProp]; 11838 parent[firstProp] = child; 11839 } 11840 if (child._next) { 11841 child._next._prev = child; 11842 } else { 11843 parent[lastProp] = child; 11844 } 11845 child._prev = prev; 11846 child.parent = child._dp = parent; 11847 return child; 11848}, _removeLinkedListItem = function _removeLinkedListItem2(parent, child, firstProp, lastProp) { 11849 if (firstProp === void 0) { 11850 firstProp = "_first"; 11851 } 11852 if (lastProp === void 0) { 11853 lastProp = "_last"; 11854 } 11855 var prev = child._prev, next2 = child._next; 11856 if (prev) { 11857 prev._next = next2; 11858 } else if (parent[firstProp] === child) { 11859 parent[firstProp] = next2; 11860 } 11861 if (next2) { 11862 next2._prev = prev; 11863 } else if (parent[lastProp] === child) { 11864 parent[lastProp] = prev; 11865 } 11866 child._next = child._prev = child.parent = null; 11867}, _removeFromParent = function _removeFromParent2(child, onlyIfParentHasAutoRemove) { 11868 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child); 11869 child._act = 0; 11870}, _uncache = function _uncache2(animation, child) { 11871 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 11872 var a2 = animation; 11873 while (a2) { 11874 a2._dirty = 1; 11875 a2 = a2.parent; 11876 } 11877 } 11878 return animation; 11879}, _recacheAncestors = function _recacheAncestors2(animation) { 11880 var parent = animation.parent; 11881 while (parent && parent.parent) { 11882 parent._dirty = 1; 11883 parent.totalDuration(); 11884 parent = parent.parent; 11885 } 11886 return animation; 11887}, _rewindStartAt = function _rewindStartAt2(tween, totalTime, suppressEvents, force) { 11888 return tween._startAt && (_reverting$1 ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 11889}, _hasNoPausedAncestors = function _hasNoPausedAncestors2(animation) { 11890 return !animation || animation._ts && _hasNoPausedAncestors2(animation.parent); 11891}, _elapsedCycleDuration = function _elapsedCycleDuration2(animation) { 11892 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 11893}, _animationCycle = function _animationCycle2(tTime, cycleDuration) { 11894 var whole = Math.floor(tTime /= cycleDuration); 11895 return tTime && whole === tTime ? whole - 1 : whole; 11896}, _parentToChildTotalTime = function _parentToChildTotalTime2(parentTime, child) { 11897 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 11898}, _setEnd = function _setEnd2(animation) { 11899 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 11900}, _alignPlayhead = function _alignPlayhead2(animation, totalTime) { 11901 var parent = animation._dp; 11902 if (parent && parent.smoothChildTiming && animation._ts) { 11903 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 11904 _setEnd(animation); 11905 parent._dirty || _uncache(parent, animation); 11906 } 11907 return animation; 11908}, _postAddChecks = function _postAddChecks2(timeline2, child) { 11909 var t2; 11910 if (child._time || !child._dur && child._initted || child._start < timeline2._time && (child._dur || !child.add)) { 11911 t2 = _parentToChildTotalTime(timeline2.rawTime(), child); 11912 if (!child._dur || _clamp$2(0, child.totalDuration(), t2) - child._tTime > _tinyNum) { 11913 child.render(t2, true); 11914 } 11915 } 11916 if (_uncache(timeline2, child)._dp && timeline2._initted && timeline2._time >= timeline2._dur && timeline2._ts) { 11917 if (timeline2._dur < timeline2.duration()) { 11918 t2 = timeline2; 11919 while (t2._dp) { 11920 t2.rawTime() >= 0 && t2.totalTime(t2._tTime); 11921 t2 = t2._dp; 11922 } 11923 } 11924 timeline2._zTime = -_tinyNum; 11925 } 11926}, _addToTimeline = function _addToTimeline2(timeline2, child, position, skipChecks) { 11927 child.parent && _removeFromParent(child); 11928 child._start = _roundPrecise((_isNumber$2(position) ? position : position || timeline2 !== _globalTimeline ? _parsePosition$1(timeline2, position, child) : timeline2._time) + child._delay); 11929 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 11930 _addLinkedListItem(timeline2, child, "_first", "_last", timeline2._sort ? "_start" : 0); 11931 _isFromOrFromStart(child) || (timeline2._recent = child); 11932 skipChecks || _postAddChecks(timeline2, child); 11933 timeline2._ts < 0 && _alignPlayhead(timeline2, timeline2._tTime); 11934 return timeline2; 11935}, _scrollTrigger = function _scrollTrigger2(animation, trigger) { 11936 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 11937}, _attemptInitTween = function _attemptInitTween2(tween, time, force, suppressEvents, tTime) { 11938 _initTween(tween, time, tTime); 11939 if (!tween._initted) { 11940 return 1; 11941 } 11942 if (!force && tween._pt && !_reverting$1 && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 11943 _lazyTweens.push(tween); 11944 tween._lazy = [tTime, suppressEvents]; 11945 return 1; 11946 } 11947}, _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart2(_ref) { 11948 var parent = _ref.parent; 11949 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart2(parent)); 11950}, _isFromOrFromStart = function _isFromOrFromStart2(_ref22) { 11951 var data = _ref22.data; 11952 return data === "isFromStart" || data === "isStart"; 11953}, _renderZeroDurationTween = function _renderZeroDurationTween2(tween, totalTime, suppressEvents, force) { 11954 var prevRatio = tween.ratio, ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, repeatDelay = tween._rDelay, tTime = 0, pt, iteration, prevIteration; 11955 if (repeatDelay && tween._repeat) { 11956 tTime = _clamp$2(0, tween._tDur, totalTime); 11957 iteration = _animationCycle(tTime, repeatDelay); 11958 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 11959 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 11960 prevRatio = 1 - ratio; 11961 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 11962 } 11963 } 11964 if (ratio !== prevRatio || _reverting$1 || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 11965 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) { 11966 return; 11967 } 11968 prevIteration = tween._zTime; 11969 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); 11970 suppressEvents || (suppressEvents = totalTime && !prevIteration); 11971 tween.ratio = ratio; 11972 tween._from && (ratio = 1 - ratio); 11973 tween._time = 0; 11974 tween._tTime = tTime; 11975 pt = tween._pt; 11976 while (pt) { 11977 pt.r(ratio, pt.d); 11978 pt = pt._next; 11979 } 11980 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 11981 tween._onUpdate && !suppressEvents && _callback$1(tween, "onUpdate"); 11982 tTime && tween._repeat && !suppressEvents && tween.parent && _callback$1(tween, "onRepeat"); 11983 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 11984 ratio && _removeFromParent(tween, 1); 11985 if (!suppressEvents && !_reverting$1) { 11986 _callback$1(tween, ratio ? "onComplete" : "onReverseComplete", true); 11987 tween._prom && tween._prom(); 11988 } 11989 } 11990 } else if (!tween._zTime) { 11991 tween._zTime = totalTime; 11992 } 11993}, _findNextPauseTween = function _findNextPauseTween2(animation, prevTime, time) { 11994 var child; 11995 if (time > prevTime) { 11996 child = animation._first; 11997 while (child && child._start <= time) { 11998 if (child.data === "isPause" && child._start > prevTime) { 11999 return child; 12000 } 12001 child = child._next; 12002 } 12003 } else { 12004 child = animation._last; 12005 while (child && child._start >= time) { 12006 if (child.data === "isPause" && child._start < prevTime) { 12007 return child; 12008 } 12009 child = child._prev; 12010 } 12011 } 12012}, _setDuration = function _setDuration2(animation, duration, skipUncache, leavePlayhead) { 12013 var repeat2 = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur; 12014 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 12015 animation._dur = dur; 12016 animation._tDur = !repeat2 ? dur : repeat2 < 0 ? 1e10 : _roundPrecise(dur * (repeat2 + 1) + animation._rDelay * repeat2); 12017 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 12018 animation.parent && _setEnd(animation); 12019 skipUncache || _uncache(animation.parent, animation); 12020 return animation; 12021}, _onUpdateTotalDuration = function _onUpdateTotalDuration2(animation) { 12022 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 12023}, _zeroPosition = { 12024 _start: 0, 12025 endTime: _emptyFunc, 12026 totalDuration: _emptyFunc 12027}, _parsePosition$1 = function _parsePosition(animation, position, percentAnimation) { 12028 var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum$2 ? recent.endTime(false) : animation._dur, i2, offset, isPercent; 12029 if (_isString$3(position) && (isNaN(position) || position in labels)) { 12030 offset = position.charAt(0); 12031 isPercent = position.substr(-1) === "%"; 12032 i2 = position.indexOf("="); 12033 if (offset === "<" || offset === ">") { 12034 i2 >= 0 && (position = position.replace(/=/, "")); 12035 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i2 < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 12036 } 12037 if (i2 < 0) { 12038 position in labels || (labels[position] = clippedDuration); 12039 return labels[position]; 12040 } 12041 offset = parseFloat(position.charAt(i2 - 1) + position.substr(i2 + 1)); 12042 if (isPercent && percentAnimation) { 12043 offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 12044 } 12045 return i2 > 1 ? _parsePosition(animation, position.substr(0, i2 - 1), percentAnimation) + offset : clippedDuration + offset; 12046 } 12047 return position == null ? clippedDuration : +position; 12048}, _createTweenType = function _createTweenType2(type, params, timeline2) { 12049 var isLegacy = _isNumber$2(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent; 12050 isLegacy && (vars.duration = params[1]); 12051 vars.parent = timeline2; 12052 if (type) { 12053 irVars = vars; 12054 parent = timeline2; 12055 while (parent && !("immediateRender" in irVars)) { 12056 irVars = parent.vars.defaults || {}; 12057 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 12058 } 12059 vars.immediateRender = _isNotFalse(irVars.immediateRender); 12060 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; 12061 } 12062 return new Tween(params[0], vars, params[varsIndex + 1]); 12063}, _conditionalReturn = function _conditionalReturn2(value, func) { 12064 return value || value === 0 ? func(value) : func; 12065}, _clamp$2 = function _clamp(min, max, value) { 12066 return value < min ? min : value > max ? max : value; 12067}, getUnit = function getUnit2(value, v2) { 12068 return !_isString$3(value) || !(v2 = _unitExp.exec(value)) ? "" : v2[1]; 12069}, clamp = function clamp2(min, max, value) { 12070 return _conditionalReturn(value, function(v2) { 12071 return _clamp$2(min, max, v2); 12072 }); 12073}, _slice = [].slice, _isArrayLike = function _isArrayLike2(value, nonEmpty) { 12074 return value && _isObject$1(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject$1(value[0])) && !value.nodeType && value !== _win$6; 12075}, _flatten = function _flatten2(ar, leaveStrings, accumulator) { 12076 if (accumulator === void 0) { 12077 accumulator = []; 12078 } 12079 return ar.forEach(function(value) { 12080 var _accumulator; 12081 return _isString$3(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray$1(value)) : accumulator.push(value); 12082 }) || accumulator; 12083}, toArray$1 = function toArray(value, scope, leaveStrings) { 12084 return _context$4 && !scope && _context$4.selector ? _context$4.selector(value) : _isString$3(value) && !leaveStrings && (_coreInitted$6 || !_wake()) ? _slice.call((scope || _doc$6).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : []; 12085}, selector = function selector2(value) { 12086 value = toArray$1(value)[0] || _warn("Invalid scope") || {}; 12087 return function(v2) { 12088 var el = value.current || value.nativeElement || value; 12089 return toArray$1(v2, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc$6.createElement("div") : value); 12090 }; 12091}, shuffle = function shuffle2(a2) { 12092 return a2.sort(function() { 12093 return 0.5 - Math.random(); 12094 }); 12095}, distribute = function distribute2(v2) { 12096 if (_isFunction$3(v2)) { 12097 return v2; 12098 } 12099 var vars = _isObject$1(v2) ? v2 : { 12100 each: v2 12101 }, ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache2 = {}, isDecimal = from > 0 && from < 1, ratios = isNaN(from) || isDecimal, axis = vars.axis, ratioX = from, ratioY = from; 12102 if (_isString$3(from)) { 12103 ratioX = ratioY = { 12104 center: 0.5, 12105 edges: 0.5, 12106 end: 1 12107 }[from] || 0; 12108 } else if (!isDecimal && ratios) { 12109 ratioX = from[0]; 12110 ratioY = from[1]; 12111 } 12112 return function(i2, target, a2) { 12113 var l2 = (a2 || vars).length, distances = cache2[l2], originX, originY, x2, y2, d2, j2, max, min, wrapAt; 12114 if (!distances) { 12115 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum$2])[1]; 12116 if (!wrapAt) { 12117 max = -_bigNum$2; 12118 while (max < (max = a2[wrapAt++].getBoundingClientRect().left) && wrapAt < l2) { 12119 } 12120 wrapAt < l2 && wrapAt--; 12121 } 12122 distances = cache2[l2] = []; 12123 originX = ratios ? Math.min(wrapAt, l2) * ratioX - 0.5 : from % wrapAt; 12124 originY = wrapAt === _bigNum$2 ? 0 : ratios ? l2 * ratioY / wrapAt - 0.5 : from / wrapAt | 0; 12125 max = 0; 12126 min = _bigNum$2; 12127 for (j2 = 0; j2 < l2; j2++) { 12128 x2 = j2 % wrapAt - originX; 12129 y2 = originY - (j2 / wrapAt | 0); 12130 distances[j2] = d2 = !axis ? _sqrt$2(x2 * x2 + y2 * y2) : Math.abs(axis === "y" ? y2 : x2); 12131 d2 > max && (max = d2); 12132 d2 < min && (min = d2); 12133 } 12134 from === "random" && shuffle(distances); 12135 distances.max = max - min; 12136 distances.min = min; 12137 distances.v = l2 = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l2 ? l2 - 1 : !axis ? Math.max(wrapAt, l2 / wrapAt) : axis === "y" ? l2 / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 12138 distances.b = l2 < 0 ? base - l2 : base; 12139 distances.u = getUnit(vars.amount || vars.each) || 0; 12140 ease = ease && l2 < 0 ? _invertEase(ease) : ease; 12141 } 12142 l2 = (distances[i2] - distances.min) / distances.max || 0; 12143 return _roundPrecise(distances.b + (ease ? ease(l2) : l2) * distances.v) + distances.u; 12144 }; 12145}, _roundModifier = function _roundModifier2(v2) { 12146 var p2 = Math.pow(10, ((v2 + "").split(".")[1] || "").length); 12147 return function(raw) { 12148 var n2 = _roundPrecise(Math.round(parseFloat(raw) / v2) * v2 * p2);
vendor: 6,093 bytes, lines 12149-12297
12149 return (n2 - n2 % 1) / p2 + (_isNumber$2(raw) ? 0 : getUnit(raw)); 12150 }; 12151}, snap = function snap2(snapTo, value) { 12152 var isArray2 = _isArray(snapTo), radius, is2D; 12153 if (!isArray2 && _isObject$1(snapTo)) { 12154 radius = isArray2 = snapTo.radius || _bigNum$2; 12155 if (snapTo.values) { 12156 snapTo = toArray$1(snapTo.values); 12157 if (is2D = !_isNumber$2(snapTo[0])) { 12158 radius *= radius; 12159 } 12160 } else { 12161 snapTo = _roundModifier(snapTo.increment); 12162 } 12163 } 12164 return _conditionalReturn(value, !isArray2 ? _roundModifier(snapTo) : _isFunction$3(snapTo) ? function(raw) { 12165 is2D = snapTo(raw); 12166 return Math.abs(is2D - raw) <= radius ? is2D : raw; 12167 } : function(raw) { 12168 var x2 = parseFloat(is2D ? raw.x : raw), y2 = parseFloat(is2D ? raw.y : 0), min = _bigNum$2, closest = 0, i2 = snapTo.length, dx, dy; 12169 while (i2--) { 12170 if (is2D) { 12171 dx = snapTo[i2].x - x2; 12172 dy = snapTo[i2].y - y2; 12173 dx = dx * dx + dy * dy; 12174 } else { 12175 dx = Math.abs(snapTo[i2] - x2); 12176 } 12177 if (dx < min) { 12178 min = dx; 12179 closest = i2; 12180 } 12181 } 12182 closest = !radius || min <= radius ? snapTo[closest] : raw; 12183 return is2D || closest === raw || _isNumber$2(raw) ? closest : closest + getUnit(raw); 12184 }); 12185}, random = function random2(min, max, roundingIncrement, returnFunction) { 12186 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function() { 12187 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * 0.99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; 12188 }); 12189}, pipe = function pipe2() { 12190 for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { 12191 functions[_key] = arguments[_key]; 12192 } 12193 return function(value) { 12194 return functions.reduce(function(v2, f2) { 12195 return f2(v2); 12196 }, value); 12197 }; 12198}, unitize = function unitize2(func, unit) { 12199 return function(value) { 12200 return func(parseFloat(value)) + (unit || getUnit(value)); 12201 }; 12202}, normalize = function normalize2(min, max, value) { 12203 return mapRange(min, max, 0, 1, value); 12204}, _wrapArray = function _wrapArray2(a2, wrapper, value) { 12205 return _conditionalReturn(value, function(index3) { 12206 return a2[~~wrapper(index3)]; 12207 }); 12208}, wrap = function wrap2(min, max, value) { 12209 var range2 = max - min; 12210 return _isArray(min) ? _wrapArray(min, wrap2(0, min.length), max) : _conditionalReturn(value, function(value2) { 12211 return (range2 + (value2 - min) % range2) % range2 + min; 12212 }); 12213}, wrapYoyo = function wrapYoyo2(min, max, value) { 12214 var range2 = max - min, total = range2 * 2; 12215 return _isArray(min) ? _wrapArray(min, wrapYoyo2(0, min.length - 1), max) : _conditionalReturn(value, function(value2) { 12216 value2 = (total + (value2 - min) % total) % total || 0; 12217 return min + (value2 > range2 ? total - value2 : value2); 12218 }); 12219}, _replaceRandom = function _replaceRandom2(value) { 12220 var prev = 0, s2 = "", i2, nums, end, isArray2; 12221 while (~(i2 = value.indexOf("random(", prev))) { 12222 end = value.indexOf(")", i2); 12223 isArray2 = value.charAt(i2 + 7) === "["; 12224 nums = value.substr(i2 + 7, end - i2 - 7).match(isArray2 ? _delimitedValueExp : _strictNumExp); 12225 s2 += value.substr(prev, i2 - prev) + random(isArray2 ? nums : +nums[0], isArray2 ? 0 : +nums[1], +nums[2] || 1e-5); 12226 prev = end + 1; 12227 } 12228 return s2 + value.substr(prev, value.length - prev); 12229}, mapRange = function mapRange2(inMin, inMax, outMin, outMax, value) { 12230 var inRange = inMax - inMin, outRange = outMax - outMin; 12231 return _conditionalReturn(value, function(value2) { 12232 return outMin + ((value2 - inMin) / inRange * outRange || 0); 12233 }); 12234}, interpolate = function interpolate2(start2, end, progress, mutate) { 12235 var func = isNaN(start2 + end) ? 0 : function(p3) { 12236 return (1 - p3) * start2 + p3 * end; 12237 }; 12238 if (!func) { 12239 var isString = _isString$3(start2), master = {}, p2, i2, interpolators, l2, il; 12240 progress === true && (mutate = 1) && (progress = null); 12241 if (isString) { 12242 start2 = { 12243 p: start2 12244 }; 12245 end = { 12246 p: end 12247 }; 12248 } else if (_isArray(start2) && !_isArray(end)) { 12249 interpolators = []; 12250 l2 = start2.length; 12251 il = l2 - 2; 12252 for (i2 = 1; i2 < l2; i2++) { 12253 interpolators.push(interpolate2(start2[i2 - 1], start2[i2])); 12254 } 12255 l2--; 12256 func = function func2(p3) { 12257 p3 *= l2; 12258 var i3 = Math.min(il, ~~p3); 12259 return interpolators[i3](p3 - i3); 12260 }; 12261 progress = end; 12262 } else if (!mutate) { 12263 start2 = _merge$1(_isArray(start2) ? [] : {}, start2); 12264 } 12265 if (!interpolators) { 12266 for (p2 in end) { 12267 _addPropTween.call(master, start2, p2, "get", end[p2]); 12268 } 12269 func = function func2(p3) { 12270 return _renderPropTweens(p3, master) || (isString ? start2.p : start2); 12271 }; 12272 } 12273 } 12274 return _conditionalReturn(progress, func); 12275}, _getLabelInDirection = function _getLabelInDirection2(timeline2, fromTime, backward) { 12276 var labels = timeline2.labels, min = _bigNum$2, p2, distance, label; 12277 for (p2 in labels) { 12278 distance = labels[p2] - fromTime; 12279 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 12280 label = p2; 12281 min = distance; 12282 } 12283 } 12284 return label; 12285}, _callback$1 = function _callback(animation, type, executeLazyFirst) { 12286 var v2 = animation.vars, callback = v2[type], prevContext = _context$4, context3 = animation._ctx, params, scope, result; 12287 if (!callback) { 12288 return; 12289 } 12290 params = v2[type + "Params"]; 12291 scope = v2.callbackScope || animation; 12292 executeLazyFirst && _lazyTweens.length && _lazyRender(); 12293 context3 && (_context$4 = context3); 12294 result = params ? callback.apply(scope, params) : callback.call(scope); 12295 _context$4 = prevContext; 12296 return result; 12297}
vendor: 16,437 bytes, lines 12297-12726
12297, _interrupt$1 = function _interrupt(animation) { 12298 _removeFromParent(animation); 12299 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting$1); 12300 animation.progress() < 1 && _callback$1(animation, "onInterrupt"); 12301 return animation; 12302}, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin2(config4) { 12303 if (!config4) return; 12304 config4 = !config4.name && config4["default"] || config4; 12305 if (_windowExists$4() || config4.headless) { 12306 var name = config4.name, isFunc = _isFunction$3(config4), Plugin = name && !isFunc && config4.init ? function() { 12307 this._props = []; 12308 } : config4, instanceDefaults = { 12309 init: _emptyFunc, 12310 render: _renderPropTweens, 12311 add: _addPropTween, 12312 kill: _killPropTweensOf, 12313 modifier: _addPluginModifier, 12314 rawVars: 0 12315 }, statics = { 12316 targetTest: 0, 12317 get: 0, 12318 getSetter: _getSetter, 12319 aliases: {}, 12320 register: 0 12321 }; 12322 _wake(); 12323 if (config4 !== Plugin) { 12324 if (_plugins[name]) { 12325 return; 12326 } 12327 _setDefaults$1(Plugin, _setDefaults$1(_copyExcluding(config4, instanceDefaults), statics)); 12328 _merge$1(Plugin.prototype, _merge$1(instanceDefaults, _copyExcluding(config4, statics))); 12329 _plugins[Plugin.prop = name] = Plugin; 12330 if (config4.targetTest) { 12331 _harnessPlugins.push(Plugin); 12332 _reservedProps[name] = 1; 12333 } 12334 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; 12335 } 12336 _addGlobal(name, Plugin); 12337 config4.register && config4.register(gsap$8, Plugin, PropTween); 12338 } else { 12339 _registerPluginQueue.push(config4); 12340 } 12341}, _255 = 255, _colorLookup = { 12342 aqua: [0, _255, _255], 12343 lime: [0, _255, 0], 12344 silver: [192, 192, 192], 12345 black: [0, 0, 0], 12346 maroon: [128, 0, 0], 12347 teal: [0, 128, 128], 12348 blue: [0, 0, _255], 12349 navy: [0, 0, 128], 12350 white: [_255, _255, _255], 12351 olive: [128, 128, 0], 12352 yellow: [_255, _255, 0], 12353 orange: [_255, 165, 0], 12354 gray: [128, 128, 128], 12355 purple: [128, 0, 128], 12356 green: [0, 128, 0], 12357 red: [_255, 0, 0], 12358 pink: [_255, 192, 203], 12359 cyan: [0, _255, _255], 12360 transparent: [_255, _255, _255, 0] 12361}, _hue = function _hue2(h2, m1, m2) { 12362 h2 += h2 < 0 ? 1 : h2 > 1 ? -1 : 0; 12363 return (h2 * 6 < 1 ? m1 + (m2 - m1) * h2 * 6 : h2 < 0.5 ? m2 : h2 * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h2) * 6 : m1) * _255 + 0.5 | 0; 12364}, splitColor = function splitColor2(v2, toHSL, forceAlpha) { 12365 var a2 = !v2 ? _colorLookup.black : _isNumber$2(v2) ? [v2 >> 16, v2 >> 8 & _255, v2 & _255] : 0, r2, g2, b2, h2, s2, l2, max, min, d2, wasHSL; 12366 if (!a2) { 12367 if (v2.substr(-1) === ",") { 12368 v2 = v2.substr(0, v2.length - 1); 12369 } 12370 if (_colorLookup[v2]) { 12371 a2 = _colorLookup[v2]; 12372 } else if (v2.charAt(0) === "#") { 12373 if (v2.length < 6) { 12374 r2 = v2.charAt(1); 12375 g2 = v2.charAt(2); 12376 b2 = v2.charAt(3); 12377 v2 = "#" + r2 + r2 + g2 + g2 + b2 + b2 + (v2.length === 5 ? v2.charAt(4) + v2.charAt(4) : ""); 12378 } 12379 if (v2.length === 9) { 12380 a2 = parseInt(v2.substr(1, 6), 16); 12381 return [a2 >> 16, a2 >> 8 & _255, a2 & _255, parseInt(v2.substr(7), 16) / 255]; 12382 } 12383 v2 = parseInt(v2.substr(1), 16); 12384 a2 = [v2 >> 16, v2 >> 8 & _255, v2 & _255]; 12385 } else if (v2.substr(0, 3) === "hsl") { 12386 a2 = wasHSL = v2.match(_strictNumExp); 12387 if (!toHSL) { 12388 h2 = +a2[0] % 360 / 360; 12389 s2 = +a2[1] / 100; 12390 l2 = +a2[2] / 100; 12391 g2 = l2 <= 0.5 ? l2 * (s2 + 1) : l2 + s2 - l2 * s2; 12392 r2 = l2 * 2 - g2; 12393 a2.length > 3 && (a2[3] *= 1); 12394 a2[0] = _hue(h2 + 1 / 3, r2, g2); 12395 a2[1] = _hue(h2, r2, g2); 12396 a2[2] = _hue(h2 - 1 / 3, r2, g2); 12397 } else if (~v2.indexOf("=")) { 12398 a2 = v2.match(_numExp$1); 12399 forceAlpha && a2.length < 4 && (a2[3] = 1); 12400 return a2; 12401 } 12402 } else { 12403 a2 = v2.match(_strictNumExp) || _colorLookup.transparent; 12404 } 12405 a2 = a2.map(Number); 12406 } 12407 if (toHSL && !wasHSL) { 12408 r2 = a2[0] / _255; 12409 g2 = a2[1] / _255; 12410 b2 = a2[2] / _255; 12411 max = Math.max(r2, g2, b2); 12412 min = Math.min(r2, g2, b2); 12413 l2 = (max + min) / 2; 12414 if (max === min) { 12415 h2 = s2 = 0; 12416 } else { 12417 d2 = max - min; 12418 s2 = l2 > 0.5 ? d2 / (2 - max - min) : d2 / (max + min); 12419 h2 = max === r2 ? (g2 - b2) / d2 + (g2 < b2 ? 6 : 0) : max === g2 ? (b2 - r2) / d2 + 2 : (r2 - g2) / d2 + 4; 12420 h2 *= 60; 12421 } 12422 a2[0] = ~~(h2 + 0.5); 12423 a2[1] = ~~(s2 * 100 + 0.5); 12424 a2[2] = ~~(l2 * 100 + 0.5); 12425 } 12426 forceAlpha && a2.length < 4 && (a2[3] = 1); 12427 return a2; 12428}, _colorOrderData = function _colorOrderData2(v2) { 12429 var values = [], c2 = [], i2 = -1; 12430 v2.split(_colorExp).forEach(function(v3) { 12431 var a2 = v3.match(_numWithUnitExp) || []; 12432 values.push.apply(values, a2); 12433 c2.push(i2 += a2.length + 1); 12434 }); 12435 values.c = c2; 12436 return values; 12437}, _formatColors = function _formatColors2(s2, toHSL, orderMatchData) { 12438 var result = "", colors = (s2 + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i2 = 0, c2, shell, d2, l2; 12439 if (!colors) { 12440 return s2; 12441 } 12442 colors = colors.map(function(color) { 12443 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 12444 }); 12445 if (orderMatchData) { 12446 d2 = _colorOrderData(s2); 12447 c2 = orderMatchData.c; 12448 if (c2.join(result) !== d2.c.join(result)) { 12449 shell = s2.replace(_colorExp, "1").split(_numWithUnitExp); 12450 l2 = shell.length - 1; 12451 for (; i2 < l2; i2++) { 12452 result += shell[i2] + (~c2.indexOf(i2) ? colors.shift() || type + "0,0,0,0)" : (d2.length ? d2 : colors.length ? colors : orderMatchData).shift()); 12453 } 12454 } 12455 } 12456 if (!shell) { 12457 shell = s2.split(_colorExp); 12458 l2 = shell.length - 1; 12459 for (; i2 < l2; i2++) { 12460 result += shell[i2] + colors[i2]; 12461 } 12462 } 12463 return result + shell[l2]; 12464}, _colorExp = function() { 12465 var s2 = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", p2; 12466 for (p2 in _colorLookup) { 12467 s2 += "|" + p2 + "\\b"; 12468 } 12469 return new RegExp(s2 + ")", "gi"); 12470}(), _hslExp = /hsl[a]?\(/, _colorStringFilter = function _colorStringFilter2(a2) { 12471 var combined = a2.join(" "), toHSL; 12472 _colorExp.lastIndex = 0; 12473 if (_colorExp.test(combined)) { 12474 toHSL = _hslExp.test(combined); 12475 a2[1] = _formatColors(a2[1], toHSL); 12476 a2[0] = _formatColors(a2[0], toHSL, _colorOrderData(a2[1])); 12477 return true; 12478 } 12479}, _tickerActive, _ticker = function() { 12480 var _getTime2 = Date.now, _lagThreshold = 500, _adjustedLag = 33, _startTime = _getTime2(), _lastUpdate = _startTime, _gap = 1e3 / 240, _nextTime = _gap, _listeners2 = [], _id2, _req, _raf, _self, _delta, _i2, _tick = function _tick2(v2) { 12481 var elapsed = _getTime2() - _lastUpdate, manual = v2 === true, overlap, dispatch2, time, frame; 12482 (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag); 12483 _lastUpdate += elapsed; 12484 time = _lastUpdate - _startTime; 12485 overlap = time - _nextTime; 12486 if (overlap > 0 || manual) { 12487 frame = ++_self.frame; 12488 _delta = time - _self.time * 1e3; 12489 _self.time = time = time / 1e3; 12490 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 12491 dispatch2 = 1; 12492 } 12493 manual || (_id2 = _req(_tick2)); 12494 if (dispatch2) { 12495 for (_i2 = 0; _i2 < _listeners2.length; _i2++) { 12496 _listeners2[_i2](time, _delta, frame, v2); 12497 } 12498 } 12499 }; 12500 _self = { 12501 time: 0, 12502 frame: 0, 12503 tick: function tick() { 12504 _tick(true); 12505 }, 12506 deltaRatio: function deltaRatio(fps) { 12507 return _delta / (1e3 / (fps || 60)); 12508 }, 12509 wake: function wake() { 12510 if (_coreReady) { 12511 if (!_coreInitted$6 && _windowExists$4()) { 12512 _win$6 = _coreInitted$6 = window; 12513 _doc$6 = _win$6.document || {}; 12514 _globals.gsap = gsap$8; 12515 (_win$6.gsapVersions || (_win$6.gsapVersions = [])).push(gsap$8.version); 12516 _install(_installScope || _win$6.GreenSockGlobals || !_win$6.gsap && _win$6 || {}); 12517 _registerPluginQueue.forEach(_createPlugin); 12518 } 12519 _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame; 12520 _id2 && _self.sleep(); 12521 _req = _raf || function(f2) { 12522 return setTimeout(f2, _nextTime - _self.time * 1e3 + 1 | 0); 12523 }; 12524 _tickerActive = 1; 12525 _tick(2); 12526 } 12527 }, 12528 sleep: function sleep2() { 12529 (_raf ? cancelAnimationFrame : clearTimeout)(_id2); 12530 _tickerActive = 0; 12531 _req = _emptyFunc; 12532 }, 12533 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 12534 _lagThreshold = threshold || Infinity; 12535 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 12536 }, 12537 fps: function fps(_fps) { 12538 _gap = 1e3 / (_fps || 240); 12539 _nextTime = _self.time * 1e3 + _gap; 12540 }, 12541 add: function add2(callback, once, prioritize) { 12542 var func = once ? function(t2, d2, f2, v2) { 12543 callback(t2, d2, f2, v2); 12544 _self.remove(func); 12545 } : callback; 12546 _self.remove(callback); 12547 _listeners2[prioritize ? "unshift" : "push"](func); 12548 _wake(); 12549 return func; 12550 }, 12551 remove: function remove(callback, i2) { 12552 ~(i2 = _listeners2.indexOf(callback)) && _listeners2.splice(i2, 1) && _i2 >= i2 && _i2--; 12553 }, 12554 _listeners: _listeners2 12555 }; 12556 return _self; 12557}(), _wake = function _wake2() { 12558 return !_tickerActive && _ticker.wake(); 12559}, _easeMap = {}, _customEaseExp = /^[\d.\-M][\d.\-,\s]/, _quotesExp = /["']/g, _parseObjectInString = function _parseObjectInString2(value) { 12560 var obj = {}, split2 = value.substr(1, value.length - 3).split(":"), key2 = split2[0], i2 = 1, l2 = split2.length, index3, val, parsedVal; 12561 for (; i2 < l2; i2++) { 12562 val = split2[i2]; 12563 index3 = i2 !== l2 - 1 ? val.lastIndexOf(",") : val.length; 12564 parsedVal = val.substr(0, index3); 12565 obj[key2] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 12566 key2 = val.substr(index3 + 1).trim(); 12567 } 12568 return obj; 12569}, _valueInParentheses = function _valueInParentheses2(value) { 12570 var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open); 12571 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 12572}, _configEaseFromString = function _configEaseFromString2(name) { 12573 var split2 = (name + "").split("("), ease = _easeMap[split2[0]]; 12574 return ease && split2.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split2[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 12575}, _invertEase = function _invertEase2(ease) { 12576 return function(p2) { 12577 return 1 - ease(1 - p2); 12578 }; 12579}, _propagateYoyoEase = function _propagateYoyoEase2(timeline2, isYoyo) { 12580 var child = timeline2._first, ease; 12581 while (child) { 12582 if (child instanceof Timeline) { 12583 _propagateYoyoEase2(child, isYoyo); 12584 } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 12585 if (child.timeline) { 12586 _propagateYoyoEase2(child.timeline, isYoyo); 12587 } else { 12588 ease = child._ease; 12589 child._ease = child._yEase; 12590 child._yEase = ease; 12591 child._yoyo = isYoyo; 12592 } 12593 } 12594 child = child._next; 12595 } 12596}, _parseEase = function _parseEase2(ease, defaultEase) { 12597 return !ease ? defaultEase : (_isFunction$3(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 12598}, _insertEase = function _insertEase2(names, easeIn, easeOut, easeInOut) { 12599 if (easeOut === void 0) { 12600 easeOut = function easeOut2(p2) { 12601 return 1 - easeIn(1 - p2); 12602 }; 12603 } 12604 if (easeInOut === void 0) { 12605 easeInOut = function easeInOut2(p2) { 12606 return p2 < 0.5 ? easeIn(p2 * 2) / 2 : 1 - easeIn((1 - p2) * 2) / 2; 12607 }; 12608 } 12609 var ease = { 12610 easeIn, 12611 easeOut, 12612 easeInOut 12613 }, lowercaseName; 12614 _forEachName(names, function(name) { 12615 _easeMap[name] = _globals[name] = ease; 12616 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 12617 for (var p2 in ease) { 12618 _easeMap[lowercaseName + (p2 === "easeIn" ? ".in" : p2 === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p2] = ease[p2]; 12619 } 12620 }); 12621 return ease; 12622}, _easeInOutFromOut = function _easeInOutFromOut2(easeOut) { 12623 return function(p2) { 12624 return p2 < 0.5 ? (1 - easeOut(1 - p2 * 2)) / 2 : 0.5 + easeOut((p2 - 0.5) * 2) / 2; 12625 }; 12626}, _configElastic = function _configElastic2(type, amplitude, period) { 12627 var p1 = amplitude >= 1 ? amplitude : 1, p2 = (period || (type ? 0.3 : 0.45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI$1 * (Math.asin(1 / p1) || 0), easeOut = function easeOut2(p4) { 12628 return p4 === 1 ? 1 : p1 * Math.pow(2, -10 * p4) * _sin$2((p4 - p3) * p2) + 1; 12629 }, ease = type === "out" ? easeOut : type === "in" ? function(p4) { 12630 return 1 - easeOut(1 - p4); 12631 } : _easeInOutFromOut(easeOut); 12632 p2 = _2PI$1 / p2; 12633 ease.config = function(amplitude2, period2) { 12634 return _configElastic2(type, amplitude2, period2); 12635 }; 12636 return ease; 12637}, _configBack = function _configBack2(type, overshoot) { 12638 if (overshoot === void 0) { 12639 overshoot = 1.70158; 12640 } 12641 var easeOut = function easeOut2(p2) { 12642 return p2 ? --p2 * p2 * ((overshoot + 1) * p2 + overshoot) + 1 : 0; 12643 }, ease = type === "out" ? easeOut : type === "in" ? function(p2) { 12644 return 1 - easeOut(1 - p2); 12645 } : _easeInOutFromOut(easeOut); 12646 ease.config = function(overshoot2) { 12647 return _configBack2(type, overshoot2); 12648 }; 12649 return ease; 12650}; 12651_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i2) { 12652 var power = i2 < 5 ? i2 + 1 : i2; 12653 _insertEase(name + ",Power" + (power - 1), i2 ? function(p2) { 12654 return Math.pow(p2, power); 12655 } : function(p2) { 12656 return p2; 12657 }, function(p2) { 12658 return 1 - Math.pow(1 - p2, power); 12659 }, function(p2) { 12660 return p2 < 0.5 ? Math.pow(p2 * 2, power) / 2 : 1 - Math.pow((1 - p2) * 2, power) / 2; 12661 }); 12662}); 12663_easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; 12664_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 12665(function(n2, c2) { 12666 var n1 = 1 / c2, n22 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut2(p2) { 12667 return p2 < n1 ? n2 * p2 * p2 : p2 < n22 ? n2 * Math.pow(p2 - 1.5 / c2, 2) + 0.75 : p2 < n3 ? n2 * (p2 -= 2.25 / c2) * p2 + 0.9375 : n2 * Math.pow(p2 - 2.625 / c2, 2) + 0.984375; 12668 }; 12669 _insertEase("Bounce", function(p2) { 12670 return 1 - easeOut(1 - p2); 12671 }, easeOut); 12672})(7.5625, 2.75); 12673_insertEase("Expo", function(p2) { 12674 return p2 ? Math.pow(2, 10 * (p2 - 1)) : 0; 12675}); 12676_insertEase("Circ", function(p2) { 12677 return -(_sqrt$2(1 - p2 * p2) - 1); 12678}); 12679_insertEase("Sine", function(p2) { 12680 return p2 === 1 ? 1 : -_cos$2(p2 * _HALF_PI) + 1; 12681}); 12682_insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 12683_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 12684 config: function config2(steps, immediateStart) { 12685 if (steps === void 0) { 12686 steps = 1; 12687 } 12688 var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum; 12689 return function(p4) { 12690 return ((p2 * _clamp$2(0, max, p4) | 0) + p3) * p1; 12691 }; 12692 } 12693}; 12694_defaults$1.ease = _easeMap["quad.out"]; 12695_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) { 12696 return _callbackNames += name + "," + name + "Params,"; 12697}); 12698var GSCache = function GSCache2(target, harness) { 12699 this.id = _gsID++; 12700 target._gsap = this; 12701 this.target = target; 12702 this.harness = harness; 12703 this.get = harness ? harness.get : _getProperty; 12704 this.set = harness ? harness.getSetter : _getSetter; 12705}; 12706var Animation = /* @__PURE__ */ function() { 12707 function Animation2(vars) { 12708 this.vars = vars; 12709 this._delay = +vars.delay || 0; 12710 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 12711 this._rDelay = vars.repeatDelay || 0; 12712 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 12713 } 12714 this._ts = 1; 12715 _setDuration(this, +vars.duration, 1, 1); 12716 this.data = vars.data; 12717 if (_context$4) { 12718 this._ctx = _context$4; 12719 _context$4.data.push(this); 12720 } 12721 _tickerActive || _ticker.wake(); 12722 } 12723 var _proto = Animation2.prototype; 12724 _proto.delay = function delay(value) { 12725 if (value || value === 0) { 12726 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
vendor: 15,534 bytes, lines 12727-13102
12727 this._delay = value; 12728 return this; 12729 } 12730 return this._delay; 12731 }; 12732 _proto.duration = function duration(value) { 12733 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 12734 }; 12735 _proto.totalDuration = function totalDuration(value) { 12736 if (!arguments.length) { 12737 return this._tDur; 12738 } 12739 this._dirty = 0; 12740 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 12741 }; 12742 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 12743 _wake(); 12744 if (!arguments.length) { 12745 return this._tTime; 12746 } 12747 var parent = this._dp; 12748 if (parent && parent.smoothChildTiming && this._ts) { 12749 _alignPlayhead(this, _totalTime); 12750 !parent._dp || parent.parent || _postAddChecks(parent, this); 12751 while (parent && parent.parent) { 12752 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { 12753 parent.totalTime(parent._tTime, true); 12754 } 12755 parent = parent.parent; 12756 } 12757 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) { 12758 _addToTimeline(this._dp, this, this._start - this._delay); 12759 } 12760 } 12761 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 12762 this._ts || (this._pTime = _totalTime); 12763 _lazySafeRender(this, _totalTime, suppressEvents); 12764 } 12765 return this; 12766 }; 12767 _proto.time = function time(value, suppressEvents) { 12768 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; 12769 }; 12770 _proto.totalProgress = function totalProgress(value, suppressEvents) { 12771 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() > 0 ? 1 : 0; 12772 }; 12773 _proto.progress = function progress(value, suppressEvents) { 12774 return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0; 12775 }; 12776 _proto.iteration = function iteration(value, suppressEvents) { 12777 var cycleDuration = this.duration() + this._rDelay; 12778 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 12779 }; 12780 _proto.timeScale = function timeScale(value, suppressEvents) { 12781 if (!arguments.length) { 12782 return this._rts === -_tinyNum ? 0 : this._rts; 12783 } 12784 if (this._rts === value) { 12785 return this; 12786 } 12787 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; 12788 this._rts = +value || 0; 12789 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; 12790 this.totalTime(_clamp$2(-Math.abs(this._delay), this._tDur, tTime), suppressEvents !== false); 12791 _setEnd(this); 12792 return _recacheAncestors(this); 12793 }; 12794 _proto.paused = function paused(value) { 12795 if (!arguments.length) { 12796 return this._ps; 12797 } 12798 if (this._ps !== value) { 12799 this._ps = value; 12800 if (value) { 12801 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); 12802 this._ts = this._act = 0; 12803 } else { 12804 _wake(); 12805 this._ts = this._rts; 12806 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); 12807 } 12808 } 12809 return this; 12810 }; 12811 _proto.startTime = function startTime(value) { 12812 if (arguments.length) { 12813 this._start = value; 12814 var parent = this.parent || this._dp; 12815 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 12816 return this; 12817 } 12818 return this._start; 12819 }; 12820 _proto.endTime = function endTime(includeRepeats) { 12821 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 12822 }; 12823 _proto.rawTime = function rawTime(wrapRepeats) { 12824 var parent = this.parent || this._dp; 12825 return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); 12826 }; 12827 _proto.revert = function revert(config4) { 12828 if (config4 === void 0) { 12829 config4 = _revertConfig; 12830 } 12831 var prevIsReverting = _reverting$1; 12832 _reverting$1 = config4; 12833 if (this._initted || this._startAt) { 12834 this.timeline && this.timeline.revert(config4); 12835 this.totalTime(-0.01, config4.suppressEvents); 12836 } 12837 this.data !== "nested" && config4.kill !== false && this.kill(); 12838 _reverting$1 = prevIsReverting; 12839 return this; 12840 }; 12841 _proto.globalTime = function globalTime(rawTime) { 12842 var animation = this, time = arguments.length ? rawTime : animation.rawTime(); 12843 while (animation) { 12844 time = animation._start + time / (Math.abs(animation._ts) || 1); 12845 animation = animation._dp; 12846 } 12847 return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time; 12848 }; 12849 _proto.repeat = function repeat2(value) { 12850 if (arguments.length) { 12851 this._repeat = value === Infinity ? -2 : value; 12852 return _onUpdateTotalDuration(this); 12853 } 12854 return this._repeat === -2 ? Infinity : this._repeat; 12855 }; 12856 _proto.repeatDelay = function repeatDelay(value) { 12857 if (arguments.length) { 12858 var time = this._time; 12859 this._rDelay = value; 12860 _onUpdateTotalDuration(this); 12861 return time ? this.time(time) : this; 12862 } 12863 return this._rDelay; 12864 }; 12865 _proto.yoyo = function yoyo(value) { 12866 if (arguments.length) { 12867 this._yoyo = value; 12868 return this; 12869 } 12870 return this._yoyo; 12871 }; 12872 _proto.seek = function seek(position, suppressEvents) { 12873 return this.totalTime(_parsePosition$1(this, position), _isNotFalse(suppressEvents)); 12874 }; 12875 _proto.restart = function restart(includeDelay, suppressEvents) { 12876 return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 12877 }; 12878 _proto.play = function play(from, suppressEvents) { 12879 from != null && this.seek(from, suppressEvents); 12880 return this.reversed(false).paused(false); 12881 }; 12882 _proto.reverse = function reverse(from, suppressEvents) { 12883 from != null && this.seek(from || this.totalDuration(), suppressEvents); 12884 return this.reversed(true).paused(false); 12885 }; 12886 _proto.pause = function pause(atTime, suppressEvents) { 12887 atTime != null && this.seek(atTime, suppressEvents); 12888 return this.paused(true); 12889 }; 12890 _proto.resume = function resume() { 12891 return this.paused(false); 12892 }; 12893 _proto.reversed = function reversed(value) { 12894 if (arguments.length) { 12895 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); 12896 return this; 12897 } 12898 return this._rts < 0; 12899 }; 12900 _proto.invalidate = function invalidate() { 12901 this._initted = this._act = 0; 12902 this._zTime = -_tinyNum; 12903 return this; 12904 }; 12905 _proto.isActive = function isActive() { 12906 var parent = this.parent || this._dp, start2 = this._start, rawTime; 12907 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start2 && rawTime < this.endTime(true) - _tinyNum); 12908 }; 12909 _proto.eventCallback = function eventCallback(type, callback, params) { 12910 var vars = this.vars; 12911 if (arguments.length > 1) { 12912 if (!callback) { 12913 delete vars[type]; 12914 } else { 12915 vars[type] = callback; 12916 params && (vars[type + "Params"] = params); 12917 type === "onUpdate" && (this._onUpdate = callback); 12918 } 12919 return this; 12920 } 12921 return vars[type]; 12922 }; 12923 _proto.then = function then(onFulfilled) { 12924 var self2 = this; 12925 return new Promise(function(resolve) { 12926 var f2 = _isFunction$3(onFulfilled) ? onFulfilled : _passThrough$1, _resolve = function _resolve2() { 12927 var _then = self2.then; 12928 self2.then = null; 12929 _isFunction$3(f2) && (f2 = f2(self2)) && (f2.then || f2 === self2) && (self2.then = _then); 12930 resolve(f2); 12931 self2.then = _then; 12932 }; 12933 if (self2._initted && self2.totalProgress() === 1 && self2._ts >= 0 || !self2._tTime && self2._ts < 0) { 12934 _resolve(); 12935 } else { 12936 self2._prom = _resolve; 12937 } 12938 }); 12939 }; 12940 _proto.kill = function kill3() { 12941 _interrupt$1(this); 12942 }; 12943 return Animation2; 12944}(); 12945_setDefaults$1(Animation.prototype, { 12946 _time: 0, 12947 _start: 0, 12948 _end: 0, 12949 _tTime: 0, 12950 _tDur: 0, 12951 _dirty: 0, 12952 _repeat: 0, 12953 _yoyo: false, 12954 parent: null, 12955 _initted: false, 12956 _rDelay: 0, 12957 _ts: 1, 12958 _dp: 0, 12959 ratio: 0, 12960 _zTime: -_tinyNum, 12961 _prom: 0, 12962 _ps: false, 12963 _rts: 1 12964}); 12965var Timeline = /* @__PURE__ */ function(_Animation) { 12966 _inheritsLoose(Timeline2, _Animation); 12967 function Timeline2(vars, position) { 12968 var _this; 12969 if (vars === void 0) { 12970 vars = {}; 12971 } 12972 _this = _Animation.call(this, vars) || this; 12973 _this.labels = {}; 12974 _this.smoothChildTiming = !!vars.smoothChildTiming; 12975 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 12976 _this._sort = _isNotFalse(vars.sortChildren); 12977 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized$6(_this), position); 12978 vars.reversed && _this.reverse(); 12979 vars.paused && _this.paused(true); 12980 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized$6(_this), vars.scrollTrigger); 12981 return _this; 12982 } 12983 var _proto2 = Timeline2.prototype; 12984 _proto2.to = function to(targets, vars, position) { 12985 _createTweenType(0, arguments, this); 12986 return this; 12987 }; 12988 _proto2.from = function from(targets, vars, position) { 12989 _createTweenType(1, arguments, this); 12990 return this; 12991 }; 12992 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 12993 _createTweenType(2, arguments, this); 12994 return this; 12995 }; 12996 _proto2.set = function set(targets, vars, position) { 12997 vars.duration = 0; 12998 vars.parent = this; 12999 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 13000 vars.immediateRender = !!vars.immediateRender; 13001 new Tween(targets, vars, _parsePosition$1(this, position), 1); 13002 return this; 13003 }; 13004 _proto2.call = function call(callback, params, position) { 13005 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 13006 }; 13007 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 13008 vars.duration = duration; 13009 vars.stagger = vars.stagger || stagger; 13010 vars.onComplete = onCompleteAll; 13011 vars.onCompleteParams = onCompleteAllParams; 13012 vars.parent = this; 13013 new Tween(targets, vars, _parsePosition$1(this, position)); 13014 return this; 13015 }; 13016 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 13017 vars.runBackwards = 1; 13018 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 13019 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 13020 }; 13021 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 13022 toVars.startAt = fromVars; 13023 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 13024 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 13025 }; 13026 _proto2.render = function render6(totalTime, suppressEvents, force) { 13027 var prevTime = this._time, tDur = this._dirty ? this.totalDuration() : this._tDur, dur = this._dur, tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), time, child, next2, iteration, cycleDuration, prevPaused, pauseTween, timeScale, prevStart, prevIteration, yoyo, isYoyo; 13028 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 13029 if (tTime !== this._tTime || force || crossingStart) { 13030 if (prevTime !== this._time && dur) { 13031 tTime += this._time - prevTime; 13032 totalTime += this._time - prevTime; 13033 } 13034 time = tTime; 13035 prevStart = this._start; 13036 timeScale = this._ts; 13037 prevPaused = !timeScale; 13038 if (crossingStart) { 13039 dur || (prevTime = this._zTime); 13040 (totalTime || !suppressEvents) && (this._zTime = totalTime); 13041 } 13042 if (this._repeat) { 13043 yoyo = this._yoyo; 13044 cycleDuration = dur + this._rDelay; 13045 if (this._repeat < -1 && totalTime < 0) { 13046 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 13047 } 13048 time = _roundPrecise(tTime % cycleDuration); 13049 if (tTime === tDur) { 13050 iteration = this._repeat; 13051 time = dur; 13052 } else { 13053 iteration = ~~(tTime / cycleDuration); 13054 if (iteration && iteration === tTime / cycleDuration) { 13055 time = dur; 13056 iteration--; 13057 } 13058 time > dur && (time = dur); 13059 } 13060 prevIteration = _animationCycle(this._tTime, cycleDuration); 13061 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); 13062 if (yoyo && iteration & 1) { 13063 time = dur - time; 13064 isYoyo = 1; 13065 } 13066 if (iteration !== prevIteration && !this._lock) { 13067 var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1); 13068 iteration < prevIteration && (rewinding = !rewinding); 13069 prevTime = rewinding ? 0 : tTime % dur ? dur : tTime; 13070 this._lock = 1; 13071 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 13072 this._tTime = tTime; 13073 !suppressEvents && this.parent && _callback$1(this, "onRepeat"); 13074 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 13075 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { 13076 return this; 13077 } 13078 dur = this._dur; 13079 tDur = this._tDur; 13080 if (doesWrap) { 13081 this._lock = 2; 13082 prevTime = rewinding ? dur : -1e-4; 13083 this.render(prevTime, true); 13084 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 13085 } 13086 this._lock = 0; 13087 if (!this._ts && !prevPaused) { 13088 return this; 13089 } 13090 _propagateYoyoEase(this, isYoyo); 13091 } 13092 } 13093 if (this._hasPause && !this._forcing && this._lock < 2) { 13094 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 13095 if (pauseTween) { 13096 tTime -= time - (time = pauseTween._start); 13097 } 13098 } 13099 this._tTime = tTime; 13100 this._time = time; 13101 this._act = !timeScale; 13102 if (!this._initted) {
vendor: 2,329 bytes, lines 13103-13158
13103 this._onUpdate = this.vars.onUpdate; 13104 this._initted = 1; 13105 this._zTime = totalTime; 13106 prevTime = 0; 13107 } 13108 if (!prevTime && time && !suppressEvents && !iteration) { 13109 _callback$1(this, "onStart"); 13110 if (this._tTime !== tTime) { 13111 return this; 13112 } 13113 } 13114 if (time >= prevTime && totalTime >= 0) { 13115 child = this._first; 13116 while (child) { 13117 next2 = child._next; 13118 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 13119 if (child.parent !== this) { 13120 return this.render(totalTime, suppressEvents, force); 13121 } 13122 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 13123 if (time !== this._time || !this._ts && !prevPaused) { 13124 pauseTween = 0; 13125 next2 && (tTime += this._zTime = -_tinyNum); 13126 break; 13127 } 13128 } 13129 child = next2; 13130 } 13131 } else { 13132 child = this._last; 13133 var adjustedTime = totalTime < 0 ? totalTime : time; 13134 while (child) { 13135 next2 = child._prev; 13136 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 13137 if (child.parent !== this) { 13138 return this.render(totalTime, suppressEvents, force); 13139 } 13140 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting$1 && (child._initted || child._startAt)); 13141 if (time !== this._time || !this._ts && !prevPaused) { 13142 pauseTween = 0; 13143 next2 && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); 13144 break; 13145 } 13146 } 13147 child = next2; 13148 } 13149 } 13150 if (pauseTween && !suppressEvents) { 13151 this.pause(); 13152 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; 13153 if (this._ts) { 13154 this._start = prevStart; 13155 _setEnd(this); 13156 return this.render(totalTime, suppressEvents, force); 13157 } 13158 }
vendor: 7,548 bytes, lines 13159-13366
13159 this._onUpdate && !suppressEvents && _callback$1(this, "onUpdate", true); 13160 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) { 13161 if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) { 13162 if (!this._lock) { 13163 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 13164 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 13165 _callback$1(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 13166 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 13167 } 13168 } 13169 } 13170 } 13171 } 13172 return this; 13173 }; 13174 _proto2.add = function add2(child, position) { 13175 var _this2 = this; 13176 _isNumber$2(position) || (position = _parsePosition$1(this, position, child)); 13177 if (!(child instanceof Animation)) { 13178 if (_isArray(child)) { 13179 child.forEach(function(obj) { 13180 return _this2.add(obj, position); 13181 }); 13182 return this; 13183 } 13184 if (_isString$3(child)) { 13185 return this.addLabel(child, position); 13186 } 13187 if (_isFunction$3(child)) { 13188 child = Tween.delayedCall(0, child); 13189 } else { 13190 return this; 13191 } 13192 } 13193 return this !== child ? _addToTimeline(this, child, position) : this; 13194 }; 13195 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 13196 if (nested === void 0) { 13197 nested = true; 13198 } 13199 if (tweens === void 0) { 13200 tweens = true; 13201 } 13202 if (timelines === void 0) { 13203 timelines = true; 13204 } 13205 if (ignoreBeforeTime === void 0) { 13206 ignoreBeforeTime = -_bigNum$2; 13207 } 13208 var a2 = [], child = this._first; 13209 while (child) { 13210 if (child._start >= ignoreBeforeTime) { 13211 if (child instanceof Tween) { 13212 tweens && a2.push(child); 13213 } else { 13214 timelines && a2.push(child); 13215 nested && a2.push.apply(a2, child.getChildren(true, tweens, timelines)); 13216 } 13217 } 13218 child = child._next; 13219 } 13220 return a2; 13221 }; 13222 _proto2.getById = function getById2(id2) { 13223 var animations = this.getChildren(1, 1, 1), i2 = animations.length; 13224 while (i2--) { 13225 if (animations[i2].vars.id === id2) { 13226 return animations[i2]; 13227 } 13228 } 13229 }; 13230 _proto2.remove = function remove(child) { 13231 if (_isString$3(child)) { 13232 return this.removeLabel(child); 13233 } 13234 if (_isFunction$3(child)) { 13235 return this.killTweensOf(child); 13236 } 13237 _removeLinkedListItem(this, child); 13238 if (child === this._recent) { 13239 this._recent = this._last; 13240 } 13241 return _uncache(this); 13242 }; 13243 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 13244 if (!arguments.length) { 13245 return this._tTime; 13246 } 13247 this._forcing = 1; 13248 if (!this._dp && this._ts) { 13249 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts)); 13250 } 13251 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 13252 this._forcing = 0; 13253 return this; 13254 }; 13255 _proto2.addLabel = function addLabel(label, position) { 13256 this.labels[label] = _parsePosition$1(this, position); 13257 return this; 13258 }; 13259 _proto2.removeLabel = function removeLabel(label) { 13260 delete this.labels[label]; 13261 return this; 13262 }; 13263 _proto2.addPause = function addPause(position, callback, params) { 13264 var t2 = Tween.delayedCall(0, callback || _emptyFunc, params); 13265 t2.data = "isPause"; 13266 this._hasPause = 1; 13267 return _addToTimeline(this, t2, _parsePosition$1(this, position)); 13268 }; 13269 _proto2.removePause = function removePause(position) { 13270 var child = this._first; 13271 position = _parsePosition$1(this, position); 13272 while (child) { 13273 if (child._start === position && child.data === "isPause") { 13274 _removeFromParent(child); 13275 } 13276 child = child._next; 13277 } 13278 }; 13279 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 13280 var tweens = this.getTweensOf(targets, onlyActive), i2 = tweens.length; 13281 while (i2--) { 13282 _overwritingTween !== tweens[i2] && tweens[i2].kill(targets, props); 13283 } 13284 return this; 13285 }; 13286 _proto2.getTweensOf = function getTweensOf2(targets, onlyActive) { 13287 var a2 = [], parsedTargets = toArray$1(targets), child = this._first, isGlobalTime = _isNumber$2(onlyActive), children; 13288 while (child) { 13289 if (child instanceof Tween) { 13290 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) { 13291 a2.push(child); 13292 } 13293 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { 13294 a2.push.apply(a2, children); 13295 } 13296 child = child._next; 13297 } 13298 return a2; 13299 }; 13300 _proto2.tweenTo = function tweenTo(position, vars) { 13301 vars = vars || {}; 13302 var tl = this, endTime = _parsePosition$1(tl, position), _vars = vars, startAt = _vars.startAt, _onStart = _vars.onStart, onStartParams = _vars.onStartParams, immediateRender = _vars.immediateRender, initted, tween = Tween.to(tl, _setDefaults$1({ 13303 ease: vars.ease || "none", 13304 lazy: false, 13305 immediateRender: false, 13306 time: endTime, 13307 overwrite: "auto", 13308 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 13309 onStart: function onStart() { 13310 tl.pause(); 13311 if (!initted) { 13312 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 13313 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 13314 initted = 1; 13315 } 13316 _onStart && _onStart.apply(tween, onStartParams || []); 13317 } 13318 }, vars)); 13319 return immediateRender ? tween.render(0) : tween; 13320 }; 13321 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 13322 return this.tweenTo(toPosition, _setDefaults$1({ 13323 startAt: { 13324 time: _parsePosition$1(this, fromPosition) 13325 } 13326 }, vars)); 13327 }; 13328 _proto2.recent = function recent() { 13329 return this._recent; 13330 }; 13331 _proto2.nextLabel = function nextLabel(afterTime) { 13332 if (afterTime === void 0) { 13333 afterTime = this._time; 13334 } 13335 return _getLabelInDirection(this, _parsePosition$1(this, afterTime)); 13336 }; 13337 _proto2.previousLabel = function previousLabel(beforeTime) { 13338 if (beforeTime === void 0) { 13339 beforeTime = this._time; 13340 } 13341 return _getLabelInDirection(this, _parsePosition$1(this, beforeTime), 1); 13342 }; 13343 _proto2.currentLabel = function currentLabel(value) { 13344 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 13345 }; 13346 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 13347 if (ignoreBeforeTime === void 0) { 13348 ignoreBeforeTime = 0; 13349 } 13350 var child = this._first, labels = this.labels, p2; 13351 while (child) { 13352 if (child._start >= ignoreBeforeTime) { 13353 child._start += amount; 13354 child._end += amount; 13355 } 13356 child = child._next; 13357 } 13358 if (adjustLabels) { 13359 for (p2 in labels) { 13360 if (labels[p2] >= ignoreBeforeTime) { 13361 labels[p2] += amount; 13362 } 13363 } 13364 } 13365 return _uncache(this); 13366 };
vendor: 7,221 bytes, lines 13367-13541
13367 _proto2.invalidate = function invalidate(soft) { 13368 var child = this._first; 13369 this._lock = 0; 13370 while (child) { 13371 child.invalidate(soft); 13372 child = child._next; 13373 } 13374 return _Animation.prototype.invalidate.call(this, soft); 13375 }; 13376 _proto2.clear = function clear(includeLabels) { 13377 if (includeLabels === void 0) { 13378 includeLabels = true; 13379 } 13380 var child = this._first, next2; 13381 while (child) { 13382 next2 = child._next; 13383 this.remove(child); 13384 child = next2; 13385 } 13386 this._dp && (this._time = this._tTime = this._pTime = 0); 13387 includeLabels && (this.labels = {}); 13388 return _uncache(this); 13389 }; 13390 _proto2.totalDuration = function totalDuration(value) { 13391 var max = 0, self2 = this, child = self2._last, prevStart = _bigNum$2, prev, start2, parent; 13392 if (arguments.length) { 13393 return self2.timeScale((self2._repeat < 0 ? self2.duration() : self2.totalDuration()) / (self2.reversed() ? -value : value)); 13394 } 13395 if (self2._dirty) { 13396 parent = self2.parent; 13397 while (child) { 13398 prev = child._prev; 13399 child._dirty && child.totalDuration(); 13400 start2 = child._start; 13401 if (start2 > prevStart && self2._sort && child._ts && !self2._lock) { 13402 self2._lock = 1; 13403 _addToTimeline(self2, child, start2 - child._delay, 1)._lock = 0; 13404 } else { 13405 prevStart = start2; 13406 } 13407 if (start2 < 0 && child._ts) { 13408 max -= start2; 13409 if (!parent && !self2._dp || parent && parent.smoothChildTiming) { 13410 self2._start += start2 / self2._ts; 13411 self2._time -= start2; 13412 self2._tTime -= start2; 13413 } 13414 self2.shiftChildren(-start2, false, -Infinity); 13415 prevStart = 0; 13416 } 13417 child._end > max && child._ts && (max = child._end); 13418 child = prev; 13419 } 13420 _setDuration(self2, self2 === _globalTimeline && self2._time > max ? self2._time : max, 1, 1); 13421 self2._dirty = 0; 13422 } 13423 return self2._tDur; 13424 }; 13425 Timeline2.updateRoot = function updateRoot(time) { 13426 if (_globalTimeline._ts) { 13427 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 13428 _lastRenderedFrame = _ticker.frame; 13429 } 13430 if (_ticker.frame >= _nextGCFrame) { 13431 _nextGCFrame += _config$1.autoSleep || 120; 13432 var child = _globalTimeline._first; 13433 if (!child || !child._ts) { 13434 if (_config$1.autoSleep && _ticker._listeners.length < 2) { 13435 while (child && !child._ts) { 13436 child = child._next; 13437 } 13438 child || _ticker.sleep(); 13439 } 13440 } 13441 } 13442 }; 13443 return Timeline2; 13444}(Animation); 13445_setDefaults$1(Timeline.prototype, { 13446 _lock: 0, 13447 _hasPause: 0, 13448 _forcing: 0 13449}); 13450var _addComplexStringPropTween = function _addComplexStringPropTween2(target, prop, start2, end, setter, stringFilter, funcParam) { 13451 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), index3 = 0, matchIndex = 0, result, startNums, color, endNum, chunk2, startNum, hasRandom, a2; 13452 pt.b = start2; 13453 pt.e = end; 13454 start2 += ""; 13455 end += ""; 13456 if (hasRandom = ~end.indexOf("random(")) { 13457 end = _replaceRandom(end); 13458 } 13459 if (stringFilter) { 13460 a2 = [start2, end]; 13461 stringFilter(a2, target, prop); 13462 start2 = a2[0]; 13463 end = a2[1]; 13464 } 13465 startNums = start2.match(_complexStringNumExp) || []; 13466 while (result = _complexStringNumExp.exec(end)) { 13467 endNum = result[0]; 13468 chunk2 = end.substring(index3, result.index); 13469 if (color) { 13470 color = (color + 1) % 5; 13471 } else if (chunk2.substr(-5) === "rgba(") { 13472 color = 1; 13473 } 13474 if (endNum !== startNums[matchIndex++]) { 13475 startNum = parseFloat(startNums[matchIndex - 1]) || 0; 13476 pt._pt = { 13477 _next: pt._pt, 13478 p: chunk2 || matchIndex === 1 ? chunk2 : ",", 13479 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 13480 s: startNum, 13481 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 13482 m: color && color < 4 ? Math.round : 0 13483 }; 13484 index3 = _complexStringNumExp.lastIndex; 13485 } 13486 } 13487 pt.c = index3 < end.length ? end.substring(index3, end.length) : ""; 13488 pt.fp = funcParam; 13489 if (_relExp.test(end) || hasRandom) { 13490 pt.e = 0; 13491 } 13492 this._pt = pt; 13493 return pt; 13494}, _addPropTween = function _addPropTween2(target, prop, start2, end, index3, targets, modifier, stringFilter, funcParam, optional) { 13495 _isFunction$3(end) && (end = end(index3 || 0, target, targets)); 13496 var currentValue = target[prop], parsedStart = start2 !== "get" ? start2 : !_isFunction$3(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction$3(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), setter = !_isFunction$3(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, pt; 13497 if (_isString$3(end)) { 13498 if (~end.indexOf("random(")) { 13499 end = _replaceRandom(end); 13500 } 13501 if (end.charAt(1) === "=") { 13502 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 13503 if (pt || pt === 0) { 13504 end = pt; 13505 } 13506 } 13507 } 13508 if (!optional || parsedStart !== end || _forceAllPropTweens) { 13509 if (!isNaN(parsedStart * end) && end !== "") { 13510 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 13511 funcParam && (pt.fp = funcParam); 13512 modifier && pt.modifier(modifier, this, target); 13513 return this._pt = pt; 13514 } 13515 !currentValue && !(prop in target) && _missingPlugin(prop, end); 13516 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config$1.stringFilter, funcParam); 13517 } 13518}, _processVars = function _processVars2(vars, index3, target, targets, tween) { 13519 _isFunction$3(vars) && (vars = _parseFuncOrString(vars, tween, index3, target, targets)); 13520 if (!_isObject$1(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { 13521 return _isString$3(vars) ? _parseFuncOrString(vars, tween, index3, target, targets) : vars; 13522 } 13523 var copy = {}, p2; 13524 for (p2 in vars) { 13525 copy[p2] = _parseFuncOrString(vars[p2], tween, index3, target, targets); 13526 } 13527 return copy; 13528}, _checkPlugin = function _checkPlugin2(property, vars, tween, index3, target, targets) { 13529 var plugin, pt, ptLookup, i2; 13530 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index3, target, targets, tween), tween, index3, targets) !== false) { 13531 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 13532 if (tween !== _quickTween) { 13533 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; 13534 i2 = plugin._props.length; 13535 while (i2--) { 13536 ptLookup[plugin._props[i2]] = pt; 13537 } 13538 } 13539 } 13540 return plugin; 13541}, _overwritingTween, _forceAllPropTweens, _initTween = function _initTween2
vendor: 7,947 bytes, lines 13541-13702
13541(tween, time, tTime) { 13542 var vars = tween.vars, ease = vars.ease, startAt = vars.startAt, immediateRender = vars.immediateRender, lazy = vars.lazy, onUpdate = vars.onUpdate, runBackwards = vars.runBackwards, yoyoEase = vars.yoyoEase, keyframes = vars.keyframes, autoRevert = vars.autoRevert, dur = tween._dur, prevStartAt = tween._startAt, targets = tween._targets, parent = tween.parent, fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites$1, tl = tween.timeline, cleanVars, i2, p2, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index3, harnessVars, overwritten; 13543 tl && (!keyframes || !ease) && (ease = "none"); 13544 tween._ease = _parseEase(ease, _defaults$1.ease); 13545 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults$1.ease)) : 0; 13546 if (yoyoEase && tween._yoyo && !tween._repeat) { 13547 yoyoEase = tween._yEase; 13548 tween._yEase = tween._ease; 13549 tween._ease = yoyoEase; 13550 } 13551 tween._from = !tl && !!vars.runBackwards; 13552 if (!tl || keyframes && !vars.stagger) { 13553 harness = targets[0] ? _getCache(targets[0]).harness : 0; 13554 harnessVars = harness && vars[harness.prop]; 13555 cleanVars = _copyExcluding(vars, _reservedProps); 13556 if (prevStartAt) { 13557 prevStartAt._zTime < 0 && prevStartAt.progress(1); 13558 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); 13559 prevStartAt._lazy = 0; 13560 } 13561 if (startAt) { 13562 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults$1({ 13563 data: "isStart", 13564 overwrite: false, 13565 parent, 13566 immediateRender: true, 13567 lazy: !prevStartAt && _isNotFalse(lazy), 13568 startAt: null, 13569 delay: 0, 13570 onUpdate: onUpdate && function() { 13571 return _callback$1(tween, "onUpdate"); 13572 }, 13573 stagger: 0 13574 }, startAt))); 13575 tween._startAt._dp = 0; 13576 tween._startAt._sat = tween; 13577 time < 0 && (_reverting$1 || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); 13578 if (immediateRender) { 13579 if (dur && time <= 0 && tTime <= 0) { 13580 time && (tween._zTime = time); 13581 return; 13582 } 13583 } 13584 } else if (runBackwards && dur) { 13585 if (!prevStartAt) { 13586 time && (immediateRender = false); 13587 p2 = _setDefaults$1({ 13588 overwrite: false, 13589 data: "isFromStart", 13590 //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. 13591 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 13592 immediateRender, 13593 //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) 13594 stagger: 0, 13595 parent 13596 //ensures that nested tweens that had a stagger are handled properly, like gsap.from(".class", {y: gsap.utils.wrap([-100,100]), stagger: 0.5}) 13597 }, cleanVars); 13598 harnessVars && (p2[harness.prop] = harnessVars); 13599 _removeFromParent(tween._startAt = Tween.set(targets, p2)); 13600 tween._startAt._dp = 0; 13601 tween._startAt._sat = tween; 13602 time < 0 && (_reverting$1 ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 13603 tween._zTime = time; 13604 if (!immediateRender) { 13605 _initTween2(tween._startAt, _tinyNum, _tinyNum); 13606 } else if (!time) { 13607 return; 13608 } 13609 } 13610 } 13611 tween._pt = tween._ptCache = 0; 13612 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 13613 for (i2 = 0; i2 < targets.length; i2++) { 13614 target = targets[i2]; 13615 gsData = target._gsap || _harness(targets)[i2]._gsap; 13616 tween._ptLookup[i2] = ptLookup = {}; 13617 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); 13618 index3 = fullTargets === targets ? i2 : fullTargets.indexOf(target); 13619 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index3, fullTargets) !== false) { 13620 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 13621 plugin._props.forEach(function(name) { 13622 ptLookup[name] = pt; 13623 }); 13624 plugin.priority && (hasPriority = 1); 13625 } 13626 if (!harness || harnessVars) { 13627 for (p2 in cleanVars) { 13628 if (_plugins[p2] && (plugin = _checkPlugin(p2, cleanVars, tween, index3, target, fullTargets))) { 13629 plugin.priority && (hasPriority = 1); 13630 } else { 13631 ptLookup[p2] = pt = _addPropTween.call(tween, target, p2, "get", cleanVars[p2], index3, fullTargets, 0, vars.stringFilter); 13632 } 13633 } 13634 } 13635 tween._op && tween._op[i2] && tween.kill(target, tween._op[i2]); 13636 if (autoOverwrite && tween._pt) { 13637 _overwritingTween = tween; 13638 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); 13639 overwritten = !tween.parent; 13640 _overwritingTween = 0; 13641 } 13642 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 13643 } 13644 hasPriority && _sortPropTweensByPriority(tween); 13645 tween._onInit && tween._onInit(tween); 13646 } 13647 tween._onUpdate = onUpdate; 13648 tween._initted = (!tween._op || tween._pt) && !overwritten; 13649 keyframes && time <= 0 && tl.render(_bigNum$2, true, true); 13650}, _updatePropTweens = function _updatePropTweens2(tween, property, value, start2, startIsRelative, ratio, time, skipRecursion) { 13651 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, rootPT, lookup, i2; 13652 if (!ptCache) { 13653 ptCache = tween._ptCache[property] = []; 13654 lookup = tween._ptLookup; 13655 i2 = tween._targets.length; 13656 while (i2--) { 13657 pt = lookup[i2][property]; 13658 if (pt && pt.d && pt.d._pt) { 13659 pt = pt.d._pt; 13660 while (pt && pt.p !== property && pt.fp !== property) { 13661 pt = pt._next; 13662 } 13663 } 13664 if (!pt) { 13665 _forceAllPropTweens = 1; 13666 tween.vars[property] = "+=0"; 13667 _initTween(tween, time); 13668 _forceAllPropTweens = 0; 13669 return skipRecursion ? _warn(property + " not eligible for reset") : 1; 13670 } 13671 ptCache.push(pt); 13672 } 13673 } 13674 i2 = ptCache.length; 13675 while (i2--) { 13676 rootPT = ptCache[i2]; 13677 pt = rootPT._pt || rootPT; 13678 pt.s = (start2 || start2 === 0) && !startIsRelative ? start2 : pt.s + (start2 || 0) + ratio * pt.c; 13679 pt.c = value - pt.s; 13680 rootPT.e && (rootPT.e = _round$4(value) + getUnit(rootPT.e)); 13681 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); 13682 } 13683}, _addAliasesToVars = function _addAliasesToVars2(targets, vars) { 13684 var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p2, i2, aliases; 13685 if (!propertyAliases) { 13686 return vars; 13687 } 13688 copy = _merge$1({}, vars); 13689 for (p2 in propertyAliases) { 13690 if (p2 in copy) { 13691 aliases = propertyAliases[p2].split(","); 13692 i2 = aliases.length; 13693 while (i2--) { 13694 copy[aliases[i2]] = copy[p2]; 13695 } 13696 } 13697 } 13698 return copy; 13699}, _parseKeyframe = function _parseKeyframe2(prop, obj, allProps, easeEach) { 13700 var ease = obj.ease || easeEach || "power1.inOut", p2, a2; 13701 if (_isArray(obj)) { 13702 a2 = allProps[prop] || (allProps[prop] = []);
vendor: 4,122 bytes, lines 13703-13784
13703 obj.forEach(function(value, i2) { 13704 return a2.push({ 13705 t: i2 / (obj.length - 1) * 100, 13706 v: value, 13707 e: ease 13708 }); 13709 }); 13710 } else { 13711 for (p2 in obj) { 13712 a2 = allProps[p2] || (allProps[p2] = []); 13713 p2 === "ease" || a2.push({ 13714 t: parseFloat(prop), 13715 v: obj[p2], 13716 e: ease 13717 }); 13718 } 13719 } 13720}, _parseFuncOrString = function _parseFuncOrString2(value, tween, i2, target, targets) { 13721 return _isFunction$3(value) ? value.call(tween, i2, target, targets) : _isString$3(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 13722}, _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", _staggerPropsToSkip = {}; 13723_forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) { 13724 return _staggerPropsToSkip[name] = 1; 13725}); 13726var Tween = /* @__PURE__ */ function(_Animation2) { 13727 _inheritsLoose(Tween2, _Animation2); 13728 function Tween2(targets, vars, position, skipInherit) { 13729 var _this3; 13730 if (typeof vars === "number") { 13731 position.duration = vars; 13732 vars = position; 13733 position = null; 13734 } 13735 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 13736 var _this3$vars = _this3.vars, duration = _this3$vars.duration, delay = _this3$vars.delay, immediateRender = _this3$vars.immediateRender, stagger = _this3$vars.stagger, overwrite = _this3$vars.overwrite, keyframes = _this3$vars.keyframes, defaults3 = _this3$vars.defaults, scrollTrigger = _this3$vars.scrollTrigger, yoyoEase = _this3$vars.yoyoEase, parent = vars.parent || _globalTimeline, parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber$2(targets[0]) : "length" in vars) ? [targets] : toArray$1(targets), tl, i2, copy, l2, p2, curTarget, staggerFunc, staggerVarsToMerge; 13737 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config$1.nullTargetWarn) || []; 13738 _this3._ptLookup = []; 13739 _this3._overwrite = overwrite; 13740 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 13741 vars = _this3.vars; 13742 tl = _this3.timeline = new Timeline({ 13743 data: "nested", 13744 defaults: defaults3 || {}, 13745 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 13746 }); 13747 tl.kill(); 13748 tl.parent = tl._dp = _assertThisInitialized$6(_this3); 13749 tl._start = 0; 13750 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 13751 l2 = parsedTargets.length; 13752 staggerFunc = stagger && distribute(stagger); 13753 if (_isObject$1(stagger)) { 13754 for (p2 in stagger) { 13755 if (~_staggerTweenProps.indexOf(p2)) { 13756 staggerVarsToMerge || (staggerVarsToMerge = {}); 13757 staggerVarsToMerge[p2] = stagger[p2]; 13758 } 13759 } 13760 } 13761 for (i2 = 0; i2 < l2; i2++) { 13762 copy = _copyExcluding(vars, _staggerPropsToSkip); 13763 copy.stagger = 0; 13764 yoyoEase && (copy.yoyoEase = yoyoEase); 13765 staggerVarsToMerge && _merge$1(copy, staggerVarsToMerge); 13766 curTarget = parsedTargets[i2]; 13767 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized$6(_this3), i2, curTarget, parsedTargets); 13768 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized$6(_this3), i2, curTarget, parsedTargets) || 0) - _this3._delay; 13769 if (!stagger && l2 === 1 && copy.delay) { 13770 _this3._delay = delay = copy.delay; 13771 _this3._start += delay; 13772 copy.delay = 0; 13773 } 13774 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i2, curTarget, parsedTargets) : 0); 13775 tl._ease = _easeMap.none; 13776 } 13777 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; 13778 } else if (keyframes) { 13779 _inheritDefaults(_setDefaults$1(tl.vars.defaults, { 13780 ease: "none" 13781 })); 13782 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 13783 var time = 0, a2, kf, v2; 13784 if (_isArray(keyframes)) {
vendor: 10,752 bytes, lines 13785-14057
13785 keyframes.forEach(function(frame) { 13786 return tl.to(parsedTargets, frame, ">"); 13787 }); 13788 tl.duration(); 13789 } else { 13790 copy = {}; 13791 for (p2 in keyframes) { 13792 p2 === "ease" || p2 === "easeEach" || _parseKeyframe(p2, keyframes[p2], copy, keyframes.easeEach); 13793 } 13794 for (p2 in copy) { 13795 a2 = copy[p2].sort(function(a3, b2) { 13796 return a3.t - b2.t; 13797 }); 13798 time = 0; 13799 for (i2 = 0; i2 < a2.length; i2++) { 13800 kf = a2[i2]; 13801 v2 = { 13802 ease: kf.e, 13803 duration: (kf.t - (i2 ? a2[i2 - 1].t : 0)) / 100 * duration 13804 }; 13805 v2[p2] = kf.v; 13806 tl.to(parsedTargets, v2, time); 13807 time += v2.duration; 13808 } 13809 } 13810 tl.duration() < duration && tl.to({}, { 13811 duration: duration - tl.duration() 13812 }); 13813 } 13814 } 13815 duration || _this3.duration(duration = tl.duration()); 13816 } else { 13817 _this3.timeline = 0; 13818 } 13819 if (overwrite === true && !_suppressOverwrites$1) { 13820 _overwritingTween = _assertThisInitialized$6(_this3); 13821 _globalTimeline.killTweensOf(parsedTargets); 13822 _overwritingTween = 0; 13823 } 13824 _addToTimeline(parent, _assertThisInitialized$6(_this3), position); 13825 vars.reversed && _this3.reverse(); 13826 vars.paused && _this3.paused(true); 13827 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized$6(_this3)) && parent.data !== "nested") { 13828 _this3._tTime = -_tinyNum; 13829 _this3.render(Math.max(0, -delay) || 0); 13830 } 13831 scrollTrigger && _scrollTrigger(_assertThisInitialized$6(_this3), scrollTrigger); 13832 return _this3; 13833 } 13834 var _proto3 = Tween2.prototype; 13835 _proto3.render = function render6(totalTime, suppressEvents, force) { 13836 var prevTime = this._time, tDur = this._tDur, dur = this._dur, isNegative = totalTime < 0, tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, time, pt, iteration, cycleDuration, prevIteration, isYoyo, ratio, timeline2, yoyoEase; 13837 if (!dur) { 13838 _renderZeroDurationTween(this, totalTime, suppressEvents, force); 13839 } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) { 13840 time = tTime; 13841 timeline2 = this.timeline; 13842 if (this._repeat) { 13843 cycleDuration = dur + this._rDelay; 13844 if (this._repeat < -1 && isNegative) { 13845 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 13846 } 13847 time = _roundPrecise(tTime % cycleDuration); 13848 if (tTime === tDur) { 13849 iteration = this._repeat; 13850 time = dur; 13851 } else { 13852 iteration = ~~(tTime / cycleDuration); 13853 if (iteration && iteration === _roundPrecise(tTime / cycleDuration)) { 13854 time = dur; 13855 iteration--; 13856 } 13857 time > dur && (time = dur); 13858 } 13859 isYoyo = this._yoyo && iteration & 1; 13860 if (isYoyo) { 13861 yoyoEase = this._yEase; 13862 time = dur - time; 13863 } 13864 prevIteration = _animationCycle(this._tTime, cycleDuration); 13865 if (time === prevTime && !force && this._initted && iteration === prevIteration) { 13866 this._tTime = tTime; 13867 return this; 13868 } 13869 if (iteration !== prevIteration) { 13870 timeline2 && this._yEase && _propagateYoyoEase(timeline2, isYoyo); 13871 if (this.vars.repeatRefresh && !isYoyo && !this._lock && this._time !== cycleDuration && this._initted) { 13872 this._lock = force = 1; 13873 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 13874 } 13875 } 13876 } 13877 if (!this._initted) { 13878 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 13879 this._tTime = 0; 13880 return this; 13881 } 13882 if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) { 13883 return this; 13884 } 13885 if (dur !== this._dur) { 13886 return this.render(totalTime, suppressEvents, force); 13887 } 13888 } 13889 this._tTime = tTime; 13890 this._time = time; 13891 if (!this._act && this._ts) { 13892 this._act = 1; 13893 this._lazy = 0; 13894 } 13895 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 13896 if (this._from) { 13897 this.ratio = ratio = 1 - ratio; 13898 } 13899 if (time && !prevTime && !suppressEvents && !iteration) { 13900 _callback$1(this, "onStart"); 13901 if (this._tTime !== tTime) { 13902 return this; 13903 } 13904 } 13905 pt = this._pt; 13906 while (pt) { 13907 pt.r(ratio, pt.d); 13908 pt = pt._next; 13909 } 13910 timeline2 && timeline2.render(totalTime < 0 ? totalTime : timeline2._dur * timeline2._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 13911 if (this._onUpdate && !suppressEvents) { 13912 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); 13913 _callback$1(this, "onUpdate"); 13914 } 13915 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback$1(this, "onRepeat"); 13916 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 13917 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 13918 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 13919 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 13920 _callback$1(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 13921 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 13922 } 13923 } 13924 } 13925 return this; 13926 }; 13927 _proto3.targets = function targets() { 13928 return this._targets; 13929 }; 13930 _proto3.invalidate = function invalidate(soft) { 13931 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 13932 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 13933 this._ptLookup = []; 13934 this.timeline && this.timeline.invalidate(soft); 13935 return _Animation2.prototype.invalidate.call(this, soft); 13936 }; 13937 _proto3.resetTo = function resetTo(property, value, start2, startIsRelative, skipRecursion) { 13938 _tickerActive || _ticker.wake(); 13939 this._ts || this.play(); 13940 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio; 13941 this._initted || _initTween(this, time); 13942 ratio = this._ease(time / this._dur); 13943 if (_updatePropTweens(this, property, value, start2, startIsRelative, ratio, time, skipRecursion)) { 13944 return this.resetTo(property, value, start2, startIsRelative, 1); 13945 } 13946 _alignPlayhead(this, 0); 13947 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 13948 return this.render(0); 13949 }; 13950 _proto3.kill = function kill3(targets, vars) { 13951 if (vars === void 0) { 13952 vars = "all"; 13953 } 13954 if (!targets && (!vars || vars === "all")) { 13955 this._lazy = this._pt = 0; 13956 return this.parent ? _interrupt$1(this) : this; 13957 } 13958 if (this.timeline) { 13959 var tDur = this.timeline.totalDuration(); 13960 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt$1(this); 13961 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); 13962 return this; 13963 } 13964 var parsedTargets = this._targets, killingTargets = targets ? toArray$1(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p2, pt, i2; 13965 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 13966 vars === "all" && (this._pt = 0); 13967 return _interrupt$1(this); 13968 } 13969 overwrittenProps = this._op = this._op || []; 13970 if (vars !== "all") { 13971 if (_isString$3(vars)) { 13972 p2 = {}; 13973 _forEachName(vars, function(name) { 13974 return p2[name] = 1; 13975 }); 13976 vars = p2; 13977 } 13978 vars = _addAliasesToVars(parsedTargets, vars); 13979 } 13980 i2 = parsedTargets.length; 13981 while (i2--) { 13982 if (~killingTargets.indexOf(parsedTargets[i2])) { 13983 curLookup = propTweenLookup[i2]; 13984 if (vars === "all") { 13985 overwrittenProps[i2] = vars; 13986 props = curLookup; 13987 curOverwriteProps = {}; 13988 } else { 13989 curOverwriteProps = overwrittenProps[i2] = overwrittenProps[i2] || {}; 13990 props = vars; 13991 } 13992 for (p2 in props) { 13993 pt = curLookup && curLookup[p2]; 13994 if (pt) { 13995 if (!("kill" in pt.d) || pt.d.kill(p2) === true) { 13996 _removeLinkedListItem(this, pt, "_pt"); 13997 } 13998 delete curLookup[p2]; 13999 } 14000 if (curOverwriteProps !== "all") { 14001 curOverwriteProps[p2] = 1; 14002 } 14003 } 14004 } 14005 } 14006 this._initted && !this._pt && firstPT && _interrupt$1(this); 14007 return this; 14008 }; 14009 Tween2.to = function to(targets, vars) { 14010 return new Tween2(targets, vars, arguments[2]); 14011 }; 14012 Tween2.from = function from(targets, vars) { 14013 return _createTweenType(1, arguments); 14014 }; 14015 Tween2.delayedCall = function delayedCall(delay, callback, params, scope) { 14016 return new Tween2(callback, 0, { 14017 immediateRender: false, 14018 lazy: false, 14019 overwrite: false, 14020 delay, 14021 onComplete: callback, 14022 onReverseComplete: callback, 14023 onCompleteParams: params, 14024 onReverseCompleteParams: params, 14025 callbackScope: scope 14026 }); 14027 }; 14028 Tween2.fromTo = function fromTo(targets, fromVars, toVars) { 14029 return _createTweenType(2, arguments); 14030 }; 14031 Tween2.set = function set(targets, vars) { 14032 vars.duration = 0; 14033 vars.repeatDelay || (vars.repeat = 0); 14034 return new Tween2(targets, vars); 14035 }; 14036 Tween2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 14037 return _globalTimeline.killTweensOf(targets, props, onlyActive); 14038 }; 14039 return Tween2; 14040}(Animation); 14041_setDefaults$1(Tween.prototype, { 14042 _targets: [], 14043 _lazy: 0, 14044 _startAt: 0, 14045 _op: 0, 14046 _onInit: 0 14047}); 14048_forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) { 14049 Tween[name] = function() { 14050 var tl = new Timeline(), params = _slice.call(arguments, 0); 14051 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 14052 return tl[name].apply(tl, params); 14053 }; 14054}); 14055var _setterPlain = function _setterPlain2(target, property, value) { 14056 return target[property] = value; 14057}
vendor: 14,223 bytes, lines 14057-14455
14057, _setterFunc = function _setterFunc2(target, property, value) { 14058 return target[property](value); 14059}, _setterFuncWithParam = function _setterFuncWithParam2(target, property, value, data) { 14060 return target[property](data.fp, value); 14061}, _setterAttribute = function _setterAttribute2(target, property, value) { 14062 return target.setAttribute(property, value); 14063}, _getSetter = function _getSetter2(target, property) { 14064 return _isFunction$3(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 14065}, _renderPlain = function _renderPlain2(ratio, data) { 14066 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e6) / 1e6, data); 14067}, _renderBoolean = function _renderBoolean2(ratio, data) { 14068 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 14069}, _renderComplexString = function _renderComplexString2(ratio, data) { 14070 var pt = data._pt, s2 = ""; 14071 if (!ratio && data.b) { 14072 s2 = data.b; 14073 } else if (ratio === 1 && data.e) { 14074 s2 = data.e; 14075 } else { 14076 while (pt) { 14077 s2 = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 1e4) / 1e4) + s2; 14078 pt = pt._next; 14079 } 14080 s2 += data.c; 14081 } 14082 data.set(data.t, data.p, s2, data); 14083}, _renderPropTweens = function _renderPropTweens2(ratio, data) { 14084 var pt = data._pt; 14085 while (pt) { 14086 pt.r(ratio, pt.d); 14087 pt = pt._next; 14088 } 14089}, _addPluginModifier = function _addPluginModifier2(modifier, tween, target, property) { 14090 var pt = this._pt, next2; 14091 while (pt) { 14092 next2 = pt._next; 14093 pt.p === property && pt.modifier(modifier, tween, target); 14094 pt = next2; 14095 } 14096}, _killPropTweensOf = function _killPropTweensOf2(property) { 14097 var pt = this._pt, hasNonDependentRemaining, next2; 14098 while (pt) { 14099 next2 = pt._next; 14100 if (pt.p === property && !pt.op || pt.op === property) { 14101 _removeLinkedListItem(this, pt, "_pt"); 14102 } else if (!pt.dep) { 14103 hasNonDependentRemaining = 1; 14104 } 14105 pt = next2; 14106 } 14107 return !hasNonDependentRemaining; 14108}, _setterWithModifier = function _setterWithModifier2(target, property, value, data) { 14109 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 14110}, _sortPropTweensByPriority = function _sortPropTweensByPriority2(parent) { 14111 var pt = parent._pt, next2, pt2, first2, last2; 14112 while (pt) { 14113 next2 = pt._next; 14114 pt2 = first2; 14115 while (pt2 && pt2.pr > pt.pr) { 14116 pt2 = pt2._next; 14117 } 14118 if (pt._prev = pt2 ? pt2._prev : last2) { 14119 pt._prev._next = pt; 14120 } else { 14121 first2 = pt; 14122 } 14123 if (pt._next = pt2) { 14124 pt2._prev = pt; 14125 } else { 14126 last2 = pt; 14127 } 14128 pt = next2; 14129 } 14130 parent._pt = first2; 14131}; 14132var PropTween = /* @__PURE__ */ function() { 14133 function PropTween2(next2, target, prop, start2, change, renderer9, data, setter, priority) { 14134 this.t = target; 14135 this.s = start2; 14136 this.c = change; 14137 this.p = prop; 14138 this.r = renderer9 || _renderPlain; 14139 this.d = data || this; 14140 this.set = setter || _setterPlain; 14141 this.pr = priority || 0; 14142 this._next = next2; 14143 if (next2) { 14144 next2._prev = this; 14145 } 14146 } 14147 var _proto4 = PropTween2.prototype; 14148 _proto4.modifier = function modifier(func, tween, target) { 14149 this.mSet = this.mSet || this.set; 14150 this.set = _setterWithModifier; 14151 this.m = func; 14152 this.mt = target; 14153 this.tween = tween; 14154 }; 14155 return PropTween2; 14156}(); 14157_forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function(name) { 14158 return _reservedProps[name] = 1; 14159}); 14160_globals.TweenMax = _globals.TweenLite = Tween; 14161_globals.TimelineLite = _globals.TimelineMax = Timeline; 14162_globalTimeline = new Timeline({ 14163 sortChildren: false, 14164 defaults: _defaults$1, 14165 autoRemoveChildren: true, 14166 id: "root", 14167 smoothChildTiming: true 14168}); 14169_config$1.stringFilter = _colorStringFilter; 14170var _media = [], _listeners$1 = {}, _emptyArray$1 = [], _lastMediaTime = 0, _contextID = 0, _dispatch$1 = function _dispatch(type) { 14171 return (_listeners$1[type] || _emptyArray$1).map(function(f2) { 14172 return f2(); 14173 }); 14174}, _onMediaChange = function _onMediaChange2() { 14175 var time = Date.now(), matches = []; 14176 if (time - _lastMediaTime > 2) { 14177 _dispatch$1("matchMediaInit"); 14178 _media.forEach(function(c2) { 14179 var queries = c2.queries, conditions = c2.conditions, match, p2, anyMatch, toggled; 14180 for (p2 in queries) { 14181 match = _win$6.matchMedia(queries[p2]).matches; 14182 match && (anyMatch = 1); 14183 if (match !== conditions[p2]) { 14184 conditions[p2] = match; 14185 toggled = 1; 14186 } 14187 } 14188 if (toggled) { 14189 c2.revert(); 14190 anyMatch && matches.push(c2); 14191 } 14192 }); 14193 _dispatch$1("matchMediaRevert"); 14194 matches.forEach(function(c2) { 14195 return c2.onMatch(c2, function(func) { 14196 return c2.add(null, func); 14197 }); 14198 }); 14199 _lastMediaTime = time; 14200 _dispatch$1("matchMedia"); 14201 } 14202}; 14203var Context$1 = /* @__PURE__ */ function() { 14204 function Context2(func, scope) { 14205 this.selector = scope && selector(scope); 14206 this.data = []; 14207 this._r = []; 14208 this.isReverted = false; 14209 this.id = _contextID++; 14210 func && this.add(func); 14211 } 14212 var _proto5 = Context2.prototype; 14213 _proto5.add = function add2(name, func, scope) { 14214 if (_isFunction$3(name)) { 14215 scope = func; 14216 func = name; 14217 name = _isFunction$3; 14218 } 14219 var self2 = this, f2 = function f3() { 14220 var prev = _context$4, prevSelector = self2.selector, result; 14221 prev && prev !== self2 && prev.data.push(self2); 14222 scope && (self2.selector = selector(scope)); 14223 _context$4 = self2; 14224 result = func.apply(self2, arguments); 14225 _isFunction$3(result) && self2._r.push(result); 14226 _context$4 = prev; 14227 self2.selector = prevSelector; 14228 self2.isReverted = false; 14229 return result; 14230 }; 14231 self2.last = f2; 14232 return name === _isFunction$3 ? f2(self2, function(func2) { 14233 return self2.add(null, func2); 14234 }) : name ? self2[name] = f2 : f2; 14235 }; 14236 _proto5.ignore = function ignore(func) { 14237 var prev = _context$4; 14238 _context$4 = null; 14239 func(this); 14240 _context$4 = prev; 14241 }; 14242 _proto5.getTweens = function getTweens() { 14243 var a2 = []; 14244 this.data.forEach(function(e2) { 14245 return e2 instanceof Context2 ? a2.push.apply(a2, e2.getTweens()) : e2 instanceof Tween && !(e2.parent && e2.parent.data === "nested") && a2.push(e2); 14246 }); 14247 return a2; 14248 }; 14249 _proto5.clear = function clear() { 14250 this._r.length = this.data.length = 0; 14251 }; 14252 _proto5.kill = function kill3(revert, matchMedia2) { 14253 var _this4 = this; 14254 if (revert) { 14255 (function() { 14256 var tweens = _this4.getTweens(), i3 = _this4.data.length, t2; 14257 while (i3--) { 14258 t2 = _this4.data[i3]; 14259 if (t2.data === "isFlip") { 14260 t2.revert(); 14261 t2.getChildren(true, true, false).forEach(function(tween) { 14262 return tweens.splice(tweens.indexOf(tween), 1); 14263 }); 14264 } 14265 } 14266 tweens.map(function(t3) { 14267 return { 14268 g: t3._dur || t3._delay || t3._sat && !t3._sat.vars.immediateRender ? t3.globalTime(0) : -Infinity, 14269 t: t3 14270 }; 14271 }).sort(function(a2, b2) { 14272 return b2.g - a2.g || -Infinity; 14273 }).forEach(function(o2) { 14274 return o2.t.revert(revert); 14275 }); 14276 i3 = _this4.data.length; 14277 while (i3--) { 14278 t2 = _this4.data[i3]; 14279 if (t2 instanceof Timeline) { 14280 if (t2.data !== "nested") { 14281 t2.scrollTrigger && t2.scrollTrigger.revert(); 14282 t2.kill(); 14283 } 14284 } else { 14285 !(t2 instanceof Tween) && t2.revert && t2.revert(revert); 14286 } 14287 } 14288 _this4._r.forEach(function(f2) { 14289 return f2(revert, _this4); 14290 }); 14291 _this4.isReverted = true; 14292 })(); 14293 } else { 14294 this.data.forEach(function(e2) { 14295 return e2.kill && e2.kill(); 14296 }); 14297 } 14298 this.clear(); 14299 if (matchMedia2) { 14300 var i2 = _media.length; 14301 while (i2--) { 14302 _media[i2].id === this.id && _media.splice(i2, 1); 14303 } 14304 } 14305 }; 14306 _proto5.revert = function revert(config4) { 14307 this.kill(config4 || {}); 14308 }; 14309 return Context2; 14310}(); 14311var MatchMedia = /* @__PURE__ */ function() { 14312 function MatchMedia2(scope) { 14313 this.contexts = []; 14314 this.scope = scope; 14315 _context$4 && _context$4.data.push(this); 14316 } 14317 var _proto6 = MatchMedia2.prototype; 14318 _proto6.add = function add2(conditions, func, scope) { 14319 _isObject$1(conditions) || (conditions = { 14320 matches: conditions 14321 }); 14322 var context3 = new Context$1(0, scope || this.scope), cond = context3.conditions = {}, mq, p2, active; 14323 _context$4 && !context3.selector && (context3.selector = _context$4.selector); 14324 this.contexts.push(context3); 14325 func = context3.add("onMatch", func); 14326 context3.queries = conditions; 14327 for (p2 in conditions) { 14328 if (p2 === "all") { 14329 active = 1; 14330 } else { 14331 mq = _win$6.matchMedia(conditions[p2]); 14332 if (mq) { 14333 _media.indexOf(context3) < 0 && _media.push(context3); 14334 (cond[p2] = mq.matches) && (active = 1); 14335 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 14336 } 14337 } 14338 } 14339 active && func(context3, function(f2) { 14340 return context3.add(null, f2); 14341 }); 14342 return this; 14343 }; 14344 _proto6.revert = function revert(config4) { 14345 this.kill(config4 || {}); 14346 }; 14347 _proto6.kill = function kill3(revert) { 14348 this.contexts.forEach(function(c2) { 14349 return c2.kill(revert, true); 14350 }); 14351 }; 14352 return MatchMedia2; 14353}(); 14354var _gsap = { 14355 registerPlugin: function registerPlugin() { 14356 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 14357 args[_key2] = arguments[_key2]; 14358 } 14359 args.forEach(function(config4) { 14360 return _createPlugin(config4); 14361 }); 14362 }, 14363 timeline: function timeline(vars) { 14364 return new Timeline(vars); 14365 }, 14366 getTweensOf: function getTweensOf(targets, onlyActive) { 14367 return _globalTimeline.getTweensOf(targets, onlyActive); 14368 }, 14369 getProperty: function getProperty(target, property, unit, uncache) { 14370 _isString$3(target) && (target = toArray$1(target)[0]); 14371 var getter = _getCache(target || {}).get, format2 = unit ? _passThrough$1 : _numericIfPossible; 14372 unit === "native" && (unit = ""); 14373 return !target ? target : !property ? function(property2, unit2, uncache2) { 14374 return format2((_plugins[property2] && _plugins[property2].get || getter)(target, property2, unit2, uncache2)); 14375 } : format2((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 14376 }, 14377 quickSetter: function quickSetter(target, property, unit) { 14378 target = toArray$1(target); 14379 if (target.length > 1) { 14380 var setters = target.map(function(t2) { 14381 return gsap$8.quickSetter(t2, property, unit); 14382 }), l2 = setters.length; 14383 return function(value) { 14384 var i2 = l2; 14385 while (i2--) { 14386 setters[i2](value); 14387 } 14388 }; 14389 } 14390 target = target[0] || {}; 14391 var Plugin = _plugins[property], cache2 = _getCache(target), p2 = cache2.harness && (cache2.harness.aliases || {})[property] || property, setter = Plugin ? function(value) { 14392 var p3 = new Plugin(); 14393 _quickTween._pt = 0; 14394 p3.init(target, unit ? value + unit : value, _quickTween, 0, [target]); 14395 p3.render(1, p3); 14396 _quickTween._pt && _renderPropTweens(1, _quickTween); 14397 } : cache2.set(target, p2); 14398 return Plugin ? setter : function(value) { 14399 return setter(target, p2, unit ? value + unit : value, cache2, 1); 14400 }; 14401 }, 14402 quickTo: function quickTo(target, property, vars) { 14403 var _merge22; 14404 var tween = gsap$8.to(target, _merge$1((_merge22 = {}, _merge22[property] = "+=0.1", _merge22.paused = true, _merge22), vars || {})), func = function func2(value, start2, startIsRelative) { 14405 return tween.resetTo(property, value, start2, startIsRelative); 14406 }; 14407 func.tween = tween; 14408 return func; 14409 }, 14410 isTweening: function isTweening(targets) { 14411 return _globalTimeline.getTweensOf(targets, true).length > 0; 14412 }, 14413 defaults: function defaults(value) { 14414 value && value.ease && (value.ease = _parseEase(value.ease, _defaults$1.ease)); 14415 return _mergeDeep(_defaults$1, value || {}); 14416 }, 14417 config: function config3(value) { 14418 return _mergeDeep(_config$1, value || {}); 14419 }, 14420 registerEffect: function registerEffect(_ref3) { 14421 var name = _ref3.name, effect = _ref3.effect, plugins = _ref3.plugins, defaults3 = _ref3.defaults, extendTimeline = _ref3.extendTimeline; 14422 (plugins || "").split(",").forEach(function(pluginName) { 14423 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 14424 }); 14425 _effects[name] = function(targets, vars, tl) { 14426 return effect(toArray$1(targets), _setDefaults$1(vars || {}, defaults3), tl); 14427 }; 14428 if (extendTimeline) { 14429 Timeline.prototype[name] = function(targets, vars, position) { 14430 return this.add(_effects[name](targets, _isObject$1(vars) ? vars : (position = vars) && {}, this), position); 14431 }; 14432 } 14433 }, 14434 registerEase: function registerEase(name, ease) { 14435 _easeMap[name] = _parseEase(ease); 14436 }, 14437 parseEase: function parseEase(ease, defaultEase) { 14438 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 14439 }, 14440 getById: function getById(id2) { 14441 return _globalTimeline.getById(id2); 14442 }, 14443 exportRoot: function exportRoot(vars, includeDelayedCalls) { 14444 if (vars === void 0) { 14445 vars = {}; 14446 } 14447 var tl = new Timeline(vars), child, next2; 14448 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 14449 _globalTimeline.remove(tl); 14450 tl._dp = 0; 14451 tl._time = tl._tTime = _globalTimeline._time; 14452 child = _globalTimeline._first; 14453 while (child) { 14454 next2 = child._next; 14455 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
vendor: 2,190 bytes, lines 14456-14543
14456 _addToTimeline(tl, child, child._start - child._delay); 14457 } 14458 child = next2; 14459 } 14460 _addToTimeline(_globalTimeline, tl, 0); 14461 return tl; 14462 }, 14463 context: function context(func, scope) { 14464 return func ? new Context$1(func, scope) : _context$4; 14465 }, 14466 matchMedia: function matchMedia(scope) { 14467 return new MatchMedia(scope); 14468 }, 14469 matchMediaRefresh: function matchMediaRefresh() { 14470 return _media.forEach(function(c2) { 14471 var cond = c2.conditions, found, p2; 14472 for (p2 in cond) { 14473 if (cond[p2]) { 14474 cond[p2] = false; 14475 found = 1; 14476 } 14477 } 14478 found && c2.revert(); 14479 }) || _onMediaChange(); 14480 }, 14481 addEventListener: function addEventListener2(type, callback) { 14482 var a2 = _listeners$1[type] || (_listeners$1[type] = []); 14483 ~a2.indexOf(callback) || a2.push(callback); 14484 }, 14485 removeEventListener: function removeEventListener2(type, callback) { 14486 var a2 = _listeners$1[type], i2 = a2 && a2.indexOf(callback); 14487 i2 >= 0 && a2.splice(i2, 1); 14488 }, 14489 utils: { 14490 wrap, 14491 wrapYoyo, 14492 distribute, 14493 random, 14494 snap, 14495 normalize, 14496 getUnit, 14497 clamp, 14498 splitColor, 14499 toArray: toArray$1, 14500 selector, 14501 mapRange, 14502 pipe, 14503 unitize, 14504 interpolate, 14505 shuffle 14506 }, 14507 install: _install, 14508 effects: _effects, 14509 ticker: _ticker, 14510 updateRoot: Timeline.updateRoot, 14511 plugins: _plugins, 14512 globalTimeline: _globalTimeline, 14513 core: { 14514 PropTween, 14515 globals: _addGlobal, 14516 Tween, 14517 Timeline, 14518 Animation, 14519 getCache: _getCache, 14520 _removeLinkedListItem, 14521 reverting: function reverting() { 14522 return _reverting$1; 14523 }, 14524 context: function context2(toAdd) { 14525 if (toAdd && _context$4) { 14526 _context$4.data.push(toAdd); 14527 toAdd._ctx = _context$4; 14528 } 14529 return _context$4; 14530 }, 14531 suppressOverwrites: function suppressOverwrites(value) { 14532 return _suppressOverwrites$1 = value; 14533 } 14534 } 14535}; 14536_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) { 14537 return _gsap[name] = Tween[name]; 14538}); 14539_ticker.add(Timeline.updateRoot); 14540_quickTween = _gsap.to({}, { 14541 duration: 0 14542}); 14543var _getPluginPropTween = function _getPluginPropTween2(plugin, prop
vendor: 20,660 bytes, lines 14543-15038
14543) { 14544 var pt = plugin._pt; 14545 while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { 14546 pt = pt._next; 14547 } 14548 return pt; 14549}, _addModifiers = function _addModifiers2(tween, modifiers) { 14550 var targets = tween._targets, p2, i2, pt; 14551 for (p2 in modifiers) { 14552 i2 = targets.length; 14553 while (i2--) { 14554 pt = tween._ptLookup[i2][p2]; 14555 if (pt && (pt = pt.d)) { 14556 if (pt._pt) { 14557 pt = _getPluginPropTween(pt, p2); 14558 } 14559 pt && pt.modifier && pt.modifier(modifiers[p2], tween, targets[i2], p2); 14560 } 14561 } 14562 } 14563}, _buildModifierPlugin = function _buildModifierPlugin2(name, modifier) { 14564 return { 14565 name, 14566 rawVars: 1, 14567 //don't pre-process function-based values or "random()" strings. 14568 init: function init7(target, vars, tween) { 14569 tween._onInit = function(tween2) { 14570 var temp, p2; 14571 if (_isString$3(vars)) { 14572 temp = {}; 14573 _forEachName(vars, function(name2) { 14574 return temp[name2] = 1; 14575 }); 14576 vars = temp; 14577 } 14578 if (modifier) { 14579 temp = {}; 14580 for (p2 in vars) { 14581 temp[p2] = modifier(vars[p2]); 14582 } 14583 vars = temp; 14584 } 14585 _addModifiers(tween2, vars); 14586 }; 14587 } 14588 }; 14589}; 14590var gsap$8 = _gsap.registerPlugin({ 14591 name: "attr", 14592 init: function init(target, vars, tween, index3, targets) { 14593 var p2, pt, v2; 14594 this.tween = tween; 14595 for (p2 in vars) { 14596 v2 = target.getAttribute(p2) || ""; 14597 pt = this.add(target, "setAttribute", (v2 || 0) + "", vars[p2], index3, targets, 0, 0, p2); 14598 pt.op = p2; 14599 pt.b = v2; 14600 this._props.push(p2); 14601 } 14602 }, 14603 render: function render(ratio, data) { 14604 var pt = data._pt; 14605 while (pt) { 14606 _reverting$1 ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); 14607 pt = pt._next; 14608 } 14609 } 14610}, { 14611 name: "endArray", 14612 init: function init2(target, value) { 14613 var i2 = value.length; 14614 while (i2--) { 14615 this.add(target, i2, target[i2] || 0, value[i2], 0, 0, 0, 0, 0, 1); 14616 } 14617 } 14618}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; 14619Tween.version = Timeline.version = gsap$8.version = "3.12.5"; 14620_coreReady = 1; 14621_windowExists$4() && _wake(); 14622_easeMap.Power0; 14623_easeMap.Power1; 14624_easeMap.Power2; 14625_easeMap.Power3; 14626_easeMap.Power4; 14627_easeMap.Linear; 14628_easeMap.Quad; 14629_easeMap.Cubic; 14630_easeMap.Quart; 14631_easeMap.Quint; 14632_easeMap.Strong; 14633_easeMap.Elastic; 14634_easeMap.Back; 14635_easeMap.SteppedEase; 14636_easeMap.Bounce; 14637_easeMap.Sine; 14638_easeMap.Expo; 14639_easeMap.Circ; 14640/*! 14641 * CSSPlugin 3.12.5 14642 * https://gsap.com 14643 * 14644 * Copyright 2008-2024, GreenSock. All rights reserved. 14645 * Subject to the terms at https://gsap.com/standard-license or for 14646 * Club GSAP members, the agreement issued with that membership. 14647 * @author: Jack Doyle, [email protected] 14648*/ 14649var _win$5, _doc$5, _docElement$1, _pluginInitted, _tempDiv$1, _recentSetterPlugin, _reverting, _windowExists$3 = function _windowExists2() { 14650 return typeof window !== "undefined"; 14651}, _transformProps = {}, _RAD2DEG$1 = 180 / Math.PI, _DEG2RAD$2 = Math.PI / 180, _atan2$1 = Math.atan2, _bigNum$1 = 1e8, _capsExp$1 = /([A-Z])/g, _horizontalExp = /(left|right|width|margin|padding|x)/i, _complexExp = /[\s,\(]\S/, _propertyAliases = { 14652 autoAlpha: "opacity,visibility", 14653 scale: "scaleX,scaleY", 14654 alpha: "opacity" 14655}, _renderCSSProp = function _renderCSSProp2(ratio, data) { 14656 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data); 14657}, _renderPropWithEnd = function _renderPropWithEnd2(ratio, data) { 14658 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data); 14659}, _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning2(ratio, data) { 14660 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u : data.b, data); 14661}, _renderRoundedCSSProp = function _renderRoundedCSSProp2(ratio, data) { 14662 var value = data.s + data.c * ratio; 14663 data.set(data.t, data.p, ~~(value + (value < 0 ? -0.5 : 0.5)) + data.u, data); 14664}, _renderNonTweeningValue = function _renderNonTweeningValue2(ratio, data) { 14665 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 14666}, _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd2(ratio, data) { 14667 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 14668}, _setterCSSStyle = function _setterCSSStyle2(target, property, value) { 14669 return target.style[property] = value; 14670}, _setterCSSProp = function _setterCSSProp2(target, property, value) { 14671 return target.style.setProperty(property, value); 14672}, _setterTransform = function _setterTransform2(target, property, value) { 14673 return target._gsap[property] = value; 14674}, _setterScale = function _setterScale2(target, property, value) { 14675 return target._gsap.scaleX = target._gsap.scaleY = value; 14676}, _setterScaleWithRender = function _setterScaleWithRender2(target, property, value, data, ratio) { 14677 var cache2 = target._gsap; 14678 cache2.scaleX = cache2.scaleY = value; 14679 cache2.renderTransform(ratio, cache2); 14680}, _setterTransformWithRender = function _setterTransformWithRender2(target, property, value, data, ratio) { 14681 var cache2 = target._gsap; 14682 cache2[property] = value; 14683 cache2.renderTransform(ratio, cache2); 14684}, _transformProp$2 = "transform", _transformOriginProp$1 = _transformProp$2 + "Origin", _saveStyle = function _saveStyle2(property, isNotCSS) { 14685 var _this = this; 14686 var target = this.target, style = target.style, cache2 = target._gsap; 14687 if (property in _transformProps && style) { 14688 this.tfm = this.tfm || {}; 14689 if (property !== "transform") { 14690 property = _propertyAliases[property] || property; 14691 ~property.indexOf(",") ? property.split(",").forEach(function(a2) { 14692 return _this.tfm[a2] = _get(target, a2); 14693 }) : this.tfm[property] = cache2.x ? cache2[property] : _get(target, property); 14694 property === _transformOriginProp$1 && (this.tfm.zOrigin = cache2.zOrigin); 14695 } else { 14696 return _propertyAliases.transform.split(",").forEach(function(p2) { 14697 return _saveStyle2.call(_this, p2, isNotCSS); 14698 }); 14699 } 14700 if (this.props.indexOf(_transformProp$2) >= 0) { 14701 return; 14702 } 14703 if (cache2.svg) { 14704 this.svgo = target.getAttribute("data-svg-origin"); 14705 this.props.push(_transformOriginProp$1, isNotCSS, ""); 14706 } 14707 property = _transformProp$2; 14708 } 14709 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 14710}, _removeIndependentTransforms = function _removeIndependentTransforms2(style) { 14711 if (style.translate) { 14712 style.removeProperty("translate"); 14713 style.removeProperty("scale"); 14714 style.removeProperty("rotate"); 14715 } 14716}, _revertStyle = function _revertStyle2() { 14717 var props = this.props, target = this.target, style = target.style, cache2 = target._gsap, i2, p2; 14718 for (i2 = 0; i2 < props.length; i2 += 3) { 14719 props[i2 + 1] ? target[props[i2]] = props[i2 + 2] : props[i2 + 2] ? style[props[i2]] = props[i2 + 2] : style.removeProperty(props[i2].substr(0, 2) === "--" ? props[i2] : props[i2].replace(_capsExp$1, "-$1").toLowerCase()); 14720 } 14721 if (this.tfm) { 14722 for (p2 in this.tfm) { 14723 cache2[p2] = this.tfm[p2]; 14724 } 14725 if (cache2.svg) { 14726 cache2.renderTransform(); 14727 target.setAttribute("data-svg-origin", this.svgo || ""); 14728 } 14729 i2 = _reverting(); 14730 if ((!i2 || !i2.isStart) && !style[_transformProp$2]) { 14731 _removeIndependentTransforms(style); 14732 if (cache2.zOrigin && style[_transformOriginProp$1]) { 14733 style[_transformOriginProp$1] += " " + cache2.zOrigin + "px"; 14734 cache2.zOrigin = 0; 14735 cache2.renderTransform(); 14736 } 14737 cache2.uncache = 1; 14738 } 14739 } 14740}, _getStyleSaver$1 = function _getStyleSaver(target, properties) { 14741 var saver = { 14742 target, 14743 props: [], 14744 revert: _revertStyle, 14745 save: _saveStyle 14746 }; 14747 target._gsap || gsap$8.core.getCache(target); 14748 properties && properties.split(",").forEach(function(p2) { 14749 return saver.save(p2); 14750 }); 14751 return saver; 14752}, _supports3D, _createElement = function _createElement2(type, ns) { 14753 var e2 = _doc$5.createElementNS ? _doc$5.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$5.createElement(type); 14754 return e2 && e2.style ? e2 : _doc$5.createElement(type); 14755}, _getComputedProperty = function _getComputedProperty2(target, property, skipPrefixFallback) { 14756 var cs = getComputedStyle(target); 14757 return cs[property] || cs.getPropertyValue(property.replace(_capsExp$1, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty2(target, _checkPropPrefix(property) || property, 1) || ""; 14758}, _prefixes = "O,Moz,ms,Ms,Webkit".split(","), _checkPropPrefix = function _checkPropPrefix2(property, element, preferPrefix) { 14759 var e2 = element || _tempDiv$1, s2 = e2.style, i2 = 5; 14760 if (property in s2 && !preferPrefix) { 14761 return property; 14762 } 14763 property = property.charAt(0).toUpperCase() + property.substr(1); 14764 while (i2-- && !(_prefixes[i2] + property in s2)) { 14765 } 14766 return i2 < 0 ? null : (i2 === 3 ? "ms" : i2 >= 0 ? _prefixes[i2] : "") + property; 14767}, _initCore$4 = function _initCore() { 14768 if (_windowExists$3() && window.document) { 14769 _win$5 = window; 14770 _doc$5 = _win$5.document; 14771 _docElement$1 = _doc$5.documentElement; 14772 _tempDiv$1 = _createElement("div") || { 14773 style: {} 14774 }; 14775 _createElement("div"); 14776 _transformProp$2 = _checkPropPrefix(_transformProp$2); 14777 _transformOriginProp$1 = _transformProp$2 + "Origin"; 14778 _tempDiv$1.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; 14779 _supports3D = !!_checkPropPrefix("perspective"); 14780 _reverting = gsap$8.core.reverting; 14781 _pluginInitted = 1; 14782 } 14783}, _getBBoxHack = function _getBBoxHack2(swapIfPossible) { 14784 var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), oldParent = this.parentNode, oldSibling = this.nextSibling, oldCSS = this.style.cssText, bbox; 14785 _docElement$1.appendChild(svg); 14786 svg.appendChild(this); 14787 this.style.display = "block"; 14788 if (swapIfPossible) { 14789 try { 14790 bbox = this.getBBox(); 14791 this._gsapBBox = this.getBBox; 14792 this.getBBox = _getBBoxHack2; 14793 } catch (e2) { 14794 } 14795 } else if (this._gsapBBox) { 14796 bbox = this._gsapBBox(); 14797 } 14798 if (oldParent) { 14799 if (oldSibling) { 14800 oldParent.insertBefore(this, oldSibling); 14801 } else { 14802 oldParent.appendChild(this); 14803 } 14804 } 14805 _docElement$1.removeChild(svg); 14806 this.style.cssText = oldCSS; 14807 return bbox; 14808}, _getAttributeFallbacks = function _getAttributeFallbacks2(target, attributesArray) { 14809 var i2 = attributesArray.length; 14810 while (i2--) { 14811 if (target.hasAttribute(attributesArray[i2])) { 14812 return target.getAttribute(attributesArray[i2]); 14813 } 14814 } 14815}, _getBBox = function _getBBox2(target) { 14816 var bounds; 14817 try { 14818 bounds = target.getBBox(); 14819 } catch (error2) { 14820 bounds = _getBBoxHack.call(target, true); 14821 } 14822 bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); 14823 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 14824 x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, 14825 y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, 14826 width: 0, 14827 height: 0 14828 } : bounds; 14829}, _isSVG = function _isSVG2(e2) { 14830 return !!(e2.getCTM && (!e2.parentNode || e2.ownerSVGElement) && _getBBox(e2)); 14831}, _removeProperty = function _removeProperty2(target, property) { 14832 if (property) { 14833 var style = target.style, first2Chars; 14834 if (property in _transformProps && property !== _transformOriginProp$1) { 14835 property = _transformProp$2; 14836 } 14837 if (style.removeProperty) { 14838 first2Chars = property.substr(0, 2); 14839 if (first2Chars === "ms" || property.substr(0, 6) === "webkit") { 14840 property = "-" + property; 14841 } 14842 style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp$1, "-$1").toLowerCase()); 14843 } else { 14844 style.removeAttribute(property); 14845 } 14846 } 14847}, _addNonTweeningPT = function _addNonTweeningPT2(plugin, target, property, beginning, end, onlySetAtEnd) { 14848 var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 14849 plugin._pt = pt; 14850 pt.b = beginning; 14851 pt.e = end; 14852 plugin._props.push(property); 14853 return pt; 14854}, _nonConvertibleUnits = { 14855 deg: 1, 14856 rad: 1, 14857 turn: 1 14858}, _nonStandardLayouts = { 14859 grid: 1, 14860 flex: 1 14861}, _convertToUnit = function _convertToUnit2(target, property, value, unit) { 14862 var curValue = parseFloat(value) || 0, curUnit = (value + "").trim().substr((curValue + "").length) || "px", style = _tempDiv$1.style, horizontal = _horizontalExp.test(property), isRootSVG = target.tagName.toLowerCase() === "svg", measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), amount = 100, toPixels = unit === "px", toPercent = unit === "%", px, parent, cache2, isSVG; 14863 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { 14864 return curValue; 14865 } 14866 curUnit !== "px" && !toPixels && (curValue = _convertToUnit2(target, property, value, "px")); 14867 isSVG = target.getCTM && _isSVG(target); 14868 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 14869 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 14870 return _round$4(toPercent ? curValue / px * amount : curValue / 100 * px); 14871 } 14872 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 14873 parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 14874 if (isSVG) { 14875 parent = (target.ownerSVGElement || {}).parentNode; 14876 } 14877 if (!parent || parent === _doc$5 || !parent.appendChild) { 14878 parent = _doc$5.body; 14879 } 14880 cache2 = parent._gsap; 14881 if (cache2 && toPercent && cache2.width && horizontal && cache2.time === _ticker.time && !cache2.uncache) { 14882 return _round$4(curValue / cache2.width * amount); 14883 } else { 14884 if (toPercent && (property === "height" || property === "width")) { 14885 var v2 = target.style[property]; 14886 target.style[property] = amount + unit; 14887 px = target[measureProperty]; 14888 v2 ? target.style[property] = v2 : _removeProperty(target, property); 14889 } else { 14890 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 14891 parent === target && (style.position = "static"); 14892 parent.appendChild(_tempDiv$1); 14893 px = _tempDiv$1[measureProperty]; 14894 parent.removeChild(_tempDiv$1); 14895 style.position = "absolute"; 14896 } 14897 if (horizontal && toPercent) { 14898 cache2 = _getCache(parent); 14899 cache2.time = _ticker.time; 14900 cache2.width = parent[measureProperty]; 14901 } 14902 } 14903 return _round$4(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 14904}, _get = function _get2(target, property, unit, uncache) { 14905 var value; 14906 _pluginInitted || _initCore$4(); 14907 if (property in _propertyAliases && property !== "transform") { 14908 property = _propertyAliases[property]; 14909 if (~property.indexOf(",")) { 14910 property = property.split(",")[0]; 14911 } 14912 } 14913 if (_transformProps[property] && property !== "transform") { 14914 value = _parseTransform(target, uncache); 14915 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp$1)) + " " + value.zOrigin + "px"; 14916 } else { 14917 value = target.style[property]; 14918 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { 14919 value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); 14920 } 14921 } 14922 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 14923}, _tweenComplexCSSString = function _tweenComplexCSSString2(target, prop, start2, end) { 14924 if (!start2 || start2 === "none") { 14925 var p2 = _checkPropPrefix(prop, target, 1), s2 = p2 && _getComputedProperty(target, p2, 1); 14926 if (s2 && s2 !== start2) { 14927 prop = p2; 14928 start2 = s2; 14929 } else if (prop === "borderColor") { 14930 start2 = _getComputedProperty(target, "borderTopColor"); 14931 } 14932 } 14933 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), index3 = 0, matchIndex = 0, a2, result, startValues, startNum, color, startValue, endValue, endNum, chunk2, endUnit, startUnit, endValues; 14934 pt.b = start2; 14935 pt.e = end; 14936 start2 += ""; 14937 end += ""; 14938 if (end === "auto") { 14939 startValue = target.style[prop]; 14940 target.style[prop] = end; 14941 end = _getComputedProperty(target, prop) || end; 14942 startValue ? target.style[prop] = startValue : _removeProperty(target, prop); 14943 } 14944 a2 = [start2, end]; 14945 _colorStringFilter(a2); 14946 start2 = a2[0]; 14947 end = a2[1]; 14948 startValues = start2.match(_numWithUnitExp) || []; 14949 endValues = end.match(_numWithUnitExp) || []; 14950 if (endValues.length) { 14951 while (result = _numWithUnitExp.exec(end)) { 14952 endValue = result[0]; 14953 chunk2 = end.substring(index3, result.index); 14954 if (color) { 14955 color = (color + 1) % 5; 14956 } else if (chunk2.substr(-5) === "rgba(" || chunk2.substr(-5) === "hsla(") { 14957 color = 1; 14958 } 14959 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 14960 startNum = parseFloat(startValue) || 0; 14961 startUnit = startValue.substr((startNum + "").length); 14962 endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit); 14963 endNum = parseFloat(endValue); 14964 endUnit = endValue.substr((endNum + "").length); 14965 index3 = _numWithUnitExp.lastIndex - endUnit.length; 14966 if (!endUnit) { 14967 endUnit = endUnit || _config$1.units[prop] || startUnit; 14968 if (index3 === end.length) { 14969 end += endUnit; 14970 pt.e += endUnit; 14971 } 14972 } 14973 if (startUnit !== endUnit) { 14974 startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 14975 } 14976 pt._pt = { 14977 _next: pt._pt, 14978 p: chunk2 || matchIndex === 1 ? chunk2 : ",", 14979 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 14980 s: startNum, 14981 c: endNum - startNum, 14982 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 14983 }; 14984 } 14985 } 14986 pt.c = index3 < end.length ? end.substring(index3, end.length) : ""; 14987 } else { 14988 pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 14989 } 14990 _relExp.test(end) && (pt.e = 0); 14991 this._pt = pt; 14992 return pt; 14993}, _keywordToPercent = { 14994 top: "0%", 14995 bottom: "100%", 14996 left: "0%", 14997 right: "100%", 14998 center: "50%" 14999}, _convertKeywordsToPercentages = function _convertKeywordsToPercentages2(value) { 15000 var split2 = value.split(" "), x2 = split2[0], y2 = split2[1] || "50%"; 15001 if (x2 === "top" || x2 === "bottom" || y2 === "left" || y2 === "right") { 15002 value = x2; 15003 x2 = y2; 15004 y2 = value; 15005 } 15006 split2[0] = _keywordToPercent[x2] || x2; 15007 split2[1] = _keywordToPercent[y2] || y2; 15008 return split2.join(" "); 15009}, _renderClearProps = function _renderClearProps2(ratio, data) { 15010 if (data.tween && data.tween._time === data.tween._dur) { 15011 var target = data.t, style = target.style, props = data.u, cache2 = target._gsap, prop, clearTransforms, i2; 15012 if (props === "all" || props === true) { 15013 style.cssText = ""; 15014 clearTransforms = 1; 15015 } else { 15016 props = props.split(","); 15017 i2 = props.length; 15018 while (--i2 > -1) { 15019 prop = props[i2]; 15020 if (_transformProps[prop]) { 15021 clearTransforms = 1; 15022 prop = prop === "transformOrigin" ? _transformOriginProp$1 : _transformProp$2; 15023 } 15024 _removeProperty(target, prop); 15025 } 15026 } 15027 if (clearTransforms) { 15028 _removeProperty(target, _transformProp$2); 15029 if (cache2) { 15030 cache2.svg && target.removeAttribute("transform"); 15031 _parseTransform(target, 1); 15032 cache2.uncache = 1; 15033 _removeIndependentTransforms(style); 15034 } 15035 } 15036 } 15037}, _specialProps = { 15038 clearProps: function clearProps(plugin, target, property, endValue, tween) {
15039 if (tween.data !== "isFromStart") { 15040 var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); 15041 pt.u = endValue; 15042 pt.pr = -10; 15043 pt.tween = tween; 15044 plugin._props.push(property); 15045 return 1; 15046 } 15047 } 15048 /* className feature (about 0.4kb gzipped). 15049 , className(plugin, target, property, endValue, tween) { 15050 let _renderClassName = (ratio, data) => { 15051 data.css.render(ratio, data.css); 15052 if (!ratio || ratio === 1) { 15053 let inline = data.rmv, 15054 target = data.t, 15055 p; 15056 target.setAttribute("class", ratio ? data.e : data.b); 15057 for (p in inline) { 15058 _removeProperty(target, p); 15059 } 15060 } 15061 }, 15062 _getAllStyles = (target) => { 15063 let styles = {}, 15064 computed = getComputedStyle(target), 15065 p; 15066 for (p in computed) { 15067 if (isNaN(p) && p !== "cssText" && p !== "length") { 15068 styles[p] = computed[p]; 15069 } 15070 } 15071 _setDefaults(styles, _parseTransform(target, 1)); 15072 return styles; 15073 }, 15074 startClassList = target.getAttribute("class"), 15075 style = target.style, 15076 cssText = style.cssText, 15077 cache = target._gsap, 15078 classPT = cache.classPT, 15079 inlineToRemoveAtEnd = {}, 15080 data = {t:target, plugin:plugin, rmv:inlineToRemoveAtEnd, b:startClassList, e:(endValue.charAt(1) !== "=") ? endValue : startClassList.replace(new RegExp("(?:\\s|^)" + endValue.substr(2) + "(?![\\w-])"), "") + ((endValue.charAt(0) === "+") ? " " + endValue.substr(2) : "")}, 15081 changingVars = {}, 15082 startVars = _getAllStyles(target), 15083 transformRelated = /(transform|perspective)/i, 15084 endVars, p; 15085 if (classPT) { 15086 classPT.r(1, classPT.d); 15087 _removeLinkedListItem(classPT.d.plugin, classPT, "_pt"); 15088 } 15089 target.setAttribute("class", data.e); 15090 endVars = _getAllStyles(target, true); 15091 target.setAttribute("class", startClassList); 15092 for (p in endVars) { 15093 if (endVars[p] !== startVars[p] && !transformRelated.test(p)) { 15094 changingVars[p] = endVars[p]; 15095 if (!style[p] && style[p] !== "0") { 15096 inlineToRemoveAtEnd[p] = 1; 15097 } 15098 } 15099 } 15100 cache.classPT = plugin._pt = new PropTween(plugin._pt, target, "className", 0, 0, _renderClassName, data, 0, -11); 15101 if (style.cssText !== cssText) { //only apply if things change. Otherwise, in cases like a background-image that's pulled dynamically, it could cause a refresh. See https://gsap.com/forums/topic/20368-possible-gsap-bug-switching-classnames-in-chrome/. 15102 style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). 15103 } 15104 _parseTransform(target, true); //to clear the caching of transforms 15105 data.css = new gsap.plugins.css();
vendor: 2,564 bytes, lines 15106-15142
15106 data.css.init(target, changingVars, tween); 15107 plugin._props.push(...data.css._props); 15108 return 1; 15109 } 15110 */ 15111}, _identity2DMatrix = [1, 0, 0, 1, 0, 0], _rotationalProperties = {}, _isNullTransform = function _isNullTransform2(value) { 15112 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 15113}, _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray2(target) { 15114 var matrixString = _getComputedProperty(target, _transformProp$2); 15115 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp$1).map(_round$4); 15116}, _getMatrix = function _getMatrix2(target, force2D) { 15117 var cache2 = target._gsap || _getCache(target), style = target.style, matrix = _getComputedTransformMatrixAsArray(target), parent, nextSibling, temp, addedToDOM; 15118 if (cache2.svg && target.getAttribute("transform")) { 15119 temp = target.transform.baseVal.consolidate().matrix; 15120 matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; 15121 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 15122 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement$1 && !cache2.svg) { 15123 temp = style.display; 15124 style.display = "block"; 15125 parent = target.parentNode; 15126 if (!parent || !target.offsetParent) { 15127 addedToDOM = 1; 15128 nextSibling = target.nextElementSibling; 15129 _docElement$1.appendChild(target); 15130 } 15131 matrix = _getComputedTransformMatrixAsArray(target); 15132 temp ? style.display = temp : _removeProperty(target, "display"); 15133 if (addedToDOM) { 15134 nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement$1.removeChild(target); 15135 } 15136 } 15137 return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; 15138}, _applySVGOrigin = function _applySVGOrigin2(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 15139 var cache2 = target._gsap, matrix = matrixArray || _getMatrix(target, true), xOriginOld = cache2.xOrigin || 0, yOriginOld = cache2.yOrigin || 0, xOffsetOld = cache2.xOffset || 0, yOffsetOld = cache2.yOffset || 0, a2 = matrix[0], b2 = matrix[1], c2 = matrix[2], d2 = matrix[3], tx = matrix[4], ty = matrix[5], originSplit = origin.split(" "), xOrigin = parseFloat(originSplit[0]) || 0, yOrigin = parseFloat(originSplit[1]) || 0, bounds, determinant, x2, y2; 15140 if (!originIsAbsolute) { 15141 bounds = _getBBox(target); 15142 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * boun
vendor: 12,011 bytes, lines 15142-15409
15142ds.width : xOrigin); 15143 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); 15144 } else if (matrix !== _identity2DMatrix && (determinant = a2 * d2 - b2 * c2)) { 15145 x2 = xOrigin * (d2 / determinant) + yOrigin * (-c2 / determinant) + (c2 * ty - d2 * tx) / determinant; 15146 y2 = xOrigin * (-b2 / determinant) + yOrigin * (a2 / determinant) - (a2 * ty - b2 * tx) / determinant; 15147 xOrigin = x2; 15148 yOrigin = y2; 15149 } 15150 if (smooth || smooth !== false && cache2.smooth) { 15151 tx = xOrigin - xOriginOld; 15152 ty = yOrigin - yOriginOld; 15153 cache2.xOffset = xOffsetOld + (tx * a2 + ty * c2) - tx; 15154 cache2.yOffset = yOffsetOld + (tx * b2 + ty * d2) - ty; 15155 } else { 15156 cache2.xOffset = cache2.yOffset = 0; 15157 } 15158 cache2.xOrigin = xOrigin; 15159 cache2.yOrigin = yOrigin; 15160 cache2.smooth = !!smooth; 15161 cache2.origin = origin; 15162 cache2.originIsAbsolute = !!originIsAbsolute; 15163 target.style[_transformOriginProp$1] = "0px 0px"; 15164 if (pluginToAddPropTweensTo) { 15165 _addNonTweeningPT(pluginToAddPropTweensTo, cache2, "xOrigin", xOriginOld, xOrigin); 15166 _addNonTweeningPT(pluginToAddPropTweensTo, cache2, "yOrigin", yOriginOld, yOrigin); 15167 _addNonTweeningPT(pluginToAddPropTweensTo, cache2, "xOffset", xOffsetOld, cache2.xOffset); 15168 _addNonTweeningPT(pluginToAddPropTweensTo, cache2, "yOffset", yOffsetOld, cache2.yOffset); 15169 } 15170 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 15171}, _parseTransform = function _parseTransform2(target, uncache) { 15172 var cache2 = target._gsap || new GSCache(target); 15173 if ("x" in cache2 && !uncache && !cache2.uncache) { 15174 return cache2; 15175 } 15176 var style = target.style, invertedScaleX = cache2.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp$1) || "0", x2, y2, z2, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos, sin, a2, b2, c2, d2, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32; 15177 x2 = y2 = z2 = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 15178 scaleX = scaleY = 1; 15179 cache2.svg = !!(target.getCTM && _isSVG(target)); 15180 if (cs.translate) { 15181 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") { 15182 style[_transformProp$2] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp$2] !== "none" ? cs[_transformProp$2] : ""); 15183 } 15184 style.scale = style.rotate = style.translate = "none"; 15185 } 15186 matrix = _getMatrix(target, cache2.svg); 15187 if (cache2.svg) { 15188 if (cache2.uncache) { 15189 t2 = target.getBBox(); 15190 origin = cache2.xOrigin - t2.x + "px " + (cache2.yOrigin - t2.y) + "px"; 15191 t1 = ""; 15192 } else { 15193 t1 = !uncache && target.getAttribute("data-svg-origin"); 15194 } 15195 _applySVGOrigin(target, t1 || origin, !!t1 || cache2.originIsAbsolute, cache2.smooth !== false, matrix); 15196 } 15197 xOrigin = cache2.xOrigin || 0; 15198 yOrigin = cache2.yOrigin || 0; 15199 if (matrix !== _identity2DMatrix) { 15200 a2 = matrix[0]; 15201 b2 = matrix[1]; 15202 c2 = matrix[2]; 15203 d2 = matrix[3]; 15204 x2 = a12 = matrix[4]; 15205 y2 = a22 = matrix[5]; 15206 if (matrix.length === 6) { 15207 scaleX = Math.sqrt(a2 * a2 + b2 * b2); 15208 scaleY = Math.sqrt(d2 * d2 + c2 * c2); 15209 rotation = a2 || b2 ? _atan2$1(b2, a2) * _RAD2DEG$1 : 0; 15210 skewX = c2 || d2 ? _atan2$1(c2, d2) * _RAD2DEG$1 + rotation : 0; 15211 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD$2))); 15212 if (cache2.svg) { 15213 x2 -= xOrigin - (xOrigin * a2 + yOrigin * c2); 15214 y2 -= yOrigin - (xOrigin * b2 + yOrigin * d2); 15215 } 15216 } else { 15217 a32 = matrix[6]; 15218 a42 = matrix[7]; 15219 a13 = matrix[8]; 15220 a23 = matrix[9]; 15221 a33 = matrix[10]; 15222 a43 = matrix[11]; 15223 x2 = matrix[12]; 15224 y2 = matrix[13]; 15225 z2 = matrix[14]; 15226 angle = _atan2$1(a32, a33); 15227 rotationX = angle * _RAD2DEG$1; 15228 if (angle) { 15229 cos = Math.cos(-angle); 15230 sin = Math.sin(-angle); 15231 t1 = a12 * cos + a13 * sin; 15232 t2 = a22 * cos + a23 * sin; 15233 t3 = a32 * cos + a33 * sin; 15234 a13 = a12 * -sin + a13 * cos; 15235 a23 = a22 * -sin + a23 * cos; 15236 a33 = a32 * -sin + a33 * cos; 15237 a43 = a42 * -sin + a43 * cos; 15238 a12 = t1; 15239 a22 = t2; 15240 a32 = t3; 15241 } 15242 angle = _atan2$1(-c2, a33); 15243 rotationY = angle * _RAD2DEG$1; 15244 if (angle) { 15245 cos = Math.cos(-angle); 15246 sin = Math.sin(-angle); 15247 t1 = a2 * cos - a13 * sin; 15248 t2 = b2 * cos - a23 * sin; 15249 t3 = c2 * cos - a33 * sin; 15250 a43 = d2 * sin + a43 * cos; 15251 a2 = t1; 15252 b2 = t2; 15253 c2 = t3; 15254 } 15255 angle = _atan2$1(b2, a2); 15256 rotation = angle * _RAD2DEG$1; 15257 if (angle) { 15258 cos = Math.cos(angle); 15259 sin = Math.sin(angle); 15260 t1 = a2 * cos + b2 * sin; 15261 t2 = a12 * cos + a22 * sin; 15262 b2 = b2 * cos - a2 * sin; 15263 a22 = a22 * cos - a12 * sin; 15264 a2 = t1; 15265 a12 = t2; 15266 } 15267 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 15268 rotationX = rotation = 0; 15269 rotationY = 180 - rotationY; 15270 } 15271 scaleX = _round$4(Math.sqrt(a2 * a2 + b2 * b2 + c2 * c2)); 15272 scaleY = _round$4(Math.sqrt(a22 * a22 + a32 * a32)); 15273 angle = _atan2$1(a12, a22); 15274 skewX = Math.abs(angle) > 2e-4 ? angle * _RAD2DEG$1 : 0; 15275 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 15276 } 15277 if (cache2.svg) { 15278 t1 = target.getAttribute("transform"); 15279 cache2.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp$2)); 15280 t1 && target.setAttribute("transform", t1); 15281 } 15282 } 15283 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 15284 if (invertedScaleX) { 15285 scaleX *= -1; 15286 skewX += rotation <= 0 ? 180 : -180; 15287 rotation += rotation <= 0 ? 180 : -180; 15288 } else { 15289 scaleY *= -1; 15290 skewX += skewX <= 0 ? 180 : -180; 15291 } 15292 } 15293 uncache = uncache || cache2.uncache; 15294 cache2.x = x2 - ((cache2.xPercent = x2 && (!uncache && cache2.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x2) ? -50 : 0))) ? target.offsetWidth * cache2.xPercent / 100 : 0) + px; 15295 cache2.y = y2 - ((cache2.yPercent = y2 && (!uncache && cache2.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y2) ? -50 : 0))) ? target.offsetHeight * cache2.yPercent / 100 : 0) + px; 15296 cache2.z = z2 + px; 15297 cache2.scaleX = _round$4(scaleX); 15298 cache2.scaleY = _round$4(scaleY); 15299 cache2.rotation = _round$4(rotation) + deg; 15300 cache2.rotationX = _round$4(rotationX) + deg; 15301 cache2.rotationY = _round$4(rotationY) + deg; 15302 cache2.skewX = skewX + deg; 15303 cache2.skewY = skewY + deg; 15304 cache2.transformPerspective = perspective + px; 15305 if (cache2.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache2.zOrigin || 0) { 15306 style[_transformOriginProp$1] = _firstTwoOnly(origin); 15307 } 15308 cache2.xOffset = cache2.yOffset = 0; 15309 cache2.force3D = _config$1.force3D; 15310 cache2.renderTransform = cache2.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 15311 cache2.uncache = 0; 15312 return cache2; 15313}, _firstTwoOnly = function _firstTwoOnly2(value) { 15314 return (value = value.split(" "))[0] + " " + value[1]; 15315}, _addPxTranslate = function _addPxTranslate2(target, start2, value) { 15316 var unit = getUnit(start2); 15317 return _round$4(parseFloat(start2) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 15318}, _renderNon3DTransforms = function _renderNon3DTransforms2(ratio, cache2) { 15319 cache2.z = "0px"; 15320 cache2.rotationY = cache2.rotationX = "0deg"; 15321 cache2.force3D = 0; 15322 _renderCSSTransforms(ratio, cache2); 15323}, _zeroDeg = "0deg", _zeroPx = "0px", _endParenthesis = ") ", _renderCSSTransforms = function _renderCSSTransforms2(ratio, cache2) { 15324 var _ref = cache2 || this, xPercent = _ref.xPercent, yPercent = _ref.yPercent, x2 = _ref.x, y2 = _ref.y, z2 = _ref.z, rotation = _ref.rotation, rotationY = _ref.rotationY, rotationX = _ref.rotationX, skewX = _ref.skewX, skewY = _ref.skewY, scaleX = _ref.scaleX, scaleY = _ref.scaleY, transformPerspective = _ref.transformPerspective, force3D = _ref.force3D, target = _ref.target, zOrigin = _ref.zOrigin, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; 15325 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 15326 var angle = parseFloat(rotationY) * _DEG2RAD$2, a13 = Math.sin(angle), a33 = Math.cos(angle), cos; 15327 angle = parseFloat(rotationX) * _DEG2RAD$2; 15328 cos = Math.cos(angle); 15329 x2 = _addPxTranslate(target, x2, a13 * cos * -zOrigin); 15330 y2 = _addPxTranslate(target, y2, -Math.sin(angle) * -zOrigin); 15331 z2 = _addPxTranslate(target, z2, a33 * cos * -zOrigin + zOrigin); 15332 } 15333 if (transformPerspective !== _zeroPx) { 15334 transforms += "perspective(" + transformPerspective + _endParenthesis; 15335 } 15336 if (xPercent || yPercent) { 15337 transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 15338 } 15339 if (use3D || x2 !== _zeroPx || y2 !== _zeroPx || z2 !== _zeroPx) { 15340 transforms += z2 !== _zeroPx || use3D ? "translate3d(" + x2 + ", " + y2 + ", " + z2 + ") " : "translate(" + x2 + ", " + y2 + _endParenthesis; 15341 } 15342 if (rotation !== _zeroDeg) { 15343 transforms += "rotate(" + rotation + _endParenthesis; 15344 } 15345 if (rotationY !== _zeroDeg) { 15346 transforms += "rotateY(" + rotationY + _endParenthesis; 15347 } 15348 if (rotationX !== _zeroDeg) { 15349 transforms += "rotateX(" + rotationX + _endParenthesis; 15350 } 15351 if (skewX !== _zeroDeg || skewY !== _zeroDeg) { 15352 transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 15353 } 15354 if (scaleX !== 1 || scaleY !== 1) { 15355 transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 15356 } 15357 target.style[_transformProp$2] = transforms || "translate(0, 0)"; 15358}, _renderSVGTransforms = function _renderSVGTransforms2(ratio, cache2) { 15359 var _ref22 = cache2 || this, xPercent = _ref22.xPercent, yPercent = _ref22.yPercent, x2 = _ref22.x, y2 = _ref22.y, rotation = _ref22.rotation, skewX = _ref22.skewX, skewY = _ref22.skewY, scaleX = _ref22.scaleX, scaleY = _ref22.scaleY, target = _ref22.target, xOrigin = _ref22.xOrigin, yOrigin = _ref22.yOrigin, xOffset = _ref22.xOffset, yOffset = _ref22.yOffset, forceCSS = _ref22.forceCSS, tx = parseFloat(x2), ty = parseFloat(y2), a11, a21, a12, a22, temp; 15360 rotation = parseFloat(rotation); 15361 skewX = parseFloat(skewX); 15362 skewY = parseFloat(skewY); 15363 if (skewY) { 15364 skewY = parseFloat(skewY); 15365 skewX += skewY; 15366 rotation += skewY; 15367 } 15368 if (rotation || skewX) { 15369 rotation *= _DEG2RAD$2; 15370 skewX *= _DEG2RAD$2; 15371 a11 = Math.cos(rotation) * scaleX; 15372 a21 = Math.sin(rotation) * scaleX; 15373 a12 = Math.sin(rotation - skewX) * -scaleY; 15374 a22 = Math.cos(rotation - skewX) * scaleY; 15375 if (skewX) { 15376 skewY *= _DEG2RAD$2; 15377 temp = Math.tan(skewX - skewY); 15378 temp = Math.sqrt(1 + temp * temp); 15379 a12 *= temp; 15380 a22 *= temp; 15381 if (skewY) { 15382 temp = Math.tan(skewY); 15383 temp = Math.sqrt(1 + temp * temp); 15384 a11 *= temp; 15385 a21 *= temp; 15386 } 15387 } 15388 a11 = _round$4(a11); 15389 a21 = _round$4(a21); 15390 a12 = _round$4(a12); 15391 a22 = _round$4(a22); 15392 } else { 15393 a11 = scaleX; 15394 a22 = scaleY; 15395 a21 = a12 = 0; 15396 } 15397 if (tx && !~(x2 + "").indexOf("px") || ty && !~(y2 + "").indexOf("px")) { 15398 tx = _convertToUnit(target, "x", x2, "px"); 15399 ty = _convertToUnit(target, "y", y2, "px"); 15400 } 15401 if (xOrigin || yOrigin || xOffset || yOffset) { 15402 tx = _round$4(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 15403 ty = _round$4(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 15404 } 15405 if (xPercent || yPercent) { 15406 temp = target.getBBox(); 15407 tx = _round$4(tx + xPercent / 100 * temp.width); 15408 ty = _round$4(ty + yPercent / 100 * temp.height); 15409 }
vendor: 18,467 bytes, lines 15410-15803
15410 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 15411 target.setAttribute("transform", temp); 15412 forceCSS && (target.style[_transformProp$2] = temp); 15413}, _addRotationalPropTween = function _addRotationalPropTween2(plugin, target, property, startNum, endValue) { 15414 var cap = 360, isString = _isString$3(endValue), endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG$1 : 1), change = endNum - startNum, finalValue = startNum + change + "deg", direction, pt; 15415 if (isString) { 15416 direction = endValue.split("_")[1]; 15417 if (direction === "short") { 15418 change %= cap; 15419 if (change !== change % (cap / 2)) { 15420 change += change < 0 ? cap : -cap; 15421 } 15422 } 15423 if (direction === "cw" && change < 0) { 15424 change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap; 15425 } else if (direction === "ccw" && change > 0) { 15426 change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap; 15427 } 15428 } 15429 plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 15430 pt.e = finalValue; 15431 pt.u = "deg"; 15432 plugin._props.push(property); 15433 return pt; 15434}, _assign = function _assign2(target, source) { 15435 for (var p2 in source) { 15436 target[p2] = source[p2]; 15437 } 15438 return target; 15439}, _addRawTransformPTs = function _addRawTransformPTs2(plugin, transforms, target) { 15440 var startCache = _assign({}, target._gsap), exclude = "perspective,force3D,transformOrigin,svgOrigin", style = target.style, endCache, p2, startValue, endValue, startNum, endNum, startUnit, endUnit; 15441 if (startCache.svg) { 15442 startValue = target.getAttribute("transform"); 15443 target.setAttribute("transform", ""); 15444 style[_transformProp$2] = transforms; 15445 endCache = _parseTransform(target, 1); 15446 _removeProperty(target, _transformProp$2); 15447 target.setAttribute("transform", startValue); 15448 } else { 15449 startValue = getComputedStyle(target)[_transformProp$2]; 15450 style[_transformProp$2] = transforms; 15451 endCache = _parseTransform(target, 1); 15452 style[_transformProp$2] = startValue; 15453 } 15454 for (p2 in _transformProps) { 15455 startValue = startCache[p2]; 15456 endValue = endCache[p2]; 15457 if (startValue !== endValue && exclude.indexOf(p2) < 0) { 15458 startUnit = getUnit(startValue); 15459 endUnit = getUnit(endValue); 15460 startNum = startUnit !== endUnit ? _convertToUnit(target, p2, startValue, endUnit) : parseFloat(startValue); 15461 endNum = parseFloat(endValue); 15462 plugin._pt = new PropTween(plugin._pt, endCache, p2, startNum, endNum - startNum, _renderCSSProp); 15463 plugin._pt.u = endUnit || 0; 15464 plugin._props.push(p2); 15465 } 15466 } 15467 _assign(endCache, startCache); 15468}; 15469_forEachName("padding,margin,Width,Radius", function(name, index3) { 15470 var t2 = "Top", r2 = "Right", b2 = "Bottom", l2 = "Left", props = (index3 < 3 ? [t2, r2, b2, l2] : [t2 + l2, t2 + r2, b2 + r2, b2 + l2]).map(function(side) { 15471 return index3 < 2 ? name + side : "border" + side + name; 15472 }); 15473 _specialProps[index3 > 1 ? "border" + name : name] = function(plugin, target, property, endValue, tween) { 15474 var a2, vars; 15475 if (arguments.length < 4) { 15476 a2 = props.map(function(prop) { 15477 return _get(plugin, prop, property); 15478 }); 15479 vars = a2.join(" "); 15480 return vars.split(a2[0]).length === 5 ? a2[0] : vars; 15481 } 15482 a2 = (endValue + "").split(" "); 15483 vars = {}; 15484 props.forEach(function(prop, i2) { 15485 return vars[prop] = a2[i2] = a2[i2] || a2[(i2 - 1) / 2 | 0]; 15486 }); 15487 plugin.init(target, vars, tween); 15488 }; 15489}); 15490var CSSPlugin = { 15491 name: "css", 15492 register: _initCore$4, 15493 targetTest: function targetTest(target) { 15494 return target.style && target.nodeType; 15495 }, 15496 init: function init3(target, vars, tween, index3, targets) { 15497 var props = this._props, style = target.style, startAt = tween.vars.startAt, startValue, endValue, endNum, startNum, type, specialProp, p2, startUnit, endUnit, relative, isTransformRelated, transformPropTween, cache2, smooth, hasPriority, inlineProps; 15498 _pluginInitted || _initCore$4(); 15499 this.styles = this.styles || _getStyleSaver$1(target); 15500 inlineProps = this.styles.props; 15501 this.tween = tween; 15502 for (p2 in vars) { 15503 if (p2 === "autoRound") { 15504 continue; 15505 } 15506 endValue = vars[p2]; 15507 if (_plugins[p2] && _checkPlugin(p2, vars, tween, index3, target, targets)) { 15508 continue; 15509 } 15510 type = typeof endValue; 15511 specialProp = _specialProps[p2]; 15512 if (type === "function") { 15513 endValue = endValue.call(tween, index3, target, targets); 15514 type = typeof endValue; 15515 } 15516 if (type === "string" && ~endValue.indexOf("random(")) { 15517 endValue = _replaceRandom(endValue); 15518 } 15519 if (specialProp) { 15520 specialProp(this, target, p2, endValue, tween) && (hasPriority = 1); 15521 } else if (p2.substr(0, 2) === "--") { 15522 startValue = (getComputedStyle(target).getPropertyValue(p2) + "").trim(); 15523 endValue += ""; 15524 _colorExp.lastIndex = 0; 15525 if (!_colorExp.test(startValue)) { 15526 startUnit = getUnit(startValue); 15527 endUnit = getUnit(endValue); 15528 } 15529 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p2, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 15530 this.add(style, "setProperty", startValue, endValue, index3, targets, 0, 0, p2); 15531 props.push(p2); 15532 inlineProps.push(p2, 0, style[p2]); 15533 } else if (type !== "undefined") { 15534 if (startAt && p2 in startAt) { 15535 startValue = typeof startAt[p2] === "function" ? startAt[p2].call(tween, index3, target, targets) : startAt[p2]; 15536 _isString$3(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue)); 15537 getUnit(startValue + "") || startValue === "auto" || (startValue += _config$1.units[p2] || getUnit(_get(target, p2)) || ""); 15538 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p2)); 15539 } else { 15540 startValue = _get(target, p2); 15541 } 15542 startNum = parseFloat(startValue); 15543 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 15544 relative && (endValue = endValue.substr(2)); 15545 endNum = parseFloat(endValue); 15546 if (p2 in _propertyAliases) { 15547 if (p2 === "autoAlpha") { 15548 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { 15549 startNum = 0; 15550 } 15551 inlineProps.push("visibility", 0, style.visibility); 15552 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 15553 } 15554 if (p2 !== "scale" && p2 !== "transform") { 15555 p2 = _propertyAliases[p2]; 15556 ~p2.indexOf(",") && (p2 = p2.split(",")[0]); 15557 } 15558 } 15559 isTransformRelated = p2 in _transformProps; 15560 if (isTransformRelated) { 15561 this.styles.save(p2); 15562 if (!transformPropTween) { 15563 cache2 = target._gsap; 15564 cache2.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); 15565 smooth = vars.smoothOrigin !== false && cache2.smooth; 15566 transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp$2, 0, 1, cache2.renderTransform, cache2, 0, -1); 15567 transformPropTween.dep = 1; 15568 } 15569 if (p2 === "scale") { 15570 this._pt = new PropTween(this._pt, cache2, "scaleY", cache2.scaleY, (relative ? _parseRelative(cache2.scaleY, relative + endNum) : endNum) - cache2.scaleY || 0, _renderCSSProp); 15571 this._pt.u = 0; 15572 props.push("scaleY", p2); 15573 p2 += "X"; 15574 } else if (p2 === "transformOrigin") { 15575 inlineProps.push(_transformOriginProp$1, 0, style[_transformOriginProp$1]); 15576 endValue = _convertKeywordsToPercentages(endValue); 15577 if (cache2.svg) { 15578 _applySVGOrigin(target, endValue, 0, smooth, 0, this); 15579 } else { 15580 endUnit = parseFloat(endValue.split(" ")[2]) || 0; 15581 endUnit !== cache2.zOrigin && _addNonTweeningPT(this, cache2, "zOrigin", cache2.zOrigin, endUnit); 15582 _addNonTweeningPT(this, style, p2, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 15583 } 15584 continue; 15585 } else if (p2 === "svgOrigin") { 15586 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 15587 continue; 15588 } else if (p2 in _rotationalProperties) { 15589 _addRotationalPropTween(this, cache2, p2, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue); 15590 continue; 15591 } else if (p2 === "smoothOrigin") { 15592 _addNonTweeningPT(this, cache2, "smooth", cache2.smooth, endValue); 15593 continue; 15594 } else if (p2 === "force3D") { 15595 cache2[p2] = endValue; 15596 continue; 15597 } else if (p2 === "transform") { 15598 _addRawTransformPTs(this, endValue, target); 15599 continue; 15600 } 15601 } else if (!(p2 in style)) { 15602 p2 = _checkPropPrefix(p2) || p2; 15603 } 15604 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p2 in style) { 15605 startUnit = (startValue + "").substr((startNum + "").length); 15606 endNum || (endNum = 0); 15607 endUnit = getUnit(endValue) || (p2 in _config$1.units ? _config$1.units[p2] : startUnit); 15608 startUnit !== endUnit && (startNum = _convertToUnit(target, p2, startValue, endUnit)); 15609 this._pt = new PropTween(this._pt, isTransformRelated ? cache2 : style, p2, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p2 === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 15610 this._pt.u = endUnit || 0; 15611 if (startUnit !== endUnit && endUnit !== "%") { 15612 this._pt.b = startValue; 15613 this._pt.r = _renderCSSPropWithBeginning; 15614 } 15615 } else if (!(p2 in style)) { 15616 if (p2 in target) { 15617 this.add(target, p2, startValue || target[p2], relative ? relative + endValue : endValue, index3, targets); 15618 } else if (p2 !== "parseTransform") { 15619 _missingPlugin(p2, endValue); 15620 continue; 15621 } 15622 } else { 15623 _tweenComplexCSSString.call(this, target, p2, startValue, relative ? relative + endValue : endValue); 15624 } 15625 isTransformRelated || (p2 in style ? inlineProps.push(p2, 0, style[p2]) : inlineProps.push(p2, 1, startValue || target[p2])); 15626 props.push(p2); 15627 } 15628 } 15629 hasPriority && _sortPropTweensByPriority(this); 15630 }, 15631 render: function render2(ratio, data) { 15632 if (data.tween._time || !_reverting()) { 15633 var pt = data._pt; 15634 while (pt) { 15635 pt.r(ratio, pt.d); 15636 pt = pt._next; 15637 } 15638 } else { 15639 data.styles.revert(); 15640 } 15641 }, 15642 get: _get, 15643 aliases: _propertyAliases, 15644 getSetter: function getSetter(target, property, plugin) { 15645 var p2 = _propertyAliases[property]; 15646 p2 && p2.indexOf(",") < 0 && (property = p2); 15647 return property in _transformProps && property !== _transformOriginProp$1 && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property); 15648 }, 15649 core: { 15650 _removeProperty, 15651 _getMatrix 15652 } 15653}; 15654gsap$8.utils.checkPrefix = _checkPropPrefix; 15655gsap$8.core.getStyleSaver = _getStyleSaver$1; 15656(function(positionAndScale, rotation, others, aliases) { 15657 var all = _forEachName(positionAndScale + "," + rotation + "," + others, function(name) { 15658 _transformProps[name] = 1; 15659 }); 15660 _forEachName(rotation, function(name) { 15661 _config$1.units[name] = "deg"; 15662 _rotationalProperties[name] = 1; 15663 }); 15664 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 15665 _forEachName(aliases, function(name) { 15666 var split2 = name.split(":"); 15667 _propertyAliases[split2[1]] = all[split2[0]]; 15668 }); 15669})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); 15670_forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) { 15671 _config$1.units[name] = "px"; 15672}); 15673gsap$8.registerPlugin(CSSPlugin); 15674var gsapWithCSS = gsap$8.registerPlugin(CSSPlugin) || gsap$8; 15675gsapWithCSS.core.Tween; 15676/*! 15677 * matrix 3.12.5 15678 * https://gsap.com 15679 * 15680 * Copyright 2008-2024, GreenSock. All rights reserved. 15681 * Subject to the terms at https://gsap.com/standard-license or for 15682 * Club GSAP members, the agreement issued with that membership. 15683 * @author: Jack Doyle, [email protected] 15684*/ 15685var _doc$4, _win$4, _docElement, _body$5, _divContainer, _svgContainer, _identityMatrix, _gEl, _transformProp$1 = "transform", _transformOriginProp = _transformProp$1 + "Origin", _hasOffsetBug, _setDoc = function _setDoc2(element) { 15686 var doc2 = element.ownerDocument || element; 15687 if (!(_transformProp$1 in element.style) && "msTransform" in element.style) { 15688 _transformProp$1 = "msTransform"; 15689 _transformOriginProp = _transformProp$1 + "Origin"; 15690 } 15691 while (doc2.parentNode && (doc2 = doc2.parentNode)) { 15692 } 15693 _win$4 = window; 15694 _identityMatrix = new Matrix2D(); 15695 if (doc2) { 15696 _doc$4 = doc2; 15697 _docElement = doc2.documentElement; 15698 _body$5 = doc2.body; 15699 _gEl = _doc$4.createElementNS("http://www.w3.org/2000/svg", "g"); 15700 _gEl.style.transform = "none"; 15701 var d1 = doc2.createElement("div"), d2 = doc2.createElement("div"), root = doc2 && (doc2.body || doc2.firstElementChild); 15702 if (root && root.appendChild) { 15703 root.appendChild(d1); 15704 d1.appendChild(d2); 15705 d1.setAttribute("style", "position:static;transform:translate3d(0,0,1px)"); 15706 _hasOffsetBug = d2.offsetParent !== d1; 15707 root.removeChild(d1); 15708 } 15709 } 15710 return doc2; 15711}, _forceNonZeroScale = function _forceNonZeroScale2(e2) { 15712 var a2, cache2; 15713 while (e2 && e2 !== _body$5) { 15714 cache2 = e2._gsap; 15715 cache2 && cache2.uncache && cache2.get(e2, "x"); 15716 if (cache2 && !cache2.scaleX && !cache2.scaleY && cache2.renderTransform) { 15717 cache2.scaleX = cache2.scaleY = 1e-4; 15718 cache2.renderTransform(1, cache2); 15719 a2 ? a2.push(cache2) : a2 = [cache2]; 15720 } 15721 e2 = e2.parentNode; 15722 } 15723 return a2; 15724}, _svgTemps = [], _divTemps = [], _getDocScrollTop = function _getDocScrollTop2() { 15725 return _win$4.pageYOffset || _doc$4.scrollTop || _docElement.scrollTop || _body$5.scrollTop || 0; 15726}, _getDocScrollLeft = function _getDocScrollLeft2() { 15727 return _win$4.pageXOffset || _doc$4.scrollLeft || _docElement.scrollLeft || _body$5.scrollLeft || 0; 15728}, _svgOwner = function _svgOwner2(element) { 15729 return element.ownerSVGElement || ((element.tagName + "").toLowerCase() === "svg" ? element : null); 15730}, _isFixed = function _isFixed2(element) { 15731 if (_win$4.getComputedStyle(element).position === "fixed") { 15732 return true; 15733 } 15734 element = element.parentNode; 15735 if (element && element.nodeType === 1) { 15736 return _isFixed2(element); 15737 } 15738}, _createSibling = function _createSibling2(element, i2) { 15739 if (element.parentNode && (_doc$4 || _setDoc(element))) { 15740 var svg = _svgOwner(element), ns = svg ? svg.getAttribute("xmlns") || "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", type = svg ? i2 ? "rect" : "g" : "div", x2 = i2 !== 2 ? 0 : 100, y2 = i2 === 3 ? 100 : 0, css = "position:absolute;display:block;pointer-events:none;margin:0;padding:0;", e2 = _doc$4.createElementNS ? _doc$4.createElementNS(ns.replace(/^https/, "http"), type) : _doc$4.createElement(type); 15741 if (i2) { 15742 if (!svg) { 15743 if (!_divContainer) { 15744 _divContainer = _createSibling2(element); 15745 _divContainer.style.cssText = css; 15746 } 15747 e2.style.cssText = css + "width:0.1px;height:0.1px;top:" + y2 + "px;left:" + x2 + "px"; 15748 _divContainer.appendChild(e2); 15749 } else { 15750 _svgContainer || (_svgContainer = _createSibling2(element)); 15751 e2.setAttribute("width", 0.01); 15752 e2.setAttribute("height", 0.01); 15753 e2.setAttribute("transform", "translate(" + x2 + "," + y2 + ")"); 15754 _svgContainer.appendChild(e2); 15755 } 15756 } 15757 return e2; 15758 } 15759 throw "Need document and parent."; 15760}, _consolidate = function _consolidate2(m2) { 15761 var c2 = new Matrix2D(), i2 = 0; 15762 for (; i2 < m2.numberOfItems; i2++) { 15763 c2.multiply(m2.getItem(i2).matrix); 15764 } 15765 return c2; 15766}, _getCTM = function _getCTM2(svg) { 15767 var m2 = svg.getCTM(), transform; 15768 if (!m2) { 15769 transform = svg.style[_transformProp$1]; 15770 svg.style[_transformProp$1] = "none"; 15771 svg.appendChild(_gEl); 15772 m2 = _gEl.getCTM(); 15773 svg.removeChild(_gEl); 15774 transform ? svg.style[_transformProp$1] = transform : svg.style.removeProperty(_transformProp$1.replace(/([A-Z])/g, "-$1").toLowerCase()); 15775 } 15776 return m2 || _identityMatrix.clone(); 15777}, _placeSiblings = function _placeSiblings2(element, adjustGOffset) { 15778 var svg = _svgOwner(element), isRootSVG = element === svg, siblings = svg ? _svgTemps : _divTemps, parent = element.parentNode, container, m2, b2, x2, y2, cs; 15779 if (element === _win$4) { 15780 return element; 15781 } 15782 siblings.length || siblings.push(_createSibling(element, 1), _createSibling(element, 2), _createSibling(element, 3)); 15783 container = svg ? _svgContainer : _divContainer; 15784 if (svg) { 15785 if (isRootSVG) { 15786 b2 = _getCTM(element); 15787 x2 = -b2.e / b2.a; 15788 y2 = -b2.f / b2.d; 15789 m2 = _identityMatrix; 15790 } else if (element.getBBox) { 15791 b2 = element.getBBox(); 15792 m2 = element.transform ? element.transform.baseVal : {}; 15793 m2 = !m2.numberOfItems ? _identityMatrix : m2.numberOfItems > 1 ? _consolidate(m2) : m2.getItem(0).matrix; 15794 x2 = m2.a * b2.x + m2.c * b2.y; 15795 y2 = m2.b * b2.x + m2.d * b2.y; 15796 } else { 15797 m2 = new Matrix2D(); 15798 x2 = y2 = 0; 15799 } 15800 if (adjustGOffset && element.tagName.toLowerCase() === "g") { 15801 x2 = y2 = 0; 15802 } 15803 (isRootSVG ? svg : parent).appendChild(container);
vendor: 4,695 bytes, lines 15804-15919
15804 container.setAttribute("transform", "matrix(" + m2.a + "," + m2.b + "," + m2.c + "," + m2.d + "," + (m2.e + x2) + "," + (m2.f + y2) + ")"); 15805 } else { 15806 x2 = y2 = 0; 15807 if (_hasOffsetBug) { 15808 m2 = element.offsetParent; 15809 b2 = element; 15810 while (b2 && (b2 = b2.parentNode) && b2 !== m2 && b2.parentNode) { 15811 if ((_win$4.getComputedStyle(b2)[_transformProp$1] + "").length > 4) { 15812 x2 = b2.offsetLeft; 15813 y2 = b2.offsetTop; 15814 b2 = 0; 15815 } 15816 } 15817 } 15818 cs = _win$4.getComputedStyle(element); 15819 if (cs.position !== "absolute" && cs.position !== "fixed") { 15820 m2 = element.offsetParent; 15821 while (parent && parent !== m2) { 15822 x2 += parent.scrollLeft || 0; 15823 y2 += parent.scrollTop || 0; 15824 parent = parent.parentNode; 15825 } 15826 } 15827 b2 = container.style; 15828 b2.top = element.offsetTop - y2 + "px"; 15829 b2.left = element.offsetLeft - x2 + "px"; 15830 b2[_transformProp$1] = cs[_transformProp$1]; 15831 b2[_transformOriginProp] = cs[_transformOriginProp]; 15832 b2.position = cs.position === "fixed" ? "fixed" : "absolute"; 15833 element.parentNode.appendChild(container); 15834 } 15835 return container; 15836}, _setMatrix = function _setMatrix2(m2, a2, b2, c2, d2, e2, f2) { 15837 m2.a = a2; 15838 m2.b = b2; 15839 m2.c = c2; 15840 m2.d = d2; 15841 m2.e = e2; 15842 m2.f = f2; 15843 return m2; 15844}; 15845var Matrix2D = /* @__PURE__ */ function() { 15846 function Matrix2D2(a2, b2, c2, d2, e2, f2) { 15847 if (a2 === void 0) { 15848 a2 = 1; 15849 } 15850 if (b2 === void 0) { 15851 b2 = 0; 15852 } 15853 if (c2 === void 0) { 15854 c2 = 0; 15855 } 15856 if (d2 === void 0) { 15857 d2 = 1; 15858 } 15859 if (e2 === void 0) { 15860 e2 = 0; 15861 } 15862 if (f2 === void 0) { 15863 f2 = 0; 15864 } 15865 _setMatrix(this, a2, b2, c2, d2, e2, f2); 15866 } 15867 var _proto = Matrix2D2.prototype; 15868 _proto.inverse = function inverse() { 15869 var a2 = this.a, b2 = this.b, c2 = this.c, d2 = this.d, e2 = this.e, f2 = this.f, determinant = a2 * d2 - b2 * c2 || 1e-10; 15870 return _setMatrix(this, d2 / determinant, -b2 / determinant, -c2 / determinant, a2 / determinant, (c2 * f2 - d2 * e2) / determinant, -(a2 * f2 - b2 * e2) / determinant); 15871 }; 15872 _proto.multiply = function multiply(matrix) { 15873 var a2 = this.a, b2 = this.b, c2 = this.c, d2 = this.d, e2 = this.e, f2 = this.f, a22 = matrix.a, b22 = matrix.c, c22 = matrix.b, d22 = matrix.d, e22 = matrix.e, f22 = matrix.f; 15874 return _setMatrix(this, a22 * a2 + c22 * c2, a22 * b2 + c22 * d2, b22 * a2 + d22 * c2, b22 * b2 + d22 * d2, e2 + e22 * a2 + f22 * c2, f2 + e22 * b2 + f22 * d2); 15875 }; 15876 _proto.clone = function clone2() { 15877 return new Matrix2D2(this.a, this.b, this.c, this.d, this.e, this.f); 15878 }; 15879 _proto.equals = function equals(matrix) { 15880 var a2 = this.a, b2 = this.b, c2 = this.c, d2 = this.d, e2 = this.e, f2 = this.f; 15881 return a2 === matrix.a && b2 === matrix.b && c2 === matrix.c && d2 === matrix.d && e2 === matrix.e && f2 === matrix.f; 15882 }; 15883 _proto.apply = function apply(point, decoratee) { 15884 if (decoratee === void 0) { 15885 decoratee = {}; 15886 } 15887 var x2 = point.x, y2 = point.y, a2 = this.a, b2 = this.b, c2 = this.c, d2 = this.d, e2 = this.e, f2 = this.f; 15888 decoratee.x = x2 * a2 + y2 * c2 + e2 || 0; 15889 decoratee.y = x2 * b2 + y2 * d2 + f2 || 0; 15890 return decoratee; 15891 }; 15892 return Matrix2D2; 15893}(); 15894function getGlobalMatrix(element, inverse, adjustGOffset, includeScrollInFixed) { 15895 if (!element || !element.parentNode || (_doc$4 || _setDoc(element)).documentElement === element) { 15896 return new Matrix2D(); 15897 } 15898 var zeroScales = _forceNonZeroScale(element), svg = _svgOwner(element), temps = svg ? _svgTemps : _divTemps, container = _placeSiblings(element, adjustGOffset), b1 = temps[0].getBoundingClientRect(), b2 = temps[1].getBoundingClientRect(), b3 = temps[2].getBoundingClientRect(), parent = container.parentNode, isFixed = !includeScrollInFixed && _isFixed(element), m2 = new Matrix2D((b2.left - b1.left) / 100, (b2.top - b1.top) / 100, (b3.left - b1.left) / 100, (b3.top - b1.top) / 100, b1.left + (isFixed ? 0 : _getDocScrollLeft()), b1.top + (isFixed ? 0 : _getDocScrollTop())); 15899 parent.removeChild(container); 15900 if (zeroScales) { 15901 b1 = zeroScales.length; 15902 while (b1--) { 15903 b2 = zeroScales[b1]; 15904 b2.scaleX = b2.scaleY = 0; 15905 b2.renderTransform(1, b2); 15906 } 15907 } 15908 return inverse ? m2.inverse() : m2; 15909} 15910/*! 15911 * Flip 3.12.5 15912 * https://gsap.com 15913 * 15914 * @license Copyright 2008-2024, GreenSock. All rights reserved. 15915 * Subject to the terms at https://gsap.com/standard-license or for 15916 * Club GSAP members, the agreement issued with that membership. 15917 * @author: Jack Doyle, [email protected] 15918*/ 15919var _id = 1, _toArray$5, gsap$7, _batch, _batchAction, _body$4, _closestTenth, _getStyleSaver2, _forEac
vendor: 10,184 bytes, lines 15919-16149
15919hBatch = function _forEachBatch2(batch, name) { 15920 return batch.actions.forEach(function(a2) { 15921 return a2.vars[name] && a2.vars[name](a2); 15922 }); 15923}, _batchLookup = {}, _RAD2DEG = 180 / Math.PI, _DEG2RAD$1 = Math.PI / 180, _emptyObj = {}, _dashedNameLookup = {}, _memoizedRemoveProps = {}, _listToArray = function _listToArray2(list) { 15924 return typeof list === "string" ? list.split(" ").join("").split(",") : list; 15925}, _callbacks = _listToArray("onStart,onUpdate,onComplete,onReverseComplete,onInterrupt"), _removeProps = _listToArray("transform,transformOrigin,width,height,position,top,left,opacity,zIndex,maxWidth,maxHeight,minWidth,minHeight"), _getEl = function _getEl2(target) { 15926 return _toArray$5(target)[0] || console.warn("Element not found:", target); 15927}, _round$3 = function _round2(value) { 15928 return Math.round(value * 1e4) / 1e4 || 0; 15929}, _toggleClass = function _toggleClass2(targets, className, action) { 15930 return targets.forEach(function(el) { 15931 return el.classList[action](className); 15932 }); 15933}, _reserved = { 15934 zIndex: 1, 15935 kill: 1, 15936 simple: 1, 15937 spin: 1, 15938 clearProps: 1, 15939 targets: 1, 15940 toggleClass: 1, 15941 onComplete: 1, 15942 onUpdate: 1, 15943 onInterrupt: 1, 15944 onStart: 1, 15945 delay: 1, 15946 repeat: 1, 15947 repeatDelay: 1, 15948 yoyo: 1, 15949 scale: 1, 15950 fade: 1, 15951 absolute: 1, 15952 props: 1, 15953 onEnter: 1, 15954 onLeave: 1, 15955 custom: 1, 15956 paused: 1, 15957 nested: 1, 15958 prune: 1, 15959 absoluteOnLeave: 1 15960}, _fitReserved = { 15961 zIndex: 1, 15962 simple: 1, 15963 clearProps: 1, 15964 scale: 1, 15965 absolute: 1, 15966 fitChild: 1, 15967 getVars: 1, 15968 props: 1 15969}, _camelToDashed = function _camelToDashed2(p2) { 15970 return p2.replace(/([A-Z])/g, "-$1").toLowerCase(); 15971}, _copy = function _copy2(obj, exclude) { 15972 var result = {}, p2; 15973 for (p2 in obj) { 15974 exclude[p2] || (result[p2] = obj[p2]); 15975 } 15976 return result; 15977}, _memoizedProps = {}, _memoizeProps = function _memoizeProps2(props) { 15978 var p2 = _memoizedProps[props] = _listToArray(props); 15979 _memoizedRemoveProps[props] = p2.concat(_removeProps); 15980 return p2; 15981}, _getInverseGlobalMatrix = function _getInverseGlobalMatrix2(el) { 15982 var cache2 = el._gsap || gsap$7.core.getCache(el); 15983 if (cache2.gmCache === gsap$7.ticker.frame) { 15984 return cache2.gMatrix; 15985 } 15986 cache2.gmCache = gsap$7.ticker.frame; 15987 return cache2.gMatrix = getGlobalMatrix(el, true, false, true); 15988}, _getDOMDepth = function _getDOMDepth2(el, invert, level) { 15989 if (level === void 0) { 15990 level = 0; 15991 } 15992 var parent = el.parentNode, inc = 1e3 * Math.pow(10, level) * (invert ? -1 : 1), l2 = invert ? -inc * 900 : 0; 15993 while (el) { 15994 l2 += inc; 15995 el = el.previousSibling; 15996 } 15997 return parent ? l2 + _getDOMDepth2(parent, invert, level + 1) : l2; 15998}, _orderByDOMDepth = function _orderByDOMDepth2(comps, invert, isElStates) { 15999 comps.forEach(function(comp) { 16000 return comp.d = _getDOMDepth(isElStates ? comp.element : comp.t, invert); 16001 }); 16002 comps.sort(function(c1, c2) { 16003 return c1.d - c2.d; 16004 }); 16005 return comps; 16006}, _recordInlineStyles = function _recordInlineStyles2(elState, props) { 16007 var style = elState.element.style, a2 = elState.css = elState.css || [], i2 = props.length, p2, v2; 16008 while (i2--) { 16009 p2 = props[i2]; 16010 v2 = style[p2] || style.getPropertyValue(p2); 16011 a2.push(v2 ? p2 : _dashedNameLookup[p2] || (_dashedNameLookup[p2] = _camelToDashed(p2)), v2); 16012 } 16013 return style; 16014}, _applyInlineStyles = function _applyInlineStyles2(state) { 16015 var css = state.css, style = state.element.style, i2 = 0; 16016 state.cache.uncache = 1; 16017 for (; i2 < css.length; i2 += 2) { 16018 css[i2 + 1] ? style[css[i2]] = css[i2 + 1] : style.removeProperty(css[i2]); 16019 } 16020 if (!css[css.indexOf("transform") + 1] && style.translate) { 16021 style.removeProperty("translate"); 16022 style.removeProperty("scale"); 16023 style.removeProperty("rotate"); 16024 } 16025}, _setFinalStates = function _setFinalStates2(comps, onlyTransforms) { 16026 comps.forEach(function(c2) { 16027 return c2.a.cache.uncache = 1; 16028 }); 16029 onlyTransforms || comps.finalStates.forEach(_applyInlineStyles); 16030}, _absoluteProps = "paddingTop,paddingRight,paddingBottom,paddingLeft,gridArea,transition".split(","), _makeAbsolute = function _makeAbsolute2(elState, fallbackNode, ignoreBatch) { 16031 var element = elState.element, width = elState.width, height = elState.height, uncache = elState.uncache, getProp = elState.getProp, style = element.style, i2 = 4, result, displayIsNone, cs; 16032 typeof fallbackNode !== "object" && (fallbackNode = elState); 16033 if (_batch && ignoreBatch !== 1) { 16034 _batch._abs.push({ 16035 t: element, 16036 b: elState, 16037 a: elState, 16038 sd: 0 16039 }); 16040 _batch._final.push(function() { 16041 return (elState.cache.uncache = 1) && _applyInlineStyles(elState); 16042 }); 16043 return element; 16044 } 16045 displayIsNone = getProp("display") === "none"; 16046 if (!elState.isVisible || displayIsNone) { 16047 displayIsNone && (_recordInlineStyles(elState, ["display"]).display = fallbackNode.display); 16048 elState.matrix = fallbackNode.matrix; 16049 elState.width = width = elState.width || fallbackNode.width; 16050 elState.height = height = elState.height || fallbackNode.height; 16051 } 16052 _recordInlineStyles(elState, _absoluteProps); 16053 cs = window.getComputedStyle(element); 16054 while (i2--) { 16055 style[_absoluteProps[i2]] = cs[_absoluteProps[i2]]; 16056 } 16057 style.gridArea = "1 / 1 / 1 / 1"; 16058 style.transition = "none"; 16059 style.position = "absolute"; 16060 style.width = width + "px"; 16061 style.height = height + "px"; 16062 style.top || (style.top = "0px"); 16063 style.left || (style.left = "0px"); 16064 if (uncache) { 16065 result = new ElementState(element); 16066 } else { 16067 result = _copy(elState, _emptyObj); 16068 result.position = "absolute"; 16069 if (elState.simple) { 16070 var bounds = element.getBoundingClientRect(); 16071 result.matrix = new Matrix2D(1, 0, 0, 1, bounds.left + _getDocScrollLeft(), bounds.top + _getDocScrollTop()); 16072 } else { 16073 result.matrix = getGlobalMatrix(element, false, false, true); 16074 } 16075 } 16076 result = _fit(result, elState, true); 16077 elState.x = _closestTenth(result.x, 0.01); 16078 elState.y = _closestTenth(result.y, 0.01); 16079 return element; 16080}, _filterComps = function _filterComps2(comps, targets) { 16081 if (targets !== true) { 16082 targets = _toArray$5(targets); 16083 comps = comps.filter(function(c2) { 16084 if (targets.indexOf((c2.sd < 0 ? c2.b : c2.a).element) !== -1) { 16085 return true; 16086 } else { 16087 c2.t._gsap.renderTransform(1); 16088 if (c2.b.isVisible) { 16089 c2.t.style.width = c2.b.width + "px"; 16090 c2.t.style.height = c2.b.height + "px"; 16091 } 16092 } 16093 }); 16094 } 16095 return comps; 16096}, _makeCompsAbsolute = function _makeCompsAbsolute2(comps) { 16097 return _orderByDOMDepth(comps, true).forEach(function(c2) { 16098 return (c2.a.isVisible || c2.b.isVisible) && _makeAbsolute(c2.sd < 0 ? c2.b : c2.a, c2.b, 1); 16099 }); 16100}, _findElStateInState = function _findElStateInState2(state, other) { 16101 return other && state.idLookup[_parseElementState(other).id] || state.elementStates[0]; 16102}, _parseElementState = function _parseElementState2(elOrNode, props, simple, other) { 16103 return elOrNode instanceof ElementState ? elOrNode : elOrNode instanceof FlipState ? _findElStateInState(elOrNode, other) : new ElementState(typeof elOrNode === "string" ? _getEl(elOrNode) || console.warn(elOrNode + " not found") : elOrNode, props, simple); 16104}, _recordProps = function _recordProps2(elState, props) { 16105 var getProp = gsap$7.getProperty(elState.element, null, "native"), obj = elState.props = {}, i2 = props.length; 16106 while (i2--) { 16107 obj[props[i2]] = (getProp(props[i2]) + "").trim(); 16108 } 16109 obj.zIndex && (obj.zIndex = parseFloat(obj.zIndex) || 0); 16110 return elState; 16111}, _applyProps = function _applyProps2(element, props) { 16112 var style = element.style || element, p2; 16113 for (p2 in props) { 16114 style[p2] = props[p2]; 16115 } 16116}, _getID = function _getID2(el) { 16117 var id2 = el.getAttribute("data-flip-id"); 16118 id2 || el.setAttribute("data-flip-id", id2 = "auto-" + _id++); 16119 return id2; 16120}, _elementsFromElementStates = function _elementsFromElementStates2(elStates) { 16121 return elStates.map(function(elState) { 16122 return elState.element; 16123 }); 16124}, _handleCallback = function _handleCallback2(callback, elStates, tl) { 16125 return callback && elStates.length && tl.add(callback(_elementsFromElementStates(elStates), tl, new FlipState(elStates, 0, true)), 0); 16126}, _fit = function _fit2(fromState, toState, scale, applyProps, fitChild, vars) { 16127 var element = fromState.element, cache2 = fromState.cache, parent = fromState.parent, x2 = fromState.x, y2 = fromState.y, width = toState.width, height = toState.height, scaleX = toState.scaleX, scaleY = toState.scaleY, rotation = toState.rotation, bounds = toState.bounds, styles = vars && _getStyleSaver2 && _getStyleSaver2(element, "transform"), dimensionState = fromState, _toState$matrix = toState.matrix, e2 = _toState$matrix.e, f2 = _toState$matrix.f, deep = fromState.bounds.width !== bounds.width || fromState.bounds.height !== bounds.height || fromState.scaleX !== scaleX || fromState.scaleY !== scaleY || fromState.rotation !== rotation, simple = !deep && fromState.simple && toState.simple && !fitChild, skewX, fromPoint, toPoint, getProp, parentMatrix, matrix, bbox; 16128 if (simple || !parent) { 16129 scaleX = scaleY = 1; 16130 rotation = skewX = 0; 16131 } else { 16132 parentMatrix = _getInverseGlobalMatrix(parent); 16133 matrix = parentMatrix.clone().multiply(toState.ctm ? toState.matrix.clone().multiply(toState.ctm) : toState.matrix); 16134 rotation = _round$3(Math.atan2(matrix.b, matrix.a) * _RAD2DEG); 16135 skewX = _round$3(Math.atan2(matrix.c, matrix.d) * _RAD2DEG + rotation) % 360; 16136 scaleX = Math.sqrt(Math.pow(matrix.a, 2) + Math.pow(matrix.b, 2)); 16137 scaleY = Math.sqrt(Math.pow(matrix.c, 2) + Math.pow(matrix.d, 2)) * Math.cos(skewX * _DEG2RAD$1); 16138 if (fitChild) { 16139 fitChild = _toArray$5(fitChild)[0]; 16140 getProp = gsap$7.getProperty(fitChild); 16141 bbox = fitChild.getBBox && typeof fitChild.getBBox === "function" && fitChild.getBBox(); 16142 dimensionState = { 16143 scaleX: getProp("scaleX"), 16144 scaleY: getProp("scaleY"), 16145 width: bbox ? bbox.width : Math.ceil(parseFloat(getProp("width", "px"))), 16146 height: bbox ? bbox.height : parseFloat(getProp("height", "px")) 16147 }; 16148 } 16149 cache2.rotation = rotation + "deg";
vendor: 10,205 bytes, lines 16150-16419
16150 cache2.skewX = skewX + "deg"; 16151 } 16152 if (scale) { 16153 scaleX *= width === dimensionState.width || !dimensionState.width ? 1 : width / dimensionState.width; 16154 scaleY *= height === dimensionState.height || !dimensionState.height ? 1 : height / dimensionState.height; 16155 cache2.scaleX = scaleX; 16156 cache2.scaleY = scaleY; 16157 } else { 16158 width = _closestTenth(width * scaleX / dimensionState.scaleX, 0); 16159 height = _closestTenth(height * scaleY / dimensionState.scaleY, 0); 16160 element.style.width = width + "px"; 16161 element.style.height = height + "px"; 16162 } 16163 applyProps && _applyProps(element, toState.props); 16164 if (simple || !parent) { 16165 x2 += e2 - fromState.matrix.e; 16166 y2 += f2 - fromState.matrix.f; 16167 } else if (deep || parent !== toState.parent) { 16168 cache2.renderTransform(1, cache2); 16169 matrix = getGlobalMatrix(fitChild || element, false, false, true); 16170 fromPoint = parentMatrix.apply({ 16171 x: matrix.e, 16172 y: matrix.f 16173 }); 16174 toPoint = parentMatrix.apply({ 16175 x: e2, 16176 y: f2 16177 }); 16178 x2 += toPoint.x - fromPoint.x; 16179 y2 += toPoint.y - fromPoint.y; 16180 } else { 16181 parentMatrix.e = parentMatrix.f = 0; 16182 toPoint = parentMatrix.apply({ 16183 x: e2 - fromState.matrix.e, 16184 y: f2 - fromState.matrix.f 16185 }); 16186 x2 += toPoint.x; 16187 y2 += toPoint.y; 16188 } 16189 x2 = _closestTenth(x2, 0.02); 16190 y2 = _closestTenth(y2, 0.02); 16191 if (vars && !(vars instanceof ElementState)) { 16192 styles && styles.revert(); 16193 } else { 16194 cache2.x = x2 + "px"; 16195 cache2.y = y2 + "px"; 16196 cache2.renderTransform(1, cache2); 16197 } 16198 if (vars) { 16199 vars.x = x2; 16200 vars.y = y2; 16201 vars.rotation = rotation; 16202 vars.skewX = skewX; 16203 if (scale) { 16204 vars.scaleX = scaleX; 16205 vars.scaleY = scaleY; 16206 } else { 16207 vars.width = width; 16208 vars.height = height; 16209 } 16210 } 16211 return vars || cache2; 16212}, _parseState = function _parseState2(targetsOrState, vars) { 16213 return targetsOrState instanceof FlipState ? targetsOrState : new FlipState(targetsOrState, vars); 16214}, _getChangingElState = function _getChangingElState2(toState, fromState, id2) { 16215 var to1 = toState.idLookup[id2], to2 = toState.alt[id2]; 16216 return to2.isVisible && (!(fromState.getElementState(to2.element) || to2).isVisible || !to1.isVisible) ? to2 : to1; 16217}, _bodyMetrics = [], _bodyProps = "width,height,overflowX,overflowY".split(","), _bodyLocked, _lockBodyScroll = function _lockBodyScroll2(lock) { 16218 if (lock !== _bodyLocked) { 16219 var s2 = _body$4.style, w2 = _body$4.clientWidth === window.outerWidth, h2 = _body$4.clientHeight === window.outerHeight, i2 = 4; 16220 if (lock && (w2 || h2)) { 16221 while (i2--) { 16222 _bodyMetrics[i2] = s2[_bodyProps[i2]]; 16223 } 16224 if (w2) { 16225 s2.width = _body$4.clientWidth + "px"; 16226 s2.overflowY = "hidden"; 16227 } 16228 if (h2) { 16229 s2.height = _body$4.clientHeight + "px"; 16230 s2.overflowX = "hidden"; 16231 } 16232 _bodyLocked = lock; 16233 } else if (_bodyLocked) { 16234 while (i2--) { 16235 _bodyMetrics[i2] ? s2[_bodyProps[i2]] = _bodyMetrics[i2] : s2.removeProperty(_camelToDashed(_bodyProps[i2])); 16236 } 16237 _bodyLocked = lock; 16238 } 16239 } 16240}, _fromTo = function _fromTo2(fromState, toState, vars, relative) { 16241 fromState instanceof FlipState && toState instanceof FlipState || console.warn("Not a valid state object."); 16242 vars = vars || {}; 16243 var _vars = vars, clearProps2 = _vars.clearProps, onEnter = _vars.onEnter, onLeave = _vars.onLeave, absolute = _vars.absolute, absoluteOnLeave = _vars.absoluteOnLeave, custom = _vars.custom, delay = _vars.delay, paused = _vars.paused, repeat2 = _vars.repeat, repeatDelay = _vars.repeatDelay, yoyo = _vars.yoyo, toggleClass = _vars.toggleClass, nested = _vars.nested, _zIndex = _vars.zIndex, scale = _vars.scale, fade = _vars.fade, stagger = _vars.stagger, spin = _vars.spin, prune2 = _vars.prune, props = ("props" in vars ? vars : fromState).props, tweenVars = _copy(vars, _reserved), animation = gsap$7.timeline({ 16244 delay, 16245 paused, 16246 repeat: repeat2, 16247 repeatDelay, 16248 yoyo, 16249 data: "isFlip" 16250 }), remainingProps = tweenVars, entering = [], leaving = [], comps = [], swapOutTargets = [], spinNum = spin === true ? 1 : spin || 0, spinFunc = typeof spin === "function" ? spin : function() { 16251 return spinNum; 16252 }, interrupted = fromState.interrupted || toState.interrupted, addFunc = animation[relative !== 1 ? "to" : "from"], v2, p2, endTime, i2, el, comp, state, targets, finalStates, fromNode, toNode, run, a2, b2; 16253 for (p2 in toState.idLookup) { 16254 toNode = !toState.alt[p2] ? toState.idLookup[p2] : _getChangingElState(toState, fromState, p2); 16255 el = toNode.element; 16256 fromNode = fromState.idLookup[p2]; 16257 fromState.alt[p2] && el === fromNode.element && (fromState.alt[p2].isVisible || !toNode.isVisible) && (fromNode = fromState.alt[p2]); 16258 if (fromNode) { 16259 comp = { 16260 t: el, 16261 b: fromNode, 16262 a: toNode, 16263 sd: fromNode.element === el ? 0 : toNode.isVisible ? 1 : -1 16264 }; 16265 comps.push(comp); 16266 if (comp.sd) { 16267 if (comp.sd < 0) { 16268 comp.b = toNode; 16269 comp.a = fromNode; 16270 } 16271 interrupted && _recordInlineStyles(comp.b, props ? _memoizedRemoveProps[props] : _removeProps); 16272 fade && comps.push(comp.swap = { 16273 t: fromNode.element, 16274 b: comp.b, 16275 a: comp.a, 16276 sd: -comp.sd, 16277 swap: comp 16278 }); 16279 } 16280 el._flip = fromNode.element._flip = _batch ? _batch.timeline : animation; 16281 } else if (toNode.isVisible) { 16282 comps.push({ 16283 t: el, 16284 b: _copy(toNode, { 16285 isVisible: 1 16286 }), 16287 a: toNode, 16288 sd: 0, 16289 entering: 1 16290 }); 16291 el._flip = _batch ? _batch.timeline : animation; 16292 } 16293 } 16294 props && (_memoizedProps[props] || _memoizeProps(props)).forEach(function(p3) { 16295 return tweenVars[p3] = function(i3) { 16296 return comps[i3].a.props[p3]; 16297 }; 16298 }); 16299 comps.finalStates = finalStates = []; 16300 run = function run2() { 16301 _orderByDOMDepth(comps); 16302 _lockBodyScroll(true); 16303 for (i2 = 0; i2 < comps.length; i2++) { 16304 comp = comps[i2]; 16305 a2 = comp.a; 16306 b2 = comp.b; 16307 if (prune2 && !a2.isDifferent(b2) && !comp.entering) { 16308 comps.splice(i2--, 1); 16309 } else { 16310 el = comp.t; 16311 nested && !(comp.sd < 0) && i2 && (a2.matrix = getGlobalMatrix(el, false, false, true)); 16312 if (b2.isVisible && a2.isVisible) { 16313 if (comp.sd < 0) { 16314 state = new ElementState(el, props, fromState.simple); 16315 _fit(state, a2, scale, 0, 0, state); 16316 state.matrix = getGlobalMatrix(el, false, false, true); 16317 state.css = comp.b.css; 16318 comp.a = a2 = state; 16319 fade && (el.style.opacity = interrupted ? b2.opacity : a2.opacity); 16320 stagger && swapOutTargets.push(el); 16321 } else if (comp.sd > 0 && fade) { 16322 el.style.opacity = interrupted ? a2.opacity - b2.opacity : "0"; 16323 } 16324 _fit(a2, b2, scale, props); 16325 } else if (b2.isVisible !== a2.isVisible) { 16326 if (!b2.isVisible) { 16327 a2.isVisible && entering.push(a2); 16328 comps.splice(i2--, 1); 16329 } else if (!a2.isVisible) { 16330 b2.css = a2.css; 16331 leaving.push(b2); 16332 comps.splice(i2--, 1); 16333 absolute && nested && _fit(a2, b2, scale, props); 16334 } 16335 } 16336 if (!scale) { 16337 el.style.maxWidth = Math.max(a2.width, b2.width) + "px"; 16338 el.style.maxHeight = Math.max(a2.height, b2.height) + "px"; 16339 el.style.minWidth = Math.min(a2.width, b2.width) + "px"; 16340 el.style.minHeight = Math.min(a2.height, b2.height) + "px"; 16341 } 16342 nested && toggleClass && el.classList.add(toggleClass); 16343 } 16344 finalStates.push(a2); 16345 } 16346 var classTargets; 16347 if (toggleClass) { 16348 classTargets = finalStates.map(function(s2) { 16349 return s2.element; 16350 }); 16351 nested && classTargets.forEach(function(e2) { 16352 return e2.classList.remove(toggleClass); 16353 }); 16354 } 16355 _lockBodyScroll(false); 16356 if (scale) { 16357 tweenVars.scaleX = function(i3) { 16358 return comps[i3].a.scaleX; 16359 }; 16360 tweenVars.scaleY = function(i3) { 16361 return comps[i3].a.scaleY; 16362 }; 16363 } else { 16364 tweenVars.width = function(i3) { 16365 return comps[i3].a.width + "px"; 16366 }; 16367 tweenVars.height = function(i3) { 16368 return comps[i3].a.height + "px"; 16369 }; 16370 tweenVars.autoRound = vars.autoRound || false; 16371 } 16372 tweenVars.x = function(i3) { 16373 return comps[i3].a.x + "px"; 16374 }; 16375 tweenVars.y = function(i3) { 16376 return comps[i3].a.y + "px"; 16377 }; 16378 tweenVars.rotation = function(i3) { 16379 return comps[i3].a.rotation + (spin ? spinFunc(i3, targets[i3], targets) * 360 : 0); 16380 }; 16381 tweenVars.skewX = function(i3) { 16382 return comps[i3].a.skewX; 16383 }; 16384 targets = comps.map(function(c2) { 16385 return c2.t; 16386 }); 16387 if (_zIndex || _zIndex === 0) { 16388 tweenVars.modifiers = { 16389 zIndex: function zIndex() { 16390 return _zIndex; 16391 } 16392 }; 16393 tweenVars.zIndex = _zIndex; 16394 tweenVars.immediateRender = vars.immediateRender !== false; 16395 } 16396 fade && (tweenVars.opacity = function(i3) { 16397 return comps[i3].sd < 0 ? 0 : comps[i3].sd > 0 ? comps[i3].a.opacity : "+=0"; 16398 }); 16399 if (swapOutTargets.length) { 16400 stagger = gsap$7.utils.distribute(stagger); 16401 var dummyArray = targets.slice(swapOutTargets.length); 16402 tweenVars.stagger = function(i3, el2) { 16403 return stagger(~swapOutTargets.indexOf(el2) ? targets.indexOf(comps[i3].swap.t) : i3, el2, dummyArray); 16404 }; 16405 } 16406 _callbacks.forEach(function(name) { 16407 return vars[name] && animation.eventCallback(name, vars[name], vars[name + "Params"]); 16408 }); 16409 if (custom && targets.length) { 16410 remainingProps = _copy(tweenVars, _reserved); 16411 if ("scale" in custom) { 16412 custom.scaleX = custom.scaleY = custom.scale; 16413 delete custom.scale; 16414 } 16415 for (p2 in custom) { 16416 v2 = _copy(custom[p2], _fitReserved); 16417 v2[p2] = tweenVars[p2]; 16418 !("duration" in v2) && "duration" in tweenVars && (v2.duration = tweenVars.duration); 16419 v2.stagger = tweenVars.stagger;
vendor: 4,611 bytes, lines 16420-16535
16420 addFunc.call(animation, targets, v2, 0); 16421 delete remainingProps[p2]; 16422 } 16423 } 16424 if (targets.length || leaving.length || entering.length) { 16425 toggleClass && animation.add(function() { 16426 return _toggleClass(classTargets, toggleClass, animation._zTime < 0 ? "remove" : "add"); 16427 }, 0) && !paused && _toggleClass(classTargets, toggleClass, "add"); 16428 targets.length && addFunc.call(animation, targets, remainingProps, 0); 16429 } 16430 _handleCallback(onEnter, entering, animation); 16431 _handleCallback(onLeave, leaving, animation); 16432 var batchTl = _batch && _batch.timeline; 16433 if (batchTl) { 16434 batchTl.add(animation, 0); 16435 _batch._final.push(function() { 16436 return _setFinalStates(comps, !clearProps2); 16437 }); 16438 } 16439 endTime = animation.duration(); 16440 animation.call(function() { 16441 var forward = animation.time() >= endTime; 16442 forward && !batchTl && _setFinalStates(comps, !clearProps2); 16443 toggleClass && _toggleClass(classTargets, toggleClass, forward ? "remove" : "add"); 16444 }); 16445 }; 16446 absoluteOnLeave && (absolute = comps.filter(function(comp2) { 16447 return !comp2.sd && !comp2.a.isVisible && comp2.b.isVisible; 16448 }).map(function(comp2) { 16449 return comp2.a.element; 16450 })); 16451 if (_batch) { 16452 var _batch$_abs; 16453 absolute && (_batch$_abs = _batch._abs).push.apply(_batch$_abs, _filterComps(comps, absolute)); 16454 _batch._run.push(run); 16455 } else { 16456 absolute && _makeCompsAbsolute(_filterComps(comps, absolute)); 16457 run(); 16458 } 16459 var anim = _batch ? _batch.timeline : animation; 16460 anim.revert = function() { 16461 return _killFlip(anim, 1, 1); 16462 }; 16463 return anim; 16464}, _interrupt2 = function _interrupt3(tl) { 16465 tl.vars.onInterrupt && tl.vars.onInterrupt.apply(tl, tl.vars.onInterruptParams || []); 16466 tl.getChildren(true, false, true).forEach(_interrupt3); 16467}, _killFlip = function _killFlip2(tl, action, force) { 16468 if (tl && tl.progress() < 1 && (!tl.paused() || force)) { 16469 if (action) { 16470 _interrupt2(tl); 16471 action < 2 && tl.progress(1); 16472 tl.kill(); 16473 } 16474 return true; 16475 } 16476}, _createLookup = function _createLookup2(state) { 16477 var lookup = state.idLookup = {}, alt = state.alt = {}, elStates = state.elementStates, i2 = elStates.length, elState; 16478 while (i2--) { 16479 elState = elStates[i2]; 16480 lookup[elState.id] ? alt[elState.id] = elState : lookup[elState.id] = elState; 16481 } 16482}; 16483var FlipState = /* @__PURE__ */ function() { 16484 function FlipState2(targets, vars, targetsAreElementStates) { 16485 this.props = vars && vars.props; 16486 this.simple = !!(vars && vars.simple); 16487 if (targetsAreElementStates) { 16488 this.targets = _elementsFromElementStates(targets); 16489 this.elementStates = targets; 16490 _createLookup(this); 16491 } else { 16492 this.targets = _toArray$5(targets); 16493 var soft = vars && (vars.kill === false || vars.batch && !vars.kill); 16494 _batch && !soft && _batch._kill.push(this); 16495 this.update(soft || !!_batch); 16496 } 16497 } 16498 var _proto = FlipState2.prototype; 16499 _proto.update = function update(soft) { 16500 var _this = this; 16501 this.elementStates = this.targets.map(function(el) { 16502 return new ElementState(el, _this.props, _this.simple); 16503 }); 16504 _createLookup(this); 16505 this.interrupt(soft); 16506 this.recordInlineStyles(); 16507 return this; 16508 }; 16509 _proto.clear = function clear() { 16510 this.targets.length = this.elementStates.length = 0; 16511 _createLookup(this); 16512 return this; 16513 }; 16514 _proto.fit = function fit(state, scale, nested) { 16515 var elStatesInOrder = _orderByDOMDepth(this.elementStates.slice(0), false, true), toElStates = (state || this).idLookup, i2 = 0, fromNode, toNode; 16516 for (; i2 < elStatesInOrder.length; i2++) { 16517 fromNode = elStatesInOrder[i2]; 16518 nested && (fromNode.matrix = getGlobalMatrix(fromNode.element, false, false, true)); 16519 toNode = toElStates[fromNode.id]; 16520 toNode && _fit(fromNode, toNode, scale, true, 0, fromNode); 16521 fromNode.matrix = getGlobalMatrix(fromNode.element, false, false, true); 16522 } 16523 return this; 16524 }; 16525 _proto.getProperty = function getProperty2(element, property) { 16526 var es = this.getElementState(element) || _emptyObj; 16527 return (property in es ? es : es.props || _emptyObj)[property]; 16528 }; 16529 _proto.add = function add2(state) { 16530 var i2 = state.targets.length, lookup = this.idLookup, alt = this.alt, index3, es, es2; 16531 while (i2--) { 16532 es = state.elementStates[i2]; 16533 es2 = lookup[es.id]; 16534 if (es2 && (es.element === es2.element || alt[es.id] && alt[es.id].element === es.element)) { 16535 index3 = this.elementStates.indexOf(es.element === es2.element ? es2 : alt[es.id]);
vendor: 5,309 bytes, lines 16536-16651
16536 this.targets.splice(index3, 1, state.targets[i2]); 16537 this.elementStates.splice(index3, 1, es); 16538 } else { 16539 this.targets.push(state.targets[i2]); 16540 this.elementStates.push(es); 16541 } 16542 } 16543 state.interrupted && (this.interrupted = true); 16544 state.simple || (this.simple = false); 16545 _createLookup(this); 16546 return this; 16547 }; 16548 _proto.compare = function compare(state) { 16549 var l1 = state.idLookup, l2 = this.idLookup, unchanged = [], changed = [], enter = [], leave = [], targets = [], a1 = state.alt, a2 = this.alt, place = function place2(s12, s22, el2) { 16550 return (s12.isVisible !== s22.isVisible ? s12.isVisible ? enter : leave : s12.isVisible ? changed : unchanged).push(el2) && targets.push(el2); 16551 }, placeIfDoesNotExist = function placeIfDoesNotExist2(s12, s22, el2) { 16552 return targets.indexOf(el2) < 0 && place(s12, s22, el2); 16553 }, s1, s2, p2, el, s1Alt, s2Alt, c1, c2; 16554 for (p2 in l1) { 16555 s1Alt = a1[p2]; 16556 s2Alt = a2[p2]; 16557 s1 = !s1Alt ? l1[p2] : _getChangingElState(state, this, p2); 16558 el = s1.element; 16559 s2 = l2[p2]; 16560 if (s2Alt) { 16561 c2 = s2.isVisible || !s2Alt.isVisible && el === s2.element ? s2 : s2Alt; 16562 c1 = s1Alt && !s1.isVisible && !s1Alt.isVisible && c2.element === s1Alt.element ? s1Alt : s1; 16563 if (c1.isVisible && c2.isVisible && c1.element !== c2.element) { 16564 (c1.isDifferent(c2) ? changed : unchanged).push(c1.element, c2.element); 16565 targets.push(c1.element, c2.element); 16566 } else { 16567 place(c1, c2, c1.element); 16568 } 16569 s1Alt && c1.element === s1Alt.element && (s1Alt = l1[p2]); 16570 placeIfDoesNotExist(c1.element !== s2.element && s1Alt ? s1Alt : c1, s2, s2.element); 16571 placeIfDoesNotExist(s1Alt && s1Alt.element === s2Alt.element ? s1Alt : c1, s2Alt, s2Alt.element); 16572 s1Alt && placeIfDoesNotExist(s1Alt, s2Alt.element === s1Alt.element ? s2Alt : s2, s1Alt.element); 16573 } else { 16574 !s2 ? enter.push(el) : !s2.isDifferent(s1) ? unchanged.push(el) : place(s1, s2, el); 16575 s1Alt && placeIfDoesNotExist(s1Alt, s2, s1Alt.element); 16576 } 16577 } 16578 for (p2 in l2) { 16579 if (!l1[p2]) { 16580 leave.push(l2[p2].element); 16581 a2[p2] && leave.push(a2[p2].element); 16582 } 16583 } 16584 return { 16585 changed, 16586 unchanged, 16587 enter, 16588 leave 16589 }; 16590 }; 16591 _proto.recordInlineStyles = function recordInlineStyles() { 16592 var props = _memoizedRemoveProps[this.props] || _removeProps, i2 = this.elementStates.length; 16593 while (i2--) { 16594 _recordInlineStyles(this.elementStates[i2], props); 16595 } 16596 }; 16597 _proto.interrupt = function interrupt(soft) { 16598 var _this2 = this; 16599 var timelines = []; 16600 this.targets.forEach(function(t2) { 16601 var tl = t2._flip, foundInProgress = _killFlip(tl, soft ? 0 : 1); 16602 soft && foundInProgress && timelines.indexOf(tl) < 0 && tl.add(function() { 16603 return _this2.updateVisibility(); 16604 }); 16605 foundInProgress && timelines.push(tl); 16606 }); 16607 !soft && timelines.length && this.updateVisibility(); 16608 this.interrupted || (this.interrupted = !!timelines.length); 16609 }; 16610 _proto.updateVisibility = function updateVisibility() { 16611 this.elementStates.forEach(function(es) { 16612 var b2 = es.element.getBoundingClientRect(); 16613 es.isVisible = !!(b2.width || b2.height || b2.top || b2.left); 16614 es.uncache = 1; 16615 }); 16616 }; 16617 _proto.getElementState = function getElementState(element) { 16618 return this.elementStates[this.targets.indexOf(_getEl(element))]; 16619 }; 16620 _proto.makeAbsolute = function makeAbsolute() { 16621 return _orderByDOMDepth(this.elementStates.slice(0), true, true).map(_makeAbsolute); 16622 }; 16623 return FlipState2; 16624}(); 16625var ElementState = /* @__PURE__ */ function() { 16626 function ElementState2(element, props, simple) { 16627 this.element = element; 16628 this.update(props, simple); 16629 } 16630 var _proto2 = ElementState2.prototype; 16631 _proto2.isDifferent = function isDifferent(state) { 16632 var b1 = this.bounds, b2 = state.bounds; 16633 return b1.top !== b2.top || b1.left !== b2.left || b1.width !== b2.width || b1.height !== b2.height || !this.matrix.equals(state.matrix) || this.opacity !== state.opacity || this.props && state.props && JSON.stringify(this.props) !== JSON.stringify(state.props); 16634 }; 16635 _proto2.update = function update(props, simple) { 16636 var self2 = this, element = self2.element, getProp = gsap$7.getProperty(element), cache2 = gsap$7.core.getCache(element), bounds = element.getBoundingClientRect(), bbox = element.getBBox && typeof element.getBBox === "function" && element.nodeName.toLowerCase() !== "svg" && element.getBBox(), m2 = simple ? new Matrix2D(1, 0, 0, 1, bounds.left + _getDocScrollLeft(), bounds.top + _getDocScrollTop()) : getGlobalMatrix(element, false, false, true); 16637 self2.getProp = getProp; 16638 self2.element = element; 16639 self2.id = _getID(element); 16640 self2.matrix = m2; 16641 self2.cache = cache2; 16642 self2.bounds = bounds; 16643 self2.isVisible = !!(bounds.width || bounds.height || bounds.left || bounds.top); 16644 self2.display = getProp("display"); 16645 self2.position = getProp("position"); 16646 self2.parent = element.parentNode; 16647 self2.x = getProp("x"); 16648 self2.y = getProp("y"); 16649 self2.scaleX = cache2.scaleX; 16650 self2.scaleY = cache2.scaleY; 16651 self2.rotation = getProp("rotation");
vendor: 5,007 bytes, lines 16652-16814
16652 self2.skewX = getProp("skewX"); 16653 self2.opacity = getProp("opacity"); 16654 self2.width = bbox ? bbox.width : _closestTenth(getProp("width", "px"), 0.04); 16655 self2.height = bbox ? bbox.height : _closestTenth(getProp("height", "px"), 0.04); 16656 props && _recordProps(self2, _memoizedProps[props] || _memoizeProps(props)); 16657 self2.ctm = element.getCTM && element.nodeName.toLowerCase() === "svg" && _getCTM(element).inverse(); 16658 self2.simple = simple || _round$3(m2.a) === 1 && !_round$3(m2.b) && !_round$3(m2.c) && _round$3(m2.d) === 1; 16659 self2.uncache = 0; 16660 }; 16661 return ElementState2; 16662}(); 16663var FlipAction = /* @__PURE__ */ function() { 16664 function FlipAction2(vars, batch) { 16665 this.vars = vars; 16666 this.batch = batch; 16667 this.states = []; 16668 this.timeline = batch.timeline; 16669 } 16670 var _proto3 = FlipAction2.prototype; 16671 _proto3.getStateById = function getStateById(id2) { 16672 var i2 = this.states.length; 16673 while (i2--) { 16674 if (this.states[i2].idLookup[id2]) { 16675 return this.states[i2]; 16676 } 16677 } 16678 }; 16679 _proto3.kill = function kill3() { 16680 this.batch.remove(this); 16681 }; 16682 return FlipAction2; 16683}(); 16684var FlipBatch = /* @__PURE__ */ function() { 16685 function FlipBatch2(id2) { 16686 this.id = id2; 16687 this.actions = []; 16688 this._kill = []; 16689 this._final = []; 16690 this._abs = []; 16691 this._run = []; 16692 this.data = {}; 16693 this.state = new FlipState(); 16694 this.timeline = gsap$7.timeline(); 16695 } 16696 var _proto4 = FlipBatch2.prototype; 16697 _proto4.add = function add2(config4) { 16698 var result = this.actions.filter(function(action) { 16699 return action.vars === config4; 16700 }); 16701 if (result.length) { 16702 return result[0]; 16703 } 16704 result = new FlipAction(typeof config4 === "function" ? { 16705 animate: config4 16706 } : config4, this); 16707 this.actions.push(result); 16708 return result; 16709 }; 16710 _proto4.remove = function remove(action) { 16711 var i2 = this.actions.indexOf(action); 16712 i2 >= 0 && this.actions.splice(i2, 1); 16713 return this; 16714 }; 16715 _proto4.getState = function getState(merge3) { 16716 var _this3 = this; 16717 var prevBatch = _batch, prevAction = _batchAction; 16718 _batch = this; 16719 this.state.clear(); 16720 this._kill.length = 0; 16721 this.actions.forEach(function(action) { 16722 if (action.vars.getState) { 16723 action.states.length = 0; 16724 _batchAction = action; 16725 action.state = action.vars.getState(action); 16726 } 16727 merge3 && action.states.forEach(function(s2) { 16728 return _this3.state.add(s2); 16729 }); 16730 }); 16731 _batchAction = prevAction; 16732 _batch = prevBatch; 16733 this.killConflicts(); 16734 return this; 16735 }; 16736 _proto4.animate = function animate() { 16737 var _this4 = this; 16738 var prevBatch = _batch, tl = this.timeline, i2 = this.actions.length, finalStates, endTime; 16739 _batch = this; 16740 tl.clear(); 16741 this._abs.length = this._final.length = this._run.length = 0; 16742 this.actions.forEach(function(a2) { 16743 a2.vars.animate && a2.vars.animate(a2); 16744 var onEnter = a2.vars.onEnter, onLeave = a2.vars.onLeave, targets = a2.targets, s2, result; 16745 if (targets && targets.length && (onEnter || onLeave)) { 16746 s2 = new FlipState(); 16747 a2.states.forEach(function(state) { 16748 return s2.add(state); 16749 }); 16750 result = s2.compare(Flip.getState(targets)); 16751 result.enter.length && onEnter && onEnter(result.enter); 16752 result.leave.length && onLeave && onLeave(result.leave); 16753 } 16754 }); 16755 _makeCompsAbsolute(this._abs); 16756 this._run.forEach(function(f2) { 16757 return f2(); 16758 }); 16759 endTime = tl.duration(); 16760 finalStates = this._final.slice(0); 16761 tl.add(function() { 16762 if (endTime <= tl.time()) { 16763 finalStates.forEach(function(f2) { 16764 return f2(); 16765 }); 16766 _forEachBatch(_this4, "onComplete"); 16767 } 16768 }); 16769 _batch = prevBatch; 16770 while (i2--) { 16771 this.actions[i2].vars.once && this.actions[i2].kill(); 16772 } 16773 _forEachBatch(this, "onStart"); 16774 tl.restart(); 16775 return this; 16776 }; 16777 _proto4.loadState = function loadState(done) { 16778 done || (done = function done2() { 16779 return 0; 16780 }); 16781 var queue = []; 16782 this.actions.forEach(function(c2) { 16783 if (c2.vars.loadState) { 16784 var i2, f2 = function f3(targets) { 16785 targets && (c2.targets = targets); 16786 i2 = queue.indexOf(f3); 16787 if (~i2) { 16788 queue.splice(i2, 1); 16789 queue.length || done(); 16790 } 16791 }; 16792 queue.push(f2); 16793 c2.vars.loadState(f2); 16794 } 16795 }); 16796 queue.length || done(); 16797 return this; 16798 }; 16799 _proto4.setState = function setState() { 16800 this.actions.forEach(function(c2) { 16801 return c2.targets = c2.vars.setState && c2.vars.setState(c2); 16802 }); 16803 return this; 16804 }; 16805 _proto4.killConflicts = function killConflicts(soft) { 16806 this.state.interrupt(soft); 16807 this._kill.forEach(function(state) { 16808 return state.interrupt(soft); 16809 }); 16810 return this; 16811 }; 16812 _proto4.run = function run(skipGetState, merge3) { 16813 var _this5 = this; 16814 if (this !== _batch) {
16815 skipGetState || this.getState(merge3); 16816 this.loadState(function() { 16817 if (!_this5._killed) { 16818 _this5.setState(); 16819 _this5.animate(); 16820 } 16821 }); 16822 } 16823 return this; 16824 }; 16825 _proto4.clear = function clear(stateOnly) { 16826 this.state.clear(); 16827 stateOnly || (this.actions.length = 0); 16828 }; 16829 _proto4.getStateById = function getStateById(id2) { 16830 var i2 = this.actions.length, s2; 16831 while (i2--) { 16832 s2 = this.actions[i2].getStateById(id2); 16833 if (s2) { 16834 return s2; 16835 } 16836 } 16837 return this.state.idLookup[id2] && this.state; 16838 }; 16839 _proto4.kill = function kill3() { 16840 this._killed = 1; 16841 this.clear(); 16842 delete _batchLookup[this.id]; 16843 }; 16844 return FlipBatch2; 16845}(); 16846var Flip = /* @__PURE__ */ function() { 16847 function Flip2() { 16848 } 16849 Flip2.getState = function getState(targets, vars) { 16850 var state = _parseState(targets, vars); 16851 _batchAction && _batchAction.states.push(state); 16852 vars && vars.batch && Flip2.batch(vars.batch).state.add(state); 16853 return state; 16854 }; 16855 Flip2.from = function from(state, vars) { 16856 vars = vars || {}; 16857 "clearProps" in vars || (vars.clearProps = true); 16858 return _fromTo(state, _parseState(vars.targets || state.targets, { 16859 props: vars.props || state.props, 16860 simple: vars.simple, 16861 kill: !!vars.kill 16862 }), vars, -1); 16863 }; 16864 Flip2.to = function to(state, vars) { 16865 return _fromTo(state, _parseState(vars.targets || state.targets, { 16866 props: vars.props || state.props, 16867 simple: vars.simple, 16868 kill: !!vars.kill 16869 }), vars, 1); 16870 }; 16871 Flip2.fromTo = function fromTo(fromState, toState, vars) { 16872 return _fromTo(fromState, toState, vars); 16873 }; 16874 Flip2.fit = function fit(fromEl, toEl, vars) { 16875 var v2 = vars ? _copy(vars, _fitReserved) : {}, _ref = vars || v2, absolute = _ref.absolute, scale = _ref.scale, getVars = _ref.getVars, props = _ref.props, runBackwards = _ref.runBackwards, onComplete = _ref.onComplete, simple = _ref.simple, fitChild = vars && vars.fitChild && _getEl(vars.fitChild), before = _parseElementState(toEl, props, simple, fromEl), after = _parseElementState(fromEl, 0, simple, before), inlineProps = props ? _memoizedRemoveProps[props] : _removeProps, ctx2 = gsap$7.context(); 16876 props && _applyProps(v2, before.props); 16877 _recordInlineStyles(after, inlineProps); 16878 if (runBackwards) { 16879 "immediateRender" in v2 || (v2.immediateRender = true); 16880 v2.onComplete = function() { 16881 _applyInlineStyles(after); 16882 onComplete && onComplete.apply(this, arguments); 16883 }; 16884 } 16885 absolute && _makeAbsolute(after, before); 16886 v2 = _fit(after, before, scale || fitChild, props, fitChild, v2.duration || getVars ? v2 : 0); 16887 ctx2 && !getVars && ctx2.add(function() { 16888 return function() { 16889 return _applyInlineStyles(after); 16890 }; 16891 }); 16892 return getVars ? v2 : v2.duration ? gsap$7.to(after.element, v2) : null; 16893 }; 16894 Flip2.makeAbsolute = function makeAbsolute(targetsOrStates, vars) { 16895 return (targetsOrStates instanceof FlipState ? targetsOrStates : new FlipState(targetsOrStates, vars)).makeAbsolute(); 16896 }; 16897 Flip2.batch = function batch(id2) { 16898 id2 || (id2 = "default"); 16899 return _batchLookup[id2] || (_batchLookup[id2] = new FlipBatch(id2)); 16900 }; 16901 Flip2.killFlipsOf = function killFlipsOf(targets, complete) { 16902 (targets instanceof FlipState ? targets.targets : _toArray$5(targets)).forEach(function(t2) { 16903 return t2 && _killFlip(t2._flip, complete !== false ? 1 : 2); 16904 }); 16905 }; 16906 Flip2.isFlipping = function isFlipping(target) { 16907 var f2 = Flip2.getByTarget(target); 16908 return !!f2 && f2.isActive(); 16909 }; 16910 Flip2.getByTarget = function getByTarget(target) { 16911 return (_getEl(target) || _emptyObj)._flip; 16912 }; 16913 Flip2.getElementState = function getElementState(target, props) { 16914 return new ElementState(_getEl(target), props); 16915 }; 16916 Flip2.convertCoordinates = function convertCoordinates(fromElement, toElement2, point) { 16917 var m2 = getGlobalMatrix(toElement2, true, true).multiply(getGlobalMatrix(fromElement)); 16918 return point ? m2.apply(point) : m2; 16919 }; 16920 Flip2.register = function register3(core) { 16921 _body$4 = typeof document !== "undefined" && document.body; 16922 if (_body$4) { 16923 gsap$7 = core; 16924 _setDoc(_body$4); 16925 _toArray$5 = gsap$7.utils.toArray; 16926 _getStyleSaver2 = gsap$7.core.getStyleSaver; 16927 var snap3 = gsap$7.utils.snap(0.1); 16928 _closestTenth = function _closestTenth2(value, add2) { 16929 return snap3(parseFloat(value) + add2); 16930 }; 16931 } 16932 }; 16933 return Flip2; 16934}(); 16935Flip.version = "3.12.5"; 16936typeof window !== "undefined" && window.gsap && window.gsap.registerPlugin(Flip); 16937/*! 16938 * strings: 3.12.5 16939 * https://gsap.com 16940 * 16941 * Copyright 2008-2024, GreenSock. All rights reserved. 16942 * Subject to the terms at https://gsap.com/standard-license or for 16943 * Club GSAP members, the agreement issued with that membership. 16944 * @author: Jack Doyle, [email protected] 16945*/ 16946var _trimExp = /(?:^\s+|\s+$)/g; 16947var emojiExp = /([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uD
vendor: 4,870 bytes, lines 16947-17013
16947FC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/; 16948function getText(e2) { 16949 var type = e2.nodeType, result = ""; 16950 if (type === 1 || type === 9 || type === 11) { 16951 if (typeof e2.textContent === "string") { 16952 return e2.textContent; 16953 } else { 16954 for (e2 = e2.firstChild; e2; e2 = e2.nextSibling) { 16955 result += getText(e2); 16956 } 16957 } 16958 } else if (type === 3 || type === 4) { 16959 return e2.nodeValue; 16960 } 16961 return result; 16962} 16963function splitInnerHTML(element, delimiter, trim, preserveSpaces) { 16964 var node = element.firstChild, result = [], s2; 16965 while (node) { 16966 if (node.nodeType === 3) { 16967 s2 = (node.nodeValue + "").replace(/^\n+/g, ""); 16968 if (!preserveSpaces) { 16969 s2 = s2.replace(/\s+/g, " "); 16970 } 16971 result.push.apply(result, emojiSafeSplit(s2, delimiter, trim, preserveSpaces)); 16972 } else if ((node.nodeName + "").toLowerCase() === "br") { 16973 result[result.length - 1] += "<br>"; 16974 } else { 16975 result.push(node.outerHTML); 16976 } 16977 node = node.nextSibling; 16978 } 16979 s2 = result.length; 16980 while (s2--) { 16981 result[s2] === "&" && result.splice(s2, 1, "&"); 16982 } 16983 return result; 16984} 16985function emojiSafeSplit(text, delimiter, trim, preserveSpaces) { 16986 text += ""; 16987 trim && (text = text.trim ? text.trim() : text.replace(_trimExp, "")); 16988 if (delimiter && delimiter !== "") { 16989 return text.replace(/>/g, ">").replace(/</g, "<").split(delimiter); 16990 } 16991 var result = [], l2 = text.length, i2 = 0, j2, character; 16992 for (; i2 < l2; i2++) { 16993 character = text.charAt(i2); 16994 if (character.charCodeAt(0) >= 55296 && character.charCodeAt(0) <= 56319 || text.charCodeAt(i2 + 1) >= 65024 && text.charCodeAt(i2 + 1) <= 65039) { 16995 j2 = ((text.substr(i2, 12).split(emojiExp) || [])[1] || "").length || 2; 16996 character = text.substr(i2, j2); 16997 result.emoji = 1; 16998 i2 += j2 - 1; 16999 } 17000 result.push(character === ">" ? ">" : character === "<" ? "<" : preserveSpaces && character === " " && (text.charAt(i2 - 1) === " " || text.charAt(i2 + 1) === " ") ? " " : character); 17001 } 17002 return result; 17003} 17004/*! 17005 * TextPlugin 3.12.5 17006 * https://gsap.com 17007 * 17008 * @license Copyright 2008-2024, GreenSock. All rights reserved. 17009 * Subject to the terms at https://gsap.com/standard-license or for 17010 * Club GSAP members, the agreement issued with that membership. 17011 * @author: Jack Doyle, [email protected] 17012*/ 17013var gsap$6, _tempDiv, _getGSAP$5 = function _getGSAP() {
vendor: 4,079 bytes, lines 17014-17118
17014 return gsap$6 || typeof window !== "undefined" && (gsap$6 = window.gsap) && gsap$6.registerPlugin && gsap$6; 17015}; 17016var TextPlugin = { 17017 version: "3.12.5", 17018 name: "text", 17019 init: function init4(target, value, tween) { 17020 typeof value !== "object" && (value = { 17021 value 17022 }); 17023 var i2 = target.nodeName.toUpperCase(), data = this, _value = value, newClass = _value.newClass, oldClass = _value.oldClass, preserveSpaces = _value.preserveSpaces, rtl = _value.rtl, delimiter = data.delimiter = value.delimiter || "", fillChar = data.fillChar = value.fillChar || (value.padSpace ? " " : ""), _short, text, original, j2, condensedText, condensedOriginal, aggregate, s2; 17024 data.svg = target.getBBox && (i2 === "TEXT" || i2 === "TSPAN"); 17025 if (!("innerHTML" in target) && !data.svg) { 17026 return false; 17027 } 17028 data.target = target; 17029 if (!("value" in value)) { 17030 data.text = data.original = [""]; 17031 return; 17032 } 17033 original = splitInnerHTML(target, delimiter, false, preserveSpaces); 17034 _tempDiv || (_tempDiv = document.createElement("div")); 17035 _tempDiv.innerHTML = value.value; 17036 text = splitInnerHTML(_tempDiv, delimiter, false, preserveSpaces); 17037 data.from = tween._from; 17038 if ((data.from || rtl) && !(rtl && data.from)) { 17039 i2 = original; 17040 original = text; 17041 text = i2; 17042 } 17043 data.hasClass = !!(newClass || oldClass); 17044 data.newClass = rtl ? oldClass : newClass; 17045 data.oldClass = rtl ? newClass : oldClass; 17046 i2 = original.length - text.length; 17047 _short = i2 < 0 ? original : text; 17048 if (i2 < 0) { 17049 i2 = -i2; 17050 } 17051 while (--i2 > -1) { 17052 _short.push(fillChar); 17053 } 17054 if (value.type === "diff") { 17055 j2 = 0; 17056 condensedText = []; 17057 condensedOriginal = []; 17058 aggregate = ""; 17059 for (i2 = 0; i2 < text.length; i2++) { 17060 s2 = text[i2]; 17061 if (s2 === original[i2]) { 17062 aggregate += s2; 17063 } else { 17064 condensedText[j2] = aggregate + s2; 17065 condensedOriginal[j2++] = aggregate + original[i2]; 17066 aggregate = ""; 17067 } 17068 } 17069 text = condensedText; 17070 original = condensedOriginal; 17071 if (aggregate) { 17072 text.push(aggregate); 17073 original.push(aggregate); 17074 } 17075 } 17076 value.speed && tween.duration(Math.min(0.05 / value.speed * _short.length, value.maxDuration || 9999)); 17077 data.rtl = rtl; 17078 data.original = original; 17079 data.text = text; 17080 data._props.push("text"); 17081 }, 17082 render: function render3(ratio, data) { 17083 if (ratio > 1) { 17084 ratio = 1; 17085 } else if (ratio < 0) { 17086 ratio = 0; 17087 } 17088 if (data.from) { 17089 ratio = 1 - ratio; 17090 } 17091 var text = data.text, hasClass = data.hasClass, newClass = data.newClass, oldClass = data.oldClass, delimiter = data.delimiter, target = data.target, fillChar = data.fillChar, original = data.original, rtl = data.rtl, l2 = text.length, i2 = (rtl ? 1 - ratio : ratio) * l2 + 0.5 | 0, applyNew, applyOld, str; 17092 if (hasClass && ratio) { 17093 applyNew = newClass && i2; 17094 applyOld = oldClass && i2 !== l2; 17095 str = (applyNew ? "<span class='" + newClass + "'>" : "") + text.slice(0, i2).join(delimiter) + (applyNew ? "</span>" : "") + (applyOld ? "<span class='" + oldClass + "'>" : "") + delimiter + original.slice(i2).join(delimiter) + (applyOld ? "</span>" : ""); 17096 } else { 17097 str = text.slice(0, i2).join(delimiter) + delimiter + original.slice(i2).join(delimiter); 17098 } 17099 if (data.svg) { 17100 target.textContent = str; 17101 } else { 17102 target.innerHTML = fillChar === " " && ~str.indexOf(" ") ? str.split(" ").join(" ") : str; 17103 } 17104 } 17105}; 17106TextPlugin.splitInnerHTML = splitInnerHTML; 17107TextPlugin.emojiSafeSplit = emojiSafeSplit; 17108TextPlugin.getText = getText; 17109_getGSAP$5() && gsap$6.registerPlugin(TextPlugin); 17110/*! 17111 * SplitText: 3.12.5 17112 * https://gsap.com 17113 * 17114 * @license Copyright 2008-2024, GreenSock. All rights reserved. 17115 * Subject to the terms at https://gsap.com/standard-license or for 17116 * Club GSAP members, the agreement issued with that membership. 17117 * @author: Jack Doyle, [email protected] 17118*/
17119var _doc$3, _win$3, _coreInitted$5, gsap$5, _context$3, _toArray$4, _stripExp = /(?:\r|\n|\t\t)/g, _multipleSpacesExp = /(?:\s\s+)/g, _nonBreakingSpace = String.fromCharCode(160), _initCore$3 = function _initCore2(core) { 17120 _doc$3 = document; 17121 _win$3 = window; 17122 gsap$5 = gsap$5 || core || _win$3.gsap || console.warn("Please gsap.registerPlugin(SplitText)"); 17123 if (gsap$5) { 17124 _toArray$4 = gsap$5.utils.toArray; 17125 _context$3 = gsap$5.core.context || function() { 17126 }; 17127 _coreInitted$5 = 1; 17128 } 17129}, _getComputedStyle$1 = function _getComputedStyle(element) { 17130 return _win$3.getComputedStyle(element); 17131}, _isAbsolute = function _isAbsolute2(vars) { 17132 return vars.position === "absolute" || vars.absolute === true; 17133}, _findSpecialChars = function _findSpecialChars2(text, chars) { 17134 var i2 = chars.length, s2; 17135 while (--i2 > -1) { 17136 s2 = chars[i2]; 17137 if (text.substr(0, s2.length) === s2) { 17138 return s2.length; 17139 } 17140 } 17141}, _divStart = " style='position:relative;display:inline-block;'", _cssClassFunc = function _cssClassFunc2(cssClass, tag) { 17142 if (cssClass === void 0) { 17143 cssClass = ""; 17144 } 17145 var iterate = ~cssClass.indexOf("++"), num = 1; 17146 if (iterate) { 17147 cssClass = cssClass.split("++").join(""); 17148 } 17149 return function() { 17150 return "<" + tag + _divStart + (cssClass ? " class='" + cssClass + (iterate ? num++ : "") + "'>" : ">"); 17151 }; 17152}, _swapText = function _swapText2(element, oldText, newText) { 17153 var type = element.nodeType; 17154 if (type === 1 || type === 9 || type === 11) { 17155 for (element = element.firstChild; element; element = element.nextSibling) { 17156 _swapText2(element, oldText, newText); 17157 } 17158 } else if (type === 3 || type === 4) { 17159 element.nodeValue = element.nodeValue.split(oldText).join(newText); 17160 } 17161}, _pushReversed = function _pushReversed2(a2, merge3) { 17162 var i2 = merge3.length; 17163 while (--i2 > -1) { 17164 a2.push(merge3[i2]); 17165 } 17166}, _isBeforeWordDelimiter = function _isBeforeWordDelimiter2(e2, root, wordDelimiter) { 17167 var next2; 17168 while (e2 && e2 !== root) { 17169 next2 = e2._next || e2.nextSibling; 17170 if (next2) { 17171 return next2.textContent.charAt(0) === wordDelimiter; 17172 } 17173 e2 = e2.parentNode || e2._parent; 17174 } 17175}, _deWordify = function _deWordify2(e2) { 17176 var children = _toArray$4(e2.childNodes), l2 = children.length, i2, child; 17177 for (i2 = 0; i2 < l2; i2++) { 17178 child = children[i2]; 17179 if (child._isSplit) { 17180 _deWordify2(child); 17181 } else { 17182 if (i2 && child.previousSibling && child.previousSibling.nodeType === 3) { 17183 child.previousSibling.nodeValue += child.nodeType === 3 ? child.nodeValue : child.firstChild.nodeValue; 17184 e2.removeChild(child); 17185 } else if (child.nodeType !== 3) { 17186 e2.insertBefore(child.firstChild, child); 17187 e2.removeChild(child); 17188 } 17189 } 17190 } 17191}, _getStyleAsNumber = function _getStyleAsNumber2(name, computedStyle) { 17192 return parseFloat(computedStyle[name]) || 0; 17193}, _setPositionsAfterSplit = function _setPositionsAfterSplit2(element, vars, allChars, allWords, allLines, origWidth, origHeight) { 17194 var cs = _getComputedStyle$1(element), paddingLeft = _getStyleAsNumber("paddingLeft", cs), lineOffsetY = -999, borderTopAndBottom = _getStyleAsNumber("borderBottomWidth", cs) + _getStyleAsNumber("borderTopWidth", cs), borderLeftAndRight = _getStyleAsNumber("borderLeftWidth", cs) + _getStyleAsNumber("borderRightWidth", cs), padTopAndBottom = _getStyleAsNumber("paddingTop", cs) + _getStyleAsNumber("paddingBottom", cs), padLeftAndRight = _getStyleAsNumber("paddingLeft", cs) + _getStyleAsNumber("paddingRight", cs), lineThreshold = _getStyleAsNumber("fontSize", cs) * (vars.lineThreshold || 0.2), textAlign = cs.textAlign, charArray = [], wordArray = [], lineArray = [], wordDelimiter = vars.wordDelimiter || " ", tag = vars.tag ? vars.tag : vars.span ? "span" : "div", types = vars.type || vars.split || "chars,words,lines", lines = allLines && ~types.indexOf("lines") ? [] : null, words = ~types.indexOf("words"), chars = ~types.indexOf("chars"), absolute = _isAbsolute(vars), linesClass = vars.linesClass, iterateLine = ~(linesClass || "").indexOf("++"), spaceNodesToRemove = [], isFlex = cs.display === "flex", prevInlineDis
17194play = element.style.display, i2, j2, l2, node, nodes, isChild, curLine, addWordSpaces, style, lineNode, lineWidth, offset; 17195 iterateLine && (linesClass = linesClass.split("++").join("")); 17196 isFlex && (element.style.display = "block"); 17197 j2 = element.getElementsByTagName("*"); 17198 l2 = j2.length; 17199 nodes = []; 17200 for (i2 = 0; i2 < l2; i2++) { 17201 nodes[i2] = j2[i2]; 17202 } 17203 if (lines || absolute) { 17204 for (i2 = 0; i2 < l2; i2++) { 17205 node = nodes[i2]; 17206 isChild = node.parentNode === element; 17207 if (isChild || absolute || chars && !words) { 17208 offset = node.offsetTop; 17209 if (lines && isChild && Math.abs(offset - lineOffsetY) > lineThreshold && (node.nodeName !== "BR" || i2 === 0)) { 17210 curLine = []; 17211 lines.push(curLine); 17212 lineOffsetY = offset; 17213 } 17214 if (absolute) { 17215 node._x = node.offsetLeft; 17216 node._y = offset; 17217 node._w = node.offsetWidth; 17218 node._h = node.offsetHeight; 17219 } 17220 if (lines) { 17221 if (node._isSplit && isChild || !chars && isChild || words && isChild || !words && node.parentNode.parentNode === element && !node.parentNode._isSplit) { 17222 curLine.push(node); 17223 node._x -= paddingLeft; 17224 if (_isBeforeWordDelimiter(node, element, wordDelimiter)) { 17225 node._wordEnd = true; 17226 } 17227 } 17228 if (node.nodeName === "BR" && (node.nextSibling && node.nextSibling.nodeName === "BR" || i2 === 0)) { 17229 lines.push([]); 17230 } 17231 } 17232 } 17233 } 17234 } 17235 for (i2 = 0; i2 < l2; i2++) { 17236 node = nodes[i2]; 17237 isChild = node.parentNode === element; 17238 if (node.nodeName === "BR") { 17239 if (lines || absolute) { 17240 node.parentNode && node.parentNode.removeChild(node); 17241 nodes.splice(i2--, 1); 17242 l2--; 17243 } else if (!words) { 17244 element.appendChild(node); 17245 } 17246 continue; 17247 } 17248 if (absolute) { 17249 style = node.style; 17250 if (!words && !isChild) { 17251 node._x += node.parentNode._x; 17252 node._y += node.parentNode._y; 17253 } 17254 style.left = node._x + "px"; 17255 style.top = node._y + "px"; 17256 style.position = "absolute"; 17257 style.display = "block"; 17258 style.width = node._w + 1 + "px"; 17259 style.height = node._h + "px"; 17260 } 17261 if (!words && chars) { 17262 if (node._isSplit) { 17263 node._next = j2 = node.nextSibling; 17264 node.parentNode.appendChild(node); 17265 while (j2 && j2.nodeType === 3 && j2.textContent === " ") { 17266 node._next = j2.nextSibling; 17267 node.parentNode.appendChild(j2); 17268 j2 = j2.nextSibling; 17269 } 17270 } else if (node.parentNode._isSplit) { 17271 node._parent = node.parentNode; 17272 if (!node.previousSibling && node.firstChild) { 17273 node.firstChild._isFirst = true; 17274 } 17275 if (node.nextSibling && node.nextSibling.textContent === " " && !node.nextSibling.nextSibling) { 17276 spaceNodesToRemove.push(node.nextSibling); 17277 } 17278 node._next = node.nextSibling && node.nextSibling._isFirst ? null : node.nextSibling; 17279 node.parentNode.removeChild(node); 17280 nodes.splice(i2--, 1); 17281 l2--; 17282 } else if (!isChild) { 17283 offset = !node.nextSibling && _isBeforeWordDelimiter(node.parentNode, element, wordDelimiter); 17284 node.parentNode._parent && node.parentNode._parent.appendChild(node); 17285 offset && node.parentNode.appendChild(_doc$3.createTextNode(" ")); 17286 if (tag === "span") { 17287 node.style.display = "inline"; 17288 } 17289 charArray.push(node); 17290 } 17291 } else if (node.parentNode._isSplit && !node._isSplit && node.innerHTML !== "") { 17292 wordArray.push(node); 17293 } else if (chars && !node._isSplit) { 17294 if (tag === "span") { 17295 node.style.display = "inline"; 17296 } 17297 charArray.push(node); 17298 } 17299 } 17300 i2 = spaceNodesToRemove.length; 17301 while (--i2 > -1) { 17302 spaceNodesToRemove[i2].parentNode.removeChild(spaceNodesToRemove[i2]); 17303 } 17304 if (lines) { 17305 if (absolute) { 17306 lineNode = _doc$3.createElement(tag); 17307 element.appendChild(lineNode); 17308 lineWidth = lineNode.offsetWidth + "px"; 17309 offset = lineNode.offsetParent === element ? 0 : element.offsetLeft; 17310 element.removeChild(lineNode); 17311 } 17312 style = element.style.cssText; 17313 element.style.cssText = "display:none;"; 17314 while (element.firstChild) { 17315 element.removeChild(element.firstChild); 17316 } 17317 addWordSpaces = wordDelimiter === " " && (!absolute || !words && !c
17317hars); 17318 for (i2 = 0; i2 < lines.length; i2++) { 17319 curLine = lines[i2]; 17320 lineNode = _doc$3.createElement(tag); 17321 lineNode.style.cssText = "display:block;text-align:" + textAlign + ";position:" + (absolute ? "absolute;" : "relative;"); 17322 if (linesClass) { 17323 lineNode.className = linesClass + (iterateLine ? i2 + 1 : ""); 17324 } 17325 lineArray.push(lineNode); 17326 l2 = curLine.length; 17327 for (j2 = 0; j2 < l2; j2++) { 17328 if (curLine[j2].nodeName !== "BR") { 17329 node = curLine[j2]; 17330 lineNode.appendChild(node); 17331 addWordSpaces && node._wordEnd && lineNode.appendChild(_doc$3.createTextNode(" ")); 17332 if (absolute) { 17333 if (j2 === 0) { 17334 lineNode.style.top = node._y + "px"; 17335 lineNode.style.left = paddingLeft + offset + "px"; 17336 } 17337 node.style.top = "0px"; 17338 if (offset) { 17339 node.style.left = node._x - offset + "px"; 17340 } 17341 } 17342 } 17343 } 17344 if (l2 === 0) { 17345 lineNode.innerHTML = " "; 17346 } else if (!words && !chars) { 17347 _deWordify(lineNode); 17348 _swapText(lineNode, String.fromCharCode(160), " "); 17349 } 17350 if (absolute) { 17351 lineNode.style.width = lineWidth; 17352 lineNode.style.height = node._h + "px"; 17353 } 17354 element.appendChild(lineNode); 17355 } 17356 element.style.cssText = style; 17357 } 17358 if (absolute) { 17359 if (origHeight > element.clientHeight) { 17360 element.style.height = origHeight - padTopAndBottom + "px"; 17361 if (element.clientHeight < origHeight) { 17362 element.style.height = origHeight + borderTopAndBottom + "px"; 17363 } 17364 } 17365 if (origWidth > element.clientWidth) { 17366 element.style.width = origWidth - padLeftAndRight + "px"; 17367 if (element.clientWidth < origWidth) { 17368 element.style.width = origWidth + borderLeftAndRight + "px"; 17369 } 17370 } 17371 } 17372 isFlex && (prevInlineDisplay ? element.style.display = prevInlineDisplay : element.style.removeProperty("display")); 17373 _pushReversed(allChars, charArray); 17374 words && _pushReversed(allWords, wordArray); 17375 _pushReversed(allLines, lineArray); 17376}, _splitRawText = function _splitRawText2(element, vars, wordStart, charStart) { 17377 var tag = vars.tag ? vars.tag : vars.span ? "span" : "div", types = vars.type || vars.split || "chars,words,lines", chars = ~types.indexOf("chars"), absolute = _isAbsolute(vars), wordDelimiter = vars.wordDelimiter || " ", isWordDelimiter = function isWordDelimiter2(_char) { 17378 return _char === wordDelimiter || _char === _nonBreakingSpace && wordDelimiter === " "; 17379 }, space = wordDelimiter !== " " ? "" : absolute ? "­ " : " ", wordEnd = "</" + tag + ">", wordIsOpen = 1, specialChars = vars.specialChars ? typeof vars.specialChars === "function" ? vars.specialChars : _findSpecialChars : null, text, splitText, i2, j2, l2, character, hasTagStart, testResult, container = _doc$3.createElement("div"), parent = element.parentNode; 17380 parent.insertBefore(container, element); 17381 container.textContent = element.nodeValue; 17382 parent.removeChild(element); 17383 element = container; 17384 text = getText(element); 17385 hasTagStart = text.indexOf("<") !== -1; 17386 if (vars.reduceWhiteSpace !== false) { 17387 text = text.replace(_multipleSpacesExp, " ").replace(_stripExp, ""); 17388 } 17389 if (hasTagStart) { 17390 text = text.split("<").join("{{LT}}"); 17391 } 17392 l2 = text.length; 17393 splitText = (text.charAt(0) === " " ? space : "") + wordStart(); 17394 for (i2 = 0; i2 < l2; i2++) { 17395 character = text.charAt(i2); 17396 if (specialChars && (testResult = specialChars(text.substr(i2), vars.specialChars))) { 17397 character = text.substr(i2, testResult || 1); 17398 splitText += chars && character !== " " ? charStart() + character + "</" + tag + ">" : character; 17399 i2 += testResult - 1; 17400 } else if (isWordDelimiter(character) && !isWordDelimiter(text.charAt(i2 - 1)) && i2) { 17401 splitText += wordIsOpen ? wordEnd : ""; 17402 wordIsOpen = 0; 17403 while (isWordDelimiter(text.charAt(i2 + 1))) { 17404 splitText += space; 17405 i2++; 17406 } 17407 if (i2 === l2 - 1) { 17408 splitText += space; 17409 } else if (text.charAt(i2 + 1) !== ")") {
17410 splitText += space + wordStart(); 17411 wordIsOpen = 1; 17412 } 17413 } else if (character === "{" && text.substr(i2, 6) === "{{LT}}") { 17414 splitText += chars ? charStart() + "{{LT}}</" + tag + ">" : "{{LT}}"; 17415 i2 += 5; 17416 } else if (character.charCodeAt(0) >= 55296 && character.charCodeAt(0) <= 56319 || text.charCodeAt(i2 + 1) >= 65024 && text.charCodeAt(i2 + 1) <= 65039) { 17417 j2 = ((text.substr(i2, 12).split(emojiExp) || [])[1] || "").length || 2; 17418 splitText += chars && character !== " " ? charStart() + text.substr(i2, j2) + "</" + tag + ">" : text.substr(i2, j2); 17419 i2 += j2 - 1; 17420 } else { 17421 splitText += chars && character !== " " ? charStart() + character + "</" + tag + ">" : character; 17422 } 17423 } 17424 element.outerHTML = splitText + (wordIsOpen ? wordEnd : ""); 17425 hasTagStart && _swapText(parent, "{{LT}}", "<"); 17426}, _split = function _split2(element, vars, wordStart, charStart) { 17427 var children = _toArray$4(element.childNodes), l2 = children.length, absolute = _isAbsolute(vars), i2, child; 17428 if (element.nodeType !== 3 || l2 > 1) { 17429 vars.absolute = false; 17430 for (i2 = 0; i2 < l2; i2++) { 17431 child = children[i2]; 17432 child._next = child._isFirst = child._parent = child._wordEnd = null; 17433 if (child.nodeType !== 3 || /\S+/.test(child.nodeValue)) { 17434 if (absolute && child.nodeType !== 3 && _getComputedStyle$1(child).display === "inline") { 17435 child.style.display = "inline-block"; 17436 child.style.position = "relative"; 17437 } 17438 child._isSplit = true; 17439 _split2(child, vars, wordStart, charStart); 17440 } 17441 } 17442 vars.absolute = absolute; 17443 element._isSplit = true; 17444 return; 17445 } 17446 _splitRawText(element, vars, wordStart, charStart); 17447}; 17448var SplitText = /* @__PURE__ */ function() { 17449 function SplitText2(element, vars) { 17450 _coreInitted$5 || _initCore$3(); 17451 this.elements = _toArray$4(element); 17452 this.chars = []; 17453 this.words = []; 17454 this.lines = []; 17455 this._originals = []; 17456 this.vars = vars || {}; 17457 _context$3(this); 17458 this.split(vars); 17459 } 17460 var _proto = SplitText2.prototype; 17461 _proto.split = function split2(vars) { 17462 this.isSplit && this.revert(); 17463 this.vars = vars = vars || this.vars; 17464 this._originals.length = this.chars.length = this.words.length = this.lines.length = 0; 17465 var i2 = this.elements.length, tag = vars.tag ? vars.tag : vars.span ? "span" : "div", wordStart = _cssClassFunc(vars.wordsClass, tag), charStart = _cssClassFunc(vars.charsClass, tag), origHeight, origWidth, e2; 17466 while (--i2 > -1) { 17467 e2 = this.elements[i2]; 17468 this._originals[i2] = { 17469 html: e2.innerHTML, 17470 style: e2.getAttribute("style") 17471 }; 17472 origHeight = e2.clientHeight; 17473 origWidth = e2.clientWidth; 17474 _split(e2, vars, wordStart, charStart); 17475 _setPositionsAfterSplit(e2, vars, this.chars, this.words, this.lines, origWidth, origHeight); 17476 } 17477 this.chars.reverse(); 17478 this.words.reverse(); 17479 this.lines.reverse(); 17480 this.isSplit = true; 17481 return this; 17482 }; 17483 _proto.revert = function revert() { 17484 var originals = this._originals; 17485 if (!originals) { 17486 throw "revert() call wasn't scoped properly."; 17487 } 17488 this.elements.forEach(function(e2, i2) { 17489 e2.innerHTML = originals[i2].html; 17490 e2.setAttribute("style", originals[i2].style); 17491 }); 17492 this.chars = []; 17493 this.words = []; 17494 this.lines = []; 17495 this.isSplit = false; 17496 return this; 17497 }; 17498 SplitText2.create = function create(element, vars) { 17499 return new SplitText2(element, vars); 17500 }; 17501 return SplitText2; 17502}(); 17503SplitText.version = "3.12.5"; 17504SplitText.register = _initCore$3; 17505/*! 17506 * paths 3.12.5 17507 * https://gsap.com 17508 * 17509 * Copyright 2008-2024, GreenSock. All rights reserved. 17510 * Subject to the terms at https://gsap.com/standard-license or for 17511 * Club GSAP members, the agreement issued with that membership. 17512 * @author: Jack Doyle, [email protected] 17513*/ 17514var _svgPathExp = /[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, _numbersExp = /(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, _scientific = /[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig, _selectorExp$1 = /(^[#\.][a-z]|[a-y][a-z])/i, _DEG2RAD = Math.PI / 180, _sin$1 = Math.sin, _cos$1 = Math.cos, _abs$1 = Math.abs, _sqrt$1 = Math.sqrt, _isString$2 = function _isString2(value) { 17515 return typeof value === "string"; 17516}, _isNumber$1 = function _isNumber2(value) { 17517 return typeof value === "number"; 17518}, _roundingNum = 1e5, _round$2 = function _round3(value) { 17519 return Math.round(value * _roundingNum) / _roundingNum || 0; 17520}; 17521function getRawPath(value) { 17522 value = _isString$2(value) && _selectorExp$1.test(value) ? document.querySelector(value) || value : value; 17523 var e2 = value.getAttribute ? value : 0, rawPath; 17524 if (e2 && (value = value.getAttribute("d"))) { 17525 if (!e2._gsPath) { 17526 e2._gsPath = {}; 17527 } 17528 rawPath = e2._gsPath[value]; 17529 return rawPath && !rawPath._dirty ? rawPath : e2._gsPath[value] = stringToRawPath(value); 17530 } 17531 return !value ? console.warn("Expecting a <path> element or an SVG path data string") : _isString$2(value) ? stringToRawPath(value) : _isNumber$1(value[0]) ? [value] : value; 17532} 17533function reverseSegment(segment) { 17534 var i2 = 0, y2; 17535 segment.reverse(); 17536 for (; i2 < segment.length; i2 += 2) { 17537 y2 = segment[i2]; 17538 segment[i2] = segment[i2 + 1]; 17539 segment[i2 + 1] = y2; 17540 } 17541 segment.reversed = !segment.reversed; 17542} 17543var _createPath = function _createPath2(e2, ignore) { 17544 var path = document.createElementNS("http://www.w3.org/2000/svg", "path"), attr = [].slice.call(e2.attributes), i2 = attr.length, name; 17545 ignore = "," + ignore + ","; 17546 while (--i2 > -1) { 17547 name = attr[i2].nodeName.toLowerCase(); 17548 if (ignore.indexOf("," + name + ",") < 0) { 17549 path.setAttributeNS(null, name, attr[i2].nodeValue); 17550 } 17551 } 17552 return path; 17553}, _typeAttrs = { 17554 rect: "rx,ry,x,y,width,height", 17555 circle: "r,cx,cy", 17556 ellipse: "rx,ry,cx,cy", 17557 line: "x1,x2,y1,y2" 17558}, _attrToObj = function _attrToObj2(e2, attrs) { 17559 var props = attrs ? attrs.split(",") : [], obj = {}, i2 = props.length; 17560 while (--i2 > -1) { 17561 obj[props[i2]] = +e2.getAttribute(props[i2]) || 0; 17562 } 17563 return obj; 17564}; 17565function convertToPath(element, swap) { 17566 var type = element.tagName.toLowerCase(), circ = 0.552284749831, data, x2, y2, r2, ry, path, rcirc, rycirc, points, w2, h2, x22, x3, x4, x5, x6, y22, y3, y4, y5, y6, attr; 17567 if (type === "path" || !element.getBBox) { 17568 return element; 17569 } 17570 path = _createPath(element, "x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"); 17571 attr = _attrToObj(element, _typeAttrs[type]); 17572 if (type === "rect") { 17573 r2 = attr.rx; 17574 ry = attr.ry || r2; 17575 x2 = attr.x; 17576 y2 = attr.y; 17577 w2 = attr.width - r2 * 2; 17578 h2 = attr.height - ry * 2; 17579 if (r2 || ry) { 17580 x22 = x2 + r2 * (1 - circ); 17581 x3 = x2 + r2; 17582 x4 = x3 + w2; 17583 x5 = x4 + r2 * circ; 17584 x6 = x4 + r2; 17585 y22 = y2 + ry * (1 - circ); 17586 y3 = y2 + ry; 17587 y4 = y3 + h2; 17588 y5 = y4 + ry * circ; 17589 y6 = y4 + ry; 17590 data = "M" + x6 + "," + y3 + " V" + y4 + " C" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x22, y6, x2, y5, x2, y4, x2, y4 - (y4 - y3) / 3, x2, y3 + (y4 - y3) / 3, x2, y3, x2, y22, x22, y2, x3, y2, x3 + (x4 - x3) / 3, y2, x4 - (x4 - x3) / 3, y2, x4, y2, x5, y2, x6, y22, x6, y3].join(",") + "z"; 17591 } else { 17592 data = "M" + (x2 + w2) + "," + y2 + " v" + h2 + " h" + -w2 + " v" +
vendor: 20,384 bytes, lines 17592-18114
17592-h2 + " h" + w2 + "z"; 17593 } 17594 } else if (type === "circle" || type === "ellipse") { 17595 if (type === "circle") { 17596 r2 = ry = attr.r; 17597 rycirc = r2 * circ; 17598 } else { 17599 r2 = attr.rx; 17600 ry = attr.ry; 17601 rycirc = ry * circ; 17602 } 17603 x2 = attr.cx; 17604 y2 = attr.cy; 17605 rcirc = r2 * circ; 17606 data = "M" + (x2 + r2) + "," + y2 + " C" + [x2 + r2, y2 + rycirc, x2 + rcirc, y2 + ry, x2, y2 + ry, x2 - rcirc, y2 + ry, x2 - r2, y2 + rycirc, x2 - r2, y2, x2 - r2, y2 - rycirc, x2 - rcirc, y2 - ry, x2, y2 - ry, x2 + rcirc, y2 - ry, x2 + r2, y2 - rycirc, x2 + r2, y2].join(",") + "z"; 17607 } else if (type === "line") { 17608 data = "M" + attr.x1 + "," + attr.y1 + " L" + attr.x2 + "," + attr.y2; 17609 } else if (type === "polyline" || type === "polygon") { 17610 points = (element.getAttribute("points") + "").match(_numbersExp) || []; 17611 x2 = points.shift(); 17612 y2 = points.shift(); 17613 data = "M" + x2 + "," + y2 + " L" + points.join(","); 17614 if (type === "polygon") { 17615 data += "," + x2 + "," + y2 + "z"; 17616 } 17617 } 17618 path.setAttribute("d", rawPathToString(path._gsRawPath = stringToRawPath(data))); 17619 if (swap && element.parentNode) { 17620 element.parentNode.insertBefore(path, element); 17621 element.parentNode.removeChild(element); 17622 } 17623 return path; 17624} 17625function arcToSegment(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x2, y2) { 17626 if (lastX === x2 && lastY === y2) { 17627 return; 17628 } 17629 rx = _abs$1(rx); 17630 ry = _abs$1(ry); 17631 var angleRad = angle % 360 * _DEG2RAD, cosAngle = _cos$1(angleRad), sinAngle = _sin$1(angleRad), PI = Math.PI, TWOPI = PI * 2, dx2 = (lastX - x2) / 2, dy2 = (lastY - y2) / 2, x1 = cosAngle * dx2 + sinAngle * dy2, y1 = -sinAngle * dx2 + cosAngle * dy2, x1_sq = x1 * x1, y1_sq = y1 * y1, radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry); 17632 if (radiiCheck > 1) { 17633 rx = _sqrt$1(radiiCheck) * rx; 17634 ry = _sqrt$1(radiiCheck) * ry; 17635 } 17636 var rx_sq = rx * rx, ry_sq = ry * ry, sq = (rx_sq * ry_sq - rx_sq * y1_sq - ry_sq * x1_sq) / (rx_sq * y1_sq + ry_sq * x1_sq); 17637 if (sq < 0) { 17638 sq = 0; 17639 } 17640 var coef = (largeArcFlag === sweepFlag ? -1 : 1) * _sqrt$1(sq), cx1 = coef * (rx * y1 / ry), cy1 = coef * -(ry * x1 / rx), sx2 = (lastX + x2) / 2, sy2 = (lastY + y2) / 2, cx2 = sx2 + (cosAngle * cx1 - sinAngle * cy1), cy = sy2 + (sinAngle * cx1 + cosAngle * cy1), ux = (x1 - cx1) / rx, uy = (y1 - cy1) / ry, vx = (-x1 - cx1) / rx, vy = (-y1 - cy1) / ry, temp = ux * ux + uy * uy, angleStart = (uy < 0 ? -1 : 1) * Math.acos(ux / _sqrt$1(temp)), angleExtent = (ux * vy - uy * vx < 0 ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt$1(temp * (vx * vx + vy * vy))); 17641 isNaN(angleExtent) && (angleExtent = PI); 17642 if (!sweepFlag && angleExtent > 0) { 17643 angleExtent -= TWOPI; 17644 } else if (sweepFlag && angleExtent < 0) { 17645 angleExtent += TWOPI; 17646 } 17647 angleStart %= TWOPI; 17648 angleExtent %= TWOPI; 17649 var segments = Math.ceil(_abs$1(angleExtent) / (TWOPI / 4)), rawPath = [], angleIncrement = angleExtent / segments, controlLength = 4 / 3 * _sin$1(angleIncrement / 2) / (1 + _cos$1(angleIncrement / 2)), ma = cosAngle * rx, mb = sinAngle * rx, mc = sinAngle * -ry, md = cosAngle * ry, i2; 17650 for (i2 = 0; i2 < segments; i2++) { 17651 angle = angleStart + i2 * angleIncrement; 17652 x1 = _cos$1(angle); 17653 y1 = _sin$1(angle); 17654 ux = _cos$1(angle += angleIncrement); 17655 uy = _sin$1(angle); 17656 rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy); 17657 } 17658 for (i2 = 0; i2 < rawPath.length; i2 += 2) { 17659 x1 = rawPath[i2]; 17660 y1 = rawPath[i2 + 1]; 17661 rawPath[i2] = x1 * ma + y1 * mc + cx2; 17662 rawPath[i2 + 1] = x1 * mb + y1 * md + cy; 17663 } 17664 rawPath[i2 - 2] = x2; 17665 rawPath[i2 - 1] = y2; 17666 return rawPath; 17667} 17668function stringToRawPath(d2) { 17669 var a2 = (d2 + "").replace(_scientific, function(m2) { 17670 var n2 = +m2; 17671 return n2 < 1e-4 && n2 > -1e-4 ? 0 : n2; 17672 }).match(_svgPathExp) || [], path = [], relativeX = 0, relativeY = 0, twoThirds = 2 / 3, elements = a2.length, points = 0, errorMessage = "ERROR: malformed path: " + d2, i2, j2, x2, y2, command, isRelative, segment, startX, startY, difX, difY, beziers, prevCommand, flag1, flag2, line = function line2(sx, sy, ex, ey) { 17673 difX = (ex - sx) / 3; 17674 difY = (ey - sy) / 3; 17675 segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey); 17676 }; 17677 if (!d2 || !isNaN(a2[0]) || isNaN(a2[1])) { 17678 console.log(errorMessage); 17679 return path; 17680 } 17681 for (i2 = 0; i2 < elements; i2++) { 17682 prevCommand = command; 17683 if (isNaN(a2[i2])) { 17684 command = a2[i2].toUpperCase(); 17685 isRelative = command !== a2[i2]; 17686 } else { 17687 i2--; 17688 } 17689 x2 = +a2[i2 + 1]; 17690 y2 = +a2[i2 + 2]; 17691 if (isRelative) { 17692 x2 += relativeX; 17693 y2 += relativeY; 17694 } 17695 if (!i2) { 17696 startX = x2; 17697 startY = y2; 17698 } 17699 if (command === "M") { 17700 if (segment) { 17701 if (segment.length < 8) { 17702 path.length -= 1; 17703 } else { 17704 points += segment.length; 17705 } 17706 } 17707 relativeX = startX = x2; 17708 relativeY = startY = y2; 17709 segment = [x2, y2]; 17710 path.push(segment); 17711 i2 += 2; 17712 command = "L"; 17713 } else if (command === "C") { 17714 if (!segment) { 17715 segment = [0, 0]; 17716 } 17717 if (!isRelative) { 17718 relativeX = relativeY = 0; 17719 } 17720 segment.push(x2, y2, relativeX + a2[i2 + 3] * 1, relativeY + a2[i2 + 4] * 1, relativeX += a2[i2 + 5] * 1, relativeY += a2[i2 + 6] * 1); 17721 i2 += 6; 17722 } else if (command === "S") { 17723 difX = relativeX; 17724 difY = relativeY; 17725 if (prevCommand === "C" || prevCommand === "S") { 17726 difX += relativeX - segment[segment.length - 4]; 17727 difY += relativeY - segment[segment.length - 3]; 17728 } 17729 if (!isRelative) { 17730 relativeX = relativeY = 0; 17731 } 17732 segment.push(difX, difY, x2, y2, relativeX += a2[i2 + 3] * 1, relativeY += a2[i2 + 4] * 1); 17733 i2 += 4; 17734 } else if (command === "Q") { 17735 difX = relativeX + (x2 - relativeX) * twoThirds; 17736 difY = relativeY + (y2 - relativeY) * twoThirds; 17737 if (!isRelative) { 17738 relativeX = relativeY = 0; 17739 } 17740 relativeX += a2[i2 + 3] * 1; 17741 relativeY += a2[i2 + 4] * 1; 17742 segment.push(difX, difY, relativeX + (x2 - relativeX) * twoThirds, relativeY + (y2 - relativeY) * twoThirds, relativeX, relativeY); 17743 i2 += 4; 17744 } else if (command === "T") { 17745 difX = relativeX - segment[segment.length - 4]; 17746 difY = relativeY - segment[segment.length - 3]; 17747 segment.push(relativeX + difX, relativeY + difY, x2 + (relativeX + difX * 1.5 - x2) * twoThirds, y2 + (relativeY + difY * 1.5 - y2) * twoThirds, relativeX = x2, relativeY = y2); 17748 i2 += 2; 17749 } else if (command === "H") { 17750 line(relativeX, relativeY, relativeX = x2, relativeY); 17751 i2 += 1; 17752 } else if (command === "V") { 17753 line(relativeX, relativeY, relativeX, relativeY = x2 + (isRelative ? relativeY - relativeX : 0)); 17754 i2 += 1; 17755 } else if (command === "L" || command === "Z") { 17756 if (command === "Z") { 17757 x2 = startX; 17758 y2 = startY; 17759 segment.closed = true; 17760 } 17761 if (command === "L" || _abs$1(relativeX - x2) > 0.5 || _abs$1(relativeY - y2) > 0.5) { 17762 line(relativeX, relativeY, x2, y2); 17763 if (command === "L") { 17764 i2 += 2; 17765 } 17766 } 17767 relativeX = x2; 17768 relativeY = y2; 17769 } else if (command === "A") { 17770 flag1 = a2[i2 + 4]; 17771 flag2 = a2[i2 + 5]; 17772 difX = a2[i2 + 6]; 17773 difY = a2[i2 + 7]; 17774 j2 = 7; 17775 if (flag1.length > 1) { 17776 if (flag1.length < 3) { 17777 difY = difX; 17778 difX = flag2; 17779 j2--; 17780 } else { 17781 difY = flag2; 17782 difX = flag1.substr(2); 17783 j2 -= 2; 17784 } 17785 flag2 = flag1.charAt(1); 17786 flag1 = flag1.charAt(0); 17787 } 17788 beziers = arcToSegment(relativeX, relativeY, +a2[i2 + 1], +a2[i2 + 2], +a2[i2 + 3], +flag1, +flag2, (isRelative ? relativeX : 0) + difX * 1, (isRelative ? relativeY : 0) + difY * 1); 17789 i2 += j2; 17790 if (beziers) { 17791 for (j2 = 0; j2 < beziers.length; j2++) { 17792 segment.push(beziers[j2]); 17793 } 17794 } 17795 relativeX = segment[segment.length - 2]; 17796 relativeY = segment[segment.length - 1]; 17797 } else { 17798 console.log(errorMessage); 17799 } 17800 } 17801 i2 = segment.length; 17802 if (i2 < 6) { 17803 path.pop(); 17804 i2 = 0; 17805 } else if (segment[0] === segment[i2 - 2] && segment[1] === segment[i2 - 1]) { 17806 segment.closed = true; 17807 } 17808 path.totalPoints = points + i2; 17809 return path; 17810} 17811function rawPathToString(rawPath) { 17812 if (_isNumber$1(rawPath[0])) { 17813 rawPath = [rawPath]; 17814 } 17815 var result = "", l2 = rawPath.length, sl, s2, i2, segment; 17816 for (s2 = 0; s2 < l2; s2++) { 17817 segment = rawPath[s2]; 17818 result += "M" + _round$2(segment[0]) + "," + _round$2(segment[1]) + " C"; 17819 sl = segment.length; 17820 for (i2 = 2; i2 < sl; i2++) { 17821 result += _round$2(segment[i2++]) + "," + _round$2(segment[i2++]) + " " + _round$2(segment[i2++]) + "," + _round$2(segment[i2++]) + " " + _round$2(segment[i2++]) + "," + _round$2(segment[i2]) + " "; 17822 } 17823 if (segment.closed) { 17824 result += "z"; 17825 } 17826 } 17827 return result; 17828} 17829/*! 17830 * MorphSVGPlugin 3.12.5 17831 * https://gsap.com 17832 * 17833 * @license Copyright 2008-2024, GreenSock. All rights reserved. 17834 * Subject to the terms at https://gsap.com/standard-license or for 17835 * Club GSAP members, the agreement issued with that membership. 17836 * @author: Jack Doyle, [email protected] 17837*/ 17838var gsap$4, _toArray$3, _lastLinkedAnchor, _coreInitted$4, PluginClass, _getGSAP$4 = function _getGSAP2() { 17839 return gsap$4 || typeof window !== "undefined" && (gsap$4 = window.gsap) && gsap$4.registerPlugin && gsap$4; 17840}, _isFunction$2 = function _isFunction2(value) { 17841 return typeof value === "function"; 17842}, _atan2 = Math.atan2, _cos = Math.cos, _sin = Math.sin, _sqrt = Math.sqrt, _PI = Math.PI, _2PI = _PI * 2, _angleMin = _PI * 0.3, _angleMax = _PI * 0.7, _bigNum = 1e20, _numExp = /[-+=\.]*\d+[\.e\-\+]*\d*[e\-\+]*\d*/gi, _selectorExp = /(^[#\.][a-z]|[a-y][a-z])/i, _commands = /[achlmqstvz]/i, _log = function _log2(message) { 17843 return console && console.warn(message); 17844}, _bonusValidated = 1, _getAverageXY = function _getAverageXY2(segment) { 17845 var l2 = segment.length, x2 = 0, y2 = 0, i2; 17846 for (i2 = 0; i2 < l2; i2++) { 17847 x2 += segment[i2++]; 17848 y2 += segment[i2]; 17849 } 17850 return [x2 / (l2 / 2), y2 / (l2 / 2)]; 17851}, _getSize$1 = function _getSize(segment) { 17852 var l2 = segment.length, xMax = segment[0], xMin = xMax, yMax = segment[1], yMin = yMax, x2, y2, i2; 17853 for (i2 = 6; i2 < l2; i2 += 6) { 17854 x2 = segment[i2]; 17855 y2 = segment[i2 + 1]; 17856 if (x2 > xMax) { 17857 xMax = x2; 17858 } else if (x2 < xMin) { 17859 xMin = x2; 17860 } 17861 if (y2 > yMax) { 17862 yMax = y2; 17863 } else if (y2 < yMin) { 17864 yMin = y2; 17865 } 17866 } 17867 segment.centerX = (xMax + xMin) / 2; 17868 segment.centerY = (yMax + yMin) / 2; 17869 return segment.size = (xMax - xMin) * (yMax - yMin); 17870}, _getTotalSize = function _getTotalSize2(rawPath, samplesPerBezier) { 17871 if (samplesPerBezier === void 0) { 17872 samplesPerBezier = 3; 17873 } 17874 var j2 = rawPath.length, xMax = rawPath[0][0], xMin = xMax, yMax = rawPath[0][1], yMin = yMax, inc = 1 / samplesPerBezier, l2, x2, y2, i2, segment, k2, t2, inv, x1, y1, x22, x3, x4, y22, y3, y4; 17875 while (--j2 > -1) { 17876 segment = rawPath[j2]; 17877 l2 = segment.length; 17878 for (i2 = 6; i2 < l2; i2 += 6) { 17879 x1 = segment[i2]; 17880 y1 = segment[i2 + 1]; 17881 x22 = segment[i2 + 2] - x1; 17882 y22 = segment[i2 + 3] - y1; 17883 x3 = segment[i2 + 4] - x1; 17884 y3 = segment[i2 + 5] - y1; 17885 x4 = segment[i2 + 6] - x1; 17886 y4 = segment[i2 + 7] - y1; 17887 k2 = samplesPerBezier; 17888 while (--k2 > -1) { 17889 t2 = inc * k2; 17890 inv = 1 - t2; 17891 x2 = (t2 * t2 * x4 + 3 * inv * (t2 * x3 + inv * x22)) * t2 + x1; 17892 y2 = (t2 * t2 * y4 + 3 * inv * (t2 * y3 + inv * y22)) * t2 + y1; 17893 if (x2 > xMax) { 17894 xMax = x2; 17895 } else if (x2 < xMin) { 17896 xMin = x2; 17897 } 17898 if (y2 > yMax) { 17899 yMax = y2; 17900 } else if (y2 < yMin) { 17901 yMin = y2; 17902 } 17903 } 17904 } 17905 } 17906 rawPath.centerX = (xMax + xMin) / 2; 17907 rawPath.centerY = (yMax + yMin) / 2; 17908 rawPath.left = xMin; 17909 rawPath.width = xMax - xMin; 17910 rawPath.top = yMin; 17911 rawPath.height = yMax - yMin; 17912 return rawPath.size = (xMax - xMin) * (yMax - yMin); 17913}, _sortByComplexity = function _sortByComplexity2(a2, b2) { 17914 return b2.length - a2.length; 17915}, _sortBySize = function _sortBySize2(a2, b2) { 17916 var sizeA = a2.size || _getSize$1(a2), sizeB = b2.size || _getSize$1(b2); 17917 return Math.abs(sizeB - sizeA) < (sizeA + sizeB) / 20 ? b2.centerX - a2.centerX || b2.centerY - a2.centerY : sizeB - sizeA; 17918}, _offsetSegment = function _offsetSegment2(segment, shapeIndex) { 17919 var a2 = segment.slice(0), l2 = segment.length, wrap3 = l2 - 2, i2, index3; 17920 shapeIndex = shapeIndex | 0; 17921 for (i2 = 0; i2 < l2; i2++) { 17922 index3 = (i2 + shapeIndex) % wrap3; 17923 segment[i2++] = a2[index3]; 17924 segment[i2] = a2[index3 + 1]; 17925 } 17926}, _getTotalMovement = function _getTotalMovement2(sb, eb, shapeIndex, offsetX, offsetY) { 17927 var l2 = sb.length, d2 = 0, wrap3 = l2 - 2, index3, i2, x2, y2; 17928 shapeIndex *= 6; 17929 for (i2 = 0; i2 < l2; i2 += 6) { 17930 index3 = (i2 + shapeIndex) % wrap3; 17931 y2 = sb[index3] - (eb[i2] - offsetX); 17932 x2 = sb[index3 + 1] - (eb[i2 + 1] - offsetY); 17933 d2 += _sqrt(x2 * x2 + y2 * y2); 17934 } 17935 return d2; 17936}, _getClosestShapeIndex = function _getClosestShapeIndex2(sb, eb, checkReverse) { 17937 var l2 = sb.length, sCenter = _getAverageXY(sb), eCenter = _getAverageXY(eb), offsetX = eCenter[0] - sCenter[0], offsetY = eCenter[1] - sCenter[1], min = _getTotalMovement(sb, eb, 0, offsetX, offsetY), minIndex = 0, copy, d2, i2; 17938 for (i2 = 6; i2 < l2; i2 += 6) { 17939 d2 = _getTotalMovement(sb, eb, i2 / 6, offsetX, offsetY); 17940 if (d2 < min) { 17941 min = d2; 17942 minIndex = i2; 17943 } 17944 } 17945 if (checkReverse) { 17946 copy = sb.slice(0); 17947 reverseSegment(copy); 17948 for (i2 = 6; i2 < l2; i2 += 6) { 17949 d2 = _getTotalMovement(copy, eb, i2 / 6, offsetX, offsetY); 17950 if (d2 < min) { 17951 min = d2; 17952 minIndex = -i2; 17953 } 17954 } 17955 } 17956 return minIndex / 6; 17957}, _getClosestAnchor = function _getClosestAnchor2(rawPath, x2, y2) { 17958 var j2 = rawPath.length, closestDistance = _bigNum, closestX = 0, closestY = 0, segment, dx, dy, d2, i2, l2; 17959 while (--j2 > -1) { 17960 segment = rawPath[j2]; 17961 l2 = segment.length; 17962 for (i2 = 0; i2 < l2; i2 += 6) { 17963 dx = segment[i2] - x2; 17964 dy = segment[i2 + 1] - y2; 17965 d2 = _sqrt(dx * dx + dy * dy); 17966 if (d2 < closestDistance) { 17967 closestDistance = d2; 17968 closestX = segment[i2]; 17969 closestY = segment[i2 + 1]; 17970 } 17971 } 17972 } 17973 return [closestX, closestY]; 17974}, _getClosestSegment = function _getClosestSegment2(bezier, pool, startIndex, sortRatio, offsetX, offsetY) { 17975 var l2 = pool.length, index3 = 0, minSize = Math.min(bezier.size || _getSize$1(bezier), pool[startIndex].size || _getSize$1(pool[startIndex])) * sortRatio, min = _bigNum, cx2 = bezier.centerX + offsetX, cy = bezier.centerY + offsetY, size, i2, dx, dy, d2; 17976 for (i2 = startIndex; i2 < l2; i2++) { 17977 size = pool[i2].size || _getSize$1(pool[i2]); 17978 if (size < minSize) { 17979 break; 17980 } 17981 dx = pool[i2].centerX - cx2; 17982 dy = pool[i2].centerY - cy; 17983 d2 = _sqrt(dx * dx + dy * dy); 17984 if (d2 < min) { 17985 index3 = i2; 17986 min = d2; 17987 } 17988 } 17989 d2 = pool[index3]; 17990 pool.splice(index3, 1); 17991 return d2; 17992}, _subdivideSegmentQty = function _subdivideSegmentQty2(segment, quantity) { 17993 var tally = 0, max = 0.999999, l2 = segment.length, newPointsPerSegment = quantity / ((l2 - 2) / 6), ax, ay, cp1x, cp1y, cp2x, cp2y, bx, by, x1, y1, x2, y2, i2, t2; 17994 for (i2 = 2; i2 < l2; i2 += 6) { 17995 tally += newPointsPerSegment; 17996 while (tally > max) { 17997 ax = segment[i2 - 2]; 17998 ay = segment[i2 - 1]; 17999 cp1x = segment[i2]; 18000 cp1y = segment[i2 + 1]; 18001 cp2x = segment[i2 + 2]; 18002 cp2y = segment[i2 + 3]; 18003 bx = segment[i2 + 4]; 18004 by = segment[i2 + 5]; 18005 t2 = 1 / ((Math.floor(tally) || 1) + 1); 18006 x1 = ax + (cp1x - ax) * t2; 18007 x2 = cp1x + (cp2x - cp1x) * t2; 18008 x1 += (x2 - x1) * t2; 18009 x2 += (cp2x + (bx - cp2x) * t2 - x2) * t2; 18010 y1 = ay + (cp1y - ay) * t2; 18011 y2 = cp1y + (cp2y - cp1y) * t2; 18012 y1 += (y2 - y1) * t2; 18013 y2 += (cp2y + (by - cp2y) * t2 - y2) * t2; 18014 segment.splice( 18015 i2, 18016 4, 18017 ax + (cp1x - ax) * t2, 18018 //first control point 18019 ay + (cp1y - ay) * t2, 18020 x1, 18021 //second control point 18022 y1, 18023 x1 + (x2 - x1) * t2, 18024 //new fabricated anchor on line 18025 y1 + (y2 - y1) * t2, 18026 x2, 18027 //third control point 18028 y2, 18029 cp2x + (bx - cp2x) * t2, 18030 //fourth control point 18031 cp2y + (by - cp2y) * t2 18032 ); 18033 i2 += 6; 18034 l2 += 6; 18035 tally--; 18036 } 18037 } 18038 return segment; 18039}, _equalizeSegmentQuantity = function _equalizeSegmentQuantity2(start2, end, shapeIndex, map, fillSafe) { 18040 var dif = end.length - start2.length, longer = dif > 0 ? end : start2, shorter = dif > 0 ? start2 : end, added = 0, sortMethod = map === "complexity" ? _sortByComplexity : _sortBySize, sortRatio = map === "position" ? 0 : typeof map === "number" ? map : 0.8, i2 = shorter.length, shapeIndices = typeof shapeIndex === "object" && shapeIndex.push ? shapeIndex.slice(0) : [shapeIndex], reverse = shapeIndices[0] === "reverse" || shapeIndices[0] < 0, log = shapeIndex === "log", eb, sb, b2, x2, y2, offsetX, offsetY; 18041 if (!shorter[0]) { 18042 return; 18043 } 18044 if (longer.length > 1) { 18045 start2.sort(sortMethod); 18046 end.sort(sortMethod); 18047 offsetX = longer.size || _getTotalSize(longer); 18048 offsetX = shorter.size || _getTotalSize(shorter); 18049 offsetX = longer.centerX - shorter.centerX; 18050 offsetY = longer.centerY - shorter.centerY; 18051 if (sortMethod === _sortBySize) { 18052 for (i2 = 0; i2 < shorter.length; i2++) { 18053 longer.splice(i2, 0, _getClosestSegment(shorter[i2], longer, i2, sortRatio, offsetX, offsetY)); 18054 } 18055 } 18056 } 18057 if (dif) { 18058 if (dif < 0) { 18059 dif = -dif; 18060 } 18061 if (longer[0].length > shorter[0].length) { 18062 _subdivideSegmentQty(shorter[0], (longer[0].length - shorter[0].length) / 6 | 0); 18063 } 18064 i2 = shorter.length; 18065 while (added < dif) { 18066 x2 = longer[i2].size || _getSize$1(longer[i2]); 18067 b2 = _getClosestAnchor(shorter, longer[i2].centerX, longer[i2].centerY); 18068 x2 = b2[0]; 18069 y2 = b2[1]; 18070 shorter[i2++] = [x2, y2, x2, y2, x2, y2, x2, y2]; 18071 shorter.totalPoints += 8; 18072 added++; 18073 } 18074 } 18075 for (i2 = 0; i2 < start2.length; i2++) { 18076 eb = end[i2]; 18077 sb = start2[i2]; 18078 dif = eb.length - sb.length; 18079 if (dif < 0) { 18080 _subdivideSegmentQty(eb, -dif / 6 | 0); 18081 } else if (dif > 0) { 18082 _subdivideSegmentQty(sb, dif / 6 | 0); 18083 } 18084 if (reverse && fillSafe !== false && !sb.reversed) { 18085 reverseSegment(sb); 18086 } 18087 shapeIndex = shapeIndices[i2] || shapeIndices[i2] === 0 ? shapeIndices[i2] : "auto"; 18088 if (shapeIndex) { 18089 if (sb.closed || Math.abs(sb[0] - sb[sb.length - 2]) < 0.5 && Math.abs(sb[1] - sb[sb.length - 1]) < 0.5) { 18090 if (shapeIndex === "auto" || shapeIndex === "log") { 18091 shapeIndices[i2] = shapeIndex = _getClosestShapeIndex(sb, eb, !i2 || fillSafe === false); 18092 if (shapeIndex < 0) { 18093 reverse = true; 18094 reverseSegment(sb); 18095 shapeIndex = -shapeIndex; 18096 } 18097 _offsetSegment(sb, shapeIndex * 6); 18098 } else if (shapeIndex !== "reverse") { 18099 if (i2 && shapeIndex < 0) { 18100 reverseSegment(sb); 18101 } 18102 _offsetSegment(sb, (shapeIndex < 0 ? -shapeIndex : shapeIndex) * 6); 18103 } 18104 } else if (!reverse && (shapeIndex === "auto" && Math.abs(eb[0] - sb[0]) + Math.abs(eb[1] - sb[1]) + Math.abs(eb[eb.length - 2] - sb[sb.length - 2]) + Math.abs(eb[eb.length - 1] - sb[sb.length - 1]) > Math.abs(eb[0] - sb[sb.length - 2]) + Math.abs(eb[1] - sb[sb.length - 1]) + Math.abs(eb[eb.length - 2] - sb[0]) + Math.abs(eb[eb.length - 1] - sb[1]) || shapeIndex % 2)) { 18105 reverseSegment(sb); 18106 shapeIndices[i2] = -1; 18107 reverse = true; 18108 } else if (shapeIndex === "auto") { 18109 shapeIndices[i2] = 0; 18110 } else if (shapeIndex === "reverse") { 18111 shapeIndices[i2] = -1; 18112 } 18113 if (sb.closed !== eb.closed) { 18114 sb.closed = eb.closed = false;
vendor: 3,070 bytes, lines 18115-18198
18115 } 18116 } 18117 } 18118 log && _log("shapeIndex:[" + shapeIndices.join(",") + "]"); 18119 start2.shapeIndex = shapeIndices; 18120 return shapeIndices; 18121}, _pathFilter = function _pathFilter2(a2, shapeIndex, map, precompile, fillSafe) { 18122 var start2 = stringToRawPath(a2[0]), end = stringToRawPath(a2[1]); 18123 if (!_equalizeSegmentQuantity(start2, end, shapeIndex || shapeIndex === 0 ? shapeIndex : "auto", map, fillSafe)) { 18124 return; 18125 } 18126 a2[0] = rawPathToString(start2); 18127 a2[1] = rawPathToString(end); 18128 if (precompile === "log" || precompile === true) { 18129 _log('precompile:["' + a2[0] + '","' + a2[1] + '"]'); 18130 } 18131}, _offsetPoints = function _offsetPoints2(text, offset) { 18132 if (!offset) { 18133 return text; 18134 } 18135 var a2 = text.match(_numExp) || [], l2 = a2.length, s2 = "", inc, i2, j2; 18136 if (offset === "reverse") { 18137 i2 = l2 - 1; 18138 inc = -2; 18139 } else { 18140 i2 = ((parseInt(offset, 10) || 0) * 2 + 1 + l2 * 100) % l2; 18141 inc = 2; 18142 } 18143 for (j2 = 0; j2 < l2; j2 += 2) { 18144 s2 += a2[i2 - 1] + "," + a2[i2] + " "; 18145 i2 = (i2 + inc) % l2; 18146 } 18147 return s2; 18148}, _equalizePointQuantity = function _equalizePointQuantity2(a2, quantity) { 18149 var tally = 0, x2 = parseFloat(a2[0]), y2 = parseFloat(a2[1]), s2 = x2 + "," + y2 + " ", max = 0.999999, newPointsPerSegment, i2, l2, j2, factor, nextX, nextY; 18150 l2 = a2.length; 18151 newPointsPerSegment = quantity * 0.5 / (l2 * 0.5 - 1); 18152 for (i2 = 0; i2 < l2 - 2; i2 += 2) { 18153 tally += newPointsPerSegment; 18154 nextX = parseFloat(a2[i2 + 2]); 18155 nextY = parseFloat(a2[i2 + 3]); 18156 if (tally > max) { 18157 factor = 1 / (Math.floor(tally) + 1); 18158 j2 = 1; 18159 while (tally > max) { 18160 s2 += (x2 + (nextX - x2) * factor * j2).toFixed(2) + "," + (y2 + (nextY - y2) * factor * j2).toFixed(2) + " "; 18161 tally--; 18162 j2++; 18163 } 18164 } 18165 s2 += nextX + "," + nextY + " "; 18166 x2 = nextX; 18167 y2 = nextY; 18168 } 18169 return s2; 18170}, _pointsFilter = function _pointsFilter2(a2) { 18171 var startNums = a2[0].match(_numExp) || [], endNums = a2[1].match(_numExp) || [], dif = endNums.length - startNums.length; 18172 if (dif > 0) { 18173 a2[0] = _equalizePointQuantity(startNums, dif); 18174 } else { 18175 a2[1] = _equalizePointQuantity(endNums, -dif); 18176 } 18177}, _buildPointsFilter = function _buildPointsFilter2(shapeIndex) { 18178 return !isNaN(shapeIndex) ? function(a2) { 18179 _pointsFilter(a2); 18180 a2[1] = _offsetPoints(a2[1], parseInt(shapeIndex, 10)); 18181 } : _pointsFilter; 18182}, _parseShape = function _parseShape2(shape, forcePath, target) { 18183 var isString = typeof shape === "string", e2, type; 18184 if (!isString || _selectorExp.test(shape) || (shape.match(_numExp) || []).length < 3) { 18185 e2 = _toArray$3(shape)[0]; 18186 if (e2) { 18187 type = (e2.nodeName + "").toUpperCase(); 18188 if (forcePath && type !== "PATH") { 18189 e2 = convertToPath(e2, false); 18190 type = "PATH"; 18191 } 18192 shape = e2.getAttribute(type === "PATH" ? "d" : "points") || ""; 18193 if (e2 === target) { 18194 shape = e2.getAttributeNS(null, "data-original") || shape; 18195 } 18196 } else { 18197 _log("WARNING: invalid morph to: " + shape); 18198 shape = false;
18199 } 18200 } 18201 return shape; 18202}, _populateSmoothData = function _populateSmoothData2(rawPath, tolerance) { 18203 var j2 = rawPath.length, limit = 0.2 * (tolerance || 1), smooth, segment, x2, y2, x22, y22, i2, l2, a2, a22, isSmooth, smoothData; 18204 while (--j2 > -1) { 18205 segment = rawPath[j2]; 18206 isSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0]; 18207 smoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0]; 18208 isSmooth.length = 4; 18209 l2 = segment.length - 2; 18210 for (i2 = 6; i2 < l2; i2 += 6) { 18211 x2 = segment[i2] - segment[i2 - 2]; 18212 y2 = segment[i2 + 1] - segment[i2 - 1]; 18213 x22 = segment[i2 + 2] - segment[i2]; 18214 y22 = segment[i2 + 3] - segment[i2 + 1]; 18215 a2 = _atan2(y2, x2); 18216 a22 = _atan2(y22, x22); 18217 smooth = Math.abs(a2 - a22) < limit; 18218 if (smooth) { 18219 smoothData[i2 - 2] = a2; 18220 smoothData[i2 + 2] = a22; 18221 smoothData[i2 - 1] = _sqrt(x2 * x2 + y2 * y2); 18222 smoothData[i2 + 3] = _sqrt(x22 * x22 + y22 * y22); 18223 } 18224 isSmooth.push(smooth, smooth, 0, 0, smooth, smooth); 18225 } 18226 if (segment[l2] === segment[0] && segment[l2 + 1] === segment[1]) { 18227 x2 = segment[0] - segment[l2 - 2]; 18228 y2 = segment[1] - segment[l2 - 1]; 18229 x22 = segment[2] - segment[0]; 18230 y22 = segment[3] - segment[1]; 18231 a2 = _atan2(y2, x2); 18232 a22 = _atan2(y22, x22); 18233 if (Math.abs(a2 - a22) < limit) { 18234 smoothData[l2 - 2] = a2; 18235 smoothData[2] = a22; 18236 smoothData[l2 - 1] = _sqrt(x2 * x2 + y2 * y2); 18237 smoothData[3] = _sqrt(x22 * x22 + y22 * y22); 18238 isSmooth[l2 - 2] = isSmooth[l2 - 1] = true; 18239 } 18240 } 18241 } 18242 return rawPath; 18243}, _parseOriginFactors = function _parseOriginFactors2(v2) { 18244 var a2 = v2.trim().split(" "), x2 = ~v2.indexOf("left") ? 0 : ~v2.indexOf("right") ? 100 : isNaN(parseFloat(a2[0])) ? 50 : parseFloat(a2[0]), y2 = ~v2.indexOf("top") ? 0 : ~v2.indexOf("bottom") ? 100 : isNaN(parseFloat(a2[1])) ? 50 : parseFloat(a2[1]); 18245 return { 18246 x: x2 / 100, 18247 y: y2 / 100 18248 }; 18249}, _shortAngle = function _shortAngle2(dif) { 18250 return dif !== dif % _PI ? dif + (dif < 0 ? _2PI : -_2PI) : dif; 18251}, _morphMessage = "Use MorphSVGPlugin.convertToPath() to convert to a path before morphing.", _tweenRotation = function _tweenRotation2(start2, end, i2, linkedPT) { 18252 var so = this._origin, eo = this._eOrigin, dx = start2[i2] - so.x, dy = start2[i2 + 1] - so.y, d2 = _sqrt(dx * dx + dy * dy), sa = _atan2(dy, dx), angleDif, _short; 18253 dx = end[i2] - eo.x; 18254 dy = end[i2 + 1] - eo.y; 18255 angleDif = _atan2(dy, dx) - sa; 18256 _short = _shortAngle(angleDif); 18257 if (!linkedPT && _lastLinkedAnchor && Math.abs(_short + _lastLinkedAnchor.ca) < _angleMin) { 18258 linkedPT = _lastLinkedAnchor; 18259 } 18260 return this._anchorPT = _lastLinkedAnchor = { 18261 _next: this._anchorPT, 18262 t: start2, 18263 sa, 18264 //starting angle 18265 ca: linkedPT && _short * linkedPT.ca < 0 && Math.abs(_short) > _angleMax ? angleDif : _short, 18266 //change in angle 18267 sl: d2, 18268 //starting length 18269 cl: _sqrt(dx * dx + dy * dy) - d2, 18270 //change in length 18271 i: i2 18272 }; 18273}, _initCore$2 = function _initCore3(required) { 18274 gsap$4 = _getGSAP$4(); 18275 PluginClass = PluginClass || gsap$4 && gsap$4.plugins.morphSVG; 18276 if (gsap$4 && PluginClass) { 18277 _toArray$3 = gsap$4.utils.toArray; 18278 PluginClass.prototype._tweenRotation = _tweenRotation; 18279 _coreInitted$4 = 1; 18280 } else if (required) { 18281 _log("Please gsap.registerPlugin(MorphSVGPlugin)"); 18282 } 18283}; 18284var MorphSVGPlugin = { 18285 version: "3.12.5", 18286 name: "morphSVG", 18287 rawVars: 1, 18288 // otherwise "render" would be interpreted as a function-based value. 18289 register: function register(core, Plugin) { 18290 gsap$4 = core; 18291 PluginClass = Plugin; 18292 _initCore$2(); 18293 }, 18294 init: function init5(target, value, tween, index3, targets) { 18295 _coreInitted$4 || _initCore$2(1); 18296 if (!value) { 18297 _log("invalid shape"); 18298 return false; 18299 } 18300 _isFunction$2(value) && (value = value.call(tween, index3, target, targets)); 18301 var type, p2, pt, shape, isPoly, shapeIndex, map, startSmooth, endSmooth, start2, end, i2, j2, l2, startSeg, endSeg, precompiled, sData, eData, originFactors, useRotation, offset; 18302 if (typeof value === "string" || value.getBBox || value[0]) { 18303 value = { 18304 shape: value 18305 }; 18306 } else if (typeof value === "object") { 18307 type = {}; 18308 for (p2 in value) { 18309 type[p2] = _isFunction$2(value[p2]) && p2 !== "render" ? value[p2].call(tween, index3, target, targets) : value[p2]; 18310 } 18311 value = type; 18312 } 18313 var cs = target.nodeType ? window.getComputedStyle(target) : {}, fill = cs.fill + "", fillSafe = !(fill === "none" || (fill.match(_numExp) || [])[3] === "0" || cs.fillRule === "evenodd"), origins = (value.origin || "50 50").split(","); 18314 type = (target.nodeName + "").toUpperCase(); 18315 isPoly = type === "POLYLINE" || type === "POLYGON"; 18316 if (type !== "PATH" && !isPoly && !value.prop) { 18317 _log("Cannot morph a <" + type + "> element. " + _morphMessage); 18318 return false;
18319 } 18320 p2 = type === "PATH" ? "d" : "points"; 18321 if (!value.prop && !_isFunction$2(target.setAttribute)) { 18322 return false; 18323 } 18324 shape = _parseShape(value.shape || value.d || value.points || "", p2 === "d", target); 18325 if (isPoly && _commands.test(shape)) { 18326 _log("A <" + type + "> cannot accept path data. " + _morphMessage); 18327 return false; 18328 } 18329 shapeIndex = value.shapeIndex || value.shapeIndex === 0 ? value.shapeIndex : "auto"; 18330 map = value.map || MorphSVGPlugin.defaultMap; 18331 this._prop = value.prop; 18332 this._render = value.render || MorphSVGPlugin.defaultRender; 18333 this._apply = "updateTarget" in value ? value.updateTarget : MorphSVGPlugin.defaultUpdateTarget; 18334 this._rnd = Math.pow(10, isNaN(value.precision) ? 2 : +value.precision); 18335 this._tween = tween; 18336 if (shape) { 18337 this._target = target; 18338 precompiled = typeof value.precompile === "object"; 18339 start2 = this._prop ? target[this._prop] : target.getAttribute(p2); 18340 if (!this._prop && !target.getAttributeNS(null, "data-original")) { 18341 target.setAttributeNS(null, "data-original", start2); 18342 } 18343 if (p2 === "d" || this._prop) { 18344 start2 = stringToRawPath(precompiled ? value.precompile[0] : start2); 18345 end = stringToRawPath(precompiled ? value.precompile[1] : shape); 18346 if (!precompiled && !_equalizeSegmentQuantity(start2, end, shapeIndex, map, fillSafe)) { 18347 return false; 18348 } 18349 if (value.precompile === "log" || value.precompile === true) { 18350 _log('precompile:["' + rawPathToString(start2) + '","' + rawPathToString(end) + '"]'); 18351 } 18352 useRotation = (value.type || MorphSVGPlugin.defaultType) !== "linear"; 18353 if (useRotation) { 18354 start2 = _populateSmoothData(start2, value.smoothTolerance); 18355 end = _populateSmoothData(end, value.smoothTolerance); 18356 if (!start2.size) { 18357 _getTotalSize(start2); 18358 } 18359 if (!end.size) { 18360 _getTotalSize(end); 18361 } 18362 originFactors = _parseOriginFactors(origins[0]); 18363 this._origin = start2.origin = { 18364 x: start2.left + originFactors.x * start2.width, 18365 y: start2.top + originFactors.y * start2.height 18366 }; 18367 if (origins[1]) { 18368 originFactors = _parseOriginFactors(origins[1]); 18369 } 18370 this._eOrigin = { 18371 x: end.left + originFactors.x * end.width, 18372 y: end.top + originFactors.y * end.height 18373 }; 18374 } 18375 this._rawPath = target._gsRawPath = start2; 18376 j2 = start2.length; 18377 while (--j2 > -1) { 18378 startSeg = start2[j2]; 18379 endSeg = end[j2]; 18380 startSmooth = startSeg.isSmooth || []; 18381 endSmooth = endSeg.isSmooth || []; 18382 l2 = startSeg.length; 18383 _lastLinkedAnchor = 0; 18384 for (i2 = 0; i2 < l2; i2 += 2) { 18385 if (endSeg[i2] !== startSeg[i2] || endSeg[i2 + 1] !== startSeg[i2 + 1]) { 18386 if (useRotation) { 18387 if (startSmooth[i2] && endSmooth[i2]) { 18388 sData = startSeg.smoothData; 18389 eData = endSeg.smoothData; 18390 offset = i2 + (i2 === l2 - 4 ? 7 - l2 : 5); 18391 this._controlPT = { 18392 _next: this._controlPT, 18393 i: i2, 18394 j: j2, 18395 l1s: sData[i2 + 1], 18396 l1c: eData[i2 + 1] - sData[i2 + 1], 18397 l2s: sData[offset], 18398 l2c: eData[offset] - sData[offset] 18399 }; 18400 pt = this._tweenRotation(startSeg, endSeg, i2 + 2); 18401 this._tweenRotation(startSeg, endSeg, i2, pt); 18402 this._tweenRotation(startSeg, endSeg, offset - 1, pt); 18403 i2 += 4; 18404 } else { 18405 this._tweenRotation(startSeg, endSeg, i2); 18406 } 18407 } else { 18408 pt = this.add(startSeg, i2, startSeg[i2], endSeg[i2], 0, 0, 0, 0, 0, 1); 18409 pt = this.add(startSeg, i2 + 1, startSeg[i2 + 1], endSeg[i2 + 1], 0, 0, 0, 0, 0, 1) || pt; 18410 } 18411 } 18412 } 18413 } 18414 } else { 18415 pt = this.add(target, "setAttribute", target.getAttribute(p2) + "", shape + "", index3, targets, 0, _buildPointsFilter(shapeIndex), p2); 18416 } 18417 if (useRotation) { 18418 this.add(this._origin, "x", this._origin.x, this._eOrigin.x, 0, 0, 0, 0, 0, 1); 18419 pt = this.add(this._origin, "y", this._origin.y, this._eOrigin.y, 0, 0, 0, 0, 0, 1); 18420 } 18421 if (pt) { 18422 this._props.push("morphSVG"); 18423 pt.end = shape; 18424 pt.endProp = p2; 18425 } 18426 } 18427 return _bonusValidated; 18428 }, 18429 render: function render4(ratio, data) { 18430 var rawPath = data._rawPath, controlPT = data._controlPT, anch
18430orPT = data._anchorPT, rnd = data._rnd, target = data._target, pt = data._pt, s2, space, easeInOut, segment, l2, angle, i2, j2, x2, y2, sin, cos, offset; 18431 while (pt) { 18432 pt.r(ratio, pt.d); 18433 pt = pt._next; 18434 } 18435 if (ratio === 1 && data._apply) { 18436 pt = data._pt; 18437 while (pt) { 18438 if (pt.end) { 18439 if (data._prop) { 18440 target[data._prop] = pt.end; 18441 } else { 18442 target.setAttribute(pt.endProp, pt.end); 18443 } 18444 } 18445 pt = pt._next; 18446 } 18447 } else if (rawPath) { 18448 while (anchorPT) { 18449 angle = anchorPT.sa + ratio * anchorPT.ca; 18450 l2 = anchorPT.sl + ratio * anchorPT.cl; 18451 anchorPT.t[anchorPT.i] = data._origin.x + _cos(angle) * l2; 18452 anchorPT.t[anchorPT.i + 1] = data._origin.y + _sin(angle) * l2; 18453 anchorPT = anchorPT._next; 18454 } 18455 easeInOut = ratio < 0.5 ? 2 * ratio * ratio : (4 - 2 * ratio) * ratio - 1; 18456 while (controlPT) { 18457 i2 = controlPT.i; 18458 segment = rawPath[controlPT.j]; 18459 offset = i2 + (i2 === segment.length - 4 ? 7 - segment.length : 5); 18460 angle = _atan2(segment[offset] - segment[i2 + 1], segment[offset - 1] - segment[i2]); 18461 sin = _sin(angle); 18462 cos = _cos(angle); 18463 x2 = segment[i2 + 2]; 18464 y2 = segment[i2 + 3]; 18465 l2 = controlPT.l1s + easeInOut * controlPT.l1c; 18466 segment[i2] = x2 - cos * l2; 18467 segment[i2 + 1] = y2 - sin * l2; 18468 l2 = controlPT.l2s + easeInOut * controlPT.l2c; 18469 segment[offset - 1] = x2 + cos * l2; 18470 segment[offset] = y2 + sin * l2; 18471 controlPT = controlPT._next; 18472 } 18473 target._gsRawPath = rawPath; 18474 if (data._apply) { 18475 s2 = ""; 18476 space = " "; 18477 for (j2 = 0; j2 < rawPath.length; j2++) { 18478 segment = rawPath[j2]; 18479 l2 = segment.length; 18480 s2 += "M" + (segment[0] * rnd | 0) / rnd + space + (segment[1] * rnd | 0) / rnd + " C"; 18481 for (i2 = 2; i2 < l2; i2++) { 18482 s2 += (segment[i2] * rnd | 0) / rnd + space; 18483 } 18484 } 18485 if (data._prop) { 18486 target[data._prop] = s2; 18487 } else { 18488 target.setAttribute("d", s2); 18489 } 18490 } 18491 } 18492 data._render && rawPath && data._render.call(data._tween, rawPath, target); 18493 }, 18494 kill: function kill(property) { 18495 this._pt = this._rawPath = 0; 18496 }, 18497 getRawPath, 18498 stringToRawPath, 18499 rawPathToString, 18500 normalizeStrings: function normalizeStrings(shape1, shape2, _ref) { 18501 var shapeIndex = _ref.shapeIndex, map = _ref.map; 18502 var result = [shape1, shape2]; 18503 _pathFilter(result, shapeIndex, map); 18504 return result; 18505 }, 18506 pathFilter: _pathFilter, 18507 pointsFilter: _pointsFilter, 18508 getTotalSize: _getTotalSize, 18509 equalizeSegmentQuantity: _equalizeSegmentQuantity, 18510 convertToPath: function convertToPath$1(targets, swap) { 18511 return _toArray$3(targets).map(function(target) { 18512 return convertToPath(target, swap !== false); 18513 }); 18514 }, 18515 defaultType: "linear", 18516 defaultUpdateTarget: true, 18517 defaultMap: "size" 18518}; 18519_getGSAP$4() && gsap$4.registerPlugin(MorphSVGPlugin); 18520var TypesenseInstantsearchAdapter$1 = {}; 18521var interopRequireDefault = { exports: {} }; 18522(function(module) { 18523 function _interopRequireDefault(e2) { 18524 return e2 && e2.__esModule ? e2 : { 18525 "default": e2 18526 }; 18527 } 18528 module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; 18529})(interopRequireDefault); 18530var interopRequireDefaultExports = interopRequireDefault.exports; 18531var regeneratorRuntime$1 = { exports: {} }; 18532var _typeof$L = { exports: {} }; 18533var hasRequired_typeof; 18534function require_typeof() { 18535 if (hasRequired_typeof) return _typeof$L.exports; 18536 hasRequired_typeof = 1; 18537 (function(module) { 18538 function _typeof2(o2) { 18539 "@babel/helpers - typeof"; 18540 return module.exports = _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { 18541 return typeof o3; 18542 } : function(o3) { 18543 return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; 18544 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof2(o2); 18545 } 18546 module.exports = _typeof2, module.exports.__esModule = true, module.exports["default"] = module.exports; 18547 })(_typeof$L); 18548 return _typeof$L.exports; 18549} 18550var hasRequiredRegeneratorRuntime; 18551function requireRegeneratorRuntime() { 18552 if (hasRequiredRegeneratorRuntime) return regeneratorRuntime$1.exports; 18553 hasRequiredRegeneratorRuntime = 1; 18554 (function(module) { 18555 var _typeof2 = require_typeof()["default"]; 18556 function _regeneratorRuntime() { 18557 module.exports = _regeneratorRuntime = function _regeneratorRuntime2() { 18558 return e2; 18559 }, module.exports.__esModule = true, module.exports["default"] = module.exports; 18560 var t2, e2 = {}, r2 = Object.prototype, n2 = r2.hasOwnProperty, o2 = Object.defineProperty || function(t3, e3, r3) { 18561 t3[e3] = r3.value; 18562 }, i2 = "function" == typeof Symbol ? Symbol : {}, a2 = i2.iterator || "@@iterator", c2 = i2.asyncIterator || "@@asyncIterator", u2 = i2.toStringTag || "@@toStringTag"; 18563 function define(t3, e3, r3) { 18564 return Object.defineProperty(t3, e3, { 18565 value: r3, 18566 enumerable: true, 18567 configurable: true, 18568 writable: true 18569 }), t3[e3]; 18570 }
vendor: 12,512 bytes, lines 18571-18868
18571 try { 18572 define({}, ""); 18573 } catch (t3) { 18574 define = function define2(t4, e3, r3) { 18575 return t4[e3] = r3; 18576 }; 18577 } 18578 function wrap3(t3, e3, r3, n3) { 18579 var i3 = e3 && e3.prototype instanceof Generator ? e3 : Generator, a3 = Object.create(i3.prototype), c3 = new Context2(n3 || []); 18580 return o2(a3, "_invoke", { 18581 value: makeInvokeMethod(t3, r3, c3) 18582 }), a3; 18583 } 18584 function tryCatch(t3, e3, r3) { 18585 try { 18586 return { 18587 type: "normal", 18588 arg: t3.call(e3, r3) 18589 }; 18590 } catch (t4) { 18591 return { 18592 type: "throw", 18593 arg: t4 18594 }; 18595 } 18596 } 18597 e2.wrap = wrap3; 18598 var h2 = "suspendedStart", l2 = "suspendedYield", f2 = "executing", s2 = "completed", y2 = {}; 18599 function Generator() { 18600 } 18601 function GeneratorFunction() { 18602 } 18603 function GeneratorFunctionPrototype() { 18604 } 18605 var p2 = {}; 18606 define(p2, a2, function() { 18607 return this; 18608 }); 18609 var d2 = Object.getPrototypeOf, v2 = d2 && d2(d2(values([]))); 18610 v2 && v2 !== r2 && n2.call(v2, a2) && (p2 = v2); 18611 var g2 = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p2); 18612 function defineIteratorMethods(t3) { 18613 ["next", "throw", "return"].forEach(function(e3) { 18614 define(t3, e3, function(t4) { 18615 return this._invoke(e3, t4); 18616 }); 18617 }); 18618 } 18619 function AsyncIterator(t3, e3) { 18620 function invoke(r4, o3, i3, a3) { 18621 var c3 = tryCatch(t3[r4], t3, o3); 18622 if ("throw" !== c3.type) { 18623 var u3 = c3.arg, h3 = u3.value; 18624 return h3 && "object" == _typeof2(h3) && n2.call(h3, "__await") ? e3.resolve(h3.__await).then(function(t4) { 18625 invoke("next", t4, i3, a3); 18626 }, function(t4) { 18627 invoke("throw", t4, i3, a3); 18628 }) : e3.resolve(h3).then(function(t4) { 18629 u3.value = t4, i3(u3); 18630 }, function(t4) { 18631 return invoke("throw", t4, i3, a3); 18632 }); 18633 } 18634 a3(c3.arg); 18635 } 18636 var r3; 18637 o2(this, "_invoke", { 18638 value: function value(t4, n3) { 18639 function callInvokeWithMethodAndArg() { 18640 return new e3(function(e4, r4) { 18641 invoke(t4, n3, e4, r4); 18642 }); 18643 } 18644 return r3 = r3 ? r3.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); 18645 } 18646 }); 18647 } 18648 function makeInvokeMethod(e3, r3, n3) { 18649 var o3 = h2; 18650 return function(i3, a3) { 18651 if (o3 === f2) throw Error("Generator is already running"); 18652 if (o3 === s2) { 18653 if ("throw" === i3) throw a3; 18654 return { 18655 value: t2, 18656 done: true 18657 }; 18658 } 18659 for (n3.method = i3, n3.arg = a3; ; ) { 18660 var c3 = n3.delegate; 18661 if (c3) { 18662 var u3 = maybeInvokeDelegate(c3, n3); 18663 if (u3) { 18664 if (u3 === y2) continue; 18665 return u3; 18666 } 18667 } 18668 if ("next" === n3.method) n3.sent = n3._sent = n3.arg; 18669 else if ("throw" === n3.method) { 18670 if (o3 === h2) throw o3 = s2, n3.arg; 18671 n3.dispatchException(n3.arg); 18672 } else "return" === n3.method && n3.abrupt("return", n3.arg); 18673 o3 = f2; 18674 var p3 = tryCatch(e3, r3, n3); 18675 if ("normal" === p3.type) { 18676 if (o3 = n3.done ? s2 : l2, p3.arg === y2) continue; 18677 return { 18678 value: p3.arg, 18679 done: n3.done 18680 }; 18681 } 18682 "throw" === p3.type && (o3 = s2, n3.method = "throw", n3.arg = p3.arg); 18683 } 18684 }; 18685 } 18686 function maybeInvokeDelegate(e3, r3) { 18687 var n3 = r3.method, o3 = e3.iterator[n3]; 18688 if (o3 === t2) return r3.delegate = null, "throw" === n3 && e3.iterator["return"] && (r3.method = "return", r3.arg = t2, maybeInvokeDelegate(e3, r3), "throw" === r3.method) || "return" !== n3 && (r3.method = "throw", r3.arg = new TypeError("The iterator does not provide a '" + n3 + "' method")), y2; 18689 var i3 = tryCatch(o3, e3.iterator, r3.arg); 18690 if ("throw" === i3.type) return r3.method = "throw", r3.arg = i3.arg, r3.delegate = null, y2; 18691 var a3 = i3.arg; 18692 return a3 ? a3.done ? (r3[e3.resultName] = a3.value, r3.next = e3.nextLoc, "return" !== r3.method && (r3.method = "next", r3.arg = t2), r3.delegate = null, y2) : a3 : (r3.method = "throw", r3.arg = new TypeError("iterator result is not an object"), r3.delegate = null, y2); 18693 } 18694 function pushTryEntry(t3) { 18695 var e3 = { 18696 tryLoc: t3[0] 18697 }; 18698 1 in t3 && (e3.catchLoc = t3[1]), 2 in t3 && (e3.finallyLoc = t3[2], e3.afterLoc = t3[3]), this.tryEntries.push(e3); 18699 } 18700 function resetTryEntry(t3) { 18701 var e3 = t3.completion || {}; 18702 e3.type = "normal", delete e3.arg, t3.completion = e3; 18703 } 18704 function Context2(t3) { 18705 this.tryEntries = [{ 18706 tryLoc: "root" 18707 }], t3.forEach(pushTryEntry, this), this.reset(true); 18708 } 18709 function values(e3) { 18710 if (e3 || "" === e3) { 18711 var r3 = e3[a2]; 18712 if (r3) return r3.call(e3); 18713 if ("function" == typeof e3.next) return e3; 18714 if (!isNaN(e3.length)) { 18715 var o3 = -1, i3 = function next2() { 18716 for (; ++o3 < e3.length; ) if (n2.call(e3, o3)) return next2.value = e3[o3], next2.done = false, next2; 18717 return next2.value = t2, next2.done = true, next2; 18718 }; 18719 return i3.next = i3; 18720 } 18721 } 18722 throw new TypeError(_typeof2(e3) + " is not iterable"); 18723 } 18724 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o2(g2, "constructor", { 18725 value: GeneratorFunctionPrototype, 18726 configurable: true 18727 }), o2(GeneratorFunctionPrototype, "constructor", { 18728 value: GeneratorFunction, 18729 configurable: true 18730 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u2, "GeneratorFunction"), e2.isGeneratorFunction = function(t3) { 18731 var e3 = "function" == typeof t3 && t3.constructor; 18732 return !!e3 && (e3 === GeneratorFunction || "GeneratorFunction" === (e3.displayName || e3.name)); 18733 }, e2.mark = function(t3) { 18734 return Object.setPrototypeOf ? Object.setPrototypeOf(t3, GeneratorFunctionPrototype) : (t3.__proto__ = GeneratorFunctionPrototype, define(t3, u2, "GeneratorFunction")), t3.prototype = Object.create(g2), t3; 18735 }, e2.awrap = function(t3) { 18736 return { 18737 __await: t3 18738 }; 18739 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c2, function() { 18740 return this; 18741 }), e2.AsyncIterator = AsyncIterator, e2.async = function(t3, r3, n3, o3, i3) { 18742 void 0 === i3 && (i3 = Promise); 18743 var a3 = new AsyncIterator(wrap3(t3, r3, n3, o3), i3); 18744 return e2.isGeneratorFunction(r3) ? a3 : a3.next().then(function(t4) { 18745 return t4.done ? t4.value : a3.next(); 18746 }); 18747 }, defineIteratorMethods(g2), define(g2, u2, "Generator"), define(g2, a2, function() { 18748 return this; 18749 }), define(g2, "toString", function() { 18750 return "[object Generator]"; 18751 }), e2.keys = function(t3) { 18752 var e3 = Object(t3), r3 = []; 18753 for (var n3 in e3) r3.push(n3); 18754 return r3.reverse(), function next2() { 18755 for (; r3.length; ) { 18756 var t4 = r3.pop(); 18757 if (t4 in e3) return next2.value = t4, next2.done = false, next2; 18758 } 18759 return next2.done = true, next2; 18760 }; 18761 }, e2.values = values, Context2.prototype = { 18762 constructor: Context2, 18763 reset: function reset2(e3) { 18764 if (this.prev = 0, this.next = 0, this.sent = this._sent = t2, this.done = false, this.delegate = null, this.method = "next", this.arg = t2, this.tryEntries.forEach(resetTryEntry), !e3) for (var r3 in this) "t" === r3.charAt(0) && n2.call(this, r3) && !isNaN(+r3.slice(1)) && (this[r3] = t2); 18765 }, 18766 stop: function stop() { 18767 this.done = true; 18768 var t3 = this.tryEntries[0].completion; 18769 if ("throw" === t3.type) throw t3.arg; 18770 return this.rval; 18771 }, 18772 dispatchException: function dispatchException(e3) { 18773 if (this.done) throw e3; 18774 var r3 = this; 18775 function handle(n3, o4) { 18776 return a3.type = "throw", a3.arg = e3, r3.next = n3, o4 && (r3.method = "next", r3.arg = t2), !!o4; 18777 } 18778 for (var o3 = this.tryEntries.length - 1; o3 >= 0; --o3) { 18779 var i3 = this.tryEntries[o3], a3 = i3.completion; 18780 if ("root" === i3.tryLoc) return handle("end"); 18781 if (i3.tryLoc <= this.prev) { 18782 var c3 = n2.call(i3, "catchLoc"), u3 = n2.call(i3, "finallyLoc"); 18783 if (c3 && u3) { 18784 if (this.prev < i3.catchLoc) return handle(i3.catchLoc, true); 18785 if (this.prev < i3.finallyLoc) return handle(i3.finallyLoc); 18786 } else if (c3) { 18787 if (this.prev < i3.catchLoc) return handle(i3.catchLoc, true); 18788 } else { 18789 if (!u3) throw Error("try statement without catch or finally"); 18790 if (this.prev < i3.finallyLoc) return handle(i3.finallyLoc); 18791 } 18792 } 18793 } 18794 }, 18795 abrupt: function abrupt(t3, e3) { 18796 for (var r3 = this.tryEntries.length - 1; r3 >= 0; --r3) { 18797 var o3 = this.tryEntries[r3]; 18798 if (o3.tryLoc <= this.prev && n2.call(o3, "finallyLoc") && this.prev < o3.finallyLoc) { 18799 var i3 = o3; 18800 break; 18801 } 18802 } 18803 i3 && ("break" === t3 || "continue" === t3) && i3.tryLoc <= e3 && e3 <= i3.finallyLoc && (i3 = null); 18804 var a3 = i3 ? i3.completion : {}; 18805 return a3.type = t3, a3.arg = e3, i3 ? (this.method = "next", this.next = i3.finallyLoc, y2) : this.complete(a3); 18806 }, 18807 complete: function complete(t3, e3) { 18808 if ("throw" === t3.type) throw t3.arg; 18809 return "break" === t3.type || "continue" === t3.type ? this.next = t3.arg : "return" === t3.type ? (this.rval = this.arg = t3.arg, this.method = "return", this.next = "end") : "normal" === t3.type && e3 && (this.next = e3), y2; 18810 }, 18811 finish: function finish(t3) { 18812 for (var e3 = this.tryEntries.length - 1; e3 >= 0; --e3) { 18813 var r3 = this.tryEntries[e3]; 18814 if (r3.finallyLoc === t3) return this.complete(r3.completion, r3.afterLoc), resetTryEntry(r3), y2; 18815 } 18816 }, 18817 "catch": function _catch(t3) { 18818 for (var e3 = this.tryEntries.length - 1; e3 >= 0; --e3) { 18819 var r3 = this.tryEntries[e3]; 18820 if (r3.tryLoc === t3) { 18821 var n3 = r3.completion; 18822 if ("throw" === n3.type) { 18823 var o3 = n3.arg; 18824 resetTryEntry(r3); 18825 } 18826 return o3; 18827 } 18828 } 18829 throw Error("illegal catch attempt"); 18830 }, 18831 delegateYield: function delegateYield(e3, r3, n3) { 18832 return this.delegate = { 18833 iterator: values(e3), 18834 resultName: r3, 18835 nextLoc: n3 18836 }, "next" === this.method && (this.arg = t2), y2; 18837 } 18838 }, e2; 18839 } 18840 module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; 18841 })(regeneratorRuntime$1); 18842 return regeneratorRuntime$1.exports; 18843} 18844var regenerator; 18845var hasRequiredRegenerator; 18846function requireRegenerator() { 18847 if (hasRequiredRegenerator) return regenerator; 18848 hasRequiredRegenerator = 1; 18849 var runtime = requireRegeneratorRuntime()(); 18850 regenerator = runtime; 18851 try { 18852 regeneratorRuntime = runtime; 18853 } catch (accidentalStrictMode) { 18854 if (typeof globalThis === "object") { 18855 globalThis.regeneratorRuntime = runtime; 18856 } else { 18857 Function("r", "regeneratorRuntime = r")(runtime); 18858 } 18859 } 18860 return regenerator; 18861} 18862var asyncToGenerator = { exports: {} }; 18863var hasRequiredAsyncToGenerator; 18864function requireAsyncToGenerator() { 18865 if (hasRequiredAsyncToGenerator) return asyncToGenerator.exports; 18866 hasRequiredAsyncToGenerator = 1; 18867 (function(module) { 18868 function asyncGeneratorStep(n2, t2, e2, r2, o2, a2, c2) {
18869 try { 18870 var i2 = n2[a2](c2), u2 = i2.value; 18871 } catch (n3) { 18872 return void e2(n3); 18873 } 18874 i2.done ? t2(u2) : Promise.resolve(u2).then(r2, o2); 18875 } 18876 function _asyncToGenerator(n2) { 18877 return function() { 18878 var t2 = this, e2 = arguments; 18879 return new Promise(function(r2, o2) { 18880 var a2 = n2.apply(t2, e2); 18881 function _next(n3) { 18882 asyncGeneratorStep(a2, r2, o2, _next, _throw, "next", n3); 18883 } 18884 function _throw(n3) { 18885 asyncGeneratorStep(a2, r2, o2, _next, _throw, "throw", n3); 18886 } 18887 _next(void 0); 18888 }); 18889 }; 18890 } 18891 module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; 18892 })(asyncToGenerator); 18893 return asyncToGenerator.exports; 18894} 18895var classCallCheck = { exports: {} }; 18896var hasRequiredClassCallCheck; 18897function requireClassCallCheck() { 18898 if (hasRequiredClassCallCheck) return classCallCheck.exports; 18899 hasRequiredClassCallCheck = 1; 18900 (function(module) { 18901 function _classCallCheck2(a2, n2) { 18902 if (!(a2 instanceof n2)) throw new TypeError("Cannot call a class as a function"); 18903 } 18904 module.exports = _classCallCheck2, module.exports.__esModule = true, module.exports["default"] = module.exports; 18905 })(classCallCheck); 18906 return classCallCheck.exports; 18907} 18908var createClass = { exports: {} }; 18909var toPropertyKey = { exports: {} }; 18910var toPrimitive = { exports: {} }; 18911var hasRequiredToPrimitive; 18912function requireToPrimitive() { 18913 if (hasRequiredToPrimitive) return toPrimitive.exports; 18914 hasRequiredToPrimitive = 1; 18915 (function(module) { 18916 var _typeof2 = require_typeof()["default"]; 18917 function toPrimitive2(t2, r2) { 18918 if ("object" != _typeof2(t2) || !t2) return t2; 18919 var e2 = t2[Symbol.toPrimitive]; 18920 if (void 0 !== e2) { 18921 var i2 = e2.call(t2, r2 || "default"); 18922 if ("object" != _typeof2(i2)) return i2; 18923 throw new TypeError("@@toPrimitive must return a primitive value."); 18924 } 18925 return ("string" === r2 ? String : Number)(t2); 18926 } 18927 module.exports = toPrimitive2, module.exports.__esModule = true, module.exports["default"] = module.exports; 18928 })(toPrimitive); 18929 return toPrimitive.exports; 18930} 18931var hasRequiredToPropertyKey; 18932function requireToPropertyKey() { 18933 if (hasRequiredToPropertyKey) return toPropertyKey.exports; 18934 hasRequiredToPropertyKey = 1; 18935 (function(module) { 18936 var _typeof2 = require_typeof()["default"]; 18937 var toPrimitive2 = requireToPrimitive(); 18938 function toPropertyKey2(t2) { 18939 var i2 = toPrimitive2(t2, "string"); 18940 return "symbol" == _typeof2(i2) ? i2 : i2 + ""; 18941 } 18942 module.exports = toPropertyKey2, module.exports.__esModule = true, module.exports["default"] = module.exports; 18943 })(toPropertyKey); 18944 return toPropertyKey.exports; 18945} 18946var hasRequiredCreateClass; 18947function requireCreateClass() { 18948 if (hasRequiredCreateClass) return createClass.exports; 18949 hasRequiredCreateClass = 1; 18950 (function(module) { 18951 var toPropertyKey2 = requireToPropertyKey(); 18952 function _defineProperties2(e2, r2) { 18953 for (var t2 = 0; t2 < r2.length; t2++) { 18954 var o2 = r2[t2]; 18955 o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, toPropertyKey2(o2.key), o2); 18956 } 18957 } 18958 function _createClass2(e2, r2, t2) { 18959 return r2 && _defineProperties2(e2.prototype, r2), t2 && _defineProperties2(e2, t2), Object.defineProperty(e2, "prototype", { 18960 writable: false 18961 }), e2; 18962 } 18963 module.exports = _createClass2, module.exports.__esModule = true, module.exports["default"] = module.exports; 18964 })(createClass); 18965 return createClass.exports; 18966} 18967var Configuration$1 = {}; 18968var hasRequiredConfiguration$1; 18969function requireConfiguration$1() { 18970 if (hasRequiredConfiguration$1) return Configuration$1; 18971 hasRequiredConfiguration$1 = 1; 18972 var _interopRequireDefault = interopRequireDefaultExports; 18973 Object.defineProperty(Configuration$1, "__esModule", { 18974 value: true 18975 }); 18976 Configuration$1.Configuration = void 0; 18977 var _classCallCheck2 = _interopRequireDefault(requireClassCallCheck()); 18978 var _createClass2 = _interopRequireDefault(requireCreateClass()); 18979 var Configuration2 = /* @__PURE__ */ function() { 18980 function Configuration3() { 18981 var _this$server$cacheSea, _options$additionalSe, _ref, _this$additionalSearc, _ref22, _this$additionalSearc2, _ref3, _this$additionalSearc3, _ref42, _this$additionalSearc4, _options$geoLocationF, _options$facetableFie, _options$collectionSp, _this = this, _options$flattenGroup, _options$facetByOptio, _options$filterByOpti, _options$collectionSp2, _options$collectionSp3; 18982 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 18983 (0, _classCallCheck2["default"])(this, Configuration3); 18984 this.server = options.server || { 18985 nodes: [{ 18986 host: "localhost", 18987 port: "8108", 18988 path: "", 18989 protocol: "http" 18990 }] 18991 }; 18992 this.server.cacheSearchResultsForSeconds = (_this$server$cacheSea = this.server.cacheSearchResultsForSeconds) !== null && _this$server$cacheSea !== void 0 ? _this$server$cacheSea : 2 * 60; 18993 this.additionalSearchParameters = (_options$additionalSe = options.additionalSearchParameters) !== null && _options$additionalSe !== void 0 ? _options$additionalSe : {}; 18994 this.additionalSearchParameters.query_by = (_ref = (_this$additionalSearc = this.additionalSearchParameters.queryBy) !== null && _this$additionalSearc !== void 0 ? _this$additionalSearc : this.additionalSearchParameters.query_by) !== null && _ref !== void 0 ? _ref : ""; 18995 this.additionalSearchParameters.preset = (_ref22 = (_this$additionalSearc2 = this.additionalSearchParameters.preset) !== null && _this$additionalSearc2 !== void 0 ? _this$additionalSearc2 : this.additionalSearchParameters.preset) !== null && _ref22 !== void 0 ? _ref22 : ""; 18996 this.additionalSearchParameters.sort_by = (_ref3 = (_this$additionalSearc3 = this.additionalSearchParameters.sortBy) !== null && _this$additionalSearc3 !== void 0 ? _this$additionalSearc3 : this.additionalSearchParameters.sort_by) !== null && _ref3 !== void 0 ? _ref3 : ""; 18997 this.additionalSearchParameters.highlight_full_fields = (_ref42 = (_this$additionalSearc4 = this.additionalSearchParameters.highlightFullFields) !== null && _this$additionalSearc4 !== void 0 ? _this$additionalSearc4 : this.additionalSearchParameters.highlight_full_fields) !== null && _ref42 !== void 0 ? _ref42 : this.additionalSearchParameters.query_by; 18998 this.geoLocationField = (_options$geoLocationF = options.geoLocationField) !== null && _options$geoLocationF !== void 0 ? _options$geoLocationF : "_geoloc"; 18999 this.facetableFieldsWithSpecialCharacters = (_options$facetableFie = options.facetableFieldsWithSpecialCharacters) !== null && _options$facetableFie !== void 0 ? _options$facetableFie : []; 19000 this.collectionSpecificSearchParameters = (_options$collectionSp = options.collectionSpecificSearchParameters) !== null && _options$collectionSp !== void 0 ? _options$collectionSp : {}; 19001 Object.keys(this.collectionSpecificSearchParameters).forEac
vendor: 2,558 bytes, lines 19001-19025
19001h(function(collection) { 19002 var _params$queryBy, _params$preset, _params$sortBy, _ref5, _ref62, _params$highlightFull; 19003 var params = _this.collectionSpecificSearchParameters[collection]; 19004 params.query_by = (_params$queryBy = params.queryBy) !== null && _params$queryBy !== void 0 ? _params$queryBy : params.query_by; 19005 params.preset = (_params$preset = params.preset) !== null && _params$preset !== void 0 ? _params$preset : params.preset; 19006 params.sort_by = (_params$sortBy = params.sortBy) !== null && _params$sortBy !== void 0 ? _params$sortBy : params.sort_by; 19007 params.highlight_full_fields = (_ref5 = (_ref62 = (_params$highlightFull = params.highlightFullFields) !== null && _params$highlightFull !== void 0 ? _params$highlightFull : params.highlight_full_fields) !== null && _ref62 !== void 0 ? _ref62 : _this.additionalSearchParameters.highlight_full_fields) !== null && _ref5 !== void 0 ? _ref5 : params.query_by; 19008 Object.keys(params).forEach(function(key2) { 19009 return params[key2] === void 0 ? delete params[key2] : {}; 19010 }); 19011 }); 19012 this.renderingContent = options.renderingContent; 19013 this.flattenGroupedHits = (_options$flattenGroup = options.flattenGroupedHits) !== null && _options$flattenGroup !== void 0 ? _options$flattenGroup : true; 19014 this.facetByOptions = (_options$facetByOptio = options.facetByOptions) !== null && _options$facetByOptio !== void 0 ? _options$facetByOptio : {}; 19015 this.filterByOptions = (_options$filterByOpti = options.filterByOptions) !== null && _options$filterByOpti !== void 0 ? _options$filterByOpti : {}; 19016 this.collectionSpecificFacetByOptions = (_options$collectionSp2 = options.collectionSpecificFacetByOptions) !== null && _options$collectionSp2 !== void 0 ? _options$collectionSp2 : {}; 19017 this.collectionSpecificFilterByOptions = (_options$collectionSp3 = options.collectionSpecificFilterByOptions) !== null && _options$collectionSp3 !== void 0 ? _options$collectionSp3 : {}; 19018 } 19019 (0, _createClass2["default"])(Configuration3, [{ 19020 key: "validate", 19021 value: function validate() { 19022 if (this.additionalSearchParameters.queryBy || Object.values(this.collectionSpecificSearchParameters).some(function(c2) { 19023 return c2.queryBy; 19024 })) { 19025 console.warn("[typesense-instantsearch-adapter] Please use snake_cased versions of parameters in additionalSearchParameters instead of camelCased parameters. For example: Use query_by instead of queryBy. camelCased parameters will be deprecated
vendor: 10,013 bytes, lines 19025-19301
19025in a future version. We're making this change so that parameter names are identical to the ones sent to Typesense (which are all snake_cased), and to also keep the types for these parameters in sync with the types defined in typesense-js."); 19026 } 19027 if (this.additionalSearchParameters.query_by.length === 0 && this.additionalSearchParameters.preset.length === 0 && (Object.keys(this.collectionSpecificSearchParameters).length === 0 || Object.values(this.collectionSpecificSearchParameters).some(function(c2) { 19028 return (c2.query_by || "").length === 0 && (c2.preset || "").length === 0; 19029 }))) { 19030 throw new Error("[typesense-instantsearch-adapter] Missing parameter: One of additionalSearchParameters.query_by or additionalSearchParameters.preset needs to be set, or all collectionSpecificSearchParameters need to have either .query_by or .preset set."); 19031 } 19032 } 19033 }]); 19034 return Configuration3; 19035 }(); 19036 Configuration$1.Configuration = Configuration2; 19037 return Configuration$1; 19038} 19039var Typesense$1 = {}; 19040var Client = {}; 19041var Configuration = {}; 19042var loglevel = { exports: {} }; 19043var hasRequiredLoglevel; 19044function requireLoglevel() { 19045 if (hasRequiredLoglevel) return loglevel.exports; 19046 hasRequiredLoglevel = 1; 19047 (function(module) { 19048 (function(root, definition) { 19049 if (module.exports) { 19050 module.exports = definition(); 19051 } else { 19052 root.log = definition(); 19053 } 19054 })(commonjsGlobal, function() { 19055 var noop2 = function() { 19056 }; 19057 var undefinedType = "undefined"; 19058 var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent); 19059 var logMethods = [ 19060 "trace", 19061 "debug", 19062 "info", 19063 "warn", 19064 "error" 19065 ]; 19066 var _loggersByName = {}; 19067 var defaultLogger = null; 19068 function bindMethod(obj, methodName) { 19069 var method = obj[methodName]; 19070 if (typeof method.bind === "function") { 19071 return method.bind(obj); 19072 } else { 19073 try { 19074 return Function.prototype.bind.call(method, obj); 19075 } catch (e2) { 19076 return function() { 19077 return Function.prototype.apply.apply(method, [obj, arguments]); 19078 }; 19079 } 19080 } 19081 } 19082 function traceForIE() { 19083 if (console.log) { 19084 if (console.log.apply) { 19085 console.log.apply(console, arguments); 19086 } else { 19087 Function.prototype.apply.apply(console.log, [console, arguments]); 19088 } 19089 } 19090 if (console.trace) console.trace(); 19091 } 19092 function realMethod(methodName) { 19093 if (methodName === "debug") { 19094 methodName = "log"; 19095 } 19096 if (typeof console === undefinedType) { 19097 return false; 19098 } else if (methodName === "trace" && isIE) { 19099 return traceForIE; 19100 } else if (console[methodName] !== void 0) { 19101 return bindMethod(console, methodName); 19102 } else if (console.log !== void 0) { 19103 return bindMethod(console, "log"); 19104 } else { 19105 return noop2; 19106 } 19107 } 19108 function replaceLoggingMethods() { 19109 var level = this.getLevel(); 19110 for (var i2 = 0; i2 < logMethods.length; i2++) { 19111 var methodName = logMethods[i2]; 19112 this[methodName] = i2 < level ? noop2 : this.methodFactory(methodName, level, this.name); 19113 } 19114 this.log = this.debug; 19115 if (typeof console === undefinedType && level < this.levels.SILENT) { 19116 return "No console available for logging"; 19117 } 19118 } 19119 function enableLoggingWhenConsoleArrives(methodName) { 19120 return function() { 19121 if (typeof console !== undefinedType) { 19122 replaceLoggingMethods.call(this); 19123 this[methodName].apply(this, arguments); 19124 } 19125 }; 19126 } 19127 function defaultMethodFactory(methodName, _level, _loggerName) { 19128 return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments); 19129 } 19130 function Logger(name, factory) { 19131 var self2 = this; 19132 var inheritedLevel; 19133 var defaultLevel; 19134 var userLevel; 19135 var storageKey = "loglevel"; 19136 if (typeof name === "string") { 19137 storageKey += ":" + name; 19138 } else if (typeof name === "symbol") { 19139 storageKey = void 0; 19140 } 19141 function persistLevelIfPossible(levelNum) { 19142 var levelName = (logMethods[levelNum] || "silent").toUpperCase(); 19143 if (typeof window === undefinedType || !storageKey) return; 19144 try { 19145 window.localStorage[storageKey] = levelName; 19146 return; 19147 } catch (ignore) { 19148 } 19149 try { 19150 window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";"; 19151 } catch (ignore) { 19152 } 19153 } 19154 function getPersistedLevel() { 19155 var storedLevel; 19156 if (typeof window === undefinedType || !storageKey) return; 19157 try { 19158 storedLevel = window.localStorage[storageKey]; 19159 } catch (ignore) { 19160 } 19161 if (typeof storedLevel === undefinedType) { 19162 try { 19163 var cookie = window.document.cookie; 19164 var cookieName = encodeURIComponent(storageKey); 19165 var location2 = cookie.indexOf(cookieName + "="); 19166 if (location2 !== -1) { 19167 storedLevel = /^([^;]+)/.exec( 19168 cookie.slice(location2 + cookieName.length + 1) 19169 )[1]; 19170 } 19171 } catch (ignore) { 19172 } 19173 } 19174 if (self2.levels[storedLevel] === void 0) { 19175 storedLevel = void 0; 19176 } 19177 return storedLevel; 19178 } 19179 function clearPersistedLevel() { 19180 if (typeof window === undefinedType || !storageKey) return; 19181 try { 19182 window.localStorage.removeItem(storageKey); 19183 } catch (ignore) { 19184 } 19185 try { 19186 window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; 19187 } catch (ignore) { 19188 } 19189 } 19190 function normalizeLevel(input) { 19191 var level = input; 19192 if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) { 19193 level = self2.levels[level.toUpperCase()]; 19194 } 19195 if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) { 19196 return level; 19197 } else { 19198 throw new TypeError("log.setLevel() called with invalid level: " + input); 19199 } 19200 } 19201 self2.name = name; 19202 self2.levels = { 19203 "TRACE": 0, 19204 "DEBUG": 1, 19205 "INFO": 2, 19206 "WARN": 3, 19207 "ERROR": 4, 19208 "SILENT": 5 19209 }; 19210 self2.methodFactory = factory || defaultMethodFactory; 19211 self2.getLevel = function() { 19212 if (userLevel != null) { 19213 return userLevel; 19214 } else if (defaultLevel != null) { 19215 return defaultLevel; 19216 } else { 19217 return inheritedLevel; 19218 } 19219 }; 19220 self2.setLevel = function(level, persist) { 19221 userLevel = normalizeLevel(level); 19222 if (persist !== false) { 19223 persistLevelIfPossible(userLevel); 19224 } 19225 return replaceLoggingMethods.call(self2); 19226 }; 19227 self2.setDefaultLevel = function(level) { 19228 defaultLevel = normalizeLevel(level); 19229 if (!getPersistedLevel()) { 19230 self2.setLevel(level, false); 19231 } 19232 }; 19233 self2.resetLevel = function() { 19234 userLevel = null; 19235 clearPersistedLevel(); 19236 replaceLoggingMethods.call(self2); 19237 }; 19238 self2.enableAll = function(persist) { 19239 self2.setLevel(self2.levels.TRACE, persist); 19240 }; 19241 self2.disableAll = function(persist) { 19242 self2.setLevel(self2.levels.SILENT, persist); 19243 }; 19244 self2.rebuild = function() { 19245 if (defaultLogger !== self2) { 19246 inheritedLevel = normalizeLevel(defaultLogger.getLevel()); 19247 } 19248 replaceLoggingMethods.call(self2); 19249 if (defaultLogger === self2) { 19250 for (var childName in _loggersByName) { 19251 _loggersByName[childName].rebuild(); 19252 } 19253 } 19254 }; 19255 inheritedLevel = normalizeLevel( 19256 defaultLogger ? defaultLogger.getLevel() : "WARN" 19257 ); 19258 var initialLevel = getPersistedLevel(); 19259 if (initialLevel != null) { 19260 userLevel = normalizeLevel(initialLevel); 19261 } 19262 replaceLoggingMethods.call(self2); 19263 } 19264 defaultLogger = new Logger(); 19265 defaultLogger.getLogger = function getLogger(name) { 19266 if (typeof name !== "symbol" && typeof name !== "string" || name === "") { 19267 throw new TypeError("You must supply a name when creating a logger."); 19268 } 19269 var logger = _loggersByName[name]; 19270 if (!logger) { 19271 logger = _loggersByName[name] = new Logger( 19272 name, 19273 defaultLogger.methodFactory 19274 ); 19275 } 19276 return logger; 19277 }; 19278 var _log3 = typeof window !== undefinedType ? window.log : void 0; 19279 defaultLogger.noConflict = function() { 19280 if (typeof window !== undefinedType && window.log === defaultLogger) { 19281 window.log = _log3; 19282 } 19283 return defaultLogger; 19284 }; 19285 defaultLogger.getLoggers = function getLoggers() { 19286 return _loggersByName; 19287 }; 19288 defaultLogger["default"] = defaultLogger; 19289 return defaultLogger; 19290 }); 19291 })(loglevel); 19292 return loglevel.exports; 19293} 19294var Errors = {}; 19295var HTTPError = {}; 19296var TypesenseError = {}; 19297var hasRequiredTypesenseError; 19298function requireTypesenseError() { 19299 if (hasRequiredTypesenseError) return TypesenseError; 19300 hasRequiredTypesenseError = 1; 19301 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19301URE__ */ function() { 19302 var extendStatics = function(d2, b2) { 19303 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19304 d3.__proto__ = b3; 19305 } || function(d3, b3) { 19306 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19307 }; 19308 return extendStatics(d2, b2); 19309 }; 19310 return function(d2, b2) { 19311 if (typeof b2 !== "function" && b2 !== null) 19312 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19313 extendStatics(d2, b2); 19314 function __() { 19315 this.constructor = d2; 19316 } 19317 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19318 }; 19319 }(); 19320 Object.defineProperty(TypesenseError, "__esModule", { value: true }); 19321 var TypesenseError$1 = ( 19322 /** @class */ 19323 function(_super) { 19324 __extends(TypesenseError2, _super); 19325 function TypesenseError2(message) { 19326 var _newTarget = this.constructor; 19327 var _this = _super.call(this, message) || this; 19328 _this.name = _newTarget.name; 19329 Object.setPrototypeOf(_this, _newTarget.prototype); 19330 return _this; 19331 } 19332 return TypesenseError2; 19333 }(Error) 19334 ); 19335 TypesenseError.default = TypesenseError$1; 19336 return TypesenseError; 19337} 19338var hasRequiredHTTPError; 19339function requireHTTPError() { 19340 if (hasRequiredHTTPError) return HTTPError; 19341 hasRequiredHTTPError = 1; 19342 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19342URE__ */ function() { 19343 var extendStatics = function(d2, b2) { 19344 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19345 d3.__proto__ = b3; 19346 } || function(d3, b3) { 19347 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19348 }; 19349 return extendStatics(d2, b2); 19350 }; 19351 return function(d2, b2) { 19352 if (typeof b2 !== "function" && b2 !== null) 19353 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19354 extendStatics(d2, b2); 19355 function __() { 19356 this.constructor = d2; 19357 } 19358 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19359 }; 19360 }(); 19361 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19362 return mod && mod.__esModule ? mod : { "default": mod }; 19363 }; 19364 Object.defineProperty(HTTPError, "__esModule", { value: true }); 19365 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19366 var HTTPError$1 = ( 19367 /** @class */ 19368 function(_super) { 19369 __extends(HTTPError2, _super); 19370 function HTTPError2() { 19371 return _super !== null && _super.apply(this, arguments) || this; 19372 } 19373 return HTTPError2; 19374 }(TypesenseError_1.default) 19375 ); 19376 HTTPError.default = HTTPError$1; 19377 return HTTPError; 19378} 19379var MissingConfigurationError = {}; 19380var hasRequiredMissingConfigurationError; 19381function requireMissingConfigurationError() { 19382 if (hasRequiredMissingConfigurationError) return MissingConfigurationError; 19383 hasRequiredMissingConfigurationError = 1; 19384 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19384URE__ */ function() { 19385 var extendStatics = function(d2, b2) { 19386 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19387 d3.__proto__ = b3; 19388 } || function(d3, b3) { 19389 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19390 }; 19391 return extendStatics(d2, b2); 19392 }; 19393 return function(d2, b2) { 19394 if (typeof b2 !== "function" && b2 !== null) 19395 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19396 extendStatics(d2, b2); 19397 function __() { 19398 this.constructor = d2; 19399 } 19400 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19401 }; 19402 }(); 19403 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19404 return mod && mod.__esModule ? mod : { "default": mod }; 19405 }; 19406 Object.defineProperty(MissingConfigurationError, "__esModule", { value: true }); 19407 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19408 var MissingConfigurationError$1 = ( 19409 /** @class */ 19410 function(_super) { 19411 __extends(MissingConfigurationError2, _super); 19412 function MissingConfigurationError2() { 19413 return _super !== null && _super.apply(this, arguments) || this; 19414 } 19415 return MissingConfigurationError2; 19416 }(TypesenseError_1.default) 19417 ); 19418 MissingConfigurationError.default = MissingConfigurationError$1; 19419 return MissingConfigurationError; 19420} 19421var ObjectAlreadyExists = {}; 19422var hasRequiredObjectAlreadyExists; 19423function requireObjectAlreadyExists() { 19424 if (hasRequiredObjectAlreadyExists) return ObjectAlreadyExists; 19425 hasRequiredObjectAlreadyExists = 1; 19426 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19426URE__ */ function() { 19427 var extendStatics = function(d2, b2) { 19428 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19429 d3.__proto__ = b3; 19430 } || function(d3, b3) { 19431 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19432 }; 19433 return extendStatics(d2, b2); 19434 }; 19435 return function(d2, b2) { 19436 if (typeof b2 !== "function" && b2 !== null) 19437 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19438 extendStatics(d2, b2); 19439 function __() { 19440 this.constructor = d2; 19441 } 19442 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19443 }; 19444 }(); 19445 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19446 return mod && mod.__esModule ? mod : { "default": mod }; 19447 }; 19448 Object.defineProperty(ObjectAlreadyExists, "__esModule", { value: true }); 19449 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19450 var ObjectAlreadyExists$1 = ( 19451 /** @class */ 19452 function(_super) { 19453 __extends(ObjectAlreadyExists2, _super); 19454 function ObjectAlreadyExists2() { 19455 return _super !== null && _super.apply(this, arguments) || this; 19456 } 19457 return ObjectAlreadyExists2; 19458 }(TypesenseError_1.default) 19459 ); 19460 ObjectAlreadyExists.default = ObjectAlreadyExists$1; 19461 return ObjectAlreadyExists; 19462} 19463var ObjectNotFound = {}; 19464var hasRequiredObjectNotFound; 19465function requireObjectNotFound() { 19466 if (hasRequiredObjectNotFound) return ObjectNotFound; 19467 hasRequiredObjectNotFound = 1; 19468 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19468URE__ */ function() { 19469 var extendStatics = function(d2, b2) { 19470 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19471 d3.__proto__ = b3; 19472 } || function(d3, b3) { 19473 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19474 }; 19475 return extendStatics(d2, b2); 19476 }; 19477 return function(d2, b2) { 19478 if (typeof b2 !== "function" && b2 !== null) 19479 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19480 extendStatics(d2, b2); 19481 function __() { 19482 this.constructor = d2; 19483 } 19484 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19485 }; 19486 }(); 19487 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19488 return mod && mod.__esModule ? mod : { "default": mod }; 19489 }; 19490 Object.defineProperty(ObjectNotFound, "__esModule", { value: true }); 19491 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19492 var ObjectNotFound$1 = ( 19493 /** @class */ 19494 function(_super) { 19495 __extends(ObjectNotFound2, _super); 19496 function ObjectNotFound2() { 19497 return _super !== null && _super.apply(this, arguments) || this; 19498 } 19499 return ObjectNotFound2; 19500 }(TypesenseError_1.default) 19501 ); 19502 ObjectNotFound.default = ObjectNotFound$1; 19503 return ObjectNotFound; 19504} 19505var ObjectUnprocessable = {}; 19506var hasRequiredObjectUnprocessable; 19507function requireObjectUnprocessable() { 19508 if (hasRequiredObjectUnprocessable) return ObjectUnprocessable; 19509 hasRequiredObjectUnprocessable = 1; 19510 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19510URE__ */ function() { 19511 var extendStatics = function(d2, b2) { 19512 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19513 d3.__proto__ = b3; 19514 } || function(d3, b3) { 19515 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19516 }; 19517 return extendStatics(d2, b2); 19518 }; 19519 return function(d2, b2) { 19520 if (typeof b2 !== "function" && b2 !== null) 19521 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19522 extendStatics(d2, b2); 19523 function __() { 19524 this.constructor = d2; 19525 } 19526 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19527 }; 19528 }(); 19529 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19530 return mod && mod.__esModule ? mod : { "default": mod }; 19531 }; 19532 Object.defineProperty(ObjectUnprocessable, "__esModule", { value: true }); 19533 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19534 var ObjectUnprocessable$1 = ( 19535 /** @class */ 19536 function(_super) { 19537 __extends(ObjectUnprocessable2, _super); 19538 function ObjectUnprocessable2() { 19539 return _super !== null && _super.apply(this, arguments) || this; 19540 } 19541 return ObjectUnprocessable2; 19542 }(TypesenseError_1.default) 19543 ); 19544 ObjectUnprocessable.default = ObjectUnprocessable$1; 19545 return ObjectUnprocessable; 19546} 19547var RequestMalformed = {}; 19548var hasRequiredRequestMalformed; 19549function requireRequestMalformed() { 19550 if (hasRequiredRequestMalformed) return RequestMalformed; 19551 hasRequiredRequestMalformed = 1; 19552 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19552URE__ */ function() { 19553 var extendStatics = function(d2, b2) { 19554 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19555 d3.__proto__ = b3; 19556 } || function(d3, b3) { 19557 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19558 }; 19559 return extendStatics(d2, b2); 19560 }; 19561 return function(d2, b2) { 19562 if (typeof b2 !== "function" && b2 !== null) 19563 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19564 extendStatics(d2, b2); 19565 function __() { 19566 this.constructor = d2; 19567 } 19568 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19569 }; 19570 }(); 19571 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19572 return mod && mod.__esModule ? mod : { "default": mod }; 19573 }; 19574 Object.defineProperty(RequestMalformed, "__esModule", { value: true }); 19575 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19576 var RequestMalformed$1 = ( 19577 /** @class */ 19578 function(_super) { 19579 __extends(RequestMalformed2, _super); 19580 function RequestMalformed2() { 19581 return _super !== null && _super.apply(this, arguments) || this; 19582 } 19583 return RequestMalformed2; 19584 }(TypesenseError_1.default) 19585 ); 19586 RequestMalformed.default = RequestMalformed$1; 19587 return RequestMalformed; 19588} 19589var RequestUnauthorized = {}; 19590var hasRequiredRequestUnauthorized; 19591function requireRequestUnauthorized() { 19592 if (hasRequiredRequestUnauthorized) return RequestUnauthorized; 19593 hasRequiredRequestUnauthorized = 1; 19594 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19594URE__ */ function() { 19595 var extendStatics = function(d2, b2) { 19596 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19597 d3.__proto__ = b3; 19598 } || function(d3, b3) { 19599 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19600 }; 19601 return extendStatics(d2, b2); 19602 }; 19603 return function(d2, b2) { 19604 if (typeof b2 !== "function" && b2 !== null) 19605 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19606 extendStatics(d2, b2); 19607 function __() { 19608 this.constructor = d2; 19609 } 19610 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19611 }; 19612 }(); 19613 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19614 return mod && mod.__esModule ? mod : { "default": mod }; 19615 }; 19616 Object.defineProperty(RequestUnauthorized, "__esModule", { value: true }); 19617 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19618 var RequestUnauthorized$1 = ( 19619 /** @class */ 19620 function(_super) { 19621 __extends(RequestUnauthorized2, _super); 19622 function RequestUnauthorized2() { 19623 return _super !== null && _super.apply(this, arguments) || this; 19624 } 19625 return RequestUnauthorized2; 19626 }(TypesenseError_1.default) 19627 ); 19628 RequestUnauthorized.default = RequestUnauthorized$1; 19629 return RequestUnauthorized; 19630} 19631var ServerError = {}; 19632var hasRequiredServerError; 19633function requireServerError() { 19634 if (hasRequiredServerError) return ServerError; 19635 hasRequiredServerError = 1; 19636 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19636URE__ */ function() { 19637 var extendStatics = function(d2, b2) { 19638 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19639 d3.__proto__ = b3; 19640 } || function(d3, b3) { 19641 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19642 }; 19643 return extendStatics(d2, b2); 19644 }; 19645 return function(d2, b2) { 19646 if (typeof b2 !== "function" && b2 !== null) 19647 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19648 extendStatics(d2, b2); 19649 function __() { 19650 this.constructor = d2; 19651 } 19652 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19653 }; 19654 }(); 19655 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19656 return mod && mod.__esModule ? mod : { "default": mod }; 19657 }; 19658 Object.defineProperty(ServerError, "__esModule", { value: true }); 19659 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19660 var ServerError$1 = ( 19661 /** @class */ 19662 function(_super) { 19663 __extends(ServerError2, _super); 19664 function ServerError2() { 19665 return _super !== null && _super.apply(this, arguments) || this; 19666 } 19667 return ServerError2; 19668 }(TypesenseError_1.default) 19669 ); 19670 ServerError.default = ServerError$1; 19671 return ServerError; 19672} 19673var ImportError = {}; 19674var hasRequiredImportError; 19675function requireImportError() { 19676 if (hasRequiredImportError) return ImportError; 19677 hasRequiredImportError = 1; 19678 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__P
19678URE__ */ function() { 19679 var extendStatics = function(d2, b2) { 19680 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 19681 d3.__proto__ = b3; 19682 } || function(d3, b3) { 19683 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 19684 }; 19685 return extendStatics(d2, b2); 19686 }; 19687 return function(d2, b2) { 19688 if (typeof b2 !== "function" && b2 !== null) 19689 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 19690 extendStatics(d2, b2); 19691 function __() { 19692 this.constructor = d2; 19693 } 19694 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 19695 }; 19696 }(); 19697 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19698 return mod && mod.__esModule ? mod : { "default": mod }; 19699 }; 19700 Object.defineProperty(ImportError, "__esModule", { value: true }); 19701 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19702 var ImportError$1 = ( 19703 /** @class */ 19704 function(_super) { 19705 __extends(ImportError2, _super); 19706 function ImportError2(message, importResults) { 19707 var _this = _super.call(this, message) || this; 19708 _this.importResults = importResults; 19709 return _this; 19710 } 19711 return ImportError2; 19712 }(TypesenseError_1.default) 19713 ); 19714 ImportError.default = ImportError$1; 19715 return ImportError; 19716} 19717var hasRequiredErrors; 19718function requireErrors() { 19719 if (hasRequiredErrors) return Errors; 19720 hasRequiredErrors = 1; 19721 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 19722 return mod && mod.__esModule ? mod : { "default": mod }; 19723 }; 19724 Object.defineProperty(Errors, "__esModule", { value: true }); 19725 Errors.ImportError = Errors.TypesenseError = Errors.ServerError = Errors.RequestUnauthorized = Errors.RequestMalformed = Errors.ObjectUnprocessable = Errors.ObjectNotFound = Errors.ObjectAlreadyExists = Errors.MissingConfigurationError = Errors.HTTPError = void 0; 19726 var HTTPError_1 = __importDefault(requireHTTPError()); 19727 Errors.HTTPError = HTTPError_1.default; 19728 var MissingConfigurationError_1 = __importDefault(requireMissingConfigurationError()); 19729 Errors.MissingConfigurationError = MissingConfigurationError_1.default; 19730 var ObjectAlreadyExists_1 = __importDefault(requireObjectAlreadyExists()); 19731 Errors.ObjectAlreadyExists = ObjectAlreadyExists_1.default; 19732 var ObjectNotFound_1 = __importDefault(requireObjectNotFound()); 19733 Errors.ObjectNotFound = ObjectNotFound_1.default; 19734 var ObjectUnprocessable_1 = __importDefault(requireObjectUnprocessable()); 19735 Errors.ObjectUnprocessable = ObjectUnprocessable_1.default; 19736 var RequestMalformed_1 = __importDefault(requireRequestMalformed()); 19737 Errors.RequestMalformed = RequestMalformed_1.default; 19738 var RequestUnauthorized_1 = __importDefault(requireRequestUnauthorized()); 19739 Errors.RequestUnauthorized = RequestUnauthorized_1.default; 19740 var ServerError_1 = __importDefault(requireServerError()); 19741 Errors.ServerError = ServerError_1.default; 19742 var ImportError_1 = __importDefault(requireImportError()); 19743 Errors.ImportError = ImportError_1.default; 19744 var TypesenseError_1 = __importDefault(requireTypesenseError()); 19745 Errors.TypesenseError = TypesenseError_1.default; 19746 return Errors; 19747} 19748var hasRequiredConfiguration; 19749function requireConfiguration() { 19750 if (hasRequiredConfiguration) return Configuration; 19751 hasRequiredConfiguration = 1; 19752 var __assign = commonjsGlobal && commonjsGlobal.__assign || function() { 19753 __assign = Object.assign || function(t2) { 19754 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { 19755 s2 = arguments[i2]; 19756 for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) 19757 t2[p2] = s2[p2]; 19758 } 19759 return t2; 19760 }; 19761 return __assign.apply(this, arguments); 19762 }; 19763 var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o2, m2, k2, k22) { 19764 if (k22 === void 0) k22 = k2; 19765 var desc = Object.getOwnPropertyDescriptor(m2, k2); 19766 if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { 19767 desc = { enumerable: true, get: function() { 19768 return m2[k2]; 19769 } }; 19770 } 19771 Object.defineProperty(o2, k22, desc); 19772 } : function(o2, m2, k2, k22) { 19773 if (k22 === void 0) k22 = k2; 19774 o2[k22] = m2[k2]; 19775 }); 19776 var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o2, v2) { 19777 Object.defineProperty(o2, "default", { enumerable: true, value: v2 }); 19778 } : function(o2, v2) { 19779 o2["default"] = v2; 19780 }); 19781 var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) { 19782 if (mod && mod.__esModule) return mod; 19783 var result = {}; 19784 if (mod != null) { 19785 for (var k2 in mod) if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2)) __createBinding(result, mod, k2); 19786 } 19787 __setModuleDefault(result, mod); 19788 return result; 19789 }; 19790 Object.defineProperty(Configuration, "__esModule", { value: true }); 19791 var logger = __importStar(requireLoglevel()); 19792 var Errors_1 = requireErrors(); 19793 var Configuration$12 = ( 19794 /** @class */ 19795 function() { 19796 function Configuration2(options) { 19797 var _this = this; 19798 this.nodes = options.nodes || []; 19799 this.nodes = this.nodes.map(function(node) { 19800 return _this.setDefaultPathInNode(node); 19801 }).map(function(node) { 19802 return _this.setDefaultPortInNode(node); 19803 }).map(function(node) { 19804 return __assign({}, node); 19805 }); 19806 if (options.randomizeNodes == null) { 19807 options.randomizeNodes = true; 19808 } 19809 if (options.randomizeNodes === true) { 19810 this.shuffleArray(this.nodes); 19811 } 19812 this.nearestNode = options.nearestNode; 19813 this.nearestNode = this.setDefaultPathInNode(this.nearestNode); 19814 this.nearestNode = this.setDefaultPortInNode(this.nearestNode); 19815 this.connectionTimeoutSeconds = options.connectionTimeoutSeconds || options.timeoutSeconds || 5; 19816 this.healthcheckIntervalSeconds = options.healthcheckIntervalSeconds || 60; 19817 this.numRetries = options.numRetries || this.nodes.length + (this.nearestNode == null ? 0 : 1) || 3; 19818 this.retryIntervalSeconds = options.retryIntervalSeconds || 0.1; 19819 this.apiKey = options.apiKey; 19820 this.sendApiKeyAsQueryParam = options.sendApiKeyAsQueryParam; 19821 this.cacheSearchResultsForSeconds = options.cacheSearchResultsForSeconds || 0; 19822 this.useServerSideSearchCache = options.useServerSideSearchCache || false; 19823 this.logger = options.logger || logger; 19824 this.logLevel = options.logLevel || "warn"; 19825 this.logger.setLevel(this.logLevel); 19826 this.additionalHeaders = options.additionalHeaders; 19827 this.httpAgent = options.httpAgent; 19828 this.httpsAgent = options.httpsAgent; 19829 this.showDeprecationWarnings(options); 19830 this.validate(); 19831 } 19832 Configuration2.prototype.validate = function() { 19833 if (this.nodes == null || this.nodes.length === 0 || this.validateNodes()) { 19834 throw new Errors_1.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set"); 19835 } 19836 if (this.nearestNode != null && this.isNodeMissingAnyParameters(this.nearestNode)) { 19837 throw new Errors_1.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set"); 19838 } 19839 if (this.apiKey == null) { 19840 throw new Errors_1.MissingConfigurationError("Ensure that apiKey is set"); 19841 } 19842 return true; 19843 }; 19844 Configuration2.prototype.validateNodes = function() { 19845 var _this = this; 19846 return this.nodes.some(function(node) { 19847 return _this.isNodeMissingAnyParameters(node); 19848 }); 19849 }; 19850 Configuration2.prototype.isNodeMissingAnyParameters = function(node) { 19851 return !["protocol", "host", "port", "path"].every(function(key2) { 19852 return node.hasOwnProperty(key2); 19853 }) && node["url"] == null; 19854 }; 19855 Configuration2.prototype.setDefaultPathInNode = function(node) { 19856 if (node != null && !node.hasOwnProperty("path")) {
19857 node["path"] = ""; 19858 } 19859 return node; 19860 }; 19861 Configuration2.prototype.setDefaultPortInNode = function(node) { 19862 if (node != null && !node.hasOwnProperty("port") && node.hasOwnProperty("protocol")) { 19863 switch (node["protocol"]) { 19864 case "https": 19865 node["port"] = 443; 19866 break; 19867 case "http": 19868 node["port"] = 80; 19869 break; 19870 } 19871 } 19872 return node; 19873 }; 19874 Configuration2.prototype.showDeprecationWarnings = function(options) { 19875 if (options.timeoutSeconds) { 19876 this.logger.warn("Deprecation warning: timeoutSeconds is now renamed to connectionTimeoutSeconds"); 19877 } 19878 if (options.masterNode) { 19879 this.logger.warn("Deprecation warning: masterNode is now consolidated to nodes, starting with Typesense Server v0.12"); 19880 } 19881 if (options.readReplicaNodes) { 19882 this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12"); 19883 } 19884 }; 19885 Configuration2.prototype.shuffleArray = function(array) { 19886 var _a2; 19887 for (var i2 = array.length - 1; i2 > 0; i2--) { 19888 var j2 = Math.floor(Math.random() * (i2 + 1)); 19889 _a2 = [array[j2], array[i2]], array[i2] = _a2[0], array[j2] = _a2[1]; 19890 } 19891 }; 19892 return Configuration2; 19893 }() 19894 ); 19895 Configuration.default = Configuration$12; 19896 return Configuration; 19897} 19898var ApiCall = {}; 19899var axios_1; 19900var hasRequiredAxios; 19901function requireAxios() { 19902 if (hasRequiredAxios) return axios_1; 19903 hasRequiredAxios = 1; 19904 function bind(fn, thisArg) { 19905 return function wrap3() { 19906 return fn.apply(thisArg, arguments); 19907 }; 19908 } 19909 const { toString } = Object.prototype; 19910 const { getPrototypeOf } = Object; 19911 const kindOf = /* @__PURE__ */ ((cache2) => (thing) => { 19912 const str = toString.call(thing); 19913 return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase()); 19914 })(/* @__PURE__ */ Object.create(null)); 19915 const kindOfTest = (type) => { 19916 type = type.toLowerCase(); 19917 return (thing) => kindOf(thing) === type; 19918 }; 19919 const typeOfTest = (type) => (thing) => typeof thing === type; 19920 const { isArray: isArray2 } = Array; 19921 const isUndefined2 = typeOfTest("undefined"); 19922 function isBuffer3(val) { 19923 return val !== null && !isUndefined2(val) && val.constructor !== null && !isUndefined2(val.constructor) && isFunction2(val.constructor.isBuffer) && val.constructor.isBuffer(val); 19924 } 19925 const isArrayBuffer = kindOfTest("ArrayBuffer"); 19926 function isArrayBufferView(val) { 19927 let result; 19928 if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { 19929 result = ArrayBuffer.isView(val); 19930 } else { 19931 result = val && val.buffer && isArrayBuffer(val.buffer); 19932 } 19933 return result; 19934 } 19935 const isString = typeOfTest("string"); 19936 const isFunction2 = typeOfTest("function"); 19937 const isNumber2 = typeOfTest("number"); 19938 const isObject2 = (thing) => thing !== null && typeof thing === "object"; 19939 const isBoolean = (thing) => thing === true || thing === false; 19940 const isPlainObject2 = (val) => { 19941 if (kindOf(val) !== "object") { 19942 return false; 19943 } 19944 const prototype2 = getPrototypeOf(val); 19945 return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); 19946 }; 19947 const isDate = kindOfTest("Date"); 19948 const isFile = kindOfTest("File"); 19949 const isBlob = kindOfTest("Blob"); 19950 const isFileList = kindOfTest("FileList"); 19951 const isStream = (val) => isObject2(val) && isFunction2(val.pipe); 19952 const isFormData = (thing) => { 19953 let kind; 19954 return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction2(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance 19955 kind === "object" && isFunction2(thing.toString) && thing.toString() === "[object FormData]")); 19956 }; 19957 const isURLSearchParams = kindOfTest("URLSearchParams"); 19958 const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest); 19959 const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); 19960 function forEach(obj, fn, { allOwnKeys = false } = {}) { 19961 if (obj === null || typeof obj === "undefined") { 19962 return; 19963 } 19964 let i2; 19965 let l2; 19966 if (typeof obj !== "object") { 19967 obj = [obj]; 19968 } 19969 if (isArray2(obj)) { 19970 for (i2 = 0, l2 = obj.length; i2 < l2; i2++) { 19971 fn.call(null, obj[i2], i2, obj); 19972 } 19973 } else {
vendor: 4,898 bytes, lines 19974-20121
19974 const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); 19975 const len2 = keys.length; 19976 let key2; 19977 for (i2 = 0; i2 < len2; i2++) { 19978 key2 = keys[i2]; 19979 fn.call(null, obj[key2], key2, obj); 19980 } 19981 } 19982 } 19983 function findKey(obj, key2) { 19984 key2 = key2.toLowerCase(); 19985 const keys = Object.keys(obj); 19986 let i2 = keys.length; 19987 let _key; 19988 while (i2-- > 0) { 19989 _key = keys[i2]; 19990 if (key2 === _key.toLowerCase()) { 19991 return _key; 19992 } 19993 } 19994 return null; 19995 } 19996 const _global = (() => { 19997 if (typeof globalThis !== "undefined") return globalThis; 19998 return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : commonjsGlobal; 19999 })(); 20000 const isContextDefined = (context3) => !isUndefined2(context3) && context3 !== _global; 20001 function merge3() { 20002 const { caseless } = isContextDefined(this) && this || {}; 20003 const result = {}; 20004 const assignValue = (val, key2) => { 20005 const targetKey = caseless && findKey(result, key2) || key2; 20006 if (isPlainObject2(result[targetKey]) && isPlainObject2(val)) { 20007 result[targetKey] = merge3(result[targetKey], val); 20008 } else if (isPlainObject2(val)) { 20009 result[targetKey] = merge3({}, val); 20010 } else if (isArray2(val)) { 20011 result[targetKey] = val.slice(); 20012 } else { 20013 result[targetKey] = val; 20014 } 20015 }; 20016 for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) { 20017 arguments[i2] && forEach(arguments[i2], assignValue); 20018 } 20019 return result; 20020 } 20021 const extend2 = (a2, b2, thisArg, { allOwnKeys } = {}) => { 20022 forEach(b2, (val, key2) => { 20023 if (thisArg && isFunction2(val)) { 20024 a2[key2] = bind(val, thisArg); 20025 } else { 20026 a2[key2] = val; 20027 } 20028 }, { allOwnKeys }); 20029 return a2; 20030 }; 20031 const stripBOM = (content) => { 20032 if (content.charCodeAt(0) === 65279) { 20033 content = content.slice(1); 20034 } 20035 return content; 20036 }; 20037 const inherits2 = (constructor, superConstructor, props, descriptors2) => { 20038 constructor.prototype = Object.create(superConstructor.prototype, descriptors2); 20039 constructor.prototype.constructor = constructor; 20040 Object.defineProperty(constructor, "super", { 20041 value: superConstructor.prototype 20042 }); 20043 props && Object.assign(constructor.prototype, props); 20044 }; 20045 const toFlatObject = (sourceObj, destObj, filter, propFilter) => { 20046 let props; 20047 let i2; 20048 let prop; 20049 const merged = {}; 20050 destObj = destObj || {}; 20051 if (sourceObj == null) return destObj; 20052 do { 20053 props = Object.getOwnPropertyNames(sourceObj); 20054 i2 = props.length; 20055 while (i2-- > 0) { 20056 prop = props[i2]; 20057 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { 20058 destObj[prop] = sourceObj[prop]; 20059 merged[prop] = true; 20060 } 20061 } 20062 sourceObj = filter !== false && getPrototypeOf(sourceObj); 20063 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); 20064 return destObj; 20065 }; 20066 const endsWith = (str, searchString, position) => { 20067 str = String(str); 20068 if (position === void 0 || position > str.length) { 20069 position = str.length; 20070 } 20071 position -= searchString.length; 20072 const lastIndex = str.indexOf(searchString, position); 20073 return lastIndex !== -1 && lastIndex === position; 20074 }; 20075 const toArray3 = (thing) => { 20076 if (!thing) return null; 20077 if (isArray2(thing)) return thing; 20078 let i2 = thing.length; 20079 if (!isNumber2(i2)) return null; 20080 const arr = new Array(i2); 20081 while (i2-- > 0) { 20082 arr[i2] = thing[i2]; 20083 } 20084 return arr; 20085 }; 20086 const isTypedArray = /* @__PURE__ */ ((TypedArray) => { 20087 return (thing) => { 20088 return TypedArray && thing instanceof TypedArray; 20089 }; 20090 })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); 20091 const forEachEntry = (obj, fn) => { 20092 const generator = obj && obj[Symbol.iterator]; 20093 const iterator = generator.call(obj); 20094 let result; 20095 while ((result = iterator.next()) && !result.done) { 20096 const pair = result.value; 20097 fn.call(obj, pair[0], pair[1]); 20098 } 20099 }; 20100 const matchAll = (regExp, str) => { 20101 let matches; 20102 const arr = []; 20103 while ((matches = regExp.exec(str)) !== null) { 20104 arr.push(matches); 20105 } 20106 return arr; 20107 }; 20108 const isHTMLForm = kindOfTest("HTMLFormElement"); 20109 const toCamelCase = (str) => { 20110 return str.toLowerCase().replace( 20111 /[-_\s]([a-z\d])(\w*)/g, 20112 function replacer(m2, p1, p2) { 20113 return p1.toUpperCase() + p2; 20114 } 20115 ); 20116 }; 20117 const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype); 20118 const isRegExp3 = kindOfTest("RegExp"); 20119 const reduceDescriptors = (obj, reducer) => { 20120 const descriptors2 = Object.getOwnPropertyDescriptors(obj); 20121 const reducedDescriptors = {};
20122 forEach(descriptors2, (descriptor, name) => { 20123 let ret; 20124 if ((ret = reducer(descriptor, name, obj)) !== false) { 20125 reducedDescriptors[name] = ret || descriptor; 20126 } 20127 }); 20128 Object.defineProperties(obj, reducedDescriptors); 20129 }; 20130 const freezeMethods = (obj) => { 20131 reduceDescriptors(obj, (descriptor, name) => { 20132 if (isFunction2(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) { 20133 return false; 20134 } 20135 const value = obj[name]; 20136 if (!isFunction2(value)) return; 20137 descriptor.enumerable = false; 20138 if ("writable" in descriptor) { 20139 descriptor.writable = false; 20140 return; 20141 } 20142 if (!descriptor.set) { 20143 descriptor.set = () => { 20144 throw Error("Can not rewrite read-only method '" + name + "'"); 20145 }; 20146 } 20147 }); 20148 }; 20149 const toObjectSet = (arrayOrString, delimiter) => { 20150 const obj = {}; 20151 const define = (arr) => { 20152 arr.forEach((value) => { 20153 obj[value] = true; 20154 }); 20155 }; 20156 isArray2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); 20157 return obj; 20158 }; 20159 const noop2 = () => { 20160 }; 20161 const toFiniteNumber = (value, defaultValue) => { 20162 return value != null && Number.isFinite(value = +value) ? value : defaultValue; 20163 }; 20164 const ALPHA = "abcdefghijklmnopqrstuvwxyz"; 20165 const DIGIT = "0123456789"; 20166 const ALPHABET = { 20167 DIGIT, 20168 ALPHA, 20169 ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT 20170 }; 20171 const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { 20172 let str = ""; 20173 const { length } = alphabet; 20174 while (size--) { 20175 str += alphabet[Math.random() * length | 0]; 20176 } 20177 return str; 20178 }; 20179 function isSpecCompliantForm(thing) { 20180 return !!(thing && isFunction2(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]); 20181 } 20182 const toJSONObject = (obj) => { 20183 const stack = new Array(10); 20184 const visit2 = (source, i2) => { 20185 if (isObject2(source)) { 20186 if (stack.indexOf(source) >= 0) { 20187 return; 20188 } 20189 if (!("toJSON" in source)) { 20190 stack[i2] = source; 20191 const target = isArray2(source) ? [] : {}; 20192 forEach(source, (value, key2) => { 20193 const reducedValue = visit2(value, i2 + 1); 20194 !isUndefined2(reducedValue) && (target[key2] = reducedValue); 20195 }); 20196 stack[i2] = void 0; 20197 return target; 20198 } 20199 } 20200 return source; 20201 }; 20202 return visit2(obj, 0); 20203 }; 20204 const isAsyncFn = kindOfTest("AsyncFunction"); 20205 const isThenable = (thing) => thing && (isObject2(thing) || isFunction2(thing)) && isFunction2(thing.then) && isFunction2(thing.catch); 20206 const _setImmediate = ((setImmediateSupported, postMessageSupported) => { 20207 if (setImmediateSupported) { 20208 return setImmediate; 20209 } 20210 return postMessageSupported ? ((token, callbacks) => { 20211 _global.addEventListener("message", ({ source, data }) => { 20212 if (source === _global && data === token) { 20213 callbacks.length && callbacks.shift()(); 20214 } 20215 }, false); 20216 return (cb) => { 20217 callbacks.push(cb); 20218 _global.postMessage(token, "*"); 20219 }; 20220 })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); 20221 })( 20222 typeof setImmediate === "function", 20223 isFunction2(_global.postMessage) 20224 ); 20225 const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate; 20226 var utils$12 = { 20227 isArray: isArray2, 20228 isArrayBuffer, 20229 isBuffer: isBuffer3, 20230 isFormData, 20231 isArrayBufferView, 20232 isString, 20233 isNumber: isNumber2, 20234 isBoolean, 20235 isObject: isObject2, 20236 isPlainObject: isPlainObject2, 20237 isReadableStream, 20238 isRequest, 20239 isResponse, 20240 isHeaders, 20241 isUndefined: isUndefined2, 20242 isDate, 20243 isFile, 20244 isBlob, 20245 isRegExp: isRegExp3, 20246 isFunction: isFunction2, 20247 isStream, 20248 isURLSearchParams, 20249 isTypedArray, 20250 isFileList, 20251 forEach, 20252 merge: merge3, 20253 extend: extend2, 20254 trim, 20255 stripBOM, 20256 inherits: inherits2, 20257 toFlatObject, 20258 kindOf, 20259 kindOfTest, 20260 endsWith, 20261 toArray: toArray3,
vendor: 9,919 bytes, lines 20262-20574
20262 forEachEntry, 20263 matchAll, 20264 isHTMLForm, 20265 hasOwnProperty, 20266 hasOwnProp: hasOwnProperty, 20267 // an alias to avoid ESLint no-prototype-builtins detection 20268 reduceDescriptors, 20269 freezeMethods, 20270 toObjectSet, 20271 toCamelCase, 20272 noop: noop2, 20273 toFiniteNumber, 20274 findKey, 20275 global: _global, 20276 isContextDefined, 20277 ALPHABET, 20278 generateString, 20279 isSpecCompliantForm, 20280 toJSONObject, 20281 isAsyncFn, 20282 isThenable, 20283 setImmediate: _setImmediate, 20284 asap 20285 }; 20286 function AxiosError(message, code, config4, request, response) { 20287 Error.call(this); 20288 if (Error.captureStackTrace) { 20289 Error.captureStackTrace(this, this.constructor); 20290 } else { 20291 this.stack = new Error().stack; 20292 } 20293 this.message = message; 20294 this.name = "AxiosError"; 20295 code && (this.code = code); 20296 config4 && (this.config = config4); 20297 request && (this.request = request); 20298 if (response) { 20299 this.response = response; 20300 this.status = response.status ? response.status : null; 20301 } 20302 } 20303 utils$12.inherits(AxiosError, Error, { 20304 toJSON: function toJSON() { 20305 return { 20306 // Standard 20307 message: this.message, 20308 name: this.name, 20309 // Microsoft 20310 description: this.description, 20311 number: this.number, 20312 // Mozilla 20313 fileName: this.fileName, 20314 lineNumber: this.lineNumber, 20315 columnNumber: this.columnNumber, 20316 stack: this.stack, 20317 // Axios 20318 config: utils$12.toJSONObject(this.config), 20319 code: this.code, 20320 status: this.status 20321 }; 20322 } 20323 }); 20324 const prototype$1 = AxiosError.prototype; 20325 const descriptors = {}; 20326 [ 20327 "ERR_BAD_OPTION_VALUE", 20328 "ERR_BAD_OPTION", 20329 "ECONNABORTED", 20330 "ETIMEDOUT", 20331 "ERR_NETWORK", 20332 "ERR_FR_TOO_MANY_REDIRECTS", 20333 "ERR_DEPRECATED", 20334 "ERR_BAD_RESPONSE", 20335 "ERR_BAD_REQUEST", 20336 "ERR_CANCELED", 20337 "ERR_NOT_SUPPORT", 20338 "ERR_INVALID_URL" 20339 // eslint-disable-next-line func-names 20340 ].forEach((code) => { 20341 descriptors[code] = { value: code }; 20342 }); 20343 Object.defineProperties(AxiosError, descriptors); 20344 Object.defineProperty(prototype$1, "isAxiosError", { value: true }); 20345 AxiosError.from = (error2, code, config4, request, response, customProps) => { 20346 const axiosError = Object.create(prototype$1); 20347 utils$12.toFlatObject(error2, axiosError, function filter(obj) { 20348 return obj !== Error.prototype; 20349 }, (prop) => { 20350 return prop !== "isAxiosError"; 20351 }); 20352 AxiosError.call(axiosError, error2.message, code, config4, request, response); 20353 axiosError.cause = error2; 20354 axiosError.name = error2.name; 20355 customProps && Object.assign(axiosError, customProps); 20356 return axiosError; 20357 }; 20358 var httpAdapter = null; 20359 function isVisitable(thing) { 20360 return utils$12.isPlainObject(thing) || utils$12.isArray(thing); 20361 } 20362 function removeBrackets(key2) { 20363 return utils$12.endsWith(key2, "[]") ? key2.slice(0, -2) : key2; 20364 } 20365 function renderKey(path, key2, dots) { 20366 if (!path) return key2; 20367 return path.concat(key2).map(function each(token, i2) { 20368 token = removeBrackets(token); 20369 return !dots && i2 ? "[" + token + "]" : token; 20370 }).join(dots ? "." : ""); 20371 } 20372 function isFlatArray(arr) { 20373 return utils$12.isArray(arr) && !arr.some(isVisitable); 20374 } 20375 const predicates = utils$12.toFlatObject(utils$12, {}, null, function filter(prop) { 20376 return /^is[A-Z]/.test(prop); 20377 }); 20378 function toFormData(obj, formData, options) { 20379 if (!utils$12.isObject(obj)) { 20380 throw new TypeError("target must be an object"); 20381 } 20382 formData = formData || new FormData(); 20383 options = utils$12.toFlatObject(options, { 20384 metaTokens: true, 20385 dots: false, 20386 indexes: false 20387 }, false, function defined(option, source) { 20388 return !utils$12.isUndefined(source[option]); 20389 }); 20390 const metaTokens = options.metaTokens; 20391 const visitor = options.visitor || defaultVisitor; 20392 const dots = options.dots; 20393 const indexes = options.indexes; 20394 const _Blob = options.Blob || typeof Blob !== "undefined" && Blob; 20395 const useBlob = _Blob && utils$12.isSpecCompliantForm(formData); 20396 if (!utils$12.isFunction(visitor)) { 20397 throw new TypeError("visitor must be a function"); 20398 } 20399 function convertValue(value) { 20400 if (value === null) return ""; 20401 if (utils$12.isDate(value)) { 20402 return value.toISOString(); 20403 } 20404 if (!useBlob && utils$12.isBlob(value)) { 20405 throw new AxiosError("Blob is not supported. Use a Buffer instead."); 20406 } 20407 if (utils$12.isArrayBuffer(value) || utils$12.isTypedArray(value)) { 20408 return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value); 20409 } 20410 return value; 20411 } 20412 function defaultVisitor(value, key2, path) { 20413 let arr = value; 20414 if (value && !path && typeof value === "object") { 20415 if (utils$12.endsWith(key2, "{}")) { 20416 key2 = metaTokens ? key2 : key2.slice(0, -2); 20417 value = JSON.stringify(value); 20418 } else if (utils$12.isArray(value) && isFlatArray(value) || (utils$12.isFileList(value) || utils$12.endsWith(key2, "[]")) && (arr = utils$12.toArray(value))) { 20419 key2 = removeBrackets(key2); 20420 arr.forEach(function each(el, index3) { 20421 !(utils$12.isUndefined(el) || el === null) && formData.append( 20422 // eslint-disable-next-line no-nested-ternary 20423 indexes === true ? renderKey([key2], index3, dots) : indexes === null ? key2 : key2 + "[]", 20424 convertValue(el) 20425 ); 20426 }); 20427 return false; 20428 } 20429 } 20430 if (isVisitable(value)) { 20431 return true; 20432 } 20433 formData.append(renderKey(path, key2, dots), convertValue(value)); 20434 return false; 20435 } 20436 const stack = []; 20437 const exposedHelpers = Object.assign(predicates, { 20438 defaultVisitor, 20439 convertValue, 20440 isVisitable 20441 }); 20442 function build(value, path) { 20443 if (utils$12.isUndefined(value)) return; 20444 if (stack.indexOf(value) !== -1) { 20445 throw Error("Circular reference detected in " + path.join(".")); 20446 } 20447 stack.push(value); 20448 utils$12.forEach(value, function each(el, key2) { 20449 const result = !(utils$12.isUndefined(el) || el === null) && visitor.call( 20450 formData, 20451 el, 20452 utils$12.isString(key2) ? key2.trim() : key2, 20453 path, 20454 exposedHelpers 20455 ); 20456 if (result === true) { 20457 build(el, path ? path.concat(key2) : [key2]); 20458 } 20459 }); 20460 stack.pop(); 20461 } 20462 if (!utils$12.isObject(obj)) { 20463 throw new TypeError("data must be an object"); 20464 } 20465 build(obj); 20466 return formData; 20467 } 20468 function encode$1(str) { 20469 const charMap = { 20470 "!": "%21", 20471 "'": "%27", 20472 "(": "%28", 20473 ")": "%29", 20474 "~": "%7E", 20475 "%20": "+", 20476 "%00": "\0" 20477 }; 20478 return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { 20479 return charMap[match]; 20480 }); 20481 } 20482 function AxiosURLSearchParams(params, options) { 20483 this._pairs = []; 20484 params && toFormData(params, this, options); 20485 } 20486 const prototype = AxiosURLSearchParams.prototype; 20487 prototype.append = function append(name, value) { 20488 this._pairs.push([name, value]); 20489 }; 20490 prototype.toString = function toString2(encoder) { 20491 const _encode = encoder ? function(value) { 20492 return encoder.call(this, value, encode$1); 20493 } : encode$1; 20494 return this._pairs.map(function each(pair) { 20495 return _encode(pair[0]) + "=" + _encode(pair[1]); 20496 }, "").join("&"); 20497 }; 20498 function encode3(val) { 20499 return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); 20500 } 20501 function buildURL(url, params, options) { 20502 if (!params) { 20503 return url; 20504 } 20505 const _encode = options && options.encode || encode3; 20506 const serializeFn = options && options.serialize; 20507 let serializedParams; 20508 if (serializeFn) { 20509 serializedParams = serializeFn(params, options); 20510 } else { 20511 serializedParams = utils$12.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode); 20512 } 20513 if (serializedParams) { 20514 const hashmarkIndex = url.indexOf("#"); 20515 if (hashmarkIndex !== -1) { 20516 url = url.slice(0, hashmarkIndex); 20517 } 20518 url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams; 20519 } 20520 return url; 20521 } 20522 class InterceptorManager { 20523 constructor() { 20524 this.handlers = []; 20525 } 20526 /** 20527 * Add a new interceptor to the stack 20528 * 20529 * @param {Function} fulfilled The function to handle `then` for a `Promise` 20530 * @param {Function} rejected The function to handle `reject` for a `Promise` 20531 * 20532 * @return {Number} An ID used to remove interceptor later 20533 */ 20534 use(fulfilled, rejected, options) { 20535 this.handlers.push({ 20536 fulfilled, 20537 rejected, 20538 synchronous: options ? options.synchronous : false, 20539 runWhen: options ? options.runWhen : null 20540 }); 20541 return this.handlers.length - 1; 20542 } 20543 /** 20544 * Remove an interceptor from the stack 20545 * 20546 * @param {Number} id The ID that was returned by `use` 20547 * 20548 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise 20549 */ 20550 eject(id2) { 20551 if (this.handlers[id2]) { 20552 this.handlers[id2] = null; 20553 } 20554 } 20555 /** 20556 * Clear all interceptors from the stack 20557 * 20558 * @returns {void} 20559 */ 20560 clear() { 20561 if (this.handlers) { 20562 this.handlers = []; 20563 } 20564 } 20565 /** 20566 * Iterate over all the registered interceptors 20567 * 20568 * This method is particularly useful for skipping over any 20569 * interceptors that may have become `null` calling `eject`. 20570 * 20571 * @param {Function} fn The function to call for each interceptor 20572 * 20573 * @returns {void} 20574 */
20575 forEach(fn) { 20576 utils$12.forEach(this.handlers, function forEachHandler(h2) { 20577 if (h2 !== null) { 20578 fn(h2); 20579 } 20580 }); 20581 } 20582 } 20583 var InterceptorManager$1 = InterceptorManager; 20584 var transitionalDefaults = { 20585 silentJSONParsing: true, 20586 forcedJSONParsing: true, 20587 clarifyTimeoutError: false 20588 }; 20589 var URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams; 20590 var FormData$1 = typeof FormData !== "undefined" ? FormData : null; 20591 var Blob$1 = typeof Blob !== "undefined" ? Blob : null; 20592 var platform$1 = { 20593 isBrowser: true, 20594 classes: { 20595 URLSearchParams: URLSearchParams$1, 20596 FormData: FormData$1, 20597 Blob: Blob$1 20598 }, 20599 protocols: ["http", "https", "file", "blob", "url", "data"] 20600 }; 20601 const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined"; 20602 const _navigator = typeof navigator === "object" && navigator || void 0; 20603 const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0); 20604 const hasStandardBrowserWebWorkerEnv = (() => { 20605 return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef 20606 self instanceof WorkerGlobalScope && typeof self.importScripts === "function"; 20607 })(); 20608 const origin = hasBrowserEnv && window.location.href || "http://localhost"; 20609 var utils2 = /* @__PURE__ */ Object.freeze({ 20610 __proto__: null, 20611 hasBrowserEnv, 20612 hasStandardBrowserWebWorkerEnv, 20613 hasStandardBrowserEnv, 20614 navigator: _navigator, 20615 origin 20616 }); 20617 var platform = { 20618 ...utils2, 20619 ...platform$1 20620 }; 20621 function toURLEncodedForm(data, options) { 20622 return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ 20623 visitor: function(value, key2, path, helpers) { 20624 if (platform.isNode && utils$12.isBuffer(value)) { 20625 this.append(key2, value.toString("base64")); 20626 return false; 20627 } 20628 return helpers.defaultVisitor.apply(this, arguments); 20629 } 20630 }, options)); 20631 } 20632 function parsePropPath(name) { 20633 return utils$12.matchAll(/\w+|\[(\w*)]/g, name).map((match) => { 20634 return match[0] === "[]" ? "" : match[1] || match[0]; 20635 }); 20636 } 20637 function arrayToObject3(arr) { 20638 const obj = {}; 20639 const keys = Object.keys(arr); 20640 let i2; 20641 const len2 = keys.length; 20642 let key2; 20643 for (i2 = 0; i2 < len2; i2++) { 20644 key2 = keys[i2]; 20645 obj[key2] = arr[key2]; 20646 } 20647 return obj; 20648 } 20649 function formDataToJSON(formData) { 20650 function buildPath(path, value, target, index3) { 20651 let name = path[index3++]; 20652 if (name === "__proto__") return true; 20653 const isNumericKey = Number.isFinite(+name); 20654 const isLast = index3 >= path.length; 20655 name = !name && utils$12.isArray(target) ? target.length : name; 20656 if (isLast) { 20657 if (utils$12.hasOwnProp(target, name)) { 20658 target[name] = [target[name], value]; 20659 } else { 20660 target[name] = value; 20661 } 20662 return !isNumericKey; 20663 } 20664 if (!target[name] || !utils$12.isObject(target[name])) { 20665 target[name] = []; 20666 } 20667 const result = buildPath(path, value, target[name], index3); 20668 if (result && utils$12.isArray(target[name])) { 20669 target[name] = arrayToObject3(target[name]); 20670 } 20671 return !isNumericKey; 20672 } 20673 if (utils$12.isFormData(formData) && utils$12.isFunction(formData.entries)) { 20674 const obj = {}; 20675 utils$12.forEachEntry(formData, (name, value) => { 20676 buildPath(parsePropPath(name), value, obj, 0); 20677 }); 20678 return obj; 20679 } 20680 return null; 20681 } 20682 function stringifySafely(rawValue, parser, encoder) { 20683 if (utils$12.isString(rawValue)) { 20684 try { 20685 (parser || JSON.parse)(rawValue); 20686 return utils$12.trim(rawValue); 20687 } catch (e2) { 20688 if (e2.name !== "SyntaxError") { 20689 throw e2; 20690 } 20691 } 20692 } 20693 return (0, JSON.stringify)(rawValue); 20694 } 20695 const defaults3 = { 20696 transitional: transitionalDefaults, 20697 adapter: ["xhr", "http", "fetch"], 20698 transformRequest: [function transformRequest(data, headers) { 20699 const contentType = headers.getContentType() || ""; 20700 const hasJSONContentType = contentType.indexOf("application/json") > -1; 20701 const isObjectPayload = utils$12.isObject(data);
vendor: 14,369 bytes, lines 20702-21134
20702 if (isObjectPayload && utils$12.isHTMLForm(data)) { 20703 data = new FormData(data); 20704 } 20705 const isFormData2 = utils$12.isFormData(data); 20706 if (isFormData2) { 20707 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; 20708 } 20709 if (utils$12.isArrayBuffer(data) || utils$12.isBuffer(data) || utils$12.isStream(data) || utils$12.isFile(data) || utils$12.isBlob(data) || utils$12.isReadableStream(data)) { 20710 return data; 20711 } 20712 if (utils$12.isArrayBufferView(data)) { 20713 return data.buffer; 20714 } 20715 if (utils$12.isURLSearchParams(data)) { 20716 headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false); 20717 return data.toString(); 20718 } 20719 let isFileList2; 20720 if (isObjectPayload) { 20721 if (contentType.indexOf("application/x-www-form-urlencoded") > -1) { 20722 return toURLEncodedForm(data, this.formSerializer).toString(); 20723 } 20724 if ((isFileList2 = utils$12.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) { 20725 const _FormData = this.env && this.env.FormData; 20726 return toFormData( 20727 isFileList2 ? { "files[]": data } : data, 20728 _FormData && new _FormData(), 20729 this.formSerializer 20730 ); 20731 } 20732 } 20733 if (isObjectPayload || hasJSONContentType) { 20734 headers.setContentType("application/json", false); 20735 return stringifySafely(data); 20736 } 20737 return data; 20738 }], 20739 transformResponse: [function transformResponse(data) { 20740 const transitional = this.transitional || defaults3.transitional; 20741 const forcedJSONParsing = transitional && transitional.forcedJSONParsing; 20742 const JSONRequested = this.responseType === "json"; 20743 if (utils$12.isResponse(data) || utils$12.isReadableStream(data)) { 20744 return data; 20745 } 20746 if (data && utils$12.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) { 20747 const silentJSONParsing = transitional && transitional.silentJSONParsing; 20748 const strictJSONParsing = !silentJSONParsing && JSONRequested; 20749 try { 20750 return JSON.parse(data); 20751 } catch (e2) { 20752 if (strictJSONParsing) { 20753 if (e2.name === "SyntaxError") { 20754 throw AxiosError.from(e2, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); 20755 } 20756 throw e2; 20757 } 20758 } 20759 } 20760 return data; 20761 }], 20762 /** 20763 * A timeout in milliseconds to abort a request. If set to 0 (default) a 20764 * timeout is not created. 20765 */ 20766 timeout: 0, 20767 xsrfCookieName: "XSRF-TOKEN", 20768 xsrfHeaderName: "X-XSRF-TOKEN", 20769 maxContentLength: -1, 20770 maxBodyLength: -1, 20771 env: { 20772 FormData: platform.classes.FormData, 20773 Blob: platform.classes.Blob 20774 }, 20775 validateStatus: function validateStatus(status) { 20776 return status >= 200 && status < 300; 20777 }, 20778 headers: { 20779 common: { 20780 "Accept": "application/json, text/plain, */*", 20781 "Content-Type": void 0 20782 } 20783 } 20784 }; 20785 utils$12.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => { 20786 defaults3.headers[method] = {}; 20787 }); 20788 var defaults$12 = defaults3; 20789 const ignoreDuplicateOf = utils$12.toObjectSet([ 20790 "age", 20791 "authorization", 20792 "content-length", 20793 "content-type", 20794 "etag", 20795 "expires", 20796 "from", 20797 "host", 20798 "if-modified-since", 20799 "if-unmodified-since", 20800 "last-modified", 20801 "location", 20802 "max-forwards", 20803 "proxy-authorization", 20804 "referer", 20805 "retry-after", 20806 "user-agent" 20807 ]); 20808 var parseHeaders = (rawHeaders) => { 20809 const parsed = {}; 20810 let key2; 20811 let val; 20812 let i2; 20813 rawHeaders && rawHeaders.split("\n").forEach(function parser(line) { 20814 i2 = line.indexOf(":"); 20815 key2 = line.substring(0, i2).trim().toLowerCase(); 20816 val = line.substring(i2 + 1).trim(); 20817 if (!key2 || parsed[key2] && ignoreDuplicateOf[key2]) { 20818 return; 20819 } 20820 if (key2 === "set-cookie") { 20821 if (parsed[key2]) { 20822 parsed[key2].push(val); 20823 } else { 20824 parsed[key2] = [val]; 20825 } 20826 } else { 20827 parsed[key2] = parsed[key2] ? parsed[key2] + ", " + val : val; 20828 } 20829 }); 20830 return parsed; 20831 }; 20832 const $internals = Symbol("internals"); 20833 function normalizeHeader(header2) { 20834 return header2 && String(header2).trim().toLowerCase(); 20835 } 20836 function normalizeValue(value) { 20837 if (value === false || value == null) { 20838 return value; 20839 } 20840 return utils$12.isArray(value) ? value.map(normalizeValue) : String(value); 20841 } 20842 function parseTokens(str) { 20843 const tokens = /* @__PURE__ */ Object.create(null); 20844 const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; 20845 let match; 20846 while (match = tokensRE.exec(str)) { 20847 tokens[match[1]] = match[2]; 20848 } 20849 return tokens; 20850 } 20851 const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); 20852 function matchHeaderValue(context3, value, header2, filter, isHeaderNameFilter) { 20853 if (utils$12.isFunction(filter)) { 20854 return filter.call(this, value, header2); 20855 } 20856 if (isHeaderNameFilter) { 20857 value = header2; 20858 } 20859 if (!utils$12.isString(value)) return; 20860 if (utils$12.isString(filter)) { 20861 return value.indexOf(filter) !== -1; 20862 } 20863 if (utils$12.isRegExp(filter)) { 20864 return filter.test(value); 20865 } 20866 } 20867 function formatHeader(header2) { 20868 return header2.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => { 20869 return char.toUpperCase() + str; 20870 }); 20871 } 20872 function buildAccessors(obj, header2) { 20873 const accessorName = utils$12.toCamelCase(" " + header2); 20874 ["get", "set", "has"].forEach((methodName) => { 20875 Object.defineProperty(obj, methodName + accessorName, { 20876 value: function(arg1, arg2, arg3) { 20877 return this[methodName].call(this, header2, arg1, arg2, arg3); 20878 }, 20879 configurable: true 20880 }); 20881 }); 20882 } 20883 class AxiosHeaders { 20884 constructor(headers) { 20885 headers && this.set(headers); 20886 } 20887 set(header2, valueOrRewrite, rewrite) { 20888 const self2 = this; 20889 function setHeader(_value, _header, _rewrite) { 20890 const lHeader = normalizeHeader(_header); 20891 if (!lHeader) { 20892 throw new Error("header name must be a non-empty string"); 20893 } 20894 const key2 = utils$12.findKey(self2, lHeader); 20895 if (!key2 || self2[key2] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key2] !== false) { 20896 self2[key2 || _header] = normalizeValue(_value); 20897 } 20898 } 20899 const setHeaders = (headers, _rewrite) => utils$12.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); 20900 if (utils$12.isPlainObject(header2) || header2 instanceof this.constructor) { 20901 setHeaders(header2, valueOrRewrite); 20902 } else if (utils$12.isString(header2) && (header2 = header2.trim()) && !isValidHeaderName(header2)) { 20903 setHeaders(parseHeaders(header2), valueOrRewrite); 20904 } else if (utils$12.isHeaders(header2)) { 20905 for (const [key2, value] of header2.entries()) { 20906 setHeader(value, key2, rewrite); 20907 } 20908 } else { 20909 header2 != null && setHeader(valueOrRewrite, header2, rewrite); 20910 } 20911 return this; 20912 } 20913 get(header2, parser) { 20914 header2 = normalizeHeader(header2); 20915 if (header2) { 20916 const key2 = utils$12.findKey(this, header2); 20917 if (key2) { 20918 const value = this[key2]; 20919 if (!parser) { 20920 return value; 20921 } 20922 if (parser === true) { 20923 return parseTokens(value); 20924 } 20925 if (utils$12.isFunction(parser)) { 20926 return parser.call(this, value, key2); 20927 } 20928 if (utils$12.isRegExp(parser)) { 20929 return parser.exec(value); 20930 } 20931 throw new TypeError("parser must be boolean|regexp|function"); 20932 } 20933 } 20934 } 20935 has(header2, matcher) { 20936 header2 = normalizeHeader(header2); 20937 if (header2) { 20938 const key2 = utils$12.findKey(this, header2); 20939 return !!(key2 && this[key2] !== void 0 && (!matcher || matchHeaderValue(this, this[key2], key2, matcher))); 20940 } 20941 return false; 20942 } 20943 delete(header2, matcher) { 20944 const self2 = this; 20945 let deleted = false; 20946 function deleteHeader(_header) { 20947 _header = normalizeHeader(_header); 20948 if (_header) { 20949 const key2 = utils$12.findKey(self2, _header); 20950 if (key2 && (!matcher || matchHeaderValue(self2, self2[key2], key2, matcher))) { 20951 delete self2[key2]; 20952 deleted = true; 20953 } 20954 } 20955 } 20956 if (utils$12.isArray(header2)) { 20957 header2.forEach(deleteHeader); 20958 } else { 20959 deleteHeader(header2); 20960 } 20961 return deleted; 20962 } 20963 clear(matcher) { 20964 const keys = Object.keys(this); 20965 let i2 = keys.length; 20966 let deleted = false; 20967 while (i2--) { 20968 const key2 = keys[i2]; 20969 if (!matcher || matchHeaderValue(this, this[key2], key2, matcher, true)) { 20970 delete this[key2]; 20971 deleted = true; 20972 } 20973 } 20974 return deleted; 20975 } 20976 normalize(format2) { 20977 const self2 = this; 20978 const headers = {}; 20979 utils$12.forEach(this, (value, header2) => { 20980 const key2 = utils$12.findKey(headers, header2); 20981 if (key2) { 20982 self2[key2] = normalizeValue(value); 20983 delete self2[header2]; 20984 return; 20985 } 20986 const normalized = format2 ? formatHeader(header2) : String(header2).trim(); 20987 if (normalized !== header2) { 20988 delete self2[header2]; 20989 } 20990 self2[normalized] = normalizeValue(value); 20991 headers[normalized] = true; 20992 }); 20993 return this; 20994 } 20995 concat(...targets) { 20996 return this.constructor.concat(this, ...targets); 20997 } 20998 toJSON(asStrings) { 20999 const obj = /* @__PURE__ */ Object.create(null); 21000 utils$12.forEach(this, (value, header2) => { 21001 value != null && value !== false && (obj[header2] = asStrings && utils$12.isArray(value) ? value.join(", ") : value); 21002 }); 21003 return obj; 21004 } 21005 [Symbol.iterator]() { 21006 return Object.entries(this.toJSON())[Symbol.iterator](); 21007 } 21008 toString() { 21009 return Object.entries(this.toJSON()).map(([header2, value]) => header2 + ": " + value).join("\n"); 21010 } 21011 get [Symbol.toStringTag]() { 21012 return "AxiosHeaders"; 21013 } 21014 static from(thing) { 21015 return thing instanceof this ? thing : new this(thing); 21016 } 21017 static concat(first2, ...targets) { 21018 const computed = new this(first2); 21019 targets.forEach((target) => computed.set(target)); 21020 return computed; 21021 } 21022 static accessor(header2) { 21023 const internals = this[$internals] = this[$internals] = { 21024 accessors: {} 21025 }; 21026 const accessors = internals.accessors; 21027 const prototype2 = this.prototype; 21028 function defineAccessor(_header) { 21029 const lHeader = normalizeHeader(_header); 21030 if (!accessors[lHeader]) { 21031 buildAccessors(prototype2, _header); 21032 accessors[lHeader] = true; 21033 } 21034 } 21035 utils$12.isArray(header2) ? header2.forEach(defineAccessor) : defineAccessor(header2); 21036 return this; 21037 } 21038 } 21039 AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); 21040 utils$12.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key2) => { 21041 let mapped = key2[0].toUpperCase() + key2.slice(1); 21042 return { 21043 get: () => value, 21044 set(headerValue) { 21045 this[mapped] = headerValue; 21046 } 21047 }; 21048 }); 21049 utils$12.freezeMethods(AxiosHeaders); 21050 var AxiosHeaders$1 = AxiosHeaders; 21051 function transformData(fns, response) { 21052 const config4 = this || defaults$12; 21053 const context3 = response || config4; 21054 const headers = AxiosHeaders$1.from(context3.headers); 21055 let data = context3.data; 21056 utils$12.forEach(fns, function transform(fn) { 21057 data = fn.call(config4, data, headers.normalize(), response ? response.status : void 0); 21058 }); 21059 headers.normalize(); 21060 return data; 21061 } 21062 function isCancel(value) { 21063 return !!(value && value.__CANCEL__); 21064 } 21065 function CanceledError(message, config4, request) { 21066 AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config4, request); 21067 this.name = "CanceledError"; 21068 } 21069 utils$12.inherits(CanceledError, AxiosError, { 21070 __CANCEL__: true 21071 }); 21072 function settle(resolve, reject, response) { 21073 const validateStatus = response.config.validateStatus; 21074 if (!response.status || !validateStatus || validateStatus(response.status)) { 21075 resolve(response); 21076 } else { 21077 reject(new AxiosError( 21078 "Request failed with status code " + response.status, 21079 [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], 21080 response.config, 21081 response.request, 21082 response 21083 )); 21084 } 21085 } 21086 function parseProtocol(url) { 21087 const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); 21088 return match && match[1] || ""; 21089 } 21090 function speedometer(samplesCount, min) { 21091 samplesCount = samplesCount || 10; 21092 const bytes = new Array(samplesCount); 21093 const timestamps = new Array(samplesCount); 21094 let head = 0; 21095 let tail = 0; 21096 let firstSampleTS; 21097 min = min !== void 0 ? min : 1e3; 21098 return function push2(chunkLength) { 21099 const now = Date.now(); 21100 const startedAt = timestamps[tail]; 21101 if (!firstSampleTS) { 21102 firstSampleTS = now; 21103 } 21104 bytes[head] = chunkLength; 21105 timestamps[head] = now; 21106 let i2 = tail; 21107 let bytesCount = 0; 21108 while (i2 !== head) { 21109 bytesCount += bytes[i2++]; 21110 i2 = i2 % samplesCount; 21111 } 21112 head = (head + 1) % samplesCount; 21113 if (head === tail) { 21114 tail = (tail + 1) % samplesCount; 21115 } 21116 if (now - firstSampleTS < min) { 21117 return; 21118 } 21119 const passed = startedAt && now - startedAt; 21120 return passed ? Math.round(bytesCount * 1e3 / passed) : void 0; 21121 }; 21122 } 21123 function throttle(fn, freq) { 21124 let timestamp = 0; 21125 let threshold = 1e3 / freq; 21126 let lastArgs; 21127 let timer; 21128 const invoke = (args, now = Date.now()) => { 21129 timestamp = now; 21130 lastArgs = null; 21131 if (timer) { 21132 clearTimeout(timer); 21133 timer = null; 21134 }
21135 fn.apply(null, args); 21136 }; 21137 const throttled = (...args) => { 21138 const now = Date.now(); 21139 const passed = now - timestamp; 21140 if (passed >= threshold) { 21141 invoke(args, now); 21142 } else { 21143 lastArgs = args; 21144 if (!timer) { 21145 timer = setTimeout(() => { 21146 timer = null; 21147 invoke(lastArgs); 21148 }, threshold - passed); 21149 } 21150 } 21151 }; 21152 const flush = () => lastArgs && invoke(lastArgs); 21153 return [throttled, flush]; 21154 } 21155 const progressEventReducer = (listener, isDownloadStream, freq = 3) => { 21156 let bytesNotified = 0; 21157 const _speedometer = speedometer(50, 250); 21158 return throttle((e2) => { 21159 const loaded = e2.loaded; 21160 const total = e2.lengthComputable ? e2.total : void 0; 21161 const progressBytes = loaded - bytesNotified; 21162 const rate = _speedometer(progressBytes); 21163 const inRange = loaded <= total; 21164 bytesNotified = loaded; 21165 const data = { 21166 loaded, 21167 total, 21168 progress: total ? loaded / total : void 0, 21169 bytes: progressBytes, 21170 rate: rate ? rate : void 0, 21171 estimated: rate && total && inRange ? (total - loaded) / rate : void 0, 21172 event: e2, 21173 lengthComputable: total != null, 21174 [isDownloadStream ? "download" : "upload"]: true 21175 }; 21176 listener(data); 21177 }, freq); 21178 }; 21179 const progressEventDecorator = (total, throttled) => { 21180 const lengthComputable = total != null; 21181 return [(loaded) => throttled[0]({ 21182 lengthComputable, 21183 total, 21184 loaded 21185 }), throttled[1]]; 21186 }; 21187 const asyncDecorator = (fn) => (...args) => utils$12.asap(() => fn(...args)); 21188 var isURLSameOrigin = platform.hasStandardBrowserEnv ? ( 21189 // Standard browser envs have full support of the APIs needed to test 21190 // whether the request URL is of the same origin as current location. 21191 function standardBrowserEnv() { 21192 const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent); 21193 const urlParsingNode = document.createElement("a"); 21194 let originURL; 21195 function resolveURL(url) { 21196 let href = url; 21197 if (msie) { 21198 urlParsingNode.setAttribute("href", href); 21199 href = urlParsingNode.href; 21200 } 21201 urlParsingNode.setAttribute("href", href); 21202 return { 21203 href: urlParsingNode.href, 21204 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", 21205 host: urlParsingNode.host, 21206 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", 21207 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", 21208 hostname: urlParsingNode.hostname, 21209 port: urlParsingNode.port, 21210 pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname 21211 }; 21212 } 21213 originURL = resolveURL(window.location.href); 21214 return function isURLSameOrigin2(requestURL) { 21215 const parsed = utils$12.isString(requestURL) ? resolveURL(requestURL) : requestURL; 21216 return parsed.protocol === originURL.protocol && parsed.host === originURL.host; 21217 }; 21218 }() 21219 ) : ( 21220 // Non standard browser envs (web workers, react-native) lack needed support. 21221 /* @__PURE__ */ function nonStandardBrowserEnv() { 21222 return function isURLSameOrigin2() { 21223 return true; 21224 }; 21225 }() 21226 ); 21227 var cookies = platform.hasStandardBrowserEnv ? ( 21228 // Standard browser envs support document.cookie 21229 { 21230 write(name, value, expires, path, domain, secure) { 21231 const cookie = [name + "=" + encodeURIComponent(value)]; 21232 utils$12.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()); 21233 utils$12.isString(path) && cookie.push("path=" + path); 21234 utils$12.isString(domain) && cookie.push("domain=" + domain); 21235 secure === true && cookie.push("secure"); 21236 document.cookie = cookie.join("; "); 21237 }, 21238 read(name) { 21239 const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); 21240 return match ? decodeURIComponent(match[3]) : null; 21241 }, 21242 remove(name) { 21243 this.write(name, "", Date.now() - 864e5); 21244 } 21245 } 21246 ) : ( 21247 // Non-standard browser env (web workers, react-native) lack needed support. 21248 { 21249 write() { 21250 }, 21251 read() { 21252 return null; 21253 }, 21254 remove() { 21255 } 21256 } 21257 ); 21258 function isAbsoluteURL(url) { 21259 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); 21260 } 21261 function combineURLs(baseURL, relativeURL) { 21262 return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; 21263 } 21264 function buildFullPath(baseURL, requestedURL) { 21265 if (baseURL && !isAbsoluteURL(requestedURL)) { 21266 return combineURLs(baseURL, requestedURL); 21267 } 21268 return requestedURL; 21269 } 21270 const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; 21271 function mergeConfig(config1, config22) { 21272 config22 = config22 || {}; 21273 const config4 = {}; 21274 function getMergedValue(target, source, caseless) { 21275 if (utils$12.isPlainObject(target) && utils$12.isPlainObject(source)) { 21276 return utils$12.merge.call({ caseless }, target, source); 21277 } else if (utils$12.isPlainObject(source)) { 21278 return utils$12.merge({}, source); 21279 } else if (utils$12.isArray(source)) { 21280 return source.slice(); 21281 } 21282 return source; 21283 } 21284 function mergeDeepProperties(a2, b2, caseless) { 21285 if (!utils$12.isUndefined(b2)) { 21286 return getMergedValue(a2, b2, caseless); 21287 } else if (!utils$12.isUndefined(a2)) { 21288 return getMergedValue(void 0, a2, caseless); 21289 } 21290 } 21291 function valueFromConfig2(a2, b2) { 21292 if (!utils$12.isUndefined(b2)) { 21293 return getMergedValue(void 0, b2); 21294 } 21295 } 21296 function defaultToConfig2(a2, b2) { 21297 if (!utils$12.isUndefined(b2)) { 21298 return getMergedValue(void 0, b2); 21299 } else if (!utils$12.isUndefined(a2)) { 21300 return getMergedValue(void 0, a2); 21301 } 21302 } 21303 function mergeDirectKeys(a2, b2, prop) { 21304 if (prop in config22) { 21305 return getMergedValue(a2, b2); 21306 } else if (prop in config1) { 21307 return getMergedValue(void 0, a2); 21308 } 21309 } 21310 const mergeMap = { 21311 url: valueFromConfig2, 21312 method: valueFromConfig2, 21313 data: valueFromConfig2, 21314 baseURL: defaultToConfig2, 21315 transformRequest: defaultToConfig2, 21316 transformResponse: defaultToConfig2, 21317 paramsSerializer: defaultToConfig2, 21318 timeout: defaultToConfig2, 21319 timeoutMessage: defaultToConfig2, 21320 withCredentials: defaultToConfig2, 21321 withXSRFToken: defaultToConfig2, 21322 adapter: defaultToConfig2, 21323 responseType: defaultToConfig2, 21324 xsrfCookieName: defaultToConfig2, 21325 xsrfHeaderName: defaultToConfig2, 21326 onUploadProgress: defaultToConfig2, 21327 onDownloadProgress: defaultToConfig2, 21328 decompress: defaultToConfig2, 21329 maxContentLength: defaultToConfig2,
21330 maxBodyLength: defaultToConfig2, 21331 beforeRedirect: defaultToConfig2, 21332 transport: defaultToConfig2, 21333 httpAgent: defaultToConfig2, 21334 httpsAgent: defaultToConfig2, 21335 cancelToken: defaultToConfig2, 21336 socketPath: defaultToConfig2, 21337 responseEncoding: defaultToConfig2, 21338 validateStatus: mergeDirectKeys, 21339 headers: (a2, b2) => mergeDeepProperties(headersToObject(a2), headersToObject(b2), true) 21340 }; 21341 utils$12.forEach(Object.keys(Object.assign({}, config1, config22)), function computeConfigValue(prop) { 21342 const merge4 = mergeMap[prop] || mergeDeepProperties; 21343 const configValue = merge4(config1[prop], config22[prop], prop); 21344 utils$12.isUndefined(configValue) && merge4 !== mergeDirectKeys || (config4[prop] = configValue); 21345 }); 21346 return config4; 21347 } 21348 var resolveConfig = (config4) => { 21349 const newConfig = mergeConfig({}, config4); 21350 let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; 21351 newConfig.headers = headers = AxiosHeaders$1.from(headers); 21352 newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config4.params, config4.paramsSerializer); 21353 if (auth) { 21354 headers.set( 21355 "Authorization", 21356 "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")) 21357 ); 21358 } 21359 let contentType; 21360 if (utils$12.isFormData(data)) { 21361 if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { 21362 headers.setContentType(void 0); 21363 } else if ((contentType = headers.getContentType()) !== false) { 21364 const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : []; 21365 headers.setContentType([type || "multipart/form-data", ...tokens].join("; ")); 21366 } 21367 } 21368 if (platform.hasStandardBrowserEnv) { 21369 withXSRFToken && utils$12.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); 21370 if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) { 21371 const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); 21372 if (xsrfValue) { 21373 headers.set(xsrfHeaderName, xsrfValue); 21374 } 21375 } 21376 } 21377 return newConfig; 21378 }; 21379 const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined"; 21380 var xhrAdapter = isXHRAdapterSupported && function(config4) { 21381 return new Promise(function dispatchXhrRequest(resolve, reject) { 21382 const _config2 = resolveConfig(config4); 21383 let requestData = _config2.data; 21384 const requestHeaders = AxiosHeaders$1.from(_config2.headers).normalize(); 21385 let { responseType, onUploadProgress, onDownloadProgress } = _config2; 21386 let onCanceled; 21387 let uploadThrottled, downloadThrottled; 21388 let flushUpload, flushDownload; 21389 function done() { 21390 flushUpload && flushUpload(); 21391 flushDownload && flushDownload(); 21392 _config2.cancelToken && _config2.cancelToken.unsubscribe(onCanceled); 21393 _config2.signal && _config2.signal.removeEventListener("abort", onCanceled); 21394 } 21395 let request = new XMLHttpRequest(); 21396 request.open(_config2.method.toUpperCase(), _config2.url, true); 21397 request.timeout = _config2.timeout; 21398 function onloadend() { 21399 if (!request) { 21400 return; 21401 } 21402 const responseHeaders = AxiosHeaders$1.from( 21403 "getAllResponseHeaders" in request && request.getAllResponseHeaders() 21404 ); 21405 const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response; 21406 const response = { 21407 data: responseData, 21408 status: request.status, 21409 statusText: request.statusText, 21410 headers: responseHeaders, 21411 config: config4, 21412 request 21413 }; 21414 settle(function _resolve(value) { 21415 resolve(value); 21416 done(); 21417 }, function _reject(err) { 21418 reject(err); 21419 done(); 21420 }, response); 21421 request = null; 21422 } 21423 if ("onloadend" in request) { 21424 request.onloadend = onloadend; 21425 } else { 21426 request.onreadystatechange = function handleLoad() { 21427 if (!request || request.readyState !== 4) { 21428 return; 21429 } 21430 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) { 21431 return; 21432 } 21433 setTimeout(onloadend); 21434 }; 21435 } 21436 request.onabort = function handleAbort() { 21437 if (!request) { 21438 return; 21439 } 21440 reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config4, request)); 21441 request = null; 21442 }; 21443 request.onerror = function handleError() { 21444 reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config4, request)); 21445 request = null; 21446 }; 21447 request.ontimeout = function handleTimeout() { 21448 let timeoutErrorMessage = _config2.timeout ? "timeout of " + _config2.timeout + "ms exceeded" : "timeout exceeded"; 21449 const transitional = _config2.transitional || transitionalDefaults; 21450 if (_config2.timeoutErrorMessage) { 21451 timeoutErrorMessage = _config2.timeoutErrorMessage; 21452 } 21453 reject(new AxiosError( 21454 timeoutErrorMessage, 21455 transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, 21456 config4, 21457 request 21458 )); 21459 request = null; 21460 }; 21461 requestData === void 0 && requestHeaders.setContentType(null); 21462 if ("setRequestHeader" in request) { 21463 utils$12.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key2) { 21464 request.setRequestHeader(key2, val); 21465 }); 21466 } 21467 if (!utils$12.isUndefined(_config2.withCredentials)) { 21468 request.withCredentials = !!_config2.withCredentials; 21469 } 21470 if (responseType && responseType !== "json") { 21471 request.responseType = _config2.responseType; 21472 } 21473 if (onDownloadProgress) { 21474 [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true); 21475 request.addEventListener("progress", downloadThrottled); 21476 } 21477 if (onUploadProgress && request.upload) { 21478 [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress); 21479 request.upload.addEventListener("progress", uploadThrottled); 21480 request.upload.addEventListener("loadend", flushUpload); 21481 } 21482 if (_config2.cancelToken || _config2.signal) { 21483 onCanceled = (cancel) => { 21484 if (!request) { 21485 return; 21486 } 21487 reject(!cancel || cancel.type ? new CanceledError(null, config4, request) : cancel); 21488 request.abort(); 21489 request = null; 21490 }; 21491 _config2.cancelToken && _config2.cancelToken.subscribe(onCanceled); 21492 if (_config2.signal) { 21493 _config2.signal.aborted ? onCanceled() : _config2.signal.addEventListener("abort", onCanceled); 21494 } 21495 } 21496 const protocol = parseProtocol(_config2.url); 21497 if (protocol && platform.protocols.indexOf(protocol) === -1) { 21498 reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config4)); 21499 return; 21500 } 21501 request.send(requestData || null); 21502 }); 21503 }; 21504 const composeSignals = (signals, timeout) => { 21505 const { length }
vendor: 3,365 bytes, lines 21505-21615
21505 = signals = signals ? signals.filter(Boolean) : []; 21506 if (timeout || length) { 21507 let controller = new AbortController(); 21508 let aborted; 21509 const onabort = function(reason) { 21510 if (!aborted) { 21511 aborted = true; 21512 unsubscribe(); 21513 const err = reason instanceof Error ? reason : this.reason; 21514 controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); 21515 } 21516 }; 21517 let timer = timeout && setTimeout(() => { 21518 timer = null; 21519 onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); 21520 }, timeout); 21521 const unsubscribe = () => { 21522 if (signals) { 21523 timer && clearTimeout(timer); 21524 timer = null; 21525 signals.forEach((signal2) => { 21526 signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort); 21527 }); 21528 signals = null; 21529 } 21530 }; 21531 signals.forEach((signal2) => signal2.addEventListener("abort", onabort)); 21532 const { signal } = controller; 21533 signal.unsubscribe = () => utils$12.asap(unsubscribe); 21534 return signal; 21535 } 21536 }; 21537 var composeSignals$1 = composeSignals; 21538 const streamChunk = function* (chunk2, chunkSize) { 21539 let len2 = chunk2.byteLength; 21540 if (len2 < chunkSize) { 21541 yield chunk2; 21542 return; 21543 } 21544 let pos = 0; 21545 let end; 21546 while (pos < len2) { 21547 end = pos + chunkSize; 21548 yield chunk2.slice(pos, end); 21549 pos = end; 21550 } 21551 }; 21552 const readBytes = async function* (iterable, chunkSize) { 21553 for await (const chunk2 of readStream(iterable)) { 21554 yield* streamChunk(chunk2, chunkSize); 21555 } 21556 }; 21557 const readStream = async function* (stream) { 21558 if (stream[Symbol.asyncIterator]) { 21559 yield* stream; 21560 return; 21561 } 21562 const reader = stream.getReader(); 21563 try { 21564 for (; ; ) { 21565 const { done, value } = await reader.read(); 21566 if (done) { 21567 break; 21568 } 21569 yield value; 21570 } 21571 } finally { 21572 await reader.cancel(); 21573 } 21574 }; 21575 const trackStream = (stream, chunkSize, onProgress, onFinish) => { 21576 const iterator = readBytes(stream, chunkSize); 21577 let bytes = 0; 21578 let done; 21579 let _onFinish = (e2) => { 21580 if (!done) { 21581 done = true; 21582 onFinish && onFinish(e2); 21583 } 21584 }; 21585 return new ReadableStream({ 21586 async pull(controller) { 21587 try { 21588 const { done: done2, value } = await iterator.next(); 21589 if (done2) { 21590 _onFinish(); 21591 controller.close(); 21592 return; 21593 } 21594 let len2 = value.byteLength; 21595 if (onProgress) { 21596 let loadedBytes = bytes += len2; 21597 onProgress(loadedBytes); 21598 } 21599 controller.enqueue(new Uint8Array(value)); 21600 } catch (err) { 21601 _onFinish(err); 21602 throw err; 21603 } 21604 }, 21605 cancel(reason) { 21606 _onFinish(reason); 21607 return iterator.return(); 21608 } 21609 }, { 21610 highWaterMark: 2 21611 }); 21612 }; 21613 const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function"; 21614 const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function"; 21615 const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__P
21615URE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer())); 21616 const test = (fn, ...args) => { 21617 try { 21618 return !!fn(...args); 21619 } catch (e2) { 21620 return false; 21621 } 21622 }; 21623 const supportsRequestStream = isReadableStreamSupported && test(() => { 21624 let duplexAccessed = false; 21625 const hasContentType = new Request(platform.origin, { 21626 body: new ReadableStream(), 21627 method: "POST", 21628 get duplex() { 21629 duplexAccessed = true; 21630 return "half"; 21631 } 21632 }).headers.has("Content-Type"); 21633 return duplexAccessed && !hasContentType; 21634 }); 21635 const DEFAULT_CHUNK_SIZE = 64 * 1024; 21636 const supportsResponseStream = isReadableStreamSupported && test(() => utils$12.isReadableStream(new Response("").body)); 21637 const resolvers = { 21638 stream: supportsResponseStream && ((res) => res.body) 21639 }; 21640 isFetchSupported && ((res) => { 21641 ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => { 21642 !resolvers[type] && (resolvers[type] = utils$12.isFunction(res[type]) ? (res2) => res2[type]() : (_2, config4) => { 21643 throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config4); 21644 }); 21645 }); 21646 })(new Response()); 21647 const getBodyLength = async (body) => { 21648 if (body == null) { 21649 return 0; 21650 } 21651 if (utils$12.isBlob(body)) { 21652 return body.size; 21653 } 21654 if (utils$12.isSpecCompliantForm(body)) { 21655 const _request = new Request(platform.origin, { 21656 method: "POST", 21657 body 21658 }); 21659 return (await _request.arrayBuffer()).byteLength; 21660 } 21661 if (utils$12.isArrayBufferView(body) || utils$12.isArrayBuffer(body)) { 21662 return body.byteLength; 21663 } 21664 if (utils$12.isURLSearchParams(body)) { 21665 body = body + ""; 21666 } 21667 if (utils$12.isString(body)) { 21668 return (await encodeText(body)).byteLength; 21669 } 21670 }; 21671 const resolveBodyLength = async (headers, body) => { 21672 const length = utils$12.toFiniteNumber(headers.getContentLength()); 21673 return length == null ? getBodyLength(body) : length; 21674 }; 21675 var fetchAdapter = isFetchSupported && (async (config4) => { 21676 let { 21677 url, 21678 method, 21679 data, 21680 signal, 21681 cancelToken, 21682 timeout, 21683 onDownloadProgress, 21684 onUploadProgress, 21685 responseType, 21686 headers, 21687 withCredentials = "same-origin", 21688 fetchOptions 21689 } = resolveConfig(config4); 21690 responseType = responseType ? (responseType + "").toLowerCase() : "text"; 21691 let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout); 21692 let request; 21693 const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => { 21694 composedSignal.unsubscribe(); 21695 }); 21696 let requestContentLength; 21697 try { 21698 if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) { 21699 let _request = new Request(url, { 21700 method: "POST", 21701 body: data, 21702 duplex: "half" 21703 }); 21704 let contentTypeHeader; 21705 if (utils$12.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) { 21706 headers.setContentType(contentTypeHeader); 21707 } 21708 if (_request.body) { 21709 const [onProgress, flush] = progressEventDecorator( 21710 requestContentLength, 21711 progressEventReducer(asyncDecorator(onUploadProgress)) 21712 ); 21713 data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush); 21714 } 21715 } 21716 if (!utils$12.isString(withCredentials)) { 21717 withCredentials = withCredentials ? "include" : "omit"; 21718 } 21719 const isCredentialsSupported = "credentials" in Request.prototype; 21720 request = new Request(url, { 21721 ...fetchOptions, 21722 signal: composedSignal, 21723 method: method.toUpperCase(), 21724 headers: headers.normalize().toJSON(), 21725 body: data, 21726 duplex: "half", 21727 credentials: isCredentialsSupported ? withCredentials : void 0 21728 }); 21729 let response = await fetch(request); 21730 const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response"); 21731 if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) { 21732 const options = {}; 21733 ["status", "statusText", "headers"].forEach((prop) => { 21734 options[prop] = response[prop]; 21735 }); 21736 const responseContentLength = utils$12.toFiniteNumber(response.headers.get("content-length")); 21737 const [onProgress, flush] = onDownloadProgress && progressEventDecorator( 21738 responseContentLength, 21739 progressEventReducer(asyncDecorator(onDownloadProgress), true) 21740 ) || []; 21741 response = new Response( 21742 trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { 21743 flush && flush(); 21744 unsubscribe && unsubscribe(); 21745 }), 21746 options 21747 ); 21748 } 21749 responseType = responseType || "text"; 21750 let responseData = await resolvers[utils$12.findKey(resolvers, responseType) || "text"](response, config4); 21751 !isStreamResponse && unsubscribe && unsubscribe(); 21752 return await new Promise((resolve, reject) => { 21753 settle(resolve, reject, { 21754 data: responseData, 21755 headers: AxiosHeaders$1.from(response.headers), 21756 status: response.status, 21757 statusText: response.statusText, 21758 config: config4, 21759 request 21760 }); 21761 }); 21762 } catch (err) { 21763 unsubscribe && unsubscribe(); 21764 if (err && err.name === "TypeError" && /fetch/i.test(err.message)) { 21765 throw Object.assign( 21766 new AxiosError("Network Error", AxiosError.ERR_NETWORK, config4, request), 21767 { 21768 cause: err.cause || err 21769 } 21770 ); 21771 } 21772 throw AxiosError.from(err, err && err.code, config4, request); 21773 } 21774 }); 21775 const knownAdapters = { 21776 http: httpAdapter, 21777 xhr: xhrAdapter, 21778 fetch: fetchAdapter 21779 }; 21780 utils$12.forEach(knownAdapters, (fn, value) => { 21781 if (fn) {
vendor: 9,487 bytes, lines 21782-22043
21782 try { 21783 Object.defineProperty(fn, "name", { value }); 21784 } catch (e2) { 21785 } 21786 Object.defineProperty(fn, "adapterName", { value }); 21787 } 21788 }); 21789 const renderReason = (reason) => `- ${reason}`; 21790 const isResolvedHandle = (adapter) => utils$12.isFunction(adapter) || adapter === null || adapter === false; 21791 var adapters = { 21792 getAdapter: (adapters2) => { 21793 adapters2 = utils$12.isArray(adapters2) ? adapters2 : [adapters2]; 21794 const { length } = adapters2; 21795 let nameOrAdapter; 21796 let adapter; 21797 const rejectedReasons = {}; 21798 for (let i2 = 0; i2 < length; i2++) { 21799 nameOrAdapter = adapters2[i2]; 21800 let id2; 21801 adapter = nameOrAdapter; 21802 if (!isResolvedHandle(nameOrAdapter)) { 21803 adapter = knownAdapters[(id2 = String(nameOrAdapter)).toLowerCase()]; 21804 if (adapter === void 0) { 21805 throw new AxiosError(`Unknown adapter '${id2}'`); 21806 } 21807 } 21808 if (adapter) { 21809 break; 21810 } 21811 rejectedReasons[id2 || "#" + i2] = adapter; 21812 } 21813 if (!adapter) { 21814 const reasons = Object.entries(rejectedReasons).map( 21815 ([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build") 21816 ); 21817 let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"; 21818 throw new AxiosError( 21819 `There is no suitable adapter to dispatch the request ` + s2, 21820 "ERR_NOT_SUPPORT" 21821 ); 21822 } 21823 return adapter; 21824 }, 21825 adapters: knownAdapters 21826 }; 21827 function throwIfCancellationRequested(config4) { 21828 if (config4.cancelToken) { 21829 config4.cancelToken.throwIfRequested(); 21830 } 21831 if (config4.signal && config4.signal.aborted) { 21832 throw new CanceledError(null, config4); 21833 } 21834 } 21835 function dispatchRequest(config4) { 21836 throwIfCancellationRequested(config4); 21837 config4.headers = AxiosHeaders$1.from(config4.headers); 21838 config4.data = transformData.call( 21839 config4, 21840 config4.transformRequest 21841 ); 21842 if (["post", "put", "patch"].indexOf(config4.method) !== -1) { 21843 config4.headers.setContentType("application/x-www-form-urlencoded", false); 21844 } 21845 const adapter = adapters.getAdapter(config4.adapter || defaults$12.adapter); 21846 return adapter(config4).then(function onAdapterResolution(response) { 21847 throwIfCancellationRequested(config4); 21848 response.data = transformData.call( 21849 config4, 21850 config4.transformResponse, 21851 response 21852 ); 21853 response.headers = AxiosHeaders$1.from(response.headers); 21854 return response; 21855 }, function onAdapterRejection(reason) { 21856 if (!isCancel(reason)) { 21857 throwIfCancellationRequested(config4); 21858 if (reason && reason.response) { 21859 reason.response.data = transformData.call( 21860 config4, 21861 config4.transformResponse, 21862 reason.response 21863 ); 21864 reason.response.headers = AxiosHeaders$1.from(reason.response.headers); 21865 } 21866 } 21867 return Promise.reject(reason); 21868 }); 21869 } 21870 const VERSION = "1.7.7"; 21871 const validators$1 = {}; 21872 ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => { 21873 validators$1[type] = function validator2(thing) { 21874 return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type; 21875 }; 21876 }); 21877 const deprecatedWarnings = {}; 21878 validators$1.transitional = function transitional(validator2, version2, message) { 21879 function formatMessage(opt, desc) { 21880 return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); 21881 } 21882 return (value, opt, opts) => { 21883 if (validator2 === false) { 21884 throw new AxiosError( 21885 formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")), 21886 AxiosError.ERR_DEPRECATED 21887 ); 21888 } 21889 if (version2 && !deprecatedWarnings[opt]) { 21890 deprecatedWarnings[opt] = true; 21891 console.warn( 21892 formatMessage( 21893 opt, 21894 " has been deprecated since v" + version2 + " and will be removed in the near future" 21895 ) 21896 ); 21897 } 21898 return validator2 ? validator2(value, opt, opts) : true; 21899 }; 21900 }; 21901 function assertOptions(options, schema, allowUnknown) { 21902 if (typeof options !== "object") { 21903 throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE); 21904 } 21905 const keys = Object.keys(options); 21906 let i2 = keys.length; 21907 while (i2-- > 0) { 21908 const opt = keys[i2]; 21909 const validator2 = schema[opt]; 21910 if (validator2) { 21911 const value = options[opt]; 21912 const result = value === void 0 || validator2(value, opt, options); 21913 if (result !== true) { 21914 throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE); 21915 } 21916 continue; 21917 } 21918 if (allowUnknown !== true) { 21919 throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION); 21920 } 21921 } 21922 } 21923 var validator = { 21924 assertOptions, 21925 validators: validators$1 21926 }; 21927 const validators = validator.validators; 21928 class Axios { 21929 constructor(instanceConfig) { 21930 this.defaults = instanceConfig; 21931 this.interceptors = { 21932 request: new InterceptorManager$1(), 21933 response: new InterceptorManager$1() 21934 }; 21935 } 21936 /** 21937 * Dispatch a request 21938 * 21939 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) 21940 * @param {?Object} config 21941 * 21942 * @returns {Promise} The Promise to be fulfilled 21943 */ 21944 async request(configOrUrl, config4) { 21945 try { 21946 return await this._request(configOrUrl, config4); 21947 } catch (err) { 21948 if (err instanceof Error) { 21949 let dummy; 21950 Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error(); 21951 const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : ""; 21952 try { 21953 if (!err.stack) { 21954 err.stack = stack; 21955 } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) { 21956 err.stack += "\n" + stack; 21957 } 21958 } catch (e2) { 21959 } 21960 } 21961 throw err; 21962 } 21963 } 21964 _request(configOrUrl, config4) { 21965 if (typeof configOrUrl === "string") { 21966 config4 = config4 || {}; 21967 config4.url = configOrUrl; 21968 } else { 21969 config4 = configOrUrl || {}; 21970 } 21971 config4 = mergeConfig(this.defaults, config4); 21972 const { transitional, paramsSerializer, headers } = config4; 21973 if (transitional !== void 0) { 21974 validator.assertOptions(transitional, { 21975 silentJSONParsing: validators.transitional(validators.boolean), 21976 forcedJSONParsing: validators.transitional(validators.boolean), 21977 clarifyTimeoutError: validators.transitional(validators.boolean) 21978 }, false); 21979 } 21980 if (paramsSerializer != null) { 21981 if (utils$12.isFunction(paramsSerializer)) { 21982 config4.paramsSerializer = { 21983 serialize: paramsSerializer 21984 }; 21985 } else { 21986 validator.assertOptions(paramsSerializer, { 21987 encode: validators.function, 21988 serialize: validators.function 21989 }, true); 21990 } 21991 } 21992 config4.method = (config4.method || this.defaults.method || "get").toLowerCase(); 21993 let contextHeaders = headers && utils$12.merge( 21994 headers.common, 21995 headers[config4.method] 21996 ); 21997 headers && utils$12.forEach( 21998 ["delete", "get", "head", "post", "put", "patch", "common"], 21999 (method) => { 22000 delete headers[method]; 22001 } 22002 ); 22003 config4.headers = AxiosHeaders$1.concat(contextHeaders, headers); 22004 const requestInterceptorChain = []; 22005 let synchronousRequestInterceptors = true; 22006 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 22007 if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config4) === false) { 22008 return; 22009 } 22010 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; 22011 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); 22012 }); 22013 const responseInterceptorChain = []; 22014 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 22015 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); 22016 }); 22017 let promise; 22018 let i2 = 0; 22019 let len2; 22020 if (!synchronousRequestInterceptors) { 22021 const chain = [dispatchRequest.bind(this), void 0]; 22022 chain.unshift.apply(chain, requestInterceptorChain); 22023 chain.push.apply(chain, responseInterceptorChain); 22024 len2 = chain.length; 22025 promise = Promise.resolve(config4); 22026 while (i2 < len2) { 22027 promise = promise.then(chain[i2++], chain[i2++]); 22028 } 22029 return promise; 22030 } 22031 len2 = requestInterceptorChain.length; 22032 let newConfig = config4; 22033 i2 = 0; 22034 while (i2 < len2) { 22035 const onFulfilled = requestInterceptorChain[i2++]; 22036 const onRejected = requestInterceptorChain[i2++]; 22037 try { 22038 newConfig = onFulfilled(newConfig); 22039 } catch (error2) { 22040 onRejected.call(this, error2); 22041 break; 22042 } 22043 }
vendor: 10,334 bytes, lines 22044-22390
22044 try { 22045 promise = dispatchRequest.call(this, newConfig); 22046 } catch (error2) { 22047 return Promise.reject(error2); 22048 } 22049 i2 = 0; 22050 len2 = responseInterceptorChain.length; 22051 while (i2 < len2) { 22052 promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]); 22053 } 22054 return promise; 22055 } 22056 getUri(config4) { 22057 config4 = mergeConfig(this.defaults, config4); 22058 const fullPath = buildFullPath(config4.baseURL, config4.url); 22059 return buildURL(fullPath, config4.params, config4.paramsSerializer); 22060 } 22061 } 22062 utils$12.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) { 22063 Axios.prototype[method] = function(url, config4) { 22064 return this.request(mergeConfig(config4 || {}, { 22065 method, 22066 url, 22067 data: (config4 || {}).data 22068 })); 22069 }; 22070 }); 22071 utils$12.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { 22072 function generateHTTPMethod(isForm) { 22073 return function httpMethod(url, data, config4) { 22074 return this.request(mergeConfig(config4 || {}, { 22075 method, 22076 headers: isForm ? { 22077 "Content-Type": "multipart/form-data" 22078 } : {}, 22079 url, 22080 data 22081 })); 22082 }; 22083 } 22084 Axios.prototype[method] = generateHTTPMethod(); 22085 Axios.prototype[method + "Form"] = generateHTTPMethod(true); 22086 }); 22087 var Axios$1 = Axios; 22088 class CancelToken { 22089 constructor(executor) { 22090 if (typeof executor !== "function") { 22091 throw new TypeError("executor must be a function."); 22092 } 22093 let resolvePromise; 22094 this.promise = new Promise(function promiseExecutor(resolve) { 22095 resolvePromise = resolve; 22096 }); 22097 const token = this; 22098 this.promise.then((cancel) => { 22099 if (!token._listeners) return; 22100 let i2 = token._listeners.length; 22101 while (i2-- > 0) { 22102 token._listeners[i2](cancel); 22103 } 22104 token._listeners = null; 22105 }); 22106 this.promise.then = (onfulfilled) => { 22107 let _resolve; 22108 const promise = new Promise((resolve) => { 22109 token.subscribe(resolve); 22110 _resolve = resolve; 22111 }).then(onfulfilled); 22112 promise.cancel = function reject() { 22113 token.unsubscribe(_resolve); 22114 }; 22115 return promise; 22116 }; 22117 executor(function cancel(message, config4, request) { 22118 if (token.reason) { 22119 return; 22120 } 22121 token.reason = new CanceledError(message, config4, request); 22122 resolvePromise(token.reason); 22123 }); 22124 } 22125 /** 22126 * Throws a `CanceledError` if cancellation has been requested. 22127 */ 22128 throwIfRequested() { 22129 if (this.reason) { 22130 throw this.reason; 22131 } 22132 } 22133 /** 22134 * Subscribe to the cancel signal 22135 */ 22136 subscribe(listener) { 22137 if (this.reason) { 22138 listener(this.reason); 22139 return; 22140 } 22141 if (this._listeners) { 22142 this._listeners.push(listener); 22143 } else { 22144 this._listeners = [listener]; 22145 } 22146 } 22147 /** 22148 * Unsubscribe from the cancel signal 22149 */ 22150 unsubscribe(listener) { 22151 if (!this._listeners) { 22152 return; 22153 } 22154 const index3 = this._listeners.indexOf(listener); 22155 if (index3 !== -1) { 22156 this._listeners.splice(index3, 1); 22157 } 22158 } 22159 toAbortSignal() { 22160 const controller = new AbortController(); 22161 const abort = (err) => { 22162 controller.abort(err); 22163 }; 22164 this.subscribe(abort); 22165 controller.signal.unsubscribe = () => this.unsubscribe(abort); 22166 return controller.signal; 22167 } 22168 /** 22169 * Returns an object that contains a new `CancelToken` and a function that, when called, 22170 * cancels the `CancelToken`. 22171 */ 22172 static source() { 22173 let cancel; 22174 const token = new CancelToken(function executor(c2) { 22175 cancel = c2; 22176 }); 22177 return { 22178 token, 22179 cancel 22180 }; 22181 } 22182 } 22183 var CancelToken$1 = CancelToken; 22184 function spread(callback) { 22185 return function wrap3(arr) { 22186 return callback.apply(null, arr); 22187 }; 22188 } 22189 function isAxiosError(payload) { 22190 return utils$12.isObject(payload) && payload.isAxiosError === true; 22191 } 22192 const HttpStatusCode = { 22193 Continue: 100, 22194 SwitchingProtocols: 101, 22195 Processing: 102, 22196 EarlyHints: 103, 22197 Ok: 200, 22198 Created: 201, 22199 Accepted: 202, 22200 NonAuthoritativeInformation: 203, 22201 NoContent: 204, 22202 ResetContent: 205, 22203 PartialContent: 206, 22204 MultiStatus: 207, 22205 AlreadyReported: 208, 22206 ImUsed: 226, 22207 MultipleChoices: 300, 22208 MovedPermanently: 301, 22209 Found: 302, 22210 SeeOther: 303, 22211 NotModified: 304, 22212 UseProxy: 305, 22213 Unused: 306, 22214 TemporaryRedirect: 307, 22215 PermanentRedirect: 308, 22216 BadRequest: 400, 22217 Unauthorized: 401, 22218 PaymentRequired: 402, 22219 Forbidden: 403, 22220 NotFound: 404, 22221 MethodNotAllowed: 405, 22222 NotAcceptable: 406, 22223 ProxyAuthenticationRequired: 407, 22224 RequestTimeout: 408, 22225 Conflict: 409, 22226 Gone: 410, 22227 LengthRequired: 411, 22228 PreconditionFailed: 412, 22229 PayloadTooLarge: 413, 22230 UriTooLong: 414, 22231 UnsupportedMediaType: 415, 22232 RangeNotSatisfiable: 416, 22233 ExpectationFailed: 417, 22234 ImATeapot: 418, 22235 MisdirectedRequest: 421, 22236 UnprocessableEntity: 422, 22237 Locked: 423, 22238 FailedDependency: 424, 22239 TooEarly: 425, 22240 UpgradeRequired: 426, 22241 PreconditionRequired: 428, 22242 TooManyRequests: 429, 22243 RequestHeaderFieldsTooLarge: 431, 22244 UnavailableForLegalReasons: 451, 22245 InternalServerError: 500, 22246 NotImplemented: 501, 22247 BadGateway: 502, 22248 ServiceUnavailable: 503, 22249 GatewayTimeout: 504, 22250 HttpVersionNotSupported: 505, 22251 VariantAlsoNegotiates: 506, 22252 InsufficientStorage: 507, 22253 LoopDetected: 508, 22254 NotExtended: 510, 22255 NetworkAuthenticationRequired: 511 22256 }; 22257 Object.entries(HttpStatusCode).forEach(([key2, value]) => { 22258 HttpStatusCode[value] = key2; 22259 }); 22260 var HttpStatusCode$1 = HttpStatusCode; 22261 function createInstance(defaultConfig) { 22262 const context3 = new Axios$1(defaultConfig); 22263 const instance = bind(Axios$1.prototype.request, context3); 22264 utils$12.extend(instance, Axios$1.prototype, context3, { allOwnKeys: true }); 22265 utils$12.extend(instance, context3, null, { allOwnKeys: true }); 22266 instance.create = function create(instanceConfig) { 22267 return createInstance(mergeConfig(defaultConfig, instanceConfig)); 22268 }; 22269 return instance; 22270 } 22271 const axios = createInstance(defaults$12); 22272 axios.Axios = Axios$1; 22273 axios.CanceledError = CanceledError; 22274 axios.CancelToken = CancelToken$1; 22275 axios.isCancel = isCancel; 22276 axios.VERSION = VERSION; 22277 axios.toFormData = toFormData; 22278 axios.AxiosError = AxiosError; 22279 axios.Cancel = axios.CanceledError; 22280 axios.all = function all(promises) { 22281 return Promise.all(promises); 22282 }; 22283 axios.spread = spread; 22284 axios.isAxiosError = isAxiosError; 22285 axios.mergeConfig = mergeConfig; 22286 axios.AxiosHeaders = AxiosHeaders$1; 22287 axios.formToJSON = (thing) => formDataToJSON(utils$12.isHTMLForm(thing) ? new FormData(thing) : thing); 22288 axios.getAdapter = adapters.getAdapter; 22289 axios.HttpStatusCode = HttpStatusCode$1; 22290 axios.default = axios; 22291 axios_1 = axios; 22292 return axios_1; 22293} 22294var hasRequiredApiCall; 22295function requireApiCall() { 22296 if (hasRequiredApiCall) return ApiCall; 22297 hasRequiredApiCall = 1; 22298 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 22299 function adopt(value) { 22300 return value instanceof P2 ? value : new P2(function(resolve) { 22301 resolve(value); 22302 }); 22303 } 22304 return new (P2 || (P2 = Promise))(function(resolve, reject) { 22305 function fulfilled(value) { 22306 try { 22307 step(generator.next(value)); 22308 } catch (e2) { 22309 reject(e2); 22310 } 22311 } 22312 function rejected(value) { 22313 try { 22314 step(generator["throw"](value)); 22315 } catch (e2) { 22316 reject(e2); 22317 } 22318 } 22319 function step(result) { 22320 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 22321 } 22322 step((generator = generator.apply(thisArg, _arguments || [])).next()); 22323 }); 22324 }; 22325 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 22326 var _2 = { label: 0, sent: function() { 22327 if (t2[0] & 1) throw t2[1]; 22328 return t2[1]; 22329 }, trys: [], ops: [] }, f2, y2, t2, g2; 22330 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 22331 return this; 22332 }), g2; 22333 function verb(n2) { 22334 return function(v2) { 22335 return step([n2, v2]); 22336 }; 22337 } 22338 function step(op) { 22339 if (f2) throw new TypeError("Generator is already executing."); 22340 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 22341 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 22342 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 22343 switch (op[0]) { 22344 case 0: 22345 case 1: 22346 t2 = op; 22347 break; 22348 case 4: 22349 _2.label++; 22350 return { value: op[1], done: false }; 22351 case 5: 22352 _2.label++; 22353 y2 = op[1]; 22354 op = [0]; 22355 continue; 22356 case 7: 22357 op = _2.ops.pop(); 22358 _2.trys.pop(); 22359 continue; 22360 default: 22361 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 22362 _2 = 0; 22363 continue; 22364 } 22365 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 22366 _2.label = op[1]; 22367 break; 22368 } 22369 if (op[0] === 6 && _2.label < t2[1]) { 22370 _2.label = t2[1]; 22371 t2 = op; 22372 break; 22373 } 22374 if (t2 && _2.label < t2[2]) { 22375 _2.label = t2[2]; 22376 _2.ops.push(op); 22377 break; 22378 } 22379 if (t2[2]) _2.ops.pop(); 22380 _2.trys.pop(); 22381 continue; 22382 } 22383 op = body.call(thisArg, _2); 22384 } catch (e2) { 22385 op = [6, e2]; 22386 y2 = 0; 22387 } finally { 22388 f2 = t2 = 0; 22389 } 22390 if (op[0] & 5) throw op[1];
22391 return { value: op[0] ? op[1] : void 0, done: true }; 22392 } 22393 }; 22394 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 22395 return mod && mod.__esModule ? mod : { "default": mod }; 22396 }; 22397 Object.defineProperty(ApiCall, "__esModule", { value: true }); 22398 var axios_12 = __importDefault(requireAxios()); 22399 var Errors_1 = requireErrors(); 22400 var TypesenseError_1 = __importDefault(requireTypesenseError()); 22401 var APIKEYHEADERNAME = "X-TYPESENSE-API-KEY"; 22402 var HEALTHY = true; 22403 var UNHEALTHY = false; 22404 var ApiCall$1 = ( 22405 /** @class */ 22406 function() { 22407 function ApiCall2(configuration) { 22408 this.configuration = configuration; 22409 this.apiKey = this.configuration.apiKey; 22410 this.nodes = this.configuration.nodes == null ? this.configuration.nodes : JSON.parse(JSON.stringify(this.configuration.nodes)); 22411 this.nearestNode = this.configuration.nearestNode == null ? this.configuration.nearestNode : JSON.parse(JSON.stringify(this.configuration.nearestNode)); 22412 this.connectionTimeoutSeconds = this.configuration.connectionTimeoutSeconds; 22413 this.healthcheckIntervalSeconds = this.configuration.healthcheckIntervalSeconds; 22414 this.numRetriesPerRequest = this.configuration.numRetries; 22415 this.retryIntervalSeconds = this.configuration.retryIntervalSeconds; 22416 this.sendApiKeyAsQueryParam = this.configuration.sendApiKeyAsQueryParam; 22417 this.additionalUserHeaders = this.configuration.additionalHeaders; 22418 this.logger = this.configuration.logger; 22419 this.initializeMetadataForNodes(); 22420 this.currentNodeIndex = -1; 22421 } 22422 ApiCall2.prototype.get = function(endpoint, queryParameters, _a2) { 22423 if (queryParameters === void 0) { 22424 queryParameters = {}; 22425 } 22426 var _b2 = _a2 === void 0 ? {} : _a2, _c = _b2.abortSignal, abortSignal = _c === void 0 ? null : _c, _d = _b2.responseType, responseType = _d === void 0 ? void 0 : _d; 22427 return __awaiter(this, void 0, void 0, function() { 22428 return __generator(this, function(_e) { 22429 return [2, this.performRequest("get", endpoint, { 22430 queryParameters, 22431 abortSignal, 22432 responseType 22433 })]; 22434 }); 22435 }); 22436 }; 22437 ApiCall2.prototype.delete = function(endpoint, queryParameters) { 22438 if (queryParameters === void 0) { 22439 queryParameters = {}; 22440 } 22441 return __awaiter(this, void 0, void 0, function() { 22442 return __generator(this, function(_a2) { 22443 return [2, this.performRequest("delete", endpoint, { queryParameters })]; 22444 }); 22445 }); 22446 }; 22447 ApiCall2.prototype.post = function(endpoint, bodyParameters, queryParameters, additionalHeaders) { 22448 if (bodyParameters === void 0) { 22449 bodyParameters = {}; 22450 } 22451 if (queryParameters === void 0) { 22452 queryParameters = {}; 22453 } 22454 if (additionalHeaders === void 0) { 22455 additionalHeaders = {}; 22456 } 22457 return __awaiter(this, void 0, void 0, function() { 22458 return __generator(this, function(_a2) { 22459 return [2, this.performRequest("post", endpoint, { 22460 queryParameters, 22461 bodyParameters, 22462 additionalHeaders 22463 })]; 22464 }); 22465 }); 22466 }; 22467 ApiCall2.prototype.put = function(endpoint, bodyParameters, queryParameters) { 22468 if (bodyParameters === void 0) { 22469 bodyParameters = {}; 22470 } 22471 if (queryParameters === void 0) { 22472 queryParameters = {}; 22473 } 22474 return __awaiter(this, void 0, void 0, function() { 22475 return __generator(this, function(_a2) { 22476 return [2, this.performRequest("put", endpoint, { 22477 queryParameters, 22478 bodyParameters 22479 })]; 22480 }); 22481 }); 22482 }; 22483 ApiCall2.prototype.patch = function(endpoint, bodyParameters, queryParameters) { 22484 if (bodyParameters === void 0) { 22485 bodyParameters = {}; 22486 } 22487 if (queryParameters === void 0) { 22488 queryParameters = {}; 22489 } 22490 return __awaiter(this, void 0, void 0, function() { 22491 return __generator(this, function(_a2) { 22492 return [2, this.performRequest("patch", endpoint, { 22493 queryParameters, 22494 bodyParameters 22495 })]; 22496 }); 22497 }); 22498 }; 22499 ApiCall2.prototype.performRequest = function(requestType, endpoint, _a2) { 22500 var _b2, _c, _d; 22501 var _e = _a2.queryParameters, queryParameters = _e === void 0 ? null : _e, _f = _a2.bodyParameters, bodyParameters = _f === void 0 ? null : _f, _g = _a2.additionalHeaders, additionalHeaders = _g === void 0 ? {}
vendor: 10,594 bytes, lines 22501-22677
22501 : _g, _h = _a2.abortSignal, abortSignal = _h === void 0 ? null : _h, _j = _a2.responseType, responseType = _j === void 0 ? void 0 : _j, _k = _a2.skipConnectionTimeout, skipConnectionTimeout = _k === void 0 ? false : _k; 22502 return __awaiter(this, void 0, void 0, function() { 22503 var requestNumber, lastException, _loop_1, this_1, numTries, state_1; 22504 return __generator(this, function(_l) { 22505 switch (_l.label) { 22506 case 0: 22507 this.configuration.validate(); 22508 requestNumber = Date.now(); 22509 this.logger.debug("Request #".concat(requestNumber, ": Performing ").concat(requestType.toUpperCase(), " request: ").concat(endpoint)); 22510 _loop_1 = function(numTries2) { 22511 var node, abortListener, requestOptions, cancelToken, source_1, response, error_1; 22512 return __generator(this, function(_m) { 22513 switch (_m.label) { 22514 case 0: 22515 node = this_1.getNextNode(requestNumber); 22516 this_1.logger.debug("Request #".concat(requestNumber, ": Attempting ").concat(requestType.toUpperCase(), " request Try #").concat(numTries2, " to Node ").concat(node.index)); 22517 if (abortSignal && abortSignal.aborted) { 22518 return [2, { value: Promise.reject(new Error("Request aborted by caller.")) }]; 22519 } 22520 abortListener = void 0; 22521 _m.label = 1; 22522 case 1: 22523 _m.trys.push([1, 3, 5, 6]); 22524 requestOptions = { 22525 method: requestType, 22526 url: this_1.uriFor(endpoint, node), 22527 headers: Object.assign({}, this_1.defaultHeaders(), additionalHeaders, this_1.additionalUserHeaders), 22528 maxContentLength: Infinity, 22529 maxBodyLength: Infinity, 22530 responseType, 22531 validateStatus: function(status) { 22532 return status > 0; 22533 }, 22534 transformResponse: [ 22535 function(data, headers) { 22536 var transformedData = data; 22537 if (headers !== void 0 && typeof data === "string" && headers["content-type"] && headers["content-type"].startsWith("application/json")) { 22538 transformedData = JSON.parse(data); 22539 } 22540 return transformedData; 22541 } 22542 ] 22543 }; 22544 if (skipConnectionTimeout !== true) { 22545 requestOptions.timeout = this_1.connectionTimeoutSeconds * 1e3; 22546 } 22547 if (queryParameters && Object.keys(queryParameters).length !== 0) { 22548 requestOptions.params = queryParameters; 22549 } 22550 if (this_1.sendApiKeyAsQueryParam) { 22551 requestOptions.params = requestOptions.params || {}; 22552 requestOptions.params["x-typesense-api-key"] = this_1.apiKey; 22553 } 22554 if (this_1.configuration.httpAgent) { 22555 this_1.logger.debug("Request #".concat(requestNumber, ": Using custom httpAgent")); 22556 requestOptions.httpAgent = this_1.configuration.httpAgent; 22557 } 22558 if (this_1.configuration.httpsAgent) { 22559 this_1.logger.debug("Request #".concat(requestNumber, ": Using custom httpsAgent")); 22560 requestOptions.httpsAgent = this_1.configuration.httpsAgent; 22561 } 22562 if (bodyParameters && (typeof bodyParameters === "string" && bodyParameters.length !== 0 || typeof bodyParameters === "object" && Object.keys(bodyParameters).length !== 0)) { 22563 requestOptions.data = bodyParameters; 22564 } 22565 if (abortSignal) { 22566 cancelToken = axios_12.default.CancelToken; 22567 source_1 = cancelToken.source(); 22568 abortListener = function() { 22569 return source_1.cancel(); 22570 }; 22571 abortSignal.addEventListener("abort", abortListener); 22572 requestOptions.cancelToken = source_1.token; 22573 } 22574 return [4, (0, axios_12.default)(requestOptions)]; 22575 case 2: 22576 response = _m.sent(); 22577 if (response.status >= 1 && response.status <= 499) { 22578 this_1.setNodeHealthcheck(node, HEALTHY); 22579 } 22580 this_1.logger.debug("Request #".concat(requestNumber, ": Request to Node ").concat(node.index, " was made. Response Code was ").concat(response.status, ".")); 22581 if (response.status >= 200 && response.status < 300) { 22582 return [2, { value: Promise.resolve(response.data) }]; 22583 } else if (response.status < 500) { 22584 return [2, { value: Promise.reject(this_1.customErrorForResponse(response, (_b2 = response.data) === null || _b2 === void 0 ? void 0 : _b2.message)) }]; 22585 } else { 22586 throw this_1.customErrorForResponse(response, (_c = response.data) === null || _c === void 0 ? void 0 : _c.message); 22587 } 22588 case 3: 22589 error_1 = _m.sent(); 22590 this_1.setNodeHealthcheck(node, UNHEALTHY); 22591 lastException = error_1; 22592 this_1.logger.warn("Request #".concat(requestNumber, ": Request to Node ").concat(node.index, ' failed due to "').concat(error_1.code, " ").concat(error_1.message).concat(error_1.response == null ? "" : " - " + JSON.stringify((_d = error_1.response) === null || _d === void 0 ? void 0 : _d.data), '"')); 22593 this_1.logger.warn("Request #".concat(requestNumber, ": Sleeping for ").concat(this_1.retryIntervalSeconds, "s and then retrying request...")); 22594 return [4, this_1.timer(this_1.retryIntervalSeconds)]; 22595 case 4: 22596 _m.sent(); 22597 return [3, 6]; 22598 case 5: 22599 if (abortSignal && abortListener) { 22600 abortSignal.removeEventListener("abort", abortListener); 22601 } 22602 return [ 22603 7 22604 /*endfinally*/ 22605 ]; 22606 case 6: 22607 return [ 22608 2 22609 /*return*/ 22610 ]; 22611 } 22612 }); 22613 }; 22614 this_1 = this; 22615 numTries = 1; 22616 _l.label = 1; 22617 case 1: 22618 if (!(numTries <= this.numRetriesPerRequest + 1)) return [3, 4]; 22619 return [5, _loop_1(numTries)]; 22620 case 2: 22621 state_1 = _l.sent(); 22622 if (typeof state_1 === "object") 22623 return [2, state_1.value]; 22624 _l.label = 3; 22625 case 3: 22626 numTries++; 22627 return [3, 1]; 22628 case 4: 22629 this.logger.debug("Request #".concat(requestNumber, ": No retries left. Raising last error")); 22630 return [2, Promise.reject(lastException)]; 22631 } 22632 }); 22633 }); 22634 }; 22635 ApiCall2.prototype.getNextNode = function(requestNumber) { 22636 if (requestNumber === void 0) { 22637 requestNumber = 0; 22638 } 22639 if (this.nearestNode != null) { 22640 this.logger.debug("Request #".concat(requestNumber, ": Nodes Health: Node ").concat(this.nearestNode.index, " is ").concat(this.nearestNode.isHealthy === true ? "Healthy" : "Unhealthy")); 22641 if (this.nearestNode.isHealthy === true || this.nodeDueForHealthcheck(this.nearestNode, requestNumber)) { 22642 this.logger.debug("Request #".concat(requestNumber, ": Updated current node to Node ").concat(this.nearestNode.index)); 22643 return this.nearestNode; 22644 } 22645 this.logger.debug("Request #".concat(requestNumber, ": Falling back to individual nodes")); 22646 } 22647 this.logger.debug("Request #".concat(requestNumber, ": Nodes Health: ").concat(this.nodes.map(function(node) { 22648 return "Node ".concat(node.index, " is ").concat(node.isHealthy === true ? "Healthy" : "Unhealthy"); 22649 }).join(" || "))); 22650 var candidateNode = this.nodes[0]; 22651 for (var i2 = 0; i2 <= this.nodes.length; i2++) { 22652 this.currentNodeIndex = (this.currentNodeIndex + 1) % this.nodes.length; 22653 candidateNode = this.nodes[this.currentNodeIndex]; 22654 if (candidateNode.isHealthy === true || this.nodeDueForHealthcheck(candidateNode, requestNumber)) { 22655 this.logger.debug("Request #".concat(requestNumber, ": Updated current node to Node ").concat(candidateNode.index)); 22656 return candidateNode; 22657 } 22658 } 22659 this.logger.debug("Request #".concat(requestNumber, ": No healthy nodes were found. Returning the next node, Node ").concat(candidateNode.index)); 22660 return candidateNode; 22661 }; 22662 ApiCall2.prototype.nodeDueForHealthcheck = function(node, requestNumber) { 22663 if (requestNumber === void 0) { 22664 requestNumber = 0; 22665 } 22666 var isDueForHealthcheck = Date.now() - node.lastAccessTimestamp > this.healthcheckIntervalSeconds * 1e3; 22667 if (isDueForHealthcheck) { 22668 this.logger.debug("Request #".concat(requestNumber, ": Node ").concat(node.index, " has exceeded healtcheckIntervalSeconds of ").concat(this.healthcheckIntervalSeconds, ". Adding it back into rotation.")); 22669 } 22670 return isDueForHealthcheck; 22671 }; 22672 ApiCall2.prototype.initializeMetadataForNodes = function() { 22673 var _this = this; 22674 if (this.nearestNode != null) { 22675 this.nearestNode.index = "nearestNode"; 22676 this.setNodeHealthcheck(this.nearestNode, HEALTHY); 22677 }
22678 this.nodes.forEach(function(node, i2) { 22679 node.index = i2; 22680 _this.setNodeHealthcheck(node, HEALTHY); 22681 }); 22682 }; 22683 ApiCall2.prototype.setNodeHealthcheck = function(node, isHealthy) { 22684 node.isHealthy = isHealthy; 22685 node.lastAccessTimestamp = Date.now(); 22686 }; 22687 ApiCall2.prototype.uriFor = function(endpoint, node) { 22688 if (node.url != null) { 22689 return "".concat(node.url).concat(endpoint); 22690 } 22691 return "".concat(node.protocol, "://").concat(node.host, ":").concat(node.port).concat(node.path).concat(endpoint); 22692 }; 22693 ApiCall2.prototype.defaultHeaders = function() { 22694 var defaultHeaders = {}; 22695 if (!this.sendApiKeyAsQueryParam) { 22696 defaultHeaders[APIKEYHEADERNAME] = this.apiKey; 22697 } 22698 defaultHeaders["Content-Type"] = "application/json"; 22699 return defaultHeaders; 22700 }; 22701 ApiCall2.prototype.timer = function(seconds) { 22702 return __awaiter(this, void 0, void 0, function() { 22703 return __generator(this, function(_a2) { 22704 return [2, new Promise(function(resolve) { 22705 return setTimeout(resolve, seconds * 1e3); 22706 })]; 22707 }); 22708 }); 22709 }; 22710 ApiCall2.prototype.customErrorForResponse = function(response, messageFromServer) { 22711 var errorMessage = "Request failed with HTTP code ".concat(response.status); 22712 if (typeof messageFromServer === "string" && messageFromServer.trim() !== "") { 22713 errorMessage += " | Server said: ".concat(messageFromServer); 22714 } 22715 var error2 = new TypesenseError_1.default(errorMessage); 22716 if (response.status === 400) { 22717 error2 = new Errors_1.RequestMalformed(errorMessage); 22718 } else if (response.status === 401) { 22719 error2 = new Errors_1.RequestUnauthorized(errorMessage); 22720 } else if (response.status === 404) { 22721 error2 = new Errors_1.ObjectNotFound(errorMessage); 22722 } else if (response.status === 409) { 22723 error2 = new Errors_1.ObjectAlreadyExists(errorMessage); 22724 } else if (response.status === 422) { 22725 error2 = new Errors_1.ObjectUnprocessable(errorMessage); 22726 } else if (response.status >= 500 && response.status <= 599) { 22727 error2 = new Errors_1.ServerError(errorMessage); 22728 } else { 22729 error2 = new Errors_1.HTTPError(errorMessage); 22730 } 22731 error2.httpStatus = response.status; 22732 return error2; 22733 }; 22734 return ApiCall2; 22735 }() 22736 ); 22737 ApiCall.default = ApiCall$1; 22738 return ApiCall; 22739} 22740var Collections = {}; 22741var hasRequiredCollections; 22742function requireCollections() { 22743 if (hasRequiredCollections) return Collections; 22744 hasRequiredCollections = 1; 22745 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 22746 function adopt(value) { 22747 return value instanceof P2 ? value : new P2(function(resolve) { 22748 resolve(value); 22749 }); 22750 } 22751 return new (P2 || (P2 = Promise))(function(resolve, reject) { 22752 function fulfilled(value) { 22753 try { 22754 step(generator.next(value)); 22755 } catch (e2) { 22756 reject(e2); 22757 } 22758 } 22759 function rejected(value) { 22760 try { 22761 step(generator["throw"](value)); 22762 } catch (e2) { 22763 reject(e2); 22764 } 22765 } 22766 function step(result) { 22767 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 22768 } 22769 step((generator = generator.apply(thisArg, _arguments || [])).next()); 22770 }); 22771 }; 22772 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 22773 var _2 = { label: 0, sent: function() { 22774 if (t2[0] & 1) throw t2[1]; 22775 return t2[1]; 22776 }, trys: [], ops: [] }, f2, y2, t2, g2; 22777 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 22778 return this; 22779 }), g2; 22780 function verb(n2) { 22781 return function(v2) { 22782 return step([n2, v2]); 22783 }; 22784 } 22785 function step(op) { 22786 if (f2) throw new TypeError("Generator is already executing."); 22787 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 22788 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 22789 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 22790 switch (op[0]) { 22791 case 0: 22792 case 1: 22793 t2 = op; 22794 break; 22795 case 4: 22796 _2.label++; 22797 return { value: op[1], done: false }; 22798 case 5: 22799 _2.label++; 22800 y2 = op[1]; 22801 op = [0]; 22802 continue; 22803 case 7: 22804 op = _2.ops.pop(); 22805 _2.trys.pop(); 22806 continue; 22807 default: 22808 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 22809 _2 = 0; 22810 continue; 22811 } 22812 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 22813 _2.label = op[1]; 22814 break; 22815 } 22816 if (op[0] === 6 && _2.label < t2[1]) { 22817 _2.label = t2[1]; 22818 t2 = op; 22819 break; 22820 } 22821 if (t2 && _2.label < t2[2]) { 22822 _2.label = t2[2]; 22823 _2.ops.push(op); 22824 break; 22825 } 22826 if (t2[2]) _2.ops.pop(); 22827 _2.trys.pop(); 22828 continue; 22829 } 22830 op = body.call(thisArg, _2); 22831 } catch (e2) { 22832 op = [6, e2]; 22833 y2 = 0; 22834 } finally { 22835 f2 = t2 = 0; 22836 } 22837 if (op[0] & 5) throw op[1];
22838 return { value: op[0] ? op[1] : void 0, done: true }; 22839 } 22840 }; 22841 Object.defineProperty(Collections, "__esModule", { value: true }); 22842 var RESOURCEPATH = "/collections"; 22843 var Collections$1 = ( 22844 /** @class */ 22845 function() { 22846 function Collections2(apiCall) { 22847 this.apiCall = apiCall; 22848 } 22849 Collections2.prototype.create = function(schema, options) { 22850 if (options === void 0) { 22851 options = {}; 22852 } 22853 return __awaiter(this, void 0, void 0, function() { 22854 return __generator(this, function(_a2) { 22855 return [2, this.apiCall.post(RESOURCEPATH, schema, options)]; 22856 }); 22857 }); 22858 }; 22859 Collections2.prototype.retrieve = function() { 22860 return __awaiter(this, void 0, void 0, function() { 22861 return __generator(this, function(_a2) { 22862 return [2, this.apiCall.get(RESOURCEPATH)]; 22863 }); 22864 }); 22865 }; 22866 Object.defineProperty(Collections2, "RESOURCEPATH", { 22867 get: function() { 22868 return RESOURCEPATH; 22869 }, 22870 enumerable: false, 22871 configurable: true 22872 }); 22873 return Collections2; 22874 }() 22875 ); 22876 Collections.default = Collections$1; 22877 return Collections; 22878} 22879var Collection = {}; 22880var Documents = {}; 22881var SearchOnlyDocuments = {}; 22882var RequestWithCache = {}; 22883var hasRequiredRequestWithCache; 22884function requireRequestWithCache() { 22885 if (hasRequiredRequestWithCache) return RequestWithCache; 22886 hasRequiredRequestWithCache = 1; 22887 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 22888 function adopt(value) { 22889 return value instanceof P2 ? value : new P2(function(resolve) { 22890 resolve(value); 22891 }); 22892 } 22893 return new (P2 || (P2 = Promise))(function(resolve, reject) { 22894 function fulfilled(value) { 22895 try { 22896 step(generator.next(value)); 22897 } catch (e2) { 22898 reject(e2); 22899 } 22900 } 22901 function rejected(value) { 22902 try { 22903 step(generator["throw"](value)); 22904 } catch (e2) { 22905 reject(e2); 22906 } 22907 } 22908 function step(result) { 22909 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 22910 } 22911 step((generator = generator.apply(thisArg, _arguments || [])).next()); 22912 }); 22913 }; 22914 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 22915 var _2 = { label: 0, sent: function() { 22916 if (t2[0] & 1) throw t2[1]; 22917 return t2[1]; 22918 }, trys: [], ops: [] }, f2, y2, t2, g2; 22919 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 22920 return this; 22921 }), g2; 22922 function verb(n2) { 22923 return function(v2) { 22924 return step([n2, v2]); 22925 }; 22926 } 22927 function step(op) { 22928 if (f2) throw new TypeError("Generator is already executing."); 22929 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 22930 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 22931 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 22932 switch (op[0]) { 22933 case 0: 22934 case 1: 22935 t2 = op; 22936 break; 22937 case 4: 22938 _2.label++; 22939 return { value: op[1], done: false }; 22940 case 5: 22941 _2.label++; 22942 y2 = op[1]; 22943 op = [0]; 22944 continue; 22945 case 7: 22946 op = _2.ops.pop(); 22947 _2.trys.pop(); 22948 continue; 22949 default: 22950 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 22951 _2 = 0; 22952 continue; 22953 } 22954 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 22955 _2.label = op[1]; 22956 break; 22957 } 22958 if (op[0] === 6 && _2.label < t2[1]) { 22959 _2.label = t2[1]; 22960 t2 = op; 22961 break; 22962 } 22963 if (t2 && _2.label < t2[2]) { 22964 _2.label = t2[2]; 22965 _2.ops.push(op); 22966 break; 22967 } 22968 if (t2[2]) _2.ops.pop(); 22969 _2.trys.pop(); 22970 continue; 22971 } 22972 op = body.call(thisArg, _2); 22973 } catch (e2) { 22974 op = [6, e2]; 22975 y2 = 0; 22976 } finally { 22977 f2 = t2 = 0; 22978 } 22979 if (op[0] & 5) throw op[1];
22980 return { value: op[0] ? op[1] : void 0, done: true }; 22981 } 22982 }; 22983 var __spreadArray = commonjsGlobal && commonjsGlobal.__spreadArray || function(to, from, pack) { 22984 if (pack || arguments.length === 2) for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) { 22985 if (ar || !(i2 in from)) { 22986 if (!ar) ar = Array.prototype.slice.call(from, 0, i2); 22987 ar[i2] = from[i2]; 22988 } 22989 } 22990 return to.concat(ar || Array.prototype.slice.call(from)); 22991 }; 22992 Object.defineProperty(RequestWithCache, "__esModule", { value: true }); 22993 var defaultCacheResponseForSeconds = 2 * 60; 22994 var defaultMaxSize = 100; 22995 var RequestWithCache$1 = ( 22996 /** @class */ 22997 function() { 22998 function RequestWithCache2() { 22999 this.responseCache = /* @__PURE__ */ new Map(); 23000 this.responsePromiseCache = /* @__PURE__ */ new Map(); 23001 } 23002 RequestWithCache2.prototype.clearCache = function() { 23003 this.responseCache = /* @__PURE__ */ new Map(); 23004 this.responsePromiseCache = /* @__PURE__ */ new Map(); 23005 }; 23006 RequestWithCache2.prototype.perform = function(requestContext, requestFunction, requestFunctionArguments, cacheOptions) { 23007 return __awaiter(this, void 0, void 0, function() { 23008 var _a2, cacheResponseForSeconds, _b2, maxSize, isCacheDisabled, requestFunctionArgumentsJSON, cacheEntry, now, isEntryValid, cachePromiseEntry, isEntryValid, responsePromise, response, isCacheOverMaxSize, oldestEntry, isResponsePromiseCacheOverMaxSize, oldestEntry; 23009 return __generator(this, function(_c) { 23010 switch (_c.label) { 23011 case 0: 23012 _a2 = cacheOptions.cacheResponseForSeconds, cacheResponseForSeconds = _a2 === void 0 ? defaultCacheResponseForSeconds : _a2, _b2 = cacheOptions.maxSize, maxSize = _b2 === void 0 ? defaultMaxSize : _b2; 23013 isCacheDisabled = cacheResponseForSeconds <= 0 || maxSize <= 0; 23014 if (isCacheDisabled) { 23015 return [2, requestFunction.call.apply(requestFunction, __spreadArray([requestContext], requestFunctionArguments, false))]; 23016 } 23017 requestFunctionArgumentsJSON = JSON.stringify(requestFunctionArguments); 23018 cacheEntry = this.responseCache.get(requestFunctionArgumentsJSON); 23019 now = Date.now(); 23020 if (cacheEntry) { 23021 isEntryValid = now - cacheEntry.requestTimestamp < cacheResponseForSeconds * 1e3; 23022 if (isEntryValid) { 23023 this.responseCache.delete(requestFunctionArgumentsJSON); 23024 this.responseCache.set(requestFunctionArgumentsJSON, cacheEntry); 23025 return [2, Promise.resolve(cacheEntry.response)]; 23026 } else { 23027 this.responseCache.delete(requestFunctionArgumentsJSON); 23028 } 23029 } 23030 cachePromiseEntry = this.responsePromiseCache.get(requestFunctionArgumentsJSON); 23031 if (cachePromiseEntry) { 23032 isEntryValid = now - cachePromiseEntry.requestTimestamp < cacheResponseForSeconds * 1e3; 23033 if (isEntryValid) { 23034 this.responsePromiseCache.delete(requestFunctionArgumentsJSON); 23035 this.responsePromiseCache.set(requestFunctionArgumentsJSON, cachePromiseEntry); 23036 return [2, cachePromiseEntry.responsePromise]; 23037 } else { 23038 this.responsePromiseCache.delete(requestFunctionArgumentsJSON); 23039 } 23040 } 23041 responsePromise = requestFunction.call.apply(requestFunction, __spreadArray([requestContext], requestFunctionArguments, false)); 23042 this.responsePromiseCache.set(requestFunctionArgumentsJSON, { 23043 requestTimestamp: now, 23044 responsePromise 23045 }); 23046 return [4, responsePromise]; 23047 case 1: 23048 response = _c.sent(); 23049 this.responseCache.set(requestFunctionArgumentsJSON, { 23050 requestTimestamp: now, 23051 response 23052 });
23053 isCacheOverMaxSize = this.responseCache.size > maxSize; 23054 if (isCacheOverMaxSize) { 23055 oldestEntry = this.responseCache.keys().next().value; 23056 this.responseCache.delete(oldestEntry); 23057 } 23058 isResponsePromiseCacheOverMaxSize = this.responsePromiseCache.size > maxSize; 23059 if (isResponsePromiseCacheOverMaxSize) { 23060 oldestEntry = this.responsePromiseCache.keys().next().value; 23061 this.responsePromiseCache.delete(oldestEntry); 23062 } 23063 return [2, response]; 23064 } 23065 }); 23066 }); 23067 }; 23068 return RequestWithCache2; 23069 }() 23070 ); 23071 RequestWithCache.default = RequestWithCache$1; 23072 return RequestWithCache; 23073} 23074var hasRequiredSearchOnlyDocuments; 23075function requireSearchOnlyDocuments() { 23076 if (hasRequiredSearchOnlyDocuments) return SearchOnlyDocuments; 23077 hasRequiredSearchOnlyDocuments = 1; 23078 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23079 function adopt(value) { 23080 return value instanceof P2 ? value : new P2(function(resolve) { 23081 resolve(value); 23082 }); 23083 } 23084 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23085 function fulfilled(value) { 23086 try { 23087 step(generator.next(value)); 23088 } catch (e2) { 23089 reject(e2); 23090 } 23091 } 23092 function rejected(value) { 23093 try { 23094 step(generator["throw"](value)); 23095 } catch (e2) { 23096 reject(e2); 23097 } 23098 } 23099 function step(result) { 23100 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23101 } 23102 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23103 }); 23104 }; 23105 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23106 var _2 = { label: 0, sent: function() { 23107 if (t2[0] & 1) throw t2[1]; 23108 return t2[1]; 23109 }, trys: [], ops: [] }, f2, y2, t2, g2; 23110 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23111 return this; 23112 }), g2; 23113 function verb(n2) { 23114 return function(v2) { 23115 return step([n2, v2]); 23116 }; 23117 } 23118 function step(op) { 23119 if (f2) throw new TypeError("Generator is already executing."); 23120 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23121 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23122 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23123 switch (op[0]) { 23124 case 0: 23125 case 1: 23126 t2 = op; 23127 break; 23128 case 4: 23129 _2.label++; 23130 return { value: op[1], done: false }; 23131 case 5: 23132 _2.label++; 23133 y2 = op[1]; 23134 op = [0]; 23135 continue; 23136 case 7: 23137 op = _2.ops.pop(); 23138 _2.trys.pop(); 23139 continue; 23140 default: 23141 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23142 _2 = 0; 23143 continue; 23144 } 23145 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23146 _2.label = op[1]; 23147 break; 23148 } 23149 if (op[0] === 6 && _2.label < t2[1]) { 23150 _2.label = t2[1]; 23151 t2 = op; 23152 break; 23153 } 23154 if (t2 && _2.label < t2[2]) { 23155 _2.label = t2[2]; 23156 _2.ops.push(op); 23157 break; 23158 } 23159 if (t2[2]) _2.ops.pop(); 23160 _2.trys.pop(); 23161 continue; 23162 } 23163 op = body.call(thisArg, _2); 23164 } catch (e2) { 23165 op = [6, e2]; 23166 y2 = 0; 23167 } finally { 23168 f2 = t2 = 0; 23169 } 23170 if (op[0] & 5) throw op[1]; 23171 return { value: op[0] ? op[1] : void 0, done: true }; 23172 } 23173 }; 23174 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 23175 return mod && mod.__esModule ? mod : { "default": mod }; 23176 }; 23177 Object.defineProperty(SearchOnlyDocuments, "__esModule", { value: true }); 23178 SearchOnlyDocuments.SearchOnlyDocuments = void 0; 23179 var RequestWithCache_1 = __importDefault(requireRequestWithCache()); 23180 var Collections_1 = __importDefault(requireCollections()); 23181 var RESOURCEPATH = "/documents"; 23182 var SearchOnlyDocuments$1 = ( 23183 /** @class */ 23184 function() { 23185 function SearchOnlyDocuments2(collectionName, apiCall, configuration) { 23186 this.collectionName = collectionName; 23187 this.apiCall = apiCall; 23188 this.configuration = configuration; 23189 this.requestWithCache = new RequestWithCache_1.default(); 23190 } 23191 SearchOnlyDocuments2.prototype.clearCache = function() { 23192 this.requestWithCache.clearCache(); 23193 }; 23194 SearchOnlyDocuments2.prototype.search = function(searchParameters, _a2) { 23195 var _b2 = _a2 === void 0 ? {}
23195 : _a2, _c = _b2.cacheSearchResultsForSeconds, cacheSearchResultsForSeconds = _c === void 0 ? this.configuration.cacheSearchResultsForSeconds : _c, _d = _b2.abortSignal, abortSignal = _d === void 0 ? null : _d; 23196 return __awaiter(this, void 0, void 0, function() { 23197 var additionalQueryParams, key2, queryParams; 23198 return __generator(this, function(_e) { 23199 additionalQueryParams = {}; 23200 if (this.configuration.useServerSideSearchCache === true) { 23201 additionalQueryParams["use_cache"] = true; 23202 } 23203 for (key2 in searchParameters) { 23204 if (Array.isArray(searchParameters[key2])) { 23205 additionalQueryParams[key2] = searchParameters[key2].join(","); 23206 } 23207 } 23208 queryParams = Object.assign({}, searchParameters, additionalQueryParams); 23209 return [2, this.requestWithCache.perform(this.apiCall, this.apiCall.get, [this.endpointPath("search"), queryParams, { abortSignal }], { 23210 cacheResponseForSeconds: cacheSearchResultsForSeconds 23211 })]; 23212 }); 23213 }); 23214 };
23215 SearchOnlyDocuments2.prototype.endpointPath = function(operation) { 23216 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 23217 }; 23218 Object.defineProperty(SearchOnlyDocuments2, "RESOURCEPATH", { 23219 get: function() { 23220 return RESOURCEPATH; 23221 }, 23222 enumerable: false, 23223 configurable: true 23224 }); 23225 return SearchOnlyDocuments2; 23226 }() 23227 ); 23228 SearchOnlyDocuments.SearchOnlyDocuments = SearchOnlyDocuments$1; 23229 return SearchOnlyDocuments; 23230} 23231var hasRequiredDocuments; 23232function requireDocuments() { 23233 if (hasRequiredDocuments) return Documents; 23234 hasRequiredDocuments = 1; 23235 var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() { 23236 var extendStatics = function(d2, b2) { 23237 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 23238 d3.__proto__ = b3; 23239 } || function(d3, b3) { 23240 for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2]; 23241 }; 23242 return extendStatics(d2, b2); 23243 }; 23244 return function(d2, b2) { 23245 if (typeof b2 !== "function" && b2 !== null) 23246 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 23247 extendStatics(d2, b2); 23248 function __() { 23249 this.constructor = d2; 23250 } 23251 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 23252 }; 23253 }(); 23254 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23255 function adopt(value) { 23256 return value instanceof P2 ? value : new P2(function(resolve) { 23257 resolve(value); 23258 }); 23259 } 23260 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23261 function fulfilled(value) { 23262 try { 23263 step(generator.next(value)); 23264 } catch (e2) { 23265 reject(e2); 23266 } 23267 } 23268 function rejected(value) { 23269 try { 23270 step(generator["throw"](value)); 23271 } catch (e2) { 23272 reject(e2); 23273 } 23274 } 23275 function step(result) { 23276 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23277 } 23278 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23279 }); 23280 }; 23281 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23282 var _2 = { label: 0, sent: function() { 23283 if (t2[0] & 1) throw t2[1]; 23284 return t2[1]; 23285 }, trys: [], ops: [] }, f2, y2, t2, g2; 23286 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23287 return this; 23288 }), g2; 23289 function verb(n2) { 23290 return function(v2) { 23291 return step([n2, v2]); 23292 }; 23293 } 23294 function step(op) { 23295 if (f2) throw new TypeError("Generator is already executing."); 23296 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23297 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23298 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23299 switch (op[0]) { 23300 case 0: 23301 case 1: 23302 t2 = op; 23303 break; 23304 case 4: 23305 _2.label++; 23306 return { value: op[1], done: false }; 23307 case 5: 23308 _2.label++; 23309 y2 = op[1]; 23310 op = [0]; 23311 continue; 23312 case 7: 23313 op = _2.ops.pop(); 23314 _2.trys.pop(); 23315 continue; 23316 default: 23317 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23318 _2 = 0; 23319 continue; 23320 } 23321 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23322 _2.label = op[1]; 23323 break; 23324 } 23325 if (op[0] === 6 && _2.label < t2[1]) { 23326 _2.label = t2[1]; 23327 t2 = op; 23328 break; 23329 } 23330 if (t2 && _2.label < t2[2]) { 23331 _2.label = t2[2]; 23332 _2.ops.push(op); 23333 break; 23334 } 23335 if (t2[2]) _2.ops.pop(); 23336 _2.trys.pop(); 23337 continue; 23338 } 23339 op = body.call(thisArg, _2); 23340 } catch (e2) { 23341 op = [6, e2]; 23342 y2 = 0; 23343 } finally { 23344 f2 = t2 = 0; 23345 } 23346 if (op[0] & 5) throw op[1];
23347 return { value: op[0] ? op[1] : void 0, done: true }; 23348 } 23349 }; 23350 Object.defineProperty(Documents, "__esModule", { value: true }); 23351 var Errors_1 = requireErrors(); 23352 var SearchOnlyDocuments_1 = requireSearchOnlyDocuments(); 23353 var Documents$1 = ( 23354 /** @class */ 23355 function(_super) { 23356 __extends(Documents2, _super); 23357 function Documents2(collectionName, apiCall, configuration) { 23358 return _super.call(this, collectionName, apiCall, configuration) || this; 23359 } 23360 Documents2.prototype.create = function(document2, options) { 23361 if (options === void 0) { 23362 options = {}; 23363 } 23364 return __awaiter(this, void 0, void 0, function() { 23365 return __generator(this, function(_a2) { 23366 if (!document2) 23367 throw new Error("No document provided"); 23368 return [2, this.apiCall.post(this.endpointPath(), document2, options)]; 23369 }); 23370 }); 23371 }; 23372 Documents2.prototype.upsert = function(document2, options) { 23373 if (options === void 0) { 23374 options = {}; 23375 } 23376 return __awaiter(this, void 0, void 0, function() { 23377 return __generator(this, function(_a2) { 23378 if (!document2) 23379 throw new Error("No document provided"); 23380 return [2, this.apiCall.post(this.endpointPath(), document2, Object.assign({}, options, { action: "upsert" }))]; 23381 }); 23382 }); 23383 }; 23384 Documents2.prototype.update = function(document2, options) { 23385 if (options === void 0) { 23386 options = {}; 23387 } 23388 return __awaiter(this, void 0, void 0, function() { 23389 return __generator(this, function(_a2) { 23390 if (!document2) 23391 throw new Error("No document provided"); 23392 if (options["filter_by"] != null) { 23393 return [2, this.apiCall.patch(this.endpointPath(), document2, Object.assign({}, options))]; 23394 } else { 23395 return [2, this.apiCall.post(this.endpointPath(), document2, Object.assign({}, options, { action: "update" }))]; 23396 } 23397 }); 23398 }); 23399 }; 23400 Documents2.prototype.delete = function(query) { 23401 if (query === void 0) { 23402 query = {}; 23403 } 23404 return __awaiter(this, void 0, void 0, function() { 23405 return __generator(this, function(_a2) { 23406 return [2, this.apiCall.delete(this.endpointPath(), query)]; 23407 }); 23408 }); 23409 }; 23410 Documents2.prototype.createMany = function(documents, options) { 23411 if (options === void 0) { 23412 options = {}; 23413 } 23414 return __awaiter(this, void 0, void 0, function() { 23415 return __generator(this, function(_a2) { 23416 this.configuration.logger.warn("createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents"); 23417 return [2, this.import(documents, options)]; 23418 }); 23419 }); 23420 }; 23421 Documents2.prototype.import = function(documents, options) { 23422 if (options === void 0) { 23423 options = {}; 23424 } 23425 return __awaiter(this, void 0, void 0, function() { 23426 var documentsInJSONLFormat, resultsInJSONLFormat, resultsInJSONFormat, failedItems; 23427 return __generator(this, function(_a2) { 23428 switch (_a2.label) { 23429 case 0: 23430 if (Array.isArray(documents)) { 23431 try { 23432 documentsInJSONLFormat = documents.map(function(document2) { 23433 return JSON.stringify(document2); 23434 }).join("\n"); 23435 } catch (error2) { 23436 if (RangeError instanceof error2 && (error2 === null || error2 === void 0 ? void 0 : error2.includes("Too many properties to enumerate"))) { 23437 throw new Error("".concat(error2, "\n It looks like you have reached a Node.js limit that restricts the number of keys in an Object: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object\n\n Please try reducing the number of keys in your document, or using CURL to import your data.\n ")); 23438 } 23439 throw new Error(error2); 23440 } 23441 } else { 23442 documentsInJSONLFormat = documents; 23443 } 23444 return [4, this.apiCall.performRequest("post", this.endpointPath("import"), { 23445 queryParameters: options, 23446 bodyParameters: documentsInJSONLFormat, 23447 additionalHeaders: { "Content-Type": "text/plain" }, 23448 skipConnectionTimeout: true 23449 // We never want to client-side-timeout on an import and retry, since imports are syncronous and we want to let them take as long as it takes to complete fully 23450 })]; 23451 case 1: 23452 resultsInJSONLFormat = _a2.sent(); 23453 if (Array.isArray(documents)) { 23454 resultsInJSONFormat = resultsInJSONLFormat.split("\n").map(function(r2) { 23455 return JSON.parse(r2); 23456 }); 23457 failedItems = resultsInJSONFormat.filter(function(r2) { 23458 return r2.success === false; 23459 }); 23460 if (failedItems.length > 0) { 23461 throw new Errors_1.ImportError("".concat(resultsInJSONFormat.length - failedItems.length, " documents imported successfully, ").concat(failedItems.length, " documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."), resultsInJSONFormat); 23462 } else { 23463 return [2, resultsInJSONFormat]; 23464 } 23465 } else { 23466 return [2, resultsInJSONLFormat]; 23467 } 23468 } 23469 }); 23470 }); 23471 };
23472 Documents2.prototype.export = function(options) { 23473 if (options === void 0) { 23474 options = {}; 23475 } 23476 return __awaiter(this, void 0, void 0, function() { 23477 return __generator(this, function(_a2) { 23478 return [2, this.apiCall.get(this.endpointPath("export"), options)]; 23479 }); 23480 }); 23481 }; 23482 Documents2.prototype.exportStream = function(options) { 23483 if (options === void 0) { 23484 options = {}; 23485 } 23486 return __awaiter(this, void 0, void 0, function() { 23487 return __generator(this, function(_a2) { 23488 return [2, this.apiCall.get(this.endpointPath("export"), options, { 23489 responseType: "stream" 23490 })]; 23491 }); 23492 }); 23493 }; 23494 return Documents2; 23495 }(SearchOnlyDocuments_1.SearchOnlyDocuments) 23496 ); 23497 Documents.default = Documents$1; 23498 return Documents; 23499} 23500var Overrides = {}; 23501var hasRequiredOverrides; 23502function requireOverrides() { 23503 if (hasRequiredOverrides) return Overrides; 23504 hasRequiredOverrides = 1; 23505 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23506 function adopt(value) { 23507 return value instanceof P2 ? value : new P2(function(resolve) { 23508 resolve(value); 23509 }); 23510 } 23511 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23512 function fulfilled(value) { 23513 try { 23514 step(generator.next(value)); 23515 } catch (e2) { 23516 reject(e2); 23517 } 23518 } 23519 function rejected(value) { 23520 try { 23521 step(generator["throw"](value)); 23522 } catch (e2) { 23523 reject(e2); 23524 } 23525 } 23526 function step(result) { 23527 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23528 } 23529 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23530 }); 23531 }; 23532 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23533 var _2 = { label: 0, sent: function() { 23534 if (t2[0] & 1) throw t2[1]; 23535 return t2[1]; 23536 }, trys: [], ops: [] }, f2, y2, t2, g2; 23537 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23538 return this; 23539 }), g2; 23540 function verb(n2) { 23541 return function(v2) { 23542 return step([n2, v2]); 23543 }; 23544 } 23545 function step(op) { 23546 if (f2) throw new TypeError("Generator is already executing."); 23547 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23548 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23549 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23550 switch (op[0]) { 23551 case 0: 23552 case 1: 23553 t2 = op; 23554 break; 23555 case 4: 23556 _2.label++; 23557 return { value: op[1], done: false }; 23558 case 5: 23559 _2.label++; 23560 y2 = op[1]; 23561 op = [0]; 23562 continue; 23563 case 7: 23564 op = _2.ops.pop(); 23565 _2.trys.pop(); 23566 continue; 23567 default: 23568 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23569 _2 = 0; 23570 continue; 23571 } 23572 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23573 _2.label = op[1]; 23574 break; 23575 } 23576 if (op[0] === 6 && _2.label < t2[1]) { 23577 _2.label = t2[1]; 23578 t2 = op; 23579 break; 23580 } 23581 if (t2 && _2.label < t2[2]) { 23582 _2.label = t2[2]; 23583 _2.ops.push(op); 23584 break; 23585 } 23586 if (t2[2]) _2.ops.pop(); 23587 _2.trys.pop(); 23588 continue; 23589 } 23590 op = body.call(thisArg, _2); 23591 } catch (e2) { 23592 op = [6, e2]; 23593 y2 = 0; 23594 } finally { 23595 f2 = t2 = 0; 23596 } 23597 if (op[0] & 5) throw op[1]; 23598 return { value: op[0] ? op[1] : void 0, done: true }; 23599 } 23600 }; 23601 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 23602 return mod && mod.__esModule ? mod : { "default": mod }; 23603 }; 23604 Object.defineProperty(Overrides, "__esModule", { value: true }); 23605 var Collections_1 = __importDefault(requireCollections()); 23606 var RESOURCEPATH = "/overrides"; 23607 var Overrides$1 = ( 23608 /** @class */ 23609 function() { 23610 function Overrides2(collectionName, apiCall) { 23611 this.collectionName = collectionName; 23612 this.apiCall = apiCall; 23613 } 23614 Overrides2.prototype.upsert = function(overrideId, params) { 23615 return __awaiter(this, void 0, void 0, function() { 23616 return __generator(this, function(_a2) { 23617 return [2, this.apiCall.put(this.endpointPath(overrideId), params)]; 23618 }); 23619 }); 23620 }; 23621 Overrides2.prototype.retrieve = function() { 23622 return __awaiter(this, void 0, void 0, function() { 23623 return __generator(this, function(_a2) { 23624 return [2, this.apiCall.get(this.endpointPath())]; 23625 }); 23626 }); 23627 };
23628 Overrides2.prototype.endpointPath = function(operation) { 23629 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(Overrides2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 23630 }; 23631 Object.defineProperty(Overrides2, "RESOURCEPATH", { 23632 get: function() { 23633 return RESOURCEPATH; 23634 }, 23635 enumerable: false, 23636 configurable: true 23637 }); 23638 return Overrides2; 23639 }() 23640 ); 23641 Overrides.default = Overrides$1; 23642 return Overrides; 23643} 23644var Override = {}; 23645var hasRequiredOverride; 23646function requireOverride() { 23647 if (hasRequiredOverride) return Override; 23648 hasRequiredOverride = 1; 23649 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23650 function adopt(value) { 23651 return value instanceof P2 ? value : new P2(function(resolve) { 23652 resolve(value); 23653 }); 23654 } 23655 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23656 function fulfilled(value) { 23657 try { 23658 step(generator.next(value)); 23659 } catch (e2) { 23660 reject(e2); 23661 } 23662 } 23663 function rejected(value) { 23664 try { 23665 step(generator["throw"](value)); 23666 } catch (e2) { 23667 reject(e2); 23668 } 23669 } 23670 function step(result) { 23671 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23672 } 23673 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23674 }); 23675 }; 23676 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23677 var _2 = { label: 0, sent: function() { 23678 if (t2[0] & 1) throw t2[1]; 23679 return t2[1]; 23680 }, trys: [], ops: [] }, f2, y2, t2, g2; 23681 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23682 return this; 23683 }), g2; 23684 function verb(n2) { 23685 return function(v2) { 23686 return step([n2, v2]); 23687 }; 23688 } 23689 function step(op) { 23690 if (f2) throw new TypeError("Generator is already executing."); 23691 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23692 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23693 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23694 switch (op[0]) { 23695 case 0: 23696 case 1: 23697 t2 = op; 23698 break; 23699 case 4: 23700 _2.label++; 23701 return { value: op[1], done: false }; 23702 case 5: 23703 _2.label++; 23704 y2 = op[1]; 23705 op = [0]; 23706 continue; 23707 case 7: 23708 op = _2.ops.pop(); 23709 _2.trys.pop(); 23710 continue; 23711 default: 23712 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23713 _2 = 0; 23714 continue; 23715 } 23716 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23717 _2.label = op[1]; 23718 break; 23719 } 23720 if (op[0] === 6 && _2.label < t2[1]) { 23721 _2.label = t2[1]; 23722 t2 = op; 23723 break; 23724 } 23725 if (t2 && _2.label < t2[2]) { 23726 _2.label = t2[2]; 23727 _2.ops.push(op); 23728 break; 23729 } 23730 if (t2[2]) _2.ops.pop(); 23731 _2.trys.pop(); 23732 continue; 23733 } 23734 op = body.call(thisArg, _2); 23735 } catch (e2) { 23736 op = [6, e2]; 23737 y2 = 0; 23738 } finally { 23739 f2 = t2 = 0; 23740 } 23741 if (op[0] & 5) throw op[1]; 23742 return { value: op[0] ? op[1] : void 0, done: true }; 23743 } 23744 }; 23745 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 23746 return mod && mod.__esModule ? mod : { "default": mod }; 23747 }; 23748 Object.defineProperty(Override, "__esModule", { value: true }); 23749 var Collections_1 = __importDefault(requireCollections()); 23750 var Overrides_1 = __importDefault(requireOverrides()); 23751 var Override$1 = ( 23752 /** @class */ 23753 function() { 23754 function Override2(collectionName, overrideId, apiCall) { 23755 this.collectionName = collectionName; 23756 this.overrideId = overrideId; 23757 this.apiCall = apiCall; 23758 } 23759 Override2.prototype.retrieve = function() { 23760 return __awaiter(this, void 0, void 0, function() { 23761 return __generator(this, function(_a2) { 23762 return [2, this.apiCall.get(this.endpointPath())]; 23763 }); 23764 }); 23765 }; 23766 Override2.prototype.delete = function() { 23767 return __awaiter(this, void 0, void 0, function() { 23768 return __generator(this, function(_a2) { 23769 return [2, this.apiCall.delete(this.endpointPath())]; 23770 }); 23771 }); 23772 };
23773 Override2.prototype.endpointPath = function() { 23774 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(Overrides_1.default.RESOURCEPATH, "/").concat(this.overrideId); 23775 }; 23776 return Override2; 23777 }() 23778 ); 23779 Override.default = Override$1; 23780 return Override; 23781} 23782var Synonyms = {}; 23783var hasRequiredSynonyms; 23784function requireSynonyms() { 23785 if (hasRequiredSynonyms) return Synonyms; 23786 hasRequiredSynonyms = 1; 23787 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23788 function adopt(value) { 23789 return value instanceof P2 ? value : new P2(function(resolve) { 23790 resolve(value); 23791 }); 23792 } 23793 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23794 function fulfilled(value) { 23795 try { 23796 step(generator.next(value)); 23797 } catch (e2) { 23798 reject(e2); 23799 } 23800 } 23801 function rejected(value) { 23802 try { 23803 step(generator["throw"](value)); 23804 } catch (e2) { 23805 reject(e2); 23806 } 23807 } 23808 function step(result) { 23809 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23810 } 23811 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23812 }); 23813 }; 23814 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23815 var _2 = { label: 0, sent: function() { 23816 if (t2[0] & 1) throw t2[1]; 23817 return t2[1]; 23818 }, trys: [], ops: [] }, f2, y2, t2, g2; 23819 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23820 return this; 23821 }), g2; 23822 function verb(n2) { 23823 return function(v2) { 23824 return step([n2, v2]); 23825 }; 23826 } 23827 function step(op) { 23828 if (f2) throw new TypeError("Generator is already executing."); 23829 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23830 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23831 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23832 switch (op[0]) { 23833 case 0: 23834 case 1: 23835 t2 = op; 23836 break; 23837 case 4: 23838 _2.label++; 23839 return { value: op[1], done: false }; 23840 case 5: 23841 _2.label++; 23842 y2 = op[1]; 23843 op = [0]; 23844 continue; 23845 case 7: 23846 op = _2.ops.pop(); 23847 _2.trys.pop(); 23848 continue; 23849 default: 23850 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23851 _2 = 0; 23852 continue; 23853 } 23854 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23855 _2.label = op[1]; 23856 break; 23857 } 23858 if (op[0] === 6 && _2.label < t2[1]) { 23859 _2.label = t2[1]; 23860 t2 = op; 23861 break; 23862 } 23863 if (t2 && _2.label < t2[2]) { 23864 _2.label = t2[2]; 23865 _2.ops.push(op); 23866 break; 23867 } 23868 if (t2[2]) _2.ops.pop(); 23869 _2.trys.pop(); 23870 continue; 23871 } 23872 op = body.call(thisArg, _2); 23873 } catch (e2) { 23874 op = [6, e2]; 23875 y2 = 0; 23876 } finally { 23877 f2 = t2 = 0; 23878 } 23879 if (op[0] & 5) throw op[1]; 23880 return { value: op[0] ? op[1] : void 0, done: true }; 23881 } 23882 }; 23883 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 23884 return mod && mod.__esModule ? mod : { "default": mod }; 23885 }; 23886 Object.defineProperty(Synonyms, "__esModule", { value: true }); 23887 var Collections_1 = __importDefault(requireCollections()); 23888 var RESOURCEPATH = "/synonyms"; 23889 var Synonyms$1 = ( 23890 /** @class */ 23891 function() { 23892 function Synonyms2(collectionName, apiCall) { 23893 this.collectionName = collectionName; 23894 this.apiCall = apiCall; 23895 } 23896 Synonyms2.prototype.upsert = function(synonymId, params) { 23897 return __awaiter(this, void 0, void 0, function() { 23898 return __generator(this, function(_a2) { 23899 return [2, this.apiCall.put(this.endpointPath(synonymId), params)]; 23900 }); 23901 }); 23902 }; 23903 Synonyms2.prototype.retrieve = function() { 23904 return __awaiter(this, void 0, void 0, function() { 23905 return __generator(this, function(_a2) { 23906 return [2, this.apiCall.get(this.endpointPath())]; 23907 }); 23908 }); 23909 };
23910 Synonyms2.prototype.endpointPath = function(operation) { 23911 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(Synonyms2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 23912 }; 23913 Object.defineProperty(Synonyms2, "RESOURCEPATH", { 23914 get: function() { 23915 return RESOURCEPATH; 23916 }, 23917 enumerable: false, 23918 configurable: true 23919 }); 23920 return Synonyms2; 23921 }() 23922 ); 23923 Synonyms.default = Synonyms$1; 23924 return Synonyms; 23925} 23926var Synonym = {}; 23927var hasRequiredSynonym; 23928function requireSynonym() { 23929 if (hasRequiredSynonym) return Synonym; 23930 hasRequiredSynonym = 1; 23931 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 23932 function adopt(value) { 23933 return value instanceof P2 ? value : new P2(function(resolve) { 23934 resolve(value); 23935 }); 23936 } 23937 return new (P2 || (P2 = Promise))(function(resolve, reject) { 23938 function fulfilled(value) { 23939 try { 23940 step(generator.next(value)); 23941 } catch (e2) { 23942 reject(e2); 23943 } 23944 } 23945 function rejected(value) { 23946 try { 23947 step(generator["throw"](value)); 23948 } catch (e2) { 23949 reject(e2); 23950 } 23951 } 23952 function step(result) { 23953 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 23954 } 23955 step((generator = generator.apply(thisArg, _arguments || [])).next()); 23956 }); 23957 }; 23958 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 23959 var _2 = { label: 0, sent: function() { 23960 if (t2[0] & 1) throw t2[1]; 23961 return t2[1]; 23962 }, trys: [], ops: [] }, f2, y2, t2, g2; 23963 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 23964 return this; 23965 }), g2; 23966 function verb(n2) { 23967 return function(v2) { 23968 return step([n2, v2]); 23969 }; 23970 } 23971 function step(op) { 23972 if (f2) throw new TypeError("Generator is already executing."); 23973 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 23974 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 23975 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 23976 switch (op[0]) { 23977 case 0: 23978 case 1: 23979 t2 = op; 23980 break; 23981 case 4: 23982 _2.label++; 23983 return { value: op[1], done: false }; 23984 case 5: 23985 _2.label++; 23986 y2 = op[1]; 23987 op = [0]; 23988 continue; 23989 case 7: 23990 op = _2.ops.pop(); 23991 _2.trys.pop(); 23992 continue; 23993 default: 23994 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 23995 _2 = 0; 23996 continue; 23997 } 23998 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 23999 _2.label = op[1]; 24000 break; 24001 } 24002 if (op[0] === 6 && _2.label < t2[1]) { 24003 _2.label = t2[1]; 24004 t2 = op; 24005 break; 24006 } 24007 if (t2 && _2.label < t2[2]) { 24008 _2.label = t2[2]; 24009 _2.ops.push(op); 24010 break; 24011 } 24012 if (t2[2]) _2.ops.pop(); 24013 _2.trys.pop(); 24014 continue; 24015 } 24016 op = body.call(thisArg, _2); 24017 } catch (e2) { 24018 op = [6, e2]; 24019 y2 = 0; 24020 } finally { 24021 f2 = t2 = 0; 24022 } 24023 if (op[0] & 5) throw op[1]; 24024 return { value: op[0] ? op[1] : void 0, done: true }; 24025 } 24026 }; 24027 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 24028 return mod && mod.__esModule ? mod : { "default": mod }; 24029 }; 24030 Object.defineProperty(Synonym, "__esModule", { value: true }); 24031 var Collections_1 = __importDefault(requireCollections()); 24032 var Synonyms_1 = __importDefault(requireSynonyms()); 24033 var Synonym$1 = ( 24034 /** @class */ 24035 function() { 24036 function Synonym2(collectionName, synonymId, apiCall) { 24037 this.collectionName = collectionName; 24038 this.synonymId = synonymId; 24039 this.apiCall = apiCall; 24040 } 24041 Synonym2.prototype.retrieve = function() { 24042 return __awaiter(this, void 0, void 0, function() { 24043 return __generator(this, function(_a2) { 24044 return [2, this.apiCall.get(this.endpointPath())]; 24045 }); 24046 }); 24047 }; 24048 Synonym2.prototype.delete = function() { 24049 return __awaiter(this, void 0, void 0, function() { 24050 return __generator(this, function(_a2) { 24051 return [2, this.apiCall.delete(this.endpointPath())]; 24052 }); 24053 }); 24054 };
24055 Synonym2.prototype.endpointPath = function() { 24056 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(Synonyms_1.default.RESOURCEPATH, "/").concat(this.synonymId); 24057 }; 24058 return Synonym2; 24059 }() 24060 ); 24061 Synonym.default = Synonym$1; 24062 return Synonym; 24063} 24064var Document$1 = {}; 24065var hasRequiredDocument; 24066function requireDocument() { 24067 if (hasRequiredDocument) return Document$1; 24068 hasRequiredDocument = 1; 24069 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24070 function adopt(value) { 24071 return value instanceof P2 ? value : new P2(function(resolve) { 24072 resolve(value); 24073 }); 24074 } 24075 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24076 function fulfilled(value) { 24077 try { 24078 step(generator.next(value)); 24079 } catch (e2) { 24080 reject(e2); 24081 } 24082 } 24083 function rejected(value) { 24084 try { 24085 step(generator["throw"](value)); 24086 } catch (e2) { 24087 reject(e2); 24088 } 24089 } 24090 function step(result) { 24091 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24092 } 24093 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24094 }); 24095 }; 24096 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24097 var _2 = { label: 0, sent: function() { 24098 if (t2[0] & 1) throw t2[1]; 24099 return t2[1]; 24100 }, trys: [], ops: [] }, f2, y2, t2, g2; 24101 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24102 return this; 24103 }), g2; 24104 function verb(n2) { 24105 return function(v2) { 24106 return step([n2, v2]); 24107 }; 24108 } 24109 function step(op) { 24110 if (f2) throw new TypeError("Generator is already executing."); 24111 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24112 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24113 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24114 switch (op[0]) { 24115 case 0: 24116 case 1: 24117 t2 = op; 24118 break; 24119 case 4: 24120 _2.label++; 24121 return { value: op[1], done: false }; 24122 case 5: 24123 _2.label++; 24124 y2 = op[1]; 24125 op = [0]; 24126 continue; 24127 case 7: 24128 op = _2.ops.pop(); 24129 _2.trys.pop(); 24130 continue; 24131 default: 24132 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24133 _2 = 0; 24134 continue; 24135 } 24136 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24137 _2.label = op[1]; 24138 break; 24139 } 24140 if (op[0] === 6 && _2.label < t2[1]) { 24141 _2.label = t2[1]; 24142 t2 = op; 24143 break; 24144 } 24145 if (t2 && _2.label < t2[2]) { 24146 _2.label = t2[2]; 24147 _2.ops.push(op); 24148 break; 24149 } 24150 if (t2[2]) _2.ops.pop(); 24151 _2.trys.pop(); 24152 continue; 24153 } 24154 op = body.call(thisArg, _2); 24155 } catch (e2) { 24156 op = [6, e2]; 24157 y2 = 0; 24158 } finally { 24159 f2 = t2 = 0; 24160 } 24161 if (op[0] & 5) throw op[1]; 24162 return { value: op[0] ? op[1] : void 0, done: true }; 24163 } 24164 }; 24165 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 24166 return mod && mod.__esModule ? mod : { "default": mod }; 24167 }; 24168 Object.defineProperty(Document$1, "__esModule", { value: true }); 24169 Document$1.Document = void 0; 24170 var Collections_1 = __importDefault(requireCollections()); 24171 var Documents_1 = __importDefault(requireDocuments()); 24172 var Document2 = ( 24173 /** @class */ 24174 function() { 24175 function Document3(collectionName, documentId, apiCall) { 24176 this.collectionName = collectionName; 24177 this.documentId = documentId; 24178 this.apiCall = apiCall; 24179 } 24180 Document3.prototype.retrieve = function() { 24181 return __awaiter(this, void 0, void 0, function() { 24182 return __generator(this, function(_a2) { 24183 return [2, this.apiCall.get(this.endpointPath())]; 24184 }); 24185 }); 24186 }; 24187 Document3.prototype.delete = function() { 24188 return __awaiter(this, void 0, void 0, function() { 24189 return __generator(this, function(_a2) { 24190 return [2, this.apiCall.delete(this.endpointPath())]; 24191 }); 24192 }); 24193 }; 24194 Document3.prototype.update = function(partialDocument, options) { 24195 if (options === void 0) { 24196 options = {}; 24197 } 24198 return __awaiter(this, void 0, void 0, function() { 24199 return __generator(this, function(_a2) { 24200 return [2, this.apiCall.patch(this.endpointPath(), partialDocument, options)]; 24201 }); 24202 }); 24203 };
24204 Document3.prototype.endpointPath = function() { 24205 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.collectionName).concat(Documents_1.default.RESOURCEPATH, "/").concat(this.documentId); 24206 }; 24207 return Document3; 24208 }() 24209 ); 24210 Document$1.Document = Document2; 24211 return Document$1; 24212} 24213var hasRequiredCollection; 24214function requireCollection() { 24215 if (hasRequiredCollection) return Collection; 24216 hasRequiredCollection = 1; 24217 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24218 function adopt(value) { 24219 return value instanceof P2 ? value : new P2(function(resolve) { 24220 resolve(value); 24221 }); 24222 } 24223 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24224 function fulfilled(value) { 24225 try { 24226 step(generator.next(value)); 24227 } catch (e2) { 24228 reject(e2); 24229 } 24230 } 24231 function rejected(value) { 24232 try { 24233 step(generator["throw"](value)); 24234 } catch (e2) { 24235 reject(e2); 24236 } 24237 } 24238 function step(result) { 24239 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24240 } 24241 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24242 }); 24243 }; 24244 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24245 var _2 = { label: 0, sent: function() { 24246 if (t2[0] & 1) throw t2[1]; 24247 return t2[1]; 24248 }, trys: [], ops: [] }, f2, y2, t2, g2; 24249 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24250 return this; 24251 }), g2; 24252 function verb(n2) { 24253 return function(v2) { 24254 return step([n2, v2]); 24255 }; 24256 } 24257 function step(op) { 24258 if (f2) throw new TypeError("Generator is already executing."); 24259 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24260 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24261 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24262 switch (op[0]) { 24263 case 0: 24264 case 1: 24265 t2 = op; 24266 break; 24267 case 4: 24268 _2.label++; 24269 return { value: op[1], done: false }; 24270 case 5: 24271 _2.label++; 24272 y2 = op[1]; 24273 op = [0]; 24274 continue; 24275 case 7: 24276 op = _2.ops.pop(); 24277 _2.trys.pop(); 24278 continue; 24279 default: 24280 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24281 _2 = 0; 24282 continue; 24283 } 24284 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24285 _2.label = op[1]; 24286 break; 24287 } 24288 if (op[0] === 6 && _2.label < t2[1]) { 24289 _2.label = t2[1]; 24290 t2 = op; 24291 break; 24292 } 24293 if (t2 && _2.label < t2[2]) { 24294 _2.label = t2[2]; 24295 _2.ops.push(op); 24296 break; 24297 } 24298 if (t2[2]) _2.ops.pop(); 24299 _2.trys.pop(); 24300 continue; 24301 } 24302 op = body.call(thisArg, _2); 24303 } catch (e2) { 24304 op = [6, e2]; 24305 y2 = 0; 24306 } finally { 24307 f2 = t2 = 0; 24308 } 24309 if (op[0] & 5) throw op[1]; 24310 return { value: op[0] ? op[1] : void 0, done: true }; 24311 } 24312 }; 24313 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 24314 return mod && mod.__esModule ? mod : { "default": mod }; 24315 }; 24316 Object.defineProperty(Collection, "__esModule", { value: true }); 24317 var Collections_1 = __importDefault(requireCollections()); 24318 var Documents_1 = __importDefault(requireDocuments()); 24319 var Errors_1 = requireErrors(); 24320 var Overrides_1 = __importDefault(requireOverrides()); 24321 var Override_1 = __importDefault(requireOverride()); 24322 var Synonyms_1 = __importDefault(requireSynonyms()); 24323 var Synonym_1 = __importDefault(requireSynonym()); 24324 var Document_1 = requireDocument(); 24325 var Collection$1 = ( 24326 /** @class */ 24327 function() { 24328 function Collection2(name, apiCall, configuration) { 24329 this.name = name; 24330 this.apiCall = apiCall; 24331 this.configuration = configuration; 24332 this.individualDocuments = {}; 24333 this.individualOverrides = {}; 24334 this.individualSynonyms = {}; 24335 this.name = name; 24336 this.apiCall = apiCall; 24337 this.configuration = configuration; 24338 this._documents = new Documents_1.default(this.name, this.apiCall, this.configuration); 24339 this._overrides = new Overrides_1.default(this.name, this.apiCall); 24340 this._synonyms = new Synonyms_1.default(this.name, this.apiCall); 24341 } 24342 Collection2.prototype.retrieve = function() { 24343 return __awaiter(this, void 0, void 0, function() { 24344 return __generator(this, function(_a2) { 24345 return [2, this.apiCall.get(this.endpointPath())]; 24346 }); 24347 }); 24348 }; 24349 Collection2.prototype.update = function(schema) { 24350 return __awaiter(this, void 0, void 0, function() { 24351 return __generator(this, function(_a2) { 24352 return [2, this.apiCall.patch(this.endpointPath(), schema)]; 24353 }); 24354 }); 24355 }; 24356 Collection2.prototype.delete = function() { 24357 return __awaiter(this, void 0, void 0, function() { 24358 return __generator(this, function(_a2) { 24359 return [2, this.apiCall.delete(this.endpointPath())]; 24360 }); 24361 }); 24362 }; 24363 Collection2.prototype.exists = function() { 24364 return __awaiter(this, void 0, void 0, function() { 24365 var e_1; 24366 return __generator(this, function(_a2) { 24367 switch (_a2.label) { 24368 case 0: 24369 _a2.trys.push([0, 2, , 3]); 24370 return [4, this.retrieve()]; 24371 case 1: 24372 _a2.sent(); 24373 return [2, true]; 24374 case 2: 24375 e_1 = _a2.sent(); 24376 if (e_1 instanceof Errors_1.ObjectNotFound) 24377 return [2, false]; 24378 throw e_1; 24379 case 3: 24380 return [ 24381 2 24382 /*return*/ 24383 ]; 24384 } 24385 }); 24386 }); 24387 }; 24388 Collection2.prototype.documents = function(documentId) { 24389 if (!documentId) { 24390 return this._documents; 24391 } else { 24392 if (this.individualDocuments[documentId] === void 0) { 24393 this.individualDocuments[documentId] = new Document_1.Document(this.name, documentId, this.apiCall); 24394 } 24395 return this.individualDocuments[documentId]; 24396 } 24397 }; 24398 Collection2.prototype.overrides = function(overrideId) { 24399 if (overrideId === void 0) { 24400 return this._overrides; 24401 } else { 24402 if (this.individualOverrides[overrideId] === void 0) { 24403 this.individualOverrides[overrideId] = new Override_1.default(this.name, overrideId, this.apiCall); 24404 } 24405 return this.individualOverrides[overrideId]; 24406 } 24407 }; 24408 Collection2.prototype.synonyms = function(synonymId) { 24409 if (synonymId === void 0) { 24410 return this._synonyms; 24411 } else { 24412 if (this.individualSynonyms[synonymId] === void 0) { 24413 this.individualSynonyms[synonymId] = new Synonym_1.default(this.name, synonymId, this.apiCall); 24414 } 24415 return this.individualSynonyms[synonymId]; 24416 } 24417 };
24418 Collection2.prototype.endpointPath = function() { 24419 return "".concat(Collections_1.default.RESOURCEPATH, "/").concat(this.name); 24420 }; 24421 return Collection2; 24422 }() 24423 ); 24424 Collection.default = Collection$1; 24425 return Collection; 24426} 24427var Aliases = {}; 24428var hasRequiredAliases; 24429function requireAliases() { 24430 if (hasRequiredAliases) return Aliases; 24431 hasRequiredAliases = 1; 24432 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24433 function adopt(value) { 24434 return value instanceof P2 ? value : new P2(function(resolve) { 24435 resolve(value); 24436 }); 24437 } 24438 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24439 function fulfilled(value) { 24440 try { 24441 step(generator.next(value)); 24442 } catch (e2) { 24443 reject(e2); 24444 } 24445 } 24446 function rejected(value) { 24447 try { 24448 step(generator["throw"](value)); 24449 } catch (e2) { 24450 reject(e2); 24451 } 24452 } 24453 function step(result) { 24454 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24455 } 24456 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24457 }); 24458 }; 24459 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24460 var _2 = { label: 0, sent: function() { 24461 if (t2[0] & 1) throw t2[1]; 24462 return t2[1]; 24463 }, trys: [], ops: [] }, f2, y2, t2, g2; 24464 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24465 return this; 24466 }), g2; 24467 function verb(n2) { 24468 return function(v2) { 24469 return step([n2, v2]); 24470 }; 24471 } 24472 function step(op) { 24473 if (f2) throw new TypeError("Generator is already executing."); 24474 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24475 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24476 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24477 switch (op[0]) { 24478 case 0: 24479 case 1: 24480 t2 = op; 24481 break; 24482 case 4: 24483 _2.label++; 24484 return { value: op[1], done: false }; 24485 case 5: 24486 _2.label++; 24487 y2 = op[1]; 24488 op = [0]; 24489 continue; 24490 case 7: 24491 op = _2.ops.pop(); 24492 _2.trys.pop(); 24493 continue; 24494 default: 24495 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24496 _2 = 0; 24497 continue; 24498 } 24499 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24500 _2.label = op[1]; 24501 break; 24502 } 24503 if (op[0] === 6 && _2.label < t2[1]) { 24504 _2.label = t2[1]; 24505 t2 = op; 24506 break; 24507 } 24508 if (t2 && _2.label < t2[2]) { 24509 _2.label = t2[2]; 24510 _2.ops.push(op); 24511 break; 24512 } 24513 if (t2[2]) _2.ops.pop(); 24514 _2.trys.pop(); 24515 continue; 24516 } 24517 op = body.call(thisArg, _2); 24518 } catch (e2) { 24519 op = [6, e2]; 24520 y2 = 0; 24521 } finally { 24522 f2 = t2 = 0; 24523 } 24524 if (op[0] & 5) throw op[1]; 24525 return { value: op[0] ? op[1] : void 0, done: true }; 24526 } 24527 }; 24528 Object.defineProperty(Aliases, "__esModule", { value: true }); 24529 var RESOURCEPATH = "/aliases"; 24530 var Aliases$1 = ( 24531 /** @class */ 24532 function() { 24533 function Aliases2(apiCall) { 24534 this.apiCall = apiCall; 24535 } 24536 Aliases2.prototype.upsert = function(name, mapping) { 24537 return __awaiter(this, void 0, void 0, function() { 24538 return __generator(this, function(_a2) { 24539 return [2, this.apiCall.put(this.endpointPath(name), mapping)]; 24540 }); 24541 }); 24542 }; 24543 Aliases2.prototype.retrieve = function() { 24544 return __awaiter(this, void 0, void 0, function() { 24545 return __generator(this, function(_a2) { 24546 return [2, this.apiCall.get(RESOURCEPATH)]; 24547 }); 24548 }); 24549 };
24550 Aliases2.prototype.endpointPath = function(aliasName) { 24551 return "".concat(Aliases2.RESOURCEPATH, "/").concat(aliasName); 24552 }; 24553 Object.defineProperty(Aliases2, "RESOURCEPATH", { 24554 get: function() { 24555 return RESOURCEPATH; 24556 }, 24557 enumerable: false, 24558 configurable: true 24559 }); 24560 return Aliases2; 24561 }() 24562 ); 24563 Aliases.default = Aliases$1; 24564 return Aliases; 24565} 24566var Alias = {}; 24567var hasRequiredAlias; 24568function requireAlias() { 24569 if (hasRequiredAlias) return Alias; 24570 hasRequiredAlias = 1; 24571 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24572 function adopt(value) { 24573 return value instanceof P2 ? value : new P2(function(resolve) { 24574 resolve(value); 24575 }); 24576 } 24577 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24578 function fulfilled(value) { 24579 try { 24580 step(generator.next(value)); 24581 } catch (e2) { 24582 reject(e2); 24583 } 24584 } 24585 function rejected(value) { 24586 try { 24587 step(generator["throw"](value)); 24588 } catch (e2) { 24589 reject(e2); 24590 } 24591 } 24592 function step(result) { 24593 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24594 } 24595 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24596 }); 24597 }; 24598 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24599 var _2 = { label: 0, sent: function() { 24600 if (t2[0] & 1) throw t2[1]; 24601 return t2[1]; 24602 }, trys: [], ops: [] }, f2, y2, t2, g2; 24603 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24604 return this; 24605 }), g2; 24606 function verb(n2) { 24607 return function(v2) { 24608 return step([n2, v2]); 24609 }; 24610 } 24611 function step(op) { 24612 if (f2) throw new TypeError("Generator is already executing."); 24613 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24614 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24615 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24616 switch (op[0]) { 24617 case 0: 24618 case 1: 24619 t2 = op; 24620 break; 24621 case 4: 24622 _2.label++; 24623 return { value: op[1], done: false }; 24624 case 5: 24625 _2.label++; 24626 y2 = op[1]; 24627 op = [0]; 24628 continue; 24629 case 7: 24630 op = _2.ops.pop(); 24631 _2.trys.pop(); 24632 continue; 24633 default: 24634 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24635 _2 = 0; 24636 continue; 24637 } 24638 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24639 _2.label = op[1]; 24640 break; 24641 } 24642 if (op[0] === 6 && _2.label < t2[1]) { 24643 _2.label = t2[1]; 24644 t2 = op; 24645 break; 24646 } 24647 if (t2 && _2.label < t2[2]) { 24648 _2.label = t2[2]; 24649 _2.ops.push(op); 24650 break; 24651 } 24652 if (t2[2]) _2.ops.pop(); 24653 _2.trys.pop(); 24654 continue; 24655 } 24656 op = body.call(thisArg, _2); 24657 } catch (e2) { 24658 op = [6, e2]; 24659 y2 = 0; 24660 } finally { 24661 f2 = t2 = 0; 24662 } 24663 if (op[0] & 5) throw op[1]; 24664 return { value: op[0] ? op[1] : void 0, done: true }; 24665 } 24666 }; 24667 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 24668 return mod && mod.__esModule ? mod : { "default": mod }; 24669 }; 24670 Object.defineProperty(Alias, "__esModule", { value: true }); 24671 var Aliases_1 = __importDefault(requireAliases()); 24672 var Alias$1 = ( 24673 /** @class */ 24674 function() { 24675 function Alias2(name, apiCall) { 24676 this.name = name; 24677 this.apiCall = apiCall; 24678 } 24679 Alias2.prototype.retrieve = function() { 24680 return __awaiter(this, void 0, void 0, function() { 24681 return __generator(this, function(_a2) { 24682 return [2, this.apiCall.get(this.endpointPath())]; 24683 }); 24684 }); 24685 }; 24686 Alias2.prototype.delete = function() { 24687 return __awaiter(this, void 0, void 0, function() { 24688 return __generator(this, function(_a2) { 24689 return [2, this.apiCall.delete(this.endpointPath())]; 24690 }); 24691 }); 24692 };
24693 Alias2.prototype.endpointPath = function() { 24694 return "".concat(Aliases_1.default.RESOURCEPATH, "/").concat(this.name); 24695 }; 24696 return Alias2; 24697 }() 24698 ); 24699 Alias.default = Alias$1; 24700 return Alias; 24701} 24702var Keys = {}; 24703const __viteBrowserExternal = {}; 24704const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 24705 __proto__: null, 24706 default: __viteBrowserExternal 24707}, Symbol.toStringTag, { value: "Module" })); 24708const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1); 24709var hasRequiredKeys; 24710function requireKeys() { 24711 if (hasRequiredKeys) return Keys; 24712 hasRequiredKeys = 1; 24713 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24714 function adopt(value) { 24715 return value instanceof P2 ? value : new P2(function(resolve) { 24716 resolve(value); 24717 }); 24718 } 24719 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24720 function fulfilled(value) { 24721 try { 24722 step(generator.next(value)); 24723 } catch (e2) { 24724 reject(e2); 24725 } 24726 } 24727 function rejected(value) { 24728 try { 24729 step(generator["throw"](value)); 24730 } catch (e2) { 24731 reject(e2); 24732 } 24733 } 24734 function step(result) { 24735 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24736 } 24737 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24738 }); 24739 }; 24740 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24741 var _2 = { label: 0, sent: function() { 24742 if (t2[0] & 1) throw t2[1]; 24743 return t2[1]; 24744 }, trys: [], ops: [] }, f2, y2, t2, g2; 24745 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24746 return this; 24747 }), g2; 24748 function verb(n2) { 24749 return function(v2) { 24750 return step([n2, v2]); 24751 }; 24752 } 24753 function step(op) { 24754 if (f2) throw new TypeError("Generator is already executing."); 24755 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24756 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24757 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24758 switch (op[0]) { 24759 case 0: 24760 case 1: 24761 t2 = op; 24762 break; 24763 case 4: 24764 _2.label++; 24765 return { value: op[1], done: false }; 24766 case 5: 24767 _2.label++; 24768 y2 = op[1]; 24769 op = [0]; 24770 continue; 24771 case 7: 24772 op = _2.ops.pop(); 24773 _2.trys.pop(); 24774 continue; 24775 default: 24776 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24777 _2 = 0; 24778 continue; 24779 } 24780 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24781 _2.label = op[1]; 24782 break; 24783 } 24784 if (op[0] === 6 && _2.label < t2[1]) { 24785 _2.label = t2[1]; 24786 t2 = op; 24787 break; 24788 } 24789 if (t2 && _2.label < t2[2]) { 24790 _2.label = t2[2]; 24791 _2.ops.push(op); 24792 break; 24793 } 24794 if (t2[2]) _2.ops.pop(); 24795 _2.trys.pop(); 24796 continue; 24797 } 24798 op = body.call(thisArg, _2); 24799 } catch (e2) { 24800 op = [6, e2]; 24801 y2 = 0; 24802 } finally { 24803 f2 = t2 = 0; 24804 } 24805 if (op[0] & 5) throw op[1]; 24806 return { value: op[0] ? op[1] : void 0, done: true }; 24807 } 24808 }; 24809 Object.defineProperty(Keys, "__esModule", { value: true }); 24810 var crypto_1 = require$$0; 24811 var RESOURCEPATH = "/keys"; 24812 var Keys$1 = ( 24813 /** @class */ 24814 function() { 24815 function Keys2(apiCall) { 24816 this.apiCall = apiCall; 24817 this.apiCall = apiCall; 24818 } 24819 Keys2.prototype.create = function(params) { 24820 return __awaiter(this, void 0, void 0, function() { 24821 return __generator(this, function(_a2) { 24822 return [2, this.apiCall.post(Keys2.RESOURCEPATH, params)]; 24823 }); 24824 }); 24825 }; 24826 Keys2.prototype.retrieve = function() { 24827 return __awaiter(this, void 0, void 0, function() { 24828 return __generator(this, function(_a2) { 24829 return [2, this.apiCall.get(RESOURCEPATH)]; 24830 }); 24831 }); 24832 }; 24833 Keys2.prototype.generateScopedSearchKey = function(searchKey, parameters) {
24834 var paramsJSON = JSON.stringify(parameters); 24835 var digest = Buffer.from((0, crypto_1.createHmac)("sha256", searchKey).update(paramsJSON).digest("base64")); 24836 var keyPrefix = searchKey.substr(0, 4); 24837 var rawScopedKey = "".concat(digest).concat(keyPrefix).concat(paramsJSON); 24838 return Buffer.from(rawScopedKey).toString("base64"); 24839 }; 24840 Object.defineProperty(Keys2, "RESOURCEPATH", { 24841 get: function() { 24842 return RESOURCEPATH; 24843 }, 24844 enumerable: false, 24845 configurable: true 24846 }); 24847 return Keys2; 24848 }() 24849 ); 24850 Keys.default = Keys$1; 24851 return Keys; 24852} 24853var Key = {}; 24854var hasRequiredKey; 24855function requireKey() { 24856 if (hasRequiredKey) return Key; 24857 hasRequiredKey = 1; 24858 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24859 function adopt(value) { 24860 return value instanceof P2 ? value : new P2(function(resolve) { 24861 resolve(value); 24862 }); 24863 } 24864 return new (P2 || (P2 = Promise))(function(resolve, reject) { 24865 function fulfilled(value) { 24866 try { 24867 step(generator.next(value)); 24868 } catch (e2) { 24869 reject(e2); 24870 } 24871 } 24872 function rejected(value) { 24873 try { 24874 step(generator["throw"](value)); 24875 } catch (e2) { 24876 reject(e2); 24877 } 24878 } 24879 function step(result) { 24880 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 24881 } 24882 step((generator = generator.apply(thisArg, _arguments || [])).next()); 24883 }); 24884 }; 24885 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 24886 var _2 = { label: 0, sent: function() { 24887 if (t2[0] & 1) throw t2[1]; 24888 return t2[1]; 24889 }, trys: [], ops: [] }, f2, y2, t2, g2; 24890 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 24891 return this; 24892 }), g2; 24893 function verb(n2) { 24894 return function(v2) { 24895 return step([n2, v2]); 24896 }; 24897 } 24898 function step(op) { 24899 if (f2) throw new TypeError("Generator is already executing."); 24900 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 24901 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 24902 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 24903 switch (op[0]) { 24904 case 0: 24905 case 1: 24906 t2 = op; 24907 break; 24908 case 4: 24909 _2.label++; 24910 return { value: op[1], done: false }; 24911 case 5: 24912 _2.label++; 24913 y2 = op[1]; 24914 op = [0]; 24915 continue; 24916 case 7: 24917 op = _2.ops.pop(); 24918 _2.trys.pop(); 24919 continue; 24920 default: 24921 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 24922 _2 = 0; 24923 continue; 24924 } 24925 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 24926 _2.label = op[1]; 24927 break; 24928 } 24929 if (op[0] === 6 && _2.label < t2[1]) { 24930 _2.label = t2[1]; 24931 t2 = op; 24932 break; 24933 } 24934 if (t2 && _2.label < t2[2]) { 24935 _2.label = t2[2]; 24936 _2.ops.push(op); 24937 break; 24938 } 24939 if (t2[2]) _2.ops.pop(); 24940 _2.trys.pop(); 24941 continue; 24942 } 24943 op = body.call(thisArg, _2); 24944 } catch (e2) { 24945 op = [6, e2]; 24946 y2 = 0; 24947 } finally { 24948 f2 = t2 = 0; 24949 } 24950 if (op[0] & 5) throw op[1]; 24951 return { value: op[0] ? op[1] : void 0, done: true }; 24952 } 24953 }; 24954 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 24955 return mod && mod.__esModule ? mod : { "default": mod }; 24956 }; 24957 Object.defineProperty(Key, "__esModule", { value: true }); 24958 var Keys_1 = __importDefault(requireKeys()); 24959 var Key$1 = ( 24960 /** @class */ 24961 function() { 24962 function Key2(id2, apiCall) { 24963 this.id = id2; 24964 this.apiCall = apiCall; 24965 } 24966 Key2.prototype.retrieve = function() { 24967 return __awaiter(this, void 0, void 0, function() { 24968 return __generator(this, function(_a2) { 24969 return [2, this.apiCall.get(this.endpointPath())]; 24970 }); 24971 }); 24972 }; 24973 Key2.prototype.delete = function() { 24974 return __awaiter(this, void 0, void 0, function() { 24975 return __generator(this, function(_a2) { 24976 return [2, this.apiCall.delete(this.endpointPath())]; 24977 }); 24978 }); 24979 };
24980 Key2.prototype.endpointPath = function() { 24981 return "".concat(Keys_1.default.RESOURCEPATH, "/").concat(this.id); 24982 }; 24983 return Key2; 24984 }() 24985 ); 24986 Key.default = Key$1; 24987 return Key; 24988} 24989var Debug = {}; 24990var hasRequiredDebug; 24991function requireDebug() { 24992 if (hasRequiredDebug) return Debug; 24993 hasRequiredDebug = 1; 24994 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 24995 function adopt(value) { 24996 return value instanceof P2 ? value : new P2(function(resolve) { 24997 resolve(value); 24998 }); 24999 } 25000 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25001 function fulfilled(value) { 25002 try { 25003 step(generator.next(value)); 25004 } catch (e2) { 25005 reject(e2); 25006 } 25007 } 25008 function rejected(value) { 25009 try { 25010 step(generator["throw"](value)); 25011 } catch (e2) { 25012 reject(e2); 25013 } 25014 } 25015 function step(result) { 25016 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25017 } 25018 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25019 }); 25020 }; 25021 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25022 var _2 = { label: 0, sent: function() { 25023 if (t2[0] & 1) throw t2[1]; 25024 return t2[1]; 25025 }, trys: [], ops: [] }, f2, y2, t2, g2; 25026 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25027 return this; 25028 }), g2; 25029 function verb(n2) { 25030 return function(v2) { 25031 return step([n2, v2]); 25032 }; 25033 } 25034 function step(op) { 25035 if (f2) throw new TypeError("Generator is already executing."); 25036 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25037 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25038 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25039 switch (op[0]) { 25040 case 0: 25041 case 1: 25042 t2 = op; 25043 break; 25044 case 4: 25045 _2.label++; 25046 return { value: op[1], done: false }; 25047 case 5: 25048 _2.label++; 25049 y2 = op[1]; 25050 op = [0]; 25051 continue; 25052 case 7: 25053 op = _2.ops.pop(); 25054 _2.trys.pop(); 25055 continue; 25056 default: 25057 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25058 _2 = 0; 25059 continue; 25060 } 25061 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25062 _2.label = op[1]; 25063 break; 25064 } 25065 if (op[0] === 6 && _2.label < t2[1]) { 25066 _2.label = t2[1]; 25067 t2 = op; 25068 break; 25069 } 25070 if (t2 && _2.label < t2[2]) { 25071 _2.label = t2[2]; 25072 _2.ops.push(op); 25073 break; 25074 } 25075 if (t2[2]) _2.ops.pop(); 25076 _2.trys.pop(); 25077 continue; 25078 } 25079 op = body.call(thisArg, _2); 25080 } catch (e2) { 25081 op = [6, e2]; 25082 y2 = 0; 25083 } finally { 25084 f2 = t2 = 0; 25085 } 25086 if (op[0] & 5) throw op[1]; 25087 return { value: op[0] ? op[1] : void 0, done: true }; 25088 } 25089 }; 25090 Object.defineProperty(Debug, "__esModule", { value: true }); 25091 var RESOURCEPATH = "/debug"; 25092 var Debug$1 = ( 25093 /** @class */ 25094 function() { 25095 function Debug2(apiCall) { 25096 this.apiCall = apiCall; 25097 } 25098 Debug2.prototype.retrieve = function() { 25099 return __awaiter(this, void 0, void 0, function() { 25100 return __generator(this, function(_a2) { 25101 return [2, this.apiCall.get(RESOURCEPATH)]; 25102 }); 25103 }); 25104 }; 25105 return Debug2; 25106 }() 25107 ); 25108 Debug.default = Debug$1; 25109 return Debug; 25110} 25111var Metrics = {}; 25112var hasRequiredMetrics; 25113function requireMetrics() { 25114 if (hasRequiredMetrics) return Metrics; 25115 hasRequiredMetrics = 1; 25116 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25117 function adopt(value) { 25118 return value instanceof P2 ? value : new P2(function(resolve) { 25119 resolve(value); 25120 }); 25121 } 25122 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25123 function fulfilled(value) { 25124 try { 25125 step(generator.next(value)); 25126 } catch (e2) { 25127 reject(e2); 25128 } 25129 } 25130 function rejected(value) { 25131 try { 25132 step(generator["throw"](value)); 25133 } catch (e2) { 25134 reject(e2); 25135 } 25136 } 25137 function step(result) { 25138 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25139 } 25140 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25141 }); 25142 }; 25143 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25144 var _2 = { label: 0, sent: function() { 25145 if (t2[0] & 1) throw t2[1]; 25146 return t2[1]; 25147 }, trys: [], ops: [] }, f2, y2, t2, g2; 25148 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25149 return this; 25150 }), g2; 25151 function verb(n2) { 25152 return function(v2) { 25153 return step([n2, v2]); 25154 }; 25155 } 25156 function step(op) { 25157 if (f2) throw new TypeError("Generator is already executing."); 25158 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25159 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25160 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25161 switch (op[0]) { 25162 case 0: 25163 case 1: 25164 t2 = op; 25165 break; 25166 case 4: 25167 _2.label++; 25168 return { value: op[1], done: false }; 25169 case 5: 25170 _2.label++; 25171 y2 = op[1]; 25172 op = [0]; 25173 continue; 25174 case 7: 25175 op = _2.ops.pop(); 25176 _2.trys.pop(); 25177 continue; 25178 default: 25179 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25180 _2 = 0; 25181 continue; 25182 } 25183 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25184 _2.label = op[1]; 25185 break; 25186 } 25187 if (op[0] === 6 && _2.label < t2[1]) { 25188 _2.label = t2[1]; 25189 t2 = op; 25190 break; 25191 } 25192 if (t2 && _2.label < t2[2]) { 25193 _2.label = t2[2]; 25194 _2.ops.push(op); 25195 break; 25196 } 25197 if (t2[2]) _2.ops.pop(); 25198 _2.trys.pop(); 25199 continue; 25200 } 25201 op = body.call(thisArg, _2); 25202 } catch (e2) { 25203 op = [6, e2]; 25204 y2 = 0; 25205 } finally { 25206 f2 = t2 = 0; 25207 } 25208 if (op[0] & 5) throw op[1];
25209 return { value: op[0] ? op[1] : void 0, done: true }; 25210 } 25211 }; 25212 Object.defineProperty(Metrics, "__esModule", { value: true }); 25213 var RESOURCEPATH = "/metrics.json"; 25214 var Metrics$1 = ( 25215 /** @class */ 25216 function() { 25217 function Metrics2(apiCall) { 25218 this.apiCall = apiCall; 25219 } 25220 Metrics2.prototype.retrieve = function() { 25221 return __awaiter(this, void 0, void 0, function() { 25222 return __generator(this, function(_a2) { 25223 return [2, this.apiCall.get(RESOURCEPATH)]; 25224 }); 25225 }); 25226 }; 25227 return Metrics2; 25228 }() 25229 ); 25230 Metrics.default = Metrics$1; 25231 return Metrics; 25232} 25233var Health = {}; 25234var hasRequiredHealth; 25235function requireHealth() { 25236 if (hasRequiredHealth) return Health; 25237 hasRequiredHealth = 1; 25238 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25239 function adopt(value) { 25240 return value instanceof P2 ? value : new P2(function(resolve) { 25241 resolve(value); 25242 }); 25243 } 25244 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25245 function fulfilled(value) { 25246 try { 25247 step(generator.next(value)); 25248 } catch (e2) { 25249 reject(e2); 25250 } 25251 } 25252 function rejected(value) { 25253 try { 25254 step(generator["throw"](value)); 25255 } catch (e2) { 25256 reject(e2); 25257 } 25258 } 25259 function step(result) { 25260 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25261 } 25262 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25263 }); 25264 }; 25265 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25266 var _2 = { label: 0, sent: function() { 25267 if (t2[0] & 1) throw t2[1]; 25268 return t2[1]; 25269 }, trys: [], ops: [] }, f2, y2, t2, g2; 25270 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25271 return this; 25272 }), g2; 25273 function verb(n2) { 25274 return function(v2) { 25275 return step([n2, v2]); 25276 }; 25277 } 25278 function step(op) { 25279 if (f2) throw new TypeError("Generator is already executing."); 25280 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25281 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25282 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25283 switch (op[0]) { 25284 case 0: 25285 case 1: 25286 t2 = op; 25287 break; 25288 case 4: 25289 _2.label++; 25290 return { value: op[1], done: false }; 25291 case 5: 25292 _2.label++; 25293 y2 = op[1]; 25294 op = [0]; 25295 continue; 25296 case 7: 25297 op = _2.ops.pop(); 25298 _2.trys.pop(); 25299 continue; 25300 default: 25301 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25302 _2 = 0; 25303 continue; 25304 } 25305 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25306 _2.label = op[1]; 25307 break; 25308 } 25309 if (op[0] === 6 && _2.label < t2[1]) { 25310 _2.label = t2[1]; 25311 t2 = op; 25312 break; 25313 } 25314 if (t2 && _2.label < t2[2]) { 25315 _2.label = t2[2]; 25316 _2.ops.push(op); 25317 break; 25318 } 25319 if (t2[2]) _2.ops.pop(); 25320 _2.trys.pop(); 25321 continue; 25322 } 25323 op = body.call(thisArg, _2); 25324 } catch (e2) { 25325 op = [6, e2]; 25326 y2 = 0; 25327 } finally { 25328 f2 = t2 = 0; 25329 } 25330 if (op[0] & 5) throw op[1]; 25331 return { value: op[0] ? op[1] : void 0, done: true }; 25332 } 25333 }; 25334 Object.defineProperty(Health, "__esModule", { value: true }); 25335 var RESOURCEPATH = "/health"; 25336 var Health$1 = ( 25337 /** @class */ 25338 function() { 25339 function Health2(apiCall) { 25340 this.apiCall = apiCall; 25341 } 25342 Health2.prototype.retrieve = function() { 25343 return __awaiter(this, void 0, void 0, function() { 25344 return __generator(this, function(_a2) { 25345 return [2, this.apiCall.get(RESOURCEPATH)]; 25346 }); 25347 }); 25348 }; 25349 return Health2; 25350 }() 25351 ); 25352 Health.default = Health$1; 25353 return Health; 25354} 25355var Operations = {}; 25356var hasRequiredOperations; 25357function requireOperations() { 25358 if (hasRequiredOperations) return Operations; 25359 hasRequiredOperations = 1; 25360 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25361 function adopt(value) { 25362 return value instanceof P2 ? value : new P2(function(resolve) { 25363 resolve(value); 25364 }); 25365 } 25366 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25367 function fulfilled(value) { 25368 try { 25369 step(generator.next(value)); 25370 } catch (e2) { 25371 reject(e2); 25372 } 25373 } 25374 function rejected(value) { 25375 try { 25376 step(generator["throw"](value)); 25377 } catch (e2) { 25378 reject(e2); 25379 } 25380 } 25381 function step(result) { 25382 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25383 } 25384 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25385 }); 25386 }; 25387 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25388 var _2 = { label: 0, sent: function() { 25389 if (t2[0] & 1) throw t2[1]; 25390 return t2[1]; 25391 }, trys: [], ops: [] }, f2, y2, t2, g2; 25392 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25393 return this; 25394 }), g2; 25395 function verb(n2) { 25396 return function(v2) { 25397 return step([n2, v2]); 25398 }; 25399 } 25400 function step(op) { 25401 if (f2) throw new TypeError("Generator is already executing."); 25402 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25403 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25404 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25405 switch (op[0]) { 25406 case 0: 25407 case 1: 25408 t2 = op; 25409 break; 25410 case 4: 25411 _2.label++; 25412 return { value: op[1], done: false }; 25413 case 5: 25414 _2.label++; 25415 y2 = op[1]; 25416 op = [0]; 25417 continue; 25418 case 7: 25419 op = _2.ops.pop(); 25420 _2.trys.pop(); 25421 continue; 25422 default: 25423 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25424 _2 = 0; 25425 continue; 25426 } 25427 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25428 _2.label = op[1]; 25429 break; 25430 } 25431 if (op[0] === 6 && _2.label < t2[1]) { 25432 _2.label = t2[1]; 25433 t2 = op; 25434 break; 25435 } 25436 if (t2 && _2.label < t2[2]) { 25437 _2.label = t2[2]; 25438 _2.ops.push(op); 25439 break; 25440 } 25441 if (t2[2]) _2.ops.pop(); 25442 _2.trys.pop(); 25443 continue; 25444 } 25445 op = body.call(thisArg, _2); 25446 } catch (e2) { 25447 op = [6, e2]; 25448 y2 = 0; 25449 } finally { 25450 f2 = t2 = 0; 25451 } 25452 if (op[0] & 5) throw op[1];
25453 return { value: op[0] ? op[1] : void 0, done: true }; 25454 } 25455 }; 25456 Object.defineProperty(Operations, "__esModule", { value: true }); 25457 var RESOURCEPATH = "/operations"; 25458 var Operations$1 = ( 25459 /** @class */ 25460 function() { 25461 function Operations2(apiCall) { 25462 this.apiCall = apiCall; 25463 } 25464 Operations2.prototype.perform = function(operationName, queryParameters) { 25465 if (queryParameters === void 0) { 25466 queryParameters = {}; 25467 } 25468 return __awaiter(this, void 0, void 0, function() { 25469 return __generator(this, function(_a2) { 25470 return [2, this.apiCall.post("".concat(RESOURCEPATH, "/").concat(operationName), {}, queryParameters)]; 25471 }); 25472 }); 25473 }; 25474 return Operations2; 25475 }() 25476 ); 25477 Operations.default = Operations$1; 25478 return Operations; 25479} 25480var MultiSearch = {}; 25481var hasRequiredMultiSearch; 25482function requireMultiSearch() { 25483 if (hasRequiredMultiSearch) return MultiSearch; 25484 hasRequiredMultiSearch = 1; 25485 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25486 function adopt(value) { 25487 return value instanceof P2 ? value : new P2(function(resolve) { 25488 resolve(value); 25489 }); 25490 } 25491 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25492 function fulfilled(value) { 25493 try { 25494 step(generator.next(value)); 25495 } catch (e2) { 25496 reject(e2); 25497 } 25498 } 25499 function rejected(value) { 25500 try { 25501 step(generator["throw"](value)); 25502 } catch (e2) { 25503 reject(e2); 25504 } 25505 } 25506 function step(result) { 25507 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25508 } 25509 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25510 }); 25511 }; 25512 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25513 var _2 = { label: 0, sent: function() { 25514 if (t2[0] & 1) throw t2[1]; 25515 return t2[1]; 25516 }, trys: [], ops: [] }, f2, y2, t2, g2; 25517 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25518 return this; 25519 }), g2; 25520 function verb(n2) { 25521 return function(v2) { 25522 return step([n2, v2]); 25523 }; 25524 } 25525 function step(op) { 25526 if (f2) throw new TypeError("Generator is already executing."); 25527 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25528 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25529 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25530 switch (op[0]) { 25531 case 0: 25532 case 1: 25533 t2 = op; 25534 break; 25535 case 4: 25536 _2.label++; 25537 return { value: op[1], done: false }; 25538 case 5: 25539 _2.label++; 25540 y2 = op[1]; 25541 op = [0]; 25542 continue; 25543 case 7: 25544 op = _2.ops.pop(); 25545 _2.trys.pop(); 25546 continue; 25547 default: 25548 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25549 _2 = 0; 25550 continue; 25551 } 25552 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25553 _2.label = op[1]; 25554 break; 25555 } 25556 if (op[0] === 6 && _2.label < t2[1]) { 25557 _2.label = t2[1]; 25558 t2 = op; 25559 break; 25560 } 25561 if (t2 && _2.label < t2[2]) { 25562 _2.label = t2[2]; 25563 _2.ops.push(op); 25564 break; 25565 } 25566 if (t2[2]) _2.ops.pop(); 25567 _2.trys.pop(); 25568 continue; 25569 } 25570 op = body.call(thisArg, _2); 25571 } catch (e2) { 25572 op = [6, e2]; 25573 y2 = 0; 25574 } finally { 25575 f2 = t2 = 0; 25576 } 25577 if (op[0] & 5) throw op[1]; 25578 return { value: op[0] ? op[1] : void 0, done: true }; 25579 } 25580 }; 25581 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 25582 return mod && mod.__esModule ? mod : { "default": mod }; 25583 }; 25584 Object.defineProperty(MultiSearch, "__esModule", { value: true }); 25585 var RequestWithCache_1 = __importDefault(requireRequestWithCache()); 25586 var RESOURCEPATH = "/multi_search"; 25587 var MultiSearch$1 = ( 25588 /** @class */ 25589 function() { 25590 function MultiSearch2(apiCall, configuration, useTextContentType) { 25591 if (useTextContentType === void 0) { 25592 useTextContentType = false;
25593 } 25594 this.apiCall = apiCall; 25595 this.configuration = configuration; 25596 this.useTextContentType = useTextContentType; 25597 this.requestWithCache = new RequestWithCache_1.default(); 25598 } 25599 MultiSearch2.prototype.clearCache = function() { 25600 this.requestWithCache.clearCache(); 25601 }; 25602 MultiSearch2.prototype.perform = function(searchRequests, commonParams, _a2) { 25603 if (commonParams === void 0) { 25604 commonParams = {}; 25605 } 25606 var _b2 = _a2 === void 0 ? {} : _a2, _c = _b2.cacheSearchResultsForSeconds, cacheSearchResultsForSeconds = _c === void 0 ? this.configuration.cacheSearchResultsForSeconds : _c; 25607 return __awaiter(this, void 0, void 0, function() { 25608 var additionalHeaders, additionalQueryParams, queryParams; 25609 return __generator(this, function(_d) { 25610 additionalHeaders = {}; 25611 if (this.useTextContentType) { 25612 additionalHeaders["content-type"] = "text/plain"; 25613 } 25614 additionalQueryParams = {}; 25615 if (this.configuration.useServerSideSearchCache === true) { 25616 additionalQueryParams["use_cache"] = true; 25617 } 25618 queryParams = Object.assign({}, commonParams, additionalQueryParams); 25619 return [2, this.requestWithCache.perform(this.apiCall, this.apiCall.post, [RESOURCEPATH, searchRequests, queryParams, additionalHeaders], { cacheResponseForSeconds: cacheSearchResultsForSeconds })]; 25620 }); 25621 }); 25622 }; 25623 return MultiSearch2; 25624 }() 25625 ); 25626 MultiSearch.default = MultiSearch$1; 25627 return MultiSearch; 25628} 25629var Presets = {}; 25630var hasRequiredPresets; 25631function requirePresets() { 25632 if (hasRequiredPresets) return Presets; 25633 hasRequiredPresets = 1; 25634 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25635 function adopt(value) { 25636 return value instanceof P2 ? value : new P2(function(resolve) { 25637 resolve(value); 25638 }); 25639 } 25640 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25641 function fulfilled(value) { 25642 try { 25643 step(generator.next(value)); 25644 } catch (e2) { 25645 reject(e2); 25646 } 25647 } 25648 function rejected(value) { 25649 try { 25650 step(generator["throw"](value)); 25651 } catch (e2) { 25652 reject(e2); 25653 } 25654 } 25655 function step(result) { 25656 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25657 } 25658 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25659 }); 25660 }; 25661 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25662 var _2 = { label: 0, sent: function() { 25663 if (t2[0] & 1) throw t2[1]; 25664 return t2[1]; 25665 }, trys: [], ops: [] }, f2, y2, t2, g2; 25666 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25667 return this; 25668 }), g2; 25669 function verb(n2) { 25670 return function(v2) { 25671 return step([n2, v2]); 25672 }; 25673 } 25674 function step(op) { 25675 if (f2) throw new TypeError("Generator is already executing."); 25676 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25677 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25678 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25679 switch (op[0]) { 25680 case 0: 25681 case 1: 25682 t2 = op; 25683 break; 25684 case 4: 25685 _2.label++; 25686 return { value: op[1], done: false }; 25687 case 5: 25688 _2.label++; 25689 y2 = op[1]; 25690 op = [0]; 25691 continue; 25692 case 7: 25693 op = _2.ops.pop(); 25694 _2.trys.pop(); 25695 continue; 25696 default: 25697 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25698 _2 = 0; 25699 continue; 25700 } 25701 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25702 _2.label = op[1]; 25703 break; 25704 } 25705 if (op[0] === 6 && _2.label < t2[1]) { 25706 _2.label = t2[1]; 25707 t2 = op; 25708 break; 25709 } 25710 if (t2 && _2.label < t2[2]) { 25711 _2.label = t2[2]; 25712 _2.ops.push(op); 25713 break; 25714 } 25715 if (t2[2]) _2.ops.pop(); 25716 _2.trys.pop(); 25717 continue; 25718 } 25719 op = body.call(thisArg, _2); 25720 } catch (e2) { 25721 op = [6, e2]; 25722 y2 = 0; 25723 } finally { 25724 f2 = t2 = 0; 25725 } 25726 if (op[0] & 5) throw op[1];
25727 return { value: op[0] ? op[1] : void 0, done: true }; 25728 } 25729 }; 25730 Object.defineProperty(Presets, "__esModule", { value: true }); 25731 var RESOURCEPATH = "/presets"; 25732 var Presets$1 = ( 25733 /** @class */ 25734 function() { 25735 function Presets2(apiCall) { 25736 this.apiCall = apiCall; 25737 } 25738 Presets2.prototype.upsert = function(presetId, params) { 25739 return __awaiter(this, void 0, void 0, function() { 25740 return __generator(this, function(_a2) { 25741 return [2, this.apiCall.put(this.endpointPath(presetId), params)]; 25742 }); 25743 }); 25744 }; 25745 Presets2.prototype.retrieve = function() { 25746 return __awaiter(this, void 0, void 0, function() { 25747 return __generator(this, function(_a2) { 25748 return [2, this.apiCall.get(this.endpointPath())]; 25749 }); 25750 }); 25751 }; 25752 Presets2.prototype.endpointPath = function(operation) { 25753 return "".concat(Presets2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 25754 }; 25755 Object.defineProperty(Presets2, "RESOURCEPATH", { 25756 get: function() { 25757 return RESOURCEPATH; 25758 }, 25759 enumerable: false, 25760 configurable: true 25761 }); 25762 return Presets2; 25763 }() 25764 ); 25765 Presets.default = Presets$1; 25766 return Presets; 25767} 25768var Preset = {}; 25769var hasRequiredPreset; 25770function requirePreset() { 25771 if (hasRequiredPreset) return Preset; 25772 hasRequiredPreset = 1; 25773 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25774 function adopt(value) { 25775 return value instanceof P2 ? value : new P2(function(resolve) { 25776 resolve(value); 25777 }); 25778 } 25779 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25780 function fulfilled(value) { 25781 try { 25782 step(generator.next(value)); 25783 } catch (e2) { 25784 reject(e2); 25785 } 25786 } 25787 function rejected(value) { 25788 try { 25789 step(generator["throw"](value)); 25790 } catch (e2) { 25791 reject(e2); 25792 } 25793 } 25794 function step(result) { 25795 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25796 } 25797 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25798 }); 25799 }; 25800 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25801 var _2 = { label: 0, sent: function() { 25802 if (t2[0] & 1) throw t2[1]; 25803 return t2[1]; 25804 }, trys: [], ops: [] }, f2, y2, t2, g2; 25805 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25806 return this; 25807 }), g2; 25808 function verb(n2) { 25809 return function(v2) { 25810 return step([n2, v2]); 25811 }; 25812 } 25813 function step(op) { 25814 if (f2) throw new TypeError("Generator is already executing."); 25815 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25816 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25817 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25818 switch (op[0]) { 25819 case 0: 25820 case 1: 25821 t2 = op; 25822 break; 25823 case 4: 25824 _2.label++; 25825 return { value: op[1], done: false }; 25826 case 5: 25827 _2.label++; 25828 y2 = op[1]; 25829 op = [0]; 25830 continue; 25831 case 7: 25832 op = _2.ops.pop(); 25833 _2.trys.pop(); 25834 continue; 25835 default: 25836 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25837 _2 = 0; 25838 continue; 25839 } 25840 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25841 _2.label = op[1]; 25842 break; 25843 } 25844 if (op[0] === 6 && _2.label < t2[1]) { 25845 _2.label = t2[1]; 25846 t2 = op; 25847 break; 25848 } 25849 if (t2 && _2.label < t2[2]) { 25850 _2.label = t2[2]; 25851 _2.ops.push(op); 25852 break; 25853 } 25854 if (t2[2]) _2.ops.pop(); 25855 _2.trys.pop(); 25856 continue; 25857 } 25858 op = body.call(thisArg, _2); 25859 } catch (e2) { 25860 op = [6, e2]; 25861 y2 = 0; 25862 } finally { 25863 f2 = t2 = 0; 25864 } 25865 if (op[0] & 5) throw op[1];
25866 return { value: op[0] ? op[1] : void 0, done: true }; 25867 } 25868 }; 25869 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 25870 return mod && mod.__esModule ? mod : { "default": mod }; 25871 }; 25872 Object.defineProperty(Preset, "__esModule", { value: true }); 25873 var Presets_1 = __importDefault(requirePresets()); 25874 var Preset$1 = ( 25875 /** @class */ 25876 function() { 25877 function Preset2(presetId, apiCall) { 25878 this.presetId = presetId; 25879 this.apiCall = apiCall; 25880 } 25881 Preset2.prototype.retrieve = function() { 25882 return __awaiter(this, void 0, void 0, function() { 25883 return __generator(this, function(_a2) { 25884 return [2, this.apiCall.get(this.endpointPath())]; 25885 }); 25886 }); 25887 }; 25888 Preset2.prototype.delete = function() { 25889 return __awaiter(this, void 0, void 0, function() { 25890 return __generator(this, function(_a2) { 25891 return [2, this.apiCall.delete(this.endpointPath())]; 25892 }); 25893 }); 25894 };
25895 Preset2.prototype.endpointPath = function() { 25896 return "".concat(Presets_1.default.RESOURCEPATH, "/").concat(this.presetId); 25897 }; 25898 return Preset2; 25899 }() 25900 ); 25901 Preset.default = Preset$1; 25902 return Preset; 25903} 25904var Analytics = {}; 25905var AnalyticsRules = {}; 25906var hasRequiredAnalyticsRules; 25907function requireAnalyticsRules() { 25908 if (hasRequiredAnalyticsRules) return AnalyticsRules; 25909 hasRequiredAnalyticsRules = 1; 25910 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 25911 function adopt(value) { 25912 return value instanceof P2 ? value : new P2(function(resolve) { 25913 resolve(value); 25914 }); 25915 } 25916 return new (P2 || (P2 = Promise))(function(resolve, reject) { 25917 function fulfilled(value) { 25918 try { 25919 step(generator.next(value)); 25920 } catch (e2) { 25921 reject(e2); 25922 } 25923 } 25924 function rejected(value) { 25925 try { 25926 step(generator["throw"](value)); 25927 } catch (e2) { 25928 reject(e2); 25929 } 25930 } 25931 function step(result) { 25932 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 25933 } 25934 step((generator = generator.apply(thisArg, _arguments || [])).next()); 25935 }); 25936 }; 25937 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 25938 var _2 = { label: 0, sent: function() { 25939 if (t2[0] & 1) throw t2[1]; 25940 return t2[1]; 25941 }, trys: [], ops: [] }, f2, y2, t2, g2; 25942 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 25943 return this; 25944 }), g2; 25945 function verb(n2) { 25946 return function(v2) { 25947 return step([n2, v2]); 25948 }; 25949 } 25950 function step(op) { 25951 if (f2) throw new TypeError("Generator is already executing."); 25952 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 25953 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 25954 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 25955 switch (op[0]) { 25956 case 0: 25957 case 1: 25958 t2 = op; 25959 break; 25960 case 4: 25961 _2.label++; 25962 return { value: op[1], done: false }; 25963 case 5: 25964 _2.label++; 25965 y2 = op[1]; 25966 op = [0]; 25967 continue; 25968 case 7: 25969 op = _2.ops.pop(); 25970 _2.trys.pop(); 25971 continue; 25972 default: 25973 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 25974 _2 = 0; 25975 continue; 25976 } 25977 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 25978 _2.label = op[1]; 25979 break; 25980 } 25981 if (op[0] === 6 && _2.label < t2[1]) { 25982 _2.label = t2[1]; 25983 t2 = op; 25984 break; 25985 } 25986 if (t2 && _2.label < t2[2]) { 25987 _2.label = t2[2]; 25988 _2.ops.push(op); 25989 break; 25990 } 25991 if (t2[2]) _2.ops.pop(); 25992 _2.trys.pop(); 25993 continue; 25994 } 25995 op = body.call(thisArg, _2); 25996 } catch (e2) { 25997 op = [6, e2]; 25998 y2 = 0; 25999 } finally { 26000 f2 = t2 = 0; 26001 } 26002 if (op[0] & 5) throw op[1]; 26003 return { value: op[0] ? op[1] : void 0, done: true }; 26004 } 26005 }; 26006 Object.defineProperty(AnalyticsRules, "__esModule", { value: true }); 26007 var RESOURCEPATH = "/analytics/rules"; 26008 var AnalyticsRules$1 = ( 26009 /** @class */ 26010 function() { 26011 function AnalyticsRules2(apiCall) { 26012 this.apiCall = apiCall; 26013 this.apiCall = apiCall; 26014 } 26015 AnalyticsRules2.prototype.upsert = function(name, params) { 26016 return __awaiter(this, void 0, void 0, function() { 26017 return __generator(this, function(_a2) { 26018 return [2, this.apiCall.put(this.endpointPath(name), params)]; 26019 }); 26020 }); 26021 }; 26022 AnalyticsRules2.prototype.retrieve = function() { 26023 return __awaiter(this, void 0, void 0, function() { 26024 return __generator(this, function(_a2) { 26025 return [2, this.apiCall.get(this.endpointPath())]; 26026 }); 26027 }); 26028 };
26029 AnalyticsRules2.prototype.endpointPath = function(operation) { 26030 return "".concat(AnalyticsRules2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 26031 }; 26032 Object.defineProperty(AnalyticsRules2, "RESOURCEPATH", { 26033 get: function() { 26034 return RESOURCEPATH; 26035 }, 26036 enumerable: false, 26037 configurable: true 26038 }); 26039 return AnalyticsRules2; 26040 }() 26041 ); 26042 AnalyticsRules.default = AnalyticsRules$1; 26043 return AnalyticsRules; 26044} 26045var AnalyticsRule = {}; 26046var hasRequiredAnalyticsRule; 26047function requireAnalyticsRule() { 26048 if (hasRequiredAnalyticsRule) return AnalyticsRule; 26049 hasRequiredAnalyticsRule = 1; 26050 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26051 function adopt(value) { 26052 return value instanceof P2 ? value : new P2(function(resolve) { 26053 resolve(value); 26054 }); 26055 } 26056 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26057 function fulfilled(value) { 26058 try { 26059 step(generator.next(value)); 26060 } catch (e2) { 26061 reject(e2); 26062 } 26063 } 26064 function rejected(value) { 26065 try { 26066 step(generator["throw"](value)); 26067 } catch (e2) { 26068 reject(e2); 26069 } 26070 } 26071 function step(result) { 26072 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26073 } 26074 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26075 }); 26076 }; 26077 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26078 var _2 = { label: 0, sent: function() { 26079 if (t2[0] & 1) throw t2[1]; 26080 return t2[1]; 26081 }, trys: [], ops: [] }, f2, y2, t2, g2; 26082 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26083 return this; 26084 }), g2; 26085 function verb(n2) { 26086 return function(v2) { 26087 return step([n2, v2]); 26088 }; 26089 } 26090 function step(op) { 26091 if (f2) throw new TypeError("Generator is already executing."); 26092 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26093 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26094 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26095 switch (op[0]) { 26096 case 0: 26097 case 1: 26098 t2 = op; 26099 break; 26100 case 4: 26101 _2.label++; 26102 return { value: op[1], done: false }; 26103 case 5: 26104 _2.label++; 26105 y2 = op[1]; 26106 op = [0]; 26107 continue; 26108 case 7: 26109 op = _2.ops.pop(); 26110 _2.trys.pop(); 26111 continue; 26112 default: 26113 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26114 _2 = 0; 26115 continue; 26116 } 26117 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26118 _2.label = op[1]; 26119 break; 26120 } 26121 if (op[0] === 6 && _2.label < t2[1]) { 26122 _2.label = t2[1]; 26123 t2 = op; 26124 break; 26125 } 26126 if (t2 && _2.label < t2[2]) { 26127 _2.label = t2[2]; 26128 _2.ops.push(op); 26129 break; 26130 } 26131 if (t2[2]) _2.ops.pop(); 26132 _2.trys.pop(); 26133 continue; 26134 } 26135 op = body.call(thisArg, _2); 26136 } catch (e2) { 26137 op = [6, e2]; 26138 y2 = 0; 26139 } finally { 26140 f2 = t2 = 0; 26141 } 26142 if (op[0] & 5) throw op[1]; 26143 return { value: op[0] ? op[1] : void 0, done: true }; 26144 } 26145 }; 26146 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 26147 return mod && mod.__esModule ? mod : { "default": mod }; 26148 }; 26149 Object.defineProperty(AnalyticsRule, "__esModule", { value: true }); 26150 var AnalyticsRules_1 = __importDefault(requireAnalyticsRules()); 26151 var AnalyticsRule$1 = ( 26152 /** @class */ 26153 function() { 26154 function AnalyticsRule2(name, apiCall) { 26155 this.name = name; 26156 this.apiCall = apiCall; 26157 } 26158 AnalyticsRule2.prototype.retrieve = function() { 26159 return __awaiter(this, void 0, void 0, function() { 26160 return __generator(this, function(_a2) { 26161 return [2, this.apiCall.get(this.endpointPath())]; 26162 }); 26163 }); 26164 }; 26165 AnalyticsRule2.prototype.delete = function() { 26166 return __awaiter(this, void 0, void 0, function() { 26167 return __generator(this, function(_a2) { 26168 return [2, this.apiCall.delete(this.endpointPath())]; 26169 }); 26170 }); 26171 };
26172 AnalyticsRule2.prototype.endpointPath = function() { 26173 return "".concat(AnalyticsRules_1.default.RESOURCEPATH, "/").concat(this.name); 26174 }; 26175 return AnalyticsRule2; 26176 }() 26177 ); 26178 AnalyticsRule.default = AnalyticsRule$1; 26179 return AnalyticsRule; 26180} 26181var hasRequiredAnalytics; 26182function requireAnalytics() { 26183 if (hasRequiredAnalytics) return Analytics; 26184 hasRequiredAnalytics = 1; 26185 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 26186 return mod && mod.__esModule ? mod : { "default": mod }; 26187 }; 26188 Object.defineProperty(Analytics, "__esModule", { value: true }); 26189 var AnalyticsRules_1 = __importDefault(requireAnalyticsRules()); 26190 var AnalyticsRule_1 = __importDefault(requireAnalyticsRule()); 26191 var RESOURCEPATH = "/analytics"; 26192 var Analytics$1 = ( 26193 /** @class */ 26194 function() { 26195 function Analytics2(apiCall) { 26196 this.apiCall = apiCall; 26197 this.individualAnalyticsRules = {}; 26198 this.apiCall = apiCall; 26199 this._analyticsRules = new AnalyticsRules_1.default(this.apiCall); 26200 } 26201 Analytics2.prototype.rules = function(id2) { 26202 if (id2 === void 0) { 26203 return this._analyticsRules; 26204 } else { 26205 if (this.individualAnalyticsRules[id2] === void 0) { 26206 this.individualAnalyticsRules[id2] = new AnalyticsRule_1.default(id2, this.apiCall); 26207 } 26208 return this.individualAnalyticsRules[id2]; 26209 } 26210 }; 26211 Object.defineProperty(Analytics2, "RESOURCEPATH", { 26212 get: function() { 26213 return RESOURCEPATH; 26214 }, 26215 enumerable: false, 26216 configurable: true 26217 }); 26218 return Analytics2; 26219 }() 26220 ); 26221 Analytics.default = Analytics$1; 26222 return Analytics; 26223} 26224var Stopwords = {}; 26225var hasRequiredStopwords; 26226function requireStopwords() { 26227 if (hasRequiredStopwords) return Stopwords; 26228 hasRequiredStopwords = 1; 26229 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26230 function adopt(value) { 26231 return value instanceof P2 ? value : new P2(function(resolve) { 26232 resolve(value); 26233 }); 26234 } 26235 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26236 function fulfilled(value) { 26237 try { 26238 step(generator.next(value)); 26239 } catch (e2) { 26240 reject(e2); 26241 } 26242 } 26243 function rejected(value) { 26244 try { 26245 step(generator["throw"](value)); 26246 } catch (e2) { 26247 reject(e2); 26248 } 26249 } 26250 function step(result) { 26251 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26252 } 26253 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26254 }); 26255 }; 26256 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26257 var _2 = { label: 0, sent: function() { 26258 if (t2[0] & 1) throw t2[1]; 26259 return t2[1]; 26260 }, trys: [], ops: [] }, f2, y2, t2, g2; 26261 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26262 return this; 26263 }), g2; 26264 function verb(n2) { 26265 return function(v2) { 26266 return step([n2, v2]); 26267 }; 26268 } 26269 function step(op) { 26270 if (f2) throw new TypeError("Generator is already executing."); 26271 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26272 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26273 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26274 switch (op[0]) { 26275 case 0: 26276 case 1: 26277 t2 = op; 26278 break; 26279 case 4: 26280 _2.label++; 26281 return { value: op[1], done: false }; 26282 case 5: 26283 _2.label++; 26284 y2 = op[1]; 26285 op = [0]; 26286 continue; 26287 case 7: 26288 op = _2.ops.pop(); 26289 _2.trys.pop(); 26290 continue; 26291 default: 26292 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26293 _2 = 0; 26294 continue; 26295 } 26296 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26297 _2.label = op[1]; 26298 break; 26299 } 26300 if (op[0] === 6 && _2.label < t2[1]) { 26301 _2.label = t2[1]; 26302 t2 = op; 26303 break; 26304 } 26305 if (t2 && _2.label < t2[2]) { 26306 _2.label = t2[2]; 26307 _2.ops.push(op); 26308 break; 26309 } 26310 if (t2[2]) _2.ops.pop(); 26311 _2.trys.pop(); 26312 continue; 26313 } 26314 op = body.call(thisArg, _2); 26315 } catch (e2) { 26316 op = [6, e2]; 26317 y2 = 0; 26318 } finally { 26319 f2 = t2 = 0; 26320 } 26321 if (op[0] & 5) throw op[1];
26322 return { value: op[0] ? op[1] : void 0, done: true }; 26323 } 26324 }; 26325 Object.defineProperty(Stopwords, "__esModule", { value: true }); 26326 var RESOURCEPATH = "/stopwords"; 26327 var Stopwords$1 = ( 26328 /** @class */ 26329 function() { 26330 function Stopwords2(apiCall) { 26331 this.apiCall = apiCall; 26332 } 26333 Stopwords2.prototype.upsert = function(stopwordId, params) { 26334 return __awaiter(this, void 0, void 0, function() { 26335 return __generator(this, function(_a2) { 26336 return [2, this.apiCall.put(this.endpointPath(stopwordId), params)]; 26337 }); 26338 }); 26339 }; 26340 Stopwords2.prototype.retrieve = function() { 26341 return __awaiter(this, void 0, void 0, function() { 26342 return __generator(this, function(_a2) { 26343 return [2, this.apiCall.get(this.endpointPath())]; 26344 }); 26345 }); 26346 }; 26347 Stopwords2.prototype.endpointPath = function(operation) { 26348 return "".concat(Stopwords2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 26349 }; 26350 Object.defineProperty(Stopwords2, "RESOURCEPATH", { 26351 get: function() { 26352 return RESOURCEPATH; 26353 }, 26354 enumerable: false, 26355 configurable: true 26356 }); 26357 return Stopwords2; 26358 }() 26359 ); 26360 Stopwords.default = Stopwords$1; 26361 return Stopwords; 26362} 26363var Stopword = {}; 26364var hasRequiredStopword; 26365function requireStopword() { 26366 if (hasRequiredStopword) return Stopword; 26367 hasRequiredStopword = 1; 26368 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26369 function adopt(value) { 26370 return value instanceof P2 ? value : new P2(function(resolve) { 26371 resolve(value); 26372 }); 26373 } 26374 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26375 function fulfilled(value) { 26376 try { 26377 step(generator.next(value)); 26378 } catch (e2) { 26379 reject(e2); 26380 } 26381 } 26382 function rejected(value) { 26383 try { 26384 step(generator["throw"](value)); 26385 } catch (e2) { 26386 reject(e2); 26387 } 26388 } 26389 function step(result) { 26390 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26391 } 26392 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26393 }); 26394 }; 26395 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26396 var _2 = { label: 0, sent: function() { 26397 if (t2[0] & 1) throw t2[1]; 26398 return t2[1]; 26399 }, trys: [], ops: [] }, f2, y2, t2, g2; 26400 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26401 return this; 26402 }), g2; 26403 function verb(n2) { 26404 return function(v2) { 26405 return step([n2, v2]); 26406 }; 26407 } 26408 function step(op) { 26409 if (f2) throw new TypeError("Generator is already executing."); 26410 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26411 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26412 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26413 switch (op[0]) { 26414 case 0: 26415 case 1: 26416 t2 = op; 26417 break; 26418 case 4: 26419 _2.label++; 26420 return { value: op[1], done: false }; 26421 case 5: 26422 _2.label++; 26423 y2 = op[1]; 26424 op = [0]; 26425 continue; 26426 case 7: 26427 op = _2.ops.pop(); 26428 _2.trys.pop(); 26429 continue; 26430 default: 26431 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26432 _2 = 0; 26433 continue; 26434 } 26435 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26436 _2.label = op[1]; 26437 break; 26438 } 26439 if (op[0] === 6 && _2.label < t2[1]) { 26440 _2.label = t2[1]; 26441 t2 = op; 26442 break; 26443 } 26444 if (t2 && _2.label < t2[2]) { 26445 _2.label = t2[2]; 26446 _2.ops.push(op); 26447 break; 26448 } 26449 if (t2[2]) _2.ops.pop(); 26450 _2.trys.pop(); 26451 continue; 26452 } 26453 op = body.call(thisArg, _2); 26454 } catch (e2) { 26455 op = [6, e2]; 26456 y2 = 0; 26457 } finally { 26458 f2 = t2 = 0; 26459 } 26460 if (op[0] & 5) throw op[1];
26461 return { value: op[0] ? op[1] : void 0, done: true }; 26462 } 26463 }; 26464 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 26465 return mod && mod.__esModule ? mod : { "default": mod }; 26466 }; 26467 Object.defineProperty(Stopword, "__esModule", { value: true }); 26468 var Stopwords_1 = __importDefault(requireStopwords()); 26469 var Stopword$1 = ( 26470 /** @class */ 26471 function() { 26472 function Stopword2(stopwordId, apiCall) { 26473 this.stopwordId = stopwordId; 26474 this.apiCall = apiCall; 26475 } 26476 Stopword2.prototype.retrieve = function() { 26477 return __awaiter(this, void 0, void 0, function() { 26478 return __generator(this, function(_a2) { 26479 return [2, this.apiCall.get(this.endpointPath())]; 26480 }); 26481 }); 26482 }; 26483 Stopword2.prototype.delete = function() { 26484 return __awaiter(this, void 0, void 0, function() { 26485 return __generator(this, function(_a2) { 26486 return [2, this.apiCall.delete(this.endpointPath())]; 26487 }); 26488 }); 26489 };
26490 Stopword2.prototype.endpointPath = function() { 26491 return "".concat(Stopwords_1.default.RESOURCEPATH, "/").concat(this.stopwordId); 26492 }; 26493 return Stopword2; 26494 }() 26495 ); 26496 Stopword.default = Stopword$1; 26497 return Stopword; 26498} 26499var Conversations = {}; 26500var ConversationModels = {}; 26501var hasRequiredConversationModels; 26502function requireConversationModels() { 26503 if (hasRequiredConversationModels) return ConversationModels; 26504 hasRequiredConversationModels = 1; 26505 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26506 function adopt(value) { 26507 return value instanceof P2 ? value : new P2(function(resolve) { 26508 resolve(value); 26509 }); 26510 } 26511 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26512 function fulfilled(value) { 26513 try { 26514 step(generator.next(value)); 26515 } catch (e2) { 26516 reject(e2); 26517 } 26518 } 26519 function rejected(value) { 26520 try { 26521 step(generator["throw"](value)); 26522 } catch (e2) { 26523 reject(e2); 26524 } 26525 } 26526 function step(result) { 26527 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26528 } 26529 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26530 }); 26531 }; 26532 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26533 var _2 = { label: 0, sent: function() { 26534 if (t2[0] & 1) throw t2[1]; 26535 return t2[1]; 26536 }, trys: [], ops: [] }, f2, y2, t2, g2; 26537 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26538 return this; 26539 }), g2; 26540 function verb(n2) { 26541 return function(v2) { 26542 return step([n2, v2]); 26543 }; 26544 } 26545 function step(op) { 26546 if (f2) throw new TypeError("Generator is already executing."); 26547 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26548 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26549 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26550 switch (op[0]) { 26551 case 0: 26552 case 1: 26553 t2 = op; 26554 break; 26555 case 4: 26556 _2.label++; 26557 return { value: op[1], done: false }; 26558 case 5: 26559 _2.label++; 26560 y2 = op[1]; 26561 op = [0]; 26562 continue; 26563 case 7: 26564 op = _2.ops.pop(); 26565 _2.trys.pop(); 26566 continue; 26567 default: 26568 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26569 _2 = 0; 26570 continue; 26571 } 26572 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26573 _2.label = op[1]; 26574 break; 26575 } 26576 if (op[0] === 6 && _2.label < t2[1]) { 26577 _2.label = t2[1]; 26578 t2 = op; 26579 break; 26580 } 26581 if (t2 && _2.label < t2[2]) { 26582 _2.label = t2[2]; 26583 _2.ops.push(op); 26584 break; 26585 } 26586 if (t2[2]) _2.ops.pop(); 26587 _2.trys.pop(); 26588 continue; 26589 } 26590 op = body.call(thisArg, _2); 26591 } catch (e2) { 26592 op = [6, e2]; 26593 y2 = 0; 26594 } finally { 26595 f2 = t2 = 0; 26596 } 26597 if (op[0] & 5) throw op[1]; 26598 return { value: op[0] ? op[1] : void 0, done: true }; 26599 } 26600 }; 26601 Object.defineProperty(ConversationModels, "__esModule", { value: true }); 26602 var RESOURCEPATH = "/conversations/models"; 26603 var ConversationModels$1 = ( 26604 /** @class */ 26605 function() { 26606 function ConversationModels2(apiCall) { 26607 this.apiCall = apiCall; 26608 this.apiCall = apiCall; 26609 } 26610 ConversationModels2.prototype.create = function(params) { 26611 return __awaiter(this, void 0, void 0, function() { 26612 return __generator(this, function(_a2) { 26613 return [2, this.apiCall.post(this.endpointPath(), params)]; 26614 }); 26615 }); 26616 }; 26617 ConversationModels2.prototype.retrieve = function() { 26618 return __awaiter(this, void 0, void 0, function() { 26619 return __generator(this, function(_a2) { 26620 return [2, this.apiCall.get(this.endpointPath())]; 26621 }); 26622 }); 26623 };
26624 ConversationModels2.prototype.endpointPath = function(operation) { 26625 return "".concat(ConversationModels2.RESOURCEPATH).concat(operation === void 0 ? "" : "/" + operation); 26626 }; 26627 Object.defineProperty(ConversationModels2, "RESOURCEPATH", { 26628 get: function() { 26629 return RESOURCEPATH; 26630 }, 26631 enumerable: false, 26632 configurable: true 26633 }); 26634 return ConversationModels2; 26635 }() 26636 ); 26637 ConversationModels.default = ConversationModels$1; 26638 return ConversationModels; 26639} 26640var ConversationModel = {}; 26641var hasRequiredConversationModel; 26642function requireConversationModel() { 26643 if (hasRequiredConversationModel) return ConversationModel; 26644 hasRequiredConversationModel = 1; 26645 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26646 function adopt(value) { 26647 return value instanceof P2 ? value : new P2(function(resolve) { 26648 resolve(value); 26649 }); 26650 } 26651 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26652 function fulfilled(value) { 26653 try { 26654 step(generator.next(value)); 26655 } catch (e2) { 26656 reject(e2); 26657 } 26658 } 26659 function rejected(value) { 26660 try { 26661 step(generator["throw"](value)); 26662 } catch (e2) { 26663 reject(e2); 26664 } 26665 } 26666 function step(result) { 26667 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26668 } 26669 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26670 }); 26671 }; 26672 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26673 var _2 = { label: 0, sent: function() { 26674 if (t2[0] & 1) throw t2[1]; 26675 return t2[1]; 26676 }, trys: [], ops: [] }, f2, y2, t2, g2; 26677 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26678 return this; 26679 }), g2; 26680 function verb(n2) { 26681 return function(v2) { 26682 return step([n2, v2]); 26683 }; 26684 } 26685 function step(op) { 26686 if (f2) throw new TypeError("Generator is already executing."); 26687 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26688 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26689 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26690 switch (op[0]) { 26691 case 0: 26692 case 1: 26693 t2 = op; 26694 break; 26695 case 4: 26696 _2.label++; 26697 return { value: op[1], done: false }; 26698 case 5: 26699 _2.label++; 26700 y2 = op[1]; 26701 op = [0]; 26702 continue; 26703 case 7: 26704 op = _2.ops.pop(); 26705 _2.trys.pop(); 26706 continue; 26707 default: 26708 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26709 _2 = 0; 26710 continue; 26711 } 26712 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26713 _2.label = op[1]; 26714 break; 26715 } 26716 if (op[0] === 6 && _2.label < t2[1]) { 26717 _2.label = t2[1]; 26718 t2 = op; 26719 break; 26720 } 26721 if (t2 && _2.label < t2[2]) { 26722 _2.label = t2[2]; 26723 _2.ops.push(op); 26724 break; 26725 } 26726 if (t2[2]) _2.ops.pop(); 26727 _2.trys.pop(); 26728 continue; 26729 } 26730 op = body.call(thisArg, _2); 26731 } catch (e2) { 26732 op = [6, e2]; 26733 y2 = 0; 26734 } finally { 26735 f2 = t2 = 0; 26736 } 26737 if (op[0] & 5) throw op[1]; 26738 return { value: op[0] ? op[1] : void 0, done: true }; 26739 } 26740 }; 26741 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 26742 return mod && mod.__esModule ? mod : { "default": mod }; 26743 }; 26744 Object.defineProperty(ConversationModel, "__esModule", { value: true }); 26745 var ConversationModels_1 = __importDefault(requireConversationModels()); 26746 var ConversationModel$1 = ( 26747 /** @class */ 26748 function() { 26749 function ConversationModel2(id2, apiCall) { 26750 this.id = id2; 26751 this.apiCall = apiCall; 26752 } 26753 ConversationModel2.prototype.update = function(params) { 26754 return __awaiter(this, void 0, void 0, function() { 26755 return __generator(this, function(_a2) { 26756 return [2, this.apiCall.put(this.endpointPath(), params)]; 26757 }); 26758 }); 26759 }; 26760 ConversationModel2.prototype.retrieve = function() { 26761 return __awaiter(this, void 0, void 0, function() { 26762 return __generator(this, function(_a2) { 26763 return [2, this.apiCall.get(this.endpointPath())]; 26764 }); 26765 }); 26766 }; 26767 ConversationModel2.prototype.delete = function() { 26768 return __awaiter(this, void 0, void 0, function() { 26769 return __generator(this, function(_a2) { 26770 return [2, this.apiCall.delete(this.endpointPath())]; 26771 }); 26772 }); 26773 };
26774 ConversationModel2.prototype.endpointPath = function() { 26775 return "".concat(ConversationModels_1.default.RESOURCEPATH, "/").concat(this.id); 26776 }; 26777 return ConversationModel2; 26778 }() 26779 ); 26780 ConversationModel.default = ConversationModel$1; 26781 return ConversationModel; 26782} 26783var hasRequiredConversations; 26784function requireConversations() { 26785 if (hasRequiredConversations) return Conversations; 26786 hasRequiredConversations = 1; 26787 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26788 function adopt(value) { 26789 return value instanceof P2 ? value : new P2(function(resolve) { 26790 resolve(value); 26791 }); 26792 } 26793 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26794 function fulfilled(value) { 26795 try { 26796 step(generator.next(value)); 26797 } catch (e2) { 26798 reject(e2); 26799 } 26800 } 26801 function rejected(value) { 26802 try { 26803 step(generator["throw"](value)); 26804 } catch (e2) { 26805 reject(e2); 26806 } 26807 } 26808 function step(result) { 26809 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26810 } 26811 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26812 }); 26813 }; 26814 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26815 var _2 = { label: 0, sent: function() { 26816 if (t2[0] & 1) throw t2[1]; 26817 return t2[1]; 26818 }, trys: [], ops: [] }, f2, y2, t2, g2; 26819 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26820 return this; 26821 }), g2; 26822 function verb(n2) { 26823 return function(v2) { 26824 return step([n2, v2]); 26825 }; 26826 } 26827 function step(op) { 26828 if (f2) throw new TypeError("Generator is already executing."); 26829 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26830 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26831 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26832 switch (op[0]) { 26833 case 0: 26834 case 1: 26835 t2 = op; 26836 break; 26837 case 4: 26838 _2.label++; 26839 return { value: op[1], done: false }; 26840 case 5: 26841 _2.label++; 26842 y2 = op[1]; 26843 op = [0]; 26844 continue; 26845 case 7: 26846 op = _2.ops.pop(); 26847 _2.trys.pop(); 26848 continue; 26849 default: 26850 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26851 _2 = 0; 26852 continue; 26853 } 26854 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 26855 _2.label = op[1]; 26856 break; 26857 } 26858 if (op[0] === 6 && _2.label < t2[1]) { 26859 _2.label = t2[1]; 26860 t2 = op; 26861 break; 26862 } 26863 if (t2 && _2.label < t2[2]) { 26864 _2.label = t2[2]; 26865 _2.ops.push(op); 26866 break; 26867 } 26868 if (t2[2]) _2.ops.pop(); 26869 _2.trys.pop(); 26870 continue; 26871 } 26872 op = body.call(thisArg, _2); 26873 } catch (e2) { 26874 op = [6, e2]; 26875 y2 = 0; 26876 } finally { 26877 f2 = t2 = 0; 26878 } 26879 if (op[0] & 5) throw op[1]; 26880 return { value: op[0] ? op[1] : void 0, done: true }; 26881 } 26882 }; 26883 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 26884 return mod && mod.__esModule ? mod : { "default": mod }; 26885 }; 26886 Object.defineProperty(Conversations, "__esModule", { value: true }); 26887 var ConversationModels_1 = __importDefault(requireConversationModels()); 26888 var ConversationModel_1 = __importDefault(requireConversationModel()); 26889 var RESOURCEPATH = "/conversations"; 26890 var Conversations$1 = ( 26891 /** @class */ 26892 function() { 26893 function Conversations2(apiCall) { 26894 this.apiCall = apiCall; 26895 this.individualConversationModels = {}; 26896 this.apiCall = apiCall; 26897 this._conversationsModels = new ConversationModels_1.default(this.apiCall); 26898 } 26899 Conversations2.prototype.retrieve = function() { 26900 return __awaiter(this, void 0, void 0, function() { 26901 return __generator(this, function(_a2) { 26902 return [2, this.apiCall.get(RESOURCEPATH)]; 26903 }); 26904 }); 26905 }; 26906 Conversations2.prototype.models = function(id2) { 26907 if (id2 === void 0) { 26908 return this._conversationsModels; 26909 } else { 26910 if (this.individualConversationModels[id2] === void 0) { 26911 this.individualConversationModels[id2] = new ConversationModel_1.default(id2, this.apiCall); 26912 } 26913 return this.individualConversationModels[id2]; 26914 } 26915 }; 26916 Object.defineProperty(Conversations2, "RESOURCEPATH", { 26917 get: function() { 26918 return RESOURCEPATH; 26919 }, 26920 enumerable: false, 26921 configurable: true 26922 }); 26923 return Conversations2; 26924 }() 26925 ); 26926 Conversations.default = Conversations$1; 26927 return Conversations; 26928} 26929var Conversation = {}; 26930var hasRequiredConversation; 26931function requireConversation() { 26932 if (hasRequiredConversation) return Conversation; 26933 hasRequiredConversation = 1; 26934 var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) { 26935 function adopt(value) { 26936 return value instanceof P2 ? value : new P2(function(resolve) { 26937 resolve(value); 26938 }); 26939 } 26940 return new (P2 || (P2 = Promise))(function(resolve, reject) { 26941 function fulfilled(value) { 26942 try { 26943 step(generator.next(value)); 26944 } catch (e2) { 26945 reject(e2); 26946 } 26947 } 26948 function rejected(value) { 26949 try { 26950 step(generator["throw"](value)); 26951 } catch (e2) { 26952 reject(e2); 26953 } 26954 } 26955 function step(result) { 26956 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 26957 } 26958 step((generator = generator.apply(thisArg, _arguments || [])).next()); 26959 }); 26960 }; 26961 var __generator = commonjsGlobal && commonjsGlobal.__generator || function(thisArg, body) { 26962 var _2 = { label: 0, sent: function() { 26963 if (t2[0] & 1) throw t2[1]; 26964 return t2[1]; 26965 }, trys: [], ops: [] }, f2, y2, t2, g2; 26966 return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { 26967 return this; 26968 }), g2; 26969 function verb(n2) { 26970 return function(v2) { 26971 return step([n2, v2]); 26972 }; 26973 } 26974 function step(op) { 26975 if (f2) throw new TypeError("Generator is already executing."); 26976 while (g2 && (g2 = 0, op[0] && (_2 = 0)), _2) try { 26977 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2; 26978 if (y2 = 0, t2) op = [op[0] & 2, t2.value]; 26979 switch (op[0]) { 26980 case 0: 26981 case 1: 26982 t2 = op; 26983 break; 26984 case 4: 26985 _2.label++; 26986 return { value: op[1], done: false }; 26987 case 5: 26988 _2.label++; 26989 y2 = op[1]; 26990 op = [0]; 26991 continue; 26992 case 7: 26993 op = _2.ops.pop(); 26994 _2.trys.pop(); 26995 continue; 26996 default: 26997 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 26998 _2 = 0; 26999 continue; 27000 } 27001 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 27002 _2.label = op[1]; 27003 break; 27004 } 27005 if (op[0] === 6 && _2.label < t2[1]) { 27006 _2.label = t2[1]; 27007 t2 = op; 27008 break; 27009 } 27010 if (t2 && _2.label < t2[2]) { 27011 _2.label = t2[2]; 27012 _2.ops.push(op); 27013 break; 27014 } 27015 if (t2[2]) _2.ops.pop(); 27016 _2.trys.pop(); 27017 continue; 27018 } 27019 op = body.call(thisArg, _2); 27020 } catch (e2) { 27021 op = [6, e2]; 27022 y2 = 0; 27023 } finally { 27024 f2 = t2 = 0; 27025 } 27026 if (op[0] & 5) throw op[1];
27027 return { value: op[0] ? op[1] : void 0, done: true }; 27028 } 27029 }; 27030 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 27031 return mod && mod.__esModule ? mod : { "default": mod }; 27032 }; 27033 Object.defineProperty(Conversation, "__esModule", { value: true }); 27034 var Conversations_1 = __importDefault(requireConversations()); 27035 var Conversation$1 = ( 27036 /** @class */ 27037 function() { 27038 function Conversation2(id2, apiCall) { 27039 this.id = id2; 27040 this.apiCall = apiCall; 27041 } 27042 Conversation2.prototype.retrieve = function() { 27043 return __awaiter(this, void 0, void 0, function() { 27044 return __generator(this, function(_a2) { 27045 return [2, this.apiCall.get(this.endpointPath())]; 27046 }); 27047 }); 27048 }; 27049 Conversation2.prototype.update = function(params) { 27050 return __awaiter(this, void 0, void 0, function() { 27051 return __generator(this, function(_a2) { 27052 return [2, this.apiCall.put(this.endpointPath(), params)]; 27053 }); 27054 }); 27055 }; 27056 Conversation2.prototype.delete = function() { 27057 return __awaiter(this, void 0, void 0, function() { 27058 return __generator(this, function(_a2) { 27059 return [2, this.apiCall.delete(this.endpointPath())]; 27060 }); 27061 }); 27062 };
27063 Conversation2.prototype.endpointPath = function() { 27064 return "".concat(Conversations_1.default.RESOURCEPATH, "/").concat(this.id); 27065 }; 27066 return Conversation2; 27067 }() 27068 ); 27069 Conversation.default = Conversation$1; 27070 return Conversation; 27071} 27072var hasRequiredClient; 27073function requireClient() { 27074 if (hasRequiredClient) return Client; 27075 hasRequiredClient = 1; 27076 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 27077 return mod && mod.__esModule ? mod : { "default": mod }; 27078 }; 27079 Object.defineProperty(Client, "__esModule", { value: true }); 27080 var Configuration_1 = __importDefault(requireConfiguration()); 27081 var ApiCall_1 = __importDefault(requireApiCall()); 27082 var Collections_1 = __importDefault(requireCollections()); 27083 var Collection_1 = __importDefault(requireCollection()); 27084 var Aliases_1 = __importDefault(requireAliases()); 27085 var Alias_1 = __importDefault(requireAlias()); 27086 var Keys_1 = __importDefault(requireKeys()); 27087 var Key_1 = __importDefault(requireKey()); 27088 var Debug_1 = __importDefault(requireDebug()); 27089 var Metrics_1 = __importDefault(requireMetrics()); 27090 var Health_1 = __importDefault(requireHealth()); 27091 var Operations_1 = __importDefault(requireOperations()); 27092 var MultiSearch_1 = __importDefault(requireMultiSearch()); 27093 var Presets_1 = __importDefault(requirePresets()); 27094 var Preset_1 = __importDefault(requirePreset()); 27095 var Analytics_1 = __importDefault(requireAnalytics()); 27096 var Stopwords_1 = __importDefault(requireStopwords()); 27097 var Stopword_1 = __importDefault(requireStopword()); 27098 var Conversations_1 = __importDefault(requireConversations()); 27099 var Conversation_1 = __importDefault(requireConversation()); 27100 var Client$1 = ( 27101 /** @class */ 27102 function() { 27103 function Client2(options) { 27104 var _a2; 27105 options.sendApiKeyAsQueryParam = (_a2 = options.sendApiKeyAsQueryParam) !== null && _a2 !== void 0 ? _a2 : false; 27106 this.configuration = new Configuration_1.default(options); 27107 this.apiCall = new ApiCall_1.default(this.configuration); 27108 this.debug = new Debug_1.default(this.apiCall); 27109 this.metrics = new Metrics_1.default(this.apiCall); 27110 this.health = new Health_1.default(this.apiCall); 27111 this.operations = new Operations_1.default(this.apiCall); 27112 this.multiSearch = new MultiSearch_1.default(this.apiCall, this.configuration); 27113 this._collections = new Collections_1.default(this.apiCall); 27114 this.individualCollections = {}; 27115 this._aliases = new Aliases_1.default(this.apiCall); 27116 this.individualAliases = {}; 27117 this._keys = new Keys_1.default(this.apiCall); 27118 this.individualKeys = {}; 27119 this._presets = new Presets_1.default(this.apiCall); 27120 this.individualPresets = {}; 27121 this._stopwords = new Stopwords_1.default(this.apiCall); 27122 this.individualStopwords = {}; 27123 this.analytics = new Analytics_1.default(this.apiCall); 27124 this._conversations = new Conversations_1.default(this.apiCall); 27125 this.individualConversations = {}; 27126 } 27127 Client2.prototype.collections = function(collectionName) { 27128 if (collectionName === void 0) { 27129 return this._collections; 27130 } else { 27131 if (this.individualCollections[collectionName] === void 0) { 27132 this.individualCollections[collectionName] = new Collection_1.default(collectionName, this.apiCall, this.configuration); 27133 } 27134 return this.individualCollections[collectionName]; 27135 } 27136 }; 27137 Client2.prototype.aliases = function(aliasName) { 27138 if (aliasName === void 0) { 27139 return this._aliases; 27140 } else { 27141 if (this.individualAliases[aliasName] === void 0) { 27142 this.individualAliases[aliasName] = new Alias_1.default(aliasName, this.apiCall); 27143 } 27144 return this.individualAliases[aliasName]; 27145 } 27146 }; 27147 Client2.prototype.keys = function(id2) { 27148 if (id2 === void 0) { 27149 return this._keys; 27150 } else { 27151 if (this.individualKeys[id2] === void 0) { 27152 this.individualKeys[id2] = new Key_1.default(id2, this.apiCall); 27153 } 27154 return this.individualKeys[id2]; 27155 } 27156 }; 27157 Client2.prototype.presets = function(id2) { 27158 if (id2 === void 0) { 27159 return this._presets; 27160 } else { 27161 if (this.individualPresets[id2] === void 0) { 27162 this.individualPresets[id2] = new Preset_1.default(id2, this.apiCall); 27163 } 27164 return this.individualPresets[id2]; 27165 } 27166 }; 27167 Client2.prototype.stopwords = function(id2) { 27168 if (id2 === void 0) { 27169 return this._stopwords; 27170 } else { 27171 if (this.individualStopwords[id2] === void 0) { 27172 this.individualStopwords[id2] = new Stopword_1.default(id2, this.apiCall); 27173 } 27174 return this.individualStopwords[id2]; 27175 } 27176 }; 27177 Client2.prototype.conversations = function(id2) { 27178 if (id2 === void 0) { 27179 return this._conversations; 27180 } else { 27181 if (this.individualConversations[id2] === void 0) { 27182 this.individualConversations[id2] = new Conversation_1.default(id2, this.apiCall); 27183 } 27184 return this.individualConversations[id2]; 27185 } 27186 }; 27187 return Client2; 27188 }() 27189 ); 27190 Client.default = Client$1; 27191 return Client; 27192} 27193var SearchClient = {}; 27194var SearchOnlyCollection = {}; 27195var hasRequiredSearchOnlyCollection; 27196function requireSearchOnlyCollection() { 27197 if (hasRequiredSearchOnlyCollection) return SearchOnlyCollection; 27198 hasRequiredSearchOnlyCollection = 1; 27199 Object.defineProperty(SearchOnlyCollection, "__esModule", { value: true }); 27200 SearchOnlyCollection.SearchOnlyCollection = void 0; 27201 var SearchOnlyDocuments_1 = requireSearchOnlyDocuments(); 27202 var SearchOnlyCollection$1 = ( 27203 /** @class */ 27204 function() { 27205 function SearchOnlyCollection2(name, apiCall, configuration) { 27206 this.name = name; 27207 this.apiCall = apiCall; 27208 this.configuration = configuration; 27209 this._documents = new SearchOnlyDocuments_1.SearchOnlyDocuments(this.name, this.apiCall, this.configuration); 27210 } 27211 SearchOnlyCollection2.prototype.documents = function() { 27212 return this._documents; 27213 }; 27214 return SearchOnlyCollection2; 27215 }() 27216 ); 27217 SearchOnlyCollection.SearchOnlyCollection = SearchOnlyCollection$1; 27218 return SearchOnlyCollection; 27219} 27220var hasRequiredSearchClient; 27221function requireSearchClient() { 27222 if (hasRequiredSearchClient) return SearchClient; 27223 hasRequiredSearchClient = 1; 27224 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 27225 return mod && mod.__esModule ? mod : { "default": mod }; 27226 }; 27227 Object.defineProperty(SearchClient, "__esModule", { value: true }); 27228 var Configuration_1 = __importDefault(requireConfiguration()); 27229 var ApiCall_1 = __importDefault(requireApiCall()); 27230 var MultiSearch_1 = __importDefault(requireMultiSearch()); 27231 var SearchOnlyCollection_1 = requireSearchOnlyCollection(); 27232 var SearchClient$1 = ( 27233 /** @class */ 27234 function() { 27235 function SearchClient2(options) { 27236 var _a2; 27237 options.sendApiKeyAsQueryParam = (_a2 = options.sendApiKeyAsQueryParam) !== null && _a2 !== void 0 ? _a2 : true; 27238 if (options.sendApiKeyAsQueryParam === true && (options.apiKey || "").length > 2e3) { 27239 console.warn("[typesense] API Key is longer than 2000 characters which is over the allowed limit, so disabling sending it as a query parameter."); 27240 options.sendApiKeyAsQueryParam = false;
27241 } 27242 this.configuration = new Configuration_1.default(options); 27243 this.apiCall = new ApiCall_1.default(this.configuration); 27244 this.multiSearch = new MultiSearch_1.default(this.apiCall, this.configuration, true); 27245 this.individualCollections = {}; 27246 } 27247 SearchClient2.prototype.clearCache = function() { 27248 this.multiSearch.clearCache(); 27249 Object.entries(this.individualCollections).forEach(function(_a2) { 27250 _a2[0]; 27251 var collection = _a2[1]; 27252 collection.documents().clearCache(); 27253 }); 27254 }; 27255 SearchClient2.prototype.collections = function(collectionName) { 27256 if (!collectionName) { 27257 throw new Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object."); 27258 } else { 27259 if (this.individualCollections[collectionName] === void 0) { 27260 this.individualCollections[collectionName] = new SearchOnlyCollection_1.SearchOnlyCollection(collectionName, this.apiCall, this.configuration); 27261 } 27262 return this.individualCollections[collectionName]; 27263 } 27264 }; 27265 return SearchClient2; 27266 }() 27267 ); 27268 SearchClient.default = SearchClient$1; 27269 return SearchClient; 27270} 27271var hasRequiredTypesense; 27272function requireTypesense() { 27273 if (hasRequiredTypesense) return Typesense$1; 27274 hasRequiredTypesense = 1; 27275 var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o2, m2, k2, k22) { 27276 if (k22 === void 0) k22 = k2; 27277 var desc = Object.getOwnPropertyDescriptor(m2, k2); 27278 if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { 27279 desc = { enumerable: true, get: function() { 27280 return m2[k2]; 27281 } }; 27282 } 27283 Object.defineProperty(o2, k22, desc); 27284 } : function(o2, m2, k2, k22) { 27285 if (k22 === void 0) k22 = k2; 27286 o2[k22] = m2[k2]; 27287 }); 27288 var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o2, v2) { 27289 Object.defineProperty(o2, "default", { enumerable: true, value: v2 }); 27290 } : function(o2, v2) { 27291 o2["default"] = v2; 27292 }); 27293 var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) { 27294 if (mod && mod.__esModule) return mod; 27295 var result = {}; 27296 if (mod != null) { 27297 for (var k2 in mod) if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2)) __createBinding(result, mod, k2); 27298 } 27299 __setModuleDefault(result, mod); 27300 return result; 27301 }; 27302 var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { 27303 return mod && mod.__esModule ? mod : { "default": mod }; 27304 }; 27305 Object.defineProperty(Typesense$1, "__esModule", { value: true }); 27306 Typesense$1.Errors = Typesense$1.SearchClient = Typesense$1.Client = void 0; 27307 var Client_1 = __importDefault(requireClient()); 27308 Typesense$1.Client = Client_1.default; 27309 var SearchClient_1 = __importDefault(requireSearchClient()); 27310 Typesense$1.SearchClient = SearchClient_1.default; 27311 var Errors2 = __importStar(requireErrors()); 27312 Typesense$1.Errors = Errors2; 27313 Typesense$1.default = { Client: Client_1.default, SearchClient: SearchClient_1.default, Errors: Errors2 }; 27314 return Typesense$1; 27315} 27316var SearchRequestAdapter = {}; 27317var slicedToArray = { exports: {} }; 27318var arrayWithHoles = { exports: {} }; 27319var hasRequiredArrayWithHoles; 27320function requireArrayWithHoles() { 27321 if (hasRequiredArrayWithHoles) return arrayWithHoles.exports; 27322 hasRequiredArrayWithHoles = 1; 27323 (function(module) { 27324 function _arrayWithHoles2(r2) { 27325 if (Array.isArray(r2)) return r2; 27326 } 27327 module.exports = _arrayWithHoles2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27328 })(arrayWithHoles); 27329 return arrayWithHoles.exports; 27330} 27331var iterableToArrayLimit = { exports: {} }; 27332var hasRequiredIterableToArrayLimit; 27333function requireIterableToArrayLimit() { 27334 if (hasRequiredIterableToArrayLimit) return iterableToArrayLimit.exports; 27335 hasRequiredIterableToArrayLimit = 1; 27336 (function(module) { 27337 function _iterableToArrayLimit2(r2, l2) { 27338 var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; 27339 if (null != t2) { 27340 var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
27341 try { 27342 if (i2 = (t2 = t2.call(r2)).next, 0 === l2) { 27343 if (Object(t2) !== t2) return; 27344 f2 = false; 27345 } else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; 27346 } catch (r3) { 27347 o2 = true, n2 = r3; 27348 } finally { 27349 try { 27350 if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; 27351 } finally { 27352 if (o2) throw n2; 27353 } 27354 } 27355 return a2; 27356 } 27357 } 27358 module.exports = _iterableToArrayLimit2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27359 })(iterableToArrayLimit); 27360 return iterableToArrayLimit.exports; 27361} 27362var unsupportedIterableToArray = { exports: {} }; 27363var arrayLikeToArray = { exports: {} }; 27364var hasRequiredArrayLikeToArray; 27365function requireArrayLikeToArray() { 27366 if (hasRequiredArrayLikeToArray) return arrayLikeToArray.exports; 27367 hasRequiredArrayLikeToArray = 1; 27368 (function(module) { 27369 function _arrayLikeToArray2(r2, a2) { 27370 (null == a2 || a2 > r2.length) && (a2 = r2.length); 27371 for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; 27372 return n2; 27373 } 27374 module.exports = _arrayLikeToArray2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27375 })(arrayLikeToArray); 27376 return arrayLikeToArray.exports; 27377} 27378var hasRequiredUnsupportedIterableToArray; 27379function requireUnsupportedIterableToArray() { 27380 if (hasRequiredUnsupportedIterableToArray) return unsupportedIterableToArray.exports; 27381 hasRequiredUnsupportedIterableToArray = 1; 27382 (function(module) { 27383 var arrayLikeToArray2 = requireArrayLikeToArray(); 27384 function _unsupportedIterableToArray2(r2, a2) { 27385 if (r2) { 27386 if ("string" == typeof r2) return arrayLikeToArray2(r2, a2); 27387 var t2 = {}.toString.call(r2).slice(8, -1); 27388 return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? arrayLikeToArray2(r2, a2) : void 0; 27389 } 27390 } 27391 module.exports = _unsupportedIterableToArray2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27392 })(unsupportedIterableToArray); 27393 return unsupportedIterableToArray.exports; 27394} 27395var nonIterableRest = { exports: {} }; 27396var hasRequiredNonIterableRest; 27397function requireNonIterableRest() { 27398 if (hasRequiredNonIterableRest) return nonIterableRest.exports; 27399 hasRequiredNonIterableRest = 1; 27400 (function(module) { 27401 function _nonIterableRest2() { 27402 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 27403 } 27404 module.exports = _nonIterableRest2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27405 })(nonIterableRest); 27406 return nonIterableRest.exports; 27407} 27408var hasRequiredSlicedToArray; 27409function requireSlicedToArray() { 27410 if (hasRequiredSlicedToArray) return slicedToArray.exports; 27411 hasRequiredSlicedToArray = 1; 27412 (function(module) { 27413 var arrayWithHoles2 = requireArrayWithHoles(); 27414 var iterableToArrayLimit2 = requireIterableToArrayLimit(); 27415 var unsupportedIterableToArray2 = requireUnsupportedIterableToArray(); 27416 var nonIterableRest2 = requireNonIterableRest(); 27417 function _slicedToArray2(r2, e2) { 27418 return arrayWithHoles2(r2) || iterableToArrayLimit2(r2, e2) || unsupportedIterableToArray2(r2, e2) || nonIterableRest2(); 27419 } 27420 module.exports = _slicedToArray2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27421 })(slicedToArray); 27422 return slicedToArray.exports; 27423} 27424var hasRequiredSearchRequestAdapter; 27425function requireSearchRequestAdapter() { 27426 if (hasRequiredSearchRequestAdapter) return SearchRequestAdapter; 27427 hasRequiredSearchRequestAdapter = 1; 27428 var _interopRequireDefault = interopRequireDefaultExports; 27429 Object.defineProperty(SearchRequestAdapter, "__esModule", { 27430 value: true 27431 }); 27432 SearchRequestAdapter.SearchRequestAdapter = void 0; 27433 var _regenerator = _interopRequireDefault(requireRegenerator()); 27434 var _asyncToGenerator2 = _interopRequireDefault(requireAsyncToGenerator()); 27435 var _slicedToArray2 = _interopRequireDefault(requireSlicedToArray()); 27436 var _classCallCheck2 = _interopRequireDefault(requireClassCallCheck()); 27437 var _createClass2 = _interopRequireDefault(requireCreateClass()); 27438 var SearchRequestAdapter$1 = /* @__PURE__ */ function() { 27439 function SearchRequestAdapter2(instantsearchRequests, typesenseClient, configuration) { 27440 (0, _classCallCheck2["default"])(this, SearchRequestAdapter2); 27441 this.instantsearchRequests = instantsearchRequests; 27442 this.typesenseClient = typesenseClient; 27443 this.configuration = configuration; 27444 this.additionalSearchParameters = configuration.additionalSearchParameters; 27445 this.collectionSpecificSearchParameters = configuration.collectionSpecificSearchParameters; 27446 } 27447 (0, _createClass2["default"])(SearchRequestAdapter2, [{ 27448 key: "_shouldUseExactMatchForField", 27449 value: function _shouldUseExactMatchForField(fieldName, collectionName) { 27450 var _this$configuration$c, _this$configuration$f; 27451 if (((_this$configuration$c = this.configuration.collectionSpecificFilterByOptions) === null || _this$configuration$c === void 0 || (_this$configuration$c = _this$configuration$c[collectionName]) === null || _this$configuration$c === void 0 || (_this$configuration$c = _this$configuration$c[fieldName]) === null || _this$configuration$c === void 0 ? void 0 : _this$configuration$c.exactMatch) === false || ((_this$configuration$f = this.configuration.filterByOptions) === null || _this$configuration$f === void 0 || (_this$configuration$f = _this$configuration$f[fieldName]) === null || _this$configuration$f === void 0 ? void 0 : _this$configuration$f.exactMatch) === false) { 27452 return false;
vendor: 14,547 bytes, lines 27453-27716
27453 } else { 27454 return true; 27455 } 27456 } 27457 }, { 27458 key: "_adaptFacetFilters", 27459 value: function _adaptFacetFilters(facetFilters, collectionName) { 27460 var _this = this; 27461 var adaptedResult = ""; 27462 if (!facetFilters) { 27463 return adaptedResult; 27464 } 27465 var transformedTypesenseFilters = facetFilters.map(function(item3) { 27466 if (Array.isArray(item3)) { 27467 var intermediateFacetFilters = {}; 27468 item3.forEach(function(facetFilter) { 27469 var _this$_parseFacetFilt = _this._parseFacetFilter(facetFilter), fieldName2 = _this$_parseFacetFilt.fieldName, fieldValue2 = _this$_parseFacetFilt.fieldValue; 27470 intermediateFacetFilters[fieldName2] = intermediateFacetFilters[fieldName2] || []; 27471 intermediateFacetFilters[fieldName2].push(fieldValue2); 27472 }); 27473 if (Object.keys(intermediateFacetFilters).length > 1) { 27474 console.error("[Typesense-Instantsearch-Adapter] Typesense does not support cross-field ORs at the moment. The adapter could not OR values between these fields: ".concat(Object.keys(intermediateFacetFilters).join(","))); 27475 } 27476 var fieldName = Object.keys(intermediateFacetFilters)[0]; 27477 var fieldValues = intermediateFacetFilters[fieldName]; 27478 var _fieldValues$reduce3 = fieldValues.reduce(function(result, fieldValue2) { 27479 if (fieldValue2.startsWith("-") && !_this._isNumber(fieldValue2)) { 27480 result[0].push(fieldValue2.substring(1)); 27481 } else { 27482 result[1].push(fieldValue2); 27483 } 27484 return result; 27485 }, [[], []]), _fieldValues$reduce4 = (0, _slicedToArray2["default"])(_fieldValues$reduce3, 2), excludedFieldValues = _fieldValues$reduce4[0], includedFieldValues = _fieldValues$reduce4[1]; 27486 var typesenseFilterStringComponents = []; 27487 if (includedFieldValues.length > 0) { 27488 var operator = _this._shouldUseExactMatchForField(fieldName, collectionName) ? ":=" : ":"; 27489 typesenseFilterStringComponents.push("".concat(fieldName).concat(operator, "[").concat(includedFieldValues.map(function(v2) { 27490 return _this._escapeFacetValue(v2); 27491 }).join(","), "]")); 27492 } 27493 if (excludedFieldValues.length > 0) { 27494 var _operator = _this._shouldUseExactMatchForField(fieldName, collectionName) ? ":!=" : ":!"; 27495 typesenseFilterStringComponents.push("".concat(fieldName).concat(_operator, "[").concat(excludedFieldValues.map(function(v2) { 27496 return _this._escapeFacetValue(v2); 27497 }).join(","), "]")); 27498 } 27499 var typesenseFilterString = typesenseFilterStringComponents.filter(function(f2) { 27500 return f2; 27501 }).join(" && "); 27502 return typesenseFilterString; 27503 } else { 27504 var _this$_parseFacetFilt3 = _this._parseFacetFilter(item3), _fieldName = _this$_parseFacetFilt3.fieldName, fieldValue = _this$_parseFacetFilt3.fieldValue; 27505 var _typesenseFilterString; 27506 if (fieldValue.startsWith("-") && !_this._isNumber(fieldValue)) { 27507 var _operator2 = _this._shouldUseExactMatchForField(_fieldName, collectionName) ? ":!=" : ":!"; 27508 _typesenseFilterString = "".concat(_fieldName).concat(_operator2, "[").concat(_this._escapeFacetValue(fieldValue.substring(1)), "]"); 27509 } else { 27510 var _operator3 = _this._shouldUseExactMatchForField(_fieldName, collectionName) ? ":=" : ":"; 27511 _typesenseFilterString = "".concat(_fieldName).concat(_operator3, "[").concat(_this._escapeFacetValue(fieldValue), "]"); 27512 } 27513 return _typesenseFilterString; 27514 } 27515 }); 27516 adaptedResult = transformedTypesenseFilters.join(" && "); 27517 return adaptedResult; 27518 } 27519 }, { 27520 key: "_parseFacetFilter", 27521 value: function _parseFacetFilter(facetFilter) { 27522 var _this$configuration$f2; 27523 var filterStringMatchingRegex, facetFilterMatches, fieldName, fieldValue; 27524 if (((_this$configuration$f2 = this.configuration.facetableFieldsWithSpecialCharacters) === null || _this$configuration$f2 === void 0 ? void 0 : _this$configuration$f2.length) > 0) { 27525 var sanitizedFacetableFieldsWithSpecialCharacters = this.configuration.facetableFieldsWithSpecialCharacters.flat().map(function(f2) { 27526 return f2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); 27527 }); 27528 filterStringMatchingRegex = new RegExp("^(".concat(sanitizedFacetableFieldsWithSpecialCharacters.join("|"), "):(.*)$")); 27529 facetFilterMatches = facetFilter.match(filterStringMatchingRegex); 27530 if (facetFilterMatches != null) { 27531 fieldName = "".concat(facetFilterMatches[1]); 27532 fieldValue = "".concat(facetFilterMatches[2]); 27533 return { 27534 fieldName, 27535 fieldValue 27536 }; 27537 } 27538 } 27539 filterStringMatchingRegex = this.constructor.DEFAULT_FACET_FILTER_STRING_MATCHING_REGEX; 27540 facetFilterMatches = facetFilter.match(filterStringMatchingRegex); 27541 if (facetFilterMatches == null) { 27542 console.error("[Typesense-Instantsearch-Adapter] Parsing failed for a facet filter `".concat(facetFilter, "` with the Regex `").concat(filterStringMatchingRegex, "`. If you have field names with special characters, be sure to add them to a parameter called `facetableFieldsWithSpecialCharacters` when instantiating the adapter.")); 27543 } else { 27544 fieldName = "".concat(facetFilterMatches[1]).concat(facetFilterMatches[2]); 27545 fieldValue = "".concat(facetFilterMatches[3]); 27546 } 27547 return { 27548 fieldName, 27549 fieldValue 27550 }; 27551 } 27552 }, { 27553 key: "_escapeFacetValue", 27554 value: function _escapeFacetValue(value) { 27555 if (typeof value === "boolean" || value === "true" || value === "false" || this._isNumber(value)) { 27556 return value; 27557 } 27558 return "`".concat(value, "`"); 27559 } 27560 }, { 27561 key: "_isNumber", 27562 value: function _isNumber5(value) { 27563 return Number.isInteger(value % 1) || // Mod 1 will automatically try converting string values to integer/float 27564 !!(value % 1); 27565 } 27566 }, { 27567 key: "_adaptNumericFilters", 27568 value: function _adaptNumericFilters(numericFilters) { 27569 var _this2 = this; 27570 var adaptedResult = ""; 27571 if (!numericFilters) { 27572 return adaptedResult; 27573 } 27574 var filtersHash = {}; 27575 numericFilters.forEach(function(filter) { 27576 var _this2$_parseNumericF = _this2._parseNumericFilter(filter), fieldName = _this2$_parseNumericF.fieldName, operator = _this2$_parseNumericF.operator, fieldValue = _this2$_parseNumericF.fieldValue; 27577 filtersHash[fieldName] = filtersHash[fieldName] || {}; 27578 filtersHash[fieldName][operator] = fieldValue; 27579 }); 27580 var adaptedFilters = []; 27581 Object.keys(filtersHash).forEach(function(field) { 27582 if (filtersHash[field]["<="] != null && filtersHash[field][">="] != null) { 27583 adaptedFilters.push("".concat(field, ":=[").concat(filtersHash[field][">="], "..").concat(filtersHash[field]["<="], "]")); 27584 } else if (filtersHash[field]["<="] != null) { 27585 adaptedFilters.push("".concat(field, ":<=").concat(filtersHash[field]["<="])); 27586 } else if (filtersHash[field][">="] != null) { 27587 adaptedFilters.push("".concat(field, ":>=").concat(filtersHash[field][">="])); 27588 } else if (filtersHash[field]["="] != null) { 27589 adaptedFilters.push("".concat(field, ":=").concat(filtersHash[field]["="])); 27590 } else { 27591 console.warn("[Typesense-Instantsearch-Adapter] Unsupported operator found ".concat(JSON.stringify(filtersHash[field]))); 27592 } 27593 }); 27594 adaptedResult = adaptedFilters.join(" && "); 27595 return adaptedResult; 27596 } 27597 }, { 27598 key: "_parseNumericFilter", 27599 value: function _parseNumericFilter(numericFilter) { 27600 var _this$configuration$f3; 27601 var filterStringMatchingRegex, numericFilterMatches; 27602 var fieldName, operator, fieldValue; 27603 if (((_this$configuration$f3 = this.configuration.facetableFieldsWithSpecialCharacters) === null || _this$configuration$f3 === void 0 ? void 0 : _this$configuration$f3.length) > 0) { 27604 var sanitizedFacetableFieldsWithSpecialCharacters = this.configuration.facetableFieldsWithSpecialCharacters.map(function(f2) { 27605 return f2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); 27606 }); 27607 filterStringMatchingRegex = new RegExp("^(".concat(sanitizedFacetableFieldsWithSpecialCharacters.join("|"), ")(<=|>=|>|<|=)(.*)$")); 27608 numericFilterMatches = numericFilter.match(filterStringMatchingRegex); 27609 if (numericFilterMatches != null) { 27610 var _numericFilterMatches = numericFilterMatches; 27611 var _numericFilterMatches2 = (0, _slicedToArray2["default"])(_numericFilterMatches, 4); 27612 fieldName = _numericFilterMatches2[1]; 27613 operator = _numericFilterMatches2[2]; 27614 fieldValue = _numericFilterMatches2[3]; 27615 return { 27616 fieldName, 27617 operator, 27618 fieldValue 27619 }; 27620 } 27621 } 27622 filterStringMatchingRegex = this.constructor.DEFAULT_NUMERIC_FILTER_STRING_MATCHING_REGEX; 27623 numericFilterMatches = numericFilter.match(filterStringMatchingRegex); 27624 if (numericFilterMatches == null) { 27625 console.error("[Typesense-Instantsearch-Adapter] Parsing failed for a numeric filter `".concat(numericFilter, "` with the Regex `").concat(filterStringMatchingRegex, "`. If you have field names with special characters, be sure to add them to a parameter called `facetableFieldsWithSpecialCharacters` when instantiating the adapter.")); 27626 } else { 27627 var _numericFilterMatches3 = numericFilterMatches; 27628 var _numericFilterMatches4 = (0, _slicedToArray2["default"])(_numericFilterMatches3, 4); 27629 fieldName = _numericFilterMatches4[1]; 27630 operator = _numericFilterMatches4[2]; 27631 fieldValue = _numericFilterMatches4[3]; 27632 } 27633 return { 27634 fieldName, 27635 operator, 27636 fieldValue 27637 }; 27638 } 27639 }, { 27640 key: "_adaptGeoFilter", 27641 value: function _adaptGeoFilter(_ref) { 27642 var insideBoundingBox = _ref.insideBoundingBox, aroundRadius = _ref.aroundRadius, aroundLatLng = _ref.aroundLatLng, insidePolygon = _ref.insidePolygon; 27643 if (insideBoundingBox) { 27644 var x1, y1, x2, y2; 27645 if (Array.isArray(insideBoundingBox)) { 27646 var _insideBoundingBox$fl = insideBoundingBox.flat(); 27647 var _insideBoundingBox$fl2 = (0, _slicedToArray2["default"])(_insideBoundingBox$fl, 4); 27648 x1 = _insideBoundingBox$fl2[0]; 27649 y1 = _insideBoundingBox$fl2[1]; 27650 x2 = _insideBoundingBox$fl2[2]; 27651 y2 = _insideBoundingBox$fl2[3]; 27652 } else { 27653 var _insideBoundingBox$sp = insideBoundingBox.split(","); 27654 var _insideBoundingBox$sp2 = (0, _slicedToArray2["default"])(_insideBoundingBox$sp, 4); 27655 x1 = _insideBoundingBox$sp2[0]; 27656 y1 = _insideBoundingBox$sp2[1]; 27657 x2 = _insideBoundingBox$sp2[2]; 27658 y2 = _insideBoundingBox$sp2[3]; 27659 } 27660 return "".concat(this.configuration.geoLocationField, ":(").concat(x1, ", ").concat(y1, ", ").concat(x1, ", ").concat(y2, ", ").concat(x2, ", ").concat(y2, ", ").concat(x2, ", ").concat(y1, ")"); 27661 } 27662 if (aroundLatLng || aroundRadius) { 27663 if (!aroundRadius || aroundRadius === "all") { 27664 throw new Error("[Typesense-Instantsearch-Adapter] In Typesense, geo-filtering around a lat/lng also requires a numerical radius. So the `aroundRadius` parameter is required when `aroundLatLng` is used. If you intend to just geo-sort around a lat/long, you want to use the sortBy InstantSearch widget (or a virtual sortBy custom widget)."); 27665 } 27666 var adaptedAroundRadius = "".concat(parseFloat(aroundRadius) / 1e3, " km"); 27667 return "".concat(this.configuration.geoLocationField, ":(").concat(aroundLatLng, ", ").concat(adaptedAroundRadius, ")"); 27668 } 27669 if (insidePolygon) { 27670 var coordinates = insidePolygon; 27671 if (Array.isArray(insidePolygon)) { 27672 coordinates = insidePolygon.flat().join(","); 27673 } 27674 return "".concat(this.configuration.geoLocationField, ":(").concat(coordinates, ")"); 27675 } 27676 } 27677 }, { 27678 key: "_adaptFilters", 27679 value: function _adaptFilters(instantsearchParams, collectionName) { 27680 var adaptedFilters = []; 27681 if (instantsearchParams.filters) { 27682 adaptedFilters.push(instantsearchParams.filters); 27683 } 27684 adaptedFilters.push(this._adaptFacetFilters(instantsearchParams.facetFilters, collectionName)); 27685 adaptedFilters.push(this._adaptNumericFilters(instantsearchParams.numericFilters)); 27686 adaptedFilters.push(this._adaptGeoFilter(instantsearchParams)); 27687 return adaptedFilters.filter(function(filter) { 27688 return filter && filter !== ""; 27689 }).join(" && "); 27690 } 27691 }, { 27692 key: "_adaptIndexName", 27693 value: function _adaptIndexName(indexName) { 27694 return indexName.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[1]; 27695 } 27696 }, { 27697 key: "_adaptSortBy", 27698 value: function _adaptSortBy(indexName) { 27699 return indexName.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[3]; 27700 } 27701 }, { 27702 key: "_adaptFacetBy", 27703 value: function _adaptFacetBy(facets, collectionName) { 27704 var _this3 = this; 27705 return [facets].flat().map(function(facet) { 27706 var _this3$configuration$; 27707 if ((_this3$configuration$ = _this3.configuration.collectionSpecificFacetByOptions) !== null && _this3$configuration$ !== void 0 && (_this3$configuration$ = _this3$configuration$[collectionName]) !== null && _this3$configuration$ !== void 0 && _this3$configuration$[facet]) { 27708 return "".concat(facet).concat(_this3.configuration.collectionSpecificFacetByOptions[collectionName][facet]); 27709 } else if (_this3.configuration.facetByOptions[facet]) { 27710 return "".concat(facet).concat(_this3.configuration.facetByOptions[facet]); 27711 } else { 27712 return facet; 27713 } 27714 }).join(","); 27715 } 27716 }, {
27717 key: "_buildSearchParameters", 27718 value: function _buildSearchParameters(instantsearchRequest) { 27719 var params = instantsearchRequest.params; 27720 var indexName = instantsearchRequest.indexName; 27721 var adaptedCollectionName = this._adaptIndexName(indexName); 27722 var snakeCasedAdditionalSearchParameters = {}; 27723 for (var _i2 = 0, _Object$entries = Object.entries(this.additionalSearchParameters); _i2 < _Object$entries.length; _i2++) { 27724 var _Object$entries$_i2 = (0, _slicedToArray2["default"])(_Object$entries[_i2], 2), key2 = _Object$entries$_i2[0], value = _Object$entries$_i2[1]; 27725 snakeCasedAdditionalSearchParameters[this._camelToSnakeCase(key2)] = value; 27726 } 27727 if (this.collectionSpecificSearchParameters[adaptedCollectionName]) { 27728 for (var _i22 = 0, _Object$entries2 = Object.entries(this.collectionSpecificSearchParameters[adaptedCollectionName]); _i22 < _Object$entries2.length; _i22++) { 27729 var _Object$entries2$_i2 = (0, _slicedToArray2["default"])(_Object$entries2[_i22], 2), _key = _Object$entries2$_i2[0], _value = _Object$entries2$_i2[1]; 27730 snakeCasedAdditionalSearchParameters[this._camelToSnakeCase(_key)] = _value; 27731 } 27732 } 27733 var typesenseSearchParams = Object.assign({}, snakeCasedAdditionalSearchParameters); 27734 var adaptedSortBy = this._adaptSortBy(indexName); 27735 Object.assign(typesenseSearchParams, { 27736 collection: adaptedCollectionName, 27737 q: params.query === "" || params.query === void 0 ? "*" : params.query, 27738 facet_by: snakeCasedAdditionalSearchParameters.facet_by || this._adaptFacetBy(params.facets, adaptedCollectionName), 27739 filter_by: this._adaptFilters(params, adaptedCollectionName) || snakeCasedAdditionalSearchParameters.filter_by, 27740 sort_by: adaptedSortBy || snakeCasedAdditionalSearchParameters.sort_by, 27741 max_facet_values: params.maxValuesPerFacet, 27742 page: (params.page || 0) + 1 27743 }); 27744 if (params.hitsPerPage) { 27745 typesenseSearchParams.per_page = params.hitsPerPage; 27746 } 27747 if (params.facetQuery) { 27748 typesenseSearchParams.facet_query = "".concat(params.facetName, ":").concat(params.facetQuery); 27749 typesenseSearchParams.per_page = 0; 27750 } 27751 if (params.typesenseVectorQuery) { 27752 typesenseSearchParams.vector_query = params.typesenseVectorQuery; 27753 } 27754 return Object.fromEntries(Object.entries(typesenseSearchParams).filter(function(_ref22) { 27755 var _ref3 = (0, _slicedToArray2["default"])(_ref22, 2); 27756 _ref3[0]; 27757 var v2 = _ref3[1]; 27758 return v2 != null && v2 !== ""; 27759 })); 27760 } 27761 }, { 27762 key: "_camelToSnakeCase", 27763 value: function _camelToSnakeCase(str) { 27764 return str.split(/(?=[A-Z])/).join("_").toLowerCase(); 27765 } 27766 }, { 27767 key: "request", 27768 value: function() { 27769 var _request = (0, _asyncToGenerator2["default"])(/* @__PURE__ */ _regenerator["default"].mark(function _callee() { 27770 var _this4 = this; 27771 var searches; 27772 return _regenerator["default"].wrap(function _callee$(_context2) { 27773 while (1) switch (_context2.prev = _context2.next) { 27774 case 0: 27775 searches = this.instantsearchRequests.map(function(instantsearchRequest) { 27776 return _this4._buildSearchParameters(instantsearchRequest); 27777 }); 27778 return _context2.abrupt("return", this.typesenseClient.multiSearch.perform({ 27779 searches 27780 })); 27781 case 2: 27782 case "end": 27783 return _context2.stop(); 27784 } 27785 }, _callee, this); 27786 })); 27787 function request() { 27788 return _request.apply(this, arguments); 27789 } 27790 return request; 27791 }() 27792 }], [{ 27793 key: "INDEX_NAME_MATCHING_REGEX", 27794 get: function get4() { 27795 return new RegExp("^(.+?)(?=(/sort/(.*))|$)"); 27796 } 27797 }, { 27798 key: "DEFAULT_FACET_FILTER_STRING_MATCHING_REGEX", 27799 get: function get4() { 27800 return new RegExp("(.*)((?!:).):(?!:)(.*)"); 27801 } 27802 }, {
27803 key: "DEFAULT_NUMERIC_FILTER_STRING_MATCHING_REGEX", 27804 get: function get4() { 27805 return new RegExp("(.*?)(<=|>=|>|<|=)(.*)"); 27806 } 27807 }]); 27808 return SearchRequestAdapter2; 27809 }(); 27810 SearchRequestAdapter.SearchRequestAdapter = SearchRequestAdapter$1; 27811 return SearchRequestAdapter; 27812} 27813var SearchResponseAdapter = {}; 27814var toConsumableArray = { exports: {} }; 27815var arrayWithoutHoles = { exports: {} }; 27816var hasRequiredArrayWithoutHoles; 27817function requireArrayWithoutHoles() { 27818 if (hasRequiredArrayWithoutHoles) return arrayWithoutHoles.exports; 27819 hasRequiredArrayWithoutHoles = 1; 27820 (function(module) { 27821 var arrayLikeToArray2 = requireArrayLikeToArray(); 27822 function _arrayWithoutHoles2(r2) { 27823 if (Array.isArray(r2)) return arrayLikeToArray2(r2); 27824 } 27825 module.exports = _arrayWithoutHoles2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27826 })(arrayWithoutHoles); 27827 return arrayWithoutHoles.exports; 27828} 27829var iterableToArray = { exports: {} }; 27830var hasRequiredIterableToArray; 27831function requireIterableToArray() { 27832 if (hasRequiredIterableToArray) return iterableToArray.exports; 27833 hasRequiredIterableToArray = 1; 27834 (function(module) { 27835 function _iterableToArray2(r2) { 27836 if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); 27837 } 27838 module.exports = _iterableToArray2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27839 })(iterableToArray); 27840 return iterableToArray.exports; 27841} 27842var nonIterableSpread = { exports: {} }; 27843var hasRequiredNonIterableSpread; 27844function requireNonIterableSpread() { 27845 if (hasRequiredNonIterableSpread) return nonIterableSpread.exports; 27846 hasRequiredNonIterableSpread = 1; 27847 (function(module) { 27848 function _nonIterableSpread2() { 27849 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 27850 } 27851 module.exports = _nonIterableSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27852 })(nonIterableSpread); 27853 return nonIterableSpread.exports; 27854} 27855var hasRequiredToConsumableArray; 27856function requireToConsumableArray() { 27857 if (hasRequiredToConsumableArray) return toConsumableArray.exports; 27858 hasRequiredToConsumableArray = 1; 27859 (function(module) { 27860 var arrayWithoutHoles2 = requireArrayWithoutHoles(); 27861 var iterableToArray2 = requireIterableToArray(); 27862 var unsupportedIterableToArray2 = requireUnsupportedIterableToArray(); 27863 var nonIterableSpread2 = requireNonIterableSpread(); 27864 function _toConsumableArray2(r2) { 27865 return arrayWithoutHoles2(r2) || iterableToArray2(r2) || unsupportedIterableToArray2(r2) || nonIterableSpread2(); 27866 } 27867 module.exports = _toConsumableArray2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27868 })(toConsumableArray); 27869 return toConsumableArray.exports; 27870} 27871var defineProperty = { exports: {} }; 27872var hasRequiredDefineProperty; 27873function requireDefineProperty() { 27874 if (hasRequiredDefineProperty) return defineProperty.exports; 27875 hasRequiredDefineProperty = 1; 27876 (function(module) { 27877 var toPropertyKey2 = requireToPropertyKey(); 27878 function _defineProperty2(e2, r2, t2) { 27879 return (r2 = toPropertyKey2(r2)) in e2 ? Object.defineProperty(e2, r2, { 27880 value: t2, 27881 enumerable: true, 27882 configurable: true, 27883 writable: true 27884 }) : e2[r2] = t2, e2; 27885 } 27886 module.exports = _defineProperty2, module.exports.__esModule = true, module.exports["default"] = module.exports; 27887 })(defineProperty); 27888 return defineProperty.exports; 27889} 27890var utils$3 = {}; 27891var hasRequiredUtils; 27892function requireUtils() { 27893 if (hasRequiredUtils) return utils$3; 27894 hasRequiredUtils = 1; 27895 Object.defineProperty(utils$3, "__esModule", { 27896 value: true 27897 }); 27898 utils$3.utils = void 0; 27899 var utils2 = { 27900 _adaptHighlightTag: function _adaptHighlightTag(value, highlightPreTag, highlightPostTag) { 27901 return value.replace(new RegExp("<mark>", "g"), highlightPreTag || "<mark>").replace(new RegExp("</mark>", "g"), highlightPostTag || "</mark>"); 27902 }, 27903 _adaptNumberOfPages: function _adaptNumberOfPages() { 27904 var result = this.typesenseResponse.found / this.typesenseResponse.request_params.per_page; 27905 if (Number.isFinite(result)) { 27906 return Math.ceil(result); 27907 } else { 27908 return 1; 27909 } 27910 } 27911 }; 27912 utils$3.utils = utils2; 27913 return utils$3; 27914} 27915var hasRequiredSearchResponseAdapter; 27916function requireSearchResponseAdapter() { 27917 if (hasRequiredSearchResponseAdapter) return SearchResponseAdapter; 27918 hasRequiredSearchResponseAdapter = 1; 27919 var _interopRequireDefault = interopRequireDefaultExports; 27920 Object.defineProperty(SearchResponseAdapter, "__esModule", { 27921 value: true 27922 }); 27923 SearchResponseAdapter.SearchResponseAdapter = void 0; 27924 var _typeof2 = _interopRequireDefault(require_typeof()); 27925 var _slicedToArray2 = _interopRequireDefault(requireSlicedToArray()); 27926 var _toConsumableArray2 = _interopRequireDefault(requireToConsumableArray()); 27927 var _defineProperty2 = _interopRequireDefault(requireDefineProperty()); 27928 var _classCallCheck2 = _interopRequireDefault(requireClassCallCheck()); 27929 var _createClass2 = _interopRequireDefault(requireCreateClass()); 27930 var _utils = requireUtils(); 27931 function ownKeys2(object, enumerableOnly) { 27932 var keys = Object.keys(object); 27933 if (Object.getOwnPropertySymbols) { 27934 var symbols = Object.getOwnPropertySymbols(object); 27935 enumerableOnly && (symbols = symbols.filter(function(sym) { 27936 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 27937 })), keys.push.apply(keys, symbols); 27938 } 27939 return keys; 27940 }
27941 function _objectSpread2(target) { 27942 for (var i2 = 1; i2 < arguments.length; i2++) { 27943 var source = null != arguments[i2] ? arguments[i2] : {}; 27944 i2 % 2 ? ownKeys2(Object(source), true).forEach(function(key2) { 27945 (0, _defineProperty2["default"])(target, key2, source[key2]); 27946 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key2) { 27947 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 27948 }); 27949 } 27950 return target; 27951 } 27952 var SearchResponseAdapter$1 = /* @__PURE__ */ function() { 27953 function SearchResponseAdapter2(typesenseResponse, instantsearchRequest, configuration) { 27954 var allTypesenseResponses = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : []; 27955 (0, _classCallCheck2["default"])(this, SearchResponseAdapter2); 27956 this.typesenseResponse = typesenseResponse; 27957 this.instantsearchRequest = instantsearchRequest; 27958 this.configuration = configuration; 27959 this.allTypesenseResponses = allTypesenseResponses; 27960 } 27961 (0, _createClass2["default"])(SearchResponseAdapter2, [{ 27962 key: "_adaptGroupedHits", 27963 value: function _adaptGroupedHits(typesenseGroupedHits) { 27964 var _this = this; 27965 var adaptedResult = []; 27966 adaptedResult = typesenseGroupedHits.map(function(groupedHit) { 27967 var adaptedHits = _this._adaptHits(groupedHit.hits);
vendor: 10,109 bytes, lines 27968-28149
27968 adaptedHits.forEach(function(hit) { 27969 hit["group_key"] = hit["_group_key"] = groupedHit.group_key; 27970 if (groupedHit.found) { 27971 hit["_group_found"] = groupedHit.found; 27972 } 27973 }); 27974 return adaptedHits; 27975 }); 27976 if (this.configuration.flattenGroupedHits) { 27977 adaptedResult = adaptedResult.flat(); 27978 } else { 27979 adaptedResult = adaptedResult.map(function(adaptedGroupedHit) { 27980 return _objectSpread2(_objectSpread2({}, adaptedGroupedHit[0]), {}, { 27981 _grouped_hits: adaptedGroupedHit 27982 }); 27983 }); 27984 } 27985 return adaptedResult; 27986 } 27987 }, { 27988 key: "_adaptHits", 27989 value: function _adaptHits(typesenseHits) { 27990 var _this2 = this; 27991 var adaptedResult = []; 27992 adaptedResult = typesenseHits.map(function(typesenseHit) { 27993 var adaptedHit = _objectSpread2({}, typesenseHit.document); 27994 adaptedHit.objectID = typesenseHit.document.id; 27995 adaptedHit._snippetResult = _this2._adaptHighlightResult(typesenseHit, "snippet"); 27996 adaptedHit._highlightResult = _this2._adaptHighlightResult(typesenseHit, "value"); 27997 adaptedHit._rawTypesenseHit = typesenseHit; 27998 ["text_match", "geo_distance_meters", "curated", "text_match_info", "hybrid_search_info", "vector_distance"].forEach(function(metadataField) { 27999 if (Object.keys(typesenseHit).includes(metadataField) && !Object.keys(adaptedHit).includes(metadataField)) { 28000 adaptedHit[metadataField] = typesenseHit[metadataField]; 28001 } 28002 }); 28003 var geoLocationValue = adaptedHit[_this2.configuration.geoLocationField]; 28004 if (geoLocationValue) { 28005 adaptedHit._geoloc = { 28006 lat: geoLocationValue[0], 28007 lng: geoLocationValue[1] 28008 }; 28009 } 28010 return adaptedHit; 28011 }); 28012 return adaptedResult; 28013 } 28014 }, { 28015 key: "_adaptHighlightResult", 28016 value: function _adaptHighlightResult(typesenseHit, snippetOrValue) { 28017 var result = {}; 28018 if (typesenseHit.highlight != null && this.isHighlightPost0240RCN32Format(typesenseHit.highlight)) { 28019 this.adaptHighlightObject(typesenseHit, result, snippetOrValue); 28020 } else { 28021 this.adaptHighlightsArray(typesenseHit, result, snippetOrValue); 28022 } 28023 return result; 28024 } 28025 }, { 28026 key: "isHighlightPost0240RCN32Format", 28027 value: function isHighlightPost0240RCN32Format(highlight2) { 28028 return highlight2.full == null && highlight2.snippet == null; 28029 } 28030 }, { 28031 key: "adaptHighlightsArray", 28032 value: function adaptHighlightsArray(typesenseHit, result, snippetOrValue) { 28033 var _this3 = this; 28034 Object.assign.apply(Object, [result].concat((0, _toConsumableArray2["default"])(Object.entries(typesenseHit.document).map(function(_ref) { 28035 var _ref22 = (0, _slicedToArray2["default"])(_ref, 2), attribute = _ref22[0], value = _ref22[1]; 28036 return (0, _defineProperty2["default"])({}, attribute, { 28037 value, 28038 matchLevel: "none", 28039 matchedWords: [] 28040 }); 28041 })))); 28042 typesenseHit.highlights.forEach(function(highlight2) { 28043 result[highlight2.field] = { 28044 value: highlight2[snippetOrValue] || highlight2["".concat(snippetOrValue, "s")], 28045 matchLevel: "full", 28046 matchedWords: highlight2.matched_tokens 28047 }; 28048 if (highlight2.indices) { 28049 result[highlight2.field]["matchedIndices"] = highlight2.indices; 28050 } 28051 }); 28052 Object.entries(result).forEach(function(_ref42) { 28053 var _ref5 = (0, _slicedToArray2["default"])(_ref42, 2), k2 = _ref5[0], v2 = _ref5[1]; 28054 var attribute = k2; 28055 var value = v2.value, matchLevel = v2.matchLevel, matchedWords = v2.matchedWords, matchedIndices = v2.matchedIndices; 28056 if (value == null) { 28057 result[attribute] = _this3._adaptHighlightNullValue(); 28058 } else if (Array.isArray(value)) { 28059 result[attribute] = []; 28060 typesenseHit.document[attribute].forEach(function(unhighlightedValueFromArray, index3) { 28061 if (matchedIndices && matchedIndices.includes(index3)) { 28062 result[attribute].push({ 28063 value: _this3._adaptHighlightTag("".concat(value[matchedIndices.indexOf(index3)]), _this3.instantsearchRequest.params.highlightPreTag, _this3.instantsearchRequest.params.highlightPostTag), 28064 matchLevel, 28065 matchedWords: matchedWords[index3] 28066 }); 28067 } else if ((0, _typeof2["default"])(unhighlightedValueFromArray) === "object") { 28068 result[attribute].push(_this3._adaptHighlightInObjectValue(unhighlightedValueFromArray, {}, snippetOrValue)); 28069 } else { 28070 result[attribute].push({ 28071 value: "".concat(unhighlightedValueFromArray), 28072 matchLevel: "none", 28073 matchedWords: [] 28074 }); 28075 } 28076 }); 28077 } else if ((0, _typeof2["default"])(value) === "object") { 28078 result[attribute] = _this3._adaptHighlightInObjectValue(value, {}, snippetOrValue); 28079 } else { 28080 result[attribute].value = _this3._adaptHighlightTag("".concat(value), _this3.instantsearchRequest.params.highlightPreTag, _this3.instantsearchRequest.params.highlightPostTag); 28081 } 28082 }); 28083 } 28084 }, { 28085 key: "adaptHighlightObject", 28086 value: function adaptHighlightObject(typesenseHit, result, snippetOrValue) { 28087 Object.assign(result, this._adaptHighlightInObjectValue(typesenseHit.document, typesenseHit.highlight, snippetOrValue)); 28088 } 28089 }, { 28090 key: "_adaptHighlightInObjectValue", 28091 value: function _adaptHighlightInObjectValue(objectValue, highlightObjectValue, snippetOrValue) { 28092 var _this4 = this; 28093 return Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2["default"])(Object.entries(objectValue).map(function(_ref62) { 28094 var _ref7 = (0, _slicedToArray2["default"])(_ref62, 2), attribute = _ref7[0], value = _ref7[1]; 28095 var adaptedValue; 28096 if (value == null) { 28097 adaptedValue = _this4._adaptHighlightNullValue(); 28098 } else if (Array.isArray(value)) { 28099 var _highlightObjectValue; 28100 adaptedValue = _this4._adaptHighlightInArrayValue(value, (_highlightObjectValue = highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute]) !== null && _highlightObjectValue !== void 0 ? _highlightObjectValue : [], snippetOrValue); 28101 } else if ((0, _typeof2["default"])(value) === "object") { 28102 var _highlightObjectValue2; 28103 adaptedValue = _this4._adaptHighlightInObjectValue(value, (_highlightObjectValue2 = highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute]) !== null && _highlightObjectValue2 !== void 0 ? _highlightObjectValue2 : {}, snippetOrValue); 28104 } else { 28105 adaptedValue = _this4._adaptHighlightInPrimitiveValue(value, highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute], snippetOrValue); 28106 } 28107 return (0, _defineProperty2["default"])({}, attribute, adaptedValue); 28108 })))); 28109 } 28110 }, { 28111 key: "_adaptHighlightInArrayValue", 28112 value: function _adaptHighlightInArrayValue(arrayValue, highlightArrayValue, snippetOrValue) { 28113 var _this5 = this; 28114 return arrayValue.map(function(value, index3) { 28115 var adaptedValue; 28116 if (value == null) { 28117 adaptedValue = _this5._adaptHighlightNullValue(); 28118 } else if (Array.isArray(value)) { 28119 var _highlightArrayValue$; 28120 adaptedValue = _this5._adaptHighlightInArrayValue(value, (_highlightArrayValue$ = highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index3]) !== null && _highlightArrayValue$ !== void 0 ? _highlightArrayValue$ : [], snippetOrValue); 28121 } else if ((0, _typeof2["default"])(value) === "object") { 28122 var _highlightArrayValue$2; 28123 adaptedValue = _this5._adaptHighlightInObjectValue(value, (_highlightArrayValue$2 = highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index3]) !== null && _highlightArrayValue$2 !== void 0 ? _highlightArrayValue$2 : {}, snippetOrValue); 28124 } else { 28125 adaptedValue = _this5._adaptHighlightInPrimitiveValue(value, highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index3], snippetOrValue); 28126 } 28127 return adaptedValue; 28128 }); 28129 } 28130 }, { 28131 key: "_adaptHighlightInPrimitiveValue", 28132 value: function _adaptHighlightInPrimitiveValue(primitiveValue, highlightPrimitiveValue, snippetOrValue) { 28133 if (highlightPrimitiveValue != null) { 28134 var _ref9, _highlightPrimitiveVa; 28135 return { 28136 value: this._adaptHighlightTag("".concat((_ref9 = (_highlightPrimitiveVa = highlightPrimitiveValue[snippetOrValue]) !== null && _highlightPrimitiveVa !== void 0 ? _highlightPrimitiveVa : highlightPrimitiveValue["highlight"]) !== null && _ref9 !== void 0 ? _ref9 : highlightPrimitiveValue["snippet"]), this.instantsearchRequest.params.highlightPreTag, this.instantsearchRequest.params.highlightPostTag), 28137 matchLevel: (highlightPrimitiveValue.matched_tokens || []).length > 0 ? "full" : "none", 28138 matchedWords: highlightPrimitiveValue.matched_tokens || [] 28139 }; 28140 } else { 28141 return { 28142 // Convert all values to strings 28143 value: this._adaptHighlightTag("".concat(primitiveValue), this.instantsearchRequest.params.highlightPreTag, this.instantsearchRequest.params.highlightPostTag), 28144 matchLevel: "none", 28145 matchedWords: [] 28146 }; 28147 } 28148 } 28149 }, {
28150 key: "_adaptHighlightNullValue", 28151 value: function _adaptHighlightNullValue() { 28152 return { 28153 value: "", 28154 matchLevel: "none", 28155 matchedWords: [] 28156 }; 28157 } 28158 }, { 28159 key: "_adaptFacets", 28160 value: function _adaptFacets(typesenseFacetCounts) { 28161 var adaptedResult = {}; 28162 typesenseFacetCounts.forEach(function(facet) { 28163 Object.assign(adaptedResult, (0, _defineProperty2["default"])({}, facet.field_name, Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2["default"])(facet.counts.map(function(count) { 28164 return (0, _defineProperty2["default"])({}, count.value, count.count); 28165 })))))); 28166 }); 28167 return adaptedResult; 28168 } 28169 }, { 28170 key: "_adaptFacetStats", 28171 value: function _adaptFacetStats(typesenseFacetCounts) { 28172 var adaptedResult = {}; 28173 typesenseFacetCounts.forEach(function(facet) { 28174 if (Object.keys(facet.stats).length > 0) { 28175 Object.assign(adaptedResult, (0, _defineProperty2["default"])({}, facet.field_name, facet.stats)); 28176 } 28177 }); 28178 return adaptedResult; 28179 } 28180 }, { 28181 key: "_adaptRenderingContent", 28182 value: function _adaptRenderingContent(typesenseFacetCounts) { 28183 var _adaptedResult$facetO; 28184 var adaptedResult = Object.assign({}, this.configuration.renderingContent); 28185 if (((_adaptedResult$facetO = adaptedResult.facetOrdering) === null || _adaptedResult$facetO === void 0 || (_adaptedResult$facetO = _adaptedResult$facetO.facets) === null || _adaptedResult$facetO === void 0 ? void 0 : _adaptedResult$facetO.order) == null) { 28186 adaptedResult.facetOrdering = adaptedResult.facetOrdering || {}; 28187 adaptedResult.facetOrdering.facets = adaptedResult.facetOrdering.facets || {}; 28188 adaptedResult.facetOrdering.facets.order = (0, _toConsumableArray2["default"])(new Set(typesenseFacetCounts.map(function(fc) { 28189 return fc["field_name"]; 28190 }).concat(this.allTypesenseResponses.map(function(r2) { 28191 return r2.facet_counts || []; 28192 }).flat().map(function(fc) { 28193 return fc["field_name"]; 28194 }).filter(function(f2) { 28195 return f2; 28196 })))); 28197 } 28198 return adaptedResult; 28199 } 28200 }, { 28201 key: "adapt", 28202 value: function adapt() { 28203 var adaptedRenderingContent = this._adaptRenderingContent(this.typesenseResponse.facet_counts || []); 28204 var adaptedResult = _objectSpread2({ 28205 hits: this.typesenseResponse.grouped_hits ? this._adaptGroupedHits(this.typesenseResponse.grouped_hits) : this._adaptHits(this.typesenseResponse.hits), 28206 nbHits: this.typesenseResponse.found, 28207 page: this.typesenseResponse.page - 1, 28208 nbPages: this._adaptNumberOfPages(), 28209 hitsPerPage: this.typesenseResponse.request_params.per_page, 28210 facets: this._adaptFacets(this.typesenseResponse.facet_counts || []), 28211 facets_stats: this._adaptFacetStats(this.typesenseResponse.facet_counts || {}), 28212 query: this.typesenseResponse.request_params.q, 28213 processingTimeMS: this.typesenseResponse.search_time_ms 28214 }, Object.keys(adaptedRenderingContent).length > 0 ? { 28215 renderingContent: adaptedRenderingContent 28216 } : null); 28217 return adaptedResult; 28218 } 28219 }]); 28220 return SearchResponseAdapter2; 28221 }(); 28222 SearchResponseAdapter.SearchResponseAdapter = SearchResponseAdapter$1; 28223 Object.assign(SearchResponseAdapter$1.prototype, _utils.utils); 28224 return SearchResponseAdapter; 28225} 28226var FacetSearchResponseAdapter = {}; 28227var hasRequiredFacetSearchResponseAdapter; 28228function requireFacetSearchResponseAdapter() { 28229 if (hasRequiredFacetSearchResponseAdapter) return FacetSearchResponseAdapter; 28230 hasRequiredFacetSearchResponseAdapter = 1; 28231 var _interopRequireDefault = interopRequireDefaultExports; 28232 Object.defineProperty(FacetSearchResponseAdapter, "__esModule", { 28233 value: true 28234 }); 28235 FacetSearchResponseAdapter.FacetSearchResponseAdapter = void 0; 28236 var _classCallCheck2 = _interopRequireDefault(requireClassCallCheck()); 28237 var _createClass2 = _interopRequireDefault(requireCreateClass()); 28238 var _utils = requireUtils(); 28239 var FacetSearchResponseAdapter$1 = /* @__PURE__ */ function() { 28240 function FacetSearchResponseAdapter2(typesenseResponse, instantsearchRequest) { 28241 (0, _classCallCheck2["default"])(this, FacetSearchResponseAdapter2); 28242 this.typesenseResponse = typesenseResponse; 28243 this.instantsearchRequest = instantsearchRequest; 28244 } 28245 (0, _createClass2["default"])(FacetSearchResponseAdapter2, [{ 28246 key: "_adaptFacetHits", 28247 value: function _adaptFacetHits(typesenseFacetCounts) { 28248 var _this = this; 28249 var adaptedResult = {}; 28250 var facet = typesenseFacetCounts.find(function(facet2) { 28251 return facet2.field_name === _this.instantsearchRequest.params.facetName; 28252 }); 28253 adaptedResult = facet.counts.map(function(facetCount) { 28254 return { 28255 value: facetCount.value, 28256 highlighted: _this._adaptHighlightTag(facetCount.highlighted, _this.instantsearchRequest.params.highlightPreTag, _this.instantsearchRequest.params.highlightPostTag), 28257 count: facetCount.count 28258 }; 28259 }); 28260 return adaptedResult; 28261 } 28262 }, {
28263 key: "adapt", 28264 value: function adapt() { 28265 var adaptedResult = { 28266 facetHits: this._adaptFacetHits(this.typesenseResponse.facet_counts), 28267 exhaustiveFacetsCount: true, 28268 processingTimeMS: this.typesenseResponse.search_time_ms 28269 }; 28270 return adaptedResult; 28271 } 28272 }]); 28273 return FacetSearchResponseAdapter2; 28274 }(); 28275 FacetSearchResponseAdapter.FacetSearchResponseAdapter = FacetSearchResponseAdapter$1; 28276 Object.assign(FacetSearchResponseAdapter$1.prototype, _utils.utils); 28277 return FacetSearchResponseAdapter; 28278} 28279(function(exports) { 28280 var _interopRequireDefault = interopRequireDefaultExports; 28281 Object.defineProperty(exports, "__esModule", { 28282 value: true 28283 }); 28284 exports["default"] = void 0; 28285 var _regenerator = _interopRequireDefault(requireRegenerator()); 28286 var _asyncToGenerator2 = _interopRequireDefault(requireAsyncToGenerator()); 28287 var _classCallCheck2 = _interopRequireDefault(requireClassCallCheck()); 28288 var _createClass2 = _interopRequireDefault(requireCreateClass()); 28289 var _Configuration = requireConfiguration$1(); 28290 var _typesense = requireTypesense(); 28291 var _SearchRequestAdapter = requireSearchRequestAdapter(); 28292 var _SearchResponseAdapter = requireSearchResponseAdapter(); 28293 var _FacetSearchResponseAdapter = requireFacetSearchResponseAdapter(); 28294 var TypesenseInstantsearchAdapter2 = /* @__PURE__ */ function() { 28295 function TypesenseInstantsearchAdapter3(options) { 28296 var _this = this; 28297 (0, _classCallCheck2["default"])(this, TypesenseInstantsearchAdapter3); 28298 this.updateConfiguration(options); 28299 this.searchClient = { 28300 clearCache: function clearCache2() { 28301 return _this.clearCache(); 28302 }, 28303 search: function search(instantsearchRequests) { 28304 return _this.searchTypesenseAndAdapt(instantsearchRequests); 28305 }, 28306 searchForFacetValues: function searchForFacetValues(instantsearchRequests) { 28307 return _this.searchTypesenseForFacetValuesAndAdapt(instantsearchRequests); 28308 } 28309 }; 28310 } 28311 (0, _createClass2["default"])(TypesenseInstantsearchAdapter3, [{ 28312 key: "searchTypesenseAndAdapt", 28313 value: function() { 28314 var _searchTypesenseAndAdapt = (0, _asyncToGenerator2["default"])(/* @__PURE__ */ _regenerator["default"].mark(function _callee(instantsearchRequests) { 28315 var _this2 = this; 28316 var typesenseResponse, adaptedResponses; 28317 return _regenerator["default"].wrap(function _callee$(_context2) { 28318 while (1) switch (_context2.prev = _context2.next) { 28319 case 0: 28320 _context2.prev = 0; 28321 _context2.next = 3; 28322 return this._adaptAndPerformTypesenseRequest(instantsearchRequests); 28323 case 3: 28324 typesenseResponse = _context2.sent; 28325 adaptedResponses = typesenseResponse.results.map(function(typesenseResult, index3) { 28326 _this2._validateTypesenseResult(typesenseResult); 28327 var responseAdapter = new _SearchResponseAdapter.SearchResponseAdapter(typesenseResult, instantsearchRequests[index3], _this2.configuration, typesenseResponse.results); 28328 return responseAdapter.adapt(); 28329 }); 28330 return _context2.abrupt("return", { 28331 results: adaptedResponses 28332 }); 28333 case 8: 28334 _context2.prev = 8; 28335 _context2.t0 = _context2["catch"](0); 28336 console.error(_context2.t0); 28337 throw _context2.t0; 28338 case 12: 28339 case "end": 28340 return _context2.stop(); 28341 } 28342 }, _callee, this, [[0, 8]]); 28343 })); 28344 function searchTypesenseAndAdapt(_x) { 28345 return _searchTypesenseAndAdapt.apply(this, arguments); 28346 } 28347 return searchTypesenseAndAdapt; 28348 }() 28349 }, { 28350 key: "searchTypesenseForFacetValuesAndAdapt", 28351 value: function() { 28352 var _searchTypesenseForFacetValuesAndAdapt = (0, _asyncToGenerator2["default"])(/* @__PURE__ */ _regenerator["default"].mark(function _callee2(instantsearchRequests) { 28353 var _this3 = this; 28354 var typesenseResponse, adaptedResponses; 28355 return _regenerator["default"].wrap(function _callee2$(_context2) { 28356 while (1) switch (_context2.prev = _context2.next) { 28357 case 0: 28358 _context2.prev = 0; 28359 _context2.next = 3;
28360 return this._adaptAndPerformTypesenseRequest(instantsearchRequests); 28361 case 3: 28362 typesenseResponse = _context2.sent; 28363 adaptedResponses = typesenseResponse.results.map(function(typesenseResult, index3) { 28364 _this3._validateTypesenseResult(typesenseResult); 28365 var responseAdapter = new _FacetSearchResponseAdapter.FacetSearchResponseAdapter(typesenseResult, instantsearchRequests[index3], _this3.configuration); 28366 return responseAdapter.adapt(); 28367 }); 28368 return _context2.abrupt("return", adaptedResponses); 28369 case 8: 28370 _context2.prev = 8; 28371 _context2.t0 = _context2["catch"](0); 28372 console.error(_context2.t0); 28373 throw _context2.t0; 28374 case 12: 28375 case "end": 28376 return _context2.stop(); 28377 } 28378 }, _callee2, this, [[0, 8]]); 28379 })); 28380 function searchTypesenseForFacetValuesAndAdapt(_x2) { 28381 return _searchTypesenseForFacetValuesAndAdapt.apply(this, arguments); 28382 } 28383 return searchTypesenseForFacetValuesAndAdapt; 28384 }() 28385 }, { 28386 key: "_adaptAndPerformTypesenseRequest", 28387 value: function() { 28388 var _adaptAndPerformTypesenseRequest2 = (0, _asyncToGenerator2["default"])(/* @__PURE__ */ _regenerator["default"].mark(function _callee3(instantsearchRequests) { 28389 var requestAdapter, typesenseResponse; 28390 return _regenerator["default"].wrap(function _callee3$(_context3) { 28391 while (1) switch (_context3.prev = _context3.next) { 28392 case 0: 28393 requestAdapter = new _SearchRequestAdapter.SearchRequestAdapter(instantsearchRequests, this.typesenseClient, this.configuration); 28394 _context3.next = 3; 28395 return requestAdapter.request(); 28396 case 3: 28397 typesenseResponse = _context3.sent; 28398 return _context3.abrupt("return", typesenseResponse); 28399 case 5: 28400 case "end": 28401 return _context3.stop(); 28402 } 28403 }, _callee3, this); 28404 })); 28405 function _adaptAndPerformTypesenseRequest(_x3) { 28406 return _adaptAndPerformTypesenseRequest2.apply(this, arguments); 28407 } 28408 return _adaptAndPerformTypesenseRequest; 28409 }() 28410 }, { 28411 key: "clearCache", 28412 value: function clearCache2() { 28413 this.typesenseClient = new _typesense.SearchClient(this.configuration.server); 28414 return this.searchClient; 28415 } 28416 }, { 28417 key: "updateConfiguration", 28418 value: function updateConfiguration(options) { 28419 this.configuration = new _Configuration.Configuration(options); 28420 this.configuration.validate(); 28421 this.typesenseClient = new _typesense.SearchClient(this.configuration.server); 28422 return true; 28423 } 28424 }, { 28425 key: "_validateTypesenseResult", 28426 value: function _validateTypesenseResult(typesenseResult) { 28427 if (typesenseResult.error) { 28428 throw new Error("".concat(typesenseResult.code, " - ").concat(typesenseResult.error)); 28429 } 28430 if (!typesenseResult.hits && !typesenseResult.grouped_hits) { 28431 throw new Error("Did not find any hits. ".concat(typesenseResult.code, " - ").concat(typesenseResult.error)); 28432 } 28433 } 28434 }]); 28435 return TypesenseInstantsearchAdapter3; 28436 }(); 28437 exports["default"] = TypesenseInstantsearchAdapter2; 28438})(TypesenseInstantsearchAdapter$1); 28439const TypesenseInstantsearchAdapter = /* @__PURE__ */ getDefaultExportFromCjs(TypesenseInstantsearchAdapter$1); 28440var TypesenseExports = requireTypesense(); 28441const Typesense = /* @__PURE__ */ getDefaultExportFromCjs(TypesenseExports); 28442var NAMESPACE = "ais"; 28443var component = function component2(componentName) { 28444 return function() { 28445 var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, descendantName = _ref.descendantName, modifierName = _ref.modifierName; 28446 var descendent = descendantName ? "-".concat(descendantName) : ""; 28447 var modifier = modifierName ? "--".concat(modifierName) : ""; 28448 return "".concat(NAMESPACE, "-").concat(componentName).concat(descendent).concat(modifier); 28449 }; 28450}; 28451var id = 0; 28452function addWidgetId(widget) {
28453 if (widget.dependsOn !== "recommend") { 28454 return; 28455 } 28456 widget.$$id = id++; 28457} 28458function noop$1() { 28459} 28460var deprecate = function deprecate2(fn, message) { 28461 return fn; 28462}; 28463function getObjectType(object) { 28464 return Object.prototype.toString.call(object).slice(8, -1); 28465} 28466function checkRendering(rendering, usage) { 28467 if (rendering === void 0 || typeof rendering !== "function") { 28468 throw new Error("The render function is not valid (received type ".concat(getObjectType(rendering), ").\n\n").concat(usage)); 28469 } 28470} 28471function clearRefinements$1(_ref) { 28472 var helper = _ref.helper, _ref$attributesToClea = _ref.attributesToClear, attributesToClear = _ref$attributesToClea === void 0 ? [] : _ref$attributesToClea; 28473 var finalState = helper.state.setPage(0); 28474 finalState = attributesToClear.reduce(function(state, attribute) { 28475 if (finalState.isNumericRefined(attribute)) { 28476 return state.removeNumericRefinement(attribute); 28477 } 28478 if (finalState.isHierarchicalFacet(attribute)) { 28479 return state.removeHierarchicalFacetRefinement(attribute); 28480 } 28481 if (finalState.isDisjunctiveFacet(attribute)) { 28482 return state.removeDisjunctiveFacetRefinement(attribute); 28483 } 28484 if (finalState.isConjunctiveFacet(attribute)) { 28485 return state.removeFacetRefinement(attribute); 28486 } 28487 return state; 28488 }, finalState); 28489 if (attributesToClear.indexOf("query") !== -1) { 28490 finalState = finalState.setQuery(""); 28491 } 28492 return finalState; 28493} 28494var htmlEntities = { 28495 "&": "&", 28496 "<": "<", 28497 ">": ">", 28498 '"': """, 28499 "'": "'" 28500}; 28501var regexUnescapedHtml = /[&<>"']/g; 28502var regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source); 28503function escape$1(value) { 28504 return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function(character) { 28505 return htmlEntities[character]; 28506 }) : value; 28507} 28508var htmlCharacters = { 28509 "&": "&", 28510 "<": "<", 28511 ">": ">", 28512 """: '"', 28513 "'": "'" 28514}; 28515var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g; 28516var regexHasEscapedHtml = RegExp(regexEscapedHtml.source); 28517function unescape$1(value) { 28518 return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function(character) { 28519 return htmlCharacters[character]; 28520 }) : value; 28521} 28522function _typeof$K(obj) { 28523 "@babel/helpers - typeof"; 28524 return _typeof$K = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 28525 return typeof obj2; 28526 } : function(obj2) { 28527 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 28528 }, _typeof$K(obj); 28529} 28530function getTag(value) { 28531 if (value === null) { 28532 return value === void 0 ? "[object Undefined]" : "[object Null]"; 28533 } 28534 return Object.prototype.toString.call(value); 28535} 28536function isObjectLike(value) { 28537 return _typeof$K(value) === "object" && value !== null; 28538} 28539function isPlainObject(value) { 28540 if (!isObjectLike(value) || getTag(value) !== "[object Object]") { 28541 return false; 28542 } 28543 if (Object.getPrototypeOf(value) === null) { 28544 return true; 28545 } 28546 var proto = value; 28547 while (Object.getPrototypeOf(proto) !== null) { 28548 proto = Object.getPrototypeOf(proto); 28549 } 28550 return Object.getPrototypeOf(value) === proto; 28551} 28552function _typeof$J(obj) { 28553 "@babel/helpers - typeof"; 28554 return _typeof$J = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 28555 return typeof obj2; 28556 } : function(obj2) { 28557 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 28558 }, _typeof$J(obj); 28559} 28560function _objectDestructuringEmpty$1(obj) { 28561 if (obj == null) throw new TypeError("Cannot destructure " + obj); 28562} 28563function _extends$g() { 28564 _extends$g = Object.assign ? Object.assign.bind() : function(target) { 28565 for (var i2 = 1; i2 < arguments.length; i2++) { 28566 var source = arguments[i2]; 28567 for (var key2 in source) { 28568 if (Object.prototype.hasOwnProperty.call(source, key2)) { 28569 target[key2] = source[key2]; 28570 } 28571 } 28572 } 28573 return target; 28574 }; 28575 return _extends$g.apply(this, arguments); 28576} 28577function ownKeys$B(object, enumerableOnly) { 28578 var keys = Object.keys(object); 28579 if (Object.getOwnPropertySymbols) { 28580 var symbols = Object.getOwnPropertySymbols(object); 28581 enumerableOnly && (symbols = symbols.filter(function(sym) { 28582 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 28583 })), keys.push.apply(keys, symbols); 28584 } 28585 return keys; 28586} 28587function _objectSpread$B(target) { 28588 for (var i2 = 1; i2 < arguments.length; i2++) { 28589 var source = null != arguments[i2] ? arguments[i2] : {}; 28590 i2 % 2 ? ownKeys$B(Object(source), true).forEach(function(key2) { 28591 _defineProperty$H(target, key2, source[key2]); 28592 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$B(Object(source)).forEac
28592h(function(key2) { 28593 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 28594 }); 28595 } 28596 return target; 28597} 28598function _defineProperty$H(obj, key2, value) { 28599 key2 = _toPropertyKey$H(key2); 28600 if (key2 in obj) { 28601 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 28602 } else { 28603 obj[key2] = value; 28604 } 28605 return obj; 28606} 28607function _toPropertyKey$H(arg) { 28608 var key2 = _toPrimitive$H(arg, "string"); 28609 return _typeof$J(key2) === "symbol" ? key2 : String(key2); 28610} 28611function _toPrimitive$H(input, hint) { 28612 if (_typeof$J(input) !== "object" || input === null) return input; 28613 var prim = input[Symbol.toPrimitive]; 28614 if (prim !== void 0) { 28615 var res = prim.call(input, hint || "default"); 28616 if (_typeof$J(res) !== "object") return res; 28617 throw new TypeError("@@toPrimitive must return a primitive value."); 28618 } 28619 return (hint === "string" ? String : Number)(input); 28620} 28621var TAG_PLACEHOLDER = { 28622 highlightPreTag: "__ais-highlight__", 28623 highlightPostTag: "__/ais-highlight__" 28624}; 28625var TAG_REPLACEMENT = { 28626 highlightPreTag: "<mark>", 28627 highlightPostTag: "</mark>" 28628}; 28629function replaceTagsAndEscape(value) { 28630 return escape$1(value).replace(new RegExp(TAG_PLACEHOLDER.highlightPreTag, "g"), TAG_REPLACEMENT.highlightPreTag).replace(new RegExp(TAG_PLACEHOLDER.highlightPostTag, "g"), TAG_REPLACEMENT.highlightPostTag); 28631} 28632function recursiveEscape(input) { 28633 if (isPlainObject(input) && typeof input.value !== "string") { 28634 return Object.keys(input).reduce(function(acc, key2) { 28635 return _objectSpread$B(_objectSpread$B({}, acc), {}, _defineProperty$H({}, key2, recursiveEscape(input[key2]))); 28636 }, {}); 28637 } 28638 if (Array.isArray(input)) { 28639 return input.map(recursiveEscape); 28640 } 28641 return _objectSpread$B(_objectSpread$B({}, input), {}, { 28642 value: replaceTagsAndEscape(input.value) 28643 }); 28644} 28645function escapeHits(hits3) { 28646 if (hits3.__escaped === void 0) { 28647 hits3 = hits3.map(function(_ref) { 28648 var hit = _extends$g({}, (_objectDestructuringEmpty$1(_ref), _ref)); 28649 if (hit._highlightResult) { 28650 hit._highlightResult = recursiveEscape(hit._highlightResult); 28651 } 28652 if (hit._snippetResult) { 28653 hit._snippetResult = recursiveEscape(hit._snippetResult); 28654 } 28655 return hit; 28656 }); 28657 hits3.__escaped = true; 28658 } 28659 return hits3; 28660} 28661function escapeFacets(facetHits) { 28662 return facetHits.map(function(h2) { 28663 return _objectSpread$B(_objectSpread$B({}, h2), {}, { 28664 highlighted: replaceTagsAndEscape(h2.highlighted) 28665 }); 28666 }); 28667} 28668function concatHighlightedParts(parts) { 28669 var highlightPreTag = TAG_REPLACEMENT.highlightPreTag, highlightPostTag = TAG_REPLACEMENT.highlightPostTag; 28670 return parts.map(function(part) { 28671 return part.isHighlighted ? highlightPreTag + part.value + highlightPostTag : part.value; 28672 }).join(""); 28673} 28674function isFacetRefined(helper, facet, value) { 28675 if (helper.state.isHierarchicalFacet(facet)) { 28676 return helper.state.isHierarchicalFacetRefined(facet, value); 28677 } else if (helper.state.isConjunctiveFacet(facet)) { 28678 return helper.state.isFacetRefined(facet, value); 28679 } else { 28680 return helper.state.isDisjunctiveFacetRefined(facet, value); 28681 } 28682} 28683function ownKeys$A(object, enumerableOnly) { 28684 var keys = Object.keys(object); 28685 if (Object.getOwnPropertySymbols) { 28686 var symbols = Object.getOwnPropertySymbols(object); 28687 enumerableOnly && (symbols = symbols.filter(function(sym) { 28688 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 28689 })), keys.push.apply(keys, symbols); 28690 } 28691 return keys; 28692} 28693function _objectSpread$A(target) { 28694 for (var i2 = 1; i2 < arguments.length; i2++) { 28695 var source = null != arguments[i2] ? arguments[i2] : {}; 28696 i2 % 2 ? ownKeys$A(Object(source), true).forEach(function(key2) { 28697 _defineProperty$G(target, key2, source[key2]); 28698 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$A(Object(source)).forEach(function(key2) { 28699 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 28700 }); 28701 } 28702 return target; 28703} 28704function _defineProperty$G(obj, key2, value) { 28705 key2 = _toPropertyKey$G(key2); 28706 if (key2 in obj) { 28707 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 28708 } else { 28709 obj[key2] = value; 28710 } 28711 return obj; 28712} 28713function _toPropertyKey$G(arg) { 28714 var key2 = _toPrimitive$G(arg, "string"); 28715 return _typeof$I(key2) === "symbol" ? key2 : String(key2); 28716} 28717function _toPrimitive$G(input, hint) { 28718 if (_typeof$I(input) !== "object" || input === null) return input; 28719 var prim = input[Symbol.toPrimitive]; 28720 if (prim !== void 0) { 28721 var res = prim.call(input, hint || "default"); 28722 if (_typeof$I(res) !== "object") return res; 28723 throw new TypeError("@@toPrimitive must return a primitive value."); 28724 } 28725 return (hint === "string" ? String : Number)(input); 28726} 28727function _typeof$I(obj) { 28728 "@babel/helpers - typeof"; 28729 return _typeof$I = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 28730 return typeof obj2; 28731 } : function(obj2) { 28732 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 28733 }, _typeof$I(obj); 28734} 28735function _slicedToArray$5(arr, i2) { 28736 return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i2) || _unsupportedIterableToArray$b(arr, i2) || _nonIterableRest$5(); 28737} 28738function _nonIterableRest$5() {
28739 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 28740} 28741function _unsupportedIterableToArray$b(o2, minLen) { 28742 if (!o2) return; 28743 if (typeof o2 === "string") return _arrayLikeToArray$b(o2, minLen); 28744 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 28745 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 28746 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 28747 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$b(o2, minLen); 28748} 28749function _arrayLikeToArray$b(arr, len2) { 28750 if (len2 == null || len2 > arr.length) len2 = arr.length; 28751 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 28752 return arr2; 28753} 28754function _iterableToArrayLimit$5(arr, i2) { 28755 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 28756 if (null != _i2) { 28757 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 28758 try { 28759 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) ; 28760 else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 28761 } catch (err) { 28762 _d = true, _e = err; 28763 } finally { 28764 try { 28765 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 28766 } finally { 28767 if (_d) throw _e; 28768 } 28769 } 28770 return _arr; 28771 } 28772} 28773function _arrayWithHoles$5(arr) { 28774 if (Array.isArray(arr)) return arr; 28775} 28776function createSendEventForFacet(_ref) { 28777 var instantSearchInstance = _ref.instantSearchInstance, helper = _ref.helper, attr = _ref.attribute, widgetType = _ref.widgetType; 28778 var sendEventForFacet = function sendEventForFacet2() { 28779 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 28780 args[_key] = arguments[_key]; 28781 } 28782 var facetValue = args[1], _args$ = args[2], eventName = _args$ === void 0 ? "Filter Applied" : _args$, _args$2 = args[3], additionalData = _args$2 === void 0 ? {} : _args$2; 28783 var _args$0$split = args[0].split(":"), _args$0$split2 = _slicedToArray$5(_args$0$split, 2), eventType = _args$0$split2[0], eventModifier = _args$0$split2[1]; 28784 var attribute = typeof attr === "string" ? attr : attr(facetValue); 28785 if (args.length === 1 && _typeof$I(args[0]) === "object") { 28786 instantSearchInstance.sendEventToInsights(args[0]); 28787 } else if (eventType === "click" && args.length >= 2 && args.length <= 4) { 28788 if (!isFacetRefined(helper, attribute, facetValue)) { 28789 instantSearchInstance.sendEventToInsights({ 28790 insightsMethod: "clickedFilters", 28791 widgetType, 28792 eventType, 28793 eventModifier, 28794 payload: _objectSpread$A({ 28795 eventName, 28796 index: helper.getIndex(), 28797 filters: ["".concat(attribute, ":").concat(facetValue)] 28798 }, additionalData), 28799 attribute 28800 }); 28801 } 28802 } else ; 28803 }; 28804 return sendEventForFacet; 28805} 28806function serializePayload(payload) { 28807 return btoa(encodeURIComponent(JSON.stringify(payload))); 28808} 28809function deserializePayload(serialized) { 28810 return JSON.parse(decodeURIComponent(atob(serialized))); 28811} 28812function ownKeys$z(object, enumerableOnly) { 28813 var keys = Object.keys(object); 28814 if (Object.getOwnPropertySymbols) { 28815 var symbols = Object.getOwnPropertySymbols(object); 28816 enumerableOnly && (symbols = symbols.filter(function(sym) { 28817 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 28818 })), keys.push.apply(keys, symbols); 28819 } 28820 return keys; 28821} 28822function _objectSpread$z(target) { 28823 for (var i2 = 1; i2 < arguments.length; i2++) { 28824 var source = null != arguments[i2] ? arguments[i2] : {}; 28825 i2 % 2 ? ownKeys$z(Object(source), true).forEach(function(key2) { 28826 _defineProperty$F(target, key2, source[key2]); 28827 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$z(Object(source)).forEach(function(key2) { 28828 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 28829 }); 28830 } 28831 return target; 28832} 28833function _defineProperty$F(obj, key2, value) { 28834 key2 = _toPropertyKey$F(key2); 28835 if (key2 in obj) { 28836 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 28837 } else { 28838 obj[key2] = value; 28839 } 28840 return obj; 28841} 28842function _toPropertyKey$F(arg) { 28843 var key2 = _toPrimitive$F(arg, "string"); 28844 return _typeof$H(key2) === "symbol" ? key2 : String(key2); 28845} 28846function _toPrimitive$F(input, hint) { 28847 if (_typeof$H(input) !== "object" || input === null) return input; 28848 var prim = input[Symbol.toPrimitive]; 28849 if (prim !== void 0) { 28850 var res = prim.call(input, hint || "default"); 28851 if (_typeof$H(res) !== "object") return res; 28852 throw new TypeError("@@toPrimitive must return a primitive value."); 28853 } 28854 return (hint === "string" ? String : Number)(input); 28855} 28856function _slicedToArray$4(arr, i2) { 28857 return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i2) || _unsupportedIterableToArray$a(arr, i2) || _nonIterableRest$4(); 28858} 28859function _nonIterableRest$4() {
28860 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 28861} 28862function _unsupportedIterableToArray$a(o2, minLen) { 28863 if (!o2) return; 28864 if (typeof o2 === "string") return _arrayLikeToArray$a(o2, minLen); 28865 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 28866 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 28867 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 28868 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$a(o2, minLen); 28869} 28870function _arrayLikeToArray$a(arr, len2) { 28871 if (len2 == null || len2 > arr.length) len2 = arr.length; 28872 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 28873 return arr2; 28874} 28875function _iterableToArrayLimit$4(arr, i2) { 28876 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 28877 if (null != _i2) { 28878 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 28879 try { 28880 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) ; 28881 else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 28882 } catch (err) { 28883 _d = true, _e = err; 28884 } finally { 28885 try { 28886 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 28887 } finally { 28888 if (_d) throw _e; 28889 } 28890 } 28891 return _arr; 28892 } 28893} 28894function _arrayWithHoles$4(arr) { 28895 if (Array.isArray(arr)) return arr; 28896} 28897function _typeof$H(obj) { 28898 "@babel/helpers - typeof"; 28899 return _typeof$H = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 28900 return typeof obj2; 28901 } : function(obj2) { 28902 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 28903 }, _typeof$H(obj); 28904} 28905function chunk(arr) { 28906 var chunkSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 20; 28907 var chunks = []; 28908 for (var i2 = 0; i2 < Math.ceil(arr.length / chunkSize); i2++) { 28909 chunks.push(arr.slice(i2 * chunkSize, (i2 + 1) * chunkSize)); 28910 } 28911 return chunks; 28912} 28913function _buildEventPayloadsForHits(_ref) { 28914 var getIndex = _ref.getIndex, widgetType = _ref.widgetType; 28915 _ref.methodName; 28916 var args = _ref.args, instantSearchInstance = _ref.instantSearchInstance; 28917 if (args.length === 1 && _typeof$H(args[0]) === "object") { 28918 return [args[0]]; 28919 } 28920 var _args$0$split = args[0].split(":"), _args$0$split2 = _slicedToArray$4(_args$0$split, 2), eventType = _args$0$split2[0], eventModifier = _args$0$split2[1]; 28921 var hits3 = args[1]; 28922 var eventName = args[2]; 28923 var additionalData = args[3] || {}; 28924 if (!hits3) { 28925 { 28926 return []; 28927 } 28928 } 28929 if ((eventType === "click" || eventType === "conversion") && !eventName) { 28930 { 28931 return []; 28932 } 28933 } 28934 var hitsArray = Array.isArray(hits3) ? hits3 : [hits3]; 28935 if (hitsArray.length === 0) { 28936 return []; 28937 } 28938 var queryID = hitsArray[0].__queryID; 28939 var hitsChunks = chunk(hitsArray); 28940 var objectIDsByChunk = hitsChunks.map(function(batch) { 28941 return batch.map(function(hit) { 28942 return hit.objectID; 28943 }); 28944 }); 28945 var positionsByChunk = hitsChunks.map(function(batch) { 28946 return batch.map(function(hit) { 28947 return hit.__position; 28948 }); 28949 }); 28950 if (eventType === "view") { 28951 if (instantSearchInstance.status !== "idle") { 28952 return []; 28953 } 28954 return hitsChunks.map(function(batch, i2) { 28955 return { 28956 insightsMethod: "viewedObjectIDs", 28957 widgetType, 28958 eventType, 28959 payload: _objectSpread$z({ 28960 eventName: eventName || "Hits Viewed", 28961 index: getIndex(), 28962 objectIDs: objectIDsByChunk[i2] 28963 }, additionalData), 28964 hits: batch, 28965 eventModifier 28966 }; 28967 }); 28968 } else if (eventType === "click") { 28969 return hitsChunks.map(function(batch, i2) { 28970 return { 28971 insightsMethod: "clickedObjectIDsAfterSearch", 28972 widgetType, 28973 eventType, 28974 payload: _objectSpread$z({ 28975 eventName: eventName || "Hit Clicked", 28976 index: getIndex(), 28977 queryID, 28978 objectIDs: objectIDsByChunk[i2], 28979 positions: positionsByChunk[i2] 28980 }, additionalData), 28981 hits: batch, 28982 eventModifier 28983 }; 28984 }); 28985 } else if (eventType === "conversion") { 28986 return hitsChunks.map(function(batch, i2) { 28987 return { 28988 insightsMethod: "convertedObjectIDsAfterSearch", 28989 widgetType, 28990 eventType, 28991 payload: _objectSpread$z({ 28992 eventName: eventName || "Hit Converted", 28993 index: getIndex(), 28994 queryID, 28995 objectIDs: objectIDsByChunk[i2] 28996 }, additionalData), 28997 hits: batch, 28998 eventModifier 28999 }; 29000 }); 29001 } else { 29002 return []; 29003 } 29004} 29005function createSendEventForHits(_ref22) { 29006 var instantSearchInstance = _ref22.instantSearchInstance, getIndex = _ref22.getIndex, widgetType = _ref22.widgetType; 29007 var sentEvents = {}; 29008 var timer = void 0; 29009 var sendEventForHits = function sendEventForHits2() { 29010 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 29011 args[_key] = arguments[_key]; 29012 } 29013 var payloads = _buildEventPayloadsForHits({ 29014 widgetType, 29015 getIndex, 29016 methodName: "sendEvent", 29017 args, 29018 instantSearchInstance 29019 }); 29020 payloads.forEach(function(payload) { 29021 if (payload.eventType === "click" && payload.eventModifier === "internal" && sentEvents[payload.eventType]) { 29022 return; 29023 } 29024 sentEvents[payload.eventType] = true; 29025 instantSearchInstance.sendEventToInsights(payload); 29026 }); 29027 clearTimeout(timer); 29028 timer = setTimeout(function() { 29029 sentEvents = {}; 29030 }, 0); 29031 }; 29032 return sendEventForHits; 29033} 29034function createBindEventForHits(_ref3) { 29035 var getIndex = _ref3.getIndex, widgetType = _ref3.widgetType, instantSearchInstance = _ref3.instantSearchInstance; 29036 var bindEventForHits = function bindEventForHits2() { 29037 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 29038 args[_key2] = arguments[_key2]; 29039 } 29040 var payloads = _buildEventPayloadsForHits({ 29041 widgetType, 29042 getIndex, 29043 methodName: "bindEvent", 29044 args, 29045 instantSearchInstance 29046 }); 29047 return payloads.length ? "data-insights-event=".concat(serializePayload(payloads)) : ""; 29048 }; 29049 return bindEventForHits; 29050} 29051function isIndexWidget(widget) { 29052 return widget.$$type === "ais.index"; 29053} 29054function setIndexHelperState(finalUiState, indexWidget) { 29055 var nextIndexUiState = finalUiState[indexWidget.getIndexId()] || {}; 29056 indexWidget.getHelper().setState(indexWidget.getWidgetSearchParameters(indexWidget.getHelper().state, { 29057 uiState: nextIndexUiState 29058 })); 29059 indexWidget.getWidgets().filter(isIndexWidget).forEach(function(widget) { 29060 return setIndexHelperState(finalUiState, widget); 29061 }); 29062} 29063var nextMicroTask = Promise.resolve(); 29064function defer(callback) { 29065 var progress = null; 29066 var cancelled = false;
vendor: 4,777 bytes, lines 29067-29210
29067 var fn = function fn2() { 29068 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 29069 args[_key] = arguments[_key]; 29070 } 29071 if (progress !== null) { 29072 return; 29073 } 29074 progress = nextMicroTask.then(function() { 29075 progress = null; 29076 if (cancelled) { 29077 cancelled = false; 29078 return; 29079 } 29080 callback.apply(void 0, args); 29081 }); 29082 }; 29083 fn.wait = function() { 29084 if (progress === null) { 29085 throw new Error("The deferred function should be called before calling `wait()`"); 29086 } 29087 return progress; 29088 }; 29089 fn.cancel = function() { 29090 if (progress === null) { 29091 return; 29092 } 29093 cancelled = true; 29094 }; 29095 return fn; 29096} 29097function createDocumentationLink(_ref) { 29098 var name = _ref.name, _ref$connector = _ref.connector, connector = _ref$connector === void 0 ? false : _ref$connector; 29099 return ["https://www.algolia.com/doc/api-reference/widgets/", name, "/js/", connector ? "#connector" : ""].join(""); 29100} 29101function createDocumentationMessageGenerator() { 29102 for (var _len = arguments.length, widgets = new Array(_len), _key = 0; _key < _len; _key++) { 29103 widgets[_key] = arguments[_key]; 29104 } 29105 var links = widgets.map(function(widget) { 29106 return createDocumentationLink(widget); 29107 }).join(", "); 29108 return function(message) { 29109 return [message, "See documentation: ".concat(links)].filter(Boolean).join("\n\n"); 29110 }; 29111} 29112function unescapeFacetValue$3(value) { 29113 if (typeof value === "string") { 29114 return value.replace(/^\\-/, "-"); 29115 } 29116 return value; 29117} 29118function escapeFacetValue$4(value) { 29119 if (typeof value === "number" && value < 0 || typeof value === "string") { 29120 return String(value).replace(/^-/, "\\-"); 29121 } 29122 return value; 29123} 29124function find$6(items, predicate) { 29125 var value; 29126 for (var i2 = 0; i2 < items.length; i2++) { 29127 value = items[i2]; 29128 if (predicate(value, i2, items)) { 29129 return value; 29130 } 29131 } 29132 return void 0; 29133} 29134function findIndex$2(array, comparator) { 29135 if (!Array.isArray(array)) { 29136 return -1; 29137 } 29138 for (var i2 = 0; i2 < array.length; i2++) { 29139 if (comparator(array[i2])) { 29140 return i2; 29141 } 29142 } 29143 return -1; 29144} 29145function getAppIdAndApiKey(searchClient) { 29146 if (searchClient.transporter) { 29147 var transporter = searchClient.transporter; 29148 var headers = transporter.headers || transporter.baseHeaders; 29149 var queryParameters = transporter.queryParameters || transporter.baseQueryParameters; 29150 var APP_ID = "x-algolia-application-id"; 29151 var API_KEY = "x-algolia-api-key"; 29152 var appId = headers[APP_ID] || queryParameters[APP_ID]; 29153 var apiKey = headers[API_KEY] || queryParameters[API_KEY]; 29154 return [appId, apiKey]; 29155 } else { 29156 return [searchClient.applicationID, searchClient.apiKey]; 29157 } 29158} 29159function isDomElement(object) { 29160 return object instanceof HTMLElement || Boolean(object) && object.nodeType > 0; 29161} 29162function getContainerNode(selectorOrHTMLElement) { 29163 var isSelectorString = typeof selectorOrHTMLElement === "string"; 29164 var domElement = isSelectorString ? document.querySelector(selectorOrHTMLElement) : selectorOrHTMLElement; 29165 if (!isDomElement(domElement)) { 29166 var errorMessage = "Container must be `string` or `HTMLElement`."; 29167 if (isSelectorString) { 29168 errorMessage += " Unable to find ".concat(selectorOrHTMLElement); 29169 } 29170 throw new Error(errorMessage); 29171 } 29172 return domElement; 29173} 29174function getHighlightedParts(highlightedValue) { 29175 var highlightPostTag = TAG_REPLACEMENT.highlightPostTag, highlightPreTag = TAG_REPLACEMENT.highlightPreTag; 29176 var splitByPreTag = highlightedValue.split(highlightPreTag); 29177 var firstValue = splitByPreTag.shift(); 29178 var elements = !firstValue ? [] : [{ 29179 value: firstValue, 29180 isHighlighted: false 29181 }]; 29182 splitByPreTag.forEach(function(split2) { 29183 var splitByPostTag = split2.split(highlightPostTag); 29184 elements.push({ 29185 value: splitByPostTag[0], 29186 isHighlighted: true 29187 }); 29188 if (splitByPostTag[1] !== "") { 29189 elements.push({ 29190 value: splitByPostTag[1], 29191 isHighlighted: false 29192 }); 29193 } 29194 }); 29195 return elements; 29196} 29197var hasAlphanumeric = new RegExp(/\w/i); 29198function getHighlightFromSiblings(parts, i2) { 29199 var _parts, _parts2; 29200 var current = parts[i2]; 29201 var isNextHighlighted = ((_parts = parts[i2 + 1]) === null || _parts === void 0 ? void 0 : _parts.isHighlighted) || true; 29202 var isPreviousHighlighted = ((_parts2 = parts[i2 - 1]) === null || _parts2 === void 0 ? void 0 : _parts2.isHighlighted) || true; 29203 if (!hasAlphanumeric.test(unescape$1(current.value)) && isPreviousHighlighted === isNextHighlighted) { 29204 return isPreviousHighlighted; 29205 } 29206 return current.isHighlighted; 29207} 29208function getPropertyByPath(object, path) { 29209 var parts = Array.isArray(path) ? path : path.split("."); 29210 return parts.reduce(function(current, key2) {
29211 return current && current[key2]; 29212 }, object); 29213} 29214function getRefinement$1(state, type, attribute, name) { 29215 var resultsFacets = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : []; 29216 var res = { 29217 type, 29218 attribute, 29219 name, 29220 escapedValue: escapeFacetValue$4(name) 29221 }; 29222 var facet = find$6(resultsFacets, function(resultsFacet) { 29223 return resultsFacet.name === attribute; 29224 }); 29225 var count; 29226 if (type === "hierarchical") { 29227 var facetDeclaration = state.getHierarchicalFacetByName(attribute); 29228 var nameParts = name.split(facetDeclaration.separator); 29229 var getFacetRefinement = function getFacetRefinement2(facetData) { 29230 return function(refinementKey) { 29231 return facetData[refinementKey]; 29232 }; 29233 }; 29234 var _loop = function _loop2(i3) { 29235 facet = facet && facet.data && find$6(Object.keys(facet.data).map(getFacetRefinement(facet.data)), function(refinement) { 29236 return refinement.name === nameParts[i3]; 29237 }); 29238 }; 29239 for (var i2 = 0; facet !== void 0 && i2 < nameParts.length; ++i2) { 29240 _loop(i2); 29241 } 29242 count = facet && facet.count; 29243 } else { 29244 count = facet && facet.data && facet.data[res.name]; 29245 } 29246 if (count !== void 0) { 29247 res.count = count; 29248 } 29249 if (facet && facet.exhaustive !== void 0) { 29250 res.exhaustive = facet.exhaustive; 29251 } 29252 return res; 29253} 29254function getRefinements(results, state) { 29255 var includesQuery = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; 29256 var refinements = []; 29257 var _state$facetsRefineme = state.facetsRefinements, facetsRefinements = _state$facetsRefineme === void 0 ? {} : _state$facetsRefineme, _state$facetsExcludes = state.facetsExcludes, facetsExcludes = _state$facetsExcludes === void 0 ? {} : _state$facetsExcludes, _state$disjunctiveFac = state.disjunctiveFacetsRefinements, disjunctiveFacetsRefinements = _state$disjunctiveFac === void 0 ? {} : _state$disjunctiveFac, _state$hierarchicalFa = state.hierarchicalFacetsRefinements, hierarchicalFacetsRefinements = _state$hierarchicalFa === void 0 ? {} : _state$hierarchicalFa, _state$numericRefinem = state.numericRefinements, numericRefinements = _state$numericRefinem === void 0 ? {} : _state$numericRefinem, _state$tagRefinements = state.tagRefinements, tagRefinements = _state$tagRefinements === void 0 ? [] : _state$tagRefinements; 29258 Object.keys(facetsRefinements).forEach(function(attribute) { 29259 var refinementNames = facetsRefinements[attribute]; 29260 refinementNames.forEach(function(refinementName) { 29261 refinements.push(getRefinement$1(state, "facet", attribute, refinementName, results.facets)); 29262 }); 29263 }); 29264 Object.keys(facetsExcludes).forEach(function(attribute) { 29265 var refinementNames = facetsExcludes[attribute]; 29266 refinementNames.forEach(function(refinementName) { 29267 refinements.push({ 29268 type: "exclude", 29269 attribute, 29270 name: refinementName, 29271 exclude: true 29272 }); 29273 }); 29274 }); 29275 Object.keys(disjunctiveFacetsRefinements).forEach(function(attribute) { 29276 var refinementNames = disjunctiveFacetsRefinements[attribute]; 29277 refinementNames.forEach(function(refinementName) { 29278 refinements.push(getRefinement$1( 29279 state, 29280 "disjunctive", 29281 attribute, 29282 // We unescape any disjunctive refined values with `unescapeFacetValue` because 29283 // they can be escaped on negative numeric values with `escapeFacetValue`. 29284 unescapeFacetValue$3(refinementName), 29285 results.disjunctiveFacets 29286 )); 29287 }); 29288 }); 29289 Object.keys(hierarchicalFacetsRefinements).forEach(function(attribute) { 29290 var refinementNames = hierarchicalFacetsRefinements[attribute]; 29291 refinementNames.forEach(function(refinement) { 29292 refinements.push(getRefinement$1(state, "hierarchical", attribute, refinement, results.hierarchicalFacets)); 29293 }); 29294 }); 29295 Object.keys(numericRefinements).forEach(function(attribute) { 29296 var operators = numericRefinements[attribute]; 29297 Object.keys(operators).forEach(function(operatorOriginal) { 29298 var operator = operatorOriginal; 29299 var valueOrValues = operators[operator]; 29300 var refinementNames = Array.isArray(valueOrValues) ? valueOrValues : [valueOrValues];
29301 refinementNames.forEach(function(refinementName) { 29302 refinements.push({ 29303 type: "numeric", 29304 attribute, 29305 name: "".concat(refinementName), 29306 numericValue: refinementName, 29307 operator 29308 }); 29309 }); 29310 }); 29311 }); 29312 tagRefinements.forEach(function(refinementName) { 29313 refinements.push({ 29314 type: "tag", 29315 attribute: "_tags", 29316 name: refinementName 29317 }); 29318 }); 29319 if (includesQuery && state.query && state.query.trim()) { 29320 refinements.push({ 29321 attribute: "query", 29322 type: "query", 29323 name: state.query, 29324 query: state.query 29325 }); 29326 } 29327 return refinements; 29328} 29329function _typeof$G(obj) { 29330 "@babel/helpers - typeof"; 29331 return _typeof$G = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 29332 return typeof obj2; 29333 } : function(obj2) { 29334 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 29335 }, _typeof$G(obj); 29336} 29337function ownKeys$y(object, enumerableOnly) { 29338 var keys = Object.keys(object); 29339 if (Object.getOwnPropertySymbols) { 29340 var symbols = Object.getOwnPropertySymbols(object); 29341 enumerableOnly && (symbols = symbols.filter(function(sym) { 29342 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 29343 })), keys.push.apply(keys, symbols); 29344 } 29345 return keys; 29346} 29347function _objectSpread$y(target) { 29348 for (var i2 = 1; i2 < arguments.length; i2++) { 29349 var source = null != arguments[i2] ? arguments[i2] : {}; 29350 i2 % 2 ? ownKeys$y(Object(source), true).forEach(function(key2) { 29351 _defineProperty$E(target, key2, source[key2]); 29352 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$y(Object(source)).forEach(function(key2) { 29353 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 29354 }); 29355 } 29356 return target; 29357} 29358function _defineProperty$E(obj, key2, value) { 29359 key2 = _toPropertyKey$E(key2); 29360 if (key2 in obj) { 29361 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 29362 } else { 29363 obj[key2] = value; 29364 } 29365 return obj; 29366} 29367function _toPropertyKey$E(arg) { 29368 var key2 = _toPrimitive$E(arg, "string"); 29369 return _typeof$G(key2) === "symbol" ? key2 : String(key2); 29370} 29371function _toPrimitive$E(input, hint) { 29372 if (_typeof$G(input) !== "object" || input === null) return input; 29373 var prim = input[Symbol.toPrimitive]; 29374 if (prim !== void 0) { 29375 var res = prim.call(input, hint || "default"); 29376 if (_typeof$G(res) !== "object") return res; 29377 throw new TypeError("@@toPrimitive must return a primitive value."); 29378 } 29379 return (hint === "string" ? String : Number)(input); 29380} 29381function addAbsolutePosition(hits3, page2, hitsPerPage) { 29382 return hits3.map(function(hit, idx) { 29383 return _objectSpread$y(_objectSpread$y({}, hit), {}, { 29384 __position: hitsPerPage * page2 + idx + 1 29385 }); 29386 }); 29387} 29388function _typeof$F(obj) { 29389 "@babel/helpers - typeof"; 29390 return _typeof$F = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 29391 return typeof obj2; 29392 } : function(obj2) { 29393 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 29394 }, _typeof$F(obj); 29395} 29396function ownKeys$x(object, enumerableOnly) { 29397 var keys = Object.keys(object); 29398 if (Object.getOwnPropertySymbols) { 29399 var symbols = Object.getOwnPropertySymbols(object); 29400 enumerableOnly && (symbols = symbols.filter(function(sym) { 29401 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 29402 })), keys.push.apply(keys, symbols); 29403 } 29404 return keys; 29405} 29406function _objectSpread$x(target) { 29407 for (var i2 = 1; i2 < arguments.length; i2++) { 29408 var source = null != arguments[i2] ? arguments[i2] : {}; 29409 i2 % 2 ? ownKeys$x(Object(source), true).forEach(function(key2) { 29410 _defineProperty$D(target, key2, source[key2]); 29411 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$x(Object(source)).forEac
29411h(function(key2) { 29412 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 29413 }); 29414 } 29415 return target; 29416} 29417function _defineProperty$D(obj, key2, value) { 29418 key2 = _toPropertyKey$D(key2); 29419 if (key2 in obj) { 29420 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 29421 } else { 29422 obj[key2] = value; 29423 } 29424 return obj; 29425} 29426function _toPropertyKey$D(arg) { 29427 var key2 = _toPrimitive$D(arg, "string"); 29428 return _typeof$F(key2) === "symbol" ? key2 : String(key2); 29429} 29430function _toPrimitive$D(input, hint) { 29431 if (_typeof$F(input) !== "object" || input === null) return input; 29432 var prim = input[Symbol.toPrimitive]; 29433 if (prim !== void 0) { 29434 var res = prim.call(input, hint || "default"); 29435 if (_typeof$F(res) !== "object") return res; 29436 throw new TypeError("@@toPrimitive must return a primitive value."); 29437 } 29438 return (hint === "string" ? String : Number)(input); 29439} 29440function addQueryID(hits3, queryID) { 29441 if (!queryID) { 29442 return hits3; 29443 } 29444 return hits3.map(function(hit) { 29445 return _objectSpread$x(_objectSpread$x({}, hit), {}, { 29446 __queryID: queryID 29447 }); 29448 }); 29449} 29450function _typeof$E(obj) { 29451 "@babel/helpers - typeof"; 29452 return _typeof$E = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 29453 return typeof obj2; 29454 } : function(obj2) { 29455 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 29456 }, _typeof$E(obj); 29457} 29458function ownKeys$w(object, enumerableOnly) { 29459 var keys = Object.keys(object); 29460 if (Object.getOwnPropertySymbols) { 29461 var symbols = Object.getOwnPropertySymbols(object); 29462 enumerableOnly && (symbols = symbols.filter(function(sym) { 29463 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 29464 })), keys.push.apply(keys, symbols); 29465 } 29466 return keys; 29467} 29468function _objectSpread$w(target) { 29469 for (var i2 = 1; i2 < arguments.length; i2++) { 29470 var source = null != arguments[i2] ? arguments[i2] : {}; 29471 i2 % 2 ? ownKeys$w(Object(source), true).forEach(function(key2) { 29472 _defineProperty$C(target, key2, source[key2]); 29473 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$w(Object(source)).forEach(function(key2) { 29474 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 29475 }); 29476 } 29477 return target; 29478} 29479function _defineProperty$C(obj, key2, value) { 29480 key2 = _toPropertyKey$C(key2); 29481 if (key2 in obj) { 29482 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 29483 } else { 29484 obj[key2] = value; 29485 } 29486 return obj; 29487} 29488function _toPropertyKey$C(arg) { 29489 var key2 = _toPrimitive$C(arg, "string"); 29490 return _typeof$E(key2) === "symbol" ? key2 : String(key2); 29491} 29492function _toPrimitive$C(input, hint) { 29493 if (_typeof$E(input) !== "object" || input === null) return input; 29494 var prim = input[Symbol.toPrimitive]; 29495 if (prim !== void 0) { 29496 var res = prim.call(input, hint || "default"); 29497 if (_typeof$E(res) !== "object") return res; 29498 throw new TypeError("@@toPrimitive must return a primitive value."); 29499 } 29500 return (hint === "string" ? String : Number)(input); 29501} 29502function hydrateRecommendCache(helper, initialResults) { 29503 var recommendCache = Object.keys(initialResults).reduce(function(acc, indexName) { 29504 var initialResult = initialResults[indexName]; 29505 if (initialResult.recommendResults) { 29506 return _objectSpread$w(_objectSpread$w({}, acc), initialResult.recommendResults.results); 29507 } 29508 return acc; 29509 }, {}); 29510 helper._recommendCache = recommendCache; 29511} 29512function _typeof$D(obj) { 29513 "@babel/helpers - typeof"; 29514 return _typeof$D = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 29515 return typeof obj2; 29516 } : function(obj2) { 29517 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 29518 }, _typeof$D(obj); 29519} 29520function _slicedToArray$3(arr, i2) { 29521 return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i2) || _unsupportedIterableToArray$9(arr, i2) || _nonIterableRest$3(); 29522} 29523function _nonIterableRest$3() {
29524 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 29525} 29526function _unsupportedIterableToArray$9(o2, minLen) { 29527 if (!o2) return; 29528 if (typeof o2 === "string") return _arrayLikeToArray$9(o2, minLen); 29529 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 29530 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 29531 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 29532 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$9(o2, minLen); 29533} 29534function _arrayLikeToArray$9(arr, len2) { 29535 if (len2 == null || len2 > arr.length) len2 = arr.length; 29536 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 29537 return arr2; 29538} 29539function _iterableToArrayLimit$3(arr, i2) { 29540 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 29541 if (null != _i2) { 29542 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 29543 try { 29544 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) ; 29545 else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 29546 } catch (err) { 29547 _d = true, _e = err; 29548 } finally { 29549 try { 29550 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 29551 } finally { 29552 if (_d) throw _e; 29553 } 29554 } 29555 return _arr; 29556 } 29557} 29558function _arrayWithHoles$3(arr) { 29559 if (Array.isArray(arr)) return arr; 29560} 29561function ownKeys$v(object, enumerableOnly) { 29562 var keys = Object.keys(object); 29563 if (Object.getOwnPropertySymbols) { 29564 var symbols = Object.getOwnPropertySymbols(object); 29565 enumerableOnly && (symbols = symbols.filter(function(sym) { 29566 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 29567 })), keys.push.apply(keys, symbols); 29568 } 29569 return keys; 29570} 29571function _objectSpread$v(target) { 29572 for (var i2 = 1; i2 < arguments.length; i2++) { 29573 var source = null != arguments[i2] ? arguments[i2] : {}; 29574 i2 % 2 ? ownKeys$v(Object(source), true).forEach(function(key2) { 29575 _defineProperty$B(target, key2, source[key2]); 29576 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$v(Object(source)).forEach(function(key2) { 29577 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 29578 }); 29579 } 29580 return target; 29581} 29582function _defineProperty$B(obj, key2, value) { 29583 key2 = _toPropertyKey$B(key2); 29584 if (key2 in obj) { 29585 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 29586 } else { 29587 obj[key2] = value; 29588 } 29589 return obj; 29590} 29591function _toPropertyKey$B(arg) { 29592 var key2 = _toPrimitive$B(arg, "string"); 29593 return _typeof$D(key2) === "symbol" ? key2 : String(key2); 29594} 29595function _toPrimitive$B(input, hint) { 29596 if (_typeof$D(input) !== "object" || input === null) return input; 29597 var prim = input[Symbol.toPrimitive]; 29598 if (prim !== void 0) { 29599 var res = prim.call(input, hint || "default"); 29600 if (_typeof$D(res) !== "object") return res; 29601 throw new TypeError("@@toPrimitive must return a primitive value."); 29602 } 29603 return (hint === "string" ? String : Number)(input); 29604} 29605function hydrateSearchClient(client, results) { 29606 if (!results) { 29607 return; 29608 } 29609 if ((!("transporter" in client) || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== "function")) { 29610 return; 29611 } 29612 var cachedRequest = [Object.keys(results).reduce(function(acc, key2) { 29613 var _results$key = results[key2], state = _results$key.state, requestParams = _results$key.requestParams, serverResults = _results$key.results; 29614 var mappedResults = serverResults && state ? serverResults.map(function(result, idx) { 29615 return _objectSpread$v({ 29616 indexName: state.index || result.index 29617 }, requestParams !== null && requestParams !== void 0 && requestParams[idx] || result.params ? { 29618 params: serializeQueryParameters((requestParams === null || requestParams === void 0 ? void 0 : requestParam
29618s[idx]) || deserializeQueryParameters(result.params)) 29619 } : {}); 29620 }) : []; 29621 return acc.concat(mappedResults); 29622 }, [])]; 29623 var cachedResults = Object.keys(results).reduce(function(acc, key2) { 29624 var res = results[key2].results; 29625 if (!res) { 29626 return acc; 29627 } 29628 return acc.concat(res); 29629 }, []); 29630 if ("transporter" in client && !client._cacheHydrated) { 29631 client._cacheHydrated = true; 29632 var baseMethod = client.search.bind(client); 29633 client.search = function(requests) { 29634 for (var _len = arguments.length, methodArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 29635 methodArgs[_key - 1] = arguments[_key]; 29636 } 29637 var requestsWithSerializedParams = requests.map(function(request) { 29638 return _objectSpread$v(_objectSpread$v({}, request), {}, { 29639 params: serializeQueryParameters(request.params) 29640 }); 29641 }); 29642 return client.transporter.responsesCache.get({ 29643 method: "search", 29644 args: [requestsWithSerializedParams].concat(methodArgs) 29645 }, function() { 29646 return baseMethod.apply(void 0, [requests].concat(methodArgs)); 29647 }); 29648 }; 29649 client.transporter.responsesCache.set({ 29650 method: "search", 29651 args: cachedRequest 29652 }, { 29653 results: cachedResults 29654 }); 29655 } 29656 if (!("transporter" in client)) { 29657 var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({ 29658 requests: cachedRequest 29659 })); 29660 client.cache = _objectSpread$v(_objectSpread$v({}, client.cache), {}, _defineProperty$B({}, cacheKey, JSON.stringify({ 29661 results: Object.keys(results).map(function(key2) { 29662 return results[key2].results; 29663 }) 29664 }))); 29665 } 29666} 29667function deserializeQueryParameters(parameters) { 29668 return parameters.split("&").reduce(function(acc, parameter) { 29669 var _parameter$split = parameter.split("="), _parameter$split2 = _slicedToArray$3(_parameter$split, 2), key2 = _parameter$split2[0], value = _parameter$split2[1]; 29670 acc[key2] = value ? decodeURIComponent(value) : ""; 29671 return acc; 29672 }, {}); 29673} 29674function serializeQueryParameters(parameters) { 29675 var isObjectOrArray = function isObjectOrArray2(value) { 29676 return Object.prototype.toString.call(value) === "[object Object]" || Object.prototype.toString.call(value) === "[object Array]"; 29677 }; 29678 var encode3 = function encode4(format2) { 29679 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 29680 args[_key2 - 1] = arguments[_key2]; 29681 } 29682 var i2 = 0; 29683 return format2.replace(/%s/g, function() { 29684 return encodeURIComponent(args[i2++]); 29685 }); 29686 }; 29687 return Object.keys(parameters).map(function(key2) { 29688 return encode3("%s=%s", key2, isObjectOrArray(parameters[key2]) ? JSON.stringify(parameters[key2]) : parameters[key2]); 29689 }).join("&"); 29690} 29691function isPrimitive(obj) { 29692 return obj !== Object(obj); 29693} 29694function isEqual(first2, second) { 29695 if (first2 === second) { 29696 return true; 29697 } 29698 if (isPrimitive(first2) || isPrimitive(second) || typeof first2 === "function" || typeof second === "function") { 29699 return first2 === second; 29700 } 29701 if (Object.keys(first2).length !== Object.keys(second).length) { 29702 return false; 29703 } 29704 for (var _i2 = 0, _Object$keys = Object.keys(first2); _i2 < _Object$keys.length; _i2++) { 29705 var key2 = _Object$keys[_i2]; 29706 if (!(key2 in second)) { 29707 return false; 29708 } 29709 if (!isEqual(first2[key2], second[key2])) { 29710 return false; 29711 } 29712 } 29713 return true; 29714} 29715function isFiniteNumber(value) { 29716 return typeof value === "number" && isFinite(value); 29717} 29718function isSpecialClick(event) { 29719 var isMiddleClick = event.button === 1; 29720 return isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 29721} 29722function uniq(array) { 29723 return array.filter(function(value, index3, self2) { 29724 return self2.indexOf(value) === index3; 29725 }); 29726} 29727function _typeof$C(obj) { 29728 "@babel/helpers - typeof"; 29729 return _typeof$C = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 29730 return typeof obj2; 29731 } : function(obj2) { 29732 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 29733 }, _typeof$C(obj); 29734} 29735var _excluded$g = ["facets", "disjunctiveFacets", "facetsRefinements", "facetsExcludes", "disjunctiveFacetsRefinements", "numericRefinements", "tagRefinements", "hierarchicalFacets", "hierarchicalFacetsRefinements", "ruleContexts"]; 29736function ownKeys$u(object, enumerableOnly) { 29737 var keys = Object.keys(object); 29738 if (Object.getOwnPropertySymbols) { 29739 var symbols = Object.getOwnPropertySymbols(object); 29740 enumerableOnly && (symbols = symbols.filter(function(sym) { 29741 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 29742 })), keys.push.apply(keys, symbols); 29743 } 29744 return keys; 29745} 29746function _objectSpread$u(target) { 29747 for (var i2 = 1; i2 < arguments.length; i2++) { 29748 var source = null != arguments[i2] ? arguments[i2] : {}; 29749 i2 % 2 ? ownKeys$u(Object(source), true).forEach(function(key2) { 29750 _defineProperty$A(target, key2, source[key2]); 29751 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$u(Object(source)).forEac
29751h(function(key2) { 29752 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 29753 }); 29754 } 29755 return target; 29756} 29757function _defineProperty$A(obj, key2, value) { 29758 key2 = _toPropertyKey$A(key2); 29759 if (key2 in obj) { 29760 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 29761 } else { 29762 obj[key2] = value; 29763 } 29764 return obj; 29765} 29766function _toPropertyKey$A(arg) { 29767 var key2 = _toPrimitive$A(arg, "string"); 29768 return _typeof$C(key2) === "symbol" ? key2 : String(key2); 29769} 29770function _toPrimitive$A(input, hint) { 29771 if (_typeof$C(input) !== "object" || input === null) return input; 29772 var prim = input[Symbol.toPrimitive]; 29773 if (prim !== void 0) { 29774 var res = prim.call(input, hint || "default"); 29775 if (_typeof$C(res) !== "object") return res; 29776 throw new TypeError("@@toPrimitive must return a primitive value."); 29777 } 29778 return (hint === "string" ? String : Number)(input); 29779} 29780function _objectWithoutProperties$f(source, excluded) { 29781 if (source == null) return {}; 29782 var target = _objectWithoutPropertiesLoose$g(source, excluded); 29783 var key2, i2; 29784 if (Object.getOwnPropertySymbols) { 29785 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 29786 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 29787 key2 = sourceSymbolKeys[i2]; 29788 if (excluded.indexOf(key2) >= 0) continue; 29789 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 29790 target[key2] = source[key2]; 29791 } 29792 } 29793 return target; 29794} 29795function _objectWithoutPropertiesLoose$g(source, excluded) { 29796 if (source == null) return {}; 29797 var target = {}; 29798 var sourceKeys = Object.keys(source); 29799 var key2, i2; 29800 for (i2 = 0; i2 < sourceKeys.length; i2++) { 29801 key2 = sourceKeys[i2]; 29802 if (excluded.indexOf(key2) >= 0) continue; 29803 target[key2] = source[key2]; 29804 } 29805 return target; 29806} 29807var mergeWithRest = function mergeWithRest2(left, right) { 29808 right.facets; 29809 right.disjunctiveFacets; 29810 right.facetsRefinements; 29811 right.facetsExcludes; 29812 right.disjunctiveFacetsRefinements; 29813 right.numericRefinements; 29814 right.tagRefinements; 29815 right.hierarchicalFacets; 29816 right.hierarchicalFacetsRefinements; 29817 right.ruleContexts; 29818 var rest = _objectWithoutProperties$f(right, _excluded$g); 29819 return left.setQueryParameters(rest); 29820}; 29821var mergeFacets = function mergeFacets2(left, right) { 29822 return right.facets.reduce(function(_2, name) { 29823 return _2.addFacet(name); 29824 }, left); 29825}; 29826var mergeDisjunctiveFacets = function mergeDisjunctiveFacets2(left, right) { 29827 return right.disjunctiveFacets.reduce(function(_2, name) { 29828 return _2.addDisjunctiveFacet(name); 29829 }, left); 29830}; 29831var mergeHierarchicalFacets = function mergeHierarchicalFacets2(left, right) { 29832 return left.setQueryParameters({ 29833 hierarchicalFacets: right.hierarchicalFacets.reduce(function(facets, facet) { 29834 var index3 = findIndex$2(facets, function(_2) { 29835 return _2.name === facet.name; 29836 }); 29837 if (index3 === -1) { 29838 return facets.concat(facet); 29839 } 29840 var nextFacets = facets.slice(); 29841 nextFacets.splice(index3, 1, facet); 29842 return nextFacets; 29843 }, left.hierarchicalFacets) 29844 }); 29845}; 29846var mergeTagRefinements = function mergeTagRefinements2(left, right) { 29847 return right.tagRefinements.reduce(function(_2, value) { 29848 return _2.addTagRefinement(value); 29849 }, left); 29850}; 29851var mergeFacetRefinements = function mergeFacetRefinements2(left, right) { 29852 return left.setQueryParameters({ 29853 facetsRefinements: _objectSpread$u(_objectSpread$u({}, left.facetsRefinements), right.facetsRefinements) 29854 }); 29855}; 29856var mergeFacetsExcludes = function mergeFacetsExcludes2(left, right) { 29857 return left.setQueryParameters({ 29858 facetsExcludes: _objectSpread$u(_objectSpread$u({}, left.facetsExcludes), right.facetsExcludes) 29859 }); 29860}; 29861var mergeDisjunctiveFacetsRefinements = function mergeDisjunctiveFacetsRefinements2(left, right) { 29862 return left.setQueryParameters({ 29863 disjunctiveFacetsRefinements: _objectSpread$u(_objectSpread$u({}, left.disjunctiveFacetsRefinements), right.disjunctiveFacetsRefinements) 29864 }); 29865}; 29866var mergeNumericRefinements = function mergeNumericRefinements2(left, right) { 29867 return left.setQueryParameters({ 29868 numericRefinements: _objectSpread$u(_objectSpread$u({}, left.numericRefinements), right.numericRefinements) 29869 }); 29870}; 29871var mergeHierarchicalFacetsRefinements = function mergeHierarchicalFacetsRefinements2(left, right) { 29872 return left.setQueryParameters({ 29873 hierarchicalFacetsRefinements: _objectSpread$u(_objectSpread$u({}, left.hierarchicalFacetsRefinements), right.hierarchicalFacetsRefinements) 29874 }); 29875}; 29876var mergeRuleContexts = function mergeRuleContexts2(left, right) { 29877 var ruleContexts = uniq([].concat(left.ruleContexts).concat(right.ruleContexts).filter(
29877Boolean)); 29878 if (ruleContexts.length > 0) { 29879 return left.setQueryParameters({ 29880 ruleContexts 29881 }); 29882 } 29883 return left; 29884}; 29885var mergeSearchParameters = function mergeSearchParameters2() { 29886 for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) { 29887 parameters[_key] = arguments[_key]; 29888 } 29889 return parameters.reduce(function(left, right) { 29890 var hierarchicalFacetsRefinementsMerged = mergeHierarchicalFacetsRefinements(left, right); 29891 var hierarchicalFacetsMerged = mergeHierarchicalFacets(hierarchicalFacetsRefinementsMerged, right); 29892 var tagRefinementsMerged = mergeTagRefinements(hierarchicalFacetsMerged, right); 29893 var numericRefinementsMerged = mergeNumericRefinements(tagRefinementsMerged, right); 29894 var disjunctiveFacetsRefinementsMerged = mergeDisjunctiveFacetsRefinements(numericRefinementsMerged, right); 29895 var facetsExcludesMerged = mergeFacetsExcludes(disjunctiveFacetsRefinementsMerged, right); 29896 var facetRefinementsMerged = mergeFacetRefinements(facetsExcludesMerged, right); 29897 var disjunctiveFacetsMerged = mergeDisjunctiveFacets(facetRefinementsMerged, right); 29898 var ruleContextsMerged = mergeRuleContexts(disjunctiveFacetsMerged, right); 29899 var facetsMerged = mergeFacets(ruleContextsMerged, right); 29900 return mergeWithRest(facetsMerged, right); 29901 }); 29902}; 29903function omit$4(source, excluded) { 29904 if (source === null || source === void 0) { 29905 return source; 29906 } 29907 return Object.keys(source).reduce(function(target, key2) { 29908 if (excluded.indexOf(key2) >= 0) { 29909 return target; 29910 } 29911 var validKey = key2; 29912 target[validKey] = source[validKey]; 29913 return target; 29914 }, {}); 29915} 29916function _toConsumableArray$6(arr) { 29917 return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$8(arr) || _nonIterableSpread$6(); 29918} 29919function _nonIterableSpread$6() { 29920 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 29921} 29922function _unsupportedIterableToArray$8(o2, minLen) { 29923 if (!o2) return; 29924 if (typeof o2 === "string") return _arrayLikeToArray$8(o2, minLen); 29925 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 29926 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 29927 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 29928 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$8(o2, minLen); 29929} 29930function _iterableToArray$6(iter) { 29931 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 29932} 29933function _arrayWithoutHoles$6(arr) { 29934 if (Array.isArray(arr)) return _arrayLikeToArray$8(arr); 29935} 29936function _arrayLikeToArray$8(arr, len2) { 29937 if (len2 == null || len2 > arr.length) len2 = arr.length; 29938 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 29939 return arr2; 29940} 29941function range$1(_ref) { 29942 var _ref$start = _ref.start, start2 = _ref$start === void 0 ? 0 : _ref$start, end = _ref.end, _ref$step = _ref.step, step = _ref$step === void 0 ? 1 : _ref$step; 29943 var limitStep = step === 0 ? 1 : step; 29944 var arrayLength = Math.round((end - start2) / limitStep); 29945 return _toConsumableArray$6(Array(arrayLength)).map(function(_2, current) { 29946 return start2 + current * limitStep; 29947 }); 29948} 29949function createInitArgs(instantSearchInstance, parent, uiState) { 29950 var helper = parent.getHelper(); 29951 return { 29952 uiState, 29953 helper, 29954 parent, 29955 instantSearchInstance, 29956 state: helper.state, 29957 renderState: instantSearchInstance.renderState, 29958 templatesConfig: instantSearchInstance.templatesConfig, 29959 createURL: parent.createURL, 29960 scopedResults: [], 29961 searchMetadata: { 29962 isSearchStalled: instantSearchInstance.status === "stalled" 29963 }, 29964 status: instantSearchInstance.status, 29965 error: instantSearchInstance.error 29966 }; 29967} 29968function createRenderArgs(instantSearchInstance, parent, widget) { 29969 var results = parent.getResultsForWidget(widget); 29970 var helper = parent.getHelper(); 29971 return { 29972 helper, 29973 parent, 29974 instantSearchInstance, 29975 results, 29976 scopedResults: parent.getScopedResults(), 29977 state: results && "_state" in results ? results._state : helper.state, 29978 renderState: instantSearchInstance.renderState, 29979 templatesConfig: instantSearchInstance.templatesConfig, 29980 createURL: parent.createURL, 29981 searchMetadata: { 29982 isSearchStalled: instantSearchInstance.status === "stalled" 29983 }, 29984 status: instantSearchInstance.status, 29985 error: instantSearchInstance.error 29986 }; 29987} 29988function resolveSearchParameters(current) { 29989 var parent = current.getParent(); 29990 var states = [current.getHelper().state]; 29991 while (parent !== null) { 29992 states = [parent.getHelper().state].concat(states); 29993 parent = parent.getParent(); 29994 } 29995 return states; 29996} 29997function _typeof$B(obj) { 29998 "@babel/helpers - typeof"; 29999 return _typeof$B = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 30000 return typeof obj2; 30001 } : function(obj2) { 30002 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 30003 }, _typeof$B(obj); 30004} 30005function ownKeys$t(object, enumerableOnly) { 30006 var keys = Object.keys(object); 30007 if (Object.getOwnPropertySymbols) { 30008 var symbols = Object.getOwnPropertySymbols(object); 30009 enumerableOnly && (symbols = symbols.filter(function(sym) { 30010 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 30011 })), keys.push.apply(keys, symbols); 30012 } 30013 return keys; 30014} 30015function _objectSpread$t(target) { 30016 for (var i2 = 1; i2 < arguments.length; i2++) { 30017 var source = null != arguments[i2] ? arguments[i2] : {}; 30018 i2 % 2 ? ownKeys$t(Object(source), true).forEach(function(key2) { 30019 _defineProperty$z(target, key2, source[key2]); 30020 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$t(Object(source)).forEac
30020h(function(key2) { 30021 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 30022 }); 30023 } 30024 return target; 30025} 30026function _defineProperty$z(obj, key2, value) { 30027 key2 = _toPropertyKey$z(key2); 30028 if (key2 in obj) { 30029 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 30030 } else { 30031 obj[key2] = value; 30032 } 30033 return obj; 30034} 30035function _toPropertyKey$z(arg) { 30036 var key2 = _toPrimitive$z(arg, "string"); 30037 return _typeof$B(key2) === "symbol" ? key2 : String(key2); 30038} 30039function _toPrimitive$z(input, hint) { 30040 if (_typeof$B(input) !== "object" || input === null) return input; 30041 var prim = input[Symbol.toPrimitive]; 30042 if (prim !== void 0) { 30043 var res = prim.call(input, hint || "default"); 30044 if (_typeof$B(res) !== "object") return res; 30045 throw new TypeError("@@toPrimitive must return a primitive value."); 30046 } 30047 return (hint === "string" ? String : Number)(input); 30048} 30049function reverseHighlightedParts(parts) { 30050 if (!parts.some(function(part) { 30051 return part.isHighlighted; 30052 })) { 30053 return parts.map(function(part) { 30054 return _objectSpread$t(_objectSpread$t({}, part), {}, { 30055 isHighlighted: false 30056 }); 30057 }); 30058 } 30059 return parts.map(function(part, i2) { 30060 return _objectSpread$t(_objectSpread$t({}, part), {}, { 30061 isHighlighted: !getHighlightFromSiblings(parts, i2) 30062 }); 30063 }); 30064} 30065function safelyRunOnBrowser(callback) { 30066 var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { 30067 fallback: function fallback2() { 30068 return void 0; 30069 } 30070 }, fallback = _ref.fallback; 30071 if (typeof window === "undefined") { 30072 return fallback(); 30073 } 30074 return callback({ 30075 window 30076 }); 30077} 30078function toArray2(value) { 30079 return Array.isArray(value) ? value : [value]; 30080} 30081var suit$9 = component("Highlight"); 30082function highlight(_ref) { 30083 var attribute = _ref.attribute, _ref$highlightedTagNa = _ref.highlightedTagName, highlightedTagName = _ref$highlightedTagNa === void 0 ? "mark" : _ref$highlightedTagNa, hit = _ref.hit, _ref$cssClasses = _ref.cssClasses, cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses; 30084 var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); 30085 var _ref22 = highlightAttributeResult || {}, _ref2$value = _ref22.value, attributeValue = _ref2$value === void 0 ? "" : _ref2$value; 30086 var className = suit$9({ 30087 descendantName: "highlighted" 30088 }) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : ""); 30089 return attributeValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, "g"), "<".concat(highlightedTagName, ' class="').concat(className, '">')).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, "g"), "</".concat(highlightedTagName, ">")); 30090} 30091var suit$8 = component("ReverseHighlight"); 30092function reverseHighlight(_ref) { 30093 var attribute = _ref.attribute, _ref$highlightedTagNa = _ref.highlightedTagName, highlightedTagName = _ref$highlightedTagNa === void 0 ? "mark" : _ref$highlightedTagNa, hit = _ref.hit, _ref$cssClasses = _ref.cssClasses, cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses; 30094 var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); 30095 var _ref22 = highlightAttributeResult || {}, _ref2$value = _ref22.value, attributeValue = _ref2$value === void 0 ? "" : _ref2$value; 30096 var className = suit$8({ 30097 descendantName: "highlighted" 30098 }) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : ""); 30099 var reverseHighlightedValue = concatHighlightedParts(reverseHighlightedParts(getHighlightedParts(attributeValue))); 30100 return reverseHighlightedValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, "g"), "<".concat(highlightedTagName, ' class="').concat(className, '">')).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, "g"), "</".concat(highlightedTagName, ">")); 30101} 30102var suit$7 = component("Snippet"); 30103function snippet(_ref) { 30104 var attribute = _ref.attribute, _ref$highlightedTagNa = _ref.highlightedTagName, highlightedTagName = _ref$highlightedTagNa === void 0 ? "mark" : _ref$highlightedTagNa, hit = _ref.hit, _ref$cssClasse
30104s = _ref.cssClasses, cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses; 30105 var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); 30106 var _ref22 = snippetAttributeResult || {}, _ref2$value = _ref22.value, attributeValue = _ref2$value === void 0 ? "" : _ref2$value; 30107 var className = suit$7({ 30108 descendantName: "highlighted" 30109 }) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : ""); 30110 return attributeValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, "g"), "<".concat(highlightedTagName, ' class="').concat(className, '">')).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, "g"), "</".concat(highlightedTagName, ">")); 30111} 30112var suit$6 = component("ReverseSnippet"); 30113function reverseSnippet(_ref) { 30114 var attribute = _ref.attribute, _ref$highlightedTagNa = _ref.highlightedTagName, highlightedTagName = _ref$highlightedTagNa === void 0 ? "mark" : _ref$highlightedTagNa, hit = _ref.hit, _ref$cssClasses = _ref.cssClasses, cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses; 30115 var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); 30116 var _ref22 = snippetAttributeResult || {}, _ref2$value = _ref22.value, attributeValue = _ref2$value === void 0 ? "" : _ref2$value; 30117 var className = suit$6({ 30118 descendantName: "highlighted" 30119 }) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : ""); 30120 var reverseHighlightedValue = concatHighlightedParts(reverseHighlightedParts(getHighlightedParts(attributeValue))); 30121 return reverseHighlightedValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, "g"), "<".concat(highlightedTagName, ' class="').concat(className, '">')).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, "g"), "</".concat(highlightedTagName, ">")); 30122} 30123function _typeof$A(obj) { 30124 "@babel/helpers - typeof"; 30125 return _typeof$A = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 30126 return typeof obj2; 30127 } : function(obj2) { 30128 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 30129 }, _typeof$A(obj); 30130} 30131function readDataAttributes(domElement) { 30132 var method = domElement.getAttribute("data-insights-method"); 30133 var serializedPayload = domElement.getAttribute("data-insights-payload"); 30134 if (typeof serializedPayload !== "string") { 30135 throw new Error("The insights helper expects `data-insights-payload` to be a base64-encoded JSON string."); 30136 } 30137 try { 30138 var payload = deserializePayload(serializedPayload); 30139 return { 30140 method, 30141 payload 30142 }; 30143 } catch (error2) { 30144 throw new Error("The insights helper was unable to parse `data-insights-payload`."); 30145 } 30146} 30147function writeDataAttributes(_ref) { 30148 var method = _ref.method, payload = _ref.payload; 30149 if (_typeof$A(payload) !== "object") { 30150 throw new Error("The insights helper expects the payload to be an object."); 30151 } 30152 var serializedPayload; 30153 try { 30154 serializedPayload = serializePayload(payload); 30155 } catch (error2) { 30156 throw new Error("Could not JSON serialize the payload object."); 30157 } 30158 return 'data-insights-method="'.concat(method, '" data-insights-payload="').concat(serializedPayload, '"'); 30159} 30160function insights(method, payload) { 30161 return writeDataAttributes({ 30162 method, 30163 payload 30164 }); 30165} 30166function _typeof$z(obj) { 30167 "@babel/helpers - typeof"; 30168 return _typeof$z = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 30169 return typeof obj2; 30170 } : function(obj2) { 30171 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 30172 }, _typeof$z(obj); 30173} 30174var ANONYMOUS_TOKEN_COOKIE_KEY = "_ALGOLIA"; 30175function getCookie(name) { 30176 if ((typeof document === "undefined" ? "undefined" : _typeof$z(document)) !== "object" || typeof document.cookie !== "string") { 30177 return void 0; 30178 } 30179 var prefix = "".concat(name, "="); 30180 var cookies = document.cookie.split(";"); 30181 for (var i2 = 0; i2 < cookies.length; i2++) { 30182 var cookie = cookies[i2]; 30183 while (cookie.charAt(0) === " ") { 30184 cookie = cookie.substring(1); 30185 } 30186 if (cookie.indexOf(prefix) === 0) { 30187 return cookie.substring(prefix.length, cookie.length); 30188 } 30189 } 30190 return void 0; 30191} 30192function getInsightsAnonymousUserTokenInternal() { 30193 return getCookie(ANONYMOUS_TOKEN_COOKIE_KEY); 30194} 30195function getInsightsAnonymousUserToken() { 30196 return getInsightsAnonymousUserTokenInternal(); 30197} 30198var _excluded$f = ["page"]; 30199function _objectWithoutProperties$e(source, excluded) { 30200 if (source == null) return {}; 30201 var target = _objectWithoutPropertiesLoose$f(source, excluded); 30202 var key2, i2; 30203 if (Object.getOwnPropertySymbols) { 30204 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 30205 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 30206 key2 = sourceSymbolKeys[i2]; 30207 if (excluded.indexOf(key2) >= 0) continue; 30208 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 30209 target[key2] = source[key2]; 30210 } 30211 } 30212 return target; 30213} 30214function _objectWithoutPropertiesLoose$f(source, excluded) { 30215 if (source == null) return {}; 30216 var target = {}; 30217 var sourceKeys = Object.keys(source); 30218 var key2, i2; 30219 for (i2 = 0; i2 < sourceKeys.length; i2++) { 30220 key2 = sourceKeys[i2]; 30221 if (excluded.indexOf(key2) >= 0) continue; 30222 target[key2] = source[key2]; 30223 } 30224 return target; 30225} 30226function getStateWithoutPage(state) { 30227 var _ref = state || {}; 30228 _ref.page; 30229 var rest = _objectWithoutProperties$e(_ref, _excluded$f); 30230 return rest; 30231} 30232function createInfiniteHitsSessionStorageCache() { 30233 var _ref22 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, key2 = _ref22.key;
vendor: 9,995 bytes, lines 30234-30575
30234 var KEY = ["ais.infiniteHits", key2].filter(Boolean).join(":"); 30235 return { 30236 read: function read(_ref3) { 30237 var state = _ref3.state; 30238 var sessionStorage2 = safelyRunOnBrowser(function(_ref42) { 30239 var window2 = _ref42.window; 30240 return window2.sessionStorage; 30241 }); 30242 if (!sessionStorage2) { 30243 return null; 30244 } 30245 try { 30246 var cache2 = JSON.parse( 30247 // @ts-expect-error JSON.parse() requires a string, but it actually accepts null, too. 30248 sessionStorage2.getItem(KEY) 30249 ); 30250 return cache2 && isEqual(cache2.state, getStateWithoutPage(state)) ? cache2.hits : null; 30251 } catch (error2) { 30252 if (error2 instanceof SyntaxError) { 30253 try { 30254 sessionStorage2.removeItem(KEY); 30255 } catch (err) { 30256 } 30257 } 30258 return null; 30259 } 30260 }, 30261 write: function write(_ref5) { 30262 var state = _ref5.state, hits3 = _ref5.hits; 30263 var sessionStorage2 = safelyRunOnBrowser(function(_ref62) { 30264 var window2 = _ref62.window; 30265 return window2.sessionStorage; 30266 }); 30267 if (!sessionStorage2) { 30268 return; 30269 } 30270 try { 30271 sessionStorage2.setItem(KEY, JSON.stringify({ 30272 state: getStateWithoutPage(state), 30273 hits: hits3 30274 })); 30275 } catch (error2) { 30276 } 30277 } 30278 }; 30279} 30280function EventEmitter$2() { 30281 this._events = this._events || {}; 30282 this._maxListeners = this._maxListeners || void 0; 30283} 30284var events = EventEmitter$2; 30285EventEmitter$2.prototype._events = void 0; 30286EventEmitter$2.prototype._maxListeners = void 0; 30287EventEmitter$2.defaultMaxListeners = 10; 30288EventEmitter$2.prototype.setMaxListeners = function(n2) { 30289 if (!isNumber(n2) || n2 < 0 || isNaN(n2)) 30290 throw TypeError("n must be a positive number"); 30291 this._maxListeners = n2; 30292 return this; 30293}; 30294EventEmitter$2.prototype.emit = function(type) { 30295 var er, handler, len2, args, i2, listeners; 30296 if (!this._events) 30297 this._events = {}; 30298 if (type === "error") { 30299 if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { 30300 er = arguments[1]; 30301 if (er instanceof Error) { 30302 throw er; 30303 } else { 30304 var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); 30305 err.context = er; 30306 throw err; 30307 } 30308 } 30309 } 30310 handler = this._events[type]; 30311 if (isUndefined(handler)) 30312 return false; 30313 if (isFunction(handler)) { 30314 switch (arguments.length) { 30315 case 1: 30316 handler.call(this); 30317 break; 30318 case 2: 30319 handler.call(this, arguments[1]); 30320 break; 30321 case 3: 30322 handler.call(this, arguments[1], arguments[2]); 30323 break; 30324 default: 30325 args = Array.prototype.slice.call(arguments, 1); 30326 handler.apply(this, args); 30327 } 30328 } else if (isObject(handler)) { 30329 args = Array.prototype.slice.call(arguments, 1); 30330 listeners = handler.slice(); 30331 len2 = listeners.length; 30332 for (i2 = 0; i2 < len2; i2++) 30333 listeners[i2].apply(this, args); 30334 } 30335 return true; 30336}; 30337EventEmitter$2.prototype.addListener = function(type, listener) { 30338 var m2; 30339 if (!isFunction(listener)) 30340 throw TypeError("listener must be a function"); 30341 if (!this._events) 30342 this._events = {}; 30343 if (this._events.newListener) 30344 this.emit( 30345 "newListener", 30346 type, 30347 isFunction(listener.listener) ? listener.listener : listener 30348 ); 30349 if (!this._events[type]) 30350 this._events[type] = listener; 30351 else if (isObject(this._events[type])) 30352 this._events[type].push(listener); 30353 else 30354 this._events[type] = [this._events[type], listener]; 30355 if (isObject(this._events[type]) && !this._events[type].warned) { 30356 if (!isUndefined(this._maxListeners)) { 30357 m2 = this._maxListeners; 30358 } else { 30359 m2 = EventEmitter$2.defaultMaxListeners; 30360 } 30361 if (m2 && m2 > 0 && this._events[type].length > m2) { 30362 this._events[type].warned = true; 30363 console.error( 30364 "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", 30365 this._events[type].length 30366 ); 30367 if (typeof console.trace === "function") { 30368 console.trace(); 30369 } 30370 } 30371 } 30372 return this; 30373}; 30374EventEmitter$2.prototype.on = EventEmitter$2.prototype.addListener; 30375EventEmitter$2.prototype.once = function(type, listener) { 30376 if (!isFunction(listener)) 30377 throw TypeError("listener must be a function"); 30378 var fired = false; 30379 function g2() { 30380 this.removeListener(type, g2); 30381 if (!fired) { 30382 fired = true; 30383 listener.apply(this, arguments); 30384 } 30385 } 30386 g2.listener = listener; 30387 this.on(type, g2); 30388 return this; 30389}; 30390EventEmitter$2.prototype.removeListener = function(type, listener) { 30391 var list, position, length, i2; 30392 if (!isFunction(listener)) 30393 throw TypeError("listener must be a function"); 30394 if (!this._events || !this._events[type]) 30395 return this; 30396 list = this._events[type]; 30397 length = list.length; 30398 position = -1; 30399 if (list === listener || isFunction(list.listener) && list.listener === listener) { 30400 delete this._events[type]; 30401 if (this._events.removeListener) 30402 this.emit("removeListener", type, listener); 30403 } else if (isObject(list)) { 30404 for (i2 = length; i2-- > 0; ) { 30405 if (list[i2] === listener || list[i2].listener && list[i2].listener === listener) { 30406 position = i2; 30407 break; 30408 } 30409 } 30410 if (position < 0) 30411 return this; 30412 if (list.length === 1) { 30413 list.length = 0; 30414 delete this._events[type]; 30415 } else { 30416 list.splice(position, 1); 30417 } 30418 if (this._events.removeListener) 30419 this.emit("removeListener", type, listener); 30420 } 30421 return this; 30422}; 30423EventEmitter$2.prototype.removeAllListeners = function(type) { 30424 var key2, listeners; 30425 if (!this._events) 30426 return this; 30427 if (!this._events.removeListener) { 30428 if (arguments.length === 0) 30429 this._events = {}; 30430 else if (this._events[type]) 30431 delete this._events[type]; 30432 return this; 30433 } 30434 if (arguments.length === 0) { 30435 for (key2 in this._events) { 30436 if (key2 === "removeListener") continue; 30437 this.removeAllListeners(key2); 30438 } 30439 this.removeAllListeners("removeListener"); 30440 this._events = {}; 30441 return this; 30442 } 30443 listeners = this._events[type]; 30444 if (isFunction(listeners)) { 30445 this.removeListener(type, listeners); 30446 } else if (listeners) { 30447 while (listeners.length) 30448 this.removeListener(type, listeners[listeners.length - 1]); 30449 } 30450 delete this._events[type]; 30451 return this; 30452}; 30453EventEmitter$2.prototype.listeners = function(type) { 30454 var ret; 30455 if (!this._events || !this._events[type]) 30456 ret = []; 30457 else if (isFunction(this._events[type])) 30458 ret = [this._events[type]]; 30459 else 30460 ret = this._events[type].slice(); 30461 return ret; 30462}; 30463EventEmitter$2.prototype.listenerCount = function(type) { 30464 if (this._events) { 30465 var evlistener = this._events[type]; 30466 if (isFunction(evlistener)) 30467 return 1; 30468 else if (evlistener) 30469 return evlistener.length; 30470 } 30471 return 0; 30472}; 30473EventEmitter$2.listenerCount = function(emitter, type) { 30474 return emitter.listenerCount(type); 30475}; 30476function isFunction(arg) { 30477 return typeof arg === "function"; 30478} 30479function isNumber(arg) { 30480 return typeof arg === "number"; 30481} 30482function isObject(arg) { 30483 return typeof arg === "object" && arg !== null; 30484} 30485function isUndefined(arg) { 30486 return arg === void 0; 30487} 30488const EventEmitter$3 = /* @__PURE__ */ getDefaultExportFromCjs(events); 30489function inherits$2(ctor, superCtor) { 30490 ctor.prototype = Object.create(superCtor.prototype, { 30491 constructor: { 30492 value: ctor, 30493 enumerable: false, 30494 writable: true, 30495 configurable: true 30496 } 30497 }); 30498} 30499var inherits_1 = inherits$2; 30500var EventEmitter$1 = events; 30501var inherits$1 = inherits_1; 30502function DerivedHelper$1(mainHelper, fn, recommendFn) { 30503 this.main = mainHelper; 30504 this.fn = fn; 30505 this.recommendFn = recommendFn; 30506 this.lastResults = null; 30507 this.lastRecommendResults = null; 30508} 30509inherits$1(DerivedHelper$1, EventEmitter$1); 30510DerivedHelper$1.prototype.detach = function() { 30511 this.removeAllListeners(); 30512 this.main.detachDerivedHelper(this); 30513}; 30514DerivedHelper$1.prototype.getModifiedState = function(parameters) { 30515 return this.fn(parameters); 30516}; 30517DerivedHelper$1.prototype.getModifiedRecommendState = function(parameters) { 30518 return this.recommendFn(parameters); 30519}; 30520var DerivedHelper_1 = DerivedHelper$1; 30521function escapeFacetValue$3(value) { 30522 if (typeof value !== "string") return value; 30523 return String(value).replace(/^-/, "\\-"); 30524} 30525function unescapeFacetValue$2(value) { 30526 if (typeof value !== "string") return value; 30527 return value.replace(/^\\-/, "-"); 30528} 30529var escapeFacetValue_1 = { 30530 escapeFacetValue: escapeFacetValue$3, 30531 unescapeFacetValue: unescapeFacetValue$2 30532}; 30533function clone(value) { 30534 if (typeof value === "object" && value !== null) { 30535 return _merge2(Array.isArray(value) ? [] : {}, value); 30536 } 30537 return value; 30538} 30539function isObjectOrArrayOrFunction(value) { 30540 return typeof value === "function" || Array.isArray(value) || Object.prototype.toString.call(value) === "[object Object]"; 30541} 30542function _merge2(target, source) { 30543 if (target === source) { 30544 return target; 30545 } 30546 for (var key2 in source) { 30547 if (!Object.prototype.hasOwnProperty.call(source, key2) || key2 === "__proto__" || key2 === "constructor") { 30548 continue; 30549 } 30550 var sourceVal = source[key2]; 30551 var targetVal = target[key2]; 30552 if (typeof targetVal !== "undefined" && typeof sourceVal === "undefined") { 30553 continue; 30554 } 30555 if (isObjectOrArrayOrFunction(targetVal) && isObjectOrArrayOrFunction(sourceVal)) { 30556 target[key2] = _merge2(targetVal, sourceVal); 30557 } else { 30558 target[key2] = clone(sourceVal); 30559 } 30560 } 30561 return target; 30562} 30563function merge$5(target) { 30564 if (!isObjectOrArrayOrFunction(target)) { 30565 target = {}; 30566 } 30567 for (var i2 = 1, l2 = arguments.length; i2 < l2; i2++) { 30568 var source = arguments[i2]; 30569 if (isObjectOrArrayOrFunction(source)) { 30570 _merge2(target, source); 30571 } 30572 } 30573 return target; 30574} 30575var merge_1 = merge$5;
30576function objectHasKeys$3(obj) { 30577 return obj && Object.keys(obj).length > 0; 30578} 30579var objectHasKeys_1 = objectHasKeys$3; 30580function _objectWithoutPropertiesLoose$e(source, excluded) { 30581 if (source === null) return {}; 30582 var target = {}; 30583 var sourceKeys = Object.keys(source); 30584 var key2; 30585 var i2; 30586 for (i2 = 0; i2 < sourceKeys.length; i2++) { 30587 key2 = sourceKeys[i2]; 30588 if (excluded.indexOf(key2) >= 0) continue; 30589 target[key2] = source[key2]; 30590 } 30591 return target; 30592} 30593var omit$3 = _objectWithoutPropertiesLoose$e; 30594function RecommendParameters$2(opts) { 30595 opts = opts || {}; 30596 this.params = opts.params || []; 30597} 30598RecommendParameters$2.prototype = { 30599 constructor: RecommendParameters$2, 30600 addParams: function(params) { 30601 var newParams = this.params.slice(); 30602 newParams.push(params); 30603 return new RecommendParameters$2({ params: newParams }); 30604 }, 30605 removeParams: function(id2) { 30606 return new RecommendParameters$2({ 30607 params: this.params.filter(function(param) { 30608 return param.$$id !== id2; 30609 }) 30610 }); 30611 }, 30612 addFrequentlyBoughtTogether: function(params) { 30613 return this.addParams( 30614 Object.assign({}, params, { model: "bought-together" }) 30615 ); 30616 }, 30617 addRelatedProducts: function(params) { 30618 return this.addParams( 30619 Object.assign({}, params, { model: "related-products" }) 30620 ); 30621 }, 30622 addTrendingItems: function(params) { 30623 return this.addParams( 30624 Object.assign({}, params, { model: "trending-items" }) 30625 ); 30626 }, 30627 addTrendingFacets: function(params) { 30628 return this.addParams( 30629 Object.assign({}, params, { model: "trending-facets" }) 30630 ); 30631 }, 30632 addLookingSimilar: function(params) { 30633 return this.addParams( 30634 Object.assign({}, params, { model: "looking-similar" }) 30635 ); 30636 }, 30637 _buildQueries: function(indexName, cache2) { 30638 return this.params.filter(function(params) { 30639 return cache2[params.$$id] === void 0; 30640 }).map(function(params) { 30641 var query = Object.assign({}, params, { 30642 indexName, 30643 // @TODO: remove this if it ever gets handled by the API 30644 threshold: params.threshold || 0 30645 }); 30646 delete query.$$id; 30647 return query; 30648 }); 30649 } 30650}; 30651var RecommendParameters_1 = RecommendParameters$2; 30652function RecommendResults$2(state, results) { 30653 this._state = state; 30654 this._rawResults = {}; 30655 var self2 = this; 30656 state.params.forEach(function(param) { 30657 var id2 = param.$$id; 30658 self2[id2] = results[id2]; 30659 self2._rawResults[id2] = results[id2]; 30660 }); 30661} 30662RecommendResults$2.prototype = { 30663 constructor: RecommendResults$2 30664}; 30665var RecommendResults_1 = RecommendResults$2; 30666var merge$4 = merge_1; 30667function sortObject(obj) { 30668 return Object.keys(obj).sort().reduce(function(acc, curr) { 30669 acc[curr] = obj[curr]; 30670 return acc; 30671 }, {}); 30672} 30673var requestBuilder$1 = { 30674 /** 30675 * Get all the queries to send to the client, those queries can used directly 30676 * with the Algolia client. 30677 * @private 30678 * @param {string} index The name of the index 30679 * @param {SearchParameters} state The state from which to get the queries 30680 * @return {object[]} The queries 30681 */ 30682 _getQueries: function getQueries(index3, state) { 30683 var queries = []; 30684 queries.push({ 30685 indexName: index3, 30686 params: requestBuilder$1._getHitsSearchParams(state) 30687 }); 30688 state.getRefinedDisjunctiveFacets().forEach(function(refinedFacet) { 30689 queries.push({ 30690 indexName: index3, 30691 params: requestBuilder$1._getDisjunctiveFacetSearchParams( 30692 state, 30693 refinedFacet 30694 ) 30695 }); 30696 }); 30697 state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) { 30698 var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet); 30699 var currentRefinement = state.getHierarchicalRefinement(refinedFacet); 30700 var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 30701 if (currentRefinement.length > 0 && currentRefinement[0].split(separator).length > 1) { 30702 var filtersMap = currentRefinement[0].split(separator).slice(0, -1).reduce(function createFiltersMap(map, segment, level) { 30703 return map.concat({ 30704 attribute: hierarchicalFacet.attributes[level], 30705 value: level === 0 ? segment : [map[map.length - 1].value, segment].join(separator) 30706 }); 30707 }, []);
vendor: 8,050 bytes, lines 30708-30911
30708 filtersMap.forEach(function(filter, level) { 30709 var params = requestBuilder$1._getDisjunctiveFacetSearchParams( 30710 state, 30711 filter.attribute, 30712 level === 0 30713 ); 30714 function hasHierarchicalFacetFilter(value) { 30715 return hierarchicalFacet.attributes.some(function(attribute) { 30716 return attribute === value.split(":")[0]; 30717 }); 30718 } 30719 var filteredFacetFilters = (params.facetFilters || []).reduce( 30720 function(acc, facetFilter) { 30721 if (Array.isArray(facetFilter)) { 30722 var filtered = facetFilter.filter(function(filterValue) { 30723 return !hasHierarchicalFacetFilter(filterValue); 30724 }); 30725 if (filtered.length > 0) { 30726 acc.push(filtered); 30727 } 30728 } 30729 if (typeof facetFilter === "string" && !hasHierarchicalFacetFilter(facetFilter)) { 30730 acc.push(facetFilter); 30731 } 30732 return acc; 30733 }, 30734 [] 30735 ); 30736 var parent = filtersMap[level - 1]; 30737 if (level > 0) { 30738 params.facetFilters = filteredFacetFilters.concat( 30739 parent.attribute + ":" + parent.value 30740 ); 30741 } else if (filteredFacetFilters.length > 0) { 30742 params.facetFilters = filteredFacetFilters; 30743 } else { 30744 delete params.facetFilters; 30745 } 30746 queries.push({ indexName: index3, params }); 30747 }); 30748 } 30749 }); 30750 return queries; 30751 }, 30752 /** 30753 * Build search parameters used to fetch hits 30754 * @private 30755 * @param {SearchParameters} state The state from which to get the queries 30756 * @return {object.<string, any>} The search parameters for hits 30757 */ 30758 _getHitsSearchParams: function(state) { 30759 var facets = state.facets.concat(state.disjunctiveFacets).concat(requestBuilder$1._getHitsHierarchicalFacetsAttributes(state)).sort(); 30760 var facetFilters = requestBuilder$1._getFacetFilters(state); 30761 var numericFilters = requestBuilder$1._getNumericFilters(state); 30762 var tagFilters = requestBuilder$1._getTagFilters(state); 30763 var additionalParams = {}; 30764 if (facets.length > 0) { 30765 additionalParams.facets = facets.indexOf("*") > -1 ? ["*"] : facets; 30766 } 30767 if (tagFilters.length > 0) { 30768 additionalParams.tagFilters = tagFilters; 30769 } 30770 if (facetFilters.length > 0) { 30771 additionalParams.facetFilters = facetFilters; 30772 } 30773 if (numericFilters.length > 0) { 30774 additionalParams.numericFilters = numericFilters; 30775 } 30776 return sortObject(merge$4({}, state.getQueryParams(), additionalParams)); 30777 }, 30778 /** 30779 * Build search parameters used to fetch a disjunctive facet 30780 * @private 30781 * @param {SearchParameters} state The state from which to get the queries 30782 * @param {string} facet the associated facet name 30783 * @param {boolean} hierarchicalRootLevel ?? FIXME 30784 * @return {object} The search parameters for a disjunctive facet 30785 */ 30786 _getDisjunctiveFacetSearchParams: function(state, facet, hierarchicalRootLevel) { 30787 var facetFilters = requestBuilder$1._getFacetFilters( 30788 state, 30789 facet, 30790 hierarchicalRootLevel 30791 ); 30792 var numericFilters = requestBuilder$1._getNumericFilters(state, facet); 30793 var tagFilters = requestBuilder$1._getTagFilters(state); 30794 var additionalParams = { 30795 hitsPerPage: 0, 30796 page: 0, 30797 analytics: false, 30798 clickAnalytics: false 30799 }; 30800 if (tagFilters.length > 0) { 30801 additionalParams.tagFilters = tagFilters; 30802 } 30803 var hierarchicalFacet = state.getHierarchicalFacetByName(facet); 30804 if (hierarchicalFacet) { 30805 additionalParams.facets = requestBuilder$1._getDisjunctiveHierarchicalFacetAttribute( 30806 state, 30807 hierarchicalFacet, 30808 hierarchicalRootLevel 30809 ); 30810 } else { 30811 additionalParams.facets = facet; 30812 } 30813 if (numericFilters.length > 0) { 30814 additionalParams.numericFilters = numericFilters; 30815 } 30816 if (facetFilters.length > 0) { 30817 additionalParams.facetFilters = facetFilters; 30818 } 30819 return sortObject(merge$4({}, state.getQueryParams(), additionalParams)); 30820 }, 30821 /** 30822 * Return the numeric filters in an algolia request fashion 30823 * @private 30824 * @param {SearchParameters} state the state from which to get the filters 30825 * @param {string} [facetName] the name of the attribute for which the filters should be excluded 30826 * @return {string[]} the numeric filters in the algolia format 30827 */ 30828 _getNumericFilters: function(state, facetName) { 30829 if (state.numericFilters) { 30830 return state.numericFilters; 30831 } 30832 var numericFilters = []; 30833 Object.keys(state.numericRefinements).forEach(function(attribute) { 30834 var operators = state.numericRefinements[attribute] || {}; 30835 Object.keys(operators).forEach(function(operator) { 30836 var values = operators[operator] || []; 30837 if (facetName !== attribute) { 30838 values.forEach(function(value) { 30839 if (Array.isArray(value)) { 30840 var vs = value.map(function(v2) { 30841 return attribute + operator + v2; 30842 }); 30843 numericFilters.push(vs); 30844 } else { 30845 numericFilters.push(attribute + operator + value); 30846 } 30847 }); 30848 } 30849 }); 30850 }); 30851 return numericFilters; 30852 }, 30853 /** 30854 * Return the tags filters depending on which format is used, either tagFilters or tagRefinements 30855 * @private 30856 * @param {SearchParameters} state the state from which to get the filters 30857 * @return {string} Tag filters in a single string 30858 */ 30859 _getTagFilters: function(state) { 30860 if (state.tagFilters) { 30861 return state.tagFilters; 30862 } 30863 return state.tagRefinements.join(","); 30864 }, 30865 /** 30866 * Build facetFilters parameter based on current refinements. The array returned 30867 * contains strings representing the facet filters in the algolia format. 30868 * @private 30869 * @param {SearchParameters} state The state from which to get the queries 30870 * @param {string} [facet] if set, the current disjunctive facet 30871 * @param {boolean} [hierarchicalRootLevel] ?? FIXME 30872 * @return {array.<string>} The facet filters in the algolia format 30873 */ 30874 _getFacetFilters: function(state, facet, hierarchicalRootLevel) { 30875 var facetFilters = []; 30876 var facetsRefinements = state.facetsRefinements || {}; 30877 Object.keys(facetsRefinements).sort().forEach(function(facetName) { 30878 var facetValues = facetsRefinements[facetName] || []; 30879 facetValues.slice().sort().forEach(function(facetValue) { 30880 facetFilters.push(facetName + ":" + facetValue); 30881 }); 30882 }); 30883 var facetsExcludes = state.facetsExcludes || {}; 30884 Object.keys(facetsExcludes).sort().forEach(function(facetName) { 30885 var facetValues = facetsExcludes[facetName] || []; 30886 facetValues.sort().forEach(function(facetValue) { 30887 facetFilters.push(facetName + ":-" + facetValue); 30888 }); 30889 }); 30890 var disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements || {}; 30891 Object.keys(disjunctiveFacetsRefinements).sort().forEach(function(facetName) { 30892 var facetValues = disjunctiveFacetsRefinements[facetName] || []; 30893 if (facetName === facet || !facetValues || facetValues.length === 0) { 30894 return; 30895 } 30896 var orFilters = []; 30897 facetValues.slice().sort().forEach(function(facetValue) { 30898 orFilters.push(facetName + ":" + facetValue); 30899 }); 30900 facetFilters.push(orFilters); 30901 }); 30902 var hierarchicalFacetsRefinements = state.hierarchicalFacetsRefinements || {}; 30903 Object.keys(hierarchicalFacetsRefinements).sort().forEach(function(facetName) { 30904 var facetValues = hierarchicalFacetsRefinements[facetName] || []; 30905 var facetValue = facetValues[0]; 30906 if (facetValue === void 0) { 30907 return; 30908 } 30909 var hierarchicalFacet = state.getHierarchicalFacetByName(facetName); 30910 var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 30911 var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);
30912 var attributeToRefine; 30913 var attributesIndex; 30914 if (facet === facetName) { 30915 if (facetValue.indexOf(separator) === -1 || !rootPath && hierarchicalRootLevel === true || rootPath && rootPath.split(separator).length === facetValue.split(separator).length) { 30916 return; 30917 } 30918 if (!rootPath) { 30919 attributesIndex = facetValue.split(separator).length - 2; 30920 facetValue = facetValue.slice(0, facetValue.lastIndexOf(separator)); 30921 } else { 30922 attributesIndex = rootPath.split(separator).length - 1; 30923 facetValue = rootPath; 30924 } 30925 attributeToRefine = hierarchicalFacet.attributes[attributesIndex]; 30926 } else { 30927 attributesIndex = facetValue.split(separator).length - 1; 30928 attributeToRefine = hierarchicalFacet.attributes[attributesIndex]; 30929 } 30930 if (attributeToRefine) { 30931 facetFilters.push([attributeToRefine + ":" + facetValue]); 30932 } 30933 }); 30934 return facetFilters; 30935 }, 30936 _getHitsHierarchicalFacetsAttributes: function(state) { 30937 var out = []; 30938 return state.hierarchicalFacets.reduce( 30939 // ask for as much levels as there's hierarchical refinements 30940 function getHitsAttributesForHierarchicalFacet(allAttributes, hierarchicalFacet) { 30941 var hierarchicalRefinement = state.getHierarchicalRefinement( 30942 hierarchicalFacet.name 30943 )[0]; 30944 if (!hierarchicalRefinement) { 30945 allAttributes.push(hierarchicalFacet.attributes[0]); 30946 return allAttributes; 30947 } 30948 var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 30949 var level = hierarchicalRefinement.split(separator).length; 30950 var newAttributes = hierarchicalFacet.attributes.slice(0, level + 1); 30951 return allAttributes.concat(newAttributes); 30952 }, 30953 out 30954 ); 30955 }, 30956 _getDisjunctiveHierarchicalFacetAttribute: function(state, hierarchicalFacet, rootLevel) { 30957 var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 30958 if (rootLevel === true) { 30959 var rootPath = state._getHierarchicalRootPath(hierarchicalFacet); 30960 var attributeIndex = 0; 30961 if (rootPath) { 30962 attributeIndex = rootPath.split(separator).length; 30963 } 30964 return [hierarchicalFacet.attributes[attributeIndex]]; 30965 } 30966 var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[0] || ""; 30967 var parentLevel = hierarchicalRefinement.split(separator).length - 1; 30968 return hierarchicalFacet.attributes.slice(0, parentLevel + 1); 30969 }, 30970 getSearchForFacetQuery: function(facetName, query, maxFacetHits, state) { 30971 var stateForSearchForFacetValues = state.isDisjunctiveFacet(facetName) ? state.clearRefinements(facetName) : state; 30972 var searchForFacetSearchParameters = { 30973 facetQuery: query, 30974 facetName 30975 }; 30976 if (typeof maxFacetHits === "number") { 30977 searchForFacetSearchParameters.maxFacetHits = maxFacetHits; 30978 } 30979 return sortObject( 30980 merge$4( 30981 {}, 30982 requestBuilder$1._getHitsSearchParams(stateForSearchForFacetValues), 30983 searchForFacetSearchParameters 30984 ) 30985 ); 30986 } 30987}; 30988var requestBuilder_1 = requestBuilder$1; 30989var defaultsPure$3 = function defaultsPure() { 30990 var sources = Array.prototype.slice.call(arguments); 30991 return sources.reduceRight(function(acc, source) { 30992 Object.keys(Object(source)).forEach(function(key2) { 30993 if (source[key2] === void 0) { 30994 return; 30995 } 30996 if (acc[key2] !== void 0) { 30997 delete acc[key2]; 30998 } 30999 acc[key2] = source[key2]; 31000 }); 31001 return acc; 31002 }, {}); 31003}; 31004var find$5 = function find(array, comparator) { 31005 if (!Array.isArray(array)) { 31006 return void 0; 31007 } 31008 for (var i2 = 0; i2 < array.length; i2++) { 31009 if (comparator(array[i2])) { 31010 return array[i2]; 31011 } 31012 } 31013 return void 0; 31014}; 31015function intersection$1(arr1, arr2) { 31016 return arr1.filter(function(value, index3) { 31017 return arr2.indexOf(value) > -1 && arr1.indexOf(value) === index3; 31018 }); 31019} 31020var intersection_1 = intersection$1; 31021function valToNumber$1(v2) { 31022 if (typeof v2 === "number") { 31023 return v2; 31024 } else if (typeof v2 === "string") { 31025 return parseFloat(v2); 31026 } else if (Array.isArray(v2)) { 31027 return v2.map(valToNumber$1); 31028 } 31029 throw new Error( 31030 "The value should be a number, a parsable string or an array of those." 31031 ); 31032} 31033var valToNumber_1 = valToNumber$1; 31034var isValidUserToken$1 = function isValidUserToken(userToken) { 31035 if (userToken === null) { 31036 return false;
31037 } 31038 return /^[a-zA-Z0-9_-]{1,64}$/.test(userToken); 31039}; 31040var defaultsPure$2 = defaultsPure$3; 31041var objectHasKeys$2 = objectHasKeys_1; 31042var omit$2 = omit$3; 31043var lib$1 = { 31044 /** 31045 * Adds a refinement to a RefinementList 31046 * @param {RefinementList} refinementList the initial list 31047 * @param {string} attribute the attribute to refine 31048 * @param {string} value the value of the refinement, if the value is not a string it will be converted 31049 * @return {RefinementList} a new and updated refinement list 31050 */ 31051 addRefinement: function addRefinement(refinementList3, attribute, value) { 31052 if (lib$1.isRefined(refinementList3, attribute, value)) { 31053 return refinementList3; 31054 } 31055 var valueAsString = "" + value; 31056 var facetRefinement = !refinementList3[attribute] ? [valueAsString] : refinementList3[attribute].concat(valueAsString); 31057 var mod = {}; 31058 mod[attribute] = facetRefinement; 31059 return defaultsPure$2({}, mod, refinementList3); 31060 }, 31061 /** 31062 * Removes refinement(s) for an attribute: 31063 * - if the value is specified removes the refinement for the value on the attribute 31064 * - if no value is specified removes all the refinements for this attribute 31065 * @param {RefinementList} refinementList the initial list 31066 * @param {string} attribute the attribute to refine 31067 * @param {string} [value] the value of the refinement 31068 * @return {RefinementList} a new and updated refinement lst 31069 */ 31070 removeRefinement: function removeRefinement(refinementList3, attribute, value) { 31071 if (value === void 0) { 31072 return lib$1.clearRefinement(refinementList3, function(v2, f2) { 31073 return attribute === f2; 31074 }); 31075 } 31076 var valueAsString = "" + value; 31077 return lib$1.clearRefinement(refinementList3, function(v2, f2) { 31078 return attribute === f2 && valueAsString === v2; 31079 }); 31080 }, 31081 /** 31082 * Toggles the refinement value for an attribute. 31083 * @param {RefinementList} refinementList the initial list 31084 * @param {string} attribute the attribute to refine 31085 * @param {string} value the value of the refinement 31086 * @return {RefinementList} a new and updated list 31087 */ 31088 toggleRefinement: function toggleRefinement(refinementList3, attribute, value) { 31089 if (value === void 0) 31090 throw new Error("toggleRefinement should be used with a value"); 31091 if (lib$1.isRefined(refinementList3, attribute, value)) { 31092 return lib$1.removeRefinement(refinementList3, attribute, value); 31093 } 31094 return lib$1.addRefinement(refinementList3, attribute, value); 31095 }, 31096 /** 31097 * Clear all or parts of a RefinementList. Depending on the arguments, three 31098 * kinds of behavior can happen: 31099 * - if no attribute is provided: clears the whole list 31100 * - if an attribute is provided as a string: clears the list for the specific attribute 31101 * - if an attribute is provided as a function: discards the elements for which the function returns true 31102 * @param {RefinementList} refinementList the initial list 31103 * @param {string} [attribute] the attribute or function to discard 31104 * @param {string} [refinementType] optional parameter to give more context to the attribute function 31105 * @return {RefinementList} a new and updated refinement list 31106 */ 31107 clearRefinement: function clearRefinement(refinementList3, attribute, refinementType) { 31108 if (attribute === void 0) { 31109 if (!objectHasKeys$2(refinementList3)) { 31110 return refinementList3; 31111 } 31112 return {}; 31113 } else if (typeof attribute === "string") { 31114 return omit$2(refinementList3, [attribute]); 31115 } else if (typeof attribute === "function") { 31116 var hasChanged = false; 31117 var newRefinementList = Object.keys(refinementList3).reduce( 31118 function(memo, key2) { 31119 var values = refinementList3[key2] || []; 31120 var facetList = values.filter(function(value) { 31121 return !attribute(value, key2, refinementType); 31122 }); 31123 if (facetList.length !== values.length) { 31124 hasChanged = true; 31125 } 31126 memo[key2] = facetList; 31127 return memo; 31128 }, 31129 {} 31130 ); 31131 if (hasChanged) return newRefinementList; 31132 return refinementList3; 31133 } 31134 return void 0; 31135 }, 31136 /** 31137 * Test if the refinement value is used for the attribute. If no refinement value 31138 * is provided, test if the refinementList contains any refinement for the 31139 * given attribute. 31140 * @param {RefinementList} refinementList the list of refinement 31141 * @param {string} attribute name of the attribute 31142 * @param {string} [refinementValue] value of the filter/refinement 31143 * @return {boolean} true if the attribute is refined, false otherwise 31144 */ 31145 isRefined: function isRefined(refinementList3, attribute, refinementValue) { 31146 var containsRefinements = Boolean(refinementList3[attribute]) && refinementList3[attribute].length > 0; 31147 if (refinementValue === void 0 || !containsRefinements) { 31148 return containsRefinements; 31149 } 31150 var refinementValueAsString = "" + refinementValue; 31151 return refinementList3[attribute].indexOf(refinementValueAsString) !== -1; 31152 } 31153}; 31154var RefinementList$2 = lib$1; 31155var defaultsPure$1 = defaultsPure$3; 31156var find$4 = find$5; 31157var intersection = intersection_1; 31158var merge$3 = merge_1; 31159var objectHasKeys$1 = objectHasKeys_1; 31160var omit$1 = omit$3; 31161var valToNumber = valToNumber_1; 31162var isValidUserToken2 = isValidUserToken$1; 31163var RefinementList$1 = RefinementList$2; 31164function isEqualNumericRefinement(a2, b2) { 31165 if (Array.isArray(a2) && Array.isArray(b2)) { 31166 return a2.length === b2.length && a2.every(function(el, i2) { 31167 return isEqualNumericRefinement(b2[i2], el); 31168 }); 31169 } 31170 return a2 === b2; 31171} 31172function findArray(array, searchedValue) { 31173 return find$4(array, function(currentValue) { 31174 return isEqualNumericRefinement(currentValue, searchedValue); 31175 }); 31176} 31177function SearchParameters$2(newParameters) { 31178 var params = newParameters ? SearchParameters$2._parseNumbers(newParameters) : {}; 31179 if (params.userToken !== void 0 && !isValidUserToken2(params.userToken)) { 31180 console.warn( 31181 "[algoliasearch-helper] The `userToken` parameter is invali
vendor: 8,032 bytes, lines 31181-31397
31181d. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}" 31182 ); 31183 } 31184 this.facets = params.facets || []; 31185 this.disjunctiveFacets = params.disjunctiveFacets || []; 31186 this.hierarchicalFacets = params.hierarchicalFacets || []; 31187 this.facetsRefinements = params.facetsRefinements || {}; 31188 this.facetsExcludes = params.facetsExcludes || {}; 31189 this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {}; 31190 this.numericRefinements = params.numericRefinements || {}; 31191 this.tagRefinements = params.tagRefinements || []; 31192 this.hierarchicalFacetsRefinements = params.hierarchicalFacetsRefinements || {}; 31193 var self2 = this; 31194 Object.keys(params).forEach(function(paramName) { 31195 var isKeyKnown = SearchParameters$2.PARAMETERS.indexOf(paramName) !== -1; 31196 var isValueDefined = params[paramName] !== void 0; 31197 if (!isKeyKnown && isValueDefined) { 31198 self2[paramName] = params[paramName]; 31199 } 31200 }); 31201} 31202SearchParameters$2.PARAMETERS = Object.keys(new SearchParameters$2()); 31203SearchParameters$2._parseNumbers = function(partialState) { 31204 if (partialState instanceof SearchParameters$2) return partialState; 31205 var numbers = {}; 31206 var numberKeys = [ 31207 "aroundPrecision", 31208 "aroundRadius", 31209 "getRankingInfo", 31210 "minWordSizefor2Typos", 31211 "minWordSizefor1Typo", 31212 "page", 31213 "maxValuesPerFacet", 31214 "distinct", 31215 "minimumAroundRadius", 31216 "hitsPerPage", 31217 "minProximity" 31218 ]; 31219 numberKeys.forEach(function(k2) { 31220 var value = partialState[k2]; 31221 if (typeof value === "string") { 31222 var parsedValue = parseFloat(value); 31223 numbers[k2] = isNaN(parsedValue) ? value : parsedValue; 31224 } 31225 }); 31226 if (Array.isArray(partialState.insideBoundingBox)) { 31227 numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) { 31228 if (Array.isArray(geoRect)) { 31229 return geoRect.map(function(value) { 31230 return parseFloat(value); 31231 }); 31232 } 31233 return geoRect; 31234 }); 31235 } 31236 if (partialState.numericRefinements) { 31237 var numericRefinements = {}; 31238 Object.keys(partialState.numericRefinements).forEach(function(attribute) { 31239 var operators = partialState.numericRefinements[attribute] || {}; 31240 numericRefinements[attribute] = {}; 31241 Object.keys(operators).forEach(function(operator) { 31242 var values = operators[operator]; 31243 var parsedValues = values.map(function(v2) { 31244 if (Array.isArray(v2)) { 31245 return v2.map(function(vPrime) { 31246 if (typeof vPrime === "string") { 31247 return parseFloat(vPrime); 31248 } 31249 return vPrime; 31250 }); 31251 } else if (typeof v2 === "string") { 31252 return parseFloat(v2); 31253 } 31254 return v2; 31255 }); 31256 numericRefinements[attribute][operator] = parsedValues; 31257 }); 31258 }); 31259 numbers.numericRefinements = numericRefinements; 31260 } 31261 return merge$3(partialState, numbers); 31262}; 31263SearchParameters$2.make = function makeSearchParameters(newParameters) { 31264 var instance = new SearchParameters$2(newParameters); 31265 var hierarchicalFacets = newParameters.hierarchicalFacets || []; 31266 hierarchicalFacets.forEach(function(facet) { 31267 if (facet.rootPath) { 31268 var currentRefinement = instance.getHierarchicalRefinement(facet.name); 31269 if (currentRefinement.length > 0 && currentRefinement[0].indexOf(facet.rootPath) !== 0) { 31270 instance = instance.clearRefinements(facet.name); 31271 } 31272 currentRefinement = instance.getHierarchicalRefinement(facet.name); 31273 if (currentRefinement.length === 0) { 31274 instance = instance.toggleHierarchicalFacetRefinement( 31275 facet.name, 31276 facet.rootPath 31277 ); 31278 } 31279 } 31280 }); 31281 return instance; 31282}; 31283SearchParameters$2.validate = function(currentState, parameters) { 31284 var params = parameters || {}; 31285 if (currentState.tagFilters && params.tagRefinements && params.tagRefinements.length > 0) { 31286 return new Error( 31287 "[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method." 31288 ); 31289 } 31290 if (currentState.tagRefinements.length > 0 && params.tagFilters) { 31291 return new Error( 31292 "[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method." 31293 ); 31294 } 31295 if (currentState.numericFilters && params.numericRefinements && objectHasKeys$1(params.numericRefinements)) { 31296 return new Error( 31297 "[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters." 31298 ); 31299 } 31300 if (objectHasKeys$1(currentState.numericRefinements) && params.numericFilters) { 31301 return new Error( 31302 "[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters." 31303 ); 31304 } 31305 return null; 31306}; 31307SearchParameters$2.prototype = { 31308 constructor: SearchParameters$2, 31309 /** 31310 * Remove all refinements (disjunctive + conjunctive + excludes + numeric filters) 31311 * @method 31312 * @param {undefined|string|SearchParameters.clearCallback} [attribute] optional string or function 31313 * - If not given, means to clear all the filters. 31314 * - If `string`, means to clear all refinements for the `attribute` named filter. 31315 * - If `function`, means to clear all the refinements that return truthy values. 31316 * @return {SearchParameters} new instance with filters cleared 31317 */ 31318 clearRefinements: function clearRefinements(attribute) { 31319 var patch = { 31320 numericRefinements: this._clearNumericRefinements(attribute), 31321 facetsRefinements: RefinementList$1.clearRefinement( 31322 this.facetsRefinements, 31323 attribute, 31324 "conjunctiveFacet" 31325 ), 31326 facetsExcludes: RefinementList$1.clearRefinement( 31327 this.facetsExcludes, 31328 attribute, 31329 "exclude" 31330 ), 31331 disjunctiveFacetsRefinements: RefinementList$1.clearRefinement( 31332 this.disjunctiveFacetsRefinements, 31333 attribute, 31334 "disjunctiveFacet" 31335 ), 31336 hierarchicalFacetsRefinements: RefinementList$1.clearRefinement( 31337 this.hierarchicalFacetsRefinements, 31338 attribute, 31339 "hierarchicalFacet" 31340 ) 31341 }; 31342 if (patch.numericRefinements === this.numericRefinements && patch.facetsRefinements === this.facetsRefinements && patch.facetsExcludes === this.facetsExcludes && patch.disjunctiveFacetsRefinements === this.disjunctiveFacetsRefinements && patch.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements) { 31343 return this; 31344 } 31345 return this.setQueryParameters(patch); 31346 }, 31347 /** 31348 * Remove all the refined tags from the SearchParameters 31349 * @method 31350 * @return {SearchParameters} new instance with tags cleared 31351 */ 31352 clearTags: function clearTags() { 31353 if (this.tagFilters === void 0 && this.tagRefinements.length === 0) 31354 return this; 31355 return this.setQueryParameters({ 31356 tagFilters: void 0, 31357 tagRefinements: [] 31358 }); 31359 }, 31360 /** 31361 * Set the index. 31362 * @method 31363 * @param {string} index the index name 31364 * @return {SearchParameters} new instance 31365 */ 31366 setIndex: function setIndex(index3) { 31367 if (index3 === this.index) return this; 31368 return this.setQueryParameters({ 31369 index: index3 31370 }); 31371 }, 31372 /** 31373 * Query setter 31374 * @method 31375 * @param {string} newQuery value for the new query 31376 * @return {SearchParameters} new instance 31377 */ 31378 setQuery: function setQuery(newQuery) { 31379 if (newQuery === this.query) return this; 31380 return this.setQueryParameters({ 31381 query: newQuery 31382 }); 31383 }, 31384 /** 31385 * Page setter 31386 * @method 31387 * @param {number} newPage new page number 31388 * @return {SearchParameters} new instance 31389 */ 31390 setPage: function setPage(newPage) { 31391 if (newPage === this.page) return this; 31392 return this.setQueryParameters({ 31393 page: newPage 31394 }); 31395 }, 31396 /** 31397 * Facets setter
31398 * The facets are the simple facets, used for conjunctive (and) faceting. 31399 * @method 31400 * @param {string[]} facets all the attributes of the algolia records used for conjunctive faceting 31401 * @return {SearchParameters} new instance 31402 */ 31403 setFacets: function setFacets(facets) { 31404 return this.setQueryParameters({ 31405 facets 31406 }); 31407 }, 31408 /** 31409 * Disjunctive facets setter 31410 * Change the list of disjunctive (or) facets the helper chan handle. 31411 * @method 31412 * @param {string[]} facets all the attributes of the algolia records used for disjunctive faceting 31413 * @return {SearchParameters} new instance 31414 */ 31415 setDisjunctiveFacets: function setDisjunctiveFacets(facets) { 31416 return this.setQueryParameters({ 31417 disjunctiveFacets: facets 31418 }); 31419 }, 31420 /** 31421 * HitsPerPage setter 31422 * Hits per page represents the number of hits retrieved for this query 31423 * @method 31424 * @param {number} n number of hits retrieved per page of results 31425 * @return {SearchParameters} new instance 31426 */ 31427 setHitsPerPage: function setHitsPerPage(n2) { 31428 if (this.hitsPerPage === n2) return this; 31429 return this.setQueryParameters({ 31430 hitsPerPage: n2 31431 }); 31432 }, 31433 /** 31434 * typoTolerance setter 31435 * Set the value of typoTolerance 31436 * @method 31437 * @param {string} typoTolerance new value of typoTolerance ("true", "false", "min" or "strict") 31438 * @return {SearchParameters} new instance 31439 */ 31440 setTypoTolerance: function setTypoTolerance(typoTolerance) { 31441 if (this.typoTolerance === typoTolerance) return this; 31442 return this.setQueryParameters({ 31443 typoTolerance 31444 }); 31445 }, 31446 /** 31447 * Add a numeric filter for a given attribute 31448 * When value is an array, they are combined with OR 31449 * When value is a single value, it will combined with AND 31450 * @method 31451 * @param {string} attribute attribute to set the filter on 31452 * @param {string} operator operator of the filter (possible values: =, >, >=, <, <=, !=) 31453 * @param {number | number[]} value value of the filter 31454 * @return {SearchParameters} new instance 31455 * @example 31456 * // for price = 50 or 40 31457 * state.addNumericRefinement('price', '=', [50, 40]); 31458 * @example 31459 * // for size = 38 and 40 31460 * state.addNumericRefinement('size', '=', 38); 31461 * state.addNumericRefinement('size', '=', 40); 31462 */ 31463 addNumericRefinement: function(attribute, operator, value) { 31464 var val = valToNumber(value); 31465 if (this.isNumericRefined(attribute, operator, val)) return this; 31466 var mod = merge$3({}, this.numericRefinements); 31467 mod[attribute] = merge$3({}, mod[attribute]); 31468 if (mod[attribute][operator]) { 31469 mod[attribute][operator] = mod[attribute][operator].slice(); 31470 mod[attribute][operator].push(val); 31471 } else { 31472 mod[attribute][operator] = [val]; 31473 } 31474 return this.setQueryParameters({ 31475 numericRefinements: mod 31476 }); 31477 }, 31478 /** 31479 * Get the list of conjunctive refinements for a single facet 31480 * @param {string} facetName name of the attribute used for faceting 31481 * @return {string[]} list of refinements 31482 */ 31483 getConjunctiveRefinements: function(facetName) { 31484 if (!this.isConjunctiveFacet(facetName)) { 31485 return []; 31486 } 31487 return this.facetsRefinements[facetName] || []; 31488 }, 31489 /** 31490 * Get the list of disjunctive refinements for a single facet 31491 * @param {string} facetName name of the attribute used for faceting 31492 * @return {string[]} list of refinements 31493 */ 31494 getDisjunctiveRefinements: function(facetName) { 31495 if (!this.isDisjunctiveFacet(facetName)) { 31496 return []; 31497 } 31498 return this.disjunctiveFacetsRefinements[facetName] || []; 31499 }, 31500 /** 31501 * Get the list of hierarchical refinements for a single facet 31502 * @param {string} facetName name of the attribute used for faceting 31503 * @return {string[]} list of refinements 31504 */ 31505 getHierarchicalRefinement: function(facetName) { 31506 return this.hierarchicalFacetsRefinements[facetName] || []; 31507 }, 31508 /** 31509 * Get the list of exclude refinements for a single facet 31510 * @param {string} facetName name of the attribute used for faceting 31511 * @return {string[]} list of refinements 31512 */ 31513 getExcludeRefinements: function(facetName) { 31514 if (!this.isConjunctiveFacet(facetName)) { 31515 return []; 31516 } 31517 return this.facetsExcludes[facetName] || []; 31518 }, 31519 /** 31520 * Remove all the numeric filter for a given (attribute, operator) 31521 * @method 31522 * @param {string} attribute attribute to set the filter on 31523 * @param {string} [operator] operator of the filter (possible values: =, >, >=, <, <=, !=) 31524 * @param {number} [number] the value to be removed 31525 * @return {SearchParameters} new instance 31526 */ 31527 removeNumericRefinement: function(attribute, operator, number) { 31528 var paramValue = number; 31529 if (paramValue !== void 0) { 31530 if (!this.isNumericRefined(attribute, operator, paramValue)) { 31531 return this; 31532 } 31533 return this.setQueryParameters({ 31534 numericRefinements: this._clearNumericRefinements(function(value, key2) { 31535 return key2 === attribute && value.op === operator && isEqualNumericRefinement(value.val, valToNumber(paramValue)); 31536 }) 31537 }); 31538 } else if (operator !== void 0) { 31539 if (!this.isNumericRefined(attribute, operator)) return this; 31540 return this.setQueryParameters({ 31541 numericRefinements: this._clearNumericRefinements(function(value, key2) { 31542 return key2 === attribute && value.op === operator; 31543 }) 31544 }); 31545 } 31546 if (!this.isNumericRefined(attribute)) return this; 31547 return this.setQueryParameters({ 31548 numericRefinements: this._clearNumericRefinements(function(value, key2) { 31549 return key2 === attribute; 31550 }) 31551 }); 31552 }, 31553 /** 31554 * Get the list of numeric refinements for a single facet 31555 * @param {string} facetName name of the attribute used for faceting 31556 * @return {SearchParameters.OperatorList} list of refinements 31557 */ 31558 getNumericRefinements: function(facetName) { 31559 return this.numericRefinements[facetName] || {}; 31560 }, 31561 /** 31562 * Return the current refinement for the (attribute, operator) 31563 * @param {string} attribute attribute in the record 31564 * @param {string} operator operator applied on the refined values 31565 * @return {Array.<number|number[]>} refined values 31566 */ 31567 getNumericRefinement: function(attribute, operator) { 31568 return this.numericRefinements[attribute] && this.numericRefinements[attribute][operator]; 31569 }, 31570 /** 31571 * Clear numeric filters. 31572 * @method 31573 * @private 31574 * @param {string|SearchParameters.clearCallback} [attribute] optional string or function 31575 * - If not given, means to clear all the filters. 31576 * - If `string`, means to clear all refinements for the `attribute` named filter. 31577 * - If `function`, means to clear all the refinements that return truthy values. 31578 * @return {Object.<string, OperatorList>} new numeric refinements 31579 */ 31580 _clearNumericRefinements: function _clearNumericRefinements(attribute) { 31581 if (attribute === void 0) { 31582 if (!objectHasKeys$1(this.numericRefinements)) { 31583 return this.numericRefinements; 31584 } 31585 return {}; 31586 } else if (typeof attribute === "string") { 31587 return omit$1(this.numericRefinements, [attribute]); 31588 } else if (typeof attribute === "function") { 31589 var hasChanged = false;
vendor: 24,257 bytes, lines 31590-32276
31590 var numericRefinements = this.numericRefinements; 31591 var newNumericRefinements = Object.keys(numericRefinements).reduce( 31592 function(memo, key2) { 31593 var operators = numericRefinements[key2]; 31594 var operatorList = {}; 31595 operators = operators || {}; 31596 Object.keys(operators).forEach(function(operator) { 31597 var values = operators[operator] || []; 31598 var outValues = []; 31599 values.forEach(function(value) { 31600 var predicateResult = attribute( 31601 { val: value, op: operator }, 31602 key2, 31603 "numeric" 31604 ); 31605 if (!predicateResult) outValues.push(value); 31606 }); 31607 if (outValues.length !== values.length) { 31608 hasChanged = true; 31609 } 31610 operatorList[operator] = outValues; 31611 }); 31612 memo[key2] = operatorList; 31613 return memo; 31614 }, 31615 {} 31616 ); 31617 if (hasChanged) return newNumericRefinements; 31618 return this.numericRefinements; 31619 } 31620 return void 0; 31621 }, 31622 /** 31623 * Add a facet to the facets attribute of the helper configuration, if it 31624 * isn't already present. 31625 * @method 31626 * @param {string} facet facet name to add 31627 * @return {SearchParameters} new instance 31628 */ 31629 addFacet: function addFacet(facet) { 31630 if (this.isConjunctiveFacet(facet)) { 31631 return this; 31632 } 31633 return this.setQueryParameters({ 31634 facets: this.facets.concat([facet]) 31635 }); 31636 }, 31637 /** 31638 * Add a disjunctive facet to the disjunctiveFacets attribute of the helper 31639 * configuration, if it isn't already present. 31640 * @method 31641 * @param {string} facet disjunctive facet name to add 31642 * @return {SearchParameters} new instance 31643 */ 31644 addDisjunctiveFacet: function addDisjunctiveFacet(facet) { 31645 if (this.isDisjunctiveFacet(facet)) { 31646 return this; 31647 } 31648 return this.setQueryParameters({ 31649 disjunctiveFacets: this.disjunctiveFacets.concat([facet]) 31650 }); 31651 }, 31652 /** 31653 * Add a hierarchical facet to the hierarchicalFacets attribute of the helper 31654 * configuration. 31655 * @method 31656 * @param {object} hierarchicalFacet hierarchical facet to add 31657 * @return {SearchParameters} new instance 31658 * @throws will throw an error if a hierarchical facet with the same name was already declared 31659 */ 31660 addHierarchicalFacet: function addHierarchicalFacet(hierarchicalFacet) { 31661 if (this.isHierarchicalFacet(hierarchicalFacet.name)) { 31662 throw new Error( 31663 "Cannot declare two hierarchical facets with the same name: `" + hierarchicalFacet.name + "`" 31664 ); 31665 } 31666 return this.setQueryParameters({ 31667 hierarchicalFacets: this.hierarchicalFacets.concat([hierarchicalFacet]) 31668 }); 31669 }, 31670 /** 31671 * Add a refinement on a "normal" facet 31672 * @method 31673 * @param {string} facet attribute to apply the faceting on 31674 * @param {string} value value of the attribute (will be converted to string) 31675 * @return {SearchParameters} new instance 31676 */ 31677 addFacetRefinement: function addFacetRefinement(facet, value) { 31678 if (!this.isConjunctiveFacet(facet)) { 31679 throw new Error( 31680 facet + " is not defined in the facets attribute of the helper configuration" 31681 ); 31682 } 31683 if (RefinementList$1.isRefined(this.facetsRefinements, facet, value)) 31684 return this; 31685 return this.setQueryParameters({ 31686 facetsRefinements: RefinementList$1.addRefinement( 31687 this.facetsRefinements, 31688 facet, 31689 value 31690 ) 31691 }); 31692 }, 31693 /** 31694 * Exclude a value from a "normal" facet 31695 * @method 31696 * @param {string} facet attribute to apply the exclusion on 31697 * @param {string} value value of the attribute (will be converted to string) 31698 * @return {SearchParameters} new instance 31699 */ 31700 addExcludeRefinement: function addExcludeRefinement(facet, value) { 31701 if (!this.isConjunctiveFacet(facet)) { 31702 throw new Error( 31703 facet + " is not defined in the facets attribute of the helper configuration" 31704 ); 31705 } 31706 if (RefinementList$1.isRefined(this.facetsExcludes, facet, value)) 31707 return this; 31708 return this.setQueryParameters({ 31709 facetsExcludes: RefinementList$1.addRefinement( 31710 this.facetsExcludes, 31711 facet, 31712 value 31713 ) 31714 }); 31715 }, 31716 /** 31717 * Adds a refinement on a disjunctive facet. 31718 * @method 31719 * @param {string} facet attribute to apply the faceting on 31720 * @param {string} value value of the attribute (will be converted to string) 31721 * @return {SearchParameters} new instance 31722 */ 31723 addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(facet, value) { 31724 if (!this.isDisjunctiveFacet(facet)) { 31725 throw new Error( 31726 facet + " is not defined in the disjunctiveFacets attribute of the helper configuration" 31727 ); 31728 } 31729 if (RefinementList$1.isRefined(this.disjunctiveFacetsRefinements, facet, value)) 31730 return this; 31731 return this.setQueryParameters({ 31732 disjunctiveFacetsRefinements: RefinementList$1.addRefinement( 31733 this.disjunctiveFacetsRefinements, 31734 facet, 31735 value 31736 ) 31737 }); 31738 }, 31739 /** 31740 * addTagRefinement adds a tag to the list used to filter the results 31741 * @param {string} tag tag to be added 31742 * @return {SearchParameters} new instance 31743 */ 31744 addTagRefinement: function addTagRefinement(tag) { 31745 if (this.isTagRefined(tag)) return this; 31746 var modification = { 31747 tagRefinements: this.tagRefinements.concat(tag) 31748 }; 31749 return this.setQueryParameters(modification); 31750 }, 31751 /** 31752 * Remove a facet from the facets attribute of the helper configuration, if it 31753 * is present. 31754 * @method 31755 * @param {string} facet facet name to remove 31756 * @return {SearchParameters} new instance 31757 */ 31758 removeFacet: function removeFacet(facet) { 31759 if (!this.isConjunctiveFacet(facet)) { 31760 return this; 31761 } 31762 return this.clearRefinements(facet).setQueryParameters({ 31763 facets: this.facets.filter(function(f2) { 31764 return f2 !== facet; 31765 }) 31766 }); 31767 }, 31768 /** 31769 * Remove a disjunctive facet from the disjunctiveFacets attribute of the 31770 * helper configuration, if it is present. 31771 * @method 31772 * @param {string} facet disjunctive facet name to remove 31773 * @return {SearchParameters} new instance 31774 */ 31775 removeDisjunctiveFacet: function removeDisjunctiveFacet(facet) { 31776 if (!this.isDisjunctiveFacet(facet)) { 31777 return this; 31778 } 31779 return this.clearRefinements(facet).setQueryParameters({ 31780 disjunctiveFacets: this.disjunctiveFacets.filter(function(f2) { 31781 return f2 !== facet; 31782 }) 31783 }); 31784 }, 31785 /** 31786 * Remove a hierarchical facet from the hierarchicalFacets attribute of the 31787 * helper configuration, if it is present. 31788 * @method 31789 * @param {string} facet hierarchical facet name to remove 31790 * @return {SearchParameters} new instance 31791 */ 31792 removeHierarchicalFacet: function removeHierarchicalFacet(facet) { 31793 if (!this.isHierarchicalFacet(facet)) { 31794 return this; 31795 } 31796 return this.clearRefinements(facet).setQueryParameters({ 31797 hierarchicalFacets: this.hierarchicalFacets.filter(function(f2) { 31798 return f2.name !== facet; 31799 }) 31800 }); 31801 }, 31802 /** 31803 * Remove a refinement set on facet. If a value is provided, it will clear the 31804 * refinement for the given value, otherwise it will clear all the refinement 31805 * values for the faceted attribute. 31806 * @method 31807 * @param {string} facet name of the attribute used for faceting 31808 * @param {string} [value] value used to filter 31809 * @return {SearchParameters} new instance 31810 */ 31811 removeFacetRefinement: function removeFacetRefinement(facet, value) { 31812 if (!this.isConjunctiveFacet(facet)) { 31813 throw new Error( 31814 facet + " is not defined in the facets attribute of the helper configuration" 31815 ); 31816 } 31817 if (!RefinementList$1.isRefined(this.facetsRefinements, facet, value)) 31818 return this; 31819 return this.setQueryParameters({ 31820 facetsRefinements: RefinementList$1.removeRefinement( 31821 this.facetsRefinements, 31822 facet, 31823 value 31824 ) 31825 }); 31826 }, 31827 /** 31828 * Remove a negative refinement on a facet 31829 * @method 31830 * @param {string} facet name of the attribute used for faceting 31831 * @param {string} value value used to filter 31832 * @return {SearchParameters} new instance 31833 */ 31834 removeExcludeRefinement: function removeExcludeRefinement(facet, value) { 31835 if (!this.isConjunctiveFacet(facet)) { 31836 throw new Error( 31837 facet + " is not defined in the facets attribute of the helper configuration" 31838 ); 31839 } 31840 if (!RefinementList$1.isRefined(this.facetsExcludes, facet, value)) 31841 return this; 31842 return this.setQueryParameters({ 31843 facetsExcludes: RefinementList$1.removeRefinement( 31844 this.facetsExcludes, 31845 facet, 31846 value 31847 ) 31848 }); 31849 }, 31850 /** 31851 * Remove a refinement on a disjunctive facet 31852 * @method 31853 * @param {string} facet name of the attribute used for faceting 31854 * @param {string} value value used to filter 31855 * @return {SearchParameters} new instance 31856 */ 31857 removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(facet, value) { 31858 if (!this.isDisjunctiveFacet(facet)) { 31859 throw new Error( 31860 facet + " is not defined in the disjunctiveFacets attribute of the helper configuration" 31861 ); 31862 } 31863 if (!RefinementList$1.isRefined(this.disjunctiveFacetsRefinements, facet, value)) 31864 return this; 31865 return this.setQueryParameters({ 31866 disjunctiveFacetsRefinements: RefinementList$1.removeRefinement( 31867 this.disjunctiveFacetsRefinements, 31868 facet, 31869 value 31870 ) 31871 }); 31872 }, 31873 /** 31874 * Remove a tag from the list of tag refinements 31875 * @method 31876 * @param {string} tag the tag to remove 31877 * @return {SearchParameters} new instance 31878 */ 31879 removeTagRefinement: function removeTagRefinement(tag) { 31880 if (!this.isTagRefined(tag)) return this; 31881 var modification = { 31882 tagRefinements: this.tagRefinements.filter(function(t2) { 31883 return t2 !== tag; 31884 }) 31885 }; 31886 return this.setQueryParameters(modification); 31887 }, 31888 /** 31889 * Generic toggle refinement method to use with facet, disjunctive facets 31890 * and hierarchical facets 31891 * @param {string} facet the facet to refine 31892 * @param {string} value the associated value 31893 * @return {SearchParameters} new instance 31894 * @throws will throw an error if the facet is not declared in the settings of the helper 31895 * @deprecated since version 2.19.0, see {@link SearchParameters#toggleFacetRefinement} 31896 */ 31897 toggleRefinement: function toggleRefinement2(facet, value) { 31898 return this.toggleFacetRefinement(facet, value); 31899 }, 31900 /** 31901 * Generic toggle refinement method to use with facet, disjunctive facets 31902 * and hierarchical facets 31903 * @param {string} facet the facet to refine 31904 * @param {string} value the associated value 31905 * @return {SearchParameters} new instance 31906 * @throws will throw an error if the facet is not declared in the settings of the helper 31907 */ 31908 toggleFacetRefinement: function toggleFacetRefinement(facet, value) { 31909 if (this.isHierarchicalFacet(facet)) { 31910 return this.toggleHierarchicalFacetRefinement(facet, value); 31911 } else if (this.isConjunctiveFacet(facet)) { 31912 return this.toggleConjunctiveFacetRefinement(facet, value); 31913 } else if (this.isDisjunctiveFacet(facet)) { 31914 return this.toggleDisjunctiveFacetRefinement(facet, value); 31915 } 31916 throw new Error( 31917 "Cannot refine the undeclared facet " + facet + "; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets" 31918 ); 31919 }, 31920 /** 31921 * Switch the refinement applied over a facet/value 31922 * @method 31923 * @param {string} facet name of the attribute used for faceting 31924 * @param {value} value value used for filtering 31925 * @return {SearchParameters} new instance 31926 */ 31927 toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(facet, value) { 31928 if (!this.isConjunctiveFacet(facet)) { 31929 throw new Error( 31930 facet + " is not defined in the facets attribute of the helper configuration" 31931 ); 31932 } 31933 return this.setQueryParameters({ 31934 facetsRefinements: RefinementList$1.toggleRefinement( 31935 this.facetsRefinements, 31936 facet, 31937 value 31938 ) 31939 }); 31940 }, 31941 /** 31942 * Switch the refinement applied over a facet/value 31943 * @method 31944 * @param {string} facet name of the attribute used for faceting 31945 * @param {value} value value used for filtering 31946 * @return {SearchParameters} new instance 31947 */ 31948 toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(facet, value) { 31949 if (!this.isConjunctiveFacet(facet)) { 31950 throw new Error( 31951 facet + " is not defined in the facets attribute of the helper configuration" 31952 ); 31953 } 31954 return this.setQueryParameters({ 31955 facetsExcludes: RefinementList$1.toggleRefinement( 31956 this.facetsExcludes, 31957 facet, 31958 value 31959 ) 31960 }); 31961 }, 31962 /** 31963 * Switch the refinement applied over a facet/value 31964 * @method 31965 * @param {string} facet name of the attribute used for faceting 31966 * @param {value} value value used for filtering 31967 * @return {SearchParameters} new instance 31968 */ 31969 toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(facet, value) { 31970 if (!this.isDisjunctiveFacet(facet)) { 31971 throw new Error( 31972 facet + " is not defined in the disjunctiveFacets attribute of the helper configuration" 31973 ); 31974 } 31975 return this.setQueryParameters({ 31976 disjunctiveFacetsRefinements: RefinementList$1.toggleRefinement( 31977 this.disjunctiveFacetsRefinements, 31978 facet, 31979 value 31980 ) 31981 }); 31982 }, 31983 /** 31984 * Switch the refinement applied over a facet/value 31985 * @method 31986 * @param {string} facet name of the attribute used for faceting 31987 * @param {value} value value used for filtering 31988 * @return {SearchParameters} new instance 31989 */ 31990 toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(facet, value) { 31991 if (!this.isHierarchicalFacet(facet)) { 31992 throw new Error( 31993 facet + " is not defined in the hierarchicalFacets attribute of the helper configuration" 31994 ); 31995 } 31996 var separator = this._getHierarchicalFacetSeparator( 31997 this.getHierarchicalFacetByName(facet) 31998 ); 31999 var mod = {}; 32000 var upOneOrMultipleLevel = this.hierarchicalFacetsRefinements[facet] !== void 0 && this.hierarchicalFacetsRefinements[facet].length > 0 && // remove current refinement: 32001 // refinement was 'beer > IPA', call is toggleRefine('beer > IPA'), refinement should be `beer` 32002 (this.hierarchicalFacetsRefinements[facet][0] === value || // remove a parent refinement of the current refinement: 32003 // - refinement was 'beer > IPA > Flying dog' 32004 // - call is toggleRefine('beer > IPA') 32005 // - refinement should be `beer` 32006 this.hierarchicalFacetsRefinements[facet][0].indexOf( 32007 value + separator 32008 ) === 0); 32009 if (upOneOrMultipleLevel) { 32010 if (value.indexOf(separator) === -1) { 32011 mod[facet] = []; 32012 } else { 32013 mod[facet] = [value.slice(0, value.lastIndexOf(separator))]; 32014 } 32015 } else { 32016 mod[facet] = [value]; 32017 } 32018 return this.setQueryParameters({ 32019 hierarchicalFacetsRefinements: defaultsPure$1( 32020 {}, 32021 mod, 32022 this.hierarchicalFacetsRefinements 32023 ) 32024 }); 32025 }, 32026 /** 32027 * Adds a refinement on a hierarchical facet. 32028 * @param {string} facet the facet name 32029 * @param {string} path the hierarchical facet path 32030 * @return {SearchParameter} the new state 32031 * @throws Error if the facet is not defined or if the facet is refined 32032 */ 32033 addHierarchicalFacetRefinement: function(facet, path) { 32034 if (this.isHierarchicalFacetRefined(facet)) { 32035 throw new Error(facet + " is already refined."); 32036 } 32037 if (!this.isHierarchicalFacet(facet)) { 32038 throw new Error( 32039 facet + " is not defined in the hierarchicalFacets attribute of the helper configuration." 32040 ); 32041 } 32042 var mod = {}; 32043 mod[facet] = [path]; 32044 return this.setQueryParameters({ 32045 hierarchicalFacetsRefinements: defaultsPure$1( 32046 {}, 32047 mod, 32048 this.hierarchicalFacetsRefinements 32049 ) 32050 }); 32051 }, 32052 /** 32053 * Removes the refinement set on a hierarchical facet. 32054 * @param {string} facet the facet name 32055 * @return {SearchParameter} the new state 32056 * @throws Error if the facet is not defined or if the facet is not refined 32057 */ 32058 removeHierarchicalFacetRefinement: function(facet) { 32059 if (!this.isHierarchicalFacetRefined(facet)) { 32060 return this; 32061 } 32062 var mod = {}; 32063 mod[facet] = []; 32064 return this.setQueryParameters({ 32065 hierarchicalFacetsRefinements: defaultsPure$1( 32066 {}, 32067 mod, 32068 this.hierarchicalFacetsRefinements 32069 ) 32070 }); 32071 }, 32072 /** 32073 * Switch the tag refinement 32074 * @method 32075 * @param {string} tag the tag to remove or add 32076 * @return {SearchParameters} new instance 32077 */ 32078 toggleTagRefinement: function toggleTagRefinement(tag) { 32079 if (this.isTagRefined(tag)) { 32080 return this.removeTagRefinement(tag); 32081 } 32082 return this.addTagRefinement(tag); 32083 }, 32084 /** 32085 * Test if the facet name is from one of the disjunctive facets 32086 * @method 32087 * @param {string} facet facet name to test 32088 * @return {boolean} true if facet is a disjunctive facet 32089 */ 32090 isDisjunctiveFacet: function(facet) { 32091 return this.disjunctiveFacets.indexOf(facet) > -1; 32092 }, 32093 /** 32094 * Test if the facet name is from one of the hierarchical facets 32095 * @method 32096 * @param {string} facetName facet name to test 32097 * @return {boolean} true if facetName is a hierarchical facet 32098 */ 32099 isHierarchicalFacet: function(facetName) { 32100 return this.getHierarchicalFacetByName(facetName) !== void 0; 32101 }, 32102 /** 32103 * Test if the facet name is from one of the conjunctive/normal facets 32104 * @method 32105 * @param {string} facet facet name to test 32106 * @return {boolean} true if facet is a conjunctive facet 32107 */ 32108 isConjunctiveFacet: function(facet) { 32109 return this.facets.indexOf(facet) > -1; 32110 }, 32111 /** 32112 * Returns true if the facet is refined, either for a specific value or in 32113 * general. 32114 * @method 32115 * @param {string} facet name of the attribute for used for faceting 32116 * @param {string} value, optional value. If passed will test that this value 32117 * is filtering the given facet. 32118 * @return {boolean} returns true if refined 32119 */ 32120 isFacetRefined: function isFacetRefined2(facet, value) { 32121 if (!this.isConjunctiveFacet(facet)) { 32122 return false; 32123 } 32124 return RefinementList$1.isRefined(this.facetsRefinements, facet, value); 32125 }, 32126 /** 32127 * Returns true if the facet contains exclusions or if a specific value is 32128 * excluded. 32129 * 32130 * @method 32131 * @param {string} facet name of the attribute for used for faceting 32132 * @param {string} [value] optional value. If passed will test that this value 32133 * is filtering the given facet. 32134 * @return {boolean} returns true if refined 32135 */ 32136 isExcludeRefined: function isExcludeRefined(facet, value) { 32137 if (!this.isConjunctiveFacet(facet)) { 32138 return false; 32139 } 32140 return RefinementList$1.isRefined(this.facetsExcludes, facet, value); 32141 }, 32142 /** 32143 * Returns true if the facet contains a refinement, or if a value passed is a 32144 * refinement for the facet. 32145 * @method 32146 * @param {string} facet name of the attribute for used for faceting 32147 * @param {string} value optional, will test if the value is used for refinement 32148 * if there is one, otherwise will test if the facet contains any refinement 32149 * @return {boolean} true if the facet is refined 32150 */ 32151 isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) { 32152 if (!this.isDisjunctiveFacet(facet)) { 32153 return false; 32154 } 32155 return RefinementList$1.isRefined( 32156 this.disjunctiveFacetsRefinements, 32157 facet, 32158 value 32159 ); 32160 }, 32161 /** 32162 * Returns true if the facet contains a refinement, or if a value passed is a 32163 * refinement for the facet. 32164 * @method 32165 * @param {string} facet name of the attribute for used for faceting 32166 * @param {string} value optional, will test if the value is used for refinement 32167 * if there is one, otherwise will test if the facet contains any refinement 32168 * @return {boolean} true if the facet is refined 32169 */ 32170 isHierarchicalFacetRefined: function isHierarchicalFacetRefined(facet, value) { 32171 if (!this.isHierarchicalFacet(facet)) { 32172 return false; 32173 } 32174 var refinements = this.getHierarchicalRefinement(facet); 32175 if (!value) { 32176 return refinements.length > 0; 32177 } 32178 return refinements.indexOf(value) !== -1; 32179 }, 32180 /** 32181 * Test if the triple (attribute, operator, value) is already refined. 32182 * If only the attribute and the operator are provided, it tests if the 32183 * contains any refinement value. 32184 * @method 32185 * @param {string} attribute attribute for which the refinement is applied 32186 * @param {string} [operator] operator of the refinement 32187 * @param {string} [value] value of the refinement 32188 * @return {boolean} true if it is refined 32189 */ 32190 isNumericRefined: function isNumericRefined(attribute, operator, value) { 32191 if (value === void 0 && operator === void 0) { 32192 return Boolean(this.numericRefinements[attribute]); 32193 } 32194 var isOperatorDefined = this.numericRefinements[attribute] && this.numericRefinements[attribute][operator] !== void 0; 32195 if (value === void 0 || !isOperatorDefined) { 32196 return isOperatorDefined; 32197 } 32198 var parsedValue = valToNumber(value); 32199 var isAttributeValueDefined = findArray(this.numericRefinements[attribute][operator], parsedValue) !== void 0; 32200 return isOperatorDefined && isAttributeValueDefined; 32201 }, 32202 /** 32203 * Returns true if the tag refined, false otherwise 32204 * @method 32205 * @param {string} tag the tag to check 32206 * @return {boolean} true if tag is refined 32207 */ 32208 isTagRefined: function isTagRefined(tag) { 32209 return this.tagRefinements.indexOf(tag) !== -1; 32210 }, 32211 /** 32212 * Returns the list of all disjunctive facets refined 32213 * @method 32214 * @param {string} facet name of the attribute used for faceting 32215 * @param {value} value value used for filtering 32216 * @return {string[]} returns the list of refinements 32217 */ 32218 getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() { 32219 var self2 = this; 32220 var disjunctiveNumericRefinedFacets = intersection( 32221 Object.keys(this.numericRefinements).filter(function(facet) { 32222 return Object.keys(self2.numericRefinements[facet]).length > 0; 32223 }), 32224 this.disjunctiveFacets 32225 ); 32226 return Object.keys(this.disjunctiveFacetsRefinements).filter(function(facet) { 32227 return self2.disjunctiveFacetsRefinements[facet].length > 0; 32228 }).concat(disjunctiveNumericRefinedFacets).concat(this.getRefinedHierarchicalFacets()).sort(); 32229 }, 32230 /** 32231 * Returns the list of all disjunctive facets refined 32232 * @method 32233 * @param {string} facet name of the attribute used for faceting 32234 * @param {value} value value used for filtering 32235 * @return {string[]} returns the list of refinements 32236 */ 32237 getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() { 32238 var self2 = this; 32239 return intersection( 32240 // enforce the order between the two arrays, 32241 // so that refinement name index === hierarchical facet index 32242 this.hierarchicalFacets.map(function(facet) { 32243 return facet.name; 32244 }), 32245 Object.keys(this.hierarchicalFacetsRefinements).filter(function(facet) { 32246 return self2.hierarchicalFacetsRefinements[facet].length > 0; 32247 }) 32248 ).sort(); 32249 }, 32250 /** 32251 * Returned the list of all disjunctive facets not refined 32252 * @method 32253 * @return {string[]} returns the list of facets that are not refined 32254 */ 32255 getUnrefinedDisjunctiveFacets: function() { 32256 var refinedFacets = this.getRefinedDisjunctiveFacets(); 32257 return this.disjunctiveFacets.filter(function(f2) { 32258 return refinedFacets.indexOf(f2) === -1; 32259 }); 32260 }, 32261 managedParameters: [ 32262 "index", 32263 "facets", 32264 "disjunctiveFacets", 32265 "facetsRefinements", 32266 "hierarchicalFacets", 32267 "facetsExcludes", 32268 "disjunctiveFacetsRefinements", 32269 "numericRefinements", 32270 "tagRefinements", 32271 "hierarchicalFacetsRefinements" 32272 ], 32273 getQueryParams: function getQueryParams() { 32274 var managedParameters = this.managedParameters; 32275 var queryParams = {}; 32276 var self2 = this;
32277 Object.keys(this).forEach(function(paramName) { 32278 var paramValue = self2[paramName]; 32279 if (managedParameters.indexOf(paramName) === -1 && paramValue !== void 0) { 32280 queryParams[paramName] = paramValue; 32281 } 32282 }); 32283 return queryParams; 32284 }, 32285 /** 32286 * Let the user set a specific value for a given parameter. Will return the 32287 * same instance if the parameter is invalid or if the value is the same as the 32288 * previous one. 32289 * @method 32290 * @param {string} parameter the parameter name 32291 * @param {any} value the value to be set, must be compliant with the definition 32292 * of the attribute on the object 32293 * @return {SearchParameters} the updated state 32294 */ 32295 setQueryParameter: function setParameter(parameter, value) { 32296 if (this[parameter] === value) return this; 32297 var modification = {}; 32298 modification[parameter] = value; 32299 return this.setQueryParameters(modification); 32300 }, 32301 /** 32302 * Let the user set any of the parameters with a plain object. 32303 * @method 32304 * @param {object} params all the keys and the values to be updated 32305 * @return {SearchParameters} a new updated instance 32306 */ 32307 setQueryParameters: function setQueryParameters(params) { 32308 if (!params) return this; 32309 var error2 = SearchParameters$2.validate(this, params); 32310 if (error2) { 32311 throw error2; 32312 } 32313 var self2 = this; 32314 var nextWithNumbers = SearchParameters$2._parseNumbers(params); 32315 var previousPlainObject = Object.keys(this).reduce(function(acc, key2) { 32316 acc[key2] = self2[key2]; 32317 return acc; 32318 }, {}); 32319 var nextPlainObject = Object.keys(nextWithNumbers).reduce( 32320 function(previous2, key2) { 32321 var isPreviousValueDefined = previous2[key2] !== void 0; 32322 var isNextValueDefined = nextWithNumbers[key2] !== void 0; 32323 if (isPreviousValueDefined && !isNextValueDefined) { 32324 return omit$1(previous2, [key2]); 32325 } 32326 if (isNextValueDefined) { 32327 previous2[key2] = nextWithNumbers[key2]; 32328 } 32329 return previous2; 32330 }, 32331 previousPlainObject 32332 ); 32333 return new this.constructor(nextPlainObject); 32334 }, 32335 /** 32336 * Returns a new instance with the page reset. Two scenarios possible: 32337 * the page is omitted -> return the given instance 32338 * the page is set -> return a new instance with a page of 0 32339 * @return {SearchParameters} a new updated instance 32340 */ 32341 resetPage: function() { 32342 if (this.page === void 0) { 32343 return this; 32344 } 32345 return this.setPage(0); 32346 }, 32347 /** 32348 * Helper function to get the hierarchicalFacet separator or the default one (`>`) 32349 * @param {object} hierarchicalFacet the hierarchicalFacet object 32350 * @return {string} returns the hierarchicalFacet.separator or `>` as default 32351 */ 32352 _getHierarchicalFacetSortBy: function(hierarchicalFacet) { 32353 return hierarchicalFacet.sortBy || ["isRefined:desc", "name:asc"]; 32354 }, 32355 /** 32356 * Helper function to get the hierarchicalFacet separator or the default one (`>`) 32357 * @private 32358 * @param {object} hierarchicalFacet the hierarchicalFacet object 32359 * @return {string} returns the hierarchicalFacet.separator or `>` as default 32360 */ 32361 _getHierarchicalFacetSeparator: function(hierarchicalFacet) { 32362 return hierarchicalFacet.separator || " > "; 32363 }, 32364 /** 32365 * Helper function to get the hierarchicalFacet prefix path or null 32366 * @private 32367 * @param {object} hierarchicalFacet the hierarchicalFacet object 32368 * @return {string} returns the hierarchicalFacet.rootPath or null as default 32369 */ 32370 _getHierarchicalRootPath: function(hierarchicalFacet) { 32371 return hierarchicalFacet.rootPath || null; 32372 }, 32373 /** 32374 * Helper function to check if we show the parent level of the hierarchicalFacet 32375 * @private 32376 * @param {object} hierarchicalFacet the hierarchicalFacet object 32377 * @return {string} returns the hierarchicalFacet.showParentLevel or true as default 32378 */ 32379 _getHierarchicalShowParentLevel: function(hierarchicalFacet) { 32380 if (typeof hierarchicalFacet.showParentLevel === "boolean") { 32381 return hierarchicalFacet.showParentLevel; 32382 } 32383 return true; 32384 }, 32385 /** 32386 * Helper function to get the hierarchicalFacet by it's name 32387 * @param {string} hierarchicalFacetName the hierarchicalFacet name 32388 * @return {object} a hierarchicalFacet 32389 */ 32390 getHierarchicalFacetByName: function(hierarchicalFacetName) { 32391 return find$4(this.hierarchicalFacets, function(f2) { 32392 return f2.name === hierarchicalFacetName; 32393 }); 32394 }, 32395 /** 32396 * Get the current breadcrumb for a hierarchical facet, as an array 32397 * @param {string} facetName Hierarchical facet name 32398 * @return {array.<string>}
vendor: 19,712 bytes, lines 32398-32943
32398 the path as an array of string 32399 */ 32400 getHierarchicalFacetBreadcrumb: function(facetName) { 32401 if (!this.isHierarchicalFacet(facetName)) { 32402 return []; 32403 } 32404 var refinement = this.getHierarchicalRefinement(facetName)[0]; 32405 if (!refinement) return []; 32406 var separator = this._getHierarchicalFacetSeparator( 32407 this.getHierarchicalFacetByName(facetName) 32408 ); 32409 var path = refinement.split(separator); 32410 return path.map(function(part) { 32411 return part.trim(); 32412 }); 32413 }, 32414 toString: function() { 32415 return JSON.stringify(this, null, 2); 32416 } 32417}; 32418var SearchParameters_1 = SearchParameters$2; 32419var compact$2 = function compact(array) { 32420 if (!Array.isArray(array)) { 32421 return []; 32422 } 32423 return array.filter(Boolean); 32424}; 32425var findIndex$1 = function find2(array, comparator) { 32426 if (!Array.isArray(array)) { 32427 return -1; 32428 } 32429 for (var i2 = 0; i2 < array.length; i2++) { 32430 if (comparator(array[i2])) { 32431 return i2; 32432 } 32433 } 32434 return -1; 32435}; 32436var find$3 = find$5; 32437var formatSort$1 = function formatSort(sortBy3, defaults3) { 32438 var defaultInstructions = (defaults3 || []).map(function(sort) { 32439 return sort.split(":"); 32440 }); 32441 return sortBy3.reduce( 32442 function preparePredicate(out, sort) { 32443 var sortInstruction = sort.split(":"); 32444 var matchingDefault = find$3( 32445 defaultInstructions, 32446 function(defaultInstruction) { 32447 return defaultInstruction[0] === sortInstruction[0]; 32448 } 32449 ); 32450 if (sortInstruction.length > 1 || !matchingDefault) { 32451 out[0].push(sortInstruction[0]); 32452 out[1].push(sortInstruction[1]); 32453 return out; 32454 } 32455 out[0].push(matchingDefault[0]); 32456 out[1].push(matchingDefault[1]); 32457 return out; 32458 }, 32459 [[], []] 32460 ); 32461}; 32462function compareAscending(value, other) { 32463 if (value !== other) { 32464 var valIsDefined = value !== void 0; 32465 var valIsNull = value === null; 32466 var othIsDefined = other !== void 0; 32467 var othIsNull = other === null; 32468 if (!othIsNull && value > other || valIsNull && othIsDefined || !valIsDefined) { 32469 return 1; 32470 } 32471 if (!valIsNull && value < other || othIsNull && valIsDefined || !othIsDefined) { 32472 return -1; 32473 } 32474 } 32475 return 0; 32476} 32477function orderBy$2(collection, iteratees, orders) { 32478 if (!Array.isArray(collection)) { 32479 return []; 32480 } 32481 if (!Array.isArray(orders)) { 32482 orders = []; 32483 } 32484 var result = collection.map(function(value, index3) { 32485 return { 32486 criteria: iteratees.map(function(iteratee) { 32487 return value[iteratee]; 32488 }), 32489 index: index3, 32490 value 32491 }; 32492 }); 32493 result.sort(function comparer(object, other) { 32494 var index3 = -1; 32495 while (++index3 < object.criteria.length) { 32496 var res = compareAscending(object.criteria[index3], other.criteria[index3]); 32497 if (res) { 32498 if (index3 >= orders.length) { 32499 return res; 32500 } 32501 if (orders[index3] === "desc") { 32502 return -res; 32503 } 32504 return res; 32505 } 32506 } 32507 return object.index - other.index; 32508 }); 32509 return result.map(function(res) { 32510 return res.value; 32511 }); 32512} 32513var orderBy_1 = orderBy$2; 32514var generateHierarchicalTree_1 = generateTrees; 32515var fv$1 = escapeFacetValue_1; 32516var find$2 = find$5; 32517var prepareHierarchicalFacetSortBy = formatSort$1; 32518var orderBy$1 = orderBy_1; 32519var escapeFacetValue$2 = fv$1.escapeFacetValue; 32520var unescapeFacetValue$1 = fv$1.unescapeFacetValue; 32521function generateTrees(state) { 32522 return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) { 32523 var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex]; 32524 var hierarchicalFacetRefinement = state.hierarchicalFacetsRefinements[hierarchicalFacet.name] && state.hierarchicalFacetsRefinements[hierarchicalFacet.name][0] || ""; 32525 var hierarchicalSeparator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 32526 var hierarchicalRootPath = state._getHierarchicalRootPath(hierarchicalFacet); 32527 var hierarchicalShowParentLevel = state._getHierarchicalShowParentLevel(hierarchicalFacet); 32528 var sortBy3 = prepareHierarchicalFacetSortBy( 32529 state._getHierarchicalFacetSortBy(hierarchicalFacet) 32530 ); 32531 var rootExhaustive = hierarchicalFacetResult.every(function(facetResult) { 32532 return facetResult.exhaustive; 32533 }); 32534 var generateTreeFn = generateHierarchicalTree$1( 32535 sortBy3, 32536 hierarchicalSeparator, 32537 hierarchicalRootPath, 32538 hierarchicalShowParentLevel, 32539 hierarchicalFacetRefinement 32540 ); 32541 var results = hierarchicalFacetResult; 32542 if (hierarchicalRootPath) { 32543 results = hierarchicalFacetResult.slice( 32544 hierarchicalRootPath.split(hierarchicalSeparator).length 32545 ); 32546 } 32547 return results.reduce(generateTreeFn, { 32548 name: state.hierarchicalFacets[hierarchicalFacetIndex].name, 32549 count: null, 32550 // root level, no count 32551 isRefined: true, 32552 // root level, always refined 32553 path: null, 32554 // root level, no path 32555 escapedValue: null, 32556 exhaustive: rootExhaustive, 32557 data: null 32558 }); 32559 }; 32560} 32561function generateHierarchicalTree$1(sortBy3, hierarchicalSeparator, hierarchicalRootPath, hierarchicalShowParentLevel, currentRefinement) { 32562 return function generateTree(hierarchicalTree, hierarchicalFacetResult, currentHierarchicalLevel) { 32563 var parent = hierarchicalTree; 32564 if (currentHierarchicalLevel > 0) { 32565 var level = 0; 32566 parent = hierarchicalTree; 32567 while (level < currentHierarchicalLevel) { 32568 var data = parent && Array.isArray(parent.data) ? parent.data : []; 32569 parent = find$2(data, function(subtree) { 32570 return subtree.isRefined; 32571 }); 32572 level++; 32573 } 32574 } 32575 if (parent) { 32576 var picked = Object.keys(hierarchicalFacetResult.data).map(function(facetValue) { 32577 return [facetValue, hierarchicalFacetResult.data[facetValue]]; 32578 }).filter(function(tuple) { 32579 var facetValue = tuple[0]; 32580 return onlyMatchingTree( 32581 facetValue, 32582 parent.path || hierarchicalRootPath, 32583 currentRefinement, 32584 hierarchicalSeparator, 32585 hierarchicalRootPath, 32586 hierarchicalShowParentLevel 32587 ); 32588 }); 32589 parent.data = orderBy$1( 32590 picked.map(function(tuple) { 32591 var facetValue = tuple[0]; 32592 var facetCount = tuple[1]; 32593 return format( 32594 facetCount, 32595 facetValue, 32596 hierarchicalSeparator, 32597 unescapeFacetValue$1(currentRefinement), 32598 hierarchicalFacetResult.exhaustive 32599 ); 32600 }), 32601 sortBy3[0], 32602 sortBy3[1] 32603 ); 32604 } 32605 return hierarchicalTree; 32606 }; 32607} 32608function onlyMatchingTree(facetValue, parentPath, currentRefinement, hierarchicalSeparator, hierarchicalRootPath, hierarchicalShowParentLevel) { 32609 if (hierarchicalRootPath && (facetValue.indexOf(hierarchicalRootPath) !== 0 || hierarchicalRootPath === facetValue)) { 32610 return false; 32611 } 32612 return !hierarchicalRootPath && facetValue.indexOf(hierarchicalSeparator) === -1 || // if there is a rootPath, being root level mean 1 level under rootPath 32613 hierarchicalRootPath && facetValue.split(hierarchicalSeparator).length - hierarchicalRootPath.split(hierarchicalSeparator).length === 1 || // if current refinement is a root level and current facetValue is a root level, 32614 // keep the facetValue 32615 facetValue.indexOf(hierarchicalSeparator) === -1 && currentRefinement.indexOf(hierarchicalSeparator) === -1 || // currentRefinement is a child of the facet value 32616 currentRefinement.indexOf(facetValue) === 0 || // facetValue is a child of the current parent, add it 32617 facetValue.indexOf(parentPath + hierarchicalSeparator) === 0 && (hierarchicalShowParentLevel || facetValue.indexOf(currentRefinement) === 0); 32618} 32619function format(facetCount, facetValue, hierarchicalSeparator, currentRefinement, exhaustive) { 32620 var parts = facetValue.split(hierarchicalSeparator); 32621 return { 32622 name: parts[parts.length - 1].trim(), 32623 path: facetValue, 32624 escapedValue: escapeFacetValue$2(facetValue), 32625 count: facetCount, 32626 isRefined: currentRefinement === facetValue || currentRefinement.indexOf(facetValue + hierarchicalSeparator) === 0, 32627 exhaustive, 32628 data: null 32629 }; 32630} 32631var compact$1 = compact$2; 32632var defaultsPure2 = defaultsPure$3; 32633var fv = escapeFacetValue_1; 32634var find$1 = find$5; 32635var findIndex = findIndex$1; 32636var formatSort2 = formatSort$1; 32637var merge$2 = merge_1; 32638var orderBy = orderBy_1; 32639var escapeFacetValue$1 = fv.escapeFacetValue; 32640var unescapeFacetValue = fv.unescapeFacetValue; 32641var generateHierarchicalTree = generateHierarchicalTree_1; 32642function getIndices(attributes) { 32643 var indices2 = {}; 32644 attributes.forEach(function(val, idx) { 32645 indices2[val] = idx; 32646 }); 32647 return indices2; 32648} 32649function assignFacetStats(dest, facetStats, key2) { 32650 if (facetStats && facetStats[key2]) { 32651 dest.stats = facetStats[key2]; 32652 } 32653} 32654function findMatchingHierarchicalFacetFromAttributeName(hierarchicalFacets, hierarchicalAttributeName) { 32655 return find$1( 32656 hierarchicalFacets, 32657 function facetKeyMatchesAttribute(hierarchicalFacet) { 32658 var facetNames = hierarchicalFacet.attributes || []; 32659 return facetNames.indexOf(hierarchicalAttributeName) > -1; 32660 } 32661 ); 32662} 32663function SearchResults$2(state, results, options) { 32664 var mainSubResponse = results[0] || {}; 32665 this._rawResults = results; 32666 var self2 = this; 32667 Object.keys(mainSubResponse).forEach(function(key2) { 32668 self2[key2] = mainSubResponse[key2]; 32669 }); 32670 var opts = merge$2( 32671 { 32672 persistHierarchicalRootCount: false 32673 }, 32674 options 32675 ); 32676 Object.keys(opts).forEach(function(key2) { 32677 self2[key2] = opts[key2]; 32678 }); 32679 this.processingTimeMS = results.reduce(function(sum, result) { 32680 return result.processingTimeMS === void 0 ? sum : sum + result.processingTimeMS; 32681 }, 0); 32682 this.disjunctiveFacets = []; 32683 this.hierarchicalFacets = state.hierarchicalFacets.map( 32684 function initFutureTree() { 32685 return []; 32686 } 32687 ); 32688 this.facets = []; 32689 var disjunctiveFacets = state.getRefinedDisjunctiveFacets(); 32690 var facetsIndices = getIndices(state.facets); 32691 var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets); 32692 var nextDisjunctiveResult = 1; 32693 var mainFacets = mainSubResponse.facets || {}; 32694 Object.keys(mainFacets).forEach(function(facetKey) { 32695 var facetValueObject = mainFacets[facetKey]; 32696 var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName( 32697 state.hierarchicalFacets, 32698 facetKey 32699 ); 32700 if (hierarchicalFacet) { 32701 var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey); 32702 var idxAttributeName = findIndex(state.hierarchicalFacets, function(f2) { 32703 return f2.name === hierarchicalFacet.name; 32704 }); 32705 self2.hierarchicalFacets[idxAttributeName][facetIndex] = { 32706 attribute: facetKey, 32707 data: facetValueObject, 32708 exhaustive: mainSubResponse.exhaustiveFacetsCount 32709 }; 32710 } else { 32711 var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1; 32712 var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1; 32713 var position; 32714 if (isFacetDisjunctive) { 32715 position = disjunctiveFacetsIndices[facetKey]; 32716 self2.disjunctiveFacets[position] = { 32717 name: facetKey, 32718 data: facetValueObject, 32719 exhaustive: mainSubResponse.exhaustiveFacetsCount 32720 }; 32721 assignFacetStats( 32722 self2.disjunctiveFacets[position], 32723 mainSubResponse.facets_stats, 32724 facetKey 32725 ); 32726 } 32727 if (isFacetConjunctive) { 32728 position = facetsIndices[facetKey]; 32729 self2.facets[position] = { 32730 name: facetKey, 32731 data: facetValueObject, 32732 exhaustive: mainSubResponse.exhaustiveFacetsCount 32733 }; 32734 assignFacetStats( 32735 self2.facets[position], 32736 mainSubResponse.facets_stats, 32737 facetKey 32738 ); 32739 } 32740 } 32741 }); 32742 this.hierarchicalFacets = compact$1(this.hierarchicalFacets); 32743 disjunctiveFacets.forEach(function(disjunctiveFacet) { 32744 var result = results[nextDisjunctiveResult]; 32745 var facets = result && result.facets ? result.facets : {}; 32746 var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet); 32747 Object.keys(facets).forEach(function(dfacet) { 32748 var facetResults = facets[dfacet]; 32749 var position; 32750 if (hierarchicalFacet) { 32751 position = findIndex(state.hierarchicalFacets, function(f2) { 32752 return f2.name === hierarchicalFacet.name; 32753 }); 32754 var attributeIndex = findIndex( 32755 self2.hierarchicalFacets[position], 32756 function(f2) { 32757 return f2.attribute === dfacet; 32758 } 32759 ); 32760 if (attributeIndex === -1) { 32761 return; 32762 } 32763 self2.hierarchicalFacets[position][attributeIndex].data = merge$2( 32764 {}, 32765 self2.hierarchicalFacets[position][attributeIndex].data, 32766 facetResults 32767 ); 32768 } else { 32769 position = disjunctiveFacetsIndices[dfacet]; 32770 var dataFromMainRequest = mainSubResponse.facets && mainSubResponse.facets[dfacet] || {}; 32771 self2.disjunctiveFacets[position] = { 32772 name: dfacet, 32773 data: defaultsPure2({}, facetResults, dataFromMainRequest), 32774 exhaustive: result.exhaustiveFacetsCount 32775 }; 32776 assignFacetStats( 32777 self2.disjunctiveFacets[position], 32778 result.facets_stats, 32779 dfacet 32780 ); 32781 if (state.disjunctiveFacetsRefinements[dfacet]) { 32782 state.disjunctiveFacetsRefinements[dfacet].forEach(function(refinementValue) { 32783 if (!self2.disjunctiveFacets[position].data[refinementValue] && state.disjunctiveFacetsRefinements[dfacet].indexOf( 32784 unescapeFacetValue(refinementValue) 32785 ) > -1) { 32786 self2.disjunctiveFacets[position].data[refinementValue] = 0; 32787 } 32788 }); 32789 } 32790 } 32791 }); 32792 nextDisjunctiveResult++; 32793 }); 32794 state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) { 32795 var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet); 32796 var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet); 32797 var currentRefinement = state.getHierarchicalRefinement(refinedFacet); 32798 if (currentRefinement.length === 0 || currentRefinement[0].split(separator).length < 2) { 32799 return; 32800 } 32801 results.slice(nextDisjunctiveResult).forEach(function(result) { 32802 var facets = result && result.facets ? result.facets : {}; 32803 Object.keys(facets).forEach(function(dfacet) { 32804 var facetResults = facets[dfacet]; 32805 var position = findIndex(state.hierarchicalFacets, function(f2) { 32806 return f2.name === hierarchicalFacet.name; 32807 }); 32808 var attributeIndex = findIndex( 32809 self2.hierarchicalFacets[position], 32810 function(f2) { 32811 return f2.attribute === dfacet; 32812 } 32813 ); 32814 if (attributeIndex === -1) { 32815 return; 32816 } 32817 var defaultData = {}; 32818 if (currentRefinement.length > 0 && !self2.persistHierarchicalRootCount) { 32819 var root = currentRefinement[0].split(separator)[0]; 32820 defaultData[root] = self2.hierarchicalFacets[position][attributeIndex].data[root]; 32821 } 32822 self2.hierarchicalFacets[position][attributeIndex].data = defaultsPure2( 32823 defaultData, 32824 facetResults, 32825 self2.hierarchicalFacets[position][attributeIndex].data 32826 ); 32827 }); 32828 nextDisjunctiveResult++; 32829 }); 32830 }); 32831 Object.keys(state.facetsExcludes).forEach(function(facetName) { 32832 var excludes = state.facetsExcludes[facetName]; 32833 var position = facetsIndices[facetName]; 32834 self2.facets[position] = { 32835 name: facetName, 32836 data: mainFacets[facetName], 32837 exhaustive: mainSubResponse.exhaustiveFacetsCount 32838 }; 32839 excludes.forEach(function(facetValue) { 32840 self2.facets[position] = self2.facets[position] || { name: facetName }; 32841 self2.facets[position].data = self2.facets[position].data || {}; 32842 self2.facets[position].data[facetValue] = 0; 32843 }); 32844 }); 32845 this.hierarchicalFacets = this.hierarchicalFacets.map( 32846 generateHierarchicalTree(state) 32847 ); 32848 this.facets = compact$1(this.facets); 32849 this.disjunctiveFacets = compact$1(this.disjunctiveFacets); 32850 this._state = state; 32851} 32852SearchResults$2.prototype.getFacetByName = function(name) { 32853 function predicate(facet) { 32854 return facet.name === name; 32855 } 32856 return find$1(this.facets, predicate) || find$1(this.disjunctiveFacets, predicate) || find$1(this.hierarchicalFacets, predicate); 32857}; 32858function extractNormalizedFacetValues(results, attribute) { 32859 function predicate(facet2) { 32860 return facet2.name === attribute; 32861 } 32862 if (results._state.isConjunctiveFacet(attribute)) { 32863 var facet = find$1(results.facets, predicate); 32864 if (!facet) return []; 32865 return Object.keys(facet.data).map(function(name) { 32866 var value = escapeFacetValue$1(name); 32867 return { 32868 name, 32869 escapedValue: value, 32870 count: facet.data[name], 32871 isRefined: results._state.isFacetRefined(attribute, value), 32872 isExcluded: results._state.isExcludeRefined(attribute, name) 32873 }; 32874 }); 32875 } else if (results._state.isDisjunctiveFacet(attribute)) { 32876 var disjunctiveFacet = find$1(results.disjunctiveFacets, predicate); 32877 if (!disjunctiveFacet) return []; 32878 return Object.keys(disjunctiveFacet.data).map(function(name) { 32879 var value = escapeFacetValue$1(name); 32880 return { 32881 name, 32882 escapedValue: value, 32883 count: disjunctiveFacet.data[name], 32884 isRefined: results._state.isDisjunctiveFacetRefined(attribute, value) 32885 }; 32886 }); 32887 } else if (results._state.isHierarchicalFacet(attribute)) { 32888 var hierarchicalFacetValues = find$1(results.hierarchicalFacets, predicate); 32889 if (!hierarchicalFacetValues) return hierarchicalFacetValues; 32890 var hierarchicalFacet = results._state.getHierarchicalFacetByName(attribute); 32891 var separator = results._state._getHierarchicalFacetSeparator(hierarchicalFacet); 32892 var currentRefinement = unescapeFacetValue( 32893 results._state.getHierarchicalRefinement(attribute)[0] || "" 32894 ); 32895 if (currentRefinement.indexOf(hierarchicalFacet.rootPath) === 0) { 32896 currentRefinement = currentRefinement.replace( 32897 hierarchicalFacet.rootPath + separator, 32898 "" 32899 ); 32900 } 32901 var currentRefinementSplit = currentRefinement.split(separator); 32902 currentRefinementSplit.unshift(attribute); 32903 setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0); 32904 return hierarchicalFacetValues; 32905 } 32906 return void 0; 32907} 32908function setIsRefined(item3, currentRefinement, depth) { 32909 item3.isRefined = item3.name === (currentRefinement[depth] && currentRefinement[depth].trim()); 32910 if (item3.data) { 32911 item3.data.forEach(function(child) { 32912 setIsRefined(child, currentRefinement, depth + 1); 32913 }); 32914 } 32915} 32916function recSort(sortFn, node, names, level) { 32917 level = level || 0; 32918 if (Array.isArray(node)) { 32919 return sortFn(node, names[level]); 32920 } 32921 if (!node.data || node.data.length === 0) { 32922 return node; 32923 } 32924 var children = node.data.map(function(childNode) { 32925 return recSort(sortFn, childNode, names, level + 1); 32926 }); 32927 var sortedChildren = sortFn(children, names[level]); 32928 var newNode = defaultsPure2({ data: sortedChildren }, node); 32929 return newNode; 32930} 32931SearchResults$2.DEFAULT_SORT = ["isRefined:desc", "count:desc", "name:asc"]; 32932function vanillaSortFn(order, data) { 32933 return data.sort(order); 32934} 32935function sortViaFacetOrdering(facetValues, facetOrdering) { 32936 var orderedFacets = []; 32937 var remainingFacets = []; 32938 var hide = facetOrdering.hide || []; 32939 var order = facetOrdering.order || []; 32940 var reverseOrder = order.reduce(function(acc, name, i2) { 32941 acc[name] = i2; 32942 return acc; 32943 }, {});
32944 facetValues.forEach(function(item3) { 32945 var name = item3.path || item3.name; 32946 var hidden = hide.indexOf(name) > -1; 32947 if (!hidden && reverseOrder[name] !== void 0) { 32948 orderedFacets[reverseOrder[name]] = item3; 32949 } else if (!hidden) { 32950 remainingFacets.push(item3); 32951 } 32952 }); 32953 orderedFacets = orderedFacets.filter(function(facet) { 32954 return facet; 32955 }); 32956 var sortRemainingBy = facetOrdering.sortRemainingBy; 32957 var ordering; 32958 if (sortRemainingBy === "hidden") { 32959 return orderedFacets; 32960 } else if (sortRemainingBy === "alpha") { 32961 ordering = [ 32962 ["path", "name"], 32963 ["asc", "asc"] 32964 ]; 32965 } else { 32966 ordering = [["count"], ["desc"]]; 32967 } 32968 return orderedFacets.concat( 32969 orderBy(remainingFacets, ordering[0], ordering[1]) 32970 ); 32971} 32972function getFacetOrdering(results, attribute) { 32973 return results.renderingContent && results.renderingContent.facetOrdering && results.renderingContent.facetOrdering.values && results.renderingContent.facetOrdering.values[attribute]; 32974} 32975SearchResults$2.prototype.getFacetValues = function(attribute, opts) { 32976 var facetValues = extractNormalizedFacetValues(this, attribute); 32977 if (!facetValues) { 32978 return void 0; 32979 } 32980 var options = defaultsPure2({}, opts, { 32981 sortBy: SearchResults$2.DEFAULT_SORT, 32982 // if no sortBy is given, attempt to sort based on facetOrdering 32983 // if it is given, we still allow to sort via facet ordering first 32984 facetOrdering: !(opts && opts.sortBy) 32985 }); 32986 var results = this; 32987 var attributes; 32988 if (Array.isArray(facetValues)) { 32989 attributes = [attribute]; 32990 } else { 32991 var config4 = results._state.getHierarchicalFacetByName(facetValues.name); 32992 attributes = config4.attributes; 32993 } 32994 return recSort( 32995 function(data, facetName) { 32996 if (options.facetOrdering) { 32997 var facetOrdering = getFacetOrdering(results, facetName); 32998 if (facetOrdering) { 32999 return sortViaFacetOrdering(data, facetOrdering); 33000 } 33001 } 33002 if (Array.isArray(options.sortBy)) { 33003 var order = formatSort2(options.sortBy, SearchResults$2.DEFAULT_SORT); 33004 return orderBy(data, order[0], order[1]); 33005 } else if (typeof options.sortBy === "function") { 33006 return vanillaSortFn(options.sortBy, data); 33007 } 33008 throw new Error( 33009 "options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function" 33010 ); 33011 }, 33012 facetValues, 33013 attributes 33014 ); 33015}; 33016SearchResults$2.prototype.getFacetStats = function(attribute) { 33017 if (this._state.isConjunctiveFacet(attribute)) { 33018 return getFacetStatsIfAvailable(this.facets, attribute); 33019 } else if (this._state.isDisjunctiveFacet(attribute)) { 33020 return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute); 33021 } 33022 return void 0; 33023}; 33024function getFacetStatsIfAvailable(facetList, facetName) { 33025 var data = find$1(facetList, function(facet) { 33026 return facet.name === facetName; 33027 }); 33028 return data && data.stats; 33029} 33030SearchResults$2.prototype.getRefinements = function() { 33031 var state = this._state; 33032 var results = this; 33033 var res = []; 33034 Object.keys(state.facetsRefinements).forEach(function(attributeName) { 33035 state.facetsRefinements[attributeName].forEach(function(name) { 33036 res.push( 33037 getRefinement(state, "facet", attributeName, name, results.facets) 33038 ); 33039 }); 33040 }); 33041 Object.keys(state.facetsExcludes).forEach(function(attributeName) { 33042 state.facetsExcludes[attributeName].forEach(function(name) { 33043 res.push( 33044 getRefinement(state, "exclude", attributeName, name, results.facets) 33045 ); 33046 }); 33047 }); 33048 Object.keys(state.disjunctiveFacetsRefinements).forEach(function(attributeName) { 33049 state.disjunctiveFacetsRefinements[attributeName].forEach(function(name) { 33050 res.push( 33051 getRefinement( 33052 state, 33053 "disjunctive", 33054 attributeName, 33055 name, 33056 results.disjunctiveFacets 33057 ) 33058 ); 33059 }); 33060 }); 33061 Object.keys(state.hierarchicalFacetsRefinements).forEach(function(attributeName) { 33062 state.hierarchicalFacetsRefinements[attributeName].forEach(function(name) { 33063 res.push( 33064 getHierarchicalRefinement( 33065 state, 33066 attributeName, 33067 name, 33068 results.hierarchicalFacets 33069 ) 33070 ); 33071 }); 33072 });
33073 Object.keys(state.numericRefinements).forEach(function(attributeName) { 33074 var operators = state.numericRefinements[attributeName]; 33075 Object.keys(operators).forEach(function(operator) { 33076 operators[operator].forEach(function(value) { 33077 res.push({ 33078 type: "numeric", 33079 attributeName, 33080 name: value, 33081 numericValue: value, 33082 operator 33083 }); 33084 }); 33085 }); 33086 }); 33087 state.tagRefinements.forEach(function(name) { 33088 res.push({ type: "tag", attributeName: "_tags", name }); 33089 }); 33090 return res; 33091}; 33092function getRefinement(state, type, attributeName, name, resultsFacets) { 33093 var facet = find$1(resultsFacets, function(f2) { 33094 return f2.name === attributeName; 33095 }); 33096 var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0; 33097 var exhaustive = facet && facet.exhaustive || false; 33098 return { 33099 type, 33100 attributeName, 33101 name, 33102 count, 33103 exhaustive 33104 }; 33105} 33106function getHierarchicalRefinement(state, attributeName, name, resultsFacets) { 33107 var facetDeclaration = state.getHierarchicalFacetByName(attributeName); 33108 var separator = state._getHierarchicalFacetSeparator(facetDeclaration); 33109 var split2 = name.split(separator); 33110 var rootFacet = find$1(resultsFacets, function(facet2) { 33111 return facet2.name === attributeName; 33112 }); 33113 var facet = split2.reduce(function(intermediateFacet, part) { 33114 var newFacet = intermediateFacet && find$1(intermediateFacet.data, function(f2) { 33115 return f2.name === part; 33116 }); 33117 return newFacet !== void 0 ? newFacet : intermediateFacet; 33118 }, rootFacet); 33119 var count = facet && facet.count || 0; 33120 var exhaustive = facet && facet.exhaustive || false; 33121 var path = facet && facet.path || ""; 33122 return { 33123 type: "hierarchical", 33124 attributeName, 33125 name: path, 33126 count, 33127 exhaustive 33128 }; 33129} 33130var SearchResults_1 = SearchResults$2; 33131var flat$1 = function flat(arr) { 33132 return arr.reduce(function(acc, val) { 33133 return acc.concat(val); 33134 }, []); 33135}; 33136var find3 = find$5; 33137var flat2 = flat$1; 33138function getAverageIndices(indexTracker, nrOfObjs) { 33139 var avgIndices = []; 33140 Object.keys(indexTracker).forEach(function(key2) { 33141 if (indexTracker[key2].count < 2) { 33142 indexTracker[key2].indexSum += 100; 33143 } 33144 avgIndices.push({ 33145 objectID: key2, 33146 avgOfIndices: indexTracker[key2].indexSum / nrOfObjs 33147 }); 33148 }); 33149 return avgIndices.sort(function(a2, b2) { 33150 return a2.avgOfIndices > b2.avgOfIndices ? 1 : -1; 33151 }); 33152} 33153function sortAndMergeRecommendations$1(results) { 33154 var indexTracker = {}; 33155 results.forEach(function(hits3) { 33156 hits3.forEach(function(hit, index3) { 33157 if (!indexTracker[hit.objectID]) { 33158 indexTracker[hit.objectID] = { indexSum: index3, count: 1 }; 33159 } else { 33160 indexTracker[hit.objectID] = { 33161 indexSum: indexTracker[hit.objectID].indexSum + index3, 33162 count: indexTracker[hit.objectID].count + 1 33163 }; 33164 } 33165 }); 33166 }); 33167 var sortedAverageIndices = getAverageIndices(indexTracker, results.length); 33168 var finalOrder = sortedAverageIndices.reduce( 33169 function(orderedHits, avgIndexRef) { 33170 var result = find3(flat2(results), function(hit) { 33171 return hit.objectID === avgIndexRef.objectID; 33172 }); 33173 return result ? orderedHits.concat(result) : orderedHits; 33174 }, 33175 [] 33176 ); 33177 return finalOrder; 33178} 33179var sortAndMergeRecommendations_1 = sortAndMergeRecommendations$1; 33180var version$2 = "3.22.5"; 33181var EventEmitter = events; 33182var DerivedHelper = DerivedHelper_1; 33183var escapeFacetValue = escapeFacetValue_1.escapeFacetValue; 33184var inherits = inherits_1; 33185var merge$1 = merge_1; 33186var objectHasKeys = objectHasKeys_1; 33187var omit = omit$3; 33188var RecommendParameters$1 = RecommendParameters_1; 33189var RecommendResults$1 = RecommendResults_1; 33190var requestBuilder = requestBuilder_1; 33191var SearchParameters$1 = SearchParameters_1; 33192var SearchResults$1 = SearchResults_1; 33193var sortAndMergeRecommendations = sortAndMergeRecommendations_1; 33194var version$1 = version$2; 33195function AlgoliaSearchHelper$1(client, index3, options, searchResultsOptions) { 33196 if (typeof client.addAlgoliaAgent === "function") { 33197 client.addAlgoliaAgent("JS Helper (" + version$1 + ")"); 33198 } 33199 this.setClient(client); 33200 var opts = options || {}; 33201 opts.index = index3; 33202 this.state = SearchParameters$1.make(opts); 33203 this.recommendState = new RecommendParameters$1({ 33204 params: opts.recommendState 33205 }); 33206 this.lastResults = null; 33207 this.lastRecommendResults = null; 33208 this._queryId = 0; 33209 this._recommendQueryId = 0; 33210 this._lastQueryIdReceived = -1;
vendor: 23,938 bytes, lines 33211-33945
33211 this._lastRecommendQueryIdReceived = -1; 33212 this.derivedHelpers = []; 33213 this._currentNbQueries = 0; 33214 this._currentNbRecommendQueries = 0; 33215 this._searchResultsOptions = searchResultsOptions; 33216 this._recommendCache = {}; 33217} 33218inherits(AlgoliaSearchHelper$1, EventEmitter); 33219AlgoliaSearchHelper$1.prototype.search = function() { 33220 this._search({ onlyWithDerivedHelpers: false }); 33221 return this; 33222}; 33223AlgoliaSearchHelper$1.prototype.searchOnlyWithDerivedHelpers = function() { 33224 this._search({ onlyWithDerivedHelpers: true }); 33225 return this; 33226}; 33227AlgoliaSearchHelper$1.prototype.recommend = function() { 33228 this._recommend(); 33229 return this; 33230}; 33231AlgoliaSearchHelper$1.prototype.getQuery = function() { 33232 var state = this.state; 33233 return requestBuilder._getHitsSearchParams(state); 33234}; 33235AlgoliaSearchHelper$1.prototype.searchOnce = function(options, cb) { 33236 var tempState = !options ? this.state : this.state.setQueryParameters(options); 33237 var queries = requestBuilder._getQueries(tempState.index, tempState); 33238 var self2 = this; 33239 this._currentNbQueries++; 33240 this.emit("searchOnce", { 33241 state: tempState 33242 }); 33243 if (cb) { 33244 this.client.search(queries).then(function(content) { 33245 self2._currentNbQueries--; 33246 if (self2._currentNbQueries === 0) { 33247 self2.emit("searchQueueEmpty"); 33248 } 33249 cb(null, new SearchResults$1(tempState, content.results), tempState); 33250 }).catch(function(err) { 33251 self2._currentNbQueries--; 33252 if (self2._currentNbQueries === 0) { 33253 self2.emit("searchQueueEmpty"); 33254 } 33255 cb(err, null, tempState); 33256 }); 33257 return void 0; 33258 } 33259 return this.client.search(queries).then( 33260 function(content) { 33261 self2._currentNbQueries--; 33262 if (self2._currentNbQueries === 0) self2.emit("searchQueueEmpty"); 33263 return { 33264 content: new SearchResults$1(tempState, content.results), 33265 state: tempState, 33266 _originalResponse: content 33267 }; 33268 }, 33269 function(e2) { 33270 self2._currentNbQueries--; 33271 if (self2._currentNbQueries === 0) self2.emit("searchQueueEmpty"); 33272 throw e2; 33273 } 33274 ); 33275}; 33276AlgoliaSearchHelper$1.prototype.findAnswers = function(options) { 33277 console.warn("[algoliasearch-helper] answers is no longer supported"); 33278 var state = this.state; 33279 var derivedHelper = this.derivedHelpers[0]; 33280 if (!derivedHelper) { 33281 return Promise.resolve([]); 33282 } 33283 var derivedState = derivedHelper.getModifiedState(state); 33284 var data = merge$1( 33285 { 33286 attributesForPrediction: options.attributesForPrediction, 33287 nbHits: options.nbHits 33288 }, 33289 { 33290 params: omit(requestBuilder._getHitsSearchParams(derivedState), [ 33291 "attributesToSnippet", 33292 "hitsPerPage", 33293 "restrictSearchableAttributes", 33294 "snippetEllipsisText" 33295 ]) 33296 } 33297 ); 33298 var errorMessage = "search for answers was called, but this client does not have a function client.initIndex(index).findAnswers"; 33299 if (typeof this.client.initIndex !== "function") { 33300 throw new Error(errorMessage); 33301 } 33302 var index3 = this.client.initIndex(derivedState.index); 33303 if (typeof index3.findAnswers !== "function") { 33304 throw new Error(errorMessage); 33305 } 33306 return index3.findAnswers(derivedState.query, options.queryLanguages, data); 33307}; 33308AlgoliaSearchHelper$1.prototype.searchForFacetValues = function(facet, query, maxFacetHits, userState) { 33309 var clientHasSFFV = typeof this.client.searchForFacetValues === "function" && // v5 has a wrong sffv signature 33310 typeof this.client.searchForFacets !== "function"; 33311 var clientHasInitIndex = typeof this.client.initIndex === "function"; 33312 if (!clientHasSFFV && !clientHasInitIndex && typeof this.client.search !== "function") { 33313 throw new Error( 33314 "search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues" 33315 ); 33316 } 33317 var state = this.state.setQueryParameters(userState || {}); 33318 var isDisjunctive = state.isDisjunctiveFacet(facet); 33319 var algoliaQuery = requestBuilder.getSearchForFacetQuery( 33320 facet, 33321 query, 33322 maxFacetHits, 33323 state 33324 ); 33325 this._currentNbQueries++; 33326 var self2 = this; 33327 var searchForFacetValuesPromise; 33328 if (clientHasSFFV) { 33329 searchForFacetValuesPromise = this.client.searchForFacetValues([ 33330 { indexName: state.index, params: algoliaQuery } 33331 ]); 33332 } else if (clientHasInitIndex) { 33333 searchForFacetValuesPromise = this.client.initIndex(state.index).searchForFacetValues(algoliaQuery); 33334 } else { 33335 delete algoliaQuery.facetName; 33336 searchForFacetValuesPromise = this.client.search([ 33337 { 33338 type: "facet", 33339 facet, 33340 indexName: state.index, 33341 params: algoliaQuery 33342 } 33343 ]).then(function processResponse(response) { 33344 return response.results[0]; 33345 }); 33346 } 33347 this.emit("searchForFacetValues", { 33348 state, 33349 facet, 33350 query 33351 }); 33352 return searchForFacetValuesPromise.then( 33353 function addIsRefined(content) { 33354 self2._currentNbQueries--; 33355 if (self2._currentNbQueries === 0) self2.emit("searchQueueEmpty"); 33356 content = Array.isArray(content) ? content[0] : content; 33357 content.facetHits.forEach(function(f2) { 33358 f2.escapedValue = escapeFacetValue(f2.value); 33359 f2.isRefined = isDisjunctive ? state.isDisjunctiveFacetRefined(facet, f2.escapedValue) : state.isFacetRefined(facet, f2.escapedValue); 33360 }); 33361 return content; 33362 }, 33363 function(e2) { 33364 self2._currentNbQueries--; 33365 if (self2._currentNbQueries === 0) self2.emit("searchQueueEmpty"); 33366 throw e2; 33367 } 33368 ); 33369}; 33370AlgoliaSearchHelper$1.prototype.setQuery = function(q2) { 33371 this._change({ 33372 state: this.state.resetPage().setQuery(q2), 33373 isPageReset: true 33374 }); 33375 return this; 33376}; 33377AlgoliaSearchHelper$1.prototype.clearRefinements = function(name) { 33378 this._change({ 33379 state: this.state.resetPage().clearRefinements(name), 33380 isPageReset: true 33381 }); 33382 return this; 33383}; 33384AlgoliaSearchHelper$1.prototype.clearTags = function() { 33385 this._change({ 33386 state: this.state.resetPage().clearTags(), 33387 isPageReset: true 33388 }); 33389 return this; 33390}; 33391AlgoliaSearchHelper$1.prototype.addDisjunctiveFacetRefinement = function(facet, value) { 33392 this._change({ 33393 state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value), 33394 isPageReset: true 33395 }); 33396 return this; 33397}; 33398AlgoliaSearchHelper$1.prototype.addDisjunctiveRefine = function() { 33399 return this.addDisjunctiveFacetRefinement.apply(this, arguments); 33400}; 33401AlgoliaSearchHelper$1.prototype.addHierarchicalFacetRefinement = function(facet, path) { 33402 this._change({ 33403 state: this.state.resetPage().addHierarchicalFacetRefinement(facet, path), 33404 isPageReset: true 33405 }); 33406 return this; 33407}; 33408AlgoliaSearchHelper$1.prototype.addNumericRefinement = function(attribute, operator, value) { 33409 this._change({ 33410 state: this.state.resetPage().addNumericRefinement(attribute, operator, value), 33411 isPageReset: true 33412 }); 33413 return this; 33414}; 33415AlgoliaSearchHelper$1.prototype.addFacetRefinement = function(facet, value) { 33416 this._change({ 33417 state: this.state.resetPage().addFacetRefinement(facet, value), 33418 isPageReset: true 33419 }); 33420 return this; 33421}; 33422AlgoliaSearchHelper$1.prototype.addRefine = function() { 33423 return this.addFacetRefinement.apply(this, arguments); 33424}; 33425AlgoliaSearchHelper$1.prototype.addFacetExclusion = function(facet, value) { 33426 this._change({ 33427 state: this.state.resetPage().addExcludeRefinement(facet, value), 33428 isPageReset: true 33429 }); 33430 return this; 33431}; 33432AlgoliaSearchHelper$1.prototype.addExclude = function() { 33433 return this.addFacetExclusion.apply(this, arguments); 33434}; 33435AlgoliaSearchHelper$1.prototype.addTag = function(tag) { 33436 this._change({ 33437 state: this.state.resetPage().addTagRefinement(tag), 33438 isPageReset: true 33439 }); 33440 return this; 33441}; 33442AlgoliaSearchHelper$1.prototype.addFrequentlyBoughtTogether = function(params) { 33443 this._recommendChange({ 33444 state: this.recommendState.addFrequentlyBoughtTogether(params) 33445 }); 33446 return this; 33447}; 33448AlgoliaSearchHelper$1.prototype.addRelatedProducts = function(params) { 33449 this._recommendChange({ 33450 state: this.recommendState.addRelatedProducts(params) 33451 }); 33452 return this; 33453}; 33454AlgoliaSearchHelper$1.prototype.addTrendingItems = function(params) { 33455 this._recommendChange({ 33456 state: this.recommendState.addTrendingItems(params) 33457 }); 33458 return this; 33459}; 33460AlgoliaSearchHelper$1.prototype.addTrendingFacets = function(params) { 33461 this._recommendChange({ 33462 state: this.recommendState.addTrendingFacets(params) 33463 }); 33464 return this; 33465}; 33466AlgoliaSearchHelper$1.prototype.addLookingSimilar = function(params) { 33467 this._recommendChange({ 33468 state: this.recommendState.addLookingSimilar(params) 33469 }); 33470 return this; 33471}; 33472AlgoliaSearchHelper$1.prototype.removeNumericRefinement = function(attribute, operator, value) { 33473 this._change({ 33474 state: this.state.resetPage().removeNumericRefinement(attribute, operator, value), 33475 isPageReset: true 33476 }); 33477 return this; 33478}; 33479AlgoliaSearchHelper$1.prototype.removeDisjunctiveFacetRefinement = function(facet, value) { 33480 this._change({ 33481 state: this.state.resetPage().removeDisjunctiveFacetRefinement(facet, value), 33482 isPageReset: true 33483 }); 33484 return this; 33485}; 33486AlgoliaSearchHelper$1.prototype.removeDisjunctiveRefine = function() { 33487 return this.removeDisjunctiveFacetRefinement.apply(this, arguments); 33488}; 33489AlgoliaSearchHelper$1.prototype.removeHierarchicalFacetRefinement = function(facet) { 33490 this._change({ 33491 state: this.state.resetPage().removeHierarchicalFacetRefinement(facet), 33492 isPageReset: true 33493 }); 33494 return this; 33495}; 33496AlgoliaSearchHelper$1.prototype.removeFacetRefinement = function(facet, value) { 33497 this._change({ 33498 state: this.state.resetPage().removeFacetRefinement(facet, value), 33499 isPageReset: true 33500 }); 33501 return this; 33502}; 33503AlgoliaSearchHelper$1.prototype.removeRefine = function() { 33504 return this.removeFacetRefinement.apply(this, arguments); 33505}; 33506AlgoliaSearchHelper$1.prototype.removeFacetExclusion = function(facet, value) { 33507 this._change({ 33508 state: this.state.resetPage().removeExcludeRefinement(facet, value), 33509 isPageReset: true 33510 }); 33511 return this; 33512}; 33513AlgoliaSearchHelper$1.prototype.removeExclude = function() { 33514 return this.removeFacetExclusion.apply(this, arguments); 33515}; 33516AlgoliaSearchHelper$1.prototype.removeTag = function(tag) { 33517 this._change({ 33518 state: this.state.resetPage().removeTagRefinement(tag), 33519 isPageReset: true 33520 }); 33521 return this; 33522}; 33523AlgoliaSearchHelper$1.prototype.removeFrequentlyBoughtTogether = function(id2) { 33524 this._recommendChange({ 33525 state: this.recommendState.removeParams(id2) 33526 }); 33527 return this; 33528}; 33529AlgoliaSearchHelper$1.prototype.removeRelatedProducts = function(id2) { 33530 this._recommendChange({ 33531 state: this.recommendState.removeParams(id2) 33532 }); 33533 return this; 33534}; 33535AlgoliaSearchHelper$1.prototype.removeTrendingItems = function(id2) { 33536 this._recommendChange({ 33537 state: this.recommendState.removeParams(id2) 33538 }); 33539 return this; 33540}; 33541AlgoliaSearchHelper$1.prototype.removeTrendingFacets = function(id2) { 33542 this._recommendChange({ 33543 state: this.recommendState.removeParams(id2) 33544 }); 33545 return this; 33546}; 33547AlgoliaSearchHelper$1.prototype.removeLookingSimilar = function(id2) { 33548 this._recommendChange({ 33549 state: this.recommendState.removeParams(id2) 33550 }); 33551 return this; 33552}; 33553AlgoliaSearchHelper$1.prototype.toggleFacetExclusion = function(facet, value) { 33554 this._change({ 33555 state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value), 33556 isPageReset: true 33557 }); 33558 return this; 33559}; 33560AlgoliaSearchHelper$1.prototype.toggleExclude = function() { 33561 return this.toggleFacetExclusion.apply(this, arguments); 33562}; 33563AlgoliaSearchHelper$1.prototype.toggleRefinement = function(facet, value) { 33564 return this.toggleFacetRefinement(facet, value); 33565}; 33566AlgoliaSearchHelper$1.prototype.toggleFacetRefinement = function(facet, value) { 33567 this._change({ 33568 state: this.state.resetPage().toggleFacetRefinement(facet, value), 33569 isPageReset: true 33570 }); 33571 return this; 33572}; 33573AlgoliaSearchHelper$1.prototype.toggleRefine = function() { 33574 return this.toggleFacetRefinement.apply(this, arguments); 33575}; 33576AlgoliaSearchHelper$1.prototype.toggleTag = function(tag) { 33577 this._change({ 33578 state: this.state.resetPage().toggleTagRefinement(tag), 33579 isPageReset: true 33580 }); 33581 return this; 33582}; 33583AlgoliaSearchHelper$1.prototype.nextPage = function() { 33584 var page2 = this.state.page || 0; 33585 return this.setPage(page2 + 1); 33586}; 33587AlgoliaSearchHelper$1.prototype.previousPage = function() { 33588 var page2 = this.state.page || 0; 33589 return this.setPage(page2 - 1); 33590}; 33591function setCurrentPage$3(page2) { 33592 if (page2 < 0) throw new Error("Page requested below 0."); 33593 this._change({ 33594 state: this.state.setPage(page2), 33595 isPageReset: false 33596 }); 33597 return this; 33598} 33599AlgoliaSearchHelper$1.prototype.setCurrentPage = setCurrentPage$3; 33600AlgoliaSearchHelper$1.prototype.setPage = setCurrentPage$3; 33601AlgoliaSearchHelper$1.prototype.setIndex = function(name) { 33602 this._change({ 33603 state: this.state.resetPage().setIndex(name), 33604 isPageReset: true 33605 }); 33606 return this; 33607}; 33608AlgoliaSearchHelper$1.prototype.setQueryParameter = function(parameter, value) { 33609 this._change({ 33610 state: this.state.resetPage().setQueryParameter(parameter, value), 33611 isPageReset: true 33612 }); 33613 return this; 33614}; 33615AlgoliaSearchHelper$1.prototype.setState = function(newState) { 33616 this._change({ 33617 state: SearchParameters$1.make(newState), 33618 isPageReset: false 33619 }); 33620 return this; 33621}; 33622AlgoliaSearchHelper$1.prototype.overrideStateWithoutTriggeringChangeEvent = function(newState) { 33623 this.state = new SearchParameters$1(newState); 33624 return this; 33625}; 33626AlgoliaSearchHelper$1.prototype.hasRefinements = function(attribute) { 33627 if (objectHasKeys(this.state.getNumericRefinements(attribute))) { 33628 return true; 33629 } else if (this.state.isConjunctiveFacet(attribute)) { 33630 return this.state.isFacetRefined(attribute); 33631 } else if (this.state.isDisjunctiveFacet(attribute)) { 33632 return this.state.isDisjunctiveFacetRefined(attribute); 33633 } else if (this.state.isHierarchicalFacet(attribute)) { 33634 return this.state.isHierarchicalFacetRefined(attribute); 33635 } 33636 return false; 33637}; 33638AlgoliaSearchHelper$1.prototype.isExcluded = function(facet, value) { 33639 return this.state.isExcludeRefined(facet, value); 33640}; 33641AlgoliaSearchHelper$1.prototype.isDisjunctiveRefined = function(facet, value) { 33642 return this.state.isDisjunctiveFacetRefined(facet, value); 33643}; 33644AlgoliaSearchHelper$1.prototype.hasTag = function(tag) { 33645 return this.state.isTagRefined(tag); 33646}; 33647AlgoliaSearchHelper$1.prototype.isTagRefined = function() { 33648 return this.hasTagRefinements.apply(this, arguments); 33649}; 33650AlgoliaSearchHelper$1.prototype.getIndex = function() { 33651 return this.state.index; 33652}; 33653function getCurrentPage$3() { 33654 return this.state.page; 33655} 33656AlgoliaSearchHelper$1.prototype.getCurrentPage = getCurrentPage$3; 33657AlgoliaSearchHelper$1.prototype.getPage = getCurrentPage$3; 33658AlgoliaSearchHelper$1.prototype.getTags = function() { 33659 return this.state.tagRefinements; 33660}; 33661AlgoliaSearchHelper$1.prototype.getRefinements = function(facetName) { 33662 var refinements = []; 33663 if (this.state.isConjunctiveFacet(facetName)) { 33664 var conjRefinements = this.state.getConjunctiveRefinements(facetName); 33665 conjRefinements.forEach(function(r2) { 33666 refinements.push({ 33667 value: r2, 33668 type: "conjunctive" 33669 }); 33670 }); 33671 var excludeRefinements = this.state.getExcludeRefinements(facetName); 33672 excludeRefinements.forEach(function(r2) { 33673 refinements.push({ 33674 value: r2, 33675 type: "exclude" 33676 }); 33677 }); 33678 } else if (this.state.isDisjunctiveFacet(facetName)) { 33679 var disjunctiveRefinements = this.state.getDisjunctiveRefinements(facetName); 33680 disjunctiveRefinements.forEach(function(r2) { 33681 refinements.push({ 33682 value: r2, 33683 type: "disjunctive" 33684 }); 33685 }); 33686 } 33687 var numericRefinements = this.state.getNumericRefinements(facetName); 33688 Object.keys(numericRefinements).forEach(function(operator) { 33689 var value = numericRefinements[operator]; 33690 refinements.push({ 33691 value, 33692 operator, 33693 type: "numeric" 33694 }); 33695 }); 33696 return refinements; 33697}; 33698AlgoliaSearchHelper$1.prototype.getNumericRefinement = function(attribute, operator) { 33699 return this.state.getNumericRefinement(attribute, operator); 33700}; 33701AlgoliaSearchHelper$1.prototype.getHierarchicalFacetBreadcrumb = function(facetName) { 33702 return this.state.getHierarchicalFacetBreadcrumb(facetName); 33703}; 33704AlgoliaSearchHelper$1.prototype._search = function(options) { 33705 var state = this.state; 33706 var states = []; 33707 var mainQueries = []; 33708 if (!options.onlyWithDerivedHelpers) { 33709 mainQueries = requestBuilder._getQueries(state.index, state); 33710 states.push({ 33711 state, 33712 queriesCount: mainQueries.length, 33713 helper: this 33714 }); 33715 this.emit("search", { 33716 state, 33717 results: this.lastResults 33718 }); 33719 } 33720 var derivedQueries = this.derivedHelpers.map(function(derivedHelper) { 33721 var derivedState = derivedHelper.getModifiedState(state); 33722 var derivedStateQueries = derivedState.index ? requestBuilder._getQueries(derivedState.index, derivedState) : []; 33723 states.push({ 33724 state: derivedState, 33725 queriesCount: derivedStateQueries.length, 33726 helper: derivedHelper 33727 }); 33728 derivedHelper.emit("search", { 33729 state: derivedState, 33730 results: derivedHelper.lastResults 33731 }); 33732 return derivedStateQueries; 33733 }); 33734 var queries = Array.prototype.concat.apply(mainQueries, derivedQueries); 33735 var queryId = this._queryId++; 33736 this._currentNbQueries++; 33737 if (!queries.length) { 33738 return Promise.resolve({ results: [] }).then( 33739 this._dispatchAlgoliaResponse.bind(this, states, queryId) 33740 ); 33741 } 33742 try { 33743 this.client.search(queries).then(this._dispatchAlgoliaResponse.bind(this, states, queryId)).catch(this._dispatchAlgoliaError.bind(this, queryId)); 33744 } catch (error2) { 33745 this.emit("error", { 33746 error: error2 33747 }); 33748 } 33749 return void 0; 33750}; 33751AlgoliaSearchHelper$1.prototype._recommend = function() { 33752 var searchState = this.state; 33753 var recommendState = this.recommendState; 33754 var index3 = this.getIndex(); 33755 var states = [{ state: recommendState, index: index3, helper: this }]; 33756 var ids = recommendState.params.map(function(param) { 33757 return param.$$id; 33758 }); 33759 this.emit("fetch", { 33760 recommend: { 33761 state: recommendState, 33762 results: this.lastRecommendResults 33763 } 33764 }); 33765 var cache2 = this._recommendCache; 33766 var derivedQueries = this.derivedHelpers.map(function(derivedHelper) { 33767 var derivedIndex = derivedHelper.getModifiedState(searchState).index; 33768 if (!derivedIndex) { 33769 return []; 33770 } 33771 var derivedState = derivedHelper.getModifiedRecommendState( 33772 new RecommendParameters$1() 33773 ); 33774 states.push({ 33775 state: derivedState, 33776 index: derivedIndex, 33777 helper: derivedHelper 33778 }); 33779 ids = Array.prototype.concat.apply( 33780 ids, 33781 derivedState.params.map(function(param) { 33782 return param.$$id; 33783 }) 33784 ); 33785 derivedHelper.emit("fetch", { 33786 recommend: { 33787 state: derivedState, 33788 results: derivedHelper.lastRecommendResults 33789 } 33790 }); 33791 return derivedState._buildQueries(derivedIndex, cache2); 33792 }); 33793 var queries = Array.prototype.concat.apply( 33794 this.recommendState._buildQueries(index3, cache2), 33795 derivedQueries 33796 ); 33797 if (queries.length === 0) { 33798 return; 33799 } 33800 if (queries.length > 0 && typeof this.client.getRecommendations === "undefined") { 33801 console.warn( 33802 "Please update algoliasearch/lite to the latest version in order to use recommend widgets." 33803 ); 33804 return; 33805 } 33806 var queryId = this._recommendQueryId++; 33807 this._currentNbRecommendQueries++; 33808 try { 33809 this.client.getRecommendations(queries).then(this._dispatchRecommendResponse.bind(this, queryId, states, ids)).catch(this._dispatchRecommendError.bind(this, queryId)); 33810 } catch (error2) { 33811 this.emit("error", { 33812 error: error2 33813 }); 33814 } 33815 return; 33816}; 33817AlgoliaSearchHelper$1.prototype._dispatchAlgoliaResponse = function(states, queryId, content) { 33818 var self2 = this; 33819 if (queryId < this._lastQueryIdReceived) { 33820 return; 33821 } 33822 this._currentNbQueries -= queryId - this._lastQueryIdReceived; 33823 this._lastQueryIdReceived = queryId; 33824 if (this._currentNbQueries === 0) this.emit("searchQueueEmpty"); 33825 var results = content.results.slice(); 33826 states.forEach(function(s2) { 33827 var state = s2.state; 33828 var queriesCount = s2.queriesCount; 33829 var helper = s2.helper; 33830 var specificResults = results.splice(0, queriesCount); 33831 if (!state.index) { 33832 helper.emit("result", { 33833 results: null, 33834 state 33835 }); 33836 return; 33837 } 33838 helper.lastResults = new SearchResults$1( 33839 state, 33840 specificResults, 33841 self2._searchResultsOptions 33842 ); 33843 helper.emit("result", { 33844 results: helper.lastResults, 33845 state 33846 }); 33847 }); 33848}; 33849AlgoliaSearchHelper$1.prototype._dispatchRecommendResponse = function(queryId, states, ids, content) { 33850 if (queryId < this._lastRecommendQueryIdReceived) { 33851 return; 33852 } 33853 this._currentNbRecommendQueries -= queryId - this._lastRecommendQueryIdReceived; 33854 this._lastRecommendQueryIdReceived = queryId; 33855 if (this._currentNbRecommendQueries === 0) this.emit("recommendQueueEmpty"); 33856 var cache2 = this._recommendCache; 33857 var idsMap = {}; 33858 ids.filter(function(id2) { 33859 return cache2[id2] === void 0; 33860 }).forEach(function(id2, index3) { 33861 if (!idsMap[id2]) idsMap[id2] = []; 33862 idsMap[id2].push(index3); 33863 }); 33864 Object.keys(idsMap).forEach(function(id2) { 33865 var indices2 = idsMap[id2]; 33866 var firstResult = content.results[indices2[0]]; 33867 if (indices2.length === 1) { 33868 cache2[id2] = firstResult; 33869 return; 33870 } 33871 cache2[id2] = Object.assign({}, firstResult, { 33872 hits: sortAndMergeRecommendations( 33873 indices2.map(function(idx) { 33874 return content.results[idx].hits; 33875 }) 33876 ) 33877 }); 33878 }); 33879 var results = {}; 33880 ids.forEach(function(id2) { 33881 results[id2] = cache2[id2]; 33882 }); 33883 states.forEach(function(s2) { 33884 var state = s2.state; 33885 var helper = s2.helper; 33886 if (!s2.index) { 33887 helper.emit("recommend:result", { 33888 results: null, 33889 state 33890 }); 33891 return; 33892 } 33893 helper.lastRecommendResults = new RecommendResults$1(state, results); 33894 helper.emit("recommend:result", { 33895 recommend: { 33896 results: helper.lastRecommendResults, 33897 state 33898 } 33899 }); 33900 }); 33901}; 33902AlgoliaSearchHelper$1.prototype._dispatchAlgoliaError = function(queryId, error2) { 33903 if (queryId < this._lastQueryIdReceived) { 33904 return; 33905 } 33906 this._currentNbQueries -= queryId - this._lastQueryIdReceived; 33907 this._lastQueryIdReceived = queryId; 33908 this.emit("error", { 33909 error: error2 33910 }); 33911 if (this._currentNbQueries === 0) this.emit("searchQueueEmpty"); 33912}; 33913AlgoliaSearchHelper$1.prototype._dispatchRecommendError = function(queryId, error2) { 33914 if (queryId < this._lastRecommendQueryIdReceived) { 33915 return; 33916 } 33917 this._currentNbRecommendQueries -= queryId - this._lastRecommendQueryIdReceived; 33918 this._lastRecommendQueryIdReceived = queryId; 33919 this.emit("error", { 33920 error: error2 33921 }); 33922 if (this._currentNbRecommendQueries === 0) this.emit("recommendQueueEmpty"); 33923}; 33924AlgoliaSearchHelper$1.prototype.containsRefinement = function(query, facetFilters, numericFilters, tagFilters) { 33925 return query || facetFilters.length !== 0 || numericFilters.length !== 0 || tagFilters.length !== 0; 33926}; 33927AlgoliaSearchHelper$1.prototype._hasDisjunctiveRefinements = function(facet) { 33928 return this.state.disjunctiveRefinements[facet] && this.state.disjunctiveRefinements[facet].length > 0; 33929}; 33930AlgoliaSearchHelper$1.prototype._change = function(event) { 33931 var state = event.state; 33932 var isPageReset = event.isPageReset; 33933 if (state !== this.state) { 33934 this.state = state; 33935 this.emit("change", { 33936 state: this.state, 33937 results: this.lastResults, 33938 isPageReset 33939 }); 33940 } 33941}; 33942AlgoliaSearchHelper$1.prototype._recommendChange = function(event) { 33943 var state = event.state; 33944 if (state !== this.recommendState) { 33945 this.recommendState = state;
33946 this.emit("recommend:change", { 33947 search: { 33948 results: this.lastResults, 33949 state: this.state 33950 }, 33951 recommend: { 33952 results: this.lastRecommendResults, 33953 state: this.recommendState 33954 } 33955 }); 33956 } 33957}; 33958AlgoliaSearchHelper$1.prototype.clearCache = function() { 33959 if (this.client.clearCache) this.client.clearCache(); 33960 return this; 33961}; 33962AlgoliaSearchHelper$1.prototype.setClient = function(newClient) { 33963 if (this.client === newClient) return this; 33964 if (typeof newClient.addAlgoliaAgent === "function") { 33965 newClient.addAlgoliaAgent("JS Helper (" + version$1 + ")"); 33966 } 33967 this.client = newClient; 33968 return this; 33969}; 33970AlgoliaSearchHelper$1.prototype.getClient = function() { 33971 return this.client; 33972}; 33973AlgoliaSearchHelper$1.prototype.derive = function(fn, recommendFn) { 33974 var derivedHelper = new DerivedHelper(this, fn, recommendFn); 33975 this.derivedHelpers.push(derivedHelper); 33976 return derivedHelper; 33977}; 33978AlgoliaSearchHelper$1.prototype.detachDerivedHelper = function(derivedHelper) { 33979 var pos = this.derivedHelpers.indexOf(derivedHelper); 33980 if (pos === -1) throw new Error("Derived helper already detached"); 33981 this.derivedHelpers.splice(pos, 1); 33982}; 33983AlgoliaSearchHelper$1.prototype.hasPendingRequests = function() { 33984 return this._currentNbQueries > 0; 33985}; 33986var algoliasearch_helper = AlgoliaSearchHelper$1; 33987var AlgoliaSearchHelper = algoliasearch_helper; 33988var RecommendParameters = RecommendParameters_1; 33989var RecommendResults = RecommendResults_1; 33990var SearchParameters = SearchParameters_1; 33991var SearchResults = SearchResults_1; 33992function algoliasearchHelper(client, index3, opts, searchResultsOptions) { 33993 return new AlgoliaSearchHelper(client, index3, opts, searchResultsOptions); 33994} 33995algoliasearchHelper.version = version$2; 33996algoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper; 33997algoliasearchHelper.SearchParameters = SearchParameters; 33998algoliasearchHelper.RecommendParameters = RecommendParameters; 33999algoliasearchHelper.SearchResults = SearchResults; 34000algoliasearchHelper.RecommendResults = RecommendResults; 34001var algoliasearchHelper_1 = algoliasearchHelper; 34002const algoliasearchHelper$1 = /* @__PURE__ */ getDefaultExportFromCjs(algoliasearchHelper_1); 34003function _typeof$y(obj) { 34004 "@babel/helpers - typeof"; 34005 return _typeof$y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 34006 return typeof obj2; 34007 } : function(obj2) { 34008 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 34009 }, _typeof$y(obj); 34010} 34011function ownKeys$s(object, enumerableOnly) { 34012 var keys = Object.keys(object); 34013 if (Object.getOwnPropertySymbols) { 34014 var symbols = Object.getOwnPropertySymbols(object); 34015 enumerableOnly && (symbols = symbols.filter(function(sym) { 34016 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 34017 })), keys.push.apply(keys, symbols); 34018 } 34019 return keys; 34020} 34021function _objectSpread$s(target) { 34022 for (var i2 = 1; i2 < arguments.length; i2++) { 34023 var source = null != arguments[i2] ? arguments[i2] : {}; 34024 i2 % 2 ? ownKeys$s(Object(source), true).forEach(function(key2) { 34025 _defineProperty$y(target, key2, source[key2]); 34026 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$s(Object(source)).forEach(function(key2) { 34027 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 34028 }); 34029 } 34030 return target; 34031} 34032function _defineProperty$y(obj, key2, value) { 34033 key2 = _toPropertyKey$y(key2); 34034 if (key2 in obj) { 34035 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 34036 } else { 34037 obj[key2] = value; 34038 } 34039 return obj; 34040} 34041function _toPropertyKey$y(arg) { 34042 var key2 = _toPrimitive$y(arg, "string"); 34043 return _typeof$y(key2) === "symbol" ? key2 : String(key2); 34044} 34045function _toPrimitive$y(input, hint) { 34046 if (_typeof$y(input) !== "object" || input === null) return input; 34047 var prim = input[Symbol.toPrimitive]; 34048 if (prim !== void 0) { 34049 var res = prim.call(input, hint || "default"); 34050 if (_typeof$y(res) !== "object") return res; 34051 throw new TypeError("@@toPrimitive must return a primitive value."); 34052 } 34053 return (hint === "string" ? String : Number)(input); 34054} 34055function _slicedToArray$2(arr, i2) { 34056 return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i2) || _unsupportedIterableToArray$7(arr, i2) || _nonIterableRest$2(); 34057} 34058function _nonIterableRest$2() {
34059 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 34060} 34061function _iterableToArrayLimit$2(arr, i2) { 34062 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 34063 if (null != _i2) { 34064 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 34065 try { 34066 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) { 34067 if (Object(_i2) !== _i2) return; 34068 _n = false; 34069 } else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 34070 } catch (err) { 34071 _d = true, _e = err; 34072 } finally { 34073 try { 34074 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 34075 } finally { 34076 if (_d) throw _e; 34077 } 34078 } 34079 return _arr; 34080 } 34081} 34082function _arrayWithHoles$2(arr) { 34083 if (Array.isArray(arr)) return arr; 34084} 34085function _toConsumableArray$5(arr) { 34086 return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$5(); 34087} 34088function _nonIterableSpread$5() { 34089 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 34090} 34091function _unsupportedIterableToArray$7(o2, minLen) { 34092 if (!o2) return; 34093 if (typeof o2 === "string") return _arrayLikeToArray$7(o2, minLen); 34094 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 34095 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 34096 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 34097 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$7(o2, minLen); 34098} 34099function _iterableToArray$5(iter) { 34100 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 34101} 34102function _arrayWithoutHoles$5(arr) { 34103 if (Array.isArray(arr)) return _arrayLikeToArray$7(arr); 34104} 34105function _arrayLikeToArray$7(arr, len2) { 34106 if (len2 == null || len2 > arr.length) len2 = arr.length; 34107 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 34108 return arr2; 34109} 34110var ALGOLIA_INSIGHTS_VERSION = "2.15.0"; 34111var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js"); 34112function createInsightsMiddleware() { 34113 var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 34114 var _insightsClient = props.insightsClient, insightsInitParams = props.insightsInitParams, onEvent = props.onEvent, _props$$$internal = props.$$internal, $$internal = _props$$$internal === void 0 ? false : _props$$$internal, _props$$$automatic = props.$$automatic, $$automatic = _props$$$automatic === void 0 ? false : _props$$$automatic; 34115 var potentialInsightsClient = _insightsClient; 34116 if (!_insightsClient && _insightsClient !== null) { 34117 safelyRunOnBrowser(function(_ref) { 34118 var window2 = _ref.window; 34119 var pointer = window2.AlgoliaAnalyticsObject || "aa"; 34120 if (typeof pointer === "string") { 34121 potentialInsightsClient = window2[pointer]; 34122 } 34123 if (!potentialInsightsClient) { 34124 window2.AlgoliaAnalyticsObject = pointer; 34125 if (!window2[pointer]) { 34126 window2[pointer] = function() { 34127 if (!window2[pointer].queue) { 34128 window2[pointer].queue = []; 34129 } 34130 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 34131 args[_key] = arguments[_key]; 34132 } 34133 window2[pointer].queue.push(args); 34134 }; 34135 window2[pointer].version = ALGOLIA_INSIGHTS_VERSION; 34136 window2[pointer].shouldAddScript = true; 34137 } 34138 potentialInsightsClient = window2[pointer]; 34139 } 34140 }); 34141 } 34142 var insightsClient = potentialInsightsClient || noop$1; 34143 return function(_ref22) { 34144 var instantSearchInstance = _ref22.instantSearchInstance; 34145 var existingInsightsMiddlewares = instantSearchInstance.middleware.filter(function(m2) { 34146 return m2.instance.$$type === "ais.insights" && m2.instance.$$internal; 34147 }).map(function(m2) { 34148 return m2.creator; 34149 }); 34150 instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray$5(existingInsightsMiddlewares)); 34151 var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client), _getAppIdAndApiKey2 = _slicedToArray$2(_getAppIdAndApiKey, 2), appId = _getAppIdAndApiKey2[0], apiKey = _getAppIdAndApiKey2[1]; 34152 var queuedUserToken = void 0; 34153 var queuedAuthenticatedUserToken = void 0; 34154 var userTokenBeforeInit = void 0; 34155 var authenticatedUserTokenBeforeInit = void 0; 34156 var queue = insightsClient.queue; 34157 if (Array.isArray(queue)) { 34158 var _map = ["setUserToken", "setAuthenticatedUserToken"].map(function(key2) { 34159 var _ref3 = find$6(queue.slice().reverse(), function(_ref5) { 34160 var _ref62 = _slicedToArray$2(_ref5, 1), method = _ref62[0]; 34161 return method === key2; 34162 }) || [], _ref42 = _slicedToArray$2(_ref3, 2), value = _ref42[1]; 34163 return value; 34164 }); 34165 var _map2 = _slicedToArray$2(_map, 2); 34166 queuedUserToken = _map2[0]; 34167 queuedAuthenticatedUserToken = _map2[1]; 34168 } 34169 insightsClient("getUserToken", null, function(_error, userToken) { 34170 userTokenBeforeInit = normalizeUserToken(userToken); 34171 }); 34172 insightsClient("getAuthenticatedUserToken", null, function(_error, userToken) { 34173 authenticatedUserTokenBeforeInit = normalizeUserToken(userToken); 34174 }); 34175 if (insightsInitParams || !isModernInsightsClient(insightsClient)) { 34176 insightsClient("init", _objectSpread$s({ 34177 appId, 34178 apiKey, 34179 partial: true 34180 }, insightsInitParams)); 34181 } 34182 var initialParameters; 34183 var helper; 34184 return { 34185 $$type: "ais.insights", 34186 $$internal, 34187 $$automatic, 34188 onStateChange: function onStateChange() { 34189 }, 34190 subscribe: function subscribe() { 34191 if (!insightsClient.shouldAddScript) return; 34192 var errorMessage = "[insights middleware]: could not load search-insights.js. Please load it manually following https://alg.li/insights-init"; 34193 try { 34194 var script = document.createElement("script"); 34195 script.async = true; 34196 script.src = ALGOLIA_INSIGHTS_SRC; 34197 script.onerror = function() { 34198 instantSearchInstance.emit("error", new Error(errorMessage)); 34199 }; 34200 document.body.appendChild(script); 34201 insightsClient.shouldAddScript = false;
34202 } catch (cause) { 34203 insightsClient.shouldAddScript = false; 34204 instantSearchInstance.emit("error", new Error(errorMessage)); 34205 } 34206 }, 34207 started: function started() { 34208 insightsClient("addAlgoliaAgent", "insights-middleware"); 34209 helper = instantSearchInstance.mainHelper; 34210 initialParameters = { 34211 userToken: helper.state.userToken, 34212 clickAnalytics: helper.state.clickAnalytics 34213 }; 34214 if (!$$automatic) { 34215 helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$s(_objectSpread$s({}, helper.state), {}, { 34216 clickAnalytics: true 34217 })); 34218 } 34219 if (!$$internal) { 34220 instantSearchInstance.scheduleSearch(); 34221 } 34222 var setUserTokenToSearch = function setUserTokenToSearch2(userToken) { 34223 var immediate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 34224 var normalizedUserToken = normalizeUserToken(userToken); 34225 if (!normalizedUserToken) { 34226 return; 34227 } 34228 var existingToken = helper.state.userToken; 34229 function applyToken() { 34230 helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$s(_objectSpread$s({}, helper.state), {}, { 34231 userToken: normalizedUserToken 34232 })); 34233 if (existingToken && existingToken !== userToken) { 34234 instantSearchInstance.scheduleSearch(); 34235 } 34236 } 34237 if (!immediate) { 34238 setTimeout(applyToken, 0); 34239 } else { 34240 applyToken(); 34241 } 34242 }; 34243 var anonymousUserToken = getInsightsAnonymousUserTokenInternal(); 34244 if (anonymousUserToken) { 34245 setUserTokenToSearch(anonymousUserToken, true); 34246 } 34247 function setUserToken(token, userToken, authenticatedUserToken) { 34248 setUserTokenToSearch(token, true); 34249 if (userToken) { 34250 insightsClient("setUserToken", userToken); 34251 } 34252 if (authenticatedUserToken) { 34253 insightsClient("setAuthenticatedUserToken", authenticatedUserToken); 34254 } 34255 } 34256 var tokenBeforeInit = authenticatedUserTokenBeforeInit || userTokenBeforeInit; 34257 var queuedToken = queuedAuthenticatedUserToken || queuedUserToken; 34258 if (tokenBeforeInit) { 34259 setUserToken(tokenBeforeInit, userTokenBeforeInit, authenticatedUserTokenBeforeInit); 34260 } else if (queuedToken) { 34261 setUserToken(queuedToken, queuedUserToken, queuedAuthenticatedUserToken); 34262 } 34263 insightsClient("onUserTokenChange", setUserTokenToSearch, { 34264 immediate: true 34265 }); 34266 insightsClient("onAuthenticatedUserTokenChange", function(authenticatedUserToken) { 34267 if (!authenticatedUserToken) { 34268 insightsClient("getUserToken", null, function(_2, userToken) { 34269 setUserTokenToSearch(userToken); 34270 }); 34271 } 34272 setUserTokenToSearch(authenticatedUserToken); 34273 }, { 34274 immediate: true 34275 }); 34276 var insightsClientWithLocalCredentials = insightsClient; 34277 if (isModernInsightsClient(insightsClient)) { 34278 insightsClientWithLocalCredentials = function insightsClientWithLocalCredentials2(method, payload) { 34279 var extraParams = { 34280 headers: { 34281 "X-Algolia-Application-Id": appId, 34282 "X-Algolia-API-Key": apiKey 34283 } 34284 }; 34285 return insightsClient(method, payload, extraParams); 34286 }; 34287 } 34288 instantSearchInstance.sendEventToInsights = function(event) { 34289 if (onEvent) { 34290 onEvent(event, insightsClientWithLocalCredentials); 34291 } else if (event.insightsMethod) { 34292 event.payload.algoliaSource = ["instantsearch"]; 34293 if ($$automatic) { 34294 event.payload.algoliaSource.push("instantsearch-automatic"); 34295 } 34296 if (event.eventModifier === "internal") { 34297 event.payload.algoliaSource.push("instantsearch-internal"); 34298 } 34299 insightsClientWithLocalCredentials(event.insightsMethod, event.payload); 34300 } else ; 34301 }; 34302 }, 34303 unsubscribe: function unsubscribe() { 34304 insightsClient("onUserTokenChange", void 0); 34305 insightsClient("onAuthenticatedUserTokenChange", void 0); 34306 instantSearchInstance.sendEventToInsights = noop$1; 34307 if (helper && initialParameters) { 34308 helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$s(_objectSpread$s({}, helper.state), initialParameters)); 34309 instantSearchInstance.scheduleSearch(); 34310 } 34311 } 34312 }; 34313 }; 34314} 34315function isModernInsightsClient(client) { 34316 var _split$map = (client.version || "").split(".").map(Number), _split$map2 = _slicedToArray$2(_split$map, 2), major = _split$map2[0], minor = _split$map2[1]; 34317 var v3 = major >= 3; 34318 var v2_6 = major === 2 && minor >= 6; 34319 var v1_10 = major === 1 && minor >= 10; 34320 return v3 || v2_6 || v1_10; 34321} 34322function normalizeUserToken(userToken) { 34323 if (!userToken) { 34324 return void 0; 34325 } 34326 return typeof userToken === "number" ? userToken.toString() : userToken; 34327} 34328function extractWidgetPayload(widgets, instantSearchInstance, payload) { 34329 var initOptions = createInitArgs(instantSearchInstance, instantSearchInstance.mainIndex, instantSearchInstance._initialUiState);
vendor: 6,383 bytes, lines 34330-34530
34330 widgets.forEach(function(widget) { 34331 var widgetParams = {}; 34332 if (widget.getWidgetRenderState) { 34333 var renderState = widget.getWidgetRenderState(initOptions); 34334 if (renderState && renderState.widgetParams) { 34335 widgetParams = renderState.widgetParams; 34336 } 34337 } 34338 var params = Object.keys(widgetParams).filter(function(key2) { 34339 return widgetParams[key2] !== void 0; 34340 }); 34341 payload.widgets.push({ 34342 type: widget.$$type, 34343 widgetType: widget.$$widgetType, 34344 params 34345 }); 34346 if (widget.$$type === "ais.index") { 34347 extractWidgetPayload(widget.getWidgets(), instantSearchInstance, payload); 34348 } 34349 }); 34350} 34351function isMetadataEnabled() { 34352 return safelyRunOnBrowser(function(_ref) { 34353 var _window$navigator, _window$navigator$use; 34354 var window2 = _ref.window; 34355 return ((_window$navigator = window2.navigator) === null || _window$navigator === void 0 ? void 0 : (_window$navigator$use = _window$navigator.userAgent) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.indexOf("Algolia Crawler")) > -1; 34356 }, { 34357 fallback: function fallback() { 34358 return false; 34359 } 34360 }); 34361} 34362function createMetadataMiddleware() { 34363 var _ref22 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$$$internal = _ref22.$$internal, $$internal = _ref2$$$internal === void 0 ? false : _ref2$$$internal; 34364 return function(_ref3) { 34365 var instantSearchInstance = _ref3.instantSearchInstance; 34366 var payload = { 34367 widgets: [] 34368 }; 34369 var payloadContainer = document.createElement("meta"); 34370 var refNode = document.querySelector("head"); 34371 payloadContainer.name = "instantsearch:widgets"; 34372 return { 34373 $$type: "ais.metadata", 34374 $$internal, 34375 onStateChange: function onStateChange() { 34376 }, 34377 subscribe: function subscribe() { 34378 setTimeout(function() { 34379 var client = instantSearchInstance.client; 34380 payload.ua = client.transporter && client.transporter.userAgent ? client.transporter.userAgent.value : client._ua; 34381 extractWidgetPayload(instantSearchInstance.mainIndex.getWidgets(), instantSearchInstance, payload); 34382 instantSearchInstance.middleware.forEach(function(middleware) { 34383 return payload.widgets.push({ 34384 middleware: true, 34385 type: middleware.instance.$$type, 34386 internal: middleware.instance.$$internal 34387 }); 34388 }); 34389 payloadContainer.content = JSON.stringify(payload); 34390 refNode.appendChild(payloadContainer); 34391 }, 0); 34392 }, 34393 started: function started() { 34394 }, 34395 unsubscribe: function unsubscribe() { 34396 payloadContainer.remove(); 34397 } 34398 }; 34399 }; 34400} 34401var replace = String.prototype.replace; 34402var percentTwenties = /%20/g; 34403var Format = { 34404 RFC1738: "RFC1738", 34405 RFC3986: "RFC3986" 34406}; 34407var formats$3 = { 34408 "default": Format.RFC3986, 34409 formatters: { 34410 RFC1738: function(value) { 34411 return replace.call(value, percentTwenties, "+"); 34412 }, 34413 RFC3986: function(value) { 34414 return String(value); 34415 } 34416 }, 34417 RFC1738: Format.RFC1738, 34418 RFC3986: Format.RFC3986 34419}; 34420var formats$2 = formats$3; 34421var has$2 = Object.prototype.hasOwnProperty; 34422var isArray$2 = Array.isArray; 34423var hexTable = function() { 34424 var array = []; 34425 for (var i2 = 0; i2 < 256; ++i2) { 34426 array.push("%" + ((i2 < 16 ? "0" : "") + i2.toString(16)).toUpperCase()); 34427 } 34428 return array; 34429}(); 34430var compactQueue = function compactQueue2(queue) { 34431 while (queue.length > 1) { 34432 var item3 = queue.pop(); 34433 var obj = item3.obj[item3.prop]; 34434 if (isArray$2(obj)) { 34435 var compacted = []; 34436 for (var j2 = 0; j2 < obj.length; ++j2) { 34437 if (typeof obj[j2] !== "undefined") { 34438 compacted.push(obj[j2]); 34439 } 34440 } 34441 item3.obj[item3.prop] = compacted; 34442 } 34443 } 34444}; 34445var arrayToObject = function arrayToObject2(source, options) { 34446 var obj = options && options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; 34447 for (var i2 = 0; i2 < source.length; ++i2) { 34448 if (typeof source[i2] !== "undefined") { 34449 obj[i2] = source[i2]; 34450 } 34451 } 34452 return obj; 34453}; 34454var merge = function merge2(target, source, options) { 34455 if (!source) { 34456 return target; 34457 } 34458 if (typeof source !== "object") { 34459 if (isArray$2(target)) { 34460 target.push(source); 34461 } else if (target && typeof target === "object") { 34462 if (options && (options.plainObjects || options.allowPrototypes) || !has$2.call(Object.prototype, source)) { 34463 target[source] = true; 34464 } 34465 } else { 34466 return [target, source]; 34467 } 34468 return target; 34469 } 34470 if (!target || typeof target !== "object") { 34471 return [target].concat(source); 34472 } 34473 var mergeTarget = target; 34474 if (isArray$2(target) && !isArray$2(source)) { 34475 mergeTarget = arrayToObject(target, options); 34476 } 34477 if (isArray$2(target) && isArray$2(source)) { 34478 source.forEach(function(item3, i2) { 34479 if (has$2.call(target, i2)) { 34480 var targetItem = target[i2]; 34481 if (targetItem && typeof targetItem === "object" && item3 && typeof item3 === "object") { 34482 target[i2] = merge2(targetItem, item3, options); 34483 } else { 34484 target.push(item3); 34485 } 34486 } else { 34487 target[i2] = item3; 34488 } 34489 }); 34490 return target; 34491 } 34492 return Object.keys(source).reduce(function(acc, key2) { 34493 var value = source[key2]; 34494 if (has$2.call(acc, key2)) { 34495 acc[key2] = merge2(acc[key2], value, options); 34496 } else { 34497 acc[key2] = value; 34498 } 34499 return acc; 34500 }, mergeTarget); 34501}; 34502var assign = function assignSingleSource(target, source) { 34503 return Object.keys(source).reduce(function(acc, key2) { 34504 acc[key2] = source[key2]; 34505 return acc; 34506 }, target); 34507}; 34508var decode = function(str, decoder, charset) { 34509 var strWithoutPlus = str.replace(/\+/g, " "); 34510 if (charset === "iso-8859-1") { 34511 return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); 34512 } 34513 try { 34514 return decodeURIComponent(strWithoutPlus); 34515 } catch (e2) { 34516 return strWithoutPlus; 34517 } 34518}; 34519var encode = function encode2(str, defaultEncoder, charset, kind, format2) { 34520 if (str.length === 0) { 34521 return str; 34522 } 34523 var string = str; 34524 if (typeof str === "symbol") { 34525 string = Symbol.prototype.toString.call(str); 34526 } else if (typeof str !== "string") { 34527 string = String(str); 34528 } 34529 if (charset === "iso-8859-1") { 34530 return escape(string).replace(/%u[0-9a-f]{4}
vendor: 6,116 bytes, lines 34530-34715
34530/gi, function($0) { 34531 return "%26%23" + parseInt($0.slice(2), 16) + "%3B"; 34532 }); 34533 } 34534 var out = ""; 34535 for (var i2 = 0; i2 < string.length; ++i2) { 34536 var c2 = string.charCodeAt(i2); 34537 if (c2 === 45 || c2 === 46 || c2 === 95 || c2 === 126 || c2 >= 48 && c2 <= 57 || c2 >= 65 && c2 <= 90 || c2 >= 97 && c2 <= 122 || format2 === formats$2.RFC1738 && (c2 === 40 || c2 === 41)) { 34538 out += string.charAt(i2); 34539 continue; 34540 } 34541 if (c2 < 128) { 34542 out = out + hexTable[c2]; 34543 continue; 34544 } 34545 if (c2 < 2048) { 34546 out = out + (hexTable[192 | c2 >> 6] + hexTable[128 | c2 & 63]); 34547 continue; 34548 } 34549 if (c2 < 55296 || c2 >= 57344) { 34550 out = out + (hexTable[224 | c2 >> 12] + hexTable[128 | c2 >> 6 & 63] + hexTable[128 | c2 & 63]); 34551 continue; 34552 } 34553 i2 += 1; 34554 c2 = 65536 + ((c2 & 1023) << 10 | string.charCodeAt(i2) & 1023); 34555 out += hexTable[240 | c2 >> 18] + hexTable[128 | c2 >> 12 & 63] + hexTable[128 | c2 >> 6 & 63] + hexTable[128 | c2 & 63]; 34556 } 34557 return out; 34558}; 34559var compact2 = function compact3(value) { 34560 var queue = [{ obj: { o: value }, prop: "o" }]; 34561 var refs = []; 34562 for (var i2 = 0; i2 < queue.length; ++i2) { 34563 var item3 = queue[i2]; 34564 var obj = item3.obj[item3.prop]; 34565 var keys = Object.keys(obj); 34566 for (var j2 = 0; j2 < keys.length; ++j2) { 34567 var key2 = keys[j2]; 34568 var val = obj[key2]; 34569 if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) { 34570 queue.push({ obj, prop: key2 }); 34571 refs.push(val); 34572 } 34573 } 34574 } 34575 compactQueue(queue); 34576 return value; 34577}; 34578var isRegExp = function isRegExp2(obj) { 34579 return Object.prototype.toString.call(obj) === "[object RegExp]"; 34580}; 34581var isBuffer = function isBuffer2(obj) { 34582 if (!obj || typeof obj !== "object") { 34583 return false; 34584 } 34585 return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); 34586}; 34587var combine = function combine2(a2, b2) { 34588 return [].concat(a2, b2); 34589}; 34590var maybeMap = function maybeMap2(val, fn) { 34591 if (isArray$2(val)) { 34592 var mapped = []; 34593 for (var i2 = 0; i2 < val.length; i2 += 1) { 34594 mapped.push(fn(val[i2])); 34595 } 34596 return mapped; 34597 } 34598 return fn(val); 34599}; 34600var utils$2 = { 34601 arrayToObject, 34602 assign, 34603 combine, 34604 compact: compact2, 34605 decode, 34606 encode, 34607 isBuffer, 34608 isRegExp, 34609 maybeMap, 34610 merge 34611}; 34612var utils$1 = utils$2; 34613var formats$1 = formats$3; 34614var has$1 = Object.prototype.hasOwnProperty; 34615var arrayPrefixGenerators = { 34616 brackets: function brackets(prefix) { 34617 return prefix + "[]"; 34618 }, 34619 comma: "comma", 34620 indices: function indices(prefix, key2) { 34621 return prefix + "[" + key2 + "]"; 34622 }, 34623 repeat: function repeat(prefix) { 34624 return prefix; 34625 } 34626}; 34627var isArray$1 = Array.isArray; 34628var split = String.prototype.split; 34629var push = Array.prototype.push; 34630var pushToArray = function(arr, valueOrArray) { 34631 push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]); 34632}; 34633var toISO = Date.prototype.toISOString; 34634var defaultFormat = formats$1["default"]; 34635var defaults$1 = { 34636 addQueryPrefix: false, 34637 allowDots: false, 34638 charset: "utf-8", 34639 charsetSentinel: false, 34640 delimiter: "&", 34641 encode: true, 34642 encoder: utils$1.encode, 34643 encodeValuesOnly: false, 34644 format: defaultFormat, 34645 formatter: formats$1.formatters[defaultFormat], 34646 // deprecated 34647 indices: false, 34648 serializeDate: function serializeDate(date) { 34649 return toISO.call(date); 34650 }, 34651 skipNulls: false, 34652 strictNullHandling: false 34653}; 34654var isNonNullishPrimitive = function isNonNullishPrimitive2(v2) { 34655 return typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean" || typeof v2 === "symbol" || typeof v2 === "bigint"; 34656}; 34657var stringify$1 = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate2, format2, formatter, encodeValuesOnly, charset) { 34658 var obj = object; 34659 if (typeof filter === "function") { 34660 obj = filter(prefix, obj); 34661 } else if (obj instanceof Date) { 34662 obj = serializeDate2(obj); 34663 } else if (generateArrayPrefix === "comma" && isArray$1(obj)) { 34664 obj = utils$1.maybeMap(obj, function(value2) { 34665 if (value2 instanceof Date) { 34666 return serializeDate2(value2); 34667 } 34668 return value2; 34669 }); 34670 } 34671 if (obj === null) { 34672 if (strictNullHandling) { 34673 return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, "key", format2) : prefix; 34674 } 34675 obj = ""; 34676 } 34677 if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) { 34678 if (encoder) { 34679 var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, "key", format2); 34680 if (generateArrayPrefix === "comma" && encodeValuesOnly) { 34681 var valuesArray = split.call(String(obj), ","); 34682 var valuesJoined = ""; 34683 for (var i2 = 0; i2 < valuesArray.length; ++i2) { 34684 valuesJoined += (i2 === 0 ? "" : ",") + formatter(encoder(valuesArray[i2], defaults$1.encoder, charset, "value", format2)); 34685 } 34686 return [formatter(keyValue) + "=" + valuesJoined]; 34687 } 34688 return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults$1.encoder, charset, "value", format2))]; 34689 } 34690 return [formatter(prefix) + "=" + formatter(String(obj))]; 34691 } 34692 var values = []; 34693 if (typeof obj === "undefined") { 34694 return values; 34695 } 34696 var objKeys; 34697 if (generateArrayPrefix === "comma" && isArray$1(obj)) { 34698 objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }]; 34699 } else if (isArray$1(filter)) { 34700 objKeys = filter; 34701 } else { 34702 var keys = Object.keys(obj); 34703 objKeys = sort ? keys.sort(sort) : keys; 34704 } 34705 for (var j2 = 0; j2 < objKeys.length; ++j2) { 34706 var key2 = objKeys[j2]; 34707 var value = typeof key2 === "object" && typeof key2.value !== "undefined" ? key2.value : obj[key2]; 34708 if (skipNulls && value === null) { 34709 continue; 34710 } 34711 var keyPrefix = isArray$1(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(prefix, key2) : prefix : prefix + (allowDots ? "." + key2 : "[" + key2 + "]"); 34712 pushToArray(values, stringify( 34713 value, 34714 keyPrefix, 34715 generateArrayPrefix,
vendor: 10,988 bytes, lines 34716-35013
34716 strictNullHandling, 34717 skipNulls, 34718 encoder, 34719 filter, 34720 sort, 34721 allowDots, 34722 serializeDate2, 34723 format2, 34724 formatter, 34725 encodeValuesOnly, 34726 charset 34727 )); 34728 } 34729 return values; 34730}; 34731var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) { 34732 if (!opts) { 34733 return defaults$1; 34734 } 34735 if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") { 34736 throw new TypeError("Encoder has to be a function."); 34737 } 34738 var charset = opts.charset || defaults$1.charset; 34739 if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { 34740 throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); 34741 } 34742 var format2 = formats$1["default"]; 34743 if (typeof opts.format !== "undefined") { 34744 if (!has$1.call(formats$1.formatters, opts.format)) { 34745 throw new TypeError("Unknown format option provided."); 34746 } 34747 format2 = opts.format; 34748 } 34749 var formatter = formats$1.formatters[format2]; 34750 var filter = defaults$1.filter; 34751 if (typeof opts.filter === "function" || isArray$1(opts.filter)) { 34752 filter = opts.filter; 34753 } 34754 return { 34755 addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults$1.addQueryPrefix, 34756 allowDots: typeof opts.allowDots === "undefined" ? defaults$1.allowDots : !!opts.allowDots, 34757 charset, 34758 charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults$1.charsetSentinel, 34759 delimiter: typeof opts.delimiter === "undefined" ? defaults$1.delimiter : opts.delimiter, 34760 encode: typeof opts.encode === "boolean" ? opts.encode : defaults$1.encode, 34761 encoder: typeof opts.encoder === "function" ? opts.encoder : defaults$1.encoder, 34762 encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly, 34763 filter, 34764 format: format2, 34765 formatter, 34766 serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults$1.serializeDate, 34767 skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults$1.skipNulls, 34768 sort: typeof opts.sort === "function" ? opts.sort : null, 34769 strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults$1.strictNullHandling 34770 }; 34771}; 34772var stringify_1 = function(object, opts) { 34773 var obj = object; 34774 var options = normalizeStringifyOptions(opts); 34775 var objKeys; 34776 var filter; 34777 if (typeof options.filter === "function") { 34778 filter = options.filter; 34779 obj = filter("", obj); 34780 } else if (isArray$1(options.filter)) { 34781 filter = options.filter; 34782 objKeys = filter; 34783 } 34784 var keys = []; 34785 if (typeof obj !== "object" || obj === null) { 34786 return ""; 34787 } 34788 var arrayFormat; 34789 if (opts && opts.arrayFormat in arrayPrefixGenerators) { 34790 arrayFormat = opts.arrayFormat; 34791 } else if (opts && "indices" in opts) { 34792 arrayFormat = opts.indices ? "indices" : "repeat"; 34793 } else { 34794 arrayFormat = "indices"; 34795 } 34796 var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; 34797 if (!objKeys) { 34798 objKeys = Object.keys(obj); 34799 } 34800 if (options.sort) { 34801 objKeys.sort(options.sort); 34802 } 34803 for (var i2 = 0; i2 < objKeys.length; ++i2) { 34804 var key2 = objKeys[i2]; 34805 if (options.skipNulls && obj[key2] === null) { 34806 continue; 34807 } 34808 pushToArray(keys, stringify$1( 34809 obj[key2], 34810 key2, 34811 generateArrayPrefix, 34812 options.strictNullHandling, 34813 options.skipNulls, 34814 options.encode ? options.encoder : null, 34815 options.filter, 34816 options.sort, 34817 options.allowDots, 34818 options.serializeDate, 34819 options.format, 34820 options.formatter, 34821 options.encodeValuesOnly, 34822 options.charset 34823 )); 34824 } 34825 var joined = keys.join(options.delimiter); 34826 var prefix = options.addQueryPrefix === true ? "?" : ""; 34827 if (options.charsetSentinel) { 34828 if (options.charset === "iso-8859-1") { 34829 prefix += "utf8=%26%2310003%3B&"; 34830 } else { 34831 prefix += "utf8=%E2%9C%93&"; 34832 } 34833 } 34834 return joined.length > 0 ? prefix + joined : ""; 34835}; 34836var utils = utils$2; 34837var has = Object.prototype.hasOwnProperty; 34838var isArray = Array.isArray; 34839var defaults2 = { 34840 allowDots: false, 34841 allowPrototypes: false, 34842 arrayLimit: 20, 34843 charset: "utf-8", 34844 charsetSentinel: false, 34845 comma: false, 34846 decoder: utils.decode, 34847 delimiter: "&", 34848 depth: 5, 34849 ignoreQueryPrefix: false, 34850 interpretNumericEntities: false, 34851 parameterLimit: 1e3, 34852 parseArrays: true, 34853 plainObjects: false, 34854 strictNullHandling: false 34855}; 34856var interpretNumericEntities = function(str) { 34857 return str.replace(/&#(\d+);/g, function($0, numberStr) { 34858 return String.fromCharCode(parseInt(numberStr, 10)); 34859 }); 34860}; 34861var parseArrayValue = function(val, options) { 34862 if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) { 34863 return val.split(","); 34864 } 34865 return val; 34866}; 34867var isoSentinel = "utf8=%26%2310003%3B"; 34868var charsetSentinel = "utf8=%E2%9C%93"; 34869var parseValues = function parseQueryStringValues(str, options) { 34870 var obj = {}; 34871 var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str; 34872 var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit; 34873 var parts = cleanStr.split(options.delimiter, limit); 34874 var skipIndex = -1; 34875 var i2; 34876 var charset = options.charset; 34877 if (options.charsetSentinel) { 34878 for (i2 = 0; i2 < parts.length; ++i2) { 34879 if (parts[i2].indexOf("utf8=") === 0) { 34880 if (parts[i2] === charsetSentinel) { 34881 charset = "utf-8"; 34882 } else if (parts[i2] === isoSentinel) { 34883 charset = "iso-8859-1"; 34884 } 34885 skipIndex = i2; 34886 i2 = parts.length; 34887 } 34888 } 34889 } 34890 for (i2 = 0; i2 < parts.length; ++i2) { 34891 if (i2 === skipIndex) { 34892 continue; 34893 } 34894 var part = parts[i2]; 34895 var bracketEqualsPos = part.indexOf("]="); 34896 var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1; 34897 var key2, val; 34898 if (pos === -1) { 34899 key2 = options.decoder(part, defaults2.decoder, charset, "key"); 34900 val = options.strictNullHandling ? null : ""; 34901 } else { 34902 key2 = options.decoder(part.slice(0, pos), defaults2.decoder, charset, "key"); 34903 val = utils.maybeMap( 34904 parseArrayValue(part.slice(pos + 1), options), 34905 function(encodedVal) { 34906 return options.decoder(encodedVal, defaults2.decoder, charset, "value"); 34907 } 34908 ); 34909 } 34910 if (val && options.interpretNumericEntities && charset === "iso-8859-1") { 34911 val = interpretNumericEntities(val); 34912 } 34913 if (part.indexOf("[]=") > -1) { 34914 val = isArray(val) ? [val] : val; 34915 } 34916 if (has.call(obj, key2)) { 34917 obj[key2] = utils.combine(obj[key2], val); 34918 } else { 34919 obj[key2] = val; 34920 } 34921 } 34922 return obj; 34923}; 34924var parseObject = function(chain, val, options, valuesParsed) { 34925 var leaf = valuesParsed ? val : parseArrayValue(val, options); 34926 for (var i2 = chain.length - 1; i2 >= 0; --i2) { 34927 var obj; 34928 var root = chain[i2]; 34929 if (root === "[]" && options.parseArrays) { 34930 obj = [].concat(leaf); 34931 } else { 34932 obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; 34933 var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root; 34934 var index3 = parseInt(cleanRoot, 10); 34935 if (!options.parseArrays && cleanRoot === "") { 34936 obj = { 0: leaf }; 34937 } else if (!isNaN(index3) && root !== cleanRoot && String(index3) === cleanRoot && index3 >= 0 && (options.parseArrays && index3 <= options.arrayLimit)) { 34938 obj = []; 34939 obj[index3] = leaf; 34940 } else if (cleanRoot !== "__proto__") { 34941 obj[cleanRoot] = leaf; 34942 } 34943 } 34944 leaf = obj; 34945 } 34946 return leaf; 34947}; 34948var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { 34949 if (!givenKey) { 34950 return; 34951 } 34952 var key2 = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; 34953 var brackets2 = /(\[[^[\]]*])/; 34954 var child = /(\[[^[\]]*])/g; 34955 var segment = options.depth > 0 && brackets2.exec(key2); 34956 var parent = segment ? key2.slice(0, segment.index) : key2; 34957 var keys = []; 34958 if (parent) { 34959 if (!options.plainObjects && has.call(Object.prototype, parent)) { 34960 if (!options.allowPrototypes) { 34961 return; 34962 } 34963 } 34964 keys.push(parent); 34965 } 34966 var i2 = 0; 34967 while (options.depth > 0 && (segment = child.exec(key2)) !== null && i2 < options.depth) { 34968 i2 += 1; 34969 if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { 34970 if (!options.allowPrototypes) { 34971 return; 34972 } 34973 } 34974 keys.push(segment[1]); 34975 } 34976 if (segment) { 34977 keys.push("[" + key2.slice(segment.index) + "]"); 34978 } 34979 return parseObject(keys, val, options, valuesParsed); 34980}; 34981var normalizeParseOptions = function normalizeParseOptions2(opts) { 34982 if (!opts) { 34983 return defaults2; 34984 } 34985 if (opts.decoder !== null && opts.decoder !== void 0 && typeof opts.decoder !== "function") { 34986 throw new TypeError("Decoder has to be a function."); 34987 } 34988 if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { 34989 throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); 34990 } 34991 var charset = typeof opts.charset === "undefined" ? defaults2.charset : opts.charset; 34992 return { 34993 allowDots: typeof opts.allowDots === "undefined" ? defaults2.allowDots : !!opts.allowDots, 34994 allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults2.allowPrototypes, 34995 arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults2.arrayLimit, 34996 charset, 34997 charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults2.charsetSentinel, 34998 comma: typeof opts.comma === "boolean" ? opts.comma : defaults2.comma, 34999 decoder: typeof opts.decoder === "function" ? opts.decoder : defaults2.decoder, 35000 delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults2.delimiter, 35001 // eslint-disable-next-line no-implicit-coercion, no-extra-parens 35002 depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults2.depth, 35003 ignoreQueryPrefix: opts.ignoreQueryPrefix === true, 35004 interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults2.interpretNumericEntities, 35005 parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults2.parameterLimit, 35006 parseArrays: opts.parseArrays !== false, 35007 plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults2.plainObjects, 35008 strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults2.strictNullHandling 35009 }; 35010}; 35011var parse$1 = function(str, opts) { 35012 var options = normalizeParseOptions(opts); 35013 if (str === "" || str === null || typeof str === "undefined") {
35014 return options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; 35015 } 35016 var tempObj = typeof str === "string" ? parseValues(str, options) : str; 35017 var obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; 35018 var keys = Object.keys(tempObj); 35019 for (var i2 = 0; i2 < keys.length; ++i2) { 35020 var key2 = keys[i2]; 35021 var newObj = parseKeys(key2, tempObj[key2], options, typeof str === "string"); 35022 obj = utils.merge(obj, newObj, options); 35023 } 35024 return utils.compact(obj); 35025}; 35026var stringify2 = stringify_1; 35027var parse = parse$1; 35028var formats = formats$3; 35029var lib = { 35030 formats, 35031 parse, 35032 stringify: stringify2 35033}; 35034const qs = /* @__PURE__ */ getDefaultExportFromCjs(lib); 35035function _typeof$x(obj) { 35036 "@babel/helpers - typeof"; 35037 return _typeof$x = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 35038 return typeof obj2; 35039 } : function(obj2) { 35040 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 35041 }, _typeof$x(obj); 35042} 35043function _classCallCheck$7(instance, Constructor) { 35044 if (!(instance instanceof Constructor)) { 35045 throw new TypeError("Cannot call a class as a function"); 35046 } 35047} 35048function _defineProperties$8(target, props) { 35049 for (var i2 = 0; i2 < props.length; i2++) { 35050 var descriptor = props[i2]; 35051 descriptor.enumerable = descriptor.enumerable || false; 35052 descriptor.configurable = true; 35053 if ("value" in descriptor) descriptor.writable = true; 35054 Object.defineProperty(target, _toPropertyKey$x(descriptor.key), descriptor); 35055 } 35056} 35057function _createClass$9(Constructor, protoProps, staticProps) { 35058 if (protoProps) _defineProperties$8(Constructor.prototype, protoProps); 35059 Object.defineProperty(Constructor, "prototype", { writable: false }); 35060 return Constructor; 35061} 35062function _defineProperty$x(obj, key2, value) { 35063 key2 = _toPropertyKey$x(key2); 35064 if (key2 in obj) { 35065 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 35066 } else { 35067 obj[key2] = value; 35068 } 35069 return obj; 35070} 35071function _toPropertyKey$x(arg) { 35072 var key2 = _toPrimitive$x(arg, "string"); 35073 return _typeof$x(key2) === "symbol" ? key2 : String(key2); 35074} 35075function _toPrimitive$x(input, hint) { 35076 if (_typeof$x(input) !== "object" || input === null) return input; 35077 var prim = input[Symbol.toPrimitive]; 35078 if (prim !== void 0) { 35079 var res = prim.call(input, hint || "default"); 35080 if (_typeof$x(res) !== "object") return res; 35081 throw new TypeError("@@toPrimitive must return a primitive value."); 35082 } 35083 return (hint === "string" ? String : Number)(input); 35084} 35085var setWindowTitle = function setWindowTitle2(title) { 35086 if (title) { 35087 window.document.title = title; 35088 } 35089}; 35090var BrowserHistory = /* @__PURE__ */ function() { 35091 function BrowserHistory2(_ref) { 35092 var _this = this; 35093 var windowTitle = _ref.windowTitle, _ref$writeDelay = _ref.writeDelay, writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay, createURL = _ref.createURL, parseURL = _ref.parseURL, getLocation = _ref.getLocation, start2 = _ref.start, dispose = _ref.dispose, push2 = _ref.push, cleanUrlOnDispose = _ref.cleanUrlOnDispose; 35094 _classCallCheck$7(this, BrowserHistory2); 35095 _defineProperty$x(this, "$$type", "ais.browser"); 35096 _defineProperty$x(this, "windowTitle", void 0); 35097 _defineProperty$x(this, "writeDelay", void 0); 35098 _defineProperty$x(this, "_createURL", void 0); 35099 _defineProperty$x(this, "parseURL", void 0); 35100 _defineProperty$x(this, "getLocation", void 0); 35101 _defineProperty$x(this, "writeTimer", void 0); 35102 _defineProperty$x(this, "_onPopState", void 0); 35103 _defineProperty$x(this, "inPopState", false); 35104 _defineProperty$x(this, "isDisposed", false); 35105 _defineProperty$x(this, "latestAcknowledgedHistory", 0); 35106 _defineProperty$x(this, "_start", void 0); 35107 _defineProperty$x(this, "_dispose", void 0); 35108 _defineProperty$x(this, "_push", void 0); 35109 _defineProperty$x(this, "_cleanUrlOnDispose", void 0); 35110 this.windowTitle = windowTitle; 35111 this.writeTimer = void 0; 35112 this.writeDelay = writeDelay; 35113 this._createURL = createURL; 35114 this.parseURL = parseURL; 35115 this.getLocation = getLocation; 35116 this._start = start2; 35117 this._dispose = dispose; 35118 this._push = push2; 35119 this._cleanUrlOnDispose = typeof cleanUrlOnDispose === "undefined" ? true : cleanUrlOnDispose; 35120 safelyRunOnBrowser(function(_ref22) { 35121 var window2 = _ref22.window; 35122 var title = _this.windowTitle && _this.windowTitle(_this.read()); 35123 setWindowTitle(title); 35124 _this.latestAcknowledgedHistory = window2.history.length; 35125 }); 35126 } 35127 _createClass$9(BrowserHistory2, [{ 35128 key: "read", 35129 value: function read() { 35130 return this.parseURL({ 35131 qsModule: qs, 35132 location: this.getLocation() 35133 }); 35134 } 35135 /** 35136 * Pushes a search state into the URL. 35137 */ 35138 }, { 35139 key: "write", 35140 value: function write(routeState) { 35141 var _this2 = this; 35142 safelyRunOnBrowser(function(_ref3) { 35143 var window2 = _ref3.window; 35144 var url = _this2.createURL(routeState); 35145 var title = _this2.windowTitle && _this2.windowTitle(routeState); 35146 if (_this2.writeTimer) { 35147 clearTimeout(_this2.writeTimer); 35148 } 35149 _this2.writeTimer = setTimeout(function() { 35150 setWindowTitle(title); 35151 if (_this2.shouldWrite(url)) { 35152 if (_this2._push) { 35153 _this2._push(url); 35154 } else { 35155 window2.history.pushState(routeState, title || "", url); 35156 } 35157 _this2.latestAcknowledgedHistory = window2.history.length; 35158 } 35159 _this2.inPopState = false;
vendor: 4,483 bytes, lines 35160-35277
35160 _this2.writeTimer = void 0; 35161 }, _this2.writeDelay); 35162 }); 35163 } 35164 /** 35165 * Sets a callback on the `onpopstate` event of the history API of the current page. 35166 * It enables the URL sync to keep track of the changes. 35167 */ 35168 }, { 35169 key: "onUpdate", 35170 value: function onUpdate(callback) { 35171 var _this3 = this; 35172 if (this._start) { 35173 this._start(function() { 35174 callback(_this3.read()); 35175 }); 35176 } 35177 this._onPopState = function() { 35178 if (_this3.writeTimer) { 35179 clearTimeout(_this3.writeTimer); 35180 _this3.writeTimer = void 0; 35181 } 35182 _this3.inPopState = true; 35183 callback(_this3.read()); 35184 }; 35185 safelyRunOnBrowser(function(_ref42) { 35186 var window2 = _ref42.window; 35187 window2.addEventListener("popstate", _this3._onPopState); 35188 }); 35189 } 35190 /** 35191 * Creates a complete URL from a given syncable UI state. 35192 * 35193 * It always generates the full URL, not a relative one. 35194 * This allows to handle cases like using a <base href>. 35195 * See: https://github.com/algolia/instantsearch/issues/790 35196 */ 35197 }, { 35198 key: "createURL", 35199 value: function createURL(routeState) { 35200 var url = this._createURL({ 35201 qsModule: qs, 35202 routeState, 35203 location: this.getLocation() 35204 }); 35205 return url; 35206 } 35207 /** 35208 * Removes the event listener and cleans up the URL. 35209 */ 35210 }, { 35211 key: "dispose", 35212 value: function dispose() { 35213 var _this4 = this; 35214 if (this._dispose) { 35215 this._dispose(); 35216 } 35217 this.isDisposed = true; 35218 safelyRunOnBrowser(function(_ref5) { 35219 var window2 = _ref5.window; 35220 if (_this4._onPopState) { 35221 window2.removeEventListener("popstate", _this4._onPopState); 35222 } 35223 }); 35224 if (this.writeTimer) { 35225 clearTimeout(this.writeTimer); 35226 } 35227 if (this._cleanUrlOnDispose) { 35228 this.write({}); 35229 } 35230 } 35231 }, { 35232 key: "start", 35233 value: function start2() { 35234 this.isDisposed = false; 35235 } 35236 }, { 35237 key: "shouldWrite", 35238 value: function shouldWrite(url) { 35239 var _this5 = this; 35240 return safelyRunOnBrowser(function(_ref62) { 35241 var window2 = _ref62.window; 35242 if (_this5.isDisposed && !_this5._cleanUrlOnDispose) { 35243 return false; 35244 } 35245 var lastPushWasByISAfterDispose = !(_this5.isDisposed && _this5.latestAcknowledgedHistory !== window2.history.length); 35246 return ( 35247 // When the last state change was through popstate, the IS.js state changes, 35248 // but that should not write the URL. 35249 !_this5.inPopState && // When the previous pushState after dispose was by IS.js, we want to write the URL. 35250 lastPushWasByISAfterDispose && // When the URL is the same as the current one, we do not want to write it. 35251 url !== window2.location.href 35252 ); 35253 }); 35254 } 35255 }]); 35256 return BrowserHistory2; 35257}(); 35258function historyRouter() { 35259 var _ref7 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref7$createURL = _ref7.createURL, createURL = _ref7$createURL === void 0 ? function(_ref8) { 35260 var qsModule = _ref8.qsModule, routeState = _ref8.routeState, location2 = _ref8.location; 35261 var protocol = location2.protocol, hostname = location2.hostname, _location$port = location2.port, port = _location$port === void 0 ? "" : _location$port, pathname = location2.pathname, hash = location2.hash; 35262 var queryString = qsModule.stringify(routeState); 35263 var portWithPrefix = port === "" ? "" : ":".concat(port); 35264 if (!queryString) { 35265 return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname).concat(hash); 35266 } 35267 return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname, "?").concat(queryString).concat(hash); 35268 } : _ref7$createURL, _ref7$parseURL = _ref7.parseURL, parseURL = _ref7$parseURL === void 0 ? function(_ref9) { 35269 var qsModule = _ref9.qsModule, location2 = _ref9.location; 35270 return qsModule.parse(location2.search.slice(1), { 35271 arrayLimit: 99 35272 }); 35273 } : _ref7$parseURL, _ref7$writeDelay = _ref7.writeDelay, writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay, windowTitle = _ref7.windowTitle, _ref7$getLocation = _ref7.getLocation, getLocation = _ref7$getLocation === void 0 ? function() { 35274 return safelyRunOnBrowser(function(_ref10) { 35275 var window2 = _ref10.window; 35276 return window2.location; 35277 }, {
35278 fallback: function fallback() { 35279 throw new Error("You need to provide `getLocation` to the `history` router in environments where `window` does not exist."); 35280 } 35281 }); 35282 } : _ref7$getLocation, start2 = _ref7.start, dispose = _ref7.dispose, push2 = _ref7.push, cleanUrlOnDispose = _ref7.cleanUrlOnDispose; 35283 return new BrowserHistory({ 35284 createURL, 35285 parseURL, 35286 writeDelay, 35287 windowTitle, 35288 getLocation, 35289 start: start2, 35290 dispose, 35291 push: push2, 35292 cleanUrlOnDispose 35293 }); 35294} 35295function _typeof$w(obj) { 35296 "@babel/helpers - typeof"; 35297 return _typeof$w = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 35298 return typeof obj2; 35299 } : function(obj2) { 35300 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 35301 }, _typeof$w(obj); 35302} 35303var _excluded$e = ["configure"]; 35304function ownKeys$r(object, enumerableOnly) { 35305 var keys = Object.keys(object); 35306 if (Object.getOwnPropertySymbols) { 35307 var symbols = Object.getOwnPropertySymbols(object); 35308 enumerableOnly && (symbols = symbols.filter(function(sym) { 35309 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 35310 })), keys.push.apply(keys, symbols); 35311 } 35312 return keys; 35313} 35314function _objectSpread$r(target) { 35315 for (var i2 = 1; i2 < arguments.length; i2++) { 35316 var source = null != arguments[i2] ? arguments[i2] : {}; 35317 i2 % 2 ? ownKeys$r(Object(source), true).forEach(function(key2) { 35318 _defineProperty$w(target, key2, source[key2]); 35319 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$r(Object(source)).forEach(function(key2) { 35320 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 35321 }); 35322 } 35323 return target; 35324} 35325function _defineProperty$w(obj, key2, value) { 35326 key2 = _toPropertyKey$w(key2); 35327 if (key2 in obj) { 35328 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 35329 } else { 35330 obj[key2] = value; 35331 } 35332 return obj; 35333} 35334function _toPropertyKey$w(arg) { 35335 var key2 = _toPrimitive$w(arg, "string"); 35336 return _typeof$w(key2) === "symbol" ? key2 : String(key2); 35337} 35338function _toPrimitive$w(input, hint) { 35339 if (_typeof$w(input) !== "object" || input === null) return input; 35340 var prim = input[Symbol.toPrimitive]; 35341 if (prim !== void 0) { 35342 var res = prim.call(input, hint || "default"); 35343 if (_typeof$w(res) !== "object") return res; 35344 throw new TypeError("@@toPrimitive must return a primitive value."); 35345 } 35346 return (hint === "string" ? String : Number)(input); 35347} 35348function _objectWithoutProperties$d(source, excluded) { 35349 if (source == null) return {}; 35350 var target = _objectWithoutPropertiesLoose$d(source, excluded); 35351 var key2, i2; 35352 if (Object.getOwnPropertySymbols) { 35353 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 35354 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 35355 key2 = sourceSymbolKeys[i2]; 35356 if (excluded.indexOf(key2) >= 0) continue; 35357 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 35358 target[key2] = source[key2]; 35359 } 35360 } 35361 return target; 35362} 35363function _objectWithoutPropertiesLoose$d(source, excluded) { 35364 if (source == null) return {}; 35365 var target = {}; 35366 var sourceKeys = Object.keys(source); 35367 var key2, i2; 35368 for (i2 = 0; i2 < sourceKeys.length; i2++) { 35369 key2 = sourceKeys[i2]; 35370 if (excluded.indexOf(key2) >= 0) continue; 35371 target[key2] = source[key2]; 35372 } 35373 return target; 35374} 35375function getIndexStateWithoutConfigure(uiState) { 35376 uiState.configure; 35377 var trackedUiState = _objectWithoutProperties$d(uiState, _excluded$e); 35378 return trackedUiState; 35379} 35380function simpleStateMapping() { 35381 return { 35382 $$type: "ais.simple", 35383 stateToRoute: function stateToRoute(uiState) { 35384 return Object.keys(uiState).reduce(function(state, indexId) { 35385 return _objectSpread$r(_objectSpread$r({}, state), {}, _defineProperty$w({}, indexId, getIndexStateWithoutConfigure(uiState[indexId]))); 35386 }, {}); 35387 }, 35388 routeToState: function routeToState() { 35389 var routeState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 35390 return Object.keys(routeState).reduce(function(state, indexId) { 35391 return _objectSpread$r(_objectSpread$r({}, state), {}, _defineProperty$w({}, indexId, getIndexStateWithoutConfigure(routeState[indexId]))); 35392 }, {}); 35393 } 35394 }; 35395} 35396function _typeof$v(obj) { 35397 "@babel/helpers - typeof"; 35398 return _typeof$v = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 35399 return typeof obj2; 35400 } : function(obj2) { 35401 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 35402 }, _typeof$v(obj); 35403} 35404function ownKeys$q(object, enumerableOnly) { 35405 var keys = Object.keys(object); 35406 if (Object.getOwnPropertySymbols) { 35407 var symbols = Object.getOwnPropertySymbols(object); 35408 enumerableOnly && (symbols = symbols.filter(function(sym) { 35409 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 35410 })), keys.push.apply(keys, symbols); 35411 } 35412 return keys; 35413} 35414function _objectSpread$q(target) { 35415 for (var i2 = 1; i2 < arguments.length; i2++) { 35416 var source = null != arguments[i2] ? arguments[i2] : {}; 35417 i2 % 2 ? ownKeys$q(Object(source), true).forEach(function(key2) { 35418 _defineProperty$v(target, key2, source[key2]); 35419 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$q(Object(source)).forEac
35419h(function(key2) { 35420 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 35421 }); 35422 } 35423 return target; 35424} 35425function _defineProperty$v(obj, key2, value) { 35426 key2 = _toPropertyKey$v(key2); 35427 if (key2 in obj) { 35428 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 35429 } else { 35430 obj[key2] = value; 35431 } 35432 return obj; 35433} 35434function _toPropertyKey$v(arg) { 35435 var key2 = _toPrimitive$v(arg, "string"); 35436 return _typeof$v(key2) === "symbol" ? key2 : String(key2); 35437} 35438function _toPrimitive$v(input, hint) { 35439 if (_typeof$v(input) !== "object" || input === null) return input; 35440 var prim = input[Symbol.toPrimitive]; 35441 if (prim !== void 0) { 35442 var res = prim.call(input, hint || "default"); 35443 if (_typeof$v(res) !== "object") return res; 35444 throw new TypeError("@@toPrimitive must return a primitive value."); 35445 } 35446 return (hint === "string" ? String : Number)(input); 35447} 35448var createRouterMiddleware = function createRouterMiddleware2() { 35449 var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 35450 var _props$router = props.router, router = _props$router === void 0 ? historyRouter() : _props$router, _props$stateMapping = props.stateMapping, stateMapping = _props$stateMapping === void 0 ? simpleStateMapping() : _props$stateMapping, _props$$$internal = props.$$internal, $$internal = _props$$$internal === void 0 ? false : _props$$$internal; 35451 return function(_ref) { 35452 var instantSearchInstance = _ref.instantSearchInstance; 35453 function topLevelCreateURL(nextState) { 35454 var previousUiState = ( 35455 // If only the mainIndex is initialized, we don't yet know what other 35456 // index widgets are used. Therefore we fall back to the initialUiState. 35457 // We can't indiscriminately use the initialUiState because then we 35458 // reintroduce state that was changed by the user. 35459 // When there are no widgets, we are sure the user can't yet have made 35460 // any changes. 35461 instantSearchInstance.mainIndex.getWidgets().length === 0 ? instantSearchInstance._initialUiState : instantSearchInstance.mainIndex.getWidgetUiState({}) 35462 ); 35463 var uiState = Object.keys(nextState).reduce(function(acc, indexId) { 35464 return _objectSpread$q(_objectSpread$q({}, acc), {}, _defineProperty$v({}, indexId, nextState[indexId])); 35465 }, previousUiState); 35466 var route = stateMapping.stateToRoute(uiState); 35467 return router.createURL(route); 35468 } 35469 instantSearchInstance._createURL = topLevelCreateURL; 35470 var lastRouteState = void 0; 35471 var initialUiState = instantSearchInstance._initialUiState; 35472 return { 35473 $$type: "ais.router({router:".concat(router.$$type || "__unknown__", ", stateMapping:").concat(stateMapping.$$type || "__unknown__", "})"), 35474 $$internal, 35475 onStateChange: function onStateChange(_ref22) { 35476 var uiState = _ref22.uiState; 35477 var routeState = stateMapping.stateToRoute(uiState); 35478 if (lastRouteState === void 0 || !isEqual(lastRouteState, routeState)) { 35479 router.write(routeState); 35480 lastRouteState = routeState; 35481 } 35482 }, 35483 subscribe: function subscribe() { 35484 instantSearchInstance._initialUiState = _objectSpread$q(_objectSpread$q({}, initialUiState), stateMapping.routeToState(router.read())); 35485 router.onUpdate(function(route) { 35486 if (instantSearchInstance.mainIndex.getWidgets().length > 0) { 35487 instantSearchInstance.setUiState(stateMapping.routeToState(route)); 35488 } 35489 }); 35490 }, 35491 started: function started() { 35492 var _router$start; 35493 (_router$start = router.start) === null || _router$start === void 0 ? void 0 : _router$start.call(router); 35494 }, 35495 unsubscribe: function unsubscribe() { 35496 router.dispose(); 35497 } 35498 }; 35499 }; 35500}; 35501function _typeof$u(obj) { 35502 "@babel/helpers - typeof"; 35503 return _typeof$u = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 35504 return typeof obj2; 35505 } : function(obj2) { 35506 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 35507 }, _typeof$u(obj); 35508} 35509var _excluded$d = ["initialSearchParameters"], _excluded2$3 = ["initialRecommendParameters"]; 35510function ownKeys$p(object, enumerableOnly) { 35511 var keys = Object.keys(object); 35512 if (Object.getOwnPropertySymbols) { 35513 var symbols = Object.getOwnPropertySymbols(object); 35514 enumerableOnly && (symbols = symbols.filter(function(sym) { 35515 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 35516 })), keys.push.apply(keys, symbols); 35517 } 35518 return keys; 35519} 35520function _objectSpread$p(target) { 35521 for (var i2 = 1; i2 < arguments.length; i2++) { 35522 var source = null != arguments[i2] ? arguments[i2] : {}; 35523 i2 % 2 ? ownKeys$p(Object(source), true).forEach(function(key2) { 35524 _defineProperty$u(target, key2, source[key2]); 35525 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$p(Object(source)).forEac
35525h(function(key2) { 35526 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 35527 }); 35528 } 35529 return target; 35530} 35531function _defineProperty$u(obj, key2, value) { 35532 key2 = _toPropertyKey$u(key2); 35533 if (key2 in obj) { 35534 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 35535 } else { 35536 obj[key2] = value; 35537 } 35538 return obj; 35539} 35540function _toPropertyKey$u(arg) { 35541 var key2 = _toPrimitive$u(arg, "string"); 35542 return _typeof$u(key2) === "symbol" ? key2 : String(key2); 35543} 35544function _toPrimitive$u(input, hint) { 35545 if (_typeof$u(input) !== "object" || input === null) return input; 35546 var prim = input[Symbol.toPrimitive]; 35547 if (prim !== void 0) { 35548 var res = prim.call(input, hint || "default"); 35549 if (_typeof$u(res) !== "object") return res; 35550 throw new TypeError("@@toPrimitive must return a primitive value."); 35551 } 35552 return (hint === "string" ? String : Number)(input); 35553} 35554function _toConsumableArray$4(arr) { 35555 return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$4(); 35556} 35557function _nonIterableSpread$4() { 35558 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 35559} 35560function _unsupportedIterableToArray$6(o2, minLen) { 35561 if (!o2) return; 35562 if (typeof o2 === "string") return _arrayLikeToArray$6(o2, minLen); 35563 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 35564 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 35565 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 35566 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$6(o2, minLen); 35567} 35568function _iterableToArray$4(iter) { 35569 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 35570} 35571function _arrayWithoutHoles$4(arr) { 35572 if (Array.isArray(arr)) return _arrayLikeToArray$6(arr); 35573} 35574function _arrayLikeToArray$6(arr, len2) { 35575 if (len2 == null || len2 > arr.length) len2 = arr.length; 35576 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 35577 return arr2; 35578} 35579function _objectWithoutProperties$c(source, excluded) { 35580 if (source == null) return {}; 35581 var target = _objectWithoutPropertiesLoose$c(source, excluded); 35582 var key2, i2; 35583 if (Object.getOwnPropertySymbols) { 35584 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 35585 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 35586 key2 = sourceSymbolKeys[i2]; 35587 if (excluded.indexOf(key2) >= 0) continue; 35588 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 35589 target[key2] = source[key2]; 35590 } 35591 } 35592 return target; 35593} 35594function _objectWithoutPropertiesLoose$c(source, excluded) { 35595 if (source == null) return {}; 35596 var target = {}; 35597 var sourceKeys = Object.keys(source); 35598 var key2, i2; 35599 for (i2 = 0; i2 < sourceKeys.length; i2++) { 35600 key2 = sourceKeys[i2]; 35601 if (excluded.indexOf(key2) >= 0) continue; 35602 target[key2] = source[key2]; 35603 } 35604 return target; 35605} 35606var withUsage$g = createDocumentationMessageGenerator({ 35607 name: "index-widget" 35608}); 35609function privateHelperSetState(helper, _ref) { 35610 var state = _ref.state, recommendState = _ref.recommendState, isPageReset = _ref.isPageReset, _uiState = _ref._uiState; 35611 if (state !== helper.state) { 35612 helper.state = state; 35613 helper.emit("change", { 35614 state: helper.state, 35615 results: helper.lastResults, 35616 isPageReset, 35617 _uiState 35618 }); 35619 } 35620 if (recommendState !== helper.recommendState) { 35621 helper.recommendState = recommendState; 35622 } 35623} 35624function getLocalWidgetsUiState(widgets, widgetStateOptions) { 35625 var initialUiState = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 35626 return widgets.reduce(function(uiState, widget) { 35627 if (isIndexWidget(widget)) { 35628 return uiState; 35629 } 35630 if (!widget.getWidgetUiState && !widget.getWidgetState) { 35631 return uiState; 35632 } 35633 if (widget.getWidgetUiState) { 35634 return widget.getWidgetUiState(uiState, widgetStateOptions); 35635 } 35636 return widget.getWidgetState(uiState, widgetStateOptions); 35637 }, initialUiState); 35638} 35639function getLocalWidgetsSearchParameters(widgets, widgetSearchParametersOptions) { 35640 var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters, rest = _objectWithoutProperties$c(widgetSearchParametersOptions, _excluded$d); 35641 return widgets.reduce(function(state, widget) { 35642 if (!widget.getWidgetSearchParameters || isIndexWidget(widget)) { 35643 return state; 35644 }
35645 if (widget.dependsOn === "search" && widget.getWidgetParameters) { 35646 return widget.getWidgetParameters(state, rest); 35647 } 35648 return widget.getWidgetSearchParameters(state, rest); 35649 }, initialSearchParameters); 35650} 35651function getLocalWidgetsRecommendParameters(widgets, widgetRecommendParametersOptions) { 35652 var initialRecommendParameters = widgetRecommendParametersOptions.initialRecommendParameters, rest = _objectWithoutProperties$c(widgetRecommendParametersOptions, _excluded2$3); 35653 return widgets.reduce(function(state, widget) { 35654 if (!isIndexWidget(widget) && widget.dependsOn === "recommend" && widget.getWidgetParameters) { 35655 return widget.getWidgetParameters(state, rest); 35656 } 35657 return state; 35658 }, initialRecommendParameters); 35659} 35660function resetPageFromWidgets(widgets) { 35661 var indexWidgets = widgets.filter(isIndexWidget); 35662 if (indexWidgets.length === 0) { 35663 return; 35664 } 35665 indexWidgets.forEach(function(widget) { 35666 var widgetHelper = widget.getHelper(); 35667 privateHelperSetState(widgetHelper, { 35668 state: widgetHelper.state.resetPage(), 35669 recommendState: widgetHelper.recommendState, 35670 isPageReset: true 35671 }); 35672 resetPageFromWidgets(widget.getWidgets()); 35673 }); 35674} 35675function resolveScopedResultsFromWidgets(widgets) { 35676 var indexWidgets = widgets.filter(isIndexWidget); 35677 return indexWidgets.reduce(function(scopedResults, current) { 35678 return scopedResults.concat.apply(scopedResults, [{ 35679 indexId: current.getIndexId(), 35680 results: current.getResults(), 35681 helper: current.getHelper() 35682 }].concat(_toConsumableArray$4(resolveScopedResultsFromWidgets(current.getWidgets())))); 35683 }, []); 35684} 35685var index = function index2(widgetParams) { 35686 if (widgetParams === void 0 || widgetParams.indexName === void 0) { 35687 throw new Error(withUsage$g("The `indexName` option is required.")); 35688 } 35689 var indexName = widgetParams.indexName, _widgetParams$indexId = widgetParams.indexId, indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId; 35690 var localWidgets = []; 35691 var localUiState = {}; 35692 var localInstantSearchInstance = null; 35693 var localParent = null; 35694 var helper = null; 35695 var derivedHelper = null; 35696 var lastValidSearchParameters = null; 35697 var hasRecommendWidget = false; 35698 var hasSearchWidget = false; 35699 return { 35700 $$type: "ais.index", 35701 $$widgetType: "ais.index", 35702 getIndexName: function getIndexName() { 35703 return indexName; 35704 }, 35705 getIndexId: function getIndexId() { 35706 return indexId; 35707 }, 35708 getHelper: function getHelper() { 35709 return helper; 35710 }, 35711 getResults: function getResults() { 35712 var _derivedHelper; 35713 if (!((_derivedHelper = derivedHelper) !== null && _derivedHelper !== void 0 && _derivedHelper.lastResults)) return null; 35714 derivedHelper.lastResults._state = helper.state; 35715 return derivedHelper.lastResults; 35716 }, 35717 getResultsForWidget: function getResultsForWidget(widget) { 35718 var _helper; 35719 if (widget.dependsOn !== "recommend" || isIndexWidget(widget) || widget.$$id === void 0) { 35720 return this.getResults(); 35721 } 35722 if (!((_helper = helper) !== null && _helper !== void 0 && _helper.lastRecommendResults)) { 35723 return null; 35724 } 35725 return helper.lastRecommendResults[widget.$$id]; 35726 }, 35727 getPreviousState: function getPreviousState() { 35728 return lastValidSearchParameters; 35729 }, 35730 getScopedResults: function getScopedResults() { 35731 var widgetParent = this.getParent(); 35732 var widgetSiblings; 35733 if (widgetParent) { 35734 widgetSiblings = widgetParent.getWidgets(); 35735 } else if (indexName.length === 0) { 35736 widgetSiblings = this.getWidgets(); 35737 } else { 35738 widgetSiblings = [this]; 35739 } 35740 return resolveScopedResultsFromWidgets(widgetSiblings); 35741 }, 35742 getParent: function getParent() { 35743 return localParent; 35744 }, 35745 createURL: function createURL(nextState) { 35746 if (typeof nextState === "function") { 35747 return localInstantSearchInstance._createURL(_defineProperty$u({}, indexId, nextState(localUiState))); 35748 } 35749 return localInstantSearchInstance._createURL(_defineProperty$u({}, indexId, getLocalWidgetsUiState(localWidgets, { 35750 searchParameters: nextState, 35751 helper 35752 }))); 35753 }, 35754 getWidgets: function getWidgets() { 35755 return localWidgets; 35756 },
35757 addWidgets: function addWidgets(widgets) { 35758 var _this = this; 35759 if (!Array.isArray(widgets)) { 35760 throw new Error(withUsage$g("The `addWidgets` method expects an array of widgets.")); 35761 } 35762 if (widgets.some(function(widget) { 35763 return typeof widget.init !== "function" && typeof widget.render !== "function"; 35764 })) { 35765 throw new Error(withUsage$g("The widget definition expects a `render` and/or an `init` method.")); 35766 } 35767 widgets.forEach(function(widget) { 35768 if (isIndexWidget(widget)) { 35769 return; 35770 } 35771 if (localInstantSearchInstance && widget.dependsOn === "recommend") { 35772 localInstantSearchInstance._hasRecommendWidget = true; 35773 } else if (localInstantSearchInstance) { 35774 localInstantSearchInstance._hasSearchWidget = true; 35775 } else if (widget.dependsOn === "recommend") { 35776 hasRecommendWidget = true; 35777 } else { 35778 hasSearchWidget = true; 35779 } 35780 addWidgetId(widget); 35781 }); 35782 localWidgets = localWidgets.concat(widgets); 35783 if (localInstantSearchInstance && Boolean(widgets.length)) { 35784 privateHelperSetState(helper, { 35785 state: getLocalWidgetsSearchParameters(localWidgets, { 35786 uiState: localUiState, 35787 initialSearchParameters: helper.state 35788 }), 35789 recommendState: getLocalWidgetsRecommendParameters(localWidgets, { 35790 uiState: localUiState, 35791 initialRecommendParameters: helper.recommendState 35792 }), 35793 _uiState: localUiState 35794 }); 35795 widgets.forEach(function(widget) { 35796 if (widget.getRenderState) { 35797 var renderState = widget.getRenderState(localInstantSearchInstance.renderState[_this.getIndexId()] || {}, createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState)); 35798 storeRenderState({ 35799 renderState, 35800 instantSearchInstance: localInstantSearchInstance, 35801 parent: _this 35802 }); 35803 } 35804 }); 35805 widgets.forEach(function(widget) { 35806 if (widget.init) { 35807 widget.init(createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState)); 35808 } 35809 }); 35810 localInstantSearchInstance.scheduleSearch(); 35811 } 35812 return this; 35813 }, 35814 removeWidgets: function removeWidgets(widgets) { 35815 var _this2 = this; 35816 if (!Array.isArray(widgets)) { 35817 throw new Error(withUsage$g("The `removeWidgets` method expects an array of widgets.")); 35818 } 35819 if (widgets.some(function(widget) { 35820 return typeof widget.dispose !== "function"; 35821 })) { 35822 throw new Error(withUsage$g("The widget definition expects a `dispose` method.")); 35823 } 35824 localWidgets = localWidgets.filter(function(widget) { 35825 return widgets.indexOf(widget) === -1; 35826 }); 35827 localWidgets.forEach(function(widget) { 35828 if (isIndexWidget(widget)) { 35829 return; 35830 } 35831 if (localInstantSearchInstance && widget.dependsOn === "recommend") { 35832 localInstantSearchInstance._hasRecommendWidget = true; 35833 } else if (localInstantSearchInstance) { 35834 localInstantSearchInstance._hasSearchWidget = true; 35835 } else if (widget.dependsOn === "recommend") { 35836 hasRecommendWidget = true; 35837 } else { 35838 hasSearchWidget = true; 35839 } 35840 }); 35841 if (localInstantSearchInstance && Boolean(widgets.length)) { 35842 var _widgets$reduce = widgets.reduce(function(states, widget) { 35843 var next2 = widget.dispose({ 35844 helper, 35845 state: states.cleanedSearchState, 35846 recommendState: states.cleanedRecommendState, 35847 parent: _this2 35848 }); 35849 if (next2 instanceof algoliasearchHelper$1.RecommendParameters) { 35850 states.cleanedRecommendState = next2; 35851 } else if (next2) { 35852 states.cleanedSearchState = next2; 35853 } 35854 return states; 35855 }, { 35856 cleanedSearchState: helper.state, 35857 cleanedRecommendState: helper.recommendState 35858 }), cleanedSearchState = _widgets$reduce.cleanedSearchState, cleanedRecommendState = _widgets$reduce.cleanedRecommendState; 35859 var newState = localInstantSearchInstance.future.preserveSharedStateOnUnmount ? getLocalWidgetsSearchParameters(localWidgets, { 35860 uiState: localUiState, 35861 initialSearchParameters: new algoliasearchHelper$1.SearchParameters({ 35862 index: this.getIndexName() 35863 }) 35864 }) : getLocalWidgetsSearchParameters(localWidgets, { 35865 uiState: getLocalWidgetsUiState(localWidgets, { 35866 searchParameters: cleanedSearchState, 35867 helper 35868 }), 35869 initialSearchParameters: cleanedSearchState 35870 }); 35871 localUiState = getLocalWidgetsUiState(localWidgets, { 35872 searchParameters: newState, 35873 helper 35874 }); 35875 helper.setState(newState); 35876 helper.recommendState = cleanedRecommendState; 35877 if (localWidgets.length) { 35878 localInstantSearchInstance.scheduleSearch(); 35879 } 35880 } 35881 return this; 35882 }, 35883 init: function init7(_ref22) { 35884 var _this3 = this, _instantSearchInstanc; 35885 var instantSearchInstance = _ref22.instantSearchInstance, parent = _ref22.parent, uiState = _ref22.uiState; 35886 if (helper !== null) { 35887 return; 35888 } 35889 localInstantSearchInstance = instantSearchInstance; 35890 localParent = parent; 35891 localUiState = uiState[indexId] || {}; 35892 var mainHelper = instantSearchInstance.mainHelper; 35893 var parameters = getLocalWidgetsSearchParameters(localWidgets, { 35894 uiState: localUiState, 35895 initialSearchParameters: new algoliasearchHelper$1.SearchParameters({ 35896 index: indexName 35897 }) 35898 }); 35899 var recommendParameters = getLocalWidgetsRecommendParameters(localWidgets, { 35900 uiState: localUiState, 35901 initialRecommendParameters: new algoliasearchHelper$1.RecommendParameters() 35902 }); 35903 helper = algoliasearchHelper$1({}, parameters.index, parameters); 35904 helper.recommendState = recommendParameters; 35905 helper.search = function() { 35906 if (instantSearchInstance.onStateChange) { 35907 instantSearchInstance.onStateChange({ 35908 uiState: instantSearchInstance.mainIndex.getWidgetUiState({}), 35909 setUiState: function setUiState(nextState) { 35910 return instantSearchInstance.setUiState(nextState, false); 35911 } 35912 }); 35913 return mainHelper; 35914 } 35915 return mainHelper.search(); 35916 }; 35917 helper.searchWithoutTriggeringOnStateChange = function() { 35918 return mainHelper.search(); 35919 }; 35920 helper.searchForFacetValues = function(facetName, facetValue, maxFacetHits, userState) { 35921 var state = helper.state.setQueryParameters(userState); 35922 return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state); 35923 }; 35924 derivedHelper = mainHelper.derive(function() { 35925 return mergeSearchParameters.apply(void 0, [mainHelper.state].concat(_toConsumableArray$4(resolveSearchParameters(_this3)))); 35926 }, function() { 35927 return _this3.getHelper().recommendState; 35928 }); 35929 var indexInitialResults = (_instantSearchInstanc = instantSearchInstance._initialResults) === null || _instantSearchInstanc === void 0 ? void 0 : _instantSearchInstanc[this.getIndexId()]; 35930 if (indexInitialResults !== null && indexInitialResults !== void 0 && indexInitialResults.results) { 35931 var results = new algoliasearchHelper$1.SearchResults(new algoliasearchHelper$1.SearchParameters(indexInitialResults.state), indexInitialResults.results); 35932 derivedHelper.lastResults = results; 35933 helper.lastResults = results; 35934 } 35935 if (indexInitialResults !== null && indexInitialResults !== void 0 && indexInitialResults.recommendResults) { 35936 var recommendResults = new algoliasearchHelper$1.RecommendResults(new algoliasearchHelper$1.RecommendParameters({ 35937 params: indexInitialResults.recommendResults.params 35938 }), indexInitialResults.recommendResults.results); 35939 derivedHelper.lastRecommendResults = recommendResults; 35940 helper.lastRecommendResults = recommendResults; 35941 } 35942 helper.on("change", function(_ref3) { 35943 var isPageReset = _ref3.isPageReset; 35944 if (isPageReset) {
35945 resetPageFromWidgets(localWidgets); 35946 } 35947 }); 35948 derivedHelper.on("search", function() { 35949 instantSearchInstance.scheduleStalledRender(); 35950 }); 35951 derivedHelper.on("result", function(_ref42) { 35952 var results2 = _ref42.results; 35953 instantSearchInstance.scheduleRender(); 35954 helper.lastResults = results2; 35955 lastValidSearchParameters = results2 === null || results2 === void 0 ? void 0 : results2._state; 35956 }); 35957 derivedHelper.on("recommend:result", function(_ref5) { 35958 var recommend = _ref5.recommend; 35959 instantSearchInstance.scheduleRender(); 35960 helper.lastRecommendResults = recommend.results; 35961 }); 35962 localWidgets.forEach(function(widget) { 35963 if (widget.getRenderState) { 35964 var renderState = widget.getRenderState(instantSearchInstance.renderState[_this3.getIndexId()] || {}, createInitArgs(instantSearchInstance, _this3, uiState)); 35965 storeRenderState({ 35966 renderState, 35967 instantSearchInstance, 35968 parent: _this3 35969 }); 35970 } 35971 }); 35972 localWidgets.forEach(function(widget) { 35973 if (widget.init) { 35974 widget.init(createInitArgs(instantSearchInstance, _this3, uiState)); 35975 } 35976 }); 35977 helper.on("change", function(event) { 35978 var state = event.state; 35979 var _uiState = event._uiState; 35980 localUiState = getLocalWidgetsUiState(localWidgets, { 35981 searchParameters: state, 35982 helper 35983 }, _uiState || {}); 35984 if (!instantSearchInstance.onStateChange) { 35985 instantSearchInstance.onInternalStateChange(); 35986 } 35987 }); 35988 if (indexInitialResults) { 35989 instantSearchInstance.scheduleRender(); 35990 } 35991 if (hasRecommendWidget) { 35992 instantSearchInstance._hasRecommendWidget = true; 35993 } 35994 if (hasSearchWidget) { 35995 instantSearchInstance._hasSearchWidget = true; 35996 } 35997 }, 35998 render: function render6(_ref62) { 35999 var _derivedHelper2, _this4 = this; 36000 var instantSearchInstance = _ref62.instantSearchInstance; 36001 if (instantSearchInstance.status === "error" && !instantSearchInstance.mainHelper.hasPendingRequests() && lastValidSearchParameters) { 36002 helper.setState(lastValidSearchParameters); 36003 } 36004 var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults ? localWidgets : localWidgets.filter(isIndexWidget); 36005 widgetsToRender = widgetsToRender.filter(function(widget) { 36006 if (!widget.shouldRender) { 36007 return true; 36008 } 36009 return widget.shouldRender({ 36010 instantSearchInstance 36011 }); 36012 }); 36013 widgetsToRender.forEach(function(widget) { 36014 if (widget.getRenderState) { 36015 var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4, widget)); 36016 storeRenderState({ 36017 renderState, 36018 instantSearchInstance, 36019 parent: _this4 36020 }); 36021 } 36022 }); 36023 widgetsToRender.forEach(function(widget) { 36024 if (widget.render) { 36025 widget.render(createRenderArgs(instantSearchInstance, _this4, widget)); 36026 } 36027 }); 36028 }, 36029 dispose: function dispose() { 36030 var _this5 = this, _helper2, _derivedHelper3; 36031 localWidgets.forEach(function(widget) { 36032 if (widget.dispose && helper) { 36033 widget.dispose({ 36034 helper, 36035 state: helper.state, 36036 recommendState: helper.recommendState, 36037 parent: _this5 36038 }); 36039 } 36040 }); 36041 localInstantSearchInstance = null; 36042 localParent = null; 36043 (_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.removeAllListeners(); 36044 helper = null; 36045 (_derivedHelper3 = derivedHelper) === null || _derivedHelper3 === void 0 ? void 0 : _derivedHelper3.detach(); 36046 derivedHelper = null; 36047 }, 36048 getWidgetUiState: function getWidgetUiState(uiState) { 36049 return localWidgets.filter(isIndexWidget).reduce(function(previousUiState, innerIndex) { 36050 return innerIndex.getWidgetUiState(previousUiState); 36051 }, _objectSpread$p(_objectSpread$p({}, uiState), {}, _defineProperty$u({}, indexId, _objectSpread$p(_objectSpread$p({}, uiState[indexId]), localUiState)))); 36052 }, 36053 getWidgetState: function getWidgetState(uiState) { 36054 return this.getWidgetUiState(uiState); 36055 }, 36056 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref7) { 36057 var uiState = _ref7.uiState; 36058 return getLocalWidgetsSearchParameters(localWidgets, { 36059 uiState, 36060 initialSearchParameters: searchParameters 36061 }); 36062 }, 36063 refreshUiState: function refreshUiState() { 36064 localUiState = getLocalWidgetsUiState(localWidgets, { 36065 searchParameters: this.getHelper().state, 36066 helper: this.getHelper() 36067 }, localUiState); 36068 }, 36069 setIndexUiState: function setIndexUiState(indexUiState) { 36070 var nextIndexUiState = typeof indexUiState === "function" ? indexUiState(localUiState) : indexUiState; 36071 localInstantSearchInstance.setUiState(function(state) { 36072 return _objectSpread$p(_objectSpread$p({}, state), {}, _defineProperty$u({}, indexId, nextIndexUiState)); 36073 }); 36074 } 36075 }; 36076}; 36077function storeRenderState(_ref8) {
36078 var renderState = _ref8.renderState, instantSearchInstance = _ref8.instantSearchInstance, parent = _ref8.parent; 36079 var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId(); 36080 instantSearchInstance.renderState = _objectSpread$p(_objectSpread$p({}, instantSearchInstance.renderState), {}, _defineProperty$u({}, parentIndexName, _objectSpread$p(_objectSpread$p({}, instantSearchInstance.renderState[parentIndexName]), renderState))); 36081} 36082function formatNumber(value, numberLocale) { 36083 return value.toLocaleString(numberLocale); 36084} 36085function _typeof$t(obj) { 36086 "@babel/helpers - typeof"; 36087 return _typeof$t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 36088 return typeof obj2; 36089 } : function(obj2) { 36090 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 36091 }, _typeof$t(obj); 36092} 36093function ownKeys$o(object, enumerableOnly) { 36094 var keys = Object.keys(object); 36095 if (Object.getOwnPropertySymbols) { 36096 var symbols = Object.getOwnPropertySymbols(object); 36097 enumerableOnly && (symbols = symbols.filter(function(sym) { 36098 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 36099 })), keys.push.apply(keys, symbols); 36100 } 36101 return keys; 36102} 36103function _objectSpread$o(target) { 36104 for (var i2 = 1; i2 < arguments.length; i2++) { 36105 var source = null != arguments[i2] ? arguments[i2] : {}; 36106 i2 % 2 ? ownKeys$o(Object(source), true).forEach(function(key2) { 36107 _defineProperty$t(target, key2, source[key2]); 36108 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$o(Object(source)).forEach(function(key2) { 36109 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 36110 }); 36111 } 36112 return target; 36113} 36114function _defineProperty$t(obj, key2, value) { 36115 key2 = _toPropertyKey$t(key2); 36116 if (key2 in obj) { 36117 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 36118 } else { 36119 obj[key2] = value; 36120 } 36121 return obj; 36122} 36123function _toPropertyKey$t(arg) { 36124 var key2 = _toPrimitive$t(arg, "string"); 36125 return _typeof$t(key2) === "symbol" ? key2 : String(key2); 36126} 36127function _toPrimitive$t(input, hint) { 36128 if (_typeof$t(input) !== "object" || input === null) return input; 36129 var prim = input[Symbol.toPrimitive]; 36130 if (prim !== void 0) { 36131 var res = prim.call(input, hint || "default"); 36132 if (_typeof$t(res) !== "object") return res; 36133 throw new TypeError("@@toPrimitive must return a primitive value."); 36134 } 36135 return (hint === "string" ? String : Number)(input); 36136} 36137function hoganHelpers(_ref) { 36138 var numberLocale = _ref.numberLocale; 36139 return { 36140 formatNumber: function formatNumber$1(value, render6) { 36141 return formatNumber(Number(render6(value)), numberLocale); 36142 }, 36143 highlight: function highlight$1(options, render6) { 36144 try { 36145 var highlightOptions = JSON.parse(options); 36146 return render6(highlight(_objectSpread$o(_objectSpread$o({}, highlightOptions), {}, { 36147 hit: this 36148 }))); 36149 } catch (error2) { 36150 throw new Error('\nThe highlight helper expects a JSON object of the format:\n{ "attribute": "name", "highlightedTagName": "mark" }'); 36151 } 36152 }, 36153 reverseHighlight: function reverseHighlight$1(options, render6) { 36154 try { 36155 var reverseHighlightOptions = JSON.parse(options); 36156 return render6(reverseHighlight(_objectSpread$o(_objectSpread$o({}, reverseHighlightOptions), {}, { 36157 hit: this 36158 }))); 36159 } catch (error2) { 36160 throw new Error('\n The reverseHighlight helper expects a JSON object of the format:\n { "attribute": "name", "highlightedTagName": "mark" }'); 36161 } 36162 }, 36163 snippet: function snippet$1(options, render6) { 36164 try { 36165 var snippetOptions = JSON.parse(options); 36166 return render6(snippet(_objectSpread$o(_objectSpread$o({}, snippetOptions), {}, { 36167 hit: this 36168 }))); 36169 } catch (error2) { 36170 throw new Error('\nThe snippet helper expects a JSON object of the format:\n{ "attribute": "name", "highlightedTagName": "mark" }'); 36171 } 36172 }, 36173 reverseSnippet: function reverseSnippet$1(options, render6) {
36174 try { 36175 var reverseSnippetOptions = JSON.parse(options); 36176 return render6(reverseSnippet(_objectSpread$o(_objectSpread$o({}, reverseSnippetOptions), {}, { 36177 hit: this 36178 }))); 36179 } catch (error2) { 36180 throw new Error('\n The reverseSnippet helper expects a JSON object of the format:\n { "attribute": "name", "highlightedTagName": "mark" }'); 36181 } 36182 }, 36183 insights: function insights$1(options, render6) { 36184 try { 36185 var _JSON$parse = JSON.parse(options), method = _JSON$parse.method, payload = _JSON$parse.payload; 36186 return render6(insights(method, _objectSpread$o({ 36187 objectIDs: [this.objectID] 36188 }, payload))); 36189 } catch (error2) { 36190 throw new Error('\nThe insights helper expects a JSON object of the format:\n{ "method": "method-name", "payload": { "eventName": "name of the event" } }'); 36191 } 36192 } 36193 }; 36194} 36195const version = "4.75.1"; 36196function _typeof$s(obj) { 36197 "@babel/helpers - typeof"; 36198 return _typeof$s = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 36199 return typeof obj2; 36200 } : function(obj2) { 36201 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 36202 }, _typeof$s(obj); 36203} 36204function ownKeys$n(object, enumerableOnly) { 36205 var keys = Object.keys(object); 36206 if (Object.getOwnPropertySymbols) { 36207 var symbols = Object.getOwnPropertySymbols(object); 36208 enumerableOnly && (symbols = symbols.filter(function(sym) { 36209 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 36210 })), keys.push.apply(keys, symbols); 36211 } 36212 return keys; 36213} 36214function _objectSpread$n(target) { 36215 for (var i2 = 1; i2 < arguments.length; i2++) { 36216 var source = null != arguments[i2] ? arguments[i2] : {}; 36217 i2 % 2 ? ownKeys$n(Object(source), true).forEach(function(key2) { 36218 _defineProperty$s(target, key2, source[key2]); 36219 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$n(Object(source)).forEach(function(key2) { 36220 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 36221 }); 36222 } 36223 return target; 36224} 36225function _classCallCheck$6(instance, Constructor) { 36226 if (!(instance instanceof Constructor)) { 36227 throw new TypeError("Cannot call a class as a function"); 36228 } 36229} 36230function _defineProperties$7(target, props) { 36231 for (var i2 = 0; i2 < props.length; i2++) { 36232 var descriptor = props[i2]; 36233 descriptor.enumerable = descriptor.enumerable || false; 36234 descriptor.configurable = true; 36235 if ("value" in descriptor) descriptor.writable = true; 36236 Object.defineProperty(target, _toPropertyKey$s(descriptor.key), descriptor); 36237 } 36238} 36239function _createClass$8(Constructor, protoProps, staticProps) { 36240 if (protoProps) _defineProperties$7(Constructor.prototype, protoProps); 36241 Object.defineProperty(Constructor, "prototype", { writable: false }); 36242 return Constructor; 36243} 36244function _inherits$5(subClass, superClass) { 36245 if (typeof superClass !== "function" && superClass !== null) { 36246 throw new TypeError("Super expression must either be null or a function"); 36247 } 36248 subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 36249 Object.defineProperty(subClass, "prototype", { writable: false }); 36250 if (superClass) _setPrototypeOf$5(subClass, superClass); 36251} 36252function _setPrototypeOf$5(o2, p2) { 36253 _setPrototypeOf$5 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o22, p22) { 36254 o22.__proto__ = p22; 36255 return o22; 36256 }; 36257 return _setPrototypeOf$5(o2, p2); 36258} 36259function _createSuper$5(Derived) { 36260 var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); 36261 return function _createSuperInternal() { 36262 var Super = _getPrototypeOf$5(Derived), result; 36263 if (hasNativeReflectConstruct) { 36264 var NewTarget = _getPrototypeOf$5(this).constructor; 36265 result = Reflect.construct(Super, arguments, NewTarget); 36266 } else { 36267 result = Super.apply(this, arguments); 36268 } 36269 return _possibleConstructorReturn$5(this, result); 36270 }; 36271} 36272function _possibleConstructorReturn$5(self2, call) { 36273 if (call && (_typeof$s(call) === "object" || typeof call === "function")) { 36274 return call; 36275 } else if (call !== void 0) { 36276 throw new TypeError("Derived constructors may only return object or undefined"); 36277 } 36278 return _assertThisInitialized$5(self2); 36279} 36280function _assertThisInitialized$5(self2) { 36281 if (self2 === void 0) { 36282 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 36283 } 36284 return self2; 36285} 36286function _isNativeReflectConstruct$5() { 36287 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
36288 if (Reflect.construct.sham) return false; 36289 if (typeof Proxy === "function") return true; 36290 try { 36291 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 36292 })); 36293 return true; 36294 } catch (e2) { 36295 return false; 36296 } 36297} 36298function _getPrototypeOf$5(o2) { 36299 _getPrototypeOf$5 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o22) { 36300 return o22.__proto__ || Object.getPrototypeOf(o22); 36301 }; 36302 return _getPrototypeOf$5(o2); 36303} 36304function _defineProperty$s(obj, key2, value) { 36305 key2 = _toPropertyKey$s(key2); 36306 if (key2 in obj) { 36307 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 36308 } else { 36309 obj[key2] = value; 36310 } 36311 return obj; 36312} 36313function _toPropertyKey$s(arg) { 36314 var key2 = _toPrimitive$s(arg, "string"); 36315 return _typeof$s(key2) === "symbol" ? key2 : String(key2); 36316} 36317function _toPrimitive$s(input, hint) { 36318 if (_typeof$s(input) !== "object" || input === null) return input; 36319 var prim = input[Symbol.toPrimitive]; 36320 if (prim !== void 0) { 36321 var res = prim.call(input, hint || "default"); 36322 if (_typeof$s(res) !== "object") return res; 36323 throw new TypeError("@@toPrimitive must return a primitive value."); 36324 } 36325 return (hint === "string" ? String : Number)(input); 36326} 36327var withUsage$f = createDocumentationMessageGenerator({ 36328 name: "instantsearch" 36329}); 36330function defaultCreateURL() { 36331 return "#"; 36332} 36333var INSTANTSEARCH_FUTURE_DEFAULTS = { 36334 preserveSharedStateOnUnmount: false, 36335 persistHierarchicalRootCount: false 36336}; 36337var InstantSearch = /* @__PURE__ */ function(_EventEmitter) { 36338 _inherits$5(InstantSearch2, _EventEmitter); 36339 var _super = _createSuper$5(InstantSearch2); 36340 function InstantSearch2(options) { 36341 var _this; 36342 _classCallCheck$6(this, InstantSearch2); 36343 _this = _super.call(this); 36344 _defineProperty$s(_assertThisInitialized$5(_this), "client", void 0); 36345 _defineProperty$s(_assertThisInitialized$5(_this), "indexName", void 0); 36346 _defineProperty$s(_assertThisInitialized$5(_this), "insightsClient", void 0); 36347 _defineProperty$s(_assertThisInitialized$5(_this), "onStateChange", null); 36348 _defineProperty$s(_assertThisInitialized$5(_this), "future", void 0); 36349 _defineProperty$s(_assertThisInitialized$5(_this), "helper", void 0); 36350 _defineProperty$s(_assertThisInitialized$5(_this), "mainHelper", void 0); 36351 _defineProperty$s(_assertThisInitialized$5(_this), "mainIndex", void 0); 36352 _defineProperty$s(_assertThisInitialized$5(_this), "started", void 0); 36353 _defineProperty$s(_assertThisInitialized$5(_this), "templatesConfig", void 0); 36354 _defineProperty$s(_assertThisInitialized$5(_this), "renderState", {}); 36355 _defineProperty$s(_assertThisInitialized$5(_this), "_stalledSearchDelay", void 0); 36356 _defineProperty$s(_assertThisInitialized$5(_this), "_searchStalledTimer", void 0); 36357 _defineProperty$s(_assertThisInitialized$5(_this), "_initialUiState", void 0); 36358 _defineProperty$s(_assertThisInitialized$5(_this), "_initialResults", void 0); 36359 _defineProperty$s(_assertThisInitialized$5(_this), "_createURL", void 0); 36360 _defineProperty$s(_assertThisInitialized$5(_this), "_searchFunction", void 0); 36361 _defineProperty$s(_assertThisInitialized$5(_this), "_mainHelperSearch", void 0); 36362 _defineProperty$s(_assertThisInitialized$5(_this), "_hasSearchWidget", false); 36363 _defineProperty$s(_assertThisInitialized$5(_this), "_hasRecommendWidget", false); 36364 _defineProperty$s(_assertThisInitialized$5(_this), "_insights", void 0); 36365 _defineProperty$s(_assertThisInitialized$5(_this), "middleware", []); 36366 _defineProperty$s(_assertThisInitialized$5(_this), "sendEventToInsights", void 0); 36367 _defineProperty$s(_assertThisInitialized$5(_this), "status", "idle"); 36368 _defineProperty$s(_assertThisInitialized$5(_this), "error", void 0); 36369 _defineProperty$s(_assertThisInitialized$5(_this), "scheduleSearch", defer(function() { 36370 if (_this.started) { 36371 _this.mainHelper.search(); 36372 } 36373 })); 36374 _defineProperty$s(_assertThisInitialized$5(_this), "scheduleRender", defer(function() { 36375 var _this$mainHelper; 36376 var shouldResetStatus = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; 36377 if (!((_this$mainHelper = _this.mainHelper) !== null && _this$mainHelper !== void 0 && _this$mainHelper.hasPendingRequests())) { 36378 clearTimeout(_this._searchStalledTimer); 36379 _this._searchStalledTimer = null; 36380 if (shouldResetStatus) { 36381 _this.status = "idle"; 36382 _this.error = void 0; 36383 } 36384 } 36385 _this.mainIndex.render({ 36386 instantSearchInstance: _assertThisInitialized$5(_this) 36387 });
36388 _this.emit("render"); 36389 })); 36390 _defineProperty$s(_assertThisInitialized$5(_this), "onInternalStateChange", defer(function() { 36391 var nextUiState = _this.mainIndex.getWidgetUiState({}); 36392 _this.middleware.forEach(function(_ref) { 36393 var instance = _ref.instance; 36394 instance.onStateChange({ 36395 uiState: nextUiState 36396 }); 36397 }); 36398 })); 36399 _this.setMaxListeners(100); 36400 var _options$indexName = options.indexName, indexName = _options$indexName === void 0 ? "" : _options$indexName, numberLocale = options.numberLocale, _options$initialUiSta = options.initialUiState, initialUiState = _options$initialUiSta === void 0 ? {} : _options$initialUiSta, _options$routing = options.routing, routing = _options$routing === void 0 ? null : _options$routing, _options$insights = options.insights, insights2 = _options$insights === void 0 ? void 0 : _options$insights, searchFunction = options.searchFunction, _options$stalledSearc = options.stalledSearchDelay, stalledSearchDelay = _options$stalledSearc === void 0 ? 200 : _options$stalledSearc, _options$searchClient = options.searchClient, searchClient = _options$searchClient === void 0 ? null : _options$searchClient, _options$insightsClie = options.insightsClient, insightsClient = _options$insightsClie === void 0 ? null : _options$insightsClie, _options$onStateChang = options.onStateChange, onStateChange = _options$onStateChang === void 0 ? null : _options$onStateChang, _options$future = options.future, future = _options$future === void 0 ? _objectSpread$n(_objectSpread$n({}, INSTANTSEARCH_FUTURE_DEFAULTS), options.future || {}) : _options$future; 36401 if (searchClient === null) { 36402 throw new Error(withUsage$f("The `searchClient` option is required.")); 36403 } 36404 if (typeof searchClient.search !== "function") { 36405 throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/"); 36406 } 36407 if (typeof searchClient.addAlgoliaAgent === "function") { 36408 searchClient.addAlgoliaAgent("instantsearch.js (".concat(version, ")")); 36409 } 36410 if (insightsClient && typeof insightsClient !== "function") { 36411 throw new Error(withUsage$f("The `insightsClient` option should be a function.")); 36412 } 36413 _this.client = searchClient; 36414 _this.future = future; 36415 _this.insightsClient = insightsClient; 36416 _this.indexName = indexName; 36417 _this.helper = null; 36418 _this.mainHelper = null; 36419 _this.mainIndex = index({ 36420 indexName 36421 }); 36422 _this.onStateChange = onStateChange; 36423 _this.started = false; 36424 _this.templatesConfig = { 36425 helpers: hoganHelpers({ 36426 numberLocale 36427 }), 36428 compileOptions: {} 36429 }; 36430 _this._stalledSearchDelay = stalledSearchDelay; 36431 _this._searchStalledTimer = null; 36432 _this._createURL = defaultCreateURL; 36433 _this._initialUiState = initialUiState; 36434 _this._initialResults = null; 36435 _this._insights = insights2; 36436 if (searchFunction) { 36437 _this._searchFunction = searchFunction; 36438 } 36439 _this.sendEventToInsights = noop$1; 36440 if (routing) { 36441 var routerOptions = typeof routing === "boolean" ? {} : routing; 36442 routerOptions.$$internal = true; 36443 _this.use(createRouterMiddleware(routerOptions)); 36444 } 36445 if (insights2) { 36446 var insightsOptions = typeof insights2 === "boolean" ? {} : insights2; 36447 insightsOptions.$$internal = true; 36448 _this.use(createInsightsMiddleware(insightsOptions)); 36449 } 36450 if (isMetadataEnabled()) { 36451 _this.use(createMetadataMiddleware({ 36452 $$internal: true 36453 })); 36454 } 36455 return _this; 36456 } 36457 _createClass$8(InstantSearch2, [{ 36458 key: "_isSearchStalled", 36459 get: ( 36460 /** 36461 * @deprecated use `status === 'stalled'` instead 36462 */ 36463 function get4() { 36464 return this.status === "stalled"; 36465 } 36466 ) 36467 }, { 36468 key: "use", 36469 value: function use() { 36470 var _this2 = this; 36471 for (var _len = arguments.length, middleware = new Array(_len), _key = 0; _key < _len; _key++) { 36472 middleware[_key] = arguments[_key]; 36473 } 36474 var newMiddlewareList = middleware.map(function(fn) { 36475 var newMiddleware = _objectSpread$n({ 36476 $$type: "__unknown__", 36477 $$internal: false, 36478 subscribe: noop$1, 36479 started: noop$1, 36480 unsubscribe: noop$1, 36481 onStateChange: noop$1 36482 }, fn({ 36483 instantSearchInstance: _this2 36484 })); 36485 _this2.middleware.push({ 36486 creator: fn, 36487 instance: newMiddleware 36488 }); 36489 return newMiddleware; 36490 }); 36491 if (this.started) { 36492 newMiddlewareList.forEach(function(m2) { 36493 m2.subscribe(); 36494 m2.started(); 36495 }); 36496 } 36497 return this; 36498 } 36499 /** 36500 * Removes a middleware from the InstantSearch lifecycle. 36501 */ 36502 }, { 36503 key: "unuse", 36504 value: function unuse() { 36505 for (var _len2 = arguments.length, middlewareToUnuse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 36506 middlewareToUnuse[_key2] = arguments[_key2]; 36507 } 36508 this.middleware.filter(function(m2) { 36509 return middlewareToUnuse.includes(m2.creator); 36510 }
vendor: 12,347 bytes, lines 36510-36844
36510).forEach(function(m2) { 36511 return m2.instance.unsubscribe(); 36512 }); 36513 this.middleware = this.middleware.filter(function(m2) { 36514 return !middlewareToUnuse.includes(m2.creator); 36515 }); 36516 return this; 36517 } 36518 // @major we shipped with EXPERIMENTAL_use, but have changed that to just `use` now 36519 }, { 36520 key: "EXPERIMENTAL_use", 36521 value: function EXPERIMENTAL_use() { 36522 return this.use.apply(this, arguments); 36523 } 36524 /** 36525 * Adds a widget to the search instance. 36526 * A widget can be added either before or after InstantSearch has started. 36527 * @param widget The widget to add to InstantSearch. 36528 * 36529 * @deprecated This method will still be supported in 4.x releases, but not further. It is replaced by `addWidgets([widget])`. 36530 */ 36531 }, { 36532 key: "addWidget", 36533 value: function addWidget(widget) { 36534 return this.addWidgets([widget]); 36535 } 36536 /** 36537 * Adds multiple widgets to the search instance. 36538 * Widgets can be added either before or after InstantSearch has started. 36539 * @param widgets The array of widgets to add to InstantSearch. 36540 */ 36541 }, { 36542 key: "addWidgets", 36543 value: function addWidgets(widgets) { 36544 if (!Array.isArray(widgets)) { 36545 throw new Error(withUsage$f("The `addWidgets` method expects an array of widgets. Please use `addWidget`.")); 36546 } 36547 if (widgets.some(function(widget) { 36548 return typeof widget.init !== "function" && typeof widget.render !== "function"; 36549 })) { 36550 throw new Error(withUsage$f("The widget definition expects a `render` and/or an `init` method.")); 36551 } 36552 this.mainIndex.addWidgets(widgets); 36553 return this; 36554 } 36555 /** 36556 * Removes a widget from the search instance. 36557 * @deprecated This method will still be supported in 4.x releases, but not further. It is replaced by `removeWidgets([widget])` 36558 * @param widget The widget instance to remove from InstantSearch. 36559 * 36560 * The widget must implement a `dispose()` method to clear its state. 36561 */ 36562 }, { 36563 key: "removeWidget", 36564 value: function removeWidget(widget) { 36565 return this.removeWidgets([widget]); 36566 } 36567 /** 36568 * Removes multiple widgets from the search instance. 36569 * @param widgets Array of widgets instances to remove from InstantSearch. 36570 * 36571 * The widgets must implement a `dispose()` method to clear their states. 36572 */ 36573 }, { 36574 key: "removeWidgets", 36575 value: function removeWidgets(widgets) { 36576 if (!Array.isArray(widgets)) { 36577 throw new Error(withUsage$f("The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.")); 36578 } 36579 if (widgets.some(function(widget) { 36580 return typeof widget.dispose !== "function"; 36581 })) { 36582 throw new Error(withUsage$f("The widget definition expects a `dispose` method.")); 36583 } 36584 this.mainIndex.removeWidgets(widgets); 36585 return this; 36586 } 36587 /** 36588 * Ends the initialization of InstantSearch.js and triggers the 36589 * first search. 36590 */ 36591 }, { 36592 key: "start", 36593 value: function start2() { 36594 var _this3 = this; 36595 if (this.started) { 36596 throw new Error(withUsage$f("The `start` method has already been called once.")); 36597 } 36598 var mainHelper = this.mainHelper || algoliasearchHelper$1(this.client, this.indexName, void 0, { 36599 persistHierarchicalRootCount: this.future.persistHierarchicalRootCount 36600 }); 36601 mainHelper.search = function() { 36602 _this3.status = "loading"; 36603 _this3.scheduleRender(false); 36604 if (_this3._hasSearchWidget) { 36605 mainHelper.searchOnlyWithDerivedHelpers(); 36606 } 36607 if (_this3._hasRecommendWidget) { 36608 mainHelper.recommend(); 36609 } 36610 return mainHelper; 36611 }; 36612 if (this._searchFunction) { 36613 var fakeClient = { 36614 search: function search() { 36615 return new Promise(noop$1); 36616 } 36617 }; 36618 this._mainHelperSearch = mainHelper.search.bind(mainHelper); 36619 mainHelper.search = function() { 36620 var mainIndexHelper = _this3.mainIndex.getHelper(); 36621 var searchFunctionHelper = algoliasearchHelper$1(fakeClient, mainIndexHelper.state.index, mainIndexHelper.state); 36622 searchFunctionHelper.once("search", function(_ref22) { 36623 var state = _ref22.state; 36624 mainIndexHelper.overrideStateWithoutTriggeringChangeEvent(state); 36625 _this3._mainHelperSearch(); 36626 }); 36627 searchFunctionHelper.on("change", function(_ref3) { 36628 var state = _ref3.state; 36629 mainIndexHelper.setState(state); 36630 }); 36631 _this3._searchFunction(searchFunctionHelper); 36632 return mainHelper; 36633 }; 36634 } 36635 mainHelper.on("error", function(_ref42) { 36636 var error2 = _ref42.error; 36637 if (!(error2 instanceof Error)) { 36638 var err = error2; 36639 error2 = Object.keys(err).reduce(function(acc, key2) { 36640 acc[key2] = err[key2]; 36641 return acc; 36642 }, new Error(err.message)); 36643 } 36644 error2.error = error2; 36645 _this3.error = error2; 36646 _this3.status = "error"; 36647 _this3.scheduleRender(false); 36648 _this3.emit("error", error2); 36649 }); 36650 this.mainHelper = mainHelper; 36651 this.middleware.forEach(function(_ref5) { 36652 var instance = _ref5.instance; 36653 instance.subscribe(); 36654 }); 36655 this.mainIndex.init({ 36656 instantSearchInstance: this, 36657 parent: null, 36658 uiState: this._initialUiState 36659 }); 36660 if (this._initialResults) { 36661 hydrateSearchClient(this.client, this._initialResults); 36662 hydrateRecommendCache(this.mainHelper, this._initialResults); 36663 var originalScheduleSearch = this.scheduleSearch; 36664 this.scheduleSearch = defer(noop$1); 36665 defer(function() { 36666 _this3.scheduleSearch = originalScheduleSearch; 36667 })(); 36668 } else if (this.mainIndex.getWidgets().length > 0) { 36669 this.scheduleSearch(); 36670 } 36671 this.helper = this.mainIndex.getHelper(); 36672 this.started = true; 36673 this.middleware.forEach(function(_ref62) { 36674 var instance = _ref62.instance; 36675 instance.started(); 36676 }); 36677 if (typeof this._insights === "undefined") { 36678 mainHelper.derivedHelpers[0].once("result", function() { 36679 var hasAutomaticInsights = _this3.mainIndex.getScopedResults().some(function(_ref7) { 36680 var results = _ref7.results; 36681 return results === null || results === void 0 ? void 0 : results._automaticInsights; 36682 }); 36683 if (hasAutomaticInsights) { 36684 _this3.use(createInsightsMiddleware({ 36685 $$internal: true, 36686 $$automatic: true 36687 })); 36688 } 36689 }); 36690 } 36691 } 36692 /** 36693 * Removes all widgets without triggering a search afterwards. 36694 * @return {undefined} This method does not return anything 36695 */ 36696 }, { 36697 key: "dispose", 36698 value: function dispose() { 36699 var _this$mainHelper2; 36700 this.scheduleSearch.cancel(); 36701 this.scheduleRender.cancel(); 36702 clearTimeout(this._searchStalledTimer); 36703 this.removeWidgets(this.mainIndex.getWidgets()); 36704 this.mainIndex.dispose(); 36705 this.started = false; 36706 this.removeAllListeners(); 36707 (_this$mainHelper2 = this.mainHelper) === null || _this$mainHelper2 === void 0 ? void 0 : _this$mainHelper2.removeAllListeners(); 36708 this.mainHelper = null; 36709 this.helper = null; 36710 this.middleware.forEach(function(_ref8) { 36711 var instance = _ref8.instance; 36712 instance.unsubscribe(); 36713 }); 36714 } 36715 }, { 36716 key: "scheduleStalledRender", 36717 value: function scheduleStalledRender() { 36718 var _this4 = this; 36719 if (!this._searchStalledTimer) { 36720 this._searchStalledTimer = setTimeout(function() { 36721 _this4.status = "stalled"; 36722 _this4.scheduleRender(); 36723 }, this._stalledSearchDelay); 36724 } 36725 } 36726 /** 36727 * Set the UI state and trigger a search. 36728 * @param uiState The next UI state or a function computing it from the current state 36729 * @param callOnStateChange private parameter used to know if the method is called from a state change 36730 */ 36731 }, { 36732 key: "setUiState", 36733 value: function setUiState(uiState) { 36734 var _this5 = this; 36735 var callOnStateChange = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; 36736 if (!this.mainHelper) { 36737 throw new Error(withUsage$f("The `start` method needs to be called before `setUiState`.")); 36738 } 36739 this.mainIndex.refreshUiState(); 36740 var nextUiState = typeof uiState === "function" ? uiState(this.mainIndex.getWidgetUiState({})) : uiState; 36741 if (this.onStateChange && callOnStateChange) { 36742 this.onStateChange({ 36743 uiState: nextUiState, 36744 setUiState: function setUiState2(finalUiState) { 36745 setIndexHelperState(typeof finalUiState === "function" ? finalUiState(nextUiState) : finalUiState, _this5.mainIndex); 36746 _this5.scheduleSearch(); 36747 _this5.onInternalStateChange(); 36748 } 36749 }); 36750 } else { 36751 setIndexHelperState(nextUiState, this.mainIndex); 36752 this.scheduleSearch(); 36753 this.onInternalStateChange(); 36754 } 36755 } 36756 }, { 36757 key: "getUiState", 36758 value: function getUiState() { 36759 if (this.started) { 36760 this.mainIndex.refreshUiState(); 36761 } 36762 return this.mainIndex.getWidgetUiState({}); 36763 } 36764 }, { 36765 key: "createURL", 36766 value: function createURL() { 36767 var nextState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 36768 if (!this.started) { 36769 throw new Error(withUsage$f("The `start` method needs to be called before `createURL`.")); 36770 } 36771 return this._createURL(nextState); 36772 } 36773 }, { 36774 key: "refresh", 36775 value: function refresh() { 36776 if (!this.mainHelper) { 36777 throw new Error(withUsage$f("The `start` method needs to be called before `refresh`.")); 36778 } 36779 this.mainHelper.clearCache().search(); 36780 } 36781 }]); 36782 return InstantSearch2; 36783}(EventEmitter$3); 36784var instantsearch = function instantsearch2(options) { 36785 return new InstantSearch(options); 36786}; 36787instantsearch.version = version; 36788instantsearch.createInfiniteHitsSessionStorageCache = deprecate(createInfiniteHitsSessionStorageCache); 36789instantsearch.highlight = deprecate(highlight); 36790instantsearch.reverseHighlight = deprecate(reverseHighlight); 36791instantsearch.snippet = deprecate(snippet); 36792instantsearch.reverseSnippet = deprecate(reverseSnippet); 36793instantsearch.insights = insights; 36794instantsearch.getInsightsAnonymousUserToken = getInsightsAnonymousUserToken; 36795Object.defineProperty(instantsearch, "widgets", { 36796 get: function get() { 36797 throw new ReferenceError(`"instantsearch.widgets" are not available from the ES build. 36798 36799To import the widgets: 36800 36801import { searchBox } from 'instantsearch.js/es/widgets'`); 36802 } 36803}); 36804Object.defineProperty(instantsearch, "connectors", { 36805 get: function get2() { 36806 throw new ReferenceError(`"instantsearch.connectors" are not available from the ES build. 36807 36808To import the connectors: 36809 36810import { connectSearchBox } from 'instantsearch.js/es/connectors'`); 36811 } 36812}); 36813Object.defineProperty(instantsearch, "templates", { 36814 get: function get3() { 36815 throw new ReferenceError(`"instantsearch.templates" are not available from the ES build. 36816 36817To import the templates: 36818 36819import { carousel } from 'instantsearch.js/es/templates'`); 36820 } 36821}); 36822function _defineProperties$6(target, props) { 36823 for (var i2 = 0; i2 < props.length; i2++) { 36824 var descriptor = props[i2]; 36825 descriptor.enumerable = descriptor.enumerable || false; 36826 descriptor.configurable = true; 36827 if ("value" in descriptor) descriptor.writable = true; 36828 Object.defineProperty(target, descriptor.key, descriptor); 36829 } 36830} 36831function _createClass$7(Constructor, protoProps, staticProps) { 36832 if (protoProps) _defineProperties$6(Constructor.prototype, protoProps); 36833 return Constructor; 36834} 36835/*! 36836 * ScrollSmoother 3.12.5 36837 * https://gsap.com 36838 * 36839 * @license Copyright 2008-2024, GreenSock. All rights reserved. 36840 * Subject to the terms at https://gsap.com/standard-license or for 36841 * Club GSAP members, the agreement issued with that membership. 36842 * @author: Jack Doyle, [email protected] 36843*/ 36844var gsap$3, _coreInitted$3, _win$2, _doc$2, _docEl$3, _body$3, _toArray$2, _clamp$1, ScrollTrigger$3, _mainInstance, _expo, _getVelocityProp$
vendor: 2,947 bytes, lines 36844-36888
368441, _inputObserver$1, _context$2, _onResizeDelayedCall, _windowExists$2 = function _windowExists3() { 36845 return typeof window !== "undefined"; 36846}, _getGSAP$3 = function _getGSAP3() { 36847 return gsap$3 || _windowExists$2() && (gsap$3 = window.gsap) && gsap$3.registerPlugin && gsap$3; 36848}, _round$1 = function _round4(value) { 36849 return Math.round(value * 1e5) / 1e5 || 0; 36850}, _maxScroll$1 = function _maxScroll(scroller) { 36851 return ScrollTrigger$3.maxScroll(scroller || _win$2); 36852}, _autoDistance = function _autoDistance2(el, progress) { 36853 var parent = el.parentNode || _docEl$3, b1 = el.getBoundingClientRect(), b2 = parent.getBoundingClientRect(), gapTop = b2.top - b1.top, gapBottom = b2.bottom - b1.bottom, change = (Math.abs(gapTop) > Math.abs(gapBottom) ? gapTop : gapBottom) / (1 - progress), offset = -change * progress, ratio, extraChange; 36854 if (change > 0) { 36855 ratio = b2.height / (_win$2.innerHeight + b2.height); 36856 extraChange = ratio === 0.5 ? b2.height * 2 : Math.min(b2.height, Math.abs(-change * ratio / (2 * ratio - 1))) * 2 * (progress || 1); 36857 offset += progress ? -extraChange * progress : -extraChange / 2; 36858 change += extraChange; 36859 } 36860 return { 36861 change, 36862 offset 36863 }; 36864}, _wrap = function _wrap2(el) { 36865 var wrapper = _doc$2.querySelector(".ScrollSmoother-wrapper"); 36866 if (!wrapper) { 36867 wrapper = _doc$2.createElement("div"); 36868 wrapper.classList.add("ScrollSmoother-wrapper"); 36869 el.parentNode.insertBefore(wrapper, el); 36870 wrapper.appendChild(el); 36871 } 36872 return wrapper; 36873}; 36874var ScrollSmoother = /* @__PURE__ */ function() { 36875 function ScrollSmoother2(vars) { 36876 var _this = this; 36877 _coreInitted$3 || ScrollSmoother2.register(gsap$3) || console.warn("Please gsap.registerPlugin(ScrollSmoother)"); 36878 vars = this.vars = vars || {}; 36879 _mainInstance && _mainInstance.kill(); 36880 _mainInstance = this; 36881 _context$2(this); 36882 var _vars = vars, smoothTouch = _vars.smoothTouch, _onUpdate = _vars.onUpdate, onStop = _vars.onStop, smooth = _vars.smooth, onFocusIn = _vars.onFocusIn, normalizeScroll = _vars.normalizeScroll, wholePixels = _vars.wholePixels, content, wrapper, height, mainST, effects, sections, intervalID, wrapperCSS, contentCSS, paused, pausedNormalizer, recordedRefreshScroll, recordedRefreshScrub, allowUpdates, self2 = this, effectsPrefix = vars.effectsPrefix || "", scrollFunc = ScrollTrigger$3.getScrollFunc(_win$2), smoothDuration = ScrollTrigger$3.isTouch === 1 ? smoothTouch === true ? 0.8 : parseFloat(smoothTouch) || 0 : smooth === 0 || smooth === false ? 0 : parseFloat(smooth) || 0.8, speed = smoothDuration && +vars.speed || 1, currentY = 0, delta = 0, startupPhase = 1, tracker = _getVelocityProp$1(0), updateVelocity = function updateVelocity2() { 36883 return tracker.update(-currentY); 36884 }, scroll = { 36885 y: 0 36886 }, removeScroll = function removeScroll2() { 36887 return content.style.overflow = "visible"; 36888 }, isProxyScrolling, killScrub = function killScrub2(trigger) {
vendor: 1,035 bytes, lines 36889-36915
36889 trigger.update(); 36890 var scrub = trigger.getTween(); 36891 if (scrub) { 36892 scrub.pause(); 36893 scrub._time = scrub._dur; 36894 scrub._tTime = scrub._tDur; 36895 } 36896 isProxyScrolling = false; 36897 trigger.animation.progress(trigger.progress, true); 36898 }, render6 = function render7(y2, force) { 36899 if (y2 !== currentY && !paused || force) { 36900 wholePixels && (y2 = Math.round(y2)); 36901 if (smoothDuration) { 36902 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + y2 + ", 0, 1)"; 36903 content._gsap.y = y2 + "px"; 36904 } 36905 delta = y2 - currentY; 36906 currentY = y2; 36907 ScrollTrigger$3.isUpdating || ScrollSmoother2.isRefreshing || ScrollTrigger$3.update(); 36908 } 36909 }, scrollTop = function scrollTop2(value) { 36910 if (arguments.length) { 36911 value < 0 && (value = 0); 36912 scroll.y = -value; 36913 isProxyScrolling = true; 36914 paused ? currentY = -value : render6(-value); 36915 ScrollTrigger$3.isRefreshing ? mainST.update(
vendor: 4,938 bytes, lines 36915-37015
36915) : scrollFunc(value / speed); 36916 return this; 36917 } 36918 return -currentY; 36919 }, resizeObserver = typeof ResizeObserver !== "undefined" && vars.autoResize !== false && new ResizeObserver(function() { 36920 if (!ScrollTrigger$3.isRefreshing) { 36921 var max = _maxScroll$1(wrapper) * speed; 36922 max < -currentY && scrollTop(max); 36923 _onResizeDelayedCall.restart(true); 36924 } 36925 }), lastFocusElement, _onFocusIn = function _onFocusIn2(e2) { 36926 wrapper.scrollTop = 0; 36927 if (e2.target.contains && e2.target.contains(wrapper) || onFocusIn && onFocusIn(_this, e2) === false) { 36928 return; 36929 } 36930 ScrollTrigger$3.isInViewport(e2.target) || e2.target === lastFocusElement || _this.scrollTo(e2.target, false, "center center"); 36931 lastFocusElement = e2.target; 36932 }, _transformPosition = function _transformPosition2(position, st) { 36933 if (position < st.start) { 36934 return position; 36935 } 36936 var ratio = isNaN(st.ratio) ? 1 : st.ratio, change = st.end - st.start, distance = position - st.start, offset = st.offset || 0, pins = st.pins || [], pinOffset = pins.offset || 0, progressOffset = st._startClamp && st.start <= 0 || st.pins && st.pins.offset ? 0 : st._endClamp && st.end === _maxScroll$1() ? 1 : 0.5; 36937 pins.forEach(function(p2) { 36938 change -= p2.distance; 36939 if (p2.nativeStart <= position) { 36940 distance -= p2.distance; 36941 } 36942 }); 36943 if (pinOffset) { 36944 distance *= (change - pinOffset / ratio) / change; 36945 } 36946 return position + (distance - offset * progressOffset) / ratio - distance; 36947 }, adjustEffectRelatedTriggers = function adjustEffectRelatedTriggers2(st, triggers, partial) { 36948 partial || (st.pins.length = st.pins.offset = 0); 36949 var pins = st.pins, markers = st.markers, dif, isClamped, start2, end, nativeStart, nativeEnd, i2, trig; 36950 for (i2 = 0; i2 < triggers.length; i2++) { 36951 trig = triggers[i2]; 36952 if (st.trigger && trig.trigger && st !== trig && (trig.trigger === st.trigger || trig.pinnedContainer === st.trigger || st.trigger.contains(trig.trigger))) { 36953 nativeStart = trig._startNative || trig._startClamp || trig.start; 36954 nativeEnd = trig._endNative || trig._endClamp || trig.end; 36955 start2 = _transformPosition(nativeStart, st); 36956 end = trig.pin && nativeEnd > 0 ? start2 + (nativeEnd - nativeStart) : _transformPosition(nativeEnd, st); 36957 trig.setPositions(start2, end, true, (trig._startClamp ? Math.max(0, start2) : start2) - nativeStart); 36958 trig.markerStart && markers.push(gsap$3.quickSetter([trig.markerStart, trig.markerEnd], "y", "px")); 36959 if (trig.pin && trig.end > 0 && !partial) { 36960 dif = trig.end - trig.start; 36961 isClamped = st._startClamp && trig.start < 0; 36962 if (isClamped) { 36963 if (st.start > 0) { 36964 st.setPositions(0, st.end + (st._startNative - st.start), true); 36965 adjustEffectRelatedTriggers2(st, triggers); 36966 return; 36967 } 36968 dif += trig.start; 36969 pins.offset = -trig.start; 36970 } 36971 pins.push({ 36972 start: trig.start, 36973 nativeStart, 36974 end: trig.end, 36975 distance: dif, 36976 trig 36977 }); 36978 st.setPositions(st.start, st.end + (isClamped ? -trig.start : dif), true); 36979 } 36980 } 36981 } 36982 }, adjustParallaxPosition = function adjustParallaxPosition2(triggers, createdAfterEffectWasApplied) { 36983 effects.forEach(function(st) { 36984 return adjustEffectRelatedTriggers(st, triggers, createdAfterEffectWasApplied); 36985 }); 36986 }, onRefresh = function onRefresh2() { 36987 removeScroll(); 36988 requestAnimationFrame(removeScroll); 36989 if (effects) { 36990 ScrollTrigger$3.getAll().forEach(function(st) { 36991 st._startNative = st.start; 36992 st._endNative = st.end; 36993 }); 36994 effects.forEach(function(st) { 36995 var start2 = st._startClamp || st.start, end = st.autoSpeed ? Math.min(_maxScroll$1(), st.end) : start2 + Math.abs((st.end - start2) / st.ratio), offset = end - st.end; 36996 start2 -= offset / 2; 36997 end -= offset / 2; 36998 if (start2 > end) { 36999 var s2 = start2; 37000 start2 = end; 37001 end = s2; 37002 } 37003 if (st._startClamp && start2 < 0) { 37004 end = st.ratio < 0 ? _maxScroll$1() : st.end / st.ratio; 37005 offset = end - st.end; 37006 start2 = 0; 37007 } else if (st.ratio < 0 || st._endClamp && end >= _maxScroll$1()) { 37008 end = _maxScroll$1(); 37009 start2 = st.ratio < 0 ? 0 : st.ratio > 1 ? 0 : end - (end - st.start) / st.ratio; 37010 offset = (end - start2) * st.ratio - (st.end - st.start); 37011 } 37012 st.offset = offset || 1e-4; 37013 st.pins.length = st.pins.offset = 0; 37014 st.setPositions(start2, end, true); 37015 });
vendor: 19,325 bytes, lines 37016-37521
37016 adjustParallaxPosition(ScrollTrigger$3.sort()); 37017 } 37018 tracker.reset(); 37019 }, addOnRefresh = function addOnRefresh2() { 37020 return ScrollTrigger$3.addEventListener("refresh", onRefresh); 37021 }, restoreEffects = function restoreEffects2() { 37022 return effects && effects.forEach(function(st) { 37023 return st.vars.onRefresh(st); 37024 }); 37025 }, revertEffects = function revertEffects2() { 37026 effects && effects.forEach(function(st) { 37027 return st.vars.onRefreshInit(st); 37028 }); 37029 return restoreEffects; 37030 }, effectValueGetter = function effectValueGetter2(name, value, index3, el) { 37031 return function() { 37032 var v2 = typeof value === "function" ? value(index3, el) : value; 37033 v2 || v2 === 0 || (v2 = el.getAttribute("data-" + effectsPrefix + name) || (name === "speed" ? 1 : 0)); 37034 el.setAttribute("data-" + effectsPrefix + name, v2); 37035 var clamp3 = (v2 + "").substr(0, 6) === "clamp("; 37036 return { 37037 clamp: clamp3, 37038 value: clamp3 ? v2.substr(6, v2.length - 7) : v2 37039 }; 37040 }; 37041 }, createEffect = function createEffect2(el, speed2, lag, index3, effectsPadding) { 37042 effectsPadding = (typeof effectsPadding === "function" ? effectsPadding(index3, el) : effectsPadding) || 0; 37043 var getSpeed = effectValueGetter("speed", speed2, index3, el), getLag = effectValueGetter("lag", lag, index3, el), startY = gsap$3.getProperty(el, "y"), cache2 = el._gsap, ratio, st, autoSpeed, scrub, progressOffset, yOffset, pins = [], initDynamicValues = function initDynamicValues2() { 37044 speed2 = getSpeed(); 37045 lag = parseFloat(getLag().value); 37046 ratio = parseFloat(speed2.value) || 1; 37047 autoSpeed = speed2.value === "auto"; 37048 progressOffset = autoSpeed || st && st._startClamp && st.start <= 0 || pins.offset ? 0 : st && st._endClamp && st.end === _maxScroll$1() ? 1 : 0.5; 37049 scrub && scrub.kill(); 37050 scrub = lag && gsap$3.to(el, { 37051 ease: _expo, 37052 overwrite: false, 37053 y: "+=0", 37054 duration: lag 37055 }); 37056 if (st) { 37057 st.ratio = ratio; 37058 st.autoSpeed = autoSpeed; 37059 } 37060 }, revert = function revert2() { 37061 cache2.y = startY + "px"; 37062 cache2.renderTransform(1); 37063 initDynamicValues(); 37064 }, markers = [], change = 0, updateChange = function updateChange2(self3) { 37065 if (autoSpeed) { 37066 revert(); 37067 var auto = _autoDistance(el, _clamp$1(0, 1, -self3.start / (self3.end - self3.start))); 37068 change = auto.change; 37069 yOffset = auto.offset; 37070 } else { 37071 yOffset = pins.offset || 0; 37072 change = (self3.end - self3.start - yOffset) * (1 - ratio); 37073 } 37074 pins.forEach(function(p2) { 37075 return change -= p2.distance * (1 - ratio); 37076 }); 37077 self3.offset = change || 1e-3; 37078 self3.vars.onUpdate(self3); 37079 scrub && scrub.progress(1); 37080 }; 37081 initDynamicValues(); 37082 if (ratio !== 1 || autoSpeed || scrub) { 37083 st = ScrollTrigger$3.create({ 37084 trigger: autoSpeed ? el.parentNode : el, 37085 start: function start2() { 37086 return speed2.clamp ? "clamp(top bottom+=" + effectsPadding + ")" : "top bottom+=" + effectsPadding; 37087 }, 37088 end: function end() { 37089 return speed2.value < 0 ? "max" : speed2.clamp ? "clamp(bottom top-=" + effectsPadding + ")" : "bottom top-=" + effectsPadding; 37090 }, 37091 scroller: wrapper, 37092 scrub: true, 37093 refreshPriority: -999, 37094 // must update AFTER any other ScrollTrigger pins 37095 onRefreshInit: revert, 37096 onRefresh: updateChange, 37097 onKill: function onKill(self3) { 37098 var i2 = effects.indexOf(self3); 37099 i2 >= 0 && effects.splice(i2, 1); 37100 revert(); 37101 }, 37102 onUpdate: function onUpdate(self3) { 37103 var y2 = startY + change * (self3.progress - progressOffset), i2 = pins.length, extraY = 0, pin, scrollY, end; 37104 if (self3.offset) { 37105 if (i2) { 37106 scrollY = -currentY; 37107 end = self3.end; 37108 while (i2--) { 37109 pin = pins[i2]; 37110 if (pin.trig.isActive || scrollY >= pin.start && scrollY <= pin.end) { 37111 if (scrub) { 37112 pin.trig.progress += pin.trig.direction < 0 ? 1e-3 : -1e-3; 37113 pin.trig.update(0, 0, 1); 37114 scrub.resetTo("y", parseFloat(cache2.y), -delta, true); 37115 startupPhase && scrub.progress(1); 37116 } 37117 return; 37118 } 37119 scrollY > pin.end && (extraY += pin.distance); 37120 end -= pin.distance; 37121 } 37122 y2 = startY + extraY + change * ((gsap$3.utils.clamp(self3.start, self3.end, scrollY) - self3.start - extraY) / (end - self3.start) - progressOffset); 37123 } 37124 markers.length && !autoSpeed && markers.forEach(function(setter) { 37125 return setter(y2 - extraY); 37126 }); 37127 y2 = _round$1(y2 + yOffset); 37128 if (scrub) { 37129 scrub.resetTo("y", y2, -delta, true); 37130 startupPhase && scrub.progress(1); 37131 } else { 37132 cache2.y = y2 + "px"; 37133 cache2.renderTransform(1); 37134 } 37135 } 37136 } 37137 }); 37138 updateChange(st); 37139 gsap$3.core.getCache(st.trigger).stRevert = revertEffects; 37140 st.startY = startY; 37141 st.pins = pins; 37142 st.markers = markers; 37143 st.ratio = ratio; 37144 st.autoSpeed = autoSpeed; 37145 el.style.willChange = "transform"; 37146 } 37147 return st; 37148 }; 37149 addOnRefresh(); 37150 ScrollTrigger$3.addEventListener("killAll", addOnRefresh); 37151 gsap$3.delayedCall(0.5, function() { 37152 return startupPhase = 0; 37153 }); 37154 this.scrollTop = scrollTop; 37155 this.scrollTo = function(target, smooth2, position) { 37156 var p2 = gsap$3.utils.clamp(0, _maxScroll$1(), isNaN(target) ? _this.offset(target, position, !!smooth2 && !paused) : +target); 37157 !smooth2 ? scrollTop(p2) : paused ? gsap$3.to(_this, { 37158 duration: smoothDuration, 37159 scrollTop: p2, 37160 overwrite: "auto", 37161 ease: _expo 37162 }) : scrollFunc(p2); 37163 }; 37164 this.offset = function(target, position, ignoreSpeed) { 37165 target = _toArray$2(target)[0]; 37166 var cssText = target.style.cssText, st = ScrollTrigger$3.create({ 37167 trigger: target, 37168 start: position || "top top" 37169 }), y2; 37170 if (effects) { 37171 startupPhase ? ScrollTrigger$3.refresh() : adjustParallaxPosition([st], true); 37172 } 37173 y2 = st.start / (ignoreSpeed ? speed : 1); 37174 st.kill(false); 37175 target.style.cssText = cssText; 37176 gsap$3.core.getCache(target).uncache = 1; 37177 return y2; 37178 }; 37179 function refreshHeight() { 37180 height = content.clientHeight; 37181 content.style.overflow = "visible"; 37182 _body$3.style.height = _win$2.innerHeight + (height - _win$2.innerHeight) / speed + "px"; 37183 return height - _win$2.innerHeight; 37184 } 37185 this.content = function(element) { 37186 if (arguments.length) { 37187 var newContent = _toArray$2(element || "#smooth-content")[0] || console.warn("ScrollSmoother needs a valid content element.") || _body$3.children[0]; 37188 if (newContent !== content) { 37189 content = newContent; 37190 contentCSS = content.getAttribute("style") || ""; 37191 resizeObserver && resizeObserver.observe(content); 37192 gsap$3.set(content, { 37193 overflow: "visible", 37194 width: "100%", 37195 boxSizing: "border-box", 37196 y: "+=0" 37197 }); 37198 smoothDuration || gsap$3.set(content, { 37199 clearProps: "transform" 37200 }); 37201 } 37202 return this; 37203 } 37204 return content; 37205 }; 37206 this.wrapper = function(element) { 37207 if (arguments.length) { 37208 wrapper = _toArray$2(element || "#smooth-wrapper")[0] || _wrap(content); 37209 wrapperCSS = wrapper.getAttribute("style") || ""; 37210 refreshHeight(); 37211 gsap$3.set(wrapper, smoothDuration ? { 37212 overflow: "hidden", 37213 position: "fixed", 37214 height: "100%", 37215 width: "100%", 37216 top: 0, 37217 left: 0, 37218 right: 0, 37219 bottom: 0 37220 } : { 37221 overflow: "visible", 37222 position: "relative", 37223 width: "100%", 37224 height: "auto", 37225 top: "auto", 37226 bottom: "auto", 37227 left: "auto", 37228 right: "auto" 37229 }); 37230 return this; 37231 } 37232 return wrapper; 37233 }; 37234 this.effects = function(targets, config4) { 37235 var _effects2; 37236 effects || (effects = []); 37237 if (!targets) { 37238 return effects.slice(0); 37239 } 37240 targets = _toArray$2(targets); 37241 targets.forEach(function(target) { 37242 var i3 = effects.length; 37243 while (i3--) { 37244 effects[i3].trigger === target && effects[i3].kill(); 37245 } 37246 }); 37247 config4 = config4 || {}; 37248 var _config2 = config4, speed2 = _config2.speed, lag = _config2.lag, effectsPadding = _config2.effectsPadding, effectsToAdd = [], i2, st; 37249 for (i2 = 0; i2 < targets.length; i2++) { 37250 st = createEffect(targets[i2], speed2, lag, i2, effectsPadding); 37251 st && effectsToAdd.push(st); 37252 } 37253 (_effects2 = effects).push.apply(_effects2, effectsToAdd); 37254 config4.refresh !== false && ScrollTrigger$3.refresh(); 37255 return effectsToAdd; 37256 }; 37257 this.sections = function(targets, config4) { 37258 var _sections; 37259 sections || (sections = []); 37260 if (!targets) { 37261 return sections.slice(0); 37262 } 37263 var newSections = _toArray$2(targets).map(function(el) { 37264 return ScrollTrigger$3.create({ 37265 trigger: el, 37266 start: "top 120%", 37267 end: "bottom -20%", 37268 onToggle: function onToggle(self3) { 37269 el.style.opacity = self3.isActive ? "1" : "0"; 37270 el.style.pointerEvents = self3.isActive ? "all" : "none"; 37271 } 37272 }); 37273 }); 37274 config4 && config4.add ? (_sections = sections).push.apply(_sections, newSections) : sections = newSections.slice(0); 37275 return newSections; 37276 }; 37277 this.content(vars.content); 37278 this.wrapper(vars.wrapper); 37279 this.render = function(y2) { 37280 return render6(y2 || y2 === 0 ? y2 : currentY); 37281 }; 37282 this.getVelocity = function() { 37283 return tracker.getVelocity(-currentY); 37284 }; 37285 ScrollTrigger$3.scrollerProxy(wrapper, { 37286 scrollTop, 37287 scrollHeight: function scrollHeight() { 37288 return refreshHeight() && _body$3.scrollHeight; 37289 }, 37290 fixedMarkers: vars.fixedMarkers !== false && !!smoothDuration, 37291 content, 37292 getBoundingClientRect: function getBoundingClientRect() { 37293 return { 37294 top: 0, 37295 left: 0, 37296 width: _win$2.innerWidth, 37297 height: _win$2.innerHeight 37298 }; 37299 } 37300 }); 37301 ScrollTrigger$3.defaults({ 37302 scroller: wrapper 37303 }); 37304 var existingScrollTriggers = ScrollTrigger$3.getAll().filter(function(st) { 37305 return st.scroller === _win$2 || st.scroller === wrapper; 37306 }); 37307 existingScrollTriggers.forEach(function(st) { 37308 return st.revert(true, true); 37309 }); 37310 mainST = ScrollTrigger$3.create({ 37311 animation: gsap$3.fromTo(scroll, { 37312 y: function y2() { 37313 allowUpdates = 0; 37314 return 0; 37315 } 37316 }, { 37317 y: function y2() { 37318 allowUpdates = 1; 37319 return -refreshHeight(); 37320 }, 37321 immediateRender: false, 37322 ease: "none", 37323 data: "ScrollSmoother", 37324 duration: 100, 37325 // for added precision 37326 onUpdate: function onUpdate() { 37327 if (allowUpdates) { 37328 var force = isProxyScrolling; 37329 if (force) { 37330 killScrub(mainST); 37331 scroll.y = currentY; 37332 } 37333 render6(scroll.y, force); 37334 updateVelocity(); 37335 _onUpdate && !paused && _onUpdate(self2); 37336 } 37337 } 37338 }), 37339 onRefreshInit: function onRefreshInit(self3) { 37340 if (ScrollSmoother2.isRefreshing) { 37341 return; 37342 } 37343 ScrollSmoother2.isRefreshing = true; 37344 if (effects) { 37345 var _pins = ScrollTrigger$3.getAll().filter(function(st) { 37346 return !!st.pin; 37347 }); 37348 effects.forEach(function(st) { 37349 if (!st.vars.pinnedContainer) { 37350 _pins.forEach(function(pinST) { 37351 if (pinST.pin.contains(st.trigger)) { 37352 var v2 = st.vars; 37353 v2.pinnedContainer = pinST.pin; 37354 st.vars = null; 37355 st.init(v2, st.animation); 37356 } 37357 }); 37358 } 37359 }); 37360 } 37361 var scrub = self3.getTween(); 37362 recordedRefreshScrub = scrub && scrub._end > scrub._dp._time; 37363 recordedRefreshScroll = currentY; 37364 scroll.y = 0; 37365 if (smoothDuration) { 37366 ScrollTrigger$3.isTouch === 1 && (wrapper.style.position = "absolute"); 37367 wrapper.scrollTop = 0; 37368 ScrollTrigger$3.isTouch === 1 && (wrapper.style.position = "fixed"); 37369 } 37370 }, 37371 onRefresh: function onRefresh2(self3) { 37372 self3.animation.invalidate(); 37373 self3.setPositions(self3.start, refreshHeight() / speed); 37374 recordedRefreshScrub || killScrub(self3); 37375 scroll.y = -scrollFunc() * speed; 37376 render6(scroll.y); 37377 if (!startupPhase) { 37378 recordedRefreshScrub && (isProxyScrolling = false); 37379 self3.animation.progress(gsap$3.utils.clamp(0, 1, recordedRefreshScroll / speed / -self3.end)); 37380 } 37381 if (recordedRefreshScrub) { 37382 self3.progress -= 1e-3; 37383 self3.update(); 37384 } 37385 ScrollSmoother2.isRefreshing = false; 37386 }, 37387 id: "ScrollSmoother", 37388 scroller: _win$2, 37389 invalidateOnRefresh: true, 37390 start: 0, 37391 refreshPriority: -9999, 37392 // because all other pins, etc. should be calculated first before this figures out the height of the body. BUT this should also update FIRST so that the scroll position on the proxy is up-to-date when all the ScrollTriggers calculate their progress! -9999 is a special number that ScrollTrigger looks for to handle in this way. 37393 end: function end() { 37394 return refreshHeight() / speed; 37395 }, 37396 onScrubComplete: function onScrubComplete() { 37397 tracker.reset(); 37398 onStop && onStop(_this); 37399 }, 37400 scrub: smoothDuration || true 37401 }); 37402 this.smooth = function(value) { 37403 if (arguments.length) { 37404 smoothDuration = value || 0; 37405 speed = smoothDuration && +vars.speed || 1; 37406 mainST.scrubDuration(value); 37407 } 37408 return mainST.getTween() ? mainST.getTween().duration() : 0; 37409 }; 37410 mainST.getTween() && (mainST.getTween().vars.ease = vars.ease || _expo); 37411 this.scrollTrigger = mainST; 37412 vars.effects && this.effects(vars.effects === true ? "[data-" + effectsPrefix + "speed], [data-" + effectsPrefix + "lag]" : vars.effects, { 37413 effectsPadding: vars.effectsPadding, 37414 refresh: false 37415 }); 37416 vars.sections && this.sections(vars.sections === true ? "[data-section]" : vars.sections); 37417 existingScrollTriggers.forEach(function(st) { 37418 st.vars.scroller = wrapper; 37419 st.revert(false, true); 37420 st.init(st.vars, st.animation); 37421 }); 37422 this.paused = function(value, allowNestedScroll) { 37423 if (arguments.length) { 37424 if (!!paused !== value) { 37425 if (value) { 37426 mainST.getTween() && mainST.getTween().pause(); 37427 scrollFunc(-currentY / speed); 37428 tracker.reset(); 37429 pausedNormalizer = ScrollTrigger$3.normalizeScroll(); 37430 pausedNormalizer && pausedNormalizer.disable(); 37431 paused = ScrollTrigger$3.observe({ 37432 preventDefault: true, 37433 type: "wheel,touch,scroll", 37434 debounce: false, 37435 allowClicks: true, 37436 onChangeY: function onChangeY() { 37437 return scrollTop(-currentY); 37438 } 37439 // refuse to scroll 37440 }); 37441 paused.nested = _inputObserver$1(_docEl$3, "wheel,touch,scroll", true, allowNestedScroll !== false); 37442 } else { 37443 paused.nested.kill(); 37444 paused.kill(); 37445 paused = 0; 37446 pausedNormalizer && pausedNormalizer.enable(); 37447 mainST.progress = (-currentY / speed - mainST.start) / (mainST.end - mainST.start); 37448 killScrub(mainST); 37449 } 37450 } 37451 return this; 37452 } 37453 return !!paused; 37454 }; 37455 this.kill = this.revert = function() { 37456 _this.paused(false); 37457 killScrub(mainST); 37458 mainST.kill(); 37459 var triggers = (effects || []).concat(sections || []), i2 = triggers.length; 37460 while (i2--) { 37461 triggers[i2].kill(); 37462 } 37463 ScrollTrigger$3.scrollerProxy(wrapper); 37464 ScrollTrigger$3.removeEventListener("killAll", addOnRefresh); 37465 ScrollTrigger$3.removeEventListener("refresh", onRefresh); 37466 wrapper.style.cssText = wrapperCSS; 37467 content.style.cssText = contentCSS; 37468 var defaults3 = ScrollTrigger$3.defaults({}); 37469 defaults3 && defaults3.scroller === wrapper && ScrollTrigger$3.defaults({ 37470 scroller: _win$2 37471 }); 37472 _this.normalizer && ScrollTrigger$3.normalizeScroll(false); 37473 clearInterval(intervalID); 37474 _mainInstance = null; 37475 resizeObserver && resizeObserver.disconnect(); 37476 _body$3.style.removeProperty("height"); 37477 _win$2.removeEventListener("focusin", _onFocusIn); 37478 }; 37479 this.refresh = function(soft, force) { 37480 return mainST.refresh(soft, force); 37481 }; 37482 if (normalizeScroll) { 37483 this.normalizer = ScrollTrigger$3.normalizeScroll(normalizeScroll === true ? { 37484 debounce: true, 37485 content: !smoothDuration && content 37486 } : normalizeScroll); 37487 } 37488 ScrollTrigger$3.config(vars); 37489 "overscrollBehavior" in _win$2.getComputedStyle(_body$3) && gsap$3.set([_body$3, _docEl$3], { 37490 overscrollBehavior: "none" 37491 }); 37492 "scrollBehavior" in _win$2.getComputedStyle(_body$3) && gsap$3.set([_body$3, _docEl$3], { 37493 scrollBehavior: "auto" 37494 }); 37495 _win$2.addEventListener("focusin", _onFocusIn); 37496 intervalID = setInterval(updateVelocity, 250); 37497 _doc$2.readyState === "loading" || requestAnimationFrame(function() { 37498 return ScrollTrigger$3.refresh(); 37499 }); 37500 } 37501 ScrollSmoother2.register = function register3(core) { 37502 if (!_coreInitted$3) { 37503 gsap$3 = core || _getGSAP$3(); 37504 if (_windowExists$2() && window.document) { 37505 _win$2 = window; 37506 _doc$2 = document; 37507 _docEl$3 = _doc$2.documentElement; 37508 _body$3 = _doc$2.body; 37509 } 37510 if (gsap$3) { 37511 _toArray$2 = gsap$3.utils.toArray; 37512 _clamp$1 = gsap$3.utils.clamp; 37513 _expo = gsap$3.parseEase("expo"); 37514 _context$2 = gsap$3.core.context || function() { 37515 }; 37516 ScrollTrigger$3 = gsap$3.core.globals().ScrollTrigger; 37517 gsap$3.core.globals("ScrollSmoother", ScrollSmoother2); 37518 if (_body$3 && ScrollTrigger$3) { 37519 _onResizeDelayedCall = gsap$3.delayedCall(0.2, function() { 37520 return ScrollTrigger$3.isRefreshing || _mainInstance && _mainInstance.refresh(); 37521 }).pause();
37522 _getVelocityProp$1 = ScrollTrigger$3.core._getVelocityProp; 37523 _inputObserver$1 = ScrollTrigger$3.core._inputObserver; 37524 ScrollSmoother2.refresh = ScrollTrigger$3.refresh; 37525 _coreInitted$3 = 1; 37526 } 37527 } 37528 } 37529 return _coreInitted$3; 37530 }; 37531 _createClass$7(ScrollSmoother2, [{ 37532 key: "progress", 37533 get: function get4() { 37534 return this.scrollTrigger ? this.scrollTrigger.animation._time / 100 : 0; 37535 } 37536 }]); 37537 return ScrollSmoother2; 37538}(); 37539ScrollSmoother.version = "3.12.5"; 37540ScrollSmoother.create = function(vars) { 37541 return _mainInstance && vars && _mainInstance.content() === _toArray$2(vars.content)[0] ? _mainInstance : new ScrollSmoother(vars); 37542}; 37543ScrollSmoother.get = function() { 37544 return _mainInstance; 37545}; 37546_getGSAP$3() && gsap$3.registerPlugin(ScrollSmoother); 37547function _extends$f() { 37548 return _extends$f = Object.assign ? Object.assign.bind() : function(n2) { 37549 for (var e2 = 1; e2 < arguments.length; e2++) { 37550 var t2 = arguments[e2]; 37551 for (var r2 in t2) ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]); 37552 } 37553 return n2; 37554 }, _extends$f.apply(null, arguments); 37555} 37556function _objectWithoutPropertiesLoose$b(r2, e2) { 37557 if (null == r2) return {}; 37558 var t2 = {}; 37559 for (var n2 in r2) if ({}.hasOwnProperty.call(r2, n2)) { 37560 if (e2.includes(n2)) continue; 37561 t2[n2] = r2[n2]; 37562 } 37563 return t2; 37564} 37565function _objectWithoutProperties$b(e2, t2) { 37566 if (null == e2) return {}; 37567 var o2, r2, i2 = _objectWithoutPropertiesLoose$b(e2, t2); 37568 if (Object.getOwnPropertySymbols) { 37569 var s2 = Object.getOwnPropertySymbols(e2); 37570 for (r2 = 0; r2 < s2.length; r2++) o2 = s2[r2], t2.includes(o2) || {}.propertyIsEnumerable.call(e2, o2) && (i2[o2] = e2[o2]); 37571 } 37572 return i2; 37573} 37574function cx() { 37575 for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { 37576 classNames[_key] = arguments[_key]; 37577 } 37578 return classNames.reduce(function(acc, className) { 37579 if (Array.isArray(className)) { 37580 return acc.concat(className); 37581 } 37582 return acc.concat([className]); 37583 }, []).filter(Boolean).join(" "); 37584} 37585var _excluded$c = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"]; 37586function createHighlightPartComponent(_ref) { 37587 var createElement = _ref.createElement; 37588 return function HighlightPart(_ref22) { 37589 var classNames = _ref22.classNames, children = _ref22.children, highlightedTagName = _ref22.highlightedTagName, isHighlighted = _ref22.isHighlighted, nonHighlightedTagName = _ref22.nonHighlightedTagName; 37590 var TagName = isHighlighted ? highlightedTagName : nonHighlightedTagName; 37591 return createElement(TagName, { 37592 className: isHighlighted ? classNames.highlighted : classNames.nonHighlighted 37593 }, children); 37594 }; 37595} 37596function createHighlightComponent(_ref3) { 37597 var createElement = _ref3.createElement, Fragment = _ref3.Fragment; 37598 var HighlightPart = createHighlightPartComponent({ 37599 createElement, 37600 Fragment 37601 }); 37602 return function Highlight2(userProps) { 37603 var parts = userProps.parts, _userProps$highlighte = userProps.highlightedTagName, highlightedTagName = _userProps$highlighte === void 0 ? "mark" : _userProps$highlighte, _userProps$nonHighlig = userProps.nonHighlightedTagName, nonHighlightedTagName = _userProps$nonHighlig === void 0 ? "span" : _userProps$nonHighlig, _userProps$separator = userProps.separator, separator = _userProps$separator === void 0 ? ", " : _userProps$separator, className = userProps.className, _userProps$classNames = userProps.classNames, classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames, props = _objectWithoutProperties$b(userProps, _excluded$c); 37604 return createElement("span", _extends$f({}, props, { 37605 className: cx(classNames.root, className) 37606 }), parts.map(function(part, partIndex) { 37607 var isLastPart = partIndex === parts.length - 1; 37608 return createElement(Fragment, { 37609 key: partIndex 37610 }, part.map(function(subPart, subPartIndex) { 37611 return createElement(HighlightPart, { 37612 key: subPartIndex, 37613 classNames, 37614 highlightedTagName, 37615 nonHighlightedTagName, 37616 isHighlighted: subPart.isHighlighted 37617 }, subPart.value); 37618 }), !isLastPart && createElement("span", { 37619 className: classNames.separator 37620 }, separator)); 37621 })); 37622 }; 37623} 37624var _excluded$b = ["classNames", "hits", "itemComponent", "sendEvent", "emptyComponent", "banner", "bannerComponent"]; 37625function createDefaultBannerComponent(_ref) { 37626 var createElement = _ref.createElement; 37627 return function DefaultBanner(_ref22) { 37628 var classNames = _ref22.classNames, banner = _ref22.banner; 37629 if (!banner.image.urls[0].url) { 37630 return null; 37631 } 37632 return createElement("aside", { 37633 className: cx("ais-Hits-banner", classNames.bannerRoot) 37634 }, banner.link ? createElement("a", { 37635 className: cx("ais-Hits-banner-link", classNames.bannerLink), 37636 href: banner.link.url, 37637 target: banner.link.target 37638 }, createElement("img", { 37639 className: cx("ais-Hits-banner-image", classNames.bannerImage), 37640 src: banner.image.urls[0].url,
37641 alt: banner.image.title 37642 })) : createElement("img", { 37643 className: cx("ais-Hits-banner-image", classNames.bannerImage), 37644 src: banner.image.urls[0].url, 37645 alt: banner.image.title 37646 })); 37647 }; 37648} 37649function createHitsComponent(_ref3) { 37650 var createElement = _ref3.createElement, Fragment = _ref3.Fragment; 37651 var DefaultBannerComponent = createDefaultBannerComponent({ 37652 createElement, 37653 Fragment 37654 }); 37655 return function Hits2(userProps) { 37656 var _userProps$classNames = userProps.classNames, classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames, hits3 = userProps.hits, ItemComponent = userProps.itemComponent, sendEvent = userProps.sendEvent, EmptyComponent = userProps.emptyComponent, banner = userProps.banner, BannerComponent = userProps.bannerComponent, props = _objectWithoutProperties$b(userProps, _excluded$b); 37657 return createElement("div", _extends$f({}, props, { 37658 className: cx("ais-Hits", classNames.root, hits3.length === 0 && cx("ais-Hits--empty", classNames.emptyRoot), props.className) 37659 }), banner && (BannerComponent ? createElement(BannerComponent, { 37660 className: cx("ais-Hits-banner", classNames.bannerRoot), 37661 banner 37662 }) : createElement(DefaultBannerComponent, { 37663 classNames, 37664 banner 37665 })), hits3.length === 0 && EmptyComponent ? createElement(EmptyComponent, null) : createElement("ol", { 37666 className: cx("ais-Hits-list", classNames.list) 37667 }, hits3.map(function(hit, index3) { 37668 return createElement(ItemComponent, { 37669 key: hit.objectID, 37670 hit, 37671 index: index3, 37672 className: cx("ais-Hits-item", classNames.item), 37673 onClick: function onClick() { 37674 sendEvent("click:internal", hit, "Hit Clicked"); 37675 },
vendor: 5,358 bytes, lines 37676-37770
37676 onAuxClick: function onAuxClick() { 37677 sendEvent("click:internal", hit, "Hit Clicked"); 37678 } 37679 }); 37680 }))); 37681 }; 37682} 37683var n$9, l$3, u$2, i$7, o$6, r$6, f$3, e$8, c$4, s$5, h$1 = {}, v$1 = [], p$2 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, y$1 = Array.isArray; 37684function d$4(n2, l2) { 37685 for (var u2 in l2) n2[u2] = l2[u2]; 37686 return n2; 37687} 37688function w(n2) { 37689 n2 && n2.parentNode && n2.parentNode.removeChild(n2); 37690} 37691function _$1(l2, u2, t2) { 37692 var i2, o2, r2, f2 = {}; 37693 for (r2 in u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o2 = u2[r2] : f2[r2] = u2[r2]; 37694 if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n$9.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (r2 in l2.defaultProps) void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]); 37695 return g$4(l2, f2, i2, o2, null); 37696} 37697function g$4(n2, t2, i2, o2, r2) { 37698 var f2 = { type: n2, props: t2, key: i2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r2 ? ++u$2 : r2, __i: -1, __u: 0 }; 37699 return null == r2 && null != l$3.vnode && l$3.vnode(f2), f2; 37700} 37701function m$6() { 37702 return { current: null }; 37703} 37704function b$3(n2) { 37705 return n2.children; 37706} 37707function k$2(n2, l2) { 37708 this.props = n2, this.context = l2; 37709} 37710function x$3(n2, l2) { 37711 if (null == l2) return n2.__ ? x$3(n2.__, n2.__i + 1) : null; 37712 for (var u2; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) return u2.__e; 37713 return "function" == typeof n2.type ? x$3(n2) : null; 37714} 37715function C$1(n2) { 37716 var l2, u2; 37717 if (null != (n2 = n2.__) && null != n2.__c) { 37718 for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) { 37719 n2.__e = n2.__c.base = u2.__e; 37720 break; 37721 } 37722 return C$1(n2); 37723 } 37724} 37725function S$1(n2) { 37726 (!n2.__d && (n2.__d = true) && i$7.push(n2) && !M$1.__r++ || o$6 !== l$3.debounceRendering) && ((o$6 = l$3.debounceRendering) || r$6)(M$1); 37727} 37728function M$1() { 37729 var n2, u2, t2, o2, r2, e2, c2, s2; 37730 for (i$7.sort(f$3); n2 = i$7.shift(); ) n2.__d && (u2 = i$7.length, o2 = void 0, e2 = (r2 = (t2 = n2).__v).__e, c2 = [], s2 = [], t2.__P && ((o2 = d$4({}, r2)).__v = r2.__v + 1, l$3.vnode && l$3.vnode(o2), O$2(t2.__P, o2, r2, t2.__n, t2.__P.namespaceURI, 32 & r2.__u ? [e2] : null, c2, null == e2 ? x$3(r2) : e2, !!(32 & r2.__u), s2), o2.__v = r2.__v, o2.__.__k[o2.__i] = o2, j$2(c2, o2, s2), o2.__e != e2 && C$1(o2)), i$7.length > u2 && i$7.sort(f$3)); 37731 M$1.__r = 0; 37732} 37733function P(n2, l2, u2, t2, i2, o2, r2, f2, e2, c2, s2) { 37734 var a2, p2, y2, d2, w2, _2 = t2 && t2.__k || v$1, g2 = l2.length; 37735 for (u2.__d = e2, $$1(u2, l2, _2), e2 = u2.__d, a2 = 0; a2 < g2; a2++) null != (y2 = u2.__k[a2]) && (p2 = -1 === y2.__i ? h$1 : _2[y2.__i] || h$1, y2.__i = a2, O$2(n2, y2, p2, i2, o2, r2, f2, e2, c2, s2), d2 = y2.__e, y2.ref && p2.ref != y2.ref && (p2.ref && N$1(p2.ref, null, y2), s2.push(y2.ref, y2.__c || d2, y2)), null == w2 && null != d2 && (w2 = d2), 65536 & y2.__u || p2.__k === y2.__k ? e2 = I$3(y2, e2, n2) : "function" == typeof y2.type && void 0 !== y2.__d ? e2 = y2.__d : d2 && (e2 = d2.nextSibling), y2.__d = void 0, y2.__u &= -196609); 37736 u2.__d = e2, u2.__e = w2; 37737} 37738function $$1(n2, l2, u2) { 37739 var t2, i2, o2, r2, f2, e2 = l2.length, c2 = u2.length, s2 = c2, a2 = 0; 37740 for (n2.__k = [], t2 = 0; t2 < e2; t2++) null != (i2 = l2[t2]) && "boolean" != typeof i2 && "function" != typeof i2 ? (r2 = t2 + a2, (i2 = n2.__k[t2] = "string" == typeof i2 || "number" == typeof i2 || "bigint" == typeof i2 || i2.constructor == String ? g$4(null, i2, null, null, null) : y$1(i2) ? g$4(b$3, { children: i2 }, null, null, null) : void 0 === i2.constructor && i2.__b > 0 ? g$4(i2.type, i2.props, i2.key, i2.ref ? i2.ref : null, i2.__v) : i2).__ = n2, i2.__b = n2.__b + 1, o2 = null, -1 !== (f2 = i2.__i = L$1(i2, u2, r2, s2)) && (s2--, (o2 = u2[f2]) && (o2.__u |= 131072)), null == o2 || null === o2.__v ? (-1 == f2 && a2--, "function" != typeof i2.type && (i2.__u |= 65536)) : f2 !== r2 && (f2 == r2 - 1 ? a2-- : f2 == r2 + 1 ? a2++ : (f2 > r2 ? a2-- : a2++, i2.__u |= 65536))) : i2 = n2.__k[t2] = null; 37741 if (s2) for (t2 = 0; t2 < c2; t2++) null != (o2 = u2[t2]) && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = x$3(o2)), V(o2, o2)); 37742} 37743function I$3(n2, l2, u2) { 37744 var t2, i2; 37745 if ("function" == typeof n2.type) { 37746 for (t2 = n2.__k, i2 = 0; t2 && i2 < t2.length; i2++) t2[i2] && (t2[i2].__ = n2, l2 = I$3(t2[i2], l2, u2)); 37747 return l2; 37748 } 37749 n2.__e != l2 && (l2 && n2.type && !u2.contains(l2) && (l2 = x$3(n2)), u2.insertBefore(n2.__e, l2 || null), l2 = n2.__e); 37750 do { 37751 l2 = l2 && l2.nextSibling; 37752 } while (null != l2 && 8 === l2.nodeType); 37753 return l2; 37754} 37755function L$1(n2, l2, u2, t2) { 37756 var i2 = n2.key, o2 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2]; 37757 if (null === e2 || e2 && i2 == e2.key && o2 === e2.type && 0 == (131072 & e2.__u)) return u2; 37758 if (t2 > (null != e2 && 0 == (131072 & e2.__u) ? 1 : 0)) for (; r2 >= 0 || f2 < l2.length; ) { 37759 if (r2 >= 0) { 37760 if ((e2 = l2[r2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return r2; 37761 r2--; 37762 } 37763 if (f2 < l2.length) { 37764 if ((e2 = l2[f2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return f2; 37765 f2++; 37766 } 37767 } 37768 return -1; 37769} 37770function T(n2, l2, u2) {
37771 "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || p$2.test(l2) ? u2 : u2 + "px"; 37772} 37773function A$2(n2, l2, u2, t2, i2) { 37774 var o2; 37775 n: if ("style" === l2) if ("string" == typeof u2) n2.style.cssText = u2; 37776 else { 37777 if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2) for (l2 in t2) u2 && l2 in u2 || T(n2.style, l2, ""); 37778 if (u2) for (l2 in u2) t2 && u2[l2] === t2[l2] || T(n2.style, l2, u2[l2]); 37779 } 37780 else if ("o" === l2[0] && "n" === l2[1]) o2 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/i, "$1")), l2 = l2.toLowerCase() in n2 || "onFocusOut" === l2 || "onFocusIn" === l2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? t2 ? u2.u = t2.u : (u2.u = e$8, n2.addEventListener(l2, o2 ? s$5 : c$4, o2)) : n2.removeEventListener(l2, o2 ? s$5 : c$4, o2); 37781 else { 37782 if ("http://www.w3.org/2000/svg" == i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); 37783 else if ("width" != l2 && "height" != l2 && "href" != l2 && "list" != l2 && "form" != l2 && "tabIndex" != l2 && "download" != l2 && "rowSpan" != l2 && "colSpan" != l2 && "role" != l2 && "popover" != l2 && l2 in n2) try { 37784 n2[l2] = null == u2 ? "" : u2; 37785 break n; 37786 } catch (n3) { 37787 } 37788 "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, "popover" == l2 && 1 == u2 ? "" : u2)); 37789 } 37790} 37791function F(n2) { 37792 return function(u2) { 37793 if (this.l) { 37794 var t2 = this.l[u2.type + n2]; 37795 if (null == u2.t) u2.t = e$8++; 37796 else if (u2.t < t2.u) return; 37797 return t2(l$3.event ? l$3.event(u2) : u2); 37798 } 37799 }; 37800} 37801function O$2(n2, u2, t2, i2, o2, r2, f2, e2, c2, s2) { 37802 var a2, h2, v2, p2, w2, _2, g2, m2, x2, C2, S2, M2, $2, I2, H, L2, T2 = u2.type; 37803 if (void 0 !== u2.constructor) return null; 37804 128 & t2.__u && (c2 = !!(32 & t2.__u), r2 = [e2 = u2.__e = t2.__e]), (a2 = l$3.__b) && a2(u2); 37805 n: if ("function" == typeof T2) try { 37806 if (m2 = u2.props, x2 = "prototype" in T2 && T2.prototype.render, C2 = (a2 = T2.contextType) && i2[a2.__c], S2 = a2 ? C2 ? C2.props.value : a2.__ : i2, t2.__c ? g2 = (h2 = u2.__c = t2.__c).__ = h2.__E : (x2 ? u2.__c = h2 = new T2(m2, S2) : (u2.__c = h2 = new k$2(m2, S2), h2.constructor = T2, h2.render = q), C2 && C2.sub(h2), h2.props = m2, h2.state || (h2.state = {}), h2.context = S2, h2.__n = i2, v2 = h2.__d = true, h2.__h = [], h2._sb = []), x2 && null == h2.__s && (h2.__s = h2.state), x2 && null != T2.getDerivedStateFromProps && (h2.__s == h2.state && (h2.__s = d$4({}, h2.__s)), d$4(h2.__s, T2.getDerivedStateFromProps(m2, h2.__s))), p2 = h2.props, w2 = h2.state, h2.__v = u2, v2) x2 && null == T2.getDerivedStateFromProps && null != h2.componentWillMount && h2.componentWillMount(), x2 && null != h2.componentDidMount && h2.__h.push(h2.componentDidMount); 37807 else { 37808 if (x2 && null == T2.getDerivedStateFromProps && m2 !== p2 && null != h2.componentWillReceiveProps && h2.componentWillReceiveProps(m2, S2), !h2.__e && (null != h2.shouldComponentUpdate && false === h2.shouldComponentUpdate(m2, h2.__s, S2) || u2.__v === t2.__v)) { 37809 for (u2.__v !== t2.__v && (h2.props = m2, h2.state = h2.__s, h2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.some(function(n3) { 37810 n3 && (n3.__ = u2); 37811 }), M2 = 0; M2 < h2._sb.length; M2++) h2.__h.push(h2._sb[M2]); 37812 h2._sb = [], h2.__h.length && f2.push(h2); 37813 break n; 37814 } 37815 null != h2.componentWillUpdate && h2.componentWillUpdate(m2, h2.__s, S2), x2 && null != h2.componentDidUpdate && h2.__h.push(function() { 37816 h2.componentDidUpdate(p2, w2, _2); 37817 }); 37818 } 37819 if (h2.context = S2, h2.props = m2, h2.__P = n2, h2.__e = false, $2 = l$3.__r, I2 = 0, x2) { 37820 for (h2.state = h2.__s, h2.__d = false, $2 && $2(u2), a2 = h2.render(h2.props, h2.state, h2.context), H = 0; H < h2._sb.length; H++) h2.__h.push(h2._sb[H]); 37821 h2._sb = []; 37822 } else do { 37823 h2.__d = false, $2 && $2(u2), a2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s; 37824 } while (h2.__d && ++I2 < 25); 37825 h2.state = h2.__s, null != h2.getChildContext && (i2 = d$4(d$4({}, i2), h2.getChildContext())), x2 && !v2 && null != h2.getSnapshotBeforeUpdate && (_2 = h2.getSnapshotBeforeUpdate(p2, w2)), P(n2, y$1(L2 = null != a2 && a2.type === b$3 && null == a2.key ? a2.props.children : a2) ? L2 : [L2], u2, t2, i2, o2, r2, f2, e2, c2, s2), h2.base = u2.__e, u2.__u &= -161, h2.__h.length && f2.push(h2), g2 && (h2.__E = h2.__ = null); 37826 } catch (n3) { 37827 if (u2.__v = null, c2 || null != r2) { 37828 for (u2.__u |= c2 ? 160 : 128; e2 && 8 === e2.nodeType && e2.nextSibling; ) e2 = e2.nextSibling; 37829 r2[r2.indexOf(e2)] = null, u2.__e = e2; 37830 } else u2.__e = t2.__e, u2.__k = t2.__k; 37831 l$3.__e(n3, u2, t2); 37832 } 37833 else null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = z$1(t2.__e, u2, t2, i2, o2, r2, f2, c2, s2); 37834 (a2 = l$3.diffed) && a2(u2); 37835} 37836function j$2(n2, u2, t2) { 37837 u2.__d = void 0; 37838 for (var i2 = 0; i2 < t2.length; i2++) N$1(t2[i2], t2[++i2], t2[++i2]);
37839 l$3.__c && l$3.__c(u2, n2), n2.some(function(u3) { 37840 try { 37841 n2 = u3.__h, u3.__h = [], n2.some(function(n3) { 37842 n3.call(u3); 37843 }); 37844 } catch (n3) { 37845 l$3.__e(n3, u3.__v); 37846 } 37847 }); 37848} 37849function z$1(u2, t2, i2, o2, r2, f2, e2, c2, s2) { 37850 var a2, v2, p2, d2, _2, g2, m2, b2 = i2.props, k2 = t2.props, C2 = t2.type; 37851 if ("svg" === C2 ? r2 = "http://www.w3.org/2000/svg" : "math" === C2 ? r2 = "http://www.w3.org/1998/Math/MathML" : r2 || (r2 = "http://www.w3.org/1999/xhtml"), null != f2) { 37852 for (a2 = 0; a2 < f2.length; a2++) if ((_2 = f2[a2]) && "setAttribute" in _2 == !!C2 && (C2 ? _2.localName === C2 : 3 === _2.nodeType)) { 37853 u2 = _2, f2[a2] = null; 37854 break; 37855 } 37856 } 37857 if (null == u2) { 37858 if (null === C2) return document.createTextNode(k2); 37859 u2 = document.createElementNS(r2, C2, k2.is && k2), c2 && (l$3.__m && l$3.__m(t2, f2), c2 = false), f2 = null; 37860 } 37861 if (null === C2) b2 === k2 || c2 && u2.data === k2 || (u2.data = k2); 37862 else { 37863 if (f2 = f2 && n$9.call(u2.childNodes), b2 = i2.props || h$1, !c2 && null != f2) for (b2 = {}, a2 = 0; a2 < u2.attributes.length; a2++) b2[(_2 = u2.attributes[a2]).name] = _2.value; 37864 for (a2 in b2) if (_2 = b2[a2], "children" == a2) ; 37865 else if ("dangerouslySetInnerHTML" == a2) p2 = _2; 37866 else if (!(a2 in k2)) { 37867 if ("value" == a2 && "defaultValue" in k2 || "checked" == a2 && "defaultChecked" in k2) continue; 37868 A$2(u2, a2, null, _2, r2); 37869 } 37870 for (a2 in k2) _2 = k2[a2], "children" == a2 ? d2 = _2 : "dangerouslySetInnerHTML" == a2 ? v2 = _2 : "value" == a2 ? g2 = _2 : "checked" == a2 ? m2 = _2 : c2 && "function" != typeof _2 || b2[a2] === _2 || A$2(u2, a2, _2, b2[a2], r2); 37871 if (v2) c2 || p2 && (v2.__html === p2.__html || v2.__html === u2.innerHTML) || (u2.innerHTML = v2.__html), t2.__k = []; 37872 else if (p2 && (u2.innerHTML = ""), P(u2, y$1(d2) ? d2 : [d2], t2, i2, o2, "foreignObject" === C2 ? "http://www.w3.org/1999/xhtml" : r2, f2, e2, f2 ? f2[0] : i2.__k && x$3(i2, 0), c2, s2), null != f2) for (a2 = f2.length; a2--; ) w(f2[a2]); 37873 c2 || (a2 = "value", "progress" === C2 && null == g2 ? u2.removeAttribute("value") : void 0 !== g2 && (g2 !== u2[a2] || "progress" === C2 && !g2 || "option" === C2 && g2 !== b2[a2]) && A$2(u2, a2, g2, b2[a2], r2), a2 = "checked", void 0 !== m2 && m2 !== u2[a2] && A$2(u2, a2, m2, b2[a2], r2)); 37874 } 37875 return u2; 37876} 37877function N$1(n2, u2, t2) { 37878 try { 37879 if ("function" == typeof n2) { 37880 var i2 = "function" == typeof n2.__u; 37881 i2 && n2.__u(), i2 && null == u2 || (n2.__u = n2(u2)); 37882 } else n2.current = u2; 37883 } catch (n3) { 37884 l$3.__e(n3, t2); 37885 } 37886} 37887function V(n2, u2, t2) { 37888 var i2, o2; 37889 if (l$3.unmount && l$3.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || N$1(i2, null, u2)), null != (i2 = n2.__c)) { 37890 if (i2.componentWillUnmount) try { 37891 i2.componentWillUnmount(); 37892 } catch (n3) { 37893 l$3.__e(n3, u2); 37894 } 37895 i2.base = i2.__P = null; 37896 } 37897 if (i2 = n2.__k) for (o2 = 0; o2 < i2.length; o2++) i2[o2] && V(i2[o2], u2, t2 || "function" != typeof n2.type); 37898 t2 || w(n2.__e), n2.__c = n2.__ = n2.__e = n2.__d = void 0; 37899} 37900function q(n2, l2, u2) { 37901 return this.constructor(n2, u2); 37902} 37903function B$1(u2, t2, i2) { 37904 var o2, r2, f2, e2; 37905 l$3.__ && l$3.__(u2, t2), r2 = (o2 = "function" == typeof i2) ? null : t2.__k, f2 = [], e2 = [], O$2(t2, u2 = (!o2 && i2 || t2).__k = _$1(b$3, null, [u2]), r2 || h$1, h$1, t2.namespaceURI, !o2 && i2 ? [i2] : r2 ? null : t2.firstChild ? n$9.call(t2.childNodes) : null, f2, !o2 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o2, e2), j$2(f2, u2, e2); 37906} 37907n$9 = v$1.slice, l$3 = { __e: function(n2, l2, u2, t2) { 37908 for (var i2, o2, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try { 37909 if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2; 37910 } catch (l3) { 37911 n2 = l3; 37912 } 37913 throw n2; 37914} }, u$2 = 0, k$2.prototype.setState = function(n2, l2) { 37915 var u2; 37916 u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = d$4({}, this.state), "function" == typeof n2 && (n2 = n2(d$4({}, u2), this.props)), n2 && d$4(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), S$1(this)); 37917}, k$2.prototype.forceUpdate = function(n2) { 37918 this.__v && (this.__e = true, n2 && this.__h.push(n2), S$1(this)); 37919}, k$2.prototype.render = b$3, i$7 = [], r$6 = "function" == typeof Promise ? Promise.prototype.then.bind(Prom
37919ise.resolve()) : setTimeout, f$3 = function(n2, l2) { 37920 return n2.__v.__b - l2.__v.__b; 37921}, M$1.__r = 0, e$8 = 0, c$4 = F(false), s$5 = F(true); 37922function _typeof$r(obj) { 37923 "@babel/helpers - typeof"; 37924 return _typeof$r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 37925 return typeof obj2; 37926 } : function(obj2) { 37927 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 37928 }, _typeof$r(obj); 37929} 37930function ownKeys$m(object, enumerableOnly) { 37931 var keys = Object.keys(object); 37932 if (Object.getOwnPropertySymbols) { 37933 var symbols = Object.getOwnPropertySymbols(object); 37934 enumerableOnly && (symbols = symbols.filter(function(sym) { 37935 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 37936 })), keys.push.apply(keys, symbols); 37937 } 37938 return keys; 37939} 37940function _objectSpread$m(target) { 37941 for (var i2 = 1; i2 < arguments.length; i2++) { 37942 var source = null != arguments[i2] ? arguments[i2] : {}; 37943 i2 % 2 ? ownKeys$m(Object(source), true).forEach(function(key2) { 37944 _defineProperty$r(target, key2, source[key2]); 37945 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$m(Object(source)).forEach(function(key2) { 37946 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 37947 }); 37948 } 37949 return target; 37950} 37951function _defineProperty$r(obj, key2, value) { 37952 key2 = _toPropertyKey$r(key2); 37953 if (key2 in obj) { 37954 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 37955 } else { 37956 obj[key2] = value; 37957 } 37958 return obj; 37959} 37960function _toPropertyKey$r(arg) { 37961 var key2 = _toPrimitive$r(arg, "string"); 37962 return _typeof$r(key2) === "symbol" ? key2 : String(key2); 37963} 37964function _toPrimitive$r(input, hint) { 37965 if (_typeof$r(input) !== "object" || input === null) return input; 37966 var prim = input[Symbol.toPrimitive]; 37967 if (prim !== void 0) { 37968 var res = prim.call(input, hint || "default"); 37969 if (_typeof$r(res) !== "object") return res; 37970 throw new TypeError("@@toPrimitive must return a primitive value."); 37971 } 37972 return (hint === "string" ? String : Number)(input); 37973} 37974function _toConsumableArray$3(arr) { 37975 return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$5(arr) || _nonIterableSpread$3(); 37976} 37977function _nonIterableSpread$3() { 37978 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 37979} 37980function _unsupportedIterableToArray$5(o2, minLen) { 37981 if (!o2) return; 37982 if (typeof o2 === "string") return _arrayLikeToArray$5(o2, minLen); 37983 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 37984 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 37985 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 37986 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$5(o2, minLen); 37987} 37988function _iterableToArray$3(iter) { 37989 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 37990} 37991function _arrayWithoutHoles$3(arr) { 37992 if (Array.isArray(arr)) return _arrayLikeToArray$5(arr); 37993} 37994function _arrayLikeToArray$5(arr, len2) { 37995 if (len2 == null || len2 > arr.length) len2 = arr.length; 37996 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 37997 return arr2; 37998} 37999function prepareTemplates(defaultTemplates2) { 38000 var templates = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 38001 var allKeys = uniq([].concat(_toConsumableArray$3(Object.keys(defaultTemplates2 || {})), _toConsumableArray$3(Object.keys(templates)))); 38002 return allKeys.reduce(function(config4, key2) { 38003 var defaultTemplate2 = defaultTemplates2 ? defaultTemplates2[key2] : void 0; 38004 var customTemplate = templates[key2]; 38005 var isCustomTemplate = customTemplate !== void 0 && customTemplate !== defaultTemplate2; 38006 config4.templates[key2] = isCustomTemplate ? customTemplate : defaultTemplate2; 38007 config4.useCustomCompileOptions[key2] = isCustomTemplate; 38008 return config4; 38009 }, { 38010 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions 38011 templates: {}, 38012 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions 38013 useCustomCompileOptions: {} 38014 }); 38015} 38016function prepareTemplateProps(_ref) { 38017 var defaultTemplates2 = _ref.defaultTemplates, templates = _ref.templates, templatesConfig = _ref.templatesConfig; 38018 var preparedTemplates = prepareTemplates(defaultTemplates2, templates); 38019 return _objectSpread$m({ 38020 templatesConfig 38021 }, preparedTemplates); 38022}
vendor: 22,127 bytes, lines 38023-38625
38023var compiler = {}; 38024(function(exports) { 38025 (function(Hogan2) { 38026 var rIsWhitespace = /\S/, rQuot = /\"/g, rNewline = /\n/g, rCr = /\r/g, rSlash = /\\/g, rLineSep = /\u2028/, rParagraphSep = /\u2029/; 38027 Hogan2.tags = { 38028 "#": 1, 38029 "^": 2, 38030 "<": 3, 38031 "$": 4, 38032 "/": 5, 38033 "!": 6, 38034 ">": 7, 38035 "=": 8, 38036 "_v": 9, 38037 "{": 10, 38038 "&": 11, 38039 "_t": 12 38040 }; 38041 Hogan2.scan = function scan(text, delimiters) { 38042 var len2 = text.length, IN_TEXT = 0, IN_TAG_TYPE = 1, IN_TAG = 2, state = IN_TEXT, tagType = null, tag = null, buf = "", tokens = [], seenTag = false, i2 = 0, lineStart = 0, otag = "{{", ctag = "}}"; 38043 function addBuf() { 38044 if (buf.length > 0) { 38045 tokens.push({ tag: "_t", text: new String(buf) }); 38046 buf = ""; 38047 } 38048 } 38049 function lineIsWhitespace() { 38050 var isAllWhitespace = true; 38051 for (var j2 = lineStart; j2 < tokens.length; j2++) { 38052 isAllWhitespace = Hogan2.tags[tokens[j2].tag] < Hogan2.tags["_v"] || tokens[j2].tag == "_t" && tokens[j2].text.match(rIsWhitespace) === null; 38053 if (!isAllWhitespace) { 38054 return false; 38055 } 38056 } 38057 return isAllWhitespace; 38058 } 38059 function filterLine(haveSeenTag, noNewLine) { 38060 addBuf(); 38061 if (haveSeenTag && lineIsWhitespace()) { 38062 for (var j2 = lineStart, next2; j2 < tokens.length; j2++) { 38063 if (tokens[j2].text) { 38064 if ((next2 = tokens[j2 + 1]) && next2.tag == ">") { 38065 next2.indent = tokens[j2].text.toString(); 38066 } 38067 tokens.splice(j2, 1); 38068 } 38069 } 38070 } else if (!noNewLine) { 38071 tokens.push({ tag: "\n" }); 38072 } 38073 seenTag = false; 38074 lineStart = tokens.length; 38075 } 38076 function changeDelimiters(text2, index3) { 38077 var close = "=" + ctag, closeIndex = text2.indexOf(close, index3), delimiters2 = trim( 38078 text2.substring(text2.indexOf("=", index3) + 1, closeIndex) 38079 ).split(" "); 38080 otag = delimiters2[0]; 38081 ctag = delimiters2[delimiters2.length - 1]; 38082 return closeIndex + close.length - 1; 38083 } 38084 if (delimiters) { 38085 delimiters = delimiters.split(" "); 38086 otag = delimiters[0]; 38087 ctag = delimiters[1]; 38088 } 38089 for (i2 = 0; i2 < len2; i2++) { 38090 if (state == IN_TEXT) { 38091 if (tagChange(otag, text, i2)) { 38092 --i2; 38093 addBuf(); 38094 state = IN_TAG_TYPE; 38095 } else { 38096 if (text.charAt(i2) == "\n") { 38097 filterLine(seenTag); 38098 } else { 38099 buf += text.charAt(i2); 38100 } 38101 } 38102 } else if (state == IN_TAG_TYPE) { 38103 i2 += otag.length - 1; 38104 tag = Hogan2.tags[text.charAt(i2 + 1)]; 38105 tagType = tag ? text.charAt(i2 + 1) : "_v"; 38106 if (tagType == "=") { 38107 i2 = changeDelimiters(text, i2); 38108 state = IN_TEXT; 38109 } else { 38110 if (tag) { 38111 i2++; 38112 } 38113 state = IN_TAG; 38114 } 38115 seenTag = i2; 38116 } else { 38117 if (tagChange(ctag, text, i2)) { 38118 tokens.push({ 38119 tag: tagType, 38120 n: trim(buf), 38121 otag, 38122 ctag, 38123 i: tagType == "/" ? seenTag - otag.length : i2 + ctag.length 38124 }); 38125 buf = ""; 38126 i2 += ctag.length - 1; 38127 state = IN_TEXT; 38128 if (tagType == "{") { 38129 if (ctag == "}}") { 38130 i2++; 38131 } else { 38132 cleanTripleStache(tokens[tokens.length - 1]); 38133 } 38134 } 38135 } else { 38136 buf += text.charAt(i2); 38137 } 38138 } 38139 } 38140 filterLine(seenTag, true); 38141 return tokens; 38142 }; 38143 function cleanTripleStache(token) { 38144 if (token.n.substr(token.n.length - 1) === "}") { 38145 token.n = token.n.substring(0, token.n.length - 1); 38146 } 38147 } 38148 function trim(s2) { 38149 if (s2.trim) { 38150 return s2.trim(); 38151 } 38152 return s2.replace(/^\s*|\s*$/g, ""); 38153 } 38154 function tagChange(tag, text, index3) { 38155 if (text.charAt(index3) != tag.charAt(0)) { 38156 return false; 38157 } 38158 for (var i2 = 1, l2 = tag.length; i2 < l2; i2++) { 38159 if (text.charAt(index3 + i2) != tag.charAt(i2)) { 38160 return false; 38161 } 38162 } 38163 return true; 38164 } 38165 var allowedInSuper = { "_t": true, "\n": true, "$": true, "/": true }; 38166 function buildTree(tokens, kind, stack, customTags) { 38167 var instructions = [], opener = null, tail = null, token = null; 38168 tail = stack[stack.length - 1]; 38169 while (tokens.length > 0) { 38170 token = tokens.shift(); 38171 if (tail && tail.tag == "<" && !(token.tag in allowedInSuper)) { 38172 throw new Error("Illegal content in < super tag."); 38173 } 38174 if (Hogan2.tags[token.tag] <= Hogan2.tags["$"] || isOpener(token, customTags)) { 38175 stack.push(token); 38176 token.nodes = buildTree(tokens, token.tag, stack, customTags); 38177 } else if (token.tag == "/") { 38178 if (stack.length === 0) { 38179 throw new Error("Closing tag without opener: /" + token.n); 38180 } 38181 opener = stack.pop(); 38182 if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) { 38183 throw new Error("Nesting error: " + opener.n + " vs. " + token.n); 38184 } 38185 opener.end = token.i; 38186 return instructions; 38187 } else if (token.tag == "\n") { 38188 token.last = tokens.length == 0 || tokens[0].tag == "\n"; 38189 } 38190 instructions.push(token); 38191 } 38192 if (stack.length > 0) { 38193 throw new Error("missing closing tag: " + stack.pop().n); 38194 } 38195 return instructions; 38196 } 38197 function isOpener(token, tags) { 38198 for (var i2 = 0, l2 = tags.length; i2 < l2; i2++) { 38199 if (tags[i2].o == token.n) { 38200 token.tag = "#"; 38201 return true; 38202 } 38203 } 38204 } 38205 function isCloser(close, open, tags) { 38206 for (var i2 = 0, l2 = tags.length; i2 < l2; i2++) { 38207 if (tags[i2].c == close && tags[i2].o == open) { 38208 return true; 38209 } 38210 } 38211 } 38212 function stringifySubstitutions(obj) { 38213 var items = []; 38214 for (var key2 in obj) { 38215 items.push('"' + esc(key2) + '": function(c,p,t,i) {' + obj[key2] + "}"); 38216 } 38217 return "{ " + items.join(",") + " }"; 38218 } 38219 function stringifyPartials(codeObj) { 38220 var partials = []; 38221 for (var key2 in codeObj.partials) { 38222 partials.push('"' + esc(key2) + '":{name:"' + esc(codeObj.partials[key2].name) + '", ' + stringifyPartials(codeObj.partials[key2]) + "}"); 38223 } 38224 return "partials: {" + partials.join(",") + "}, subs: " + stringifySubstitutions(codeObj.subs); 38225 } 38226 Hogan2.stringify = function(codeObj, text, options) { 38227 return "{code: function (c,p,i) { " + Hogan2.wrapMain(codeObj.code) + " }," + stringifyPartials(codeObj) + "}"; 38228 }; 38229 var serialNo = 0; 38230 Hogan2.generate = function(tree, text, options) { 38231 serialNo = 0; 38232 var context3 = { code: "", subs: {}, partials: {} }; 38233 Hogan2.walk(tree, context3); 38234 if (options.asString) { 38235 return this.stringify(context3, text, options); 38236 } 38237 return this.makeTemplate(context3, text, options); 38238 }; 38239 Hogan2.wrapMain = function(code) { 38240 return 'var t=this;t.b(i=i||"");' + code + "return t.fl();"; 38241 }; 38242 Hogan2.template = Hogan2.Template; 38243 Hogan2.makeTemplate = function(codeObj, text, options) { 38244 var template2 = this.makePartials(codeObj); 38245 template2.code = new Function("c", "p", "i", this.wrapMain(codeObj.code)); 38246 return new this.template(template2, text, this, options); 38247 }; 38248 Hogan2.makePartials = function(codeObj) { 38249 var key2, template2 = { subs: {}, partials: codeObj.partials, name: codeObj.name }; 38250 for (key2 in template2.partials) { 38251 template2.partials[key2] = this.makePartials(template2.partials[key2]); 38252 } 38253 for (key2 in codeObj.subs) { 38254 template2.subs[key2] = new Function("c", "p", "t", "i", codeObj.subs[key2]); 38255 } 38256 return template2; 38257 }; 38258 function esc(s2) { 38259 return s2.replace(rSlash, "\\\\").replace(rQuot, '\\"').replace(rNewline, "\\n").replace(rCr, "\\r").replace(rLineSep, "\\u2028").replace(rParagraphSep, "\\u2029"); 38260 } 38261 function chooseMethod(s2) { 38262 return ~s2.indexOf(".") ? "d" : "f"; 38263 } 38264 function createPartial(node, context3) { 38265 var prefix = "<" + (context3.prefix || ""); 38266 var sym = prefix + node.n + serialNo++; 38267 context3.partials[sym] = { name: node.n, partials: {} }; 38268 context3.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || "") + '"));'; 38269 return sym; 38270 } 38271 Hogan2.codegen = { 38272 "#": function(node, context3) { 38273 context3.code += "if(t.s(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,0,' + node.i + "," + node.end + ',"' + node.otag + " " + node.ctag + '")){t.rs(c,p,function(c,p,t){'; 38274 Hogan2.walk(node.nodes, context3); 38275 context3.code += "});c.pop();}"; 38276 }, 38277 "^": function(node, context3) { 38278 context3.code += "if(!t.s(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,1,0,0,"")){'; 38279 Hogan2.walk(node.nodes, context3); 38280 context3.code += "};"; 38281 }, 38282 ">": createPartial, 38283 "<": function(node, context3) { 38284 var ctx2 = { partials: {}, code: "", subs: {}, inPartial: true }; 38285 Hogan2.walk(node.nodes, ctx2); 38286 var template2 = context3.partials[createPartial(node, context3)]; 38287 template2.subs = ctx2.subs; 38288 template2.partials = ctx2.partials; 38289 }, 38290 "$": function(node, context3) { 38291 var ctx2 = { subs: {}, code: "", partials: context3.partials, prefix: node.n }; 38292 Hogan2.walk(node.nodes, ctx2); 38293 context3.subs[node.n] = ctx2.code; 38294 if (!context3.inPartial) { 38295 context3.code += 't.sub("' + esc(node.n) + '",c,p,i);'; 38296 } 38297 }, 38298 "\n": function(node, context3) { 38299 context3.code += write('"\\n"' + (node.last ? "" : " + i")); 38300 }, 38301 "_v": function(node, context3) { 38302 context3.code += "t.b(t.v(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));'; 38303 }, 38304 "_t": function(node, context3) { 38305 context3.code += write('"' + esc(node.text) + '"'); 38306 }, 38307 "{": tripleStache, 38308 "&": tripleStache 38309 }; 38310 function tripleStache(node, context3) { 38311 context3.code += "t.b(t.t(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));'; 38312 } 38313 function write(s2) { 38314 return "t.b(" + s2 + ");"; 38315 } 38316 Hogan2.walk = function(nodelist, context3) { 38317 var func; 38318 for (var i2 = 0, l2 = nodelist.length; i2 < l2; i2++) { 38319 func = Hogan2.codegen[nodelist[i2].tag]; 38320 func && func(nodelist[i2], context3); 38321 } 38322 return context3; 38323 }; 38324 Hogan2.parse = function(tokens, text, options) { 38325 options = options || {}; 38326 return buildTree(tokens, "", [], options.sectionTags || []); 38327 }; 38328 Hogan2.cache = {}; 38329 Hogan2.cacheKey = function(text, options) { 38330 return [text, !!options.asString, !!options.disableLambda, options.delimiters, !!options.modelGet].join("||"); 38331 }; 38332 Hogan2.compile = function(text, options) { 38333 options = options || {}; 38334 var key2 = Hogan2.cacheKey(text, options); 38335 var template2 = this.cache[key2]; 38336 if (template2) { 38337 var partials = template2.partials; 38338 for (var name in partials) { 38339 delete partials[name].instance; 38340 } 38341 return template2; 38342 } 38343 template2 = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options); 38344 return this.cache[key2] = template2; 38345 }; 38346 })(exports); 38347})(compiler); 38348var template = {}; 38349(function(exports) { 38350 (function(Hogan2) { 38351 Hogan2.Template = function(codeObj, text, compiler2, options) { 38352 codeObj = codeObj || {}; 38353 this.r = codeObj.code || this.r; 38354 this.c = compiler2; 38355 this.options = options || {}; 38356 this.text = text || ""; 38357 this.partials = codeObj.partials || {}; 38358 this.subs = codeObj.subs || {}; 38359 this.buf = ""; 38360 }; 38361 Hogan2.Template.prototype = { 38362 // render: replaced by generated code. 38363 r: function(context3, partials, indent) { 38364 return ""; 38365 }, 38366 // variable escaping 38367 v: hoganEscape, 38368 // triple stache 38369 t: coerceToString, 38370 render: function render6(context3, partials, indent) { 38371 return this.ri([context3], partials || {}, indent); 38372 }, 38373 // render internal -- a hook for overrides that catches partials too 38374 ri: function(context3, partials, indent) { 38375 return this.r(context3, partials, indent); 38376 }, 38377 // ensurePartial 38378 ep: function(symbol, partials) { 38379 var partial = this.partials[symbol]; 38380 var template2 = partials[partial.name]; 38381 if (partial.instance && partial.base == template2) { 38382 return partial.instance; 38383 } 38384 if (typeof template2 == "string") { 38385 if (!this.c) { 38386 throw new Error("No compiler available."); 38387 } 38388 template2 = this.c.compile(template2, this.options); 38389 } 38390 if (!template2) { 38391 return null; 38392 } 38393 this.partials[symbol].base = template2; 38394 if (partial.subs) { 38395 if (!partials.stackText) partials.stackText = {}; 38396 for (key in partial.subs) { 38397 if (!partials.stackText[key]) { 38398 partials.stackText[key] = this.activeSub !== void 0 && partials.stackText[this.activeSub] ? partials.stackText[this.activeSub] : this.text; 38399 } 38400 } 38401 template2 = createSpecializedPartial( 38402 template2, 38403 partial.subs, 38404 partial.partials, 38405 this.stackSubs, 38406 this.stackPartials, 38407 partials.stackText 38408 ); 38409 } 38410 this.partials[symbol].instance = template2; 38411 return template2; 38412 }, 38413 // tries to find a partial in the current scope and render it 38414 rp: function(symbol, context3, partials, indent) { 38415 var partial = this.ep(symbol, partials); 38416 if (!partial) { 38417 return ""; 38418 } 38419 return partial.ri(context3, partials, indent); 38420 }, 38421 // render a section 38422 rs: function(context3, partials, section) { 38423 var tail = context3[context3.length - 1]; 38424 if (!isArray2(tail)) { 38425 section(context3, partials, this); 38426 return; 38427 } 38428 for (var i2 = 0; i2 < tail.length; i2++) { 38429 context3.push(tail[i2]); 38430 section(context3, partials, this); 38431 context3.pop(); 38432 } 38433 }, 38434 // maybe start a section 38435 s: function(val, ctx2, partials, inverted, start2, end, tags) { 38436 var pass; 38437 if (isArray2(val) && val.length === 0) { 38438 return false; 38439 } 38440 if (typeof val == "function") { 38441 val = this.ms(val, ctx2, partials, inverted, start2, end, tags); 38442 } 38443 pass = !!val; 38444 if (!inverted && pass && ctx2) { 38445 ctx2.push(typeof val == "object" ? val : ctx2[ctx2.length - 1]); 38446 } 38447 return pass; 38448 }, 38449 // find values with dotted names 38450 d: function(key2, ctx2, partials, returnFound) { 38451 var found, names = key2.split("."), val = this.f(names[0], ctx2, partials, returnFound), doModelGet = this.options.modelGet, cx2 = null; 38452 if (key2 === "." && isArray2(ctx2[ctx2.length - 2])) { 38453 val = ctx2[ctx2.length - 1]; 38454 } else { 38455 for (var i2 = 1; i2 < names.length; i2++) { 38456 found = findInScope(names[i2], val, doModelGet); 38457 if (found !== void 0) { 38458 cx2 = val; 38459 val = found; 38460 } else { 38461 val = ""; 38462 } 38463 } 38464 } 38465 if (returnFound && !val) { 38466 return false; 38467 } 38468 if (!returnFound && typeof val == "function") { 38469 ctx2.push(cx2); 38470 val = this.mv(val, ctx2, partials); 38471 ctx2.pop(); 38472 } 38473 return val; 38474 }, 38475 // find values with normal names 38476 f: function(key2, ctx2, partials, returnFound) { 38477 var val = false, v2 = null, found = false, doModelGet = this.options.modelGet; 38478 for (var i2 = ctx2.length - 1; i2 >= 0; i2--) { 38479 v2 = ctx2[i2]; 38480 val = findInScope(key2, v2, doModelGet); 38481 if (val !== void 0) { 38482 found = true; 38483 break; 38484 } 38485 } 38486 if (!found) { 38487 return returnFound ? false : ""; 38488 } 38489 if (!returnFound && typeof val == "function") { 38490 val = this.mv(val, ctx2, partials); 38491 } 38492 return val; 38493 }, 38494 // higher order templates 38495 ls: function(func, cx2, partials, text, tags) { 38496 var oldTags = this.options.delimiters; 38497 this.options.delimiters = tags; 38498 this.b(this.ct(coerceToString(func.call(cx2, text)), cx2, partials)); 38499 this.options.delimiters = oldTags; 38500 return false; 38501 }, 38502 // compile text 38503 ct: function(text, cx2, partials) { 38504 if (this.options.disableLambda) { 38505 throw new Error("Lambda features disabled."); 38506 } 38507 return this.c.compile(text, this.options).render(cx2, partials); 38508 }, 38509 // template result buffering 38510 b: function(s2) { 38511 this.buf += s2; 38512 }, 38513 fl: function() { 38514 var r2 = this.buf; 38515 this.buf = ""; 38516 return r2; 38517 }, 38518 // method replace section 38519 ms: function(func, ctx2, partials, inverted, start2, end, tags) { 38520 var textSource, cx2 = ctx2[ctx2.length - 1], result = func.call(cx2); 38521 if (typeof result == "function") { 38522 if (inverted) { 38523 return true; 38524 } else { 38525 textSource = this.activeSub && this.subsText && this.subsText[this.activeSub] ? this.subsText[this.activeSub] : this.text; 38526 return this.ls(result, cx2, partials, textSource.substring(start2, end), tags); 38527 } 38528 } 38529 return result; 38530 }, 38531 // method replace variable 38532 mv: function(func, ctx2, partials) { 38533 var cx2 = ctx2[ctx2.length - 1]; 38534 var result = func.call(cx2); 38535 if (typeof result == "function") { 38536 return this.ct(coerceToString(result.call(cx2)), cx2, partials); 38537 } 38538 return result; 38539 }, 38540 sub: function(name, context3, partials, indent) { 38541 var f2 = this.subs[name]; 38542 if (f2) { 38543 this.activeSub = name; 38544 f2(context3, partials, this, indent); 38545 this.activeSub = false; 38546 } 38547 } 38548 }; 38549 function findInScope(key2, scope, doModelGet) { 38550 var val; 38551 if (scope && typeof scope == "object") { 38552 if (scope[key2] !== void 0) { 38553 val = scope[key2]; 38554 } else if (doModelGet && scope.get && typeof scope.get == "function") { 38555 val = scope.get(key2); 38556 } 38557 } 38558 return val; 38559 } 38560 function createSpecializedPartial(instance, subs, partials, stackSubs, stackPartials, stackText) { 38561 function PartialTemplate() { 38562 } 38563 PartialTemplate.prototype = instance; 38564 function Substitutions() { 38565 } 38566 Substitutions.prototype = instance.subs; 38567 var key2; 38568 var partial = new PartialTemplate(); 38569 partial.subs = new Substitutions(); 38570 partial.subsText = {}; 38571 partial.buf = ""; 38572 stackSubs = stackSubs || {}; 38573 partial.stackSubs = stackSubs; 38574 partial.subsText = stackText; 38575 for (key2 in subs) { 38576 if (!stackSubs[key2]) stackSubs[key2] = subs[key2]; 38577 } 38578 for (key2 in stackSubs) { 38579 partial.subs[key2] = stackSubs[key2]; 38580 } 38581 stackPartials = stackPartials || {}; 38582 partial.stackPartials = stackPartials; 38583 for (key2 in partials) { 38584 if (!stackPartials[key2]) stackPartials[key2] = partials[key2]; 38585 } 38586 for (key2 in stackPartials) { 38587 partial.partials[key2] = stackPartials[key2]; 38588 } 38589 return partial; 38590 } 38591 var rAmp = /&/g, rLt = /</g, rGt = />/g, rApos = /\'/g, rQuot = /\"/g, hChars = /[&<>\"\']/; 38592 function coerceToString(val) { 38593 return String(val === null || val === void 0 ? "" : val); 38594 } 38595 function hoganEscape(str) { 38596 str = coerceToString(str); 38597 return hChars.test(str) ? str.replace(rAmp, "&").replace(rLt, "<").replace(rGt, ">").replace(rApos, "'").replace(rQuot, """) : str; 38598 } 38599 var isArray2 = Array.isArray || function(a2) { 38600 return Object.prototype.toString.call(a2) === "[object Array]"; 38601 }; 38602 })(exports); 38603})(template); 38604var Hogan = compiler; 38605Hogan.Template = template.Template; 38606Hogan.template = Hogan.Template; 38607var hogan = Hogan; 38608const hogan$1 = /* @__PURE__ */ getDefaultExportFromCjs(hogan); 38609var n$8 = function(t2, s2, r2, e2) { 38610 var u2; 38611 s2[0] = 0; 38612 for (var h2 = 1; h2 < s2.length; h2++) { 38613 var p2 = s2[h2++], a2 = s2[h2] ? (s2[0] |= p2 ? 1 : 2, r2[s2[h2++]]) : s2[++h2]; 38614 3 === p2 ? e2[0] = a2 : 4 === p2 ? e2[1] = Object.assign(e2[1] || {}, a2) : 5 === p2 ? (e2[1] = e2[1] || {})[s2[++h2]] = a2 : 6 === p2 ? e2[1][s2[++h2]] += a2 + "" : p2 ? (u2 = t2.apply(a2, n$8(t2, a2, r2, ["", null])), e2.push(u2), a2[0] ? s2[0] |= 2 : (s2[h2 - 2] = 0, s2[h2] = u2)) : e2.push(a2); 38615 } 38616 return e2; 38617}, t$9 = /* @__PURE__ */ new Map(); 38618function e$7(s2) { 38619 var r2 = t$9.get(this); 38620 return r2 || (r2 = /* @__PURE__ */ new Map(), t$9.set(this, r2)), (r2 = n$8(this, r2.get(s2) || (r2.set(s2, r2 = function(n2) { 38621 for (var t2, s3, r3 = 1, e2 = "", u2 = "", h2 = [0], p2 = function(n3) { 38622 1 === r3 && (n3 || (e2 = e2.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? h2.push(0, n3, e2) : 3 === r3 && (n3 || e2) ? (h2.push(3, n3, e2), r3 = 2) : 2 === r3 && "..." === e2 && n3 ? h2.push(4, n3, 0) : 2 === r3 && e2 && !n3 ? h2.push(5, 0, true, e2) : r3 >= 5 && ((e2 || !n3 && 5 === r3) && (h2.push(r3, 0, e2, s3), r3 = 6), n3 && (h2.push(r3, n3, 0, s3), r3 = 6)), e2 = ""; 38623 }, a2 = 0; a2 < n2.length; a2++) { 38624 a2 && (1 === r3 && p2(), p2(a2)); 38625 for (var l2 = 0; l2 < n2[a2].length;
38625 l2++) t2 = n2[a2][l2], 1 === r3 ? "<" === t2 ? (p2(), h2 = [h2], r3 = 3) : e2 += t2 : 4 === r3 ? "--" === e2 && ">" === t2 ? (r3 = 1, e2 = "") : e2 = t2 + e2[0] : u2 ? t2 === u2 ? u2 = "" : e2 += t2 : '"' === t2 || "'" === t2 ? u2 = t2 : ">" === t2 ? (p2(), r3 = 1) : r3 && ("=" === t2 ? (r3 = 5, s3 = e2, e2 = "") : "/" === t2 && (r3 < 5 || ">" === n2[a2][l2 + 1]) ? (p2(), 3 === r3 && (h2 = h2[0]), r3 = h2, (h2 = h2[0]).push(2, 0, r3), r3 = 0) : " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2 ? (p2(), r3 = 2) : e2 += t2), 3 === r3 && "!--" === e2 && (r3 = 4, h2 = h2[0]); 38626 } 38627 return p2(), h2; 38628 }(s2)), r2), arguments, [])).length > 1 ? r2 : r2[0]; 38629} 38630var m$5 = e$7.bind(_$1); 38631var InternalHighlight = createHighlightComponent({ 38632 createElement: _$1, 38633 Fragment: b$3 38634}); 38635var _excluded$a = ["classNames"]; 38636function _extends$e() { 38637 _extends$e = Object.assign ? Object.assign.bind() : function(target) { 38638 for (var i2 = 1; i2 < arguments.length; i2++) { 38639 var source = arguments[i2]; 38640 for (var key2 in source) { 38641 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38642 target[key2] = source[key2]; 38643 } 38644 } 38645 } 38646 return target; 38647 }; 38648 return _extends$e.apply(this, arguments); 38649} 38650function _objectWithoutProperties$a(source, excluded) { 38651 if (source == null) return {}; 38652 var target = _objectWithoutPropertiesLoose$a(source, excluded); 38653 var key2, i2; 38654 if (Object.getOwnPropertySymbols) { 38655 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38656 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 38657 key2 = sourceSymbolKeys[i2]; 38658 if (excluded.indexOf(key2) >= 0) continue; 38659 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 38660 target[key2] = source[key2]; 38661 } 38662 } 38663 return target; 38664} 38665function _objectWithoutPropertiesLoose$a(source, excluded) { 38666 if (source == null) return {}; 38667 var target = {}; 38668 var sourceKeys = Object.keys(source); 38669 var key2, i2; 38670 for (i2 = 0; i2 < sourceKeys.length; i2++) { 38671 key2 = sourceKeys[i2]; 38672 if (excluded.indexOf(key2) >= 0) continue; 38673 target[key2] = source[key2]; 38674 } 38675 return target; 38676} 38677function Highlight$1(_ref) { 38678 var _ref$classNames = _ref.classNames, classNames = _ref$classNames === void 0 ? {} : _ref$classNames, props = _objectWithoutProperties$a(_ref, _excluded$a); 38679 return _$1(InternalHighlight, _extends$e({ 38680 classNames: { 38681 root: cx("ais-Highlight", classNames.root), 38682 highlighted: cx("ais-Highlight-highlighted", classNames.highlighted), 38683 nonHighlighted: cx("ais-Highlight-nonHighlighted", classNames.nonHighlighted), 38684 separator: cx("ais-Highlight-separator", classNames.separator) 38685 } 38686 }, props)); 38687} 38688var _excluded$9 = ["hit", "attribute", "cssClasses"]; 38689function _extends$d() { 38690 _extends$d = Object.assign ? Object.assign.bind() : function(target) { 38691 for (var i2 = 1; i2 < arguments.length; i2++) { 38692 var source = arguments[i2]; 38693 for (var key2 in source) { 38694 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38695 target[key2] = source[key2]; 38696 } 38697 } 38698 } 38699 return target; 38700 }; 38701 return _extends$d.apply(this, arguments); 38702} 38703function _objectWithoutProperties$9(source, excluded) { 38704 if (source == null) return {}; 38705 var target = _objectWithoutPropertiesLoose$9(source, excluded); 38706 var key2, i2; 38707 if (Object.getOwnPropertySymbols) { 38708 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38709 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 38710 key2 = sourceSymbolKeys[i2]; 38711 if (excluded.indexOf(key2) >= 0) continue; 38712 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 38713 target[key2] = source[key2]; 38714 } 38715 } 38716 return target; 38717} 38718function _objectWithoutPropertiesLoose$9(source, excluded) { 38719 if (source == null) return {}; 38720 var target = {}; 38721 var sourceKeys = Object.keys(source); 38722 var key2, i2; 38723 for (i2 = 0; i2 < sourceKeys.length; i2++) { 38724 key2 = sourceKeys[i2]; 38725 if (excluded.indexOf(key2) >= 0) continue; 38726 target[key2] = source[key2]; 38727 } 38728 return target; 38729} 38730function Highlight(_ref) {
38731 var hit = _ref.hit, attribute = _ref.attribute, cssClasses = _ref.cssClasses, props = _objectWithoutProperties$9(_ref, _excluded$9); 38732 var property = getPropertyByPath(hit._highlightResult, attribute) || []; 38733 var properties = toArray2(property); 38734 var parts = properties.map(function(_ref22) { 38735 var value = _ref22.value; 38736 return getHighlightedParts(unescape$1(value || "")); 38737 }); 38738 return _$1(Highlight$1, _extends$d({}, props, { 38739 parts, 38740 classNames: cssClasses 38741 })); 38742} 38743var _excluded$8 = ["classNames"]; 38744function _extends$c() { 38745 _extends$c = Object.assign ? Object.assign.bind() : function(target) { 38746 for (var i2 = 1; i2 < arguments.length; i2++) { 38747 var source = arguments[i2]; 38748 for (var key2 in source) { 38749 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38750 target[key2] = source[key2]; 38751 } 38752 } 38753 } 38754 return target; 38755 }; 38756 return _extends$c.apply(this, arguments); 38757} 38758function _objectWithoutProperties$8(source, excluded) { 38759 if (source == null) return {}; 38760 var target = _objectWithoutPropertiesLoose$8(source, excluded); 38761 var key2, i2; 38762 if (Object.getOwnPropertySymbols) { 38763 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38764 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 38765 key2 = sourceSymbolKeys[i2]; 38766 if (excluded.indexOf(key2) >= 0) continue; 38767 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 38768 target[key2] = source[key2]; 38769 } 38770 } 38771 return target; 38772} 38773function _objectWithoutPropertiesLoose$8(source, excluded) { 38774 if (source == null) return {}; 38775 var target = {}; 38776 var sourceKeys = Object.keys(source); 38777 var key2, i2; 38778 for (i2 = 0; i2 < sourceKeys.length; i2++) { 38779 key2 = sourceKeys[i2]; 38780 if (excluded.indexOf(key2) >= 0) continue; 38781 target[key2] = source[key2]; 38782 } 38783 return target; 38784} 38785function ReverseHighlight$1(_ref) { 38786 var _ref$classNames = _ref.classNames, classNames = _ref$classNames === void 0 ? {} : _ref$classNames, props = _objectWithoutProperties$8(_ref, _excluded$8); 38787 return _$1(InternalHighlight, _extends$c({ 38788 classNames: { 38789 root: cx("ais-ReverseHighlight", classNames.root), 38790 highlighted: cx("ais-ReverseHighlight-highlighted", classNames.highlighted), 38791 nonHighlighted: cx("ais-ReverseHighlight-nonHighlighted", classNames.nonHighlighted), 38792 separator: cx("ais-ReverseHighlight-separator", classNames.separator) 38793 } 38794 }, props)); 38795} 38796function _typeof$q(obj) { 38797 "@babel/helpers - typeof"; 38798 return _typeof$q = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 38799 return typeof obj2; 38800 } : function(obj2) { 38801 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 38802 }, _typeof$q(obj); 38803} 38804var _excluded$7 = ["hit", "attribute", "cssClasses"], _excluded2$2 = ["isHighlighted"]; 38805function _extends$b() { 38806 _extends$b = Object.assign ? Object.assign.bind() : function(target) { 38807 for (var i2 = 1; i2 < arguments.length; i2++) { 38808 var source = arguments[i2]; 38809 for (var key2 in source) { 38810 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38811 target[key2] = source[key2]; 38812 } 38813 } 38814 } 38815 return target; 38816 }; 38817 return _extends$b.apply(this, arguments); 38818} 38819function ownKeys$l(object, enumerableOnly) { 38820 var keys = Object.keys(object); 38821 if (Object.getOwnPropertySymbols) { 38822 var symbols = Object.getOwnPropertySymbols(object); 38823 enumerableOnly && (symbols = symbols.filter(function(sym) { 38824 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 38825 })), keys.push.apply(keys, symbols); 38826 } 38827 return keys; 38828} 38829function _objectSpread$l(target) { 38830 for (var i2 = 1; i2 < arguments.length; i2++) { 38831 var source = null != arguments[i2] ? arguments[i2] : {}; 38832 i2 % 2 ? ownKeys$l(Object(source), true).forEach(function(key2) { 38833 _defineProperty$q(target, key2, source[key2]); 38834 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$l(Object(source)).forEach(function(key2) { 38835 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 38836 }); 38837 } 38838 return target; 38839} 38840function _defineProperty$q(obj, key2, value) { 38841 key2 = _toPropertyKey$q(key2); 38842 if (key2 in obj) { 38843 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 38844 } else { 38845 obj[key2] = value; 38846 } 38847 return obj; 38848} 38849function _toPropertyKey$q(arg) { 38850 var key2 = _toPrimitive$q(arg, "string"); 38851 return _typeof$q(key2) === "symbol" ? key2 : String(key2); 38852} 38853function _toPrimitive$q(input, hint) { 38854 if (_typeof$q(input) !== "object" || input === null) return input; 38855 var prim = input[Symbol.toPrimitive]; 38856 if (prim !== void 0) { 38857 var res = prim.call(input, hint || "default"); 38858 if (_typeof$q(res) !== "object") return res; 38859 throw new TypeError("@@toPrimitive must return a primitive value."); 38860 } 38861 return (hint === "string" ? String : Number)(input); 38862} 38863function _objectWithoutProperties$7(source, excluded) { 38864 if (source == null) return {}; 38865 var target = _objectWithoutPropertiesLoose$7(source, excluded); 38866 var key2, i2; 38867 if (Object.getOwnPropertySymbols) { 38868 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38869 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 38870 key2 = sourceSymbolKeys[i2]; 38871 if (excluded.indexOf(key2) >= 0) continue; 38872 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 38873 target[key2] = source[key2]; 38874 } 38875 } 38876 return target; 38877} 38878function _objectWithoutPropertiesLoose$7(source, excluded) { 38879 if (source == null) return {}; 38880 var target = {}; 38881 var sourceKeys = Object.keys(source); 38882 var key2, i2; 38883 for (i2 = 0; i2 < sourceKeys.length; i2++) { 38884 key2 = sourceKeys[i2]; 38885 if (excluded.indexOf(key2) >= 0) continue; 38886 target[key2] = source[key2]; 38887 } 38888 return target; 38889} 38890function ReverseHighlight(_ref) {
38891 var hit = _ref.hit, attribute = _ref.attribute, cssClasses = _ref.cssClasses, props = _objectWithoutProperties$7(_ref, _excluded$7); 38892 var property = getPropertyByPath(hit._highlightResult, attribute) || []; 38893 var properties = toArray2(property); 38894 var parts = properties.map(function(_ref22) { 38895 var value = _ref22.value; 38896 return getHighlightedParts(unescape$1(value || "")).map(function(_ref3) { 38897 var isHighlighted = _ref3.isHighlighted, rest = _objectWithoutProperties$7(_ref3, _excluded2$2); 38898 return _objectSpread$l(_objectSpread$l({}, rest), {}, { 38899 isHighlighted: !isHighlighted 38900 }); 38901 }); 38902 }); 38903 return _$1(ReverseHighlight$1, _extends$b({}, props, { 38904 parts, 38905 classNames: cssClasses 38906 })); 38907} 38908var _excluded$6 = ["classNames"]; 38909function _extends$a() { 38910 _extends$a = Object.assign ? Object.assign.bind() : function(target) { 38911 for (var i2 = 1; i2 < arguments.length; i2++) { 38912 var source = arguments[i2]; 38913 for (var key2 in source) { 38914 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38915 target[key2] = source[key2]; 38916 } 38917 } 38918 } 38919 return target; 38920 }; 38921 return _extends$a.apply(this, arguments); 38922} 38923function _objectWithoutProperties$6(source, excluded) { 38924 if (source == null) return {}; 38925 var target = _objectWithoutPropertiesLoose$6(source, excluded); 38926 var key2, i2; 38927 if (Object.getOwnPropertySymbols) { 38928 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38929 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 38930 key2 = sourceSymbolKeys[i2]; 38931 if (excluded.indexOf(key2) >= 0) continue; 38932 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 38933 target[key2] = source[key2]; 38934 } 38935 } 38936 return target; 38937} 38938function _objectWithoutPropertiesLoose$6(source, excluded) { 38939 if (source == null) return {}; 38940 var target = {}; 38941 var sourceKeys = Object.keys(source); 38942 var key2, i2; 38943 for (i2 = 0; i2 < sourceKeys.length; i2++) { 38944 key2 = sourceKeys[i2]; 38945 if (excluded.indexOf(key2) >= 0) continue; 38946 target[key2] = source[key2]; 38947 } 38948 return target; 38949} 38950function ReverseSnippet$1(_ref) { 38951 var _ref$classNames = _ref.classNames, classNames = _ref$classNames === void 0 ? {} : _ref$classNames, props = _objectWithoutProperties$6(_ref, _excluded$6); 38952 return _$1(InternalHighlight, _extends$a({ 38953 classNames: { 38954 root: cx("ais-ReverseSnippet", classNames.root), 38955 highlighted: cx("ais-ReverseSnippet-highlighted", classNames.highlighted), 38956 nonHighlighted: cx("ais-ReverseSnippet-nonHighlighted", classNames.nonHighlighted), 38957 separator: cx("ais-ReverseSnippet-separator", classNames.separator) 38958 } 38959 }, props)); 38960} 38961function _typeof$p(obj) { 38962 "@babel/helpers - typeof"; 38963 return _typeof$p = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 38964 return typeof obj2; 38965 } : function(obj2) { 38966 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 38967 }, _typeof$p(obj); 38968} 38969var _excluded$5 = ["hit", "attribute", "cssClasses"], _excluded2$1 = ["isHighlighted"]; 38970function _extends$9() { 38971 _extends$9 = Object.assign ? Object.assign.bind() : function(target) { 38972 for (var i2 = 1; i2 < arguments.length; i2++) { 38973 var source = arguments[i2]; 38974 for (var key2 in source) { 38975 if (Object.prototype.hasOwnProperty.call(source, key2)) { 38976 target[key2] = source[key2]; 38977 } 38978 } 38979 } 38980 return target; 38981 }; 38982 return _extends$9.apply(this, arguments); 38983} 38984function ownKeys$k(object, enumerableOnly) { 38985 var keys = Object.keys(object); 38986 if (Object.getOwnPropertySymbols) { 38987 var symbols = Object.getOwnPropertySymbols(object); 38988 enumerableOnly && (symbols = symbols.filter(function(sym) { 38989 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 38990 })), keys.push.apply(keys, symbols); 38991 } 38992 return keys; 38993} 38994function _objectSpread$k(target) { 38995 for (var i2 = 1; i2 < arguments.length; i2++) { 38996 var source = null != arguments[i2] ? arguments[i2] : {}; 38997 i2 % 2 ? ownKeys$k(Object(source), true).forEach(function(key2) { 38998 _defineProperty$p(target, key2, source[key2]); 38999 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$k(Object(source)).forEac
38999h(function(key2) { 39000 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 39001 }); 39002 } 39003 return target; 39004} 39005function _defineProperty$p(obj, key2, value) { 39006 key2 = _toPropertyKey$p(key2); 39007 if (key2 in obj) { 39008 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39009 } else { 39010 obj[key2] = value; 39011 } 39012 return obj; 39013} 39014function _toPropertyKey$p(arg) { 39015 var key2 = _toPrimitive$p(arg, "string"); 39016 return _typeof$p(key2) === "symbol" ? key2 : String(key2); 39017} 39018function _toPrimitive$p(input, hint) { 39019 if (_typeof$p(input) !== "object" || input === null) return input; 39020 var prim = input[Symbol.toPrimitive]; 39021 if (prim !== void 0) { 39022 var res = prim.call(input, hint || "default"); 39023 if (_typeof$p(res) !== "object") return res; 39024 throw new TypeError("@@toPrimitive must return a primitive value."); 39025 } 39026 return (hint === "string" ? String : Number)(input); 39027} 39028function _objectWithoutProperties$5(source, excluded) { 39029 if (source == null) return {}; 39030 var target = _objectWithoutPropertiesLoose$5(source, excluded); 39031 var key2, i2; 39032 if (Object.getOwnPropertySymbols) { 39033 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 39034 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 39035 key2 = sourceSymbolKeys[i2]; 39036 if (excluded.indexOf(key2) >= 0) continue; 39037 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 39038 target[key2] = source[key2]; 39039 } 39040 } 39041 return target; 39042} 39043function _objectWithoutPropertiesLoose$5(source, excluded) { 39044 if (source == null) return {}; 39045 var target = {}; 39046 var sourceKeys = Object.keys(source); 39047 var key2, i2; 39048 for (i2 = 0; i2 < sourceKeys.length; i2++) { 39049 key2 = sourceKeys[i2]; 39050 if (excluded.indexOf(key2) >= 0) continue; 39051 target[key2] = source[key2]; 39052 } 39053 return target; 39054} 39055function ReverseSnippet(_ref) { 39056 var hit = _ref.hit, attribute = _ref.attribute, cssClasses = _ref.cssClasses, props = _objectWithoutProperties$5(_ref, _excluded$5); 39057 var property = getPropertyByPath(hit._snippetResult, attribute) || []; 39058 var properties = toArray2(property); 39059 var parts = properties.map(function(_ref22) { 39060 var value = _ref22.value; 39061 return getHighlightedParts(unescape$1(value || "")).map(function(_ref3) { 39062 var isHighlighted = _ref3.isHighlighted, rest = _objectWithoutProperties$5(_ref3, _excluded2$1); 39063 return _objectSpread$k(_objectSpread$k({}, rest), {}, { 39064 isHighlighted: !isHighlighted 39065 }); 39066 }); 39067 }); 39068 return _$1(ReverseSnippet$1, _extends$9({}, props, { 39069 parts, 39070 classNames: cssClasses 39071 })); 39072} 39073var _excluded$4 = ["classNames"]; 39074function _extends$8() { 39075 _extends$8 = Object.assign ? Object.assign.bind() : function(target) { 39076 for (var i2 = 1; i2 < arguments.length; i2++) { 39077 var source = arguments[i2]; 39078 for (var key2 in source) { 39079 if (Object.prototype.hasOwnProperty.call(source, key2)) { 39080 target[key2] = source[key2]; 39081 } 39082 } 39083 } 39084 return target; 39085 }; 39086 return _extends$8.apply(this, arguments); 39087} 39088function _objectWithoutProperties$4(source, excluded) { 39089 if (source == null) return {}; 39090 var target = _objectWithoutPropertiesLoose$4(source, excluded); 39091 var key2, i2; 39092 if (Object.getOwnPropertySymbols) { 39093 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 39094 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 39095 key2 = sourceSymbolKeys[i2]; 39096 if (excluded.indexOf(key2) >= 0) continue; 39097 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 39098 target[key2] = source[key2]; 39099 } 39100 } 39101 return target; 39102} 39103function _objectWithoutPropertiesLoose$4(source, excluded) { 39104 if (source == null) return {}; 39105 var target = {}; 39106 var sourceKeys = Object.keys(source); 39107 var key2, i2; 39108 for (i2 = 0; i2 < sourceKeys.length; i2++) { 39109 key2 = sourceKeys[i2]; 39110 if (excluded.indexOf(key2) >= 0) continue; 39111 target[key2] = source[key2]; 39112 } 39113 return target; 39114} 39115function Snippet$1(_ref) { 39116 var _ref$classNames = _ref.classNames, classNames = _ref$classNames === void 0 ? {} : _ref$classNames, props = _objectWithoutProperties$4(_ref, _excluded$4); 39117 return _$1(InternalHighlight, _extends$8({ 39118 classNames: { 39119 root: cx("ais-Snippet", classNames.root), 39120 highlighted: cx("ais-Snippet-highlighted", classNames.highlighted), 39121 nonHighlighted: cx("ais-Snippet-nonHighlighted", classNames.nonHighlighted), 39122 separator: cx("ais-Snippet-separator", classNames.separator) 39123 } 39124 }, props)); 39125}
39126var _excluded$3 = ["hit", "attribute", "cssClasses"]; 39127function _extends$7() { 39128 _extends$7 = Object.assign ? Object.assign.bind() : function(target) { 39129 for (var i2 = 1; i2 < arguments.length; i2++) { 39130 var source = arguments[i2]; 39131 for (var key2 in source) { 39132 if (Object.prototype.hasOwnProperty.call(source, key2)) { 39133 target[key2] = source[key2]; 39134 } 39135 } 39136 } 39137 return target; 39138 }; 39139 return _extends$7.apply(this, arguments); 39140} 39141function _objectWithoutProperties$3(source, excluded) { 39142 if (source == null) return {}; 39143 var target = _objectWithoutPropertiesLoose$3(source, excluded); 39144 var key2, i2; 39145 if (Object.getOwnPropertySymbols) { 39146 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 39147 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 39148 key2 = sourceSymbolKeys[i2]; 39149 if (excluded.indexOf(key2) >= 0) continue; 39150 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 39151 target[key2] = source[key2]; 39152 } 39153 } 39154 return target; 39155} 39156function _objectWithoutPropertiesLoose$3(source, excluded) { 39157 if (source == null) return {}; 39158 var target = {}; 39159 var sourceKeys = Object.keys(source); 39160 var key2, i2; 39161 for (i2 = 0; i2 < sourceKeys.length; i2++) { 39162 key2 = sourceKeys[i2]; 39163 if (excluded.indexOf(key2) >= 0) continue; 39164 target[key2] = source[key2]; 39165 } 39166 return target; 39167} 39168function Snippet(_ref) { 39169 var hit = _ref.hit, attribute = _ref.attribute, cssClasses = _ref.cssClasses, props = _objectWithoutProperties$3(_ref, _excluded$3); 39170 var property = getPropertyByPath(hit._snippetResult, attribute) || []; 39171 var properties = toArray2(property); 39172 var parts = properties.map(function(_ref22) { 39173 var value = _ref22.value; 39174 return getHighlightedParts(unescape$1(value || "")); 39175 }); 39176 return _$1(Snippet$1, _extends$7({}, props, { 39177 parts, 39178 classNames: cssClasses 39179 })); 39180} 39181function _typeof$o(obj) { 39182 "@babel/helpers - typeof"; 39183 return _typeof$o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39184 return typeof obj2; 39185 } : function(obj2) { 39186 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39187 }, _typeof$o(obj); 39188} 39189function ownKeys$j(object, enumerableOnly) { 39190 var keys = Object.keys(object); 39191 if (Object.getOwnPropertySymbols) { 39192 var symbols = Object.getOwnPropertySymbols(object); 39193 enumerableOnly && (symbols = symbols.filter(function(sym) { 39194 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39195 })), keys.push.apply(keys, symbols); 39196 } 39197 return keys; 39198} 39199function _objectSpread$j(target) { 39200 for (var i2 = 1; i2 < arguments.length; i2++) { 39201 var source = null != arguments[i2] ? arguments[i2] : {}; 39202 i2 % 2 ? ownKeys$j(Object(source), true).forEach(function(key2) { 39203 _defineProperty$o(target, key2, source[key2]); 39204 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$j(Object(source)).forEach(function(key2) { 39205 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 39206 }); 39207 } 39208 return target; 39209} 39210function _defineProperty$o(obj, key2, value) { 39211 key2 = _toPropertyKey$o(key2); 39212 if (key2 in obj) { 39213 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39214 } else { 39215 obj[key2] = value; 39216 } 39217 return obj; 39218} 39219function _toPropertyKey$o(arg) { 39220 var key2 = _toPrimitive$o(arg, "string"); 39221 return _typeof$o(key2) === "symbol" ? key2 : String(key2); 39222} 39223function _toPrimitive$o(input, hint) { 39224 if (_typeof$o(input) !== "object" || input === null) return input; 39225 var prim = input[Symbol.toPrimitive]; 39226 if (prim !== void 0) { 39227 var res = prim.call(input, hint || "default"); 39228 if (_typeof$o(res) !== "object") return res; 39229 throw new TypeError("@@toPrimitive must return a primitive value."); 39230 } 39231 return (hint === "string" ? String : Number)(input); 39232} 39233function transformHelpersToHogan() { 39234 var helpers = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 39235 var compileOptions = arguments.length > 1 ? arguments[1] : void 0; 39236 var data = arguments.length > 2 ? arguments[2] : void 0; 39237 return Object.keys(helpers).reduce(function(acc, helperKey) { 39238 return _objectSpread$j(_objectSpread$j({}, acc), {}, _defineProperty$o({}, helperKey, function() { 39239 var _this = this; 39240 return function(text) { 39241 var render6 = function render7(value) { 39242 return hogan$1.compile(value, compileOptions).render(_this); 39243 }; 39244 return helpers[helperKey].call(data, text, render6); 39245 }; 39246 })); 39247 }, {}); 39248} 39249function renderTemplate(_ref) { 39250 var templates = _ref.templates, templateKey = _ref.templateKey, compileOptions = _ref.compileOptions, helpers = _ref.helpers, data = _ref.data, bindEvent = _ref.bindEvent, sendEvent = _ref.sendEvent; 39251 var template2 = templates[templateKey]; 39252 if (typeof template2 !== "string" && typeof template2 !== "function") { 39253 throw new Error("Template must be 'string' or 'function', was '".concat(_typeof$o(template2), "' (key: ").concat(templateKey, ")")); 39254 } 39255 if (typeof template2 === "function") { 39256 var params = bindEvent || {}; 39257 params.html = m$5; 39258 params.sendEvent = sendEvent; 39259 params.components = { 39260 Highlight, 39261 ReverseHighlight, 39262 Snippet, 39263 ReverseSnippet 39264 }; 39265 return template2(data, params); 39266 } 39267 var transformedHelpers = transformHelpersToHogan(helpers, compileOptions, data); 39268 return hogan$1.compile(template2, compileOptions).render(_objectSpread$j(_objectSpread$j({}, data), {}, { 39269 helpers: transformedHelpers 39270 }
vendor: 4,734 bytes, lines 39270-39383
39270)).replace(/[ \n\r\t\f\xA0]+/g, function(spaces) { 39271 return spaces.replace(/(^|\xA0+)[^\xA0]+/g, "$1 "); 39272 }).trim(); 39273} 39274function _extends$6() { 39275 _extends$6 = Object.assign ? Object.assign.bind() : function(target) { 39276 for (var i2 = 1; i2 < arguments.length; i2++) { 39277 var source = arguments[i2]; 39278 for (var key2 in source) { 39279 if (Object.prototype.hasOwnProperty.call(source, key2)) { 39280 target[key2] = source[key2]; 39281 } 39282 } 39283 } 39284 return target; 39285 }; 39286 return _extends$6.apply(this, arguments); 39287} 39288function _typeof$n(obj) { 39289 "@babel/helpers - typeof"; 39290 return _typeof$n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39291 return typeof obj2; 39292 } : function(obj2) { 39293 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39294 }, _typeof$n(obj); 39295} 39296function _toConsumableArray$2(arr) { 39297 return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread$2(); 39298} 39299function _nonIterableSpread$2() { 39300 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 39301} 39302function _unsupportedIterableToArray$4(o2, minLen) { 39303 if (!o2) return; 39304 if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen); 39305 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 39306 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 39307 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 39308 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen); 39309} 39310function _iterableToArray$2(iter) { 39311 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 39312} 39313function _arrayWithoutHoles$2(arr) { 39314 if (Array.isArray(arr)) return _arrayLikeToArray$4(arr); 39315} 39316function _arrayLikeToArray$4(arr, len2) { 39317 if (len2 == null || len2 > arr.length) len2 = arr.length; 39318 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 39319 return arr2; 39320} 39321function _classCallCheck$5(instance, Constructor) { 39322 if (!(instance instanceof Constructor)) { 39323 throw new TypeError("Cannot call a class as a function"); 39324 } 39325} 39326function _defineProperties$5(target, props) { 39327 for (var i2 = 0; i2 < props.length; i2++) { 39328 var descriptor = props[i2]; 39329 descriptor.enumerable = descriptor.enumerable || false; 39330 descriptor.configurable = true; 39331 if ("value" in descriptor) descriptor.writable = true; 39332 Object.defineProperty(target, _toPropertyKey$n(descriptor.key), descriptor); 39333 } 39334} 39335function _createClass$6(Constructor, protoProps, staticProps) { 39336 if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); 39337 Object.defineProperty(Constructor, "prototype", { writable: false }); 39338 return Constructor; 39339} 39340function _inherits$4(subClass, superClass) { 39341 if (typeof superClass !== "function" && superClass !== null) { 39342 throw new TypeError("Super expression must either be null or a function"); 39343 } 39344 subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 39345 Object.defineProperty(subClass, "prototype", { writable: false }); 39346 if (superClass) _setPrototypeOf$4(subClass, superClass); 39347} 39348function _setPrototypeOf$4(o2, p2) { 39349 _setPrototypeOf$4 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o22, p22) { 39350 o22.__proto__ = p22; 39351 return o22; 39352 }; 39353 return _setPrototypeOf$4(o2, p2); 39354} 39355function _createSuper$4(Derived) { 39356 var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); 39357 return function _createSuperInternal() { 39358 var Super = _getPrototypeOf$4(Derived), result; 39359 if (hasNativeReflectConstruct) { 39360 var NewTarget = _getPrototypeOf$4(this).constructor; 39361 result = Reflect.construct(Super, arguments, NewTarget); 39362 } else { 39363 result = Super.apply(this, arguments); 39364 } 39365 return _possibleConstructorReturn$4(this, result); 39366 }; 39367} 39368function _possibleConstructorReturn$4(self2, call) { 39369 if (call && (_typeof$n(call) === "object" || typeof call === "function")) { 39370 return call; 39371 } else if (call !== void 0) { 39372 throw new TypeError("Derived constructors may only return object or undefined"); 39373 } 39374 return _assertThisInitialized$4(self2); 39375} 39376function _assertThisInitialized$4(self2) { 39377 if (self2 === void 0) { 39378 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 39379 } 39380 return self2; 39381} 39382function _isNativeReflectConstruct$4() { 39383 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
39384 if (Reflect.construct.sham) return false; 39385 if (typeof Proxy === "function") return true; 39386 try { 39387 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 39388 })); 39389 return true; 39390 } catch (e2) { 39391 return false; 39392 } 39393} 39394function _getPrototypeOf$4(o2) { 39395 _getPrototypeOf$4 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o22) { 39396 return o22.__proto__ || Object.getPrototypeOf(o22); 39397 }; 39398 return _getPrototypeOf$4(o2); 39399} 39400function _defineProperty$n(obj, key2, value) { 39401 key2 = _toPropertyKey$n(key2); 39402 if (key2 in obj) { 39403 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39404 } else { 39405 obj[key2] = value; 39406 } 39407 return obj; 39408} 39409function _toPropertyKey$n(arg) { 39410 var key2 = _toPrimitive$n(arg, "string"); 39411 return _typeof$n(key2) === "symbol" ? key2 : String(key2); 39412} 39413function _toPrimitive$n(input, hint) { 39414 if (_typeof$n(input) !== "object" || input === null) return input; 39415 var prim = input[Symbol.toPrimitive]; 39416 if (prim !== void 0) { 39417 var res = prim.call(input, hint || "default"); 39418 if (_typeof$n(res) !== "object") return res; 39419 throw new TypeError("@@toPrimitive must return a primitive value."); 39420 } 39421 return (hint === "string" ? String : Number)(input); 39422} 39423var RawHtml = /* @__PURE__ */ function(_Component) { 39424 _inherits$4(RawHtml2, _Component); 39425 var _super = _createSuper$4(RawHtml2); 39426 function RawHtml2() { 39427 var _this; 39428 _classCallCheck$5(this, RawHtml2); 39429 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 39430 args[_key] = arguments[_key]; 39431 } 39432 _this = _super.call.apply(_super, [this].concat(args)); 39433 _defineProperty$n(_assertThisInitialized$4(_this), "ref", m$6()); 39434 _defineProperty$n(_assertThisInitialized$4(_this), "nodes", []); 39435 return _this; 39436 } 39437 _createClass$6(RawHtml2, [{ 39438 key: "componentDidMount", 39439 value: function componentDidMount() { 39440 var fragment = new DocumentFragment(); 39441 var root = document.createElement("div"); 39442 root.innerHTML = this.props.content; 39443 this.nodes = _toConsumableArray$2(root.childNodes); 39444 this.nodes.forEach(function(node) { 39445 return fragment.appendChild(node); 39446 }); 39447 this.ref.current.replaceWith(fragment); 39448 } 39449 }, { 39450 key: "componentWillUnmount", 39451 value: function componentWillUnmount() { 39452 this.nodes.forEach(function(node) { 39453 if (node instanceof Element) { 39454 node.outerHTML = ""; 39455 return; 39456 } 39457 node.nodeValue = ""; 39458 }); 39459 if (this.nodes[0].nodeValue) { 39460 this.nodes[0].nodeValue = ""; 39461 } 39462 } 39463 }, { 39464 key: "render", 39465 value: function render6() { 39466 return _$1("div", { 39467 ref: this.ref 39468 }); 39469 } 39470 }]); 39471 return RawHtml2; 39472}(k$2); 39473var defaultProps$2 = { 39474 data: {}, 39475 rootTagName: "div", 39476 useCustomCompileOptions: {}, 39477 templates: {}, 39478 templatesConfig: {} 39479}; 39480var Template = /* @__PURE__ */ function(_Component2) { 39481 _inherits$4(Template2, _Component2); 39482 var _super2 = _createSuper$4(Template2); 39483 function Template2() { 39484 _classCallCheck$5(this, Template2); 39485 return _super2.apply(this, arguments); 39486 } 39487 _createClass$6(Template2, [{ 39488 key: "shouldComponentUpdate", 39489 value: function shouldComponentUpdate(nextProps) { 39490 return !isEqual(this.props.data, nextProps.data) || this.props.templateKey !== nextProps.templateKey || !isEqual(this.props.rootProps, nextProps.rootProps); 39491 } 39492 }, { 39493 key: "render", 39494 value: function render6() { 39495 var RootTagName = this.props.rootTagName === "fragment" ? b$3 : this.props.rootTagName; 39496 var useCustomCompileOptions = this.props.useCustomCompileOptions[this.props.templateKey]; 39497 var compileOptions = useCustomCompileOptions ? this.props.templatesConfig.compileOptions : {}; 39498 var content = renderTemplate({ 39499 templates: this.props.templates, 39500 templateKey: this.props.templateKey, 39501 compileOptions, 39502 helpers: this.props.templatesConfig.helpers, 39503 data: this.props.data, 39504 bindEvent: this.props.bindEvent, 39505 sendEvent: this.props.sendEvent 39506 }); 39507 if (content === null) { 39508 return null; 39509 } 39510 if (_typeof$n(content) === "object") { 39511 return _$1(RootTagName, this.props.rootProps, content); 39512 } 39513 if (RootTagName === b$3) { 39514 return _$1(RawHtml, { 39515 content, 39516 key: Math.random() 39517 }); 39518 } 39519 return _$1(RootTagName, _extends$6({}, this.props.rootProps, { 39520 dangerouslySetInnerHTML: { 39521 __html: content 39522 } 39523 })); 39524 } 39525 }]); 39526 return Template2; 39527}(k$2); 39528_defineProperty$n(Template, "defaultProps", defaultProps$2); 39529function _typeof$m(obj) { 39530 "@babel/helpers - typeof"; 39531 return _typeof$m = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39532 return typeof obj2; 39533 } : function(obj2) { 39534 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39535 }, _typeof$m(obj); 39536} 39537function ownKeys$i(object, enumerableOnly) { 39538 var keys = Object.keys(object); 39539 if (Object.getOwnPropertySymbols) { 39540 var symbols = Object.getOwnPropertySymbols(object); 39541 enumerableOnly && (symbols = symbols.filter(function(sym) { 39542 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39543 })), keys.push.apply(keys, symbols); 39544 } 39545 return keys; 39546} 39547function _objectSpread$i(target) { 39548 for (var i2 = 1; i2 < arguments.length; i2++) { 39549 var source = null != arguments[i2] ? arguments[i2] : {}; 39550 i2 % 2 ? ownKeys$i(Object(source), true).forEach(function(key2) { 39551 _defineProperty$m(target, key2, source[key2]); 39552 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEac
39552h(function(key2) { 39553 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 39554 }); 39555 } 39556 return target; 39557} 39558function _defineProperty$m(obj, key2, value) { 39559 key2 = _toPropertyKey$m(key2); 39560 if (key2 in obj) { 39561 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39562 } else { 39563 obj[key2] = value; 39564 } 39565 return obj; 39566} 39567function _toPropertyKey$m(arg) { 39568 var key2 = _toPrimitive$m(arg, "string"); 39569 return _typeof$m(key2) === "symbol" ? key2 : String(key2); 39570} 39571function _toPrimitive$m(input, hint) { 39572 if (_typeof$m(input) !== "object" || input === null) return input; 39573 var prim = input[Symbol.toPrimitive]; 39574 if (prim !== void 0) { 39575 var res = prim.call(input, hint || "default"); 39576 if (_typeof$m(res) !== "object") return res; 39577 throw new TypeError("@@toPrimitive must return a primitive value."); 39578 } 39579 return (hint === "string" ? String : Number)(input); 39580} 39581var withUsage$e = createDocumentationMessageGenerator({ 39582 name: "configure", 39583 connector: true 39584}); 39585function getInitialSearchParameters(state, widgetParams) { 39586 return state.setQueryParameters(Object.keys(widgetParams.searchParameters).reduce(function(acc, key2) { 39587 return _objectSpread$i(_objectSpread$i({}, acc), {}, _defineProperty$m({}, key2, void 0)); 39588 }, {})); 39589} 39590var connectConfigure = function connectConfigure2() { 39591 var renderFn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : noop$1; 39592 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 39593 return function(widgetParams) { 39594 if (!widgetParams || !isPlainObject(widgetParams.searchParameters)) { 39595 throw new Error(withUsage$e("The `searchParameters` option expects an object.")); 39596 } 39597 var connectorState = {}; 39598 function refine(helper) { 39599 return function(searchParameters) { 39600 var actualState = getInitialSearchParameters(helper.state, widgetParams); 39601 var nextSearchParameters = mergeSearchParameters(actualState, new algoliasearchHelper$1.SearchParameters(searchParameters)); 39602 widgetParams.searchParameters = searchParameters; 39603 helper.setState(nextSearchParameters).search(); 39604 }; 39605 } 39606 return { 39607 $$type: "ais.configure", 39608 init: function init7(initOptions) { 39609 var instantSearchInstance = initOptions.instantSearchInstance; 39610 renderFn(_objectSpread$i(_objectSpread$i({}, this.getWidgetRenderState(initOptions)), {}, { 39611 instantSearchInstance 39612 }), true); 39613 }, 39614 render: function render6(renderOptions) { 39615 var instantSearchInstance = renderOptions.instantSearchInstance; 39616 renderFn(_objectSpread$i(_objectSpread$i({}, this.getWidgetRenderState(renderOptions)), {}, { 39617 instantSearchInstance 39618 }), false); 39619 }, 39620 dispose: function dispose(_ref) { 39621 var state = _ref.state; 39622 unmountFn(); 39623 return getInitialSearchParameters(state, widgetParams); 39624 }, 39625 getRenderState: function getRenderState(renderState, renderOptions) { 39626 var _renderState$configur; 39627 var widgetRenderState = this.getWidgetRenderState(renderOptions); 39628 return _objectSpread$i(_objectSpread$i({}, renderState), {}, { 39629 configure: _objectSpread$i(_objectSpread$i({}, widgetRenderState), {}, { 39630 widgetParams: _objectSpread$i(_objectSpread$i({}, widgetRenderState.widgetParams), {}, { 39631 searchParameters: mergeSearchParameters(new algoliasearchHelper$1.SearchParameters((_renderState$configur = renderState.configure) === null || _renderState$configur === void 0 ? void 0 : _renderState$configur.widgetParams.searchParameters), new algoliasearchHelper$1.SearchParameters(widgetRenderState.widgetParams.searchParameters)).getQueryParams() 39632 }) 39633 }) 39634 }); 39635 }, 39636 getWidgetRenderState: function getWidgetRenderState(_ref22) { 39637 var helper = _ref22.helper; 39638 if (!connectorState.refine) { 39639 connectorState.refine = refine(helper); 39640 } 39641 return { 39642 refine: connectorState.refine, 39643 widgetParams 39644 }; 39645 }, 39646 getWidgetSearchParameters: function getWidgetSearchParameters(state, _ref3) { 39647 var uiState = _ref3.uiState; 39648 return mergeSearchParameters(state, new algoliasearchHelper$1.SearchParameters(_objectSpread$i(_objectSpread$i({}, uiState.configure), widgetParams.searchParameters))); 39649 }, 39650 getWidgetUiState: function getWidgetUiState(uiState) { 39651 return _objectSpread$i(_objectSpread$i({}, uiState), {}, { 39652 configure: _objectSpread$i(_objectSpread$i({}, uiState.configure), widgetParams.searchParameters) 39653 }); 39654 } 39655 }; 39656 }; 39657}; 39658function _extends$5() { 39659 _extends$5 = Object.assign ? Object.assign.bind() : function(target) { 39660 for (var i2 = 1; i2 < arguments.length; i2++) { 39661 var source = arguments[i2]; 39662 for (var key2 in source) { 39663 if (Object.prototype.hasOwnProperty.call(source, key2)) { 39664 target[key2] = source[key2]; 39665 } 39666 } 39667 } 39668 return target; 39669 }; 39670 return _extends$5.apply(this, arguments); 39671} 39672var ClearRefinements = function ClearRefinements2(_ref) {
39673 var hasRefinements = _ref.hasRefinements, refine = _ref.refine, cssClasses = _ref.cssClasses, templateProps = _ref.templateProps; 39674 return _$1("div", { 39675 className: cssClasses.root 39676 }, _$1(Template, _extends$5({}, templateProps, { 39677 templateKey: "resetLabel", 39678 rootTagName: "button", 39679 rootProps: { 39680 className: cx(cssClasses.button, !hasRefinements && cssClasses.disabledButton), 39681 onClick: refine, 39682 disabled: !hasRefinements 39683 }, 39684 data: { 39685 hasRefinements 39686 } 39687 }))); 39688}; 39689function _typeof$l(obj) { 39690 "@babel/helpers - typeof"; 39691 return _typeof$l = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39692 return typeof obj2; 39693 } : function(obj2) { 39694 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39695 }, _typeof$l(obj); 39696} 39697function _toConsumableArray$1(arr) { 39698 return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$1(); 39699} 39700function _nonIterableSpread$1() { 39701 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 39702} 39703function _unsupportedIterableToArray$3(o2, minLen) { 39704 if (!o2) return; 39705 if (typeof o2 === "string") return _arrayLikeToArray$3(o2, minLen); 39706 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 39707 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 39708 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 39709 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$3(o2, minLen); 39710} 39711function _iterableToArray$1(iter) { 39712 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 39713} 39714function _arrayWithoutHoles$1(arr) { 39715 if (Array.isArray(arr)) return _arrayLikeToArray$3(arr); 39716} 39717function _arrayLikeToArray$3(arr, len2) { 39718 if (len2 == null || len2 > arr.length) len2 = arr.length; 39719 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 39720 return arr2; 39721} 39722function ownKeys$h(object, enumerableOnly) { 39723 var keys = Object.keys(object); 39724 if (Object.getOwnPropertySymbols) { 39725 var symbols = Object.getOwnPropertySymbols(object); 39726 enumerableOnly && (symbols = symbols.filter(function(sym) { 39727 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39728 })), keys.push.apply(keys, symbols); 39729 } 39730 return keys; 39731} 39732function _objectSpread$h(target) { 39733 for (var i2 = 1; i2 < arguments.length; i2++) { 39734 var source = null != arguments[i2] ? arguments[i2] : {}; 39735 i2 % 2 ? ownKeys$h(Object(source), true).forEach(function(key2) { 39736 _defineProperty$l(target, key2, source[key2]); 39737 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function(key2) { 39738 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 39739 }); 39740 } 39741 return target; 39742} 39743function _defineProperty$l(obj, key2, value) { 39744 key2 = _toPropertyKey$l(key2); 39745 if (key2 in obj) { 39746 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39747 } else { 39748 obj[key2] = value; 39749 } 39750 return obj; 39751} 39752function _toPropertyKey$l(arg) { 39753 var key2 = _toPrimitive$l(arg, "string"); 39754 return _typeof$l(key2) === "symbol" ? key2 : String(key2); 39755} 39756function _toPrimitive$l(input, hint) { 39757 if (_typeof$l(input) !== "object" || input === null) return input; 39758 var prim = input[Symbol.toPrimitive]; 39759 if (prim !== void 0) { 39760 var res = prim.call(input, hint || "default"); 39761 if (_typeof$l(res) !== "object") return res; 39762 throw new TypeError("@@toPrimitive must return a primitive value."); 39763 } 39764 return (hint === "string" ? String : Number)(input); 39765} 39766var withUsage$d = createDocumentationMessageGenerator({ 39767 name: "clear-refinements", 39768 connector: true 39769}); 39770var connectClearRefinements = function connectClearRefinements2(renderFn) { 39771 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 39772 checkRendering(renderFn, withUsage$d()); 39773 return function(widgetParams) { 39774 var _ref = widgetParams || {}, _ref$includedAttribut = _ref.includedAttributes, includedAttributes = _ref$includedAttribut === void 0 ? [] : _ref$includedAttribut, _ref$excludedAttribut = _ref.excludedAttributes, excludedAttributes = _ref$excludedAttribut === void 0 ? ["query"] : _ref$excludedAttribut, _ref$transformItems = _ref.transformItems, transformItems = _ref$transformItems === void 0 ? function(items) { 39775 return items; 39776 } : _ref$transformItems; 39777 if (widgetParams && widgetParams.includedAttributes && widgetParams.excludedAttributes) { 39778 throw new Error(withUsage$d("The options `includedAttributes` and `excludedAttributes` cannot be used together.")); 39779 } 39780 var connectorState = { 39781 refine: noop$1, 39782 createURL: function createURL() { 39783 return ""; 39784 }, 39785 attributesToClear: [] 39786 }; 39787 var cachedRefine = function cachedRefine2() { 39788 return connectorState.refine(); 39789 }; 39790 var cachedCreateURL = function cachedCreateURL2() { 39791 return connectorState.createURL(); 39792 }; 39793 return { 39794 $$type: "ais.clearRefinements", 39795 init: function init7(initOptions) { 39796 var instantSearchInstance = initOptions.instantSearchInstance; 39797 renderFn(_objectSpread$h(_objectSpread$h({}, this.getWidgetRenderState(initOptions)), {}, { 39798 instantSearchInstance 39799 }), true); 39800 }, 39801 render: function render6(renderOptions) { 39802 var instantSearchInstance = renderOptions.instantSearchInstance; 39803 renderFn(_objectSpread$h(_objectSpread$h({}, this.getWidgetRenderState(renderOptions)), {}, { 39804 instantSearchInstance 39805 }), false); 39806 }, 39807 dispose: function dispose() { 39808 unmountFn(); 39809 }, 39810 getRenderState: function getRenderState(renderState, renderOptions) { 39811 return _objectSpread$h(_objectSpread$h({}, renderState), {}, { 39812 clearRefinements: this.getWidgetRenderState(renderOptions) 39813 }); 39814 }, 39815 getWidgetRenderState: function getWidgetRenderState(_ref22) { 39816 var createURL = _ref22.createURL, scopedResults = _ref22.scopedResults, results = _ref22.results; 39817 connectorState.attributesToClear = scopedResults.reduce(function(attributesToClear, scopedResult) { 39818 return attributesToClear.concat(getAttributesToClear({ 39819 scopedResult, 39820 includedAttributes, 39821 excludedAttributes, 39822 transformItems, 39823 results 39824 })); 39825 }, []); 39826 connectorState.refine = function() { 39827 connectorState.attributesToClear.forEach(function(_ref3) { 39828 var indexHelper = _ref3.helper, items = _ref3.items; 39829 indexHelper.setState(clearRefinements$1({ 39830 helper: indexHelper, 39831 attributesToClear: items 39832 })).search(); 39833 }); 39834 }; 39835 connectorState.createURL = function() { 39836 return createURL(mergeSearchParameters.apply(void 0, _toConsumableArray$1(connectorState.attributesToClear.map(function(_ref42) { 39837 var indexHelper = _ref42.helper, items = _ref42.items; 39838 return clearRefinements$1({ 39839 helper: indexHelper, 39840 attributesToClear: items 39841 }); 39842 })))); 39843 }; 39844 var canRefine = connectorState.attributesToClear.some(function(attributeToClear) { 39845 return attributeToClear.items.length > 0; 39846 }); 39847 return { 39848 canRefine, 39849 hasRefinements: canRefine, 39850 refine: cachedRefine, 39851 createURL: cachedCreateURL, 39852 widgetParams 39853 }; 39854 } 39855 }; 39856 }; 39857}; 39858function getAttributesToClear(_ref5) { 39859 var scopedResult = _ref5.scopedResult, includedAttributes = _ref5.includedAttributes, excludedAttributes = _ref5.excludedAttributes, transformItems = _ref5.transformItems, results = _ref5.results; 39860 var includesQuery = includedAttributes.indexOf("query") !== -1 || excludedAttributes.indexOf("query") === -1; 39861 return { 39862 helper: scopedResult.helper, 39863 items: transformItems(uniq(getRefinements(scopedResult.results, scopedResult.helper.state, includesQuery).map(function(refinement) { 39864 return refinement.attribute; 39865 }).filter(function(attribute) { 39866 return ( 39867 // If the array is empty (default case), we keep all the attributes 39868 includedAttributes.length === 0 || // Otherwise, only add the specified attributes 39869 includedAttributes.indexOf(attribute) !== -1 39870 ); 39871 }).filter(function(attribute) { 39872 return ( 39873 // If the query is included, we ignore the default `excludedAttributes = ['query']` 39874 attribute === "query" && includesQuery || // Otherwise, ignore the excluded attributes 39875 excludedAttributes.indexOf(attribute) === -1 39876 ); 39877 })), { 39878 results 39879 }) 39880 }; 39881} 39882var defaultTemplates$3 = { 39883 resetLabel: function resetLabel() { 39884 return "Clear refinements"; 39885 } 39886}; 39887function _typeof$k(obj) { 39888 "@babel/helpers - typeof"; 39889 return _typeof$k = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39890 return typeof obj2; 39891 } : function(obj2) { 39892 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39893 }, _typeof$k(obj); 39894} 39895function ownKeys$g(object, enumerableOnly) { 39896 var keys = Object.keys(object); 39897 if (Object.getOwnPropertySymbols) { 39898 var symbols = Object.getOwnPropertySymbols(object); 39899 enumerableOnly && (symbols = symbols.filter(function(sym) { 39900 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39901 })), keys.push.apply(keys, symbols); 39902 } 39903 return keys; 39904} 39905function _objectSpread$g(target) { 39906 for (var i2 = 1; i2 < arguments.length; i2++) { 39907 var source = null != arguments[i2] ? arguments[i2] : {}; 39908 i2 % 2 ? ownKeys$g(Object(source), true).forEach(function(key2) { 39909 _defineProperty$k(target, key2, source[key2]); 39910 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEac
39910h(function(key2) { 39911 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 39912 }); 39913 } 39914 return target; 39915} 39916function _defineProperty$k(obj, key2, value) { 39917 key2 = _toPropertyKey$k(key2); 39918 if (key2 in obj) { 39919 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 39920 } else { 39921 obj[key2] = value; 39922 } 39923 return obj; 39924} 39925function _toPropertyKey$k(arg) { 39926 var key2 = _toPrimitive$k(arg, "string"); 39927 return _typeof$k(key2) === "symbol" ? key2 : String(key2); 39928} 39929function _toPrimitive$k(input, hint) { 39930 if (_typeof$k(input) !== "object" || input === null) return input; 39931 var prim = input[Symbol.toPrimitive]; 39932 if (prim !== void 0) { 39933 var res = prim.call(input, hint || "default"); 39934 if (_typeof$k(res) !== "object") return res; 39935 throw new TypeError("@@toPrimitive must return a primitive value."); 39936 } 39937 return (hint === "string" ? String : Number)(input); 39938} 39939var withUsage$c = createDocumentationMessageGenerator({ 39940 name: "clear-refinements" 39941}); 39942var suit$5 = component("ClearRefinements"); 39943var renderer$6 = function renderer(_ref) { 39944 var containerNode = _ref.containerNode, cssClasses = _ref.cssClasses, renderState = _ref.renderState, templates = _ref.templates; 39945 return function(_ref22, isFirstRendering) { 39946 var refine = _ref22.refine, canRefine = _ref22.canRefine, instantSearchInstance = _ref22.instantSearchInstance; 39947 if (isFirstRendering) { 39948 renderState.templateProps = prepareTemplateProps({ 39949 defaultTemplates: defaultTemplates$3, 39950 templatesConfig: instantSearchInstance.templatesConfig, 39951 templates 39952 }); 39953 return; 39954 } 39955 B$1(_$1(ClearRefinements, { 39956 refine, 39957 cssClasses, 39958 hasRefinements: canRefine, 39959 templateProps: renderState.templateProps 39960 }), containerNode); 39961 }; 39962}; 39963var clearRefinements2 = function clearRefinements3(widgetParams) { 39964 var _ref3 = widgetParams || {}, container = _ref3.container, _ref3$templates = _ref3.templates, templates = _ref3$templates === void 0 ? {} : _ref3$templates, includedAttributes = _ref3.includedAttributes, excludedAttributes = _ref3.excludedAttributes, transformItems = _ref3.transformItems, _ref3$cssClasses = _ref3.cssClasses, userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses; 39965 if (!container) { 39966 throw new Error(withUsage$c("The `container` option is required.")); 39967 } 39968 var containerNode = getContainerNode(container);
39969 var cssClasses = { 39970 root: cx(suit$5(), userCssClasses.root), 39971 button: cx(suit$5({ 39972 descendantName: "button" 39973 }), userCssClasses.button), 39974 disabledButton: cx(suit$5({ 39975 descendantName: "button", 39976 modifierName: "disabled" 39977 }), userCssClasses.disabledButton) 39978 }; 39979 var specializedRenderer = renderer$6({ 39980 containerNode, 39981 cssClasses, 39982 renderState: {}, 39983 templates 39984 }); 39985 var makeWidget = connectClearRefinements(specializedRenderer, function() { 39986 return B$1(null, containerNode); 39987 }); 39988 return _objectSpread$g(_objectSpread$g({}, makeWidget({ 39989 includedAttributes, 39990 excludedAttributes, 39991 transformItems 39992 })), {}, { 39993 $$widgetType: "ais.clearRefinements" 39994 }); 39995}; 39996function _typeof$j(obj) { 39997 "@babel/helpers - typeof"; 39998 return _typeof$j = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 39999 return typeof obj2; 40000 } : function(obj2) { 40001 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40002 }, _typeof$j(obj); 40003} 40004function ownKeys$f(object, enumerableOnly) { 40005 var keys = Object.keys(object); 40006 if (Object.getOwnPropertySymbols) { 40007 var symbols = Object.getOwnPropertySymbols(object); 40008 enumerableOnly && (symbols = symbols.filter(function(sym) { 40009 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40010 })), keys.push.apply(keys, symbols); 40011 } 40012 return keys; 40013} 40014function _objectSpread$f(target) { 40015 for (var i2 = 1; i2 < arguments.length; i2++) { 40016 var source = null != arguments[i2] ? arguments[i2] : {}; 40017 i2 % 2 ? ownKeys$f(Object(source), true).forEach(function(key2) { 40018 _defineProperty$j(target, key2, source[key2]); 40019 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function(key2) { 40020 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 40021 }); 40022 } 40023 return target; 40024} 40025function _defineProperty$j(obj, key2, value) { 40026 key2 = _toPropertyKey$j(key2); 40027 if (key2 in obj) { 40028 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 40029 } else { 40030 obj[key2] = value; 40031 } 40032 return obj; 40033} 40034function _toPropertyKey$j(arg) { 40035 var key2 = _toPrimitive$j(arg, "string"); 40036 return _typeof$j(key2) === "symbol" ? key2 : String(key2); 40037} 40038function _toPrimitive$j(input, hint) { 40039 if (_typeof$j(input) !== "object" || input === null) return input; 40040 var prim = input[Symbol.toPrimitive]; 40041 if (prim !== void 0) { 40042 var res = prim.call(input, hint || "default"); 40043 if (_typeof$j(res) !== "object") return res; 40044 throw new TypeError("@@toPrimitive must return a primitive value."); 40045 } 40046 return (hint === "string" ? String : Number)(input); 40047} 40048var configure = function configure2(widgetParams) { 40049 var makeWidget = connectConfigure(noop$1); 40050 return _objectSpread$f(_objectSpread$f({}, makeWidget({ 40051 searchParameters: widgetParams 40052 })), {}, { 40053 $$widgetType: "ais.configure" 40054 }); 40055}; 40056function _typeof$i(obj) { 40057 "@babel/helpers - typeof"; 40058 return _typeof$i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 40059 return typeof obj2; 40060 } : function(obj2) { 40061 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40062 }, _typeof$i(obj); 40063} 40064function _classCallCheck$4(instance, Constructor) { 40065 if (!(instance instanceof Constructor)) { 40066 throw new TypeError("Cannot call a class as a function"); 40067 } 40068} 40069function _defineProperties$4(target, props) { 40070 for (var i2 = 0; i2 < props.length; i2++) { 40071 var descriptor = props[i2]; 40072 descriptor.enumerable = descriptor.enumerable || false; 40073 descriptor.configurable = true; 40074 if ("value" in descriptor) descriptor.writable = true; 40075 Object.defineProperty(target, _toPropertyKey$i(descriptor.key), descriptor); 40076 } 40077} 40078function _createClass$5(Constructor, protoProps, staticProps) { 40079 if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); 40080 Object.defineProperty(Constructor, "prototype", { writable: false }); 40081 return Constructor; 40082} 40083function _inherits$3(subClass, superClass) { 40084 if (typeof superClass !== "function" && superClass !== null) { 40085 throw new TypeError("Super expression must either be null or a function"); 40086 } 40087 subClass.prototype = Object.create(superClass && superClass.prototype, { c
40087onstructor: { value: subClass, writable: true, configurable: true } }); 40088 Object.defineProperty(subClass, "prototype", { writable: false }); 40089 if (superClass) _setPrototypeOf$3(subClass, superClass); 40090} 40091function _setPrototypeOf$3(o2, p2) { 40092 _setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) { 40093 o3.__proto__ = p3; 40094 return o3; 40095 }; 40096 return _setPrototypeOf$3(o2, p2); 40097} 40098function _createSuper$3(Derived) { 40099 var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); 40100 return function _createSuperInternal() { 40101 var Super = _getPrototypeOf$3(Derived), result; 40102 if (hasNativeReflectConstruct) { 40103 var NewTarget = _getPrototypeOf$3(this).constructor; 40104 result = Reflect.construct(Super, arguments, NewTarget); 40105 } else { 40106 result = Super.apply(this, arguments); 40107 } 40108 return _possibleConstructorReturn$3(this, result); 40109 }; 40110} 40111function _possibleConstructorReturn$3(self2, call) { 40112 if (call && (_typeof$i(call) === "object" || typeof call === "function")) { 40113 return call; 40114 } else if (call !== void 0) { 40115 throw new TypeError("Derived constructors may only return object or undefined"); 40116 } 40117 return _assertThisInitialized$3(self2); 40118} 40119function _assertThisInitialized$3(self2) { 40120 if (self2 === void 0) { 40121 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 40122 } 40123 return self2; 40124} 40125function _isNativeReflectConstruct$3() { 40126 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 40127 if (Reflect.construct.sham) return false; 40128 if (typeof Proxy === "function") return true; 40129 try { 40130 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 40131 })); 40132 return true; 40133 } catch (e2) { 40134 return false; 40135 } 40136} 40137function _getPrototypeOf$3(o2) { 40138 _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) { 40139 return o3.__proto__ || Object.getPrototypeOf(o3); 40140 }; 40141 return _getPrototypeOf$3(o2); 40142} 40143function _defineProperty$i(obj, key2, value) { 40144 key2 = _toPropertyKey$i(key2); 40145 if (key2 in obj) { 40146 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 40147 } else { 40148 obj[key2] = value; 40149 } 40150 return obj; 40151} 40152function _toPropertyKey$i(arg) { 40153 var key2 = _toPrimitive$i(arg, "string"); 40154 return _typeof$i(key2) === "symbol" ? key2 : String(key2); 40155} 40156function _toPrimitive$i(input, hint) { 40157 if (_typeof$i(input) !== "object" || input === null) return input; 40158 var prim = input[Symbol.toPrimitive]; 40159 if (prim !== void 0) { 40160 var res = prim.call(input, hint || "default"); 40161 if (_typeof$i(res) !== "object") return res; 40162 throw new TypeError("@@toPrimitive must return a primitive value."); 40163 } 40164 return (hint === "string" ? String : Number)(input); 40165} 40166var defaultProps$1 = { 40167 query: "", 40168 showSubmit: true, 40169 showReset: true, 40170 showLoadingIndicator: true, 40171 autofocus: false, 40172 searchAsYouType: true, 40173 ignoreCompositionEvents: false, 40174 isSearchStalled: false, 40175 disabled: false, 40176 ariaLabel: "Search", 40177 onChange: noop$1, 40178 onSubmit: noop$1, 40179 onReset: noop$1, 40180 refine: noop$1 40181}; 40182var SearchBox = /* @__PURE__ */ function(_Component) { 40183 _inherits$3(SearchBox2, _Component); 40184 var _super = _createSuper$3(SearchBox2); 40185 function SearchBox2() { 40186 var _this; 40187 _classCallCheck$4(this, SearchBox2); 40188 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 40189 args[_key] = arguments[_key]; 40190 } 40191 _this = _super.call.apply(_super, [this].concat(args)); 40192 _defineProperty$i(_assertThisInitialized$3(_this), "state", { 40193 query: _this.props.query, 40194 focused: false 40195 }); 40196 _defineProperty$i(_assertThisInitialized$3(_this), "input", m$6()); 40197 _defineProperty$i(_assertThisInitialized$3(_this), "onInput", function(event) { 40198 var _this$props = _this.props, searchAsYouType = _this$props.searchAsYouType, refine = _this$props.refine, onChange = _this$props.onChange; 40199 var query = event.target.value; 40200 if (!(_this.props.ignoreCompositionEvents && event.isComposing)) { 40201 if (searchAsYouType) { 40202 refine(query); 40203 } 40204 _this.setState({ 40205 query 40206 }); 40207 onChange(event); 40208 } 40209 }); 40210 _defineProperty$i(_assertThisInitialized$3(_this), "onSubmit", function(event) { 40211 var _this$props2 = _this.props, searchAsYouType = _this$props2.searchAsYouType, refine = _this$props2.refine, onSubmit = _this$props2.onSubmit; 40212 event.preventDefault(); 40213 event.stopPropagation(); 40214 if (_this.input.current) { 40215 _this.input.current.blur(); 40216 } 40217 if (!searchAsYouType) { 40218 refine(_this.state.query); 40219 } 40220 onSubmit(event); 40221 return false;
40222 }); 40223 _defineProperty$i(_assertThisInitialized$3(_this), "onReset", function(event) { 40224 var _this$props3 = _this.props, refine = _this$props3.refine, onReset = _this$props3.onReset; 40225 var query = ""; 40226 if (_this.input.current) { 40227 _this.input.current.focus(); 40228 } 40229 refine(query); 40230 _this.setState({ 40231 query 40232 }); 40233 onReset(event); 40234 }); 40235 _defineProperty$i(_assertThisInitialized$3(_this), "onBlur", function() { 40236 _this.setState({ 40237 focused: false 40238 }); 40239 }); 40240 _defineProperty$i(_assertThisInitialized$3(_this), "onFocus", function() { 40241 _this.setState({ 40242 focused: true 40243 }); 40244 }); 40245 return _this; 40246 } 40247 _createClass$5(SearchBox2, [{ 40248 key: "resetInput", 40249 value: ( 40250 /** 40251 * This public method is used in the RefinementList SFFV search box 40252 * to reset the input state when an item is selected. 40253 * 40254 * @see RefinementList#componentWillReceiveProps 40255 * @return {undefined} 40256 */ 40257 function resetInput() { 40258 this.setState({ 40259 query: "" 40260 }); 40261 } 40262 ) 40263 }, { 40264 key: "componentWillReceiveProps", 40265 value: function componentWillReceiveProps(nextProps) { 40266 if (!this.state.focused && nextProps.query !== this.state.query) { 40267 this.setState({ 40268 query: nextProps.query 40269 }); 40270 } 40271 } 40272 }, { 40273 key: "render", 40274 value: function render6() {
40275 var _this$props4 = this.props, cssClasses = _this$props4.cssClasses, placeholder = _this$props4.placeholder, autofocus = _this$props4.autofocus, showSubmit = _this$props4.showSubmit, showReset = _this$props4.showReset, showLoadingIndicator = _this$props4.showLoadingIndicator, templates = _this$props4.templates, isSearchStalled = _this$props4.isSearchStalled, ariaLabel = _this$props4.ariaLabel; 40276 return _$1("div", { 40277 className: cssClasses.root 40278 }, _$1("form", { 40279 action: "", 40280 role: "search", 40281 className: cssClasses.form, 40282 noValidate: true, 40283 onSubmit: this.onSubmit, 40284 onReset: this.onReset 40285 }, _$1("input", { 40286 ref: this.input, 40287 value: this.state.query, 40288 disabled: this.props.disabled, 40289 className: cssClasses.input, 40290 type: "search", 40291 placeholder, 40292 autoFocus: autofocus, 40293 autoComplete: "off", 40294 autoCorrect: "off", 40295 autoCapitalize: "off", 40296 spellCheck: "false", 40297 maxLength: 512, 40298 onInput: this.onInput, 40299 oncompositionend: this.onInput, 40300 onBlur: this.onBlur, 40301 onFocus: this.onFocus, 40302 "aria-label": ariaLabel 40303 }), _$1(Template, { 40304 templateKey: "submit", 40305 rootTagName: "button", 40306 rootProps: { 40307 className: cssClasses.submit, 40308 type: "submit", 40309 title: "Submit the search query", 40310 hidden: !showSubmit 40311 }, 40312 templates, 40313 data: { 40314 cssClasses 40315 } 40316 }), _$1(Template, { 40317 templateKey: "reset", 40318 rootTagName: "button", 40319 rootProps: { 40320 className: cssClasses.reset, 40321 type: "reset", 40322 title: "Clear the search query", 40323 hidden: !(showReset && this.state.query.trim() && !isSearchStalled) 40324 }, 40325 templates, 40326 data: { 40327 cssClasses 40328 } 40329 }), showLoadingIndicator && _$1(Template, { 40330 templateKey: "loadingIndicator", 40331 rootTagName: "span", 40332 rootProps: { 40333 className: cssClasses.loadingIndicator, 40334 hidden: !isSearchStalled 40335 }, 40336 templates, 40337 data: { 40338 cssClasses 40339 } 40340 }))); 40341 } 40342 }]); 40343 return SearchBox2; 40344}(k$2); 40345_defineProperty$i(SearchBox, "defaultProps", defaultProps$1); 40346function _extends$4() { 40347 _extends$4 = Object.assign ? Object.assign.bind() : function(target) { 40348 for (var i2 = 1; i2 < arguments.length; i2++) { 40349 var source = arguments[i2]; 40350 for (var key2 in source) { 40351 if (Object.prototype.hasOwnProperty.call(source, key2)) { 40352 target[key2] = source[key2]; 40353 } 40354 } 40355 } 40356 return target; 40357 }; 40358 return _extends$4.apply(this, arguments); 40359} 40360function RefinementListItem(_ref) { 40361 var className = _ref.className, handleClick = _ref.handleClick, facetValueToRefine = _ref.facetValueToRefine, isRefined2 = _ref.isRefined, templateProps = _ref.templateProps, templateKey = _ref.templateKey, templateData = _ref.templateData, subItems = _ref.subItems; 40362 return _$1("li", { 40363 className, 40364 onClick: function onClick(originalEvent) { 40365 handleClick({ 40366 facetValueToRefine, 40367 isRefined: isRefined2, 40368 originalEvent 40369 }); 40370 } 40371 }, _$1(Template, _extends$4({}, templateProps, { 40372 templateKey, 40373 data: templateData 40374 })), subItems); 40375} 40376var _excluded$2 = ["root"]; 40377function _typeof$h(obj) { 40378 "@babel/helpers - typeof"; 40379 return _typeof$h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 40380 return typeof obj2; 40381 } : function(obj2) { 40382 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40383 }, _typeof$h(obj); 40384} 40385function ownKeys$e(object, enumerableOnly) { 40386 var keys = Object.keys(object); 40387 if (Object.getOwnPropertySymbols) { 40388 var symbols = Object.getOwnPropertySymbols(object); 40389 enumerableOnly && (symbols = symbols.filter(function(sym) { 40390 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40391 })), keys.push.apply(keys, symbols); 40392 } 40393 return keys; 40394} 40395function _objectSpread$e(target) { 40396 for (var i2 = 1; i2 < arguments.length; i2++) { 40397 var source = null != arguments[i2] ? arguments[i2] : {}; 40398 i2 % 2 ? ownKeys$e(Object(source), true).forEach(function(key2) { 40399 _defineProperty$h(target, key2, source[key2]); 40400 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEac
vendor: 4,253 bytes, lines 40400-40517
40400h(function(key2) { 40401 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 40402 }); 40403 } 40404 return target; 40405} 40406function _extends$3() { 40407 _extends$3 = Object.assign ? Object.assign.bind() : function(target) { 40408 for (var i2 = 1; i2 < arguments.length; i2++) { 40409 var source = arguments[i2]; 40410 for (var key2 in source) { 40411 if (Object.prototype.hasOwnProperty.call(source, key2)) { 40412 target[key2] = source[key2]; 40413 } 40414 } 40415 } 40416 return target; 40417 }; 40418 return _extends$3.apply(this, arguments); 40419} 40420function _objectWithoutProperties$2(source, excluded) { 40421 if (source == null) return {}; 40422 var target = _objectWithoutPropertiesLoose$2(source, excluded); 40423 var key2, i2; 40424 if (Object.getOwnPropertySymbols) { 40425 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 40426 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 40427 key2 = sourceSymbolKeys[i2]; 40428 if (excluded.indexOf(key2) >= 0) continue; 40429 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 40430 target[key2] = source[key2]; 40431 } 40432 } 40433 return target; 40434} 40435function _objectWithoutPropertiesLoose$2(source, excluded) { 40436 if (source == null) return {}; 40437 var target = {}; 40438 var sourceKeys = Object.keys(source); 40439 var key2, i2; 40440 for (i2 = 0; i2 < sourceKeys.length; i2++) { 40441 key2 = sourceKeys[i2]; 40442 if (excluded.indexOf(key2) >= 0) continue; 40443 target[key2] = source[key2]; 40444 } 40445 return target; 40446} 40447function _classCallCheck$3(instance, Constructor) { 40448 if (!(instance instanceof Constructor)) { 40449 throw new TypeError("Cannot call a class as a function"); 40450 } 40451} 40452function _defineProperties$3(target, props) { 40453 for (var i2 = 0; i2 < props.length; i2++) { 40454 var descriptor = props[i2]; 40455 descriptor.enumerable = descriptor.enumerable || false; 40456 descriptor.configurable = true; 40457 if ("value" in descriptor) descriptor.writable = true; 40458 Object.defineProperty(target, _toPropertyKey$h(descriptor.key), descriptor); 40459 } 40460} 40461function _createClass$4(Constructor, protoProps, staticProps) { 40462 if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); 40463 Object.defineProperty(Constructor, "prototype", { writable: false }); 40464 return Constructor; 40465} 40466function _inherits$2(subClass, superClass) { 40467 if (typeof superClass !== "function" && superClass !== null) { 40468 throw new TypeError("Super expression must either be null or a function"); 40469 } 40470 subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 40471 Object.defineProperty(subClass, "prototype", { writable: false }); 40472 if (superClass) _setPrototypeOf$2(subClass, superClass); 40473} 40474function _setPrototypeOf$2(o2, p2) { 40475 _setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) { 40476 o3.__proto__ = p3; 40477 return o3; 40478 }; 40479 return _setPrototypeOf$2(o2, p2); 40480} 40481function _createSuper$2(Derived) { 40482 var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); 40483 return function _createSuperInternal() { 40484 var Super = _getPrototypeOf$2(Derived), result; 40485 if (hasNativeReflectConstruct) { 40486 var NewTarget = _getPrototypeOf$2(this).constructor; 40487 result = Reflect.construct(Super, arguments, NewTarget); 40488 } else { 40489 result = Super.apply(this, arguments); 40490 } 40491 return _possibleConstructorReturn$2(this, result); 40492 }; 40493} 40494function _possibleConstructorReturn$2(self2, call) { 40495 if (call && (_typeof$h(call) === "object" || typeof call === "function")) { 40496 return call; 40497 } else if (call !== void 0) { 40498 throw new TypeError("Derived constructors may only return object or undefined"); 40499 } 40500 return _assertThisInitialized$2(self2); 40501} 40502function _assertThisInitialized$2(self2) { 40503 if (self2 === void 0) { 40504 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 40505 } 40506 return self2; 40507} 40508function _isNativeReflectConstruct$2() { 40509 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 40510 if (Reflect.construct.sham) return false; 40511 if (typeof Proxy === "function") return true; 40512 try { 40513 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 40514 })); 40515 return true; 40516 } catch (e2) { 40517 return false;
40518 } 40519} 40520function _getPrototypeOf$2(o2) { 40521 _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) { 40522 return o3.__proto__ || Object.getPrototypeOf(o3); 40523 }; 40524 return _getPrototypeOf$2(o2); 40525} 40526function _defineProperty$h(obj, key2, value) { 40527 key2 = _toPropertyKey$h(key2); 40528 if (key2 in obj) { 40529 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 40530 } else { 40531 obj[key2] = value; 40532 } 40533 return obj; 40534} 40535function _toPropertyKey$h(arg) { 40536 var key2 = _toPrimitive$h(arg, "string"); 40537 return _typeof$h(key2) === "symbol" ? key2 : String(key2); 40538} 40539function _toPrimitive$h(input, hint) { 40540 if (_typeof$h(input) !== "object" || input === null) return input; 40541 var prim = input[Symbol.toPrimitive]; 40542 if (prim !== void 0) { 40543 var res = prim.call(input, hint || "default"); 40544 if (_typeof$h(res) !== "object") return res; 40545 throw new TypeError("@@toPrimitive must return a primitive value."); 40546 } 40547 return (hint === "string" ? String : Number)(input); 40548} 40549var defaultProps = { 40550 cssClasses: {}, 40551 depth: 0 40552}; 40553function isHierarchicalMenuItem(facetValue) { 40554 return facetValue.data !== void 0; 40555} 40556var RefinementList = /* @__PURE__ */ function(_Component) { 40557 _inherits$2(RefinementList2, _Component); 40558 var _super = _createSuper$2(RefinementList2); 40559 function RefinementList2() { 40560 var _this; 40561 _classCallCheck$3(this, RefinementList2); 40562 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 40563 args[_key] = arguments[_key]; 40564 } 40565 _this = _super.call.apply(_super, [this].concat(args)); 40566 _defineProperty$h(_assertThisInitialized$2(_this), "searchBox", m$6()); 40567 _defineProperty$h(_assertThisInitialized$2(_this), "_generateFacetItem", function(facetValue) { 40568 var subItems; 40569 if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) { 40570 var _this$props$cssClasse = _this.props.cssClasses; 40571 _this$props$cssClasse.root;
vendor: 4,635 bytes, lines 40572-40685
40572 var cssClasses = _objectWithoutProperties$2(_this$props$cssClasse, _excluded$2); 40573 subItems = _$1(RefinementList2, _extends$3({}, _this.props, { 40574 // We want to keep `root` required for external usage but not for the 40575 // sub items. 40576 cssClasses, 40577 depth: _this.props.depth + 1, 40578 facetValues: facetValue.data, 40579 showMore: false, 40580 className: _this.props.cssClasses.childList 40581 })); 40582 } 40583 var url = _this.props.createURL(facetValue.value); 40584 var templateData = _objectSpread$e(_objectSpread$e({}, facetValue), {}, { 40585 url, 40586 attribute: _this.props.attribute, 40587 cssClasses: _this.props.cssClasses, 40588 isFromSearch: _this.props.isFromSearch 40589 }); 40590 var key2 = facetValue.value; 40591 if (facetValue.isRefined !== void 0) { 40592 key2 += "/".concat(facetValue.isRefined); 40593 } 40594 if (facetValue.count !== void 0) { 40595 key2 += "/".concat(facetValue.count); 40596 } 40597 var refinementListItemClassName = cx(_this.props.cssClasses.item, facetValue.isRefined && _this.props.cssClasses.selectedItem, !facetValue.count && _this.props.cssClasses.disabledItem, Boolean(isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) && _this.props.cssClasses.parentItem); 40598 return _$1(RefinementListItem, { 40599 templateKey: "item", 40600 key: key2, 40601 facetValueToRefine: facetValue.value, 40602 handleClick: _this.handleItemClick, 40603 isRefined: facetValue.isRefined, 40604 className: refinementListItemClassName, 40605 subItems, 40606 templateData, 40607 templateProps: _this.props.templateProps 40608 }); 40609 }); 40610 _defineProperty$h(_assertThisInitialized$2(_this), "handleItemClick", function(_ref) { 40611 var facetValueToRefine = _ref.facetValueToRefine, isRefined2 = _ref.isRefined, originalEvent = _ref.originalEvent; 40612 if (isSpecialClick(originalEvent)) { 40613 return; 40614 } 40615 var parent = originalEvent.target; 40616 if (parent === null || parent.parentNode === null) { 40617 return; 40618 } 40619 if (isRefined2 && parent.parentNode.querySelector('input[type="radio"]:checked')) { 40620 return; 40621 } 40622 if (parent.tagName === "INPUT") { 40623 _this.refine(facetValueToRefine); 40624 return; 40625 } 40626 while (parent !== originalEvent.currentTarget) { 40627 if (parent.tagName === "LABEL" && (parent.querySelector('input[type="checkbox"]') || parent.querySelector('input[type="radio"]'))) { 40628 return; 40629 } 40630 if (parent.tagName === "A" && parent.href) { 40631 originalEvent.preventDefault(); 40632 } 40633 parent = parent.parentNode; 40634 } 40635 originalEvent.stopPropagation(); 40636 _this.refine(facetValueToRefine); 40637 }); 40638 return _this; 40639 } 40640 _createClass$4(RefinementList2, [{ 40641 key: "shouldComponentUpdate", 40642 value: function shouldComponentUpdate(nextProps) { 40643 var areFacetValuesDifferent = !isEqual(this.props.facetValues, nextProps.facetValues); 40644 return areFacetValuesDifferent; 40645 } 40646 }, { 40647 key: "refine", 40648 value: function refine(facetValueToRefine) { 40649 this.props.toggleRefinement(facetValueToRefine); 40650 } 40651 }, { 40652 key: "componentWillReceiveProps", 40653 value: function componentWillReceiveProps(nextProps) { 40654 if (this.searchBox.current && !nextProps.isFromSearch) { 40655 this.searchBox.current.resetInput(); 40656 } 40657 } 40658 }, { 40659 key: "refineFirstValue", 40660 value: function refineFirstValue() { 40661 var firstValue = this.props.facetValues && this.props.facetValues[0]; 40662 if (firstValue) { 40663 var actualValue = firstValue.value; 40664 this.props.toggleRefinement(actualValue); 40665 } 40666 } 40667 }, { 40668 key: "render", 40669 value: function render6() { 40670 var _this2 = this; 40671 var showMoreButtonClassName = cx(this.props.cssClasses.showMore, !(this.props.showMore === true && this.props.canToggleShowMore) && this.props.cssClasses.disabledShowMore); 40672 var showMoreButton = this.props.showMore === true && _$1(Template, _extends$3({}, this.props.templateProps, { 40673 templateKey: "showMoreText", 40674 rootTagName: "button", 40675 rootProps: { 40676 className: showMoreButtonClassName, 40677 disabled: !this.props.canToggleShowMore, 40678 onClick: this.props.toggleShowMore 40679 }, 40680 data: { 40681 isShowingMore: this.props.isShowingMore 40682 } 40683 })); 40684 var shouldDisableSearchBox = this.props.searchIsAlwaysActive !== true && !(this.props.isFromSearch || !this.props.hasExhaustiveItems); 40685 var searchBox3 = this.props.searchFacetValues && _$1("div", {
40686 className: this.props.cssClasses.searchBox 40687 }, _$1(SearchBox, { 40688 ref: this.searchBox, 40689 placeholder: this.props.searchPlaceholder, 40690 disabled: shouldDisableSearchBox, 40691 cssClasses: this.props.cssClasses.searchable, 40692 templates: this.props.searchBoxTemplateProps.templates, 40693 onChange: function onChange(event) { 40694 return _this2.props.searchFacetValues(event.target.value); 40695 }, 40696 onReset: function onReset() { 40697 return _this2.props.searchFacetValues(""); 40698 }, 40699 onSubmit: function onSubmit() { 40700 return _this2.refineFirstValue(); 40701 }, 40702 searchAsYouType: false, 40703 ariaLabel: "Search for filters" 40704 })); 40705 var facetValues = this.props.facetValues && this.props.facetValues.length > 0 && _$1("ul", { 40706 className: this.props.cssClasses.list 40707 }, this.props.facetValues.map(this._generateFacetItem, this)); 40708 var noResults = this.props.searchFacetValues && this.props.isFromSearch && (!this.props.facetValues || this.props.facetValues.length === 0) && _$1(Template, _extends$3({}, this.props.templateProps, { 40709 templateKey: "searchableNoResults", 40710 rootProps: { 40711 className: this.props.cssClasses.noResults 40712 } 40713 })); 40714 var rootClassName = cx(this.props.cssClasses.root, (!this.props.facetValues || this.props.facetValues.length === 0) && this.props.cssClasses.noRefinementRoot, this.props.className); 40715 return _$1("div", { 40716 className: rootClassName 40717 }, this.props.children, searchBox3, facetValues, noResults, showMoreButton); 40718 } 40719 }]); 40720 return RefinementList2; 40721}(k$2); 40722_defineProperty$h(RefinementList, "defaultProps", defaultProps); 40723function _typeof$g(obj) { 40724 "@babel/helpers - typeof"; 40725 return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 40726 return typeof obj2; 40727 } : function(obj2) { 40728 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40729 }, _typeof$g(obj); 40730} 40731function ownKeys$d(object, enumerableOnly) { 40732 var keys = Object.keys(object); 40733 if (Object.getOwnPropertySymbols) { 40734 var symbols = Object.getOwnPropertySymbols(object); 40735 enumerableOnly && (symbols = symbols.filter(function(sym) { 40736 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40737 })), keys.push.apply(keys, symbols); 40738 } 40739 return keys; 40740} 40741function _objectSpread$d(target) { 40742 for (var i2 = 1; i2 < arguments.length; i2++) { 40743 var source = null != arguments[i2] ? arguments[i2] : {}; 40744 i2 % 2 ? ownKeys$d(Object(source), true).forEach(function(key2) { 40745 _defineProperty$g(target, key2, source[key2]); 40746 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function(key2) { 40747 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 40748 }); 40749 } 40750 return target; 40751} 40752function _defineProperty$g(obj, key2, value) { 40753 key2 = _toPropertyKey$g(key2); 40754 if (key2 in obj) { 40755 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 40756 } else { 40757 obj[key2] = value; 40758 } 40759 return obj; 40760} 40761function _toPropertyKey$g(arg) { 40762 var key2 = _toPrimitive$g(arg, "string"); 40763 return _typeof$g(key2) === "symbol" ? key2 : String(key2); 40764} 40765function _toPrimitive$g(input, hint) { 40766 if (_typeof$g(input) !== "object" || input === null) return input; 40767 var prim = input[Symbol.toPrimitive]; 40768 if (prim !== void 0) { 40769 var res = prim.call(input, hint || "default"); 40770 if (_typeof$g(res) !== "object") return res; 40771 throw new TypeError("@@toPrimitive must return a primitive value."); 40772 } 40773 return (hint === "string" ? String : Number)(input); 40774} 40775var withUsage$b = createDocumentationMessageGenerator({ 40776 name: "hits", 40777 connector: true 40778}); 40779const connectHits = function connectHits2(renderFn) { 40780 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 40781 checkRendering(renderFn, withUsage$b()); 40782 return function(widgetParams) { 40783 var _ref = widgetParams || {}, _ref$escapeHTML = _ref.escapeHTML, escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML, _ref$transformItems = _ref.transformItems, transformItems = _ref$transformItems === void 0 ? function(items) { 40784 return items; 40785 } : _ref$transformItems; 40786 var sendEvent; 40787 var bindEvent; 40788 return { 40789 $$type: "ais.hits", 40790 init: function init7(initOptions) { 40791 renderFn(_objectSpread$d(_objectSpread$d({}, this.getWidgetRenderState(initOptions)), {}, { 40792 instantSearchInstance: initOptions.instantSearchInstance 40793 }), true); 40794 }, 40795 render: function render6(renderOptions) { 40796 var renderState = this.getWidgetRenderState(renderOptions); 40797 renderFn(_objectSpread$d(_objectSpread$d({}, renderState), {}, { 40798 instantSearchInstance: renderOptions.instantSearchInstance 40799 }), false); 40800 renderState.sendEvent("view:internal", renderState.items); 40801 }, 40802 getRenderState: function getRenderState(renderState, renderOptions) { 40803 return _objectSpread$d(_objectSpread$d({}, renderState), {}, { 40804 hits: this.getWidgetRenderState(renderOptions) 40805 }); 40806 }, 40807 getWidgetRenderState: function getWidgetRenderState(_ref22) { 40808 var _results$renderingCon, _results$renderingCon2, _results$renderingCon3; 40809 var results = _ref22.results, helper = _ref22.helper, instantSearchInstance = _ref22.instantSearchInstance; 40810 if (!sendEvent) { 40811 sendEvent = createSendEventForHits({ 40812 instantSearchInstance, 40813 getIndex: function getIndex() { 40814 return helper.getIndex(); 40815 }, 40816 widgetType: this.$$type 40817 }); 40818 } 40819 if (!bindEvent) { 40820 bindEvent = createBindEventForHits({ 40821 getIndex: function getIndex() { 40822 return helper.getIndex(); 40823 }, 40824 widgetType: this.$$type, 40825 instantSearchInstance 40826 }); 40827 } 40828 if (!results) { 40829 return { 40830 hits: [], 40831 items: [], 40832 results: void 0, 40833 banner: void 0, 40834 sendEvent, 40835 bindEvent, 40836 widgetParams 40837 }; 40838 } 40839 if (escapeHTML && results.hits.length > 0) { 40840 results.hits = escapeHits(results.hits); 40841 } 40842 var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage); 40843 var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID); 40844 var items = transformItems(hitsWithAbsolutePositionAndQueryID, { 40845 results 40846 }); 40847 var banner = (_results$renderingCon = results.renderingContent) === null || _results$renderingCon === void 0 ? void 0 : (_results$renderingCon2 = _results$renderingCon.widgets) === null || _results$renderingCon2 === void 0 ? void 0 : (_results$renderingCon3 = _results$renderingCon2.banners) === null || _results$renderingCon3 === void 0 ? void 0 : _results$renderingCon3[0]; 40848 return { 40849 hits: items, 40850 items, 40851 results, 40852 banner, 40853 sendEvent, 40854 bindEvent, 40855 widgetParams 40856 }; 40857 }, 40858 dispose: function dispose(_ref3) { 40859 var state = _ref3.state; 40860 unmountFn(); 40861 if (!escapeHTML) { 40862 return state; 40863 } 40864 return state.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key2) { 40865 return _objectSpread$d(_objectSpread$d({}, acc), {}, _defineProperty$g({}, key2, void 0)); 40866 }, {})); 40867 }, 40868 getWidgetSearchParameters: function getWidgetSearchParameters(state, _uiState) { 40869 if (!escapeHTML) { 40870 return state; 40871 } 40872 return state.setQueryParameters(TAG_PLACEHOLDER); 40873 } 40874 }; 40875 }; 40876}; 40877function _typeof$f(obj) { 40878 "@babel/helpers - typeof"; 40879 return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 40880 return typeof obj2; 40881 } : function(obj2) { 40882 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40883 }, _typeof$f(obj); 40884} 40885function ownKeys$c(object, enumerableOnly) { 40886 var keys = Object.keys(object); 40887 if (Object.getOwnPropertySymbols) { 40888 var symbols = Object.getOwnPropertySymbols(object); 40889 enumerableOnly && (symbols = symbols.filter(function(sym) { 40890 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40891 })), keys.push.apply(keys, symbols); 40892 } 40893 return keys; 40894} 40895function _objectSpread$c(target) { 40896 for (var i2 = 1; i2 < arguments.length; i2++) { 40897 var source = null != arguments[i2] ? arguments[i2] : {}; 40898 i2 % 2 ? ownKeys$c(Object(source), true).forEach(function(key2) { 40899 _defineProperty$f(target, key2, source[key2]); 40900 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEac
40900h(function(key2) { 40901 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 40902 }); 40903 } 40904 return target; 40905} 40906function _defineProperty$f(obj, key2, value) { 40907 key2 = _toPropertyKey$f(key2); 40908 if (key2 in obj) { 40909 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 40910 } else { 40911 obj[key2] = value; 40912 } 40913 return obj; 40914} 40915function _toPropertyKey$f(arg) { 40916 var key2 = _toPrimitive$f(arg, "string"); 40917 return _typeof$f(key2) === "symbol" ? key2 : String(key2); 40918} 40919function _toPrimitive$f(input, hint) { 40920 if (_typeof$f(input) !== "object" || input === null) return input; 40921 var prim = input[Symbol.toPrimitive]; 40922 if (prim !== void 0) { 40923 var res = prim.call(input, hint || "default"); 40924 if (_typeof$f(res) !== "object") return res; 40925 throw new TypeError("@@toPrimitive must return a primitive value."); 40926 } 40927 return (hint === "string" ? String : Number)(input); 40928} 40929var getSelectedHits = function getSelectedHits2(hits3, selectedObjectIDs) { 40930 return selectedObjectIDs.map(function(objectID) { 40931 var hit = find$6(hits3, function(h2) { 40932 return h2.objectID === objectID; 40933 }); 40934 if (typeof hit === "undefined") { 40935 throw new Error('Could not find objectID "'.concat(objectID, '" passed to `clickedObjectIDsAfterSearch` in the returned hits. This is necessary to infer the absolute position and the query ID.')); 40936 } 40937 return hit; 40938 }); 40939}; 40940var getQueryID = function getQueryID2(selectedHits) { 40941 var queryIDs = uniq(selectedHits.map(function(hit) { 40942 return hit.__queryID; 40943 })); 40944 if (queryIDs.length > 1) { 40945 throw new Error("Insights currently allows a single `queryID`. The `objectIDs` provided map to multiple `queryID`s."); 40946 } 40947 var queryID = queryIDs[0]; 40948 if (typeof queryID !== "string") { 40949 throw new Error("Could not infer `queryID`. Ensure InstantSearch `clickAnalytics: true` was added with the Configure widget.\n\nSee: https://alg.li/lNiZZ7"); 40950 } 40951 return queryID; 40952}; 40953var getPositions = function getPositions2(selectedHits) { 40954 return selectedHits.map(function(hit) { 40955 return hit.__position; 40956 }); 40957}; 40958var inferPayload = function inferPayload2(_ref) { 40959 var method = _ref.method, results = _ref.results, hits3 = _ref.hits, objectIDs = _ref.objectIDs; 40960 var index3 = results.index; 40961 var selectedHits = getSelectedHits(hits3, objectIDs); 40962 var queryID = getQueryID(selectedHits); 40963 switch (method) { 40964 case "clickedObjectIDsAfterSearch": { 40965 var positions = getPositions(selectedHits); 40966 return { 40967 index: index3, 40968 queryID, 40969 objectIDs, 40970 positions 40971 }; 40972 } 40973 case "convertedObjectIDsAfterSearch": 40974 return { 40975 index: index3, 40976 queryID, 40977 objectIDs 40978 }; 40979 default: 40980 throw new Error('Unsupported method passed to insights: "'.concat(method, '".')); 40981 } 40982}; 40983var wrapInsightsClient = function wrapInsightsClient2(aa, results, hits3) { 40984 return function(method) { 40985 for (var _len = arguments.length, payloads = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 40986 payloads[_key - 1] = arguments[_key]; 40987 } 40988 var payload = payloads[0]; 40989 if (!aa) { 40990 var withInstantSearchUsage = createDocumentationMessageGenerator({ 40991 name: "instantsearch" 40992 }); 40993 throw new Error(withInstantSearchUsage("The `insightsClient` option has not been provided to `instantsearch`.")); 40994 } 40995 if (!Array.isArray(payload.objectIDs)) { 40996 throw new TypeError("Expected `objectIDs` to be an array."); 40997 } 40998 var inferredPayload = inferPayload({ 40999 method, 41000 results, 41001 hits: hits3, 41002 objectIDs: payload.objectIDs 41003 }); 41004 aa(method, _objectSpread$c(_objectSpread$c({}, inferredPayload), payload)); 41005 }; 41006}; 41007function withInsights(connector) { 41008 return function(renderFn, unmountFn) { 41009 return connector(function(renderOptions, isFirstRender) { 41010 var results = renderOptions.results, hits3 = renderOptions.hits, instantSearchInstance = renderOptions.instantSearchInstance; 41011 if (results && hits3 && instantSearchInstance) { 41012 var insights2 = wrapInsightsClient(instantSearchInstance.insightsClient, results, hits3); 41013 return renderFn(_objectSpread$c(_objectSpread$c({}, renderOptions), {}, { 41014 insights: insights2 41015 }), isFirstRender); 41016 } 41017 return renderFn(renderOptions, isFirstRender); 41018 }, unmountFn); 41019 }; 41020} 41021var createInsightsEventHandler = function createInsightsEventHandler2(_ref) { 41022 var insights2 = _ref.insights, sendEvent = _ref.sendEvent; 41023 return function(event) { 41024 var insightsThroughSendEvent = findInsightsTarget(event.target, event.currentTarget, function(element) { 41025 return element.hasAttribute("data-insights-event"); 41026 }); 41027 if (insightsThroughSendEvent) { 41028 var payload = parseInsightsEvent(insightsThroughSendEvent);
41029 payload.forEach(function(single) { 41030 return sendEvent(single); 41031 }); 41032 } 41033 var insightsThroughFunction = findInsightsTarget(event.target, event.currentTarget, function(element) { 41034 return element.hasAttribute("data-insights-method") && element.hasAttribute("data-insights-payload"); 41035 }); 41036 if (insightsThroughFunction) { 41037 var _readDataAttributes = readDataAttributes(insightsThroughFunction), method = _readDataAttributes.method, _payload = _readDataAttributes.payload; 41038 insights2(method, _payload); 41039 } 41040 }; 41041}; 41042function findInsightsTarget(startElement, endElement, validator) { 41043 var element = startElement; 41044 while (element && !validator(element)) { 41045 if (element === endElement) { 41046 return null; 41047 } 41048 element = element.parentElement; 41049 } 41050 return element; 41051} 41052function parseInsightsEvent(element) { 41053 var serializedPayload = element.getAttribute("data-insights-event"); 41054 if (typeof serializedPayload !== "string") { 41055 throw new Error("The insights middleware expects `data-insights-event` to be a base64-encoded JSON string."); 41056 } 41057 try { 41058 return deserializePayload(serializedPayload); 41059 } catch (error2) { 41060 throw new Error("The insights middleware was unable to parse `data-insights-event`."); 41061 } 41062} 41063var defaultTemplates$2 = { 41064 empty: function empty() { 41065 return "No results"; 41066 }, 41067 item: function item(data) { 41068 return JSON.stringify(omit$4(data, ["__hitIndex"]), null, 2); 41069 } 41070}; 41071function _typeof$e(obj) { 41072 "@babel/helpers - typeof"; 41073 return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 41074 return typeof obj2; 41075 } : function(obj2) { 41076 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41077 }, _typeof$e(obj); 41078} 41079var _excluded$1 = ["hit", "index"]; 41080function ownKeys$b(object, enumerableOnly) { 41081 var keys = Object.keys(object); 41082 if (Object.getOwnPropertySymbols) { 41083 var symbols = Object.getOwnPropertySymbols(object); 41084 enumerableOnly && (symbols = symbols.filter(function(sym) { 41085 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41086 })), keys.push.apply(keys, symbols); 41087 } 41088 return keys; 41089} 41090function _objectSpread$b(target) { 41091 for (var i2 = 1; i2 < arguments.length; i2++) { 41092 var source = null != arguments[i2] ? arguments[i2] : {}; 41093 i2 % 2 ? ownKeys$b(Object(source), true).forEach(function(key2) { 41094 _defineProperty$e(target, key2, source[key2]); 41095 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function(key2) { 41096 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 41097 }); 41098 } 41099 return target; 41100} 41101function _defineProperty$e(obj, key2, value) { 41102 key2 = _toPropertyKey$e(key2); 41103 if (key2 in obj) { 41104 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 41105 } else { 41106 obj[key2] = value; 41107 } 41108 return obj; 41109} 41110function _toPropertyKey$e(arg) { 41111 var key2 = _toPrimitive$e(arg, "string"); 41112 return _typeof$e(key2) === "symbol" ? key2 : String(key2); 41113} 41114function _toPrimitive$e(input, hint) { 41115 if (_typeof$e(input) !== "object" || input === null) return input; 41116 var prim = input[Symbol.toPrimitive]; 41117 if (prim !== void 0) { 41118 var res = prim.call(input, hint || "default"); 41119 if (_typeof$e(res) !== "object") return res; 41120 throw new TypeError("@@toPrimitive must return a primitive value."); 41121 } 41122 return (hint === "string" ? String : Number)(input); 41123} 41124function _objectWithoutProperties$1(source, excluded) { 41125 if (source == null) return {}; 41126 var target = _objectWithoutPropertiesLoose$1(source, excluded); 41127 var key2, i2; 41128 if (Object.getOwnPropertySymbols) { 41129 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 41130 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 41131 key2 = sourceSymbolKeys[i2]; 41132 if (excluded.indexOf(key2) >= 0) continue; 41133 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 41134 target[key2] = source[key2]; 41135 } 41136 } 41137 return target; 41138} 41139function _objectWithoutPropertiesLoose$1(source, excluded) { 41140 if (source == null) return {}; 41141 var target = {}; 41142 var sourceKeys = Object.keys(source); 41143 var key2, i2; 41144 for (i2 = 0; i2 < sourceKeys.length; i2++) { 41145 key2 = sourceKeys[i2]; 41146 if (excluded.indexOf(key2) >= 0) continue; 41147 target[key2] = source[key2]; 41148 } 41149 return target; 41150} 41151function _objectDestructuringEmpty(obj) { 41152 if (obj == null) throw new TypeError("Cannot destructure " + obj); 41153} 41154function _extends$2() { 41155 _extends$2 = Object.assign ? Object.assign.bind() : function(target) { 41156 for (var i2 = 1; i2 < arguments.length; i2++) { 41157 var source = arguments[i2]; 41158 for (var key2 in source) { 41159 if (Object.prototype.hasOwnProperty.call(source, key2)) { 41160 target[key2] = source[key2]; 41161 } 41162 } 41163 } 41164 return target; 41165 }; 41166 return _extends$2.apply(this, arguments); 41167} 41168var withUsage$a = createDocumentationMessageGenerator({ 41169 name: "hits" 41170}); 41171var Hits = createHitsComponent({ 41172 createElement: _$1, 41173 Fragment: b$3 41174}); 41175var renderer$5 = function renderer2(_ref) {
41176 var renderState = _ref.renderState, cssClasses = _ref.cssClasses, containerNode = _ref.containerNode, templates = _ref.templates; 41177 return function(_ref22, isFirstRendering) { 41178 var items = _ref22.items, results = _ref22.results, instantSearchInstance = _ref22.instantSearchInstance, insights2 = _ref22.insights, bindEvent = _ref22.bindEvent, sendEvent = _ref22.sendEvent, banner = _ref22.banner; 41179 if (isFirstRendering) { 41180 renderState.templateProps = prepareTemplateProps({ 41181 defaultTemplates: defaultTemplates$2, 41182 templatesConfig: instantSearchInstance.templatesConfig, 41183 templates 41184 }); 41185 return; 41186 } 41187 var handleInsightsClick = createInsightsEventHandler({ 41188 insights: insights2, 41189 sendEvent 41190 }); 41191 var emptyComponent = function emptyComponent2(_ref3) { 41192 var rootProps = _extends$2({}, (_objectDestructuringEmpty(_ref3), _ref3)); 41193 return _$1(Template, _extends$2({}, renderState.templateProps, { 41194 rootProps, 41195 templateKey: "empty", 41196 data: results, 41197 rootTagName: "fragment" 41198 })); 41199 }; 41200 var itemComponent = function itemComponent2(_ref42) { 41201 var hit = _ref42.hit, index3 = _ref42.index, rootProps = _objectWithoutProperties$1(_ref42, _excluded$1); 41202 return _$1(Template, _extends$2({}, renderState.templateProps, { 41203 templateKey: "item", 41204 rootTagName: "li", 41205 rootProps: _objectSpread$b(_objectSpread$b({}, rootProps), {}, { 41206 onClick: function onClick(event) { 41207 handleInsightsClick(event); 41208 rootProps.onClick(); 41209 },
41210 onAuxClick: function onAuxClick(event) { 41211 handleInsightsClick(event); 41212 rootProps.onAuxClick(); 41213 } 41214 }), 41215 data: _objectSpread$b(_objectSpread$b({}, hit), {}, { 41216 get __hitIndex() { 41217 return index3; 41218 } 41219 }), 41220 bindEvent, 41221 sendEvent 41222 })); 41223 }; 41224 var bannerComponent = function bannerComponent2(props) { 41225 return _$1(Template, _extends$2({}, renderState.templateProps, { 41226 templateKey: "banner", 41227 data: props, 41228 rootTagName: "fragment" 41229 })); 41230 }; 41231 B$1(_$1(Hits, { 41232 hits: items, 41233 itemComponent, 41234 sendEvent, 41235 classNames: cssClasses, 41236 emptyComponent, 41237 banner, 41238 bannerComponent: templates.banner ? bannerComponent : void 0 41239 }), containerNode); 41240 }; 41241}; 41242const hits = function hits2(widgetParams) { 41243 var _ref5 = widgetParams || {}, container = _ref5.container, escapeHTML = _ref5.escapeHTML, transformItems = _ref5.transformItems, _ref5$templates = _ref5.templates, templates = _ref5$templates === void 0 ? {} : _ref5$templates, _ref5$cssClasses = _ref5.cssClasses, cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses; 41244 if (!container) { 41245 throw new Error(withUsage$a("The `container` option is required.")); 41246 } 41247 var containerNode = getContainerNode(container); 41248 var specializedRenderer = renderer$5({ 41249 containerNode, 41250 cssClasses, 41251 renderState: {}, 41252 templates 41253 }); 41254 var makeWidget = withInsights(connectHits)(specializedRenderer, function() { 41255 return B$1(null, containerNode); 41256 }); 41257 return _objectSpread$b(_objectSpread$b({}, makeWidget({ 41258 escapeHTML, 41259 transformItems 41260 })), {}, { 41261 $$widgetType: "ais.hits" 41262 }); 41263}; 41264function Selector(_ref) { 41265 var currentValue = _ref.currentValue, options = _ref.options, cssClasse
41265s = _ref.cssClasses, setValue = _ref.setValue, ariaLabel = _ref.ariaLabel; 41266 return _$1("select", { 41267 className: cx(cssClasses.select), 41268 onChange: function onChange(event) { 41269 return setValue(event.target.value); 41270 }, 41271 value: "".concat(currentValue), 41272 "aria-label": ariaLabel 41273 }, options.map(function(option) { 41274 return _$1("option", { 41275 className: cx(cssClasses.option), 41276 key: option.label + option.value, 41277 value: "".concat(option.value) 41278 }, option.label); 41279 })); 41280} 41281function Pagination(props) { 41282 function createClickHandler(pageNumber) { 41283 return function(event) { 41284 if (isSpecialClick(event)) { 41285 return; 41286 } 41287 event.preventDefault(); 41288 props.setCurrentPage(pageNumber); 41289 }; 41290 } 41291 return _$1("div", { 41292 className: cx(props.cssClasses.root, props.nbPages <= 1 && props.cssClasses.noRefinementRoot) 41293 }, _$1("ul", { 41294 className: props.cssClasses.list 41295 }, props.showFirst && _$1(PaginationLink, { 41296 ariaLabel: "First Page", 41297 className: props.cssClasses.firstPageItem, 41298 isDisabled: props.isFirstPage, 41299 templates: props.templates, 41300 templateKey: "first", 41301 pageNumber: 0, 41302 createURL: props.createURL, 41303 cssClasses: props.cssClasses, 41304 createClickHandler 41305 }), props.showPrevious && _$1(PaginationLink, { 41306 ariaLabel: "Previous Page", 41307 className: props.cssClasses.previousPageItem, 41308 isDisabled: props.isFirstPage, 41309 templates: props.templates, 41310 templateKey: "previous", 41311 pageNumber: props.currentPage - 1, 41312 createURL: props.createURL, 41313 cssClasses: props.cssClasses, 41314 createClickHandler 41315 }), props.pages.map(function(pageNumber) { 41316 return _$1(PaginationLink, { 41317 key: pageNumber, 41318 ariaLabel: "Page ".concat(pageNumber + 1), 41319 className: props.cssClasses.pageItem, 41320 isSelected: pageNumber === props.currentPage, 41321 templates: props.templates, 41322 templateKey: "page", 41323 pageNumber, 41324 createURL: props.createURL, 41325 cssClasses: props.cssClasses, 41326 createClickHandler 41327 }); 41328 }), props.showNext && _$1(PaginationLink, { 41329 ariaLabel: "Next Page", 41330 className: props.cssClasses.nextPageItem, 41331 isDisabled: props.isLastPage, 41332 templates: props.templates, 41333 templateKey: "next", 41334 pageNumber: props.currentPage + 1, 41335 createURL: props.createURL, 41336 cssClasses: props.cssClasses, 41337 createClickHandler 41338 }), props.showLast && _$1(PaginationLink, { 41339 ariaLabel: "Last Page, Page ".concat(props.nbPages), 41340 className: props.cssClasses.lastPageItem, 41341 isDisabled: props.isLastPage, 41342 templates: props.templates, 41343 templateKey: "last", 41344 pageNumber: props.nbPages - 1, 41345 createURL: props.createURL, 41346 cssClasses: props.cssClasses, 41347 createClickHandler 41348 }))); 41349} 41350function PaginationLink(_ref) { 41351 var templates = _ref.templates, templateKey = _ref.templateKey, ariaLabel = _ref.ariaLabel, pageNumber = _ref.pageNumber, className = _ref.className, _ref$isDisabled = _ref.isDisabled, isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled, _ref$isSelected = _ref.isSelected, isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected, cssClasse
41351s = _ref.cssClasses, createURL = _ref.createURL, createClickHandler = _ref.createClickHandler; 41352 return _$1("li", { 41353 className: cx(cssClasses.item, isDisabled && cssClasses.disabledItem, className, isSelected && cssClasses.selectedItem) 41354 }, isDisabled ? _$1(Template, { 41355 rootTagName: "span", 41356 rootProps: { 41357 className: cssClasses.link, 41358 "aria-label": ariaLabel 41359 }, 41360 templateKey, 41361 templates, 41362 data: { 41363 page: pageNumber + 1 41364 } 41365 }) : _$1(Template, { 41366 rootTagName: "a", 41367 rootProps: { 41368 className: cssClasses.link, 41369 "aria-label": ariaLabel, 41370 href: createURL(pageNumber), 41371 onClick: createClickHandler(pageNumber) 41372 }, 41373 templateKey, 41374 templates, 41375 data: { 41376 page: pageNumber + 1 41377 } 41378 })); 41379} 41380function _typeof$d(obj) { 41381 "@babel/helpers - typeof"; 41382 return _typeof$d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 41383 return typeof obj2; 41384 } : function(obj2) { 41385 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41386 }, _typeof$d(obj); 41387} 41388function _classCallCheck$2(instance, Constructor) { 41389 if (!(instance instanceof Constructor)) { 41390 throw new TypeError("Cannot call a class as a function"); 41391 } 41392} 41393function _defineProperties$2(target, props) { 41394 for (var i2 = 0; i2 < props.length; i2++) { 41395 var descriptor = props[i2]; 41396 descriptor.enumerable = descriptor.enumerable || false; 41397 descriptor.configurable = true; 41398 if ("value" in descriptor) descriptor.writable = true; 41399 Object.defineProperty(target, _toPropertyKey$d(descriptor.key), descriptor); 41400 } 41401} 41402function _createClass$3(Constructor, protoProps, staticProps) { 41403 if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); 41404 Object.defineProperty(Constructor, "prototype", { writable: false }); 41405 return Constructor; 41406} 41407function _defineProperty$d(obj, key2, value) { 41408 key2 = _toPropertyKey$d(key2); 41409 if (key2 in obj) { 41410 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 41411 } else { 41412 obj[key2] = value; 41413 } 41414 return obj; 41415} 41416function _toPropertyKey$d(arg) { 41417 var key2 = _toPrimitive$d(arg, "string"); 41418 return _typeof$d(key2) === "symbol" ? key2 : String(key2); 41419} 41420function _toPrimitive$d(input, hint) { 41421 if (_typeof$d(input) !== "object" || input === null) return input; 41422 var prim = input[Symbol.toPrimitive]; 41423 if (prim !== void 0) { 41424 var res = prim.call(input, hint || "default"); 41425 if (_typeof$d(res) !== "object") return res; 41426 throw new TypeError("@@toPrimitive must return a primitive value."); 41427 } 41428 return (hint === "string" ? String : Number)(input); 41429} 41430var Paginator = /* @__PURE__ */ function() { 41431 function Paginator2(params) { 41432 _classCallCheck$2(this, Paginator2); 41433 _defineProperty$d(this, "currentPage", void 0); 41434 _defineProperty$d(this, "total", void 0); 41435 _defineProperty$d(this, "padding", void 0); 41436 this.currentPage = params.currentPage; 41437 this.total = params.total; 41438 this.padding = params.padding; 41439 } 41440 _createClass$3(Paginator2, [{ 41441 key: "pages", 41442 value: function pages() { 41443 var total = this.total, currentPage = this.currentPage, padding = this.padding; 41444 if (total === 0) return [0]; 41445 var totalDisplayedPages = this.nbPagesDisplayed(padding, total); 41446 if (totalDisplayedPages === total) { 41447 return range$1({ 41448 end: total 41449 }); 41450 } 41451 var paddingLeft = this.calculatePaddingLeft(currentPage, padding, total, totalDisplayedPages); 41452 var paddingRight = totalDisplayedPages - paddingLeft; 41453 var first2 = currentPage - paddingLeft; 41454 var last2 = currentPage + paddingRight; 41455 return range$1({ 41456 start: first2, 41457 end: last2 41458 }); 41459 } 41460 }, { 41461 key: "nbPagesDisplayed", 41462 value: function nbPagesDisplayed(padding, total) { 41463 return Math.min(2 * padding + 1, total); 41464 } 41465 }, { 41466 key: "calculatePaddingLeft", 41467 value: function calculatePaddingLeft(current, padding, total, totalDisplayedPages) { 41468 if (current <= padding) { 41469 return current; 41470 } 41471 if (current >= total - padding) { 41472 return totalDisplayedPages - (total - current); 41473 } 41474 return padding; 41475 } 41476 }, { 41477 key: "isLastPage", 41478 value: function isLastPage() { 41479 return this.currentPage >= this.total - 1; 41480 } 41481 }, { 41482 key: "isFirstPage", 41483 value: function isFirstPage() { 41484 return this.currentPage <= 0; 41485 } 41486 }]); 41487 return Paginator2; 41488}(); 41489function _typeof$c(obj) { 41490 "@babel/helpers - typeof"; 41491 return _typeof$c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 41492 return typeof obj2; 41493 } : function(obj2) { 41494 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41495 }, _typeof$c(obj); 41496} 41497function ownKeys$a(object, enumerableOnly) { 41498 var keys = Object.keys(object); 41499 if (Object.getOwnPropertySymbols) { 41500 var symbols = Object.getOwnPropertySymbols(object); 41501 enumerableOnly && (symbols = symbols.filter(function(sym) { 41502 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41503 })), keys.push.apply(keys, symbols); 41504 } 41505 return keys; 41506} 41507function _objectSpread$a(target) { 41508 for (var i2 = 1; i2 < arguments.length; i2++) { 41509 var source = null != arguments[i2] ? arguments[i2] : {}; 41510 i2 % 2 ? ownKeys$a(Object(source), true).forEach(function(key2) { 41511 _defineProperty$c(target, key2, source[key2]); 41512 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEac
41512h(function(key2) { 41513 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 41514 }); 41515 } 41516 return target; 41517} 41518function _defineProperty$c(obj, key2, value) { 41519 key2 = _toPropertyKey$c(key2); 41520 if (key2 in obj) { 41521 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 41522 } else { 41523 obj[key2] = value; 41524 } 41525 return obj; 41526} 41527function _toPropertyKey$c(arg) { 41528 var key2 = _toPrimitive$c(arg, "string"); 41529 return _typeof$c(key2) === "symbol" ? key2 : String(key2); 41530} 41531function _toPrimitive$c(input, hint) { 41532 if (_typeof$c(input) !== "object" || input === null) return input; 41533 var prim = input[Symbol.toPrimitive]; 41534 if (prim !== void 0) { 41535 var res = prim.call(input, hint || "default"); 41536 if (_typeof$c(res) !== "object") return res; 41537 throw new TypeError("@@toPrimitive must return a primitive value."); 41538 } 41539 return (hint === "string" ? String : Number)(input); 41540} 41541var withUsage$9 = createDocumentationMessageGenerator({ 41542 name: "pagination", 41543 connector: true 41544}); 41545var connectPagination = function connectPagination2(renderFn) { 41546 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 41547 checkRendering(renderFn, withUsage$9()); 41548 return function(widgetParams) { 41549 var _ref = widgetParams || {}, totalPages = _ref.totalPages, _ref$padding = _ref.padding, padding = _ref$padding === void 0 ? 3 : _ref$padding; 41550 var pager = new Paginator({ 41551 currentPage: 0, 41552 total: 0, 41553 padding 41554 }); 41555 var connectorState = {}; 41556 function getMaxPage(_ref22) { 41557 var nbPages = _ref22.nbPages; 41558 return totalPages !== void 0 ? Math.min(totalPages, nbPages) : nbPages; 41559 } 41560 return { 41561 $$type: "ais.pagination", 41562 init: function init7(initOptions) { 41563 var instantSearchInstance = initOptions.instantSearchInstance; 41564 renderFn(_objectSpread$a(_objectSpread$a({}, this.getWidgetRenderState(initOptions)), {}, { 41565 instantSearchInstance 41566 }), true); 41567 }, 41568 render: function render6(renderOptions) { 41569 var instantSearchInstance = renderOptions.instantSearchInstance; 41570 renderFn(_objectSpread$a(_objectSpread$a({}, this.getWidgetRenderState(renderOptions)), {}, { 41571 instantSearchInstance 41572 }), false); 41573 }, 41574 dispose: function dispose(_ref3) { 41575 var state = _ref3.state; 41576 unmountFn(); 41577 return state.setQueryParameter("page", void 0); 41578 }, 41579 getWidgetUiState: function getWidgetUiState(uiState, _ref42) { 41580 var searchParameters = _ref42.searchParameters; 41581 var page2 = searchParameters.page || 0; 41582 if (!page2) { 41583 return uiState; 41584 } 41585 return _objectSpread$a(_objectSpread$a({}, uiState), {}, { 41586 page: page2 + 1 41587 }); 41588 }, 41589 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) { 41590 var uiState = _ref5.uiState; 41591 var page2 = uiState.page ? uiState.page - 1 : 0; 41592 return searchParameters.setQueryParameter("page", page2); 41593 }, 41594 getWidgetRenderState: function getWidgetRenderState(_ref62) { 41595 var results = _ref62.results, helper = _ref62.helper, state = _ref62.state, createURL = _ref62.createURL; 41596 if (!connectorState.refine) { 41597 connectorState.refine = function(page3) { 41598 helper.setPage(page3); 41599 helper.search(); 41600 }; 41601 } 41602 if (!connectorState.createURL) { 41603 connectorState.createURL = function(page3) { 41604 return createURL(function(uiState) { 41605 return _objectSpread$a(_objectSpread$a({}, uiState), {}, { 41606 page: page3 + 1 41607 }); 41608 }); 41609 }; 41610 } 41611 var page2 = state.page || 0; 41612 var nbPages = getMaxPage(results || { 41613 nbPages: 0 41614 }); 41615 pager.currentPage = page2; 41616 pager.total = nbPages; 41617 return { 41618 createURL: connectorState.createURL, 41619 refine: connectorState.refine, 41620 canRefine: nbPages > 1, 41621 currentRefinement: page2, 41622 nbHits: (results === null || results === void 0 ? void 0 : results.nbHits) || 0, 41623 nbPages, 41624 pages: results ? pager.pages() : [], 41625 isFirstPage: pager.isFirstPage(), 41626 isLastPage: pager.isLastPage(), 41627 widgetParams 41628 }; 41629 }, 41630 getRenderState: function getRenderState(renderState, renderOptions) { 41631 return _objectSpread$a(_objectSpread$a({}, renderState), {}, { 41632 pagination: this.getWidgetRenderState(renderOptions) 41633 }); 41634 } 41635 }; 41636 }; 41637}; 41638function _typeof$b(obj) { 41639 "@babel/helpers - typeof"; 41640 return _typeof$b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 41641 return typeof obj2; 41642 } : function(obj2) { 41643 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41644 }, _typeof$b(obj); 41645} 41646function ownKeys$9(object, enumerableOnly) { 41647 var keys = Object.keys(object); 41648 if (Object.getOwnPropertySymbols) { 41649 var symbols = Object.getOwnPropertySymbols(object); 41650 enumerableOnly && (symbols = symbols.filter(function(sym) { 41651 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41652 })), keys.push.apply(keys, symbols); 41653 } 41654 return keys; 41655} 41656function _objectSpread$9(target) { 41657 for (var i2 = 1; i2 < arguments.length; i2++) { 41658 var source = null != arguments[i2] ? arguments[i2] : {}; 41659 i2 % 2 ? ownKeys$9(Object(source), true).forEach(function(key2) { 41660 _defineProperty$b(target, key2, source[key2]); 41661 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEac
41661h(function(key2) { 41662 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 41663 }); 41664 } 41665 return target; 41666} 41667function _defineProperty$b(obj, key2, value) { 41668 key2 = _toPropertyKey$b(key2); 41669 if (key2 in obj) { 41670 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 41671 } else { 41672 obj[key2] = value; 41673 } 41674 return obj; 41675} 41676function _toPropertyKey$b(arg) { 41677 var key2 = _toPrimitive$b(arg, "string"); 41678 return _typeof$b(key2) === "symbol" ? key2 : String(key2); 41679} 41680function _toPrimitive$b(input, hint) { 41681 if (_typeof$b(input) !== "object" || input === null) return input; 41682 var prim = input[Symbol.toPrimitive]; 41683 if (prim !== void 0) { 41684 var res = prim.call(input, hint || "default"); 41685 if (_typeof$b(res) !== "object") return res; 41686 throw new TypeError("@@toPrimitive must return a primitive value."); 41687 } 41688 return (hint === "string" ? String : Number)(input); 41689} 41690var suit$4 = component("Pagination"); 41691var withUsage$8 = createDocumentationMessageGenerator({ 41692 name: "pagination" 41693}); 41694var defaultTemplates$1 = { 41695 previous: function previous() { 41696 return "â¹"; 41697 }, 41698 next: function next() { 41699 return "âº"; 41700 }, 41701 page: function page(_ref) { 41702 var _page = _ref.page; 41703 return "".concat(_page); 41704 }, 41705 first: function first() { 41706 return "«"; 41707 }, 41708 last: function last() { 41709 return "»"; 41710 } 41711}; 41712var renderer$4 = function renderer3(_ref22) { 41713 var containerNode = _ref22.containerNode, cssClasses = _ref22.cssClasses, templates = _ref22.templates, showFirst = _ref22.showFirst, showLast = _ref22.showLast, showPrevious = _ref22.showPrevious, showNext = _ref22.showNext, scrollToNode = _ref22.scrollToNode; 41714 return function(_ref3, isFirstRendering) { 41715 var createURL = _ref3.createURL, currentRefinement = _ref3.currentRefinement, nbPages = _ref3.nbPages, pages = _ref3.pages, isFirstPage = _ref3.isFirstPage, isLastPage = _ref3.isLastPage, refine = _ref3.refine; 41716 if (isFirstRendering) return; 41717 var setCurrentPage2 = function setCurrentPage3(pageNumber) { 41718 refine(pageNumber); 41719 if (scrollToNode !== false) { 41720 scrollToNode.scrollIntoView(); 41721 } 41722 }; 41723 B$1(_$1(Pagination, { 41724 createURL, 41725 cssClasses, 41726 currentPage: currentRefinement, 41727 templates, 41728 nbPages, 41729 pages, 41730 isFirstPage, 41731 isLastPage, 41732 setCurrentPage: setCurrentPage2, 41733 showFirst, 41734 showLast, 41735 showPrevious, 41736 showNext 41737 }), containerNode); 41738 }; 41739}; 41740var pagination = function pagination2(widgetParams) { 41741 var _ref42 = widgetParams || {}, container = _ref42.container, _ref4$templates = _ref42.templates, userTemplates = _ref4$templates === void 0 ? {} : _ref4$templates, _ref4$cssClasses = _ref42.cssClasses, userCssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses, totalPages = _ref42.totalPages, padding = _ref42.padding, _ref4$showFirst = _ref42.showFirst, showFirst = _ref4$showFirst === void 0 ? true : _ref4$showFirst, _ref4$showLast = _ref42.showLast, showLast = _ref4$showLast === void 0 ? true : _ref4$showLast, _ref4$showPrevious = _ref42.showPrevious, showPrevious = _ref4$showPrevious === void 0 ? true : _ref4$showPrevious, _ref4$showNext = _ref42.showNext, showNext = _ref4$showNext === void 0 ? true : _ref4$showNext, _ref4$scrollTo = _ref42.scrollTo, userScrollTo = _ref4$scrollTo === void 0 ? "body" : _ref4$scrollTo; 41742 if (!container) { 41743 throw new Error(withUsage$8("The `container` option is required.")); 41744 } 41745 var containerNode = getContainerNode(container); 41746 var scrollTo = userScrollTo === true ? "body" : userScrollTo; 41747 var scrollToNode = scrollTo !== false ? getContainerNode(scrollTo) : false;
41748 var cssClasses = { 41749 root: cx(suit$4(), userCssClasses.root), 41750 noRefinementRoot: cx(suit$4({ 41751 modifierName: "noRefinement" 41752 }), userCssClasses.noRefinementRoot), 41753 list: cx(suit$4({ 41754 descendantName: "list" 41755 }), userCssClasses.list), 41756 item: cx(suit$4({ 41757 descendantName: "item" 41758 }), userCssClasses.item), 41759 firstPageItem: cx(suit$4({ 41760 descendantName: "item", 41761 modifierName: "firstPage" 41762 }), userCssClasses.firstPageItem), 41763 lastPageItem: cx(suit$4({ 41764 descendantName: "item", 41765 modifierName: "lastPage" 41766 }), userCssClasses.lastPageItem), 41767 previousPageItem: cx(suit$4({ 41768 descendantName: "item", 41769 modifierName: "previousPage" 41770 }), userCssClasses.previousPageItem), 41771 nextPageItem: cx(suit$4({ 41772 descendantName: "item", 41773 modifierName: "nextPage" 41774 }), userCssClasses.nextPageItem), 41775 pageItem: cx(suit$4({ 41776 descendantName: "item", 41777 modifierName: "page" 41778 }), userCssClasses.pageItem), 41779 selectedItem: cx(suit$4({ 41780 descendantName: "item", 41781 modifierName: "selected" 41782 }), userCssClasses.selectedItem), 41783 disabledItem: cx(suit$4({ 41784 descendantName: "item", 41785 modifierName: "disabled" 41786 }), userCssClasses.disabledItem), 41787 link: cx(suit$4({ 41788 descendantName: "link" 41789 }), userCssClasses.link) 41790 }; 41791 var templates = _objectSpread$9(_objectSpread$9({}, defaultTemplates$1), userTemplates); 41792 var specializedRenderer = renderer$4({ 41793 containerNode, 41794 cssClasses, 41795 templates, 41796 showFirst, 41797 showLast, 41798 showPrevious, 41799 showNext, 41800 scrollToNode 41801 }); 41802 var makeWidget = connectPagination(specializedRenderer, function() { 41803 return B$1(null, containerNode); 41804 }); 41805 return _objectSpread$9(_objectSpread$9({}, makeWidget({ 41806 totalPages, 41807 padding 41808 })), {}, { 41809 $$widgetType: "ais.pagination" 41810 }); 41811}; 41812function _typeof$a(obj) { 41813 "@babel/helpers - typeof"; 41814 return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 41815 return typeof obj2; 41816 } : function(obj2) { 41817 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41818 }, _typeof$a(obj); 41819} 41820function ownKeys$8(object, enumerableOnly) { 41821 var keys = Object.keys(object); 41822 if (Object.getOwnPropertySymbols) { 41823 var symbols = Object.getOwnPropertySymbols(object); 41824 enumerableOnly && (symbols = symbols.filter(function(sym) { 41825 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41826 })), keys.push.apply(keys, symbols); 41827 } 41828 return keys; 41829} 41830function _objectSpread$8(target) { 41831 for (var i2 = 1; i2 < arguments.length; i2++) { 41832 var source = null != arguments[i2] ? arguments[i2] : {}; 41833 i2 % 2 ? ownKeys$8(Object(source), true).forEach(function(key2) { 41834 _defineProperty$a(target, key2, source[key2]); 41835 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function(key2) { 41836 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 41837 }); 41838 } 41839 return target; 41840} 41841function _defineProperty$a(obj, key2, value) { 41842 key2 = _toPropertyKey$a(key2); 41843 if (key2 in obj) { 41844 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 41845 } else { 41846 obj[key2] = value; 41847 } 41848 return obj; 41849} 41850function _toPropertyKey$a(arg) { 41851 var key2 = _toPrimitive$a(arg, "string"); 41852 return _typeof$a(key2) === "symbol" ? key2 : String(key2); 41853} 41854function _toPrimitive$a(input, hint) { 41855 if (_typeof$a(input) !== "object" || input === null) return input; 41856 var prim = input[Symbol.toPrimitive]; 41857 if (prim !== void 0) { 41858 var res = prim.call(input, hint || "default"); 41859 if (_typeof$a(res) !== "object") return res; 41860 throw new TypeError("@@toPrimitive must return a primitive value."); 41861 } 41862 return (hint === "string" ? String : Number)(input); 41863} 41864function _slicedToArray$1(arr, i2) { 41865 return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i2) || _unsupportedIterableToArray$2(arr, i2) || _nonIterableRest$1(); 41866} 41867function _nonIterableRest$1() {
41868 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 41869} 41870function _unsupportedIterableToArray$2(o2, minLen) { 41871 if (!o2) return; 41872 if (typeof o2 === "string") return _arrayLikeToArray$2(o2, minLen); 41873 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 41874 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 41875 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 41876 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$2(o2, minLen); 41877} 41878function _arrayLikeToArray$2(arr, len2) { 41879 if (len2 == null || len2 > arr.length) len2 = arr.length; 41880 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 41881 return arr2; 41882} 41883function _iterableToArrayLimit$1(arr, i2) { 41884 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 41885 if (null != _i2) { 41886 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 41887 try { 41888 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) { 41889 if (Object(_i2) !== _i2) return; 41890 _n = false; 41891 } else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 41892 } catch (err) { 41893 _d = true, _e = err; 41894 } finally { 41895 try { 41896 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 41897 } finally { 41898 if (_d) throw _e; 41899 } 41900 } 41901 return _arr; 41902 } 41903} 41904function _arrayWithHoles$1(arr) { 41905 if (Array.isArray(arr)) return arr; 41906} 41907var withUsage$7 = createDocumentationMessageGenerator({ 41908 name: "range-input", 41909 connector: true 41910}, { 41911 name: "range-slider", 41912 connector: true 41913}); 41914var $$type = "ais.range"; 41915function toPrecision(_ref) { 41916 var min = _ref.min, max = _ref.max, precision = _ref.precision; 41917 var pow = Math.pow(10, precision); 41918 return { 41919 min: min ? Math.floor(min * pow) / pow : min, 41920 max: max ? Math.ceil(max * pow) / pow : max 41921 }; 41922} 41923var connectRange = function connectRange2(renderFn) { 41924 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 41925 checkRendering(renderFn, withUsage$7()); 41926 return function(widgetParams) { 41927 var _ref22 = widgetParams || {}, _ref2$attribute = _ref22.attribute, attribute = _ref2$attribute === void 0 ? "" : _ref2$attribute, minBound = _ref22.min, maxBound = _ref22.max, _ref2$precision = _ref22.precision, precision = _ref2$precision === void 0 ? 0 : _ref2$precision; 41928 if (!attribute) { 41929 throw new Error(withUsage$7("The `attribute` option is required.")); 41930 } 41931 if (isFiniteNumber(minBound) && isFiniteNumber(maxBound) && minBound > maxBound) { 41932 throw new Error(withUsage$7("The `max` option can't be lower than `min`.")); 41933 } 41934 var formatToNumber = function formatToNumber2(v2) { 41935 return Number(Number(v2).toFixed(precision)); 41936 }; 41937 var rangeFormatter = { 41938 from: function from(v2) { 41939 return v2.toLocaleString(); 41940 }, 41941 to: function to(v2) { 41942 return formatToNumber(v2).toLocaleString(); 41943 } 41944 }; 41945 var getRefinedState = function getRefinedState2(helper, currentRange, nextMin, nextMax) { 41946 var resolvedState = helper.state; 41947 var currentRangeMin = currentRange.min, currentRangeMax = currentRange.max; 41948 var _ref3 = resolvedState.getNumericRefinement(attribute, ">=") || [], _ref42 = _slicedToArray$1(_ref3, 1), min = _ref42[0]; 41949 var _ref5 = resolvedState.getNumericRefinement(attribute, "<=") || [], _ref62 = _slicedToArray$1(_ref5, 1), max = _ref62[0]; 41950 var isResetMin = nextMin === void 0 || nextMin === ""; 41951 var isResetMax = nextMax === void 0 || nextMax === ""; 41952 var _toPrecision = toPrecision({ 41953 min: !isResetMin ? parseFloat(nextMin) : void 0, 41954 max: !isResetMax ? parseFloat(nextMax) : void 0, 41955 precision 41956 }), nextMinAsNumber = _toPrecision.min, nextMaxAsNumber = _toPrecision.max; 41957 var newNextMin; 41958 if (!isFiniteNumber(minBound) && currentRangeMin === nextMinAsNumber) { 41959 newNextMin = void 0; 41960 } else if (isFiniteNumber(minBound) && isResetMin) { 41961 newNextMin = minBound; 41962 } else { 41963 newNextMin = nextMinAsNumber; 41964 } 41965 var newNextMax; 41966 if (!isFiniteNumber(maxBound) && currentRangeMax === nextMaxAsNumber) { 41967 newNextMax = void 0; 41968 } else if (isFiniteNumber(maxBound) && isResetMax) {
41969 newNextMax = maxBound; 41970 } else { 41971 newNextMax = nextMaxAsNumber; 41972 } 41973 var isResetNewNextMin = newNextMin === void 0; 41974 var isGreaterThanCurrentRange = isFiniteNumber(currentRangeMin) && currentRangeMin <= newNextMin; 41975 var isMinValid = isResetNewNextMin || isFiniteNumber(newNextMin) && (!isFiniteNumber(currentRangeMin) || isGreaterThanCurrentRange); 41976 var isResetNewNextMax = newNextMax === void 0; 41977 var isLowerThanRange = isFiniteNumber(newNextMax) && currentRangeMax >= newNextMax; 41978 var isMaxValid = isResetNewNextMax || isFiniteNumber(newNextMax) && (!isFiniteNumber(currentRangeMax) || isLowerThanRange); 41979 var hasMinChange = min !== newNextMin; 41980 var hasMaxChange = max !== newNextMax; 41981 if ((hasMinChange || hasMaxChange) && isMinValid && isMaxValid) { 41982 resolvedState = resolvedState.removeNumericRefinement(attribute); 41983 if (isFiniteNumber(newNextMin)) { 41984 resolvedState = resolvedState.addNumericRefinement(attribute, ">=", newNextMin); 41985 } 41986 if (isFiniteNumber(newNextMax)) { 41987 resolvedState = resolvedState.addNumericRefinement(attribute, "<=", newNextMax); 41988 } 41989 return resolvedState.resetPage(); 41990 } 41991 return null; 41992 }; 41993 var createSendEvent = function createSendEvent2(instantSearchInstance) { 41994 return function() { 41995 if (arguments.length === 1) { 41996 instantSearchInstance.sendEventToInsights(arguments.length <= 0 ? void 0 : arguments[0]); 41997 return; 41998 } 41999 }; 42000 }; 42001 function _getCurrentRange(stats) { 42002 var min; 42003 if (isFiniteNumber(minBound)) { 42004 min = minBound; 42005 } else if (isFiniteNumber(stats.min)) { 42006 min = stats.min; 42007 } else { 42008 min = 0; 42009 } 42010 var max; 42011 if (isFiniteNumber(maxBound)) { 42012 max = maxBound; 42013 } else if (isFiniteNumber(stats.max)) { 42014 max = stats.max; 42015 } else { 42016 max = 0; 42017 } 42018 return toPrecision({ 42019 min, 42020 max, 42021 precision 42022 }); 42023 } 42024 function _getCurrentRefinement(helper) { 42025 var _ref7 = helper.getNumericRefinement(attribute, ">=") || [], _ref8 = _slicedToArray$1(_ref7, 1), minValue = _ref8[0]; 42026 var _ref9 = helper.getNumericRefinement(attribute, "<=") || [], _ref10 = _slicedToArray$1(_ref9, 1), maxValue = _ref10[0]; 42027 var min = isFiniteNumber(minValue) ? minValue : -Infinity; 42028 var max = isFiniteNumber(maxValue) ? maxValue : Infinity; 42029 return [min, max]; 42030 } 42031 function _refine(helper, currentRange) { 42032 return function() { 42033 var _ref11 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [void 0, void 0], _ref12 = _slicedToArray$1(_ref11, 2), nextMin = _ref12[0], nextMax = _ref12[1]; 42034 var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax); 42035 if (refinedState) { 42036 helper.setState(refinedState).search(); 42037 } 42038 }; 42039 } 42040 return { 42041 $$type, 42042 init: function init7(initOptions) { 42043 renderFn(_objectSpread$8(_objectSpread$8({}, this.getWidgetRenderState(initOptions)), {}, { 42044 instantSearchInstance: initOptions.instantSearchInstance 42045 }), true); 42046 }, 42047 render: function render6(renderOptions) { 42048 renderFn(_objectSpread$8(_objectSpread$8({}, this.getWidgetRenderState(renderOptions)), {}, { 42049 instantSearchInstance: renderOptions.instantSearchInstance 42050 }), false); 42051 }, 42052 getRenderState: function getRenderState(renderState, renderOptions) { 42053 return _objectSpread$8(_objectSpread$8({}, renderState), {}, { 42054 range: _objectSpread$8(_objectSpread$8({}, renderState.range), {}, _defineProperty$a({}, attribute, this.getWidgetRenderState(renderOptions))) 42055 }); 42056 }, 42057 getWidgetRenderState: function getWidgetRenderState(_ref13) { 42058 var results = _ref13.results, helper = _ref13.helper, instantSearchInstance = _ref13.instantSearchInstance; 42059 var facetsFromResults = results && results.disjunctiveFacets || []; 42060 var facet = find$6(facetsFromResults, function(facetResult) { 42061 return facetResult.name === attribute; 42062 }); 42063 var stats = facet && facet.stats || { 42064 min: void 0, 42065 max: void 0 42066 }; 42067 var currentRange = _getCurrentRange(stats); 42068 var start2 = _getCurrentRefinement(helper); 42069 var refine; 42070 if (!results) { 42071 refine = _refine(helper, { 42072 min: void 0, 42073 max: void 0 42074 }); 42075 } else { 42076 refine = _refine(helper, currentRange); 42077 } 42078 return { 42079 refine, 42080 canRefine: currentRange.min !== currentRange.max, 42081 format: rangeFormatter, 42082 range: currentRange, 42083 sendEvent: createSendEvent(instantSearchInstance), 42084 widgetParams: _objectSpread$8(_objectSpread$8({}, widgetParams), {}, { 42085 precision 42086 }), 42087 start: start2 42088 }; 42089 }, 42090 dispose: function dispose(_ref14) { 42091 var state = _ref14.state; 42092 unmountFn(); 42093 return state.removeDisjunctiveFacet(attribute).removeNumericRefinement(attribute); 42094 }, 42095 getWidgetUiState: function getWidgetUiState(uiState, _ref15) { 42096 var searchParameters = _ref15.searchParameters; 42097 var _searchParameters$get = searchParameters.getNumericRefinements(attribute), _searchParameters$get2 = _searchParameters$get[">="], min = _searchParameters$get2 === void 0 ? [] : _searchParameters$get2, _searchParameters$get3 = _searchParameters$get["<="], max = _searchParameters$get3 === void 0 ? [] : _searchParameters$get3; 42098 if (min.length === 0 && max.length === 0) { 42099 return uiState; 42100 } 42101 return _objectSpread$8(_objectSpread$8({}, uiState), {}, { 42102 range: _objectSpread$8(_objectSpread$8({}, uiState.range), {}, _defineProperty$a({}, attribute, "".concat(min, ":").concat(max))) 42103 }); 42104 }, 42105 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref16) { 42106 var uiState = _ref16.uiState; 42107 var widgetSearchParameters = searchParameters.addDisjunctiveFacet(attribute).setQueryParameters({ 42108 numericRefinements: _objectSpread$8(_objectSpread$8({}, searchParameters.numericRefinements), {}, _defineProperty$a({}, attribute, {})) 42109 }); 42110 if (isFiniteNumber(minBound)) { 42111 widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, ">=", minBound); 42112 } 42113 if (isFiniteNumber(maxBound)) { 42114 widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, "<=", maxBound); 42115 } 42116 var value = uiState.range && uiState.range[attribute]; 42117 if (!value || value.indexOf(":") === -1) { 42118 return widgetSearchParameters; 42119 } 42120 var _value$split$map = value.split(":").map(parseFloat), _value$split$map2 = _slicedToArray$1(_value$split$map, 2), lowerBound = _value$split$map2[0], upperBound = _value$split$map2[1]; 42121 if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) { 42122 widgetSearchParameters = widgetSearchParameters.removeNumericRefinement(attribute, ">="); 42123 widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, ">=", lowerBound); 42124 } 42125 if (isFiniteNumber(upperBound) && (!isFiniteNumber(maxBound) || upperBound < maxBound)) { 42126 widgetSearchParameters = widgetSearchParameters.removeNumericRefinement(attribute, "<="); 42127 widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, "<=", upperBound); 42128 } 42129 return widgetSearchParameters; 42130 } 42131 }; 42132 }; 42133}; 42134function _typeof$9(obj) { 42135 "@babel/helpers - typeof"; 42136 return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 42137 return typeof obj2; 42138 } : function(obj2) { 42139 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42140 }, _typeof$9(obj); 42141} 42142function ownKeys$7(object, enumerableOnly) { 42143 var keys = Object.keys(object); 42144 if (Object.getOwnPropertySymbols) { 42145 var symbols = Object.getOwnPropertySymbols(object); 42146 enumerableOnly && (symbols = symbols.filter(function(sym) { 42147 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42148 })), keys.push.apply(keys, symbols); 42149 } 42150 return keys; 42151} 42152function _objectSpread$7(target) { 42153 for (var i2 = 1; i2 < arguments.length; i2++) { 42154 var source = null != arguments[i2] ? arguments[i2] : {}; 42155 i2 % 2 ? ownKeys$7(Object(source), true).forEach(function(key2) { 42156 _defineProperty$9(target, key2, source[key2]); 42157 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEac
42157h(function(key2) { 42158 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 42159 }); 42160 } 42161 return target; 42162} 42163function _defineProperty$9(obj, key2, value) { 42164 key2 = _toPropertyKey$9(key2); 42165 if (key2 in obj) { 42166 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 42167 } else { 42168 obj[key2] = value; 42169 } 42170 return obj; 42171} 42172function _toPropertyKey$9(arg) { 42173 var key2 = _toPrimitive$9(arg, "string"); 42174 return _typeof$9(key2) === "symbol" ? key2 : String(key2); 42175} 42176function _toPrimitive$9(input, hint) { 42177 if (_typeof$9(input) !== "object" || input === null) return input; 42178 var prim = input[Symbol.toPrimitive]; 42179 if (prim !== void 0) { 42180 var res = prim.call(input, hint || "default"); 42181 if (_typeof$9(res) !== "object") return res; 42182 throw new TypeError("@@toPrimitive must return a primitive value."); 42183 } 42184 return (hint === "string" ? String : Number)(input); 42185} 42186var Pit = function Pit2(_ref) { 42187 var style = _ref.style, children = _ref.children; 42188 var positionValue = Math.round(parseFloat(style.left)); 42189 var shouldDisplayValue = [0, 50, 100].includes(positionValue); 42190 var value = children; 42191 var pitValue = Math.round(parseInt(value, 10) * 100) / 100; 42192 return _$1("div", { 42193 style: _objectSpread$7(_objectSpread$7({}, style), {}, { 42194 marginLeft: positionValue === 100 ? "-2px" : 0 42195 }), 42196 className: cx("rheostat-marker", "rheostat-marker-horizontal", shouldDisplayValue && "rheostat-marker-large") 42197 }, shouldDisplayValue && _$1("div", { 42198 className: "rheostat-value" 42199 }, pitValue)); 42200}; 42201function _typeof$8(obj) { 42202 "@babel/helpers - typeof"; 42203 return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 42204 return typeof obj2; 42205 } : function(obj2) { 42206 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42207 }, _typeof$8(obj); 42208} 42209function _createClass$2(Constructor, protoProps, staticProps) { 42210 Object.defineProperty(Constructor, "prototype", { writable: false }); 42211 return Constructor; 42212} 42213function _classCallCheck$1(instance, Constructor) { 42214 if (!(instance instanceof Constructor)) { 42215 throw new TypeError("Cannot call a class as a function"); 42216 } 42217} 42218function _inherits$1(subClass, superClass) { 42219 if (typeof superClass !== "function" && superClass !== null) { 42220 throw new TypeError("Super expression must either be null or a function"); 42221 } 42222 subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 42223 Object.defineProperty(subClass, "prototype", { writable: false }); 42224 if (superClass) _setPrototypeOf$1(subClass, superClass); 42225} 42226function _setPrototypeOf$1(o2, p2) { 42227 _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) { 42228 o3.__proto__ = p3; 42229 return o3; 42230 }; 42231 return _setPrototypeOf$1(o2, p2); 42232} 42233function _createSuper$1(Derived) { 42234 var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); 42235 return function _createSuperInternal() { 42236 var Super = _getPrototypeOf$1(Derived), result; 42237 if (hasNativeReflectConstruct) { 42238 var NewTarget = _getPrototypeOf$1(this).constructor; 42239 result = Reflect.construct(Super, arguments, NewTarget); 42240 } else { 42241 result = Super.apply(this, arguments); 42242 } 42243 return _possibleConstructorReturn$1(this, result); 42244 }; 42245} 42246function _possibleConstructorReturn$1(self2, call) { 42247 if (call && (_typeof$8(call) === "object" || typeof call === "function")) { 42248 return call; 42249 } else if (call !== void 0) { 42250 throw new TypeError("Derived constructors may only return object or undefined"); 42251 } 42252 return _assertThisInitialized$1(self2); 42253} 42254function _assertThisInitialized$1(self2) { 42255 if (self2 === void 0) { 42256 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 42257 } 42258 return self2; 42259} 42260function _isNativeReflectConstruct$1() { 42261 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 42262 if (Reflect.construct.sham) return false;
42263 if (typeof Proxy === "function") return true; 42264 try { 42265 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 42266 })); 42267 return true; 42268 } catch (e2) { 42269 return false; 42270 } 42271} 42272function _getPrototypeOf$1(o2) { 42273 _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) { 42274 return o3.__proto__ || Object.getPrototypeOf(o3); 42275 }; 42276 return _getPrototypeOf$1(o2); 42277} 42278function _defineProperty$8(obj, key2, value) { 42279 key2 = _toPropertyKey$8(key2); 42280 if (key2 in obj) { 42281 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 42282 } else { 42283 obj[key2] = value; 42284 } 42285 return obj; 42286} 42287function _toPropertyKey$8(arg) { 42288 var key2 = _toPrimitive$8(arg, "string"); 42289 return _typeof$8(key2) === "symbol" ? key2 : String(key2); 42290} 42291function _toPrimitive$8(input, hint) { 42292 if (_typeof$8(input) !== "object" || input === null) return input; 42293 var prim = input[Symbol.toPrimitive]; 42294 if (prim !== void 0) { 42295 var res = prim.call(input, hint || "default"); 42296 if (_typeof$8(res) !== "object") return res; 42297 throw new TypeError("@@toPrimitive must return a primitive value."); 42298 } 42299 return (hint === "string" ? String : Number)(input); 42300} 42301function _extends$1() { 42302 _extends$1 = Object.assign ? Object.assign.bind() : function(target) { 42303 for (var i2 = 1; i2 < arguments.length; i2++) { 42304 var source = arguments[i2]; 42305 for (var key2 in source) { 42306 if (Object.prototype.hasOwnProperty.call(source, key2)) { 42307 target[key2] = source[key2]; 42308 } 42309 } 42310 } 42311 return target; 42312 }; 42313 return _extends$1.apply(this, arguments); 42314} 42315var KEYS = { 42316 DOWN: 40, 42317 END: 35, 42318 ESC: 27, 42319 HOME: 36, 42320 LEFT: 37, 42321 PAGE_DOWN: 34, 42322 PAGE_UP: 33, 42323 RIGHT: 39, 42324 UP: 38 42325}; 42326var PERCENT_EMPTY = 0; 42327var PERCENT_FULL = 100; 42328function getPosition(value, min, max) { 42329 return (value - min) / (max - min) * 100; 42330} 42331function getValue(pos, min, max) { 42332 var decimal = pos / 100; 42333 if (pos === 0) { 42334 return min; 42335 } else if (pos === 100) { 42336 return max; 42337 } 42338 return Math.round((max - min) * decimal + min); 42339} 42340function getClassName(props) { 42341 var orientation = props.orientation === "vertical" ? "rheostat-vertical" : "rheostat-horizontal"; 42342 return ["rheostat", orientation].concat(props.className.split(" ")).join(" "); 42343} 42344function getHandleFor(ev) { 42345 return Number(ev.currentTarget.getAttribute("data-handle-key")); 42346} 42347function killEvent(ev) { 42348 ev.stopPropagation(); 42349 ev.preventDefault(); 42350} 42351function Button(props) { 42352 return _$1("button", _extends$1({}, props, { 42353 type: "button" 42354 })); 42355} 42356var _ref6$1 = _$1("div", { 42357 className: "rheostat-background" 42358}); 42359var Rheostat = /* @__PURE__ */ function(_Component) { 42360 _inherits$1(Rheostat2, _Component); 42361 var _super = _createSuper$1(Rheostat2); 42362 function Rheostat2() { 42363 var _this; 42364 _classCallCheck$1(this, Rheostat2); 42365 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 42366 args[_key] = arguments[_key]; 42367 } 42368 _this = _super.call.apply(_super, [this].concat(args)); 42369 _defineProperty$8(_assertThisInitialized$1(_this), "x", [0, 0].map(function(y2) { 42370 return y2; 42371 })); 42372 _defineProperty$8(_assertThisInitialized$1(_this), "state", { 42373 className: getClassName(_this.props), 42374 // non-null thanks to defaultProps 42375 handlePos: _this.props.values.map(function(value) { 42376 return getPosition(value, _this.props.min, _this.props.max); 42377 }), 42378 handleDimensions: 0, 42379 mousePos: null, 42380 sliderBox: {}, 42381 slidingIndex: null, 42382 // non-null thanks to defaultProps 42383 values: _this.props.values 42384 }); 42385 _defineProperty$8(_assertThisInitialized$1(_this), "rheostat", m$6()); 42386 _defineProperty$8(_assertThisInitialized$1(_this), "componentWillReceiveProps", function(nextProps) { 42387 var _this$props = _this.props, className = _this$props.className, disabled = _this$props.disabled, min = _this$props.min, max = _this$props.max, orientation = _this$props.orientation; 42388 var _this$state = _this.state, values = _this$state.values, slidingIndex = _this$state.slidingIndex; 42389 var minMaxChanged = nextProps.min !== min || nextProps.max !== max; 42390 var valuesChanged = values.length !== nextProps.values.length || values.some(function(value, idx) { 42391 return nextProps.values[idx] !== value; 42392 }); 42393 var orientationChanged = nextProps.className !== className || nextProps.orientation !== orientation; 42394 var willBeDisabled = nextProps.disabled && !disabled; 42395 if (orientationChanged) { 42396 _this.setState({ 42397 className: getClassName(nextProps) 42398 }); 42399 } 42400 if (minMaxChanged || valuesChanged) _this.updateNewValues(nextProps); 42401 if (willBeDisabled && slidingIndex !== null) { 42402 _this.endSlide(); 42403 } 42404 }); 42405 _defineProperty$8(_assertThisInitialized$1(_this), "getPublicState", function() { 42406 var _this$props2 = _this.props, min = _this$props2.min, max = _this$props2.max; 42407 var values = _this.state.values; 42408 return { 42409 max, 42410 min, 42411 values 42412 }; 42413 }); 42414 _defineProperty$8(_assertThisInitialized$1(_this), "getSliderBoundingBox", function() { 42415 var node = _this.rheostat.current;
vendor: 5,377 bytes, lines 42416-42535
42416 var rect = node.getBoundingClientRect(); 42417 return { 42418 height: rect.height || node.clientHeight, 42419 left: rect.left, 42420 top: rect.top, 42421 width: rect.width || node.clientWidth 42422 }; 42423 }); 42424 _defineProperty$8(_assertThisInitialized$1(_this), "getProgressStyle", function(idx) { 42425 var handlePos = _this.state.handlePos; 42426 var value = handlePos[idx]; 42427 if (idx === 0) { 42428 return _this.props.orientation === "vertical" ? { 42429 height: "".concat(value, "%"), 42430 top: 0 42431 } : { 42432 left: 0, 42433 width: "".concat(value, "%") 42434 }; 42435 } 42436 var prevValue = handlePos[idx - 1]; 42437 var diffValue = value - prevValue; 42438 return _this.props.orientation === "vertical" ? { 42439 height: "".concat(diffValue, "%"), 42440 top: "".concat(prevValue, "%") 42441 } : { 42442 left: "".concat(prevValue, "%"), 42443 width: "".concat(diffValue, "%") 42444 }; 42445 }); 42446 _defineProperty$8(_assertThisInitialized$1(_this), "getMinValue", function(idx) { 42447 return _this.state.values[idx - 1] ? Math.max(_this.props.min, _this.state.values[idx - 1]) : _this.props.min; 42448 }); 42449 _defineProperty$8(_assertThisInitialized$1(_this), "getMaxValue", function(idx) { 42450 return _this.state.values[idx + 1] ? Math.min(_this.props.max, _this.state.values[idx + 1]) : _this.props.max; 42451 }); 42452 _defineProperty$8(_assertThisInitialized$1(_this), "getHandleDimensions", function(ev, sliderBox) { 42453 var handleNode = ev.currentTarget || null; 42454 if (!handleNode) return 0; 42455 return _this.props.orientation === "vertical" ? handleNode.clientHeight / sliderBox.height * PERCENT_FULL / 2 : handleNode.clientWidth / sliderBox.width * PERCENT_FULL / 2; 42456 }); 42457 _defineProperty$8(_assertThisInitialized$1(_this), "getClosestSnapPoint", function(value) { 42458 if (!_this.props.snapPoints.length) return value; 42459 return _this.props.snapPoints.reduce(function(snapTo, snap3) { 42460 return Math.abs(snapTo - value) < Math.abs(snap3 - value) ? snapTo : snap3; 42461 }); 42462 }); 42463 _defineProperty$8(_assertThisInitialized$1(_this), "getSnapPosition", function(positionPercent) { 42464 if (!_this.props.snap) return positionPercent; 42465 var _ref = _this.props, max = _ref.max, min = _ref.min; 42466 var value = getValue(positionPercent, min, max); 42467 var snapValue = _this.getClosestSnapPoint(value); 42468 return getPosition(snapValue, min, max); 42469 }); 42470 _defineProperty$8(_assertThisInitialized$1(_this), "getNextPositionForKey", function(idx, keyCode) { 42471 var _stepMultiplier; 42472 var _this$state2 = _this.state, handlePos = _this$state2.handlePos, values = _this$state2.values; 42473 var _ref22 = _this.props, max = _ref22.max, min = _ref22.min, snapPoints = _ref22.snapPoints; 42474 var shouldSnap = _this.props.snap; 42475 var proposedValue = values[idx]; 42476 var proposedPercentage = handlePos[idx]; 42477 var originalPercentage = proposedPercentage; 42478 var stepValue = 1; 42479 if (max >= 100) { 42480 proposedPercentage = Math.round(proposedPercentage); 42481 } else { 42482 stepValue = 100 / (max - min); 42483 } 42484 var currentIndex = null; 42485 if (shouldSnap) { 42486 currentIndex = snapPoints.indexOf(_this.getClosestSnapPoint(values[idx])); 42487 } 42488 var stepMultiplier = (_stepMultiplier = {}, _defineProperty$8(_stepMultiplier, KEYS.LEFT, function(v2) { 42489 return v2 * -1; 42490 }), _defineProperty$8(_stepMultiplier, KEYS.RIGHT, function(v2) { 42491 return v2; 42492 }), _defineProperty$8(_stepMultiplier, KEYS.UP, function(v2) { 42493 return v2; 42494 }), _defineProperty$8(_stepMultiplier, KEYS.DOWN, function(v2) { 42495 return v2 * -1; 42496 }), _defineProperty$8(_stepMultiplier, KEYS.PAGE_DOWN, function(v2) { 42497 return v2 > 1 ? -v2 : v2 * -10; 42498 }), _defineProperty$8(_stepMultiplier, KEYS.PAGE_UP, function(v2) { 42499 return v2 > 1 ? v2 : v2 * 10; 42500 }), _stepMultiplier); 42501 if (Object.prototype.hasOwnProperty.call(stepMultiplier, keyCode)) { 42502 proposedPercentage += stepMultiplier[keyCode](stepValue); 42503 if (shouldSnap) { 42504 if (!currentIndex) ; 42505 else if (proposedPercentage > originalPercentage) { 42506 if (currentIndex < snapPoints.length - 1) { 42507 proposedValue = snapPoints[currentIndex + 1]; 42508 } 42509 } else if (currentIndex > 0) { 42510 proposedValue = snapPoints[currentIndex - 1]; 42511 } 42512 } 42513 } else if (keyCode === KEYS.HOME) { 42514 proposedPercentage = PERCENT_EMPTY; 42515 if (shouldSnap) { 42516 proposedValue = snapPoints[0]; 42517 } 42518 } else if (keyCode === KEYS.END) { 42519 proposedPercentage = PERCENT_FULL; 42520 if (shouldSnap) { 42521 proposedValue = snapPoints[snapPoints.length - 1]; 42522 } 42523 } else { 42524 return null; 42525 } 42526 return shouldSnap ? getPosition(proposedValue, min, max) : proposedPercentage; 42527 }); 42528 _defineProperty$8(_assertThisInitialized$1(_this), "getNextState", function(idx, proposedPosition) { 42529 var handlePos = _this.state.handlePos; 42530 var _ref3 = _this.props, max = _ref3.max, min = _ref3.min; 42531 var actualPosition = _this.validatePosition(idx, proposedPosition); 42532 var nextHandlePos = handlePos.map(function(pos, index3) { 42533 return index3 === idx ? actualPosition : pos; 42534 }); 42535 return {
42536 handlePos: nextHandlePos, 42537 values: nextHandlePos.map(function(pos) { 42538 return getValue(pos, min, max); 42539 }) 42540 }; 42541 }); 42542 _defineProperty$8(_assertThisInitialized$1(_this), "getClosestHandle", function(positionPercent) { 42543 var handlePos = _this.state.handlePos; 42544 return handlePos.reduce(function(closestIdx, _node, idx) { 42545 var challenger = Math.abs(handlePos[idx] - positionPercent); 42546 var current = Math.abs(handlePos[closestIdx] - positionPercent); 42547 return challenger < current ? idx : closestIdx; 42548 }, 0); 42549 }); 42550 _defineProperty$8(_assertThisInitialized$1(_this), "setStartSlide", function(ev, x2, y2) { 42551 var sliderBox = _this.getSliderBoundingBox(); 42552 _this.setState({ 42553 handleDimensions: _this.getHandleDimensions(ev, sliderBox), 42554 mousePos: { 42555 x: x2, 42556 y: y2 42557 }, 42558 sliderBox, 42559 slidingIndex: getHandleFor(ev) 42560 }); 42561 }); 42562 _defineProperty$8(_assertThisInitialized$1(_this), "startMouseSlide", function(ev) { 42563 _this.setStartSlide(ev, ev.clientX, ev.clientY); 42564 document.addEventListener("mousemove", _this.handleMouseSlide, false); 42565 document.addEventListener("mouseup", _this.endSlide, false); 42566 killEvent(ev); 42567 }); 42568 _defineProperty$8(_assertThisInitialized$1(_this), "startTouchSlide", function(ev) { 42569 if (ev.changedTouches.length > 1) return; 42570 var touch = ev.changedTouches[0]; 42571 _this.setStartSlide(ev, touch.clientX, touch.clientY); 42572 document.addEventListener("touchmove", _this.handleTouchSlide, false); 42573 document.addEventListener("touchend", _this.endSlide, false); 42574 if (_this.props.onSliderDragStart) _this.props.onSliderDragStart(); 42575 killEvent(ev); 42576 }); 42577 _defineProperty$8(_assertThisInitialized$1(_this), "handleMouseSlide", function(ev) { 42578 if (_this.state.slidingIndex === null) return; 42579 _this.handleSlide(ev.clientX, ev.clientY); 42580 killEvent(ev); 42581 }); 42582 _defineProperty$8(_assertThisInitialized$1(_this), "handleTouchSlide", function(ev) { 42583 if (_this.state.slidingIndex === null) return; 42584 if (ev.changedTouches.length > 1) { 42585 _this.endSlide(); 42586 return; 42587 } 42588 var touch = ev.changedTouches[0]; 42589 _this.handleSlide(touch.clientX, touch.clientY); 42590 killEvent(ev); 42591 }); 42592 _defineProperty$8(_assertThisInitialized$1(_this), "handleSlide", function(x2, y2) { 42593 var _this$state3 = _this.state, idx = _this$state3.slidingIndex, sliderBox = _this$state3.sliderBox; 42594 var positionPercent = _this.props.orientation === "vertical" ? (y2 - sliderBox.top) / sliderBox.height * PERCENT_FULL : (x2 - sliderBox.left) / sliderBox.width * PERCENT_FULL; 42595 _this.slideTo(idx, positionPercent); 42596 if (_this.canMove(idx, positionPercent)) { 42597 _this.setState({ 42598 mousePos: { 42599 x: x2, 42600 y: y2 42601 } 42602 }); 42603 if (_this.props.onSliderDragMove) _this.props.onSliderDragMove(); 42604 } 42605 }); 42606 _defineProperty$8(_assertThisInitialized$1(_this), "endSlide", function() { 42607 var idx = _this.state.slidingIndex; 42608 _this.setState({ 42609 slidingIndex: null 42610 }); 42611 document.removeEventListener("mouseup", _this.endSlide, false); 42612 document.removeEventListener("touchend", _this.endSlide, false); 42613 document.removeEventListener("touchmove", _this.handleTouchSlide, false); 42614 document.removeEventListener("mousemove", _this.handleMouseSlide, false); 42615 if (_this.props.onSliderDragEnd) _this.props.onSliderDragEnd(); 42616 if (_this.props.snap) { 42617 var positionPercent = _this.getSnapPosition(_this.state.handlePos[idx]); 42618 _this.slideTo(idx, positionPercent, function() { 42619 return _this.fireChangeEvent(); 42620 }); 42621 } else { 42622 _this.fireChangeEvent(); 42623 } 42624 }); 42625 _defineProperty$8(_assertThisInitialized$1(_this), "handleClick", function(ev) { 42626 if (ev.target.getAttribute("data-handle-key")) { 42627 return; 42628 } 42629 var sliderBox = _this.getSliderBoundingBox(); 42630 var positionDecimal = _this.props.orientation === "vertical" ? (ev.clientY - sliderBox.top) / sliderBox.height : (ev.clientX - sliderBox.left) / sliderBox.width; 42631 var positionPercent = positionDecimal * PERCENT_FULL; 42632 var handleId = _this.getClosestHandle(positionPercent);
42633 var validPositionPercent = _this.getSnapPosition(positionPercent); 42634 _this.slideTo(handleId, validPositionPercent, function() { 42635 return _this.fireChangeEvent(); 42636 }); 42637 if (_this.props.onClick) _this.props.onClick(); 42638 }); 42639 _defineProperty$8(_assertThisInitialized$1(_this), "handleKeydown", function(ev) { 42640 var idx = getHandleFor(ev); 42641 if (ev.keyCode === KEYS.ESC) { 42642 ev.currentTarget.blur(); 42643 return; 42644 } 42645 var proposedPercentage = _this.getNextPositionForKey(idx, ev.keyCode); 42646 if (proposedPercentage === null) return; 42647 if (_this.canMove(idx, proposedPercentage)) { 42648 _this.slideTo(idx, proposedPercentage, function() { 42649 return _this.fireChangeEvent(); 42650 }); 42651 if (_this.props.onKeyPress) _this.props.onKeyPress(); 42652 } 42653 killEvent(ev); 42654 }); 42655 _defineProperty$8(_assertThisInitialized$1(_this), "validatePosition", function(idx, proposedPosition) { 42656 var _this$state4 = _this.state, handlePos = _this$state4.handlePos, handleDimensions = _this$state4.handleDimensions; 42657 return Math.max( 42658 Math.min( 42659 proposedPosition, 42660 handlePos[idx + 1] !== void 0 ? handlePos[idx + 1] - handleDimensions : PERCENT_FULL 42661 // 100% is the highest value 42662 ), 42663 handlePos[idx - 1] !== void 0 ? handlePos[idx - 1] + handleDimensions : PERCENT_EMPTY 42664 // 0% is the lowest value 42665 ); 42666 }); 42667 _defineProperty$8(_assertThisInitialized$1(_this), "validateValues", function(proposedValues, props) { 42668 var _ref42 = props || _this.props, max = _ref42.max, min = _ref42.min; 42669 return proposedValues.map(function(value, idx, values) { 42670 var realValue = Math.max(Math.min(value, max), min); 42671 if (values.length && realValue < values[idx - 1]) { 42672 return values[idx - 1]; 42673 } 42674 return realValue; 42675 }); 42676 }); 42677 _defineProperty$8(_assertThisInitialized$1(_this), "canMove", function(idx, proposedPosition) { 42678 var _this$state5 = _this.state, handlePos = _this$state5.handlePos, handleDimensions = _this$state5.handleDimensions; 42679 if (proposedPosition < PERCENT_EMPTY) return false; 42680 if (proposedPosition > PERCENT_FULL) return false; 42681 var nextHandlePosition = handlePos[idx + 1] !== void 0 ? handlePos[idx + 1] - handleDimensions : Infinity; 42682 if (proposedPosition > nextHandlePosition) return false; 42683 var prevHandlePosition = handlePos[idx - 1] !== void 0 ? handlePos[idx - 1] + handleDimensions : -Infinity; 42684 if (proposedPosition < prevHandlePosition) return false; 42685 return true; 42686 }); 42687 _defineProperty$8(_assertThisInitialized$1(_this), "fireChangeEvent", function() { 42688 var onChange = _this.props.onChange; 42689 if (onChange) onChange(_this.getPublicState()); 42690 }); 42691 _defineProperty$8(_assertThisInitialized$1(_this), "slideTo", function(idx, proposedPosition, onAfterSet) { 42692 var nextState = _this.getNextState(idx, proposedPosition); 42693 _this.setState(nextState, function() { 42694 var onValuesUpdated = _this.props.onValuesUpdated; 42695 if (onValuesUpdated) onValuesUpdated(_this.getPublicState()); 42696 if (onAfterSet) onAfterSet(); 42697 }); 42698 }); 42699 _defineProperty$8(_assertThisInitialized$1(_this), "updateNewValues", function(nextProps) { 42700 var slidingIndex = _this.state.slidingIndex; 42701 if (slidingIndex !== null) { 42702 return; 42703 } 42704 var max = nextProps.max, min = nextProps.min, values = nextProps.values; 42705 var nextValues = _this.validateValues(values, nextProps); 42706 _this.setState({ 42707 handlePos: nextValues.map(function(value) { 42708 return getPosition(value, min, max); 42709 }), 42710 values: nextValues 42711 }, function() { 42712 return _this.fireChangeEvent(); 42713 }); 42714 }); 42715 _defineProperty$8(_assertThisInitialized$1(_this), "render", function() { 42716 var _ref5 = _this.props, children = _ref5.children, disabled = _ref5.disabled, Handle = _ref5.handle, max = _ref5.max, min = _ref5.min, orientation = _ref5.orientation, PitComponent = _ref5.pitComponent, pitPoints = _ref5.pitPoints, ProgressBar2 = _ref5.progressBar; 42717 var _this$state6 = _this.state, className = _this$state6.className, handlePos = _this$state6.handlePos, values = _this$state6.values; 42718 return _$1("div", { 42719 className, 42720 ref: _this.rheostat, 42721 onClick: disabled ? void 0 : _this.handleClick, 42722 style: { 42723 position: "relative" 42724 } 42725 }, _ref6$1, handlePos.map(function(pos, idx) { 42726 var handleStyle = orientation === "vertical" ? { 42727 top: "".concat(pos, "%"), 42728 position: "absolute" 42729 } : { 42730 left: "".concat(pos, "%"), 42731 position: "absolute" 42732 }; 42733 return _$1(Handle, { 42734 "aria-valuemax": _this.getMaxValue(idx), 42735 "aria-valuemin": _this.getMinValue(idx), 42736 "aria-valuenow": values[idx], 42737 "aria-disabled": disabled, 42738 "data-handle-key": idx, 42739 className: "rheostat-handle", 42740 key: "handle-".concat(idx), 42741 onClick: killEvent, 42742 onKeyDown: disabled ? void 0 : _this.handleKeydown, 42743 onMouseDown: disabled ? void 0 : _this.startMouseSlide, 42744 onTouchStart: disabled ? void 0 : _this.startTouchSlide, 42745 role: "slider", 42746 style: handleStyle, 42747 tabIndex: 0 42748 }); 42749 }), handlePos.map(function(_node, idx, arr) { 42750 if (idx === 0 && arr.length > 1) { 42751 return null; 42752 } 42753 return _$1(ProgressBar2, { 42754 className: "rheostat-progress", 42755 key: "progress-bar-".concat(idx), 42756 style: _this.getProgressStyle(idx) 42757 }); 42758 }), PitComponent && pitPoints.map(function(n2) { 42759 var pos = getPosition(n2, min, max); 42760 var pitStyle = orientation === "vertical" ? { 42761 top: "".concat(pos, "%"), 42762 position: "absolute" 42763 } : { 42764 left: "".concat(pos, "%"), 42765 position: "absolute" 42766 }; 42767 return _$1(PitComponent, { 42768 key: "pit-".concat(n2), 42769 style: pitStyle 42770 }, n2); 42771 }), children); 42772 }); 42773 return _this; 42774 } 42775 return _createClass$2(Rheostat2); 42776}(k$2); 42777_defineProperty$8(Rheostat, "defaultProps", { 42778 className: "", 42779 children: null, 42780 disabled: false, 42781 handle: Button, 42782 max: PERCENT_FULL, 42783 min: PERCENT_EMPTY, 42784 onClick: null, 42785 onChange: null, 42786 onKeyPress: null, 42787 onSliderDragEnd: null, 42788 onSliderDragMove: null, 42789 onSliderDragStart: null, 42790 onValuesUpdated: null, 42791 orientation: "horizontal", 42792 pitComponent: null, 42793 pitPoints: [], 42794 progressBar: "div", 42795 snap: false, 42796 snapPoints: [], 42797 values: [PERCENT_EMPTY] 42798}); 42799function _toConsumableArray(arr) { 42800 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread(); 42801} 42802function _nonIterableSpread() { 42803 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 42804} 42805function _unsupportedIterableToArray$1(o2, minLen) { 42806 if (!o2) return; 42807 if (typeof o2 === "string") return _arrayLikeToArray$1(o2, minLen); 42808 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 42809 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 42810 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 42811 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$1(o2, minLen); 42812} 42813function _iterableToArray(iter) { 42814 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 42815} 42816function _arrayWithoutHoles(arr) { 42817 if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); 42818} 42819function _arrayLikeToArray$1(arr, len2) { 42820 if (len2 == null || len2 > arr.length) len2 = arr.length; 42821 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 42822 return arr2; 42823} 42824function _extends() { 42825 _extends = Object.assign ? Object.assign.bind() : function(target) { 42826 for (var i2 = 1; i2 < arguments.length; i2++) { 42827 var source = arguments[i2]; 42828 for (var key2 in source) { 42829 if (Object.prototype.hasOwnProperty.call(source, key2)) { 42830 target[key2] = source[key2]; 42831 } 42832 } 42833 } 42834 return target; 42835 }; 42836 return _extends.apply(this, arguments); 42837} 42838function _typeof$7(obj) { 42839 "@babel/helpers - typeof"; 42840 return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 42841 return typeof obj2; 42842 } : function(obj2) { 42843 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42844 }, _typeof$7(obj); 42845} 42846function _classCallCheck(instance, Constructor) { 42847 if (!(instance instanceof Constructor)) { 42848 throw new TypeError("Cannot call a class as a function"); 42849 } 42850} 42851function _defineProperties$1(target, props) { 42852 for (var i2 = 0; i2 < props.length; i2++) { 42853 var descriptor = props[i2]; 42854 descriptor.enumerable = descriptor.enumerable || false; 42855 descriptor.configurable = true; 42856 if ("value" in descriptor) descriptor.writable = true; 42857 Object.defineProperty(target, _toPropertyKey$7(descriptor.key), descriptor); 42858 } 42859} 42860function _createClass$1(Constructor, protoProps, staticProps) { 42861 if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); 42862 Object.defineProperty(Constructor, "prototype", { writable: false }); 42863 return Constructor; 42864} 42865function _inherits(subClass, superClass) { 42866 if (typeof superClass !== "function" && superClass !== null) { 42867 throw new TypeError("Super expression must either be null or a function"); 42868 } 42869 subClass.prototype = Object.create(superClass && superClass.prototype, { c
42869onstructor: { value: subClass, writable: true, configurable: true } }); 42870 Object.defineProperty(subClass, "prototype", { writable: false }); 42871 if (superClass) _setPrototypeOf(subClass, superClass); 42872} 42873function _setPrototypeOf(o2, p2) { 42874 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) { 42875 o3.__proto__ = p3; 42876 return o3; 42877 }; 42878 return _setPrototypeOf(o2, p2); 42879} 42880function _createSuper(Derived) { 42881 var hasNativeReflectConstruct = _isNativeReflectConstruct(); 42882 return function _createSuperInternal() { 42883 var Super = _getPrototypeOf(Derived), result; 42884 if (hasNativeReflectConstruct) { 42885 var NewTarget = _getPrototypeOf(this).constructor; 42886 result = Reflect.construct(Super, arguments, NewTarget); 42887 } else { 42888 result = Super.apply(this, arguments); 42889 } 42890 return _possibleConstructorReturn(this, result); 42891 }; 42892} 42893function _possibleConstructorReturn(self2, call) { 42894 if (call && (_typeof$7(call) === "object" || typeof call === "function")) { 42895 return call; 42896 } else if (call !== void 0) { 42897 throw new TypeError("Derived constructors may only return object or undefined"); 42898 } 42899 return _assertThisInitialized(self2); 42900} 42901function _assertThisInitialized(self2) { 42902 if (self2 === void 0) { 42903 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 42904 } 42905 return self2; 42906} 42907function _isNativeReflectConstruct() { 42908 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 42909 if (Reflect.construct.sham) return false; 42910 if (typeof Proxy === "function") return true; 42911 try { 42912 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 42913 })); 42914 return true; 42915 } catch (e2) { 42916 return false; 42917 } 42918} 42919function _getPrototypeOf(o2) { 42920 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) { 42921 return o3.__proto__ || Object.getPrototypeOf(o3); 42922 }; 42923 return _getPrototypeOf(o2); 42924} 42925function _defineProperty$7(obj, key2, value) { 42926 key2 = _toPropertyKey$7(key2); 42927 if (key2 in obj) { 42928 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 42929 } else { 42930 obj[key2] = value; 42931 } 42932 return obj; 42933} 42934function _toPropertyKey$7(arg) { 42935 var key2 = _toPrimitive$7(arg, "string"); 42936 return _typeof$7(key2) === "symbol" ? key2 : String(key2); 42937} 42938function _toPrimitive$7(input, hint) { 42939 if (_typeof$7(input) !== "object" || input === null) return input; 42940 var prim = input[Symbol.toPrimitive]; 42941 if (prim !== void 0) { 42942 var res = prim.call(input, hint || "default"); 42943 if (_typeof$7(res) !== "object") return res; 42944 throw new TypeError("@@toPrimitive must return a primitive value."); 42945 } 42946 return (hint === "string" ? String : Number)(input); 42947} 42948var Slider = /* @__PURE__ */ function(_Component) { 42949 _inherits(Slider2, _Component); 42950 var _super = _createSuper(Slider2); 42951 function Slider2() { 42952 var _this; 42953 _classCallCheck(this, Slider2); 42954 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 42955 args[_key] = arguments[_key]; 42956 } 42957 _this = _super.call.apply(_super, [this].concat(args)); 42958 _defineProperty$7(_assertThisInitialized(_this), "handleChange", function(_ref) { 42959 var values = _ref.values; 42960 if (!_this.isDisabled) { 42961 _this.props.refine(values); 42962 } 42963 }); 42964 _defineProperty$7(_assertThisInitialized(_this), "createHandleComponent", function(tooltips) { 42965 return function(props) { 42966 var roundedValue = Math.round( 42967 // have to cast as a string, as the value given to the prop is a number, but becomes a string when read 42968 parseFloat(props["aria-valuenow"]) * 100 42969 ) / 100; 42970 var value = _typeof$7(tooltips) === "object" && tooltips.format ? tooltips.format(roundedValue) : roundedValue; 42971 var className = cx(props.className, props["data-handle-key"] === 0 && "rheostat-handle-lower", props["data-handle-key"] === 1 && "rheostat-handle-upper"); 42972 var ariaLabel = props["data-handle-key"] === 0 ? "Minimum Filter Handle" : "Maximum Filter Handle"; 42973 return _$1("div", _extends({}, props, { 42974 className, 42975 "aria-label": ariaLabel 42976 }), tooltips && _$1("div", { 42977 className: "rheostat-tooltip" 42978 }, value)); 42979 }; 42980 }); 42981 return _this; 42982 } 42983 _createClass$1(Slider2, [{ 42984 key: "isDisabled", 42985 get: function get4() { 42986 return this.props.min >= this.props.max; 42987 } 42988 }, { 42989 key: "computeDefaultPitPoints", 42990 value: ( 42991 // creates an array number where to display a pit point on the slider 42992 function computeDefaultPitPoints(_ref22) { 42993 var min = _ref22.min, max = _ref22.max; 42994 var totalLength = max - min; 42995 var steps = 34; 42996 var stepsLength = totalLength / steps; 42997 var pitPoints = [min].concat(_toConsumableArray(range$1({ 42998 end: steps - 1 42999 }).map(function(step) { 43000 return min + stepsLength * (step + 1); 43001 })), [max]); 43002 return pitPoints; 43003 } 43004 ) 43005 // creates an array of values where the slider should snap to 43006 }, { 43007 key: "computeSnapPoints", 43008 value: function computeSnapPoints(_ref3) { 43009 var min = _ref3.min, max = _ref3.max, step = _ref3.step; 43010 if (!step) return void 0; 43011 return [].concat(_toConsumableArray(range$1({ 43012 start: min, 43013 end: max, 43014 step 43015 })), [max]); 43016 } 43017 }, { 43018 key: "render", 43019 value: function render6() { 43020 var _this$props = this.props, tooltips = _this$props.tooltips, step = _this$props.step, pips = _this$props.pips, values = _this$props.values, cssClasse
43020s = _this$props.cssClasses; 43021 var _ref42 = this.isDisabled ? { 43022 min: this.props.min, 43023 max: this.props.max + 1e-3 43024 } : this.props, min = _ref42.min, max = _ref42.max; 43025 var snapPoints = this.computeSnapPoints({ 43026 min, 43027 max, 43028 step 43029 }); 43030 var pitPoints = pips === false ? [] : this.computeDefaultPitPoints({ 43031 min, 43032 max 43033 }); 43034 return _$1("div", { 43035 className: cx(cssClasses.root, this.isDisabled && cssClasses.disabledRoot) 43036 }, _$1(Rheostat, { 43037 handle: this.createHandleComponent(tooltips), 43038 onChange: this.handleChange, 43039 min, 43040 max, 43041 pitComponent: Pit, 43042 pitPoints, 43043 snap: true, 43044 snapPoints, 43045 values: this.isDisabled ? [min, max] : values, 43046 disabled: this.isDisabled 43047 })); 43048 } 43049 }]); 43050 return Slider2; 43051}(k$2); 43052function _typeof$6(obj) { 43053 "@babel/helpers - typeof"; 43054 return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 43055 return typeof obj2; 43056 } : function(obj2) { 43057 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43058 }, _typeof$6(obj); 43059} 43060function ownKeys$6(object, enumerableOnly) { 43061 var keys = Object.keys(object); 43062 if (Object.getOwnPropertySymbols) { 43063 var symbols = Object.getOwnPropertySymbols(object); 43064 enumerableOnly && (symbols = symbols.filter(function(sym) { 43065 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43066 })), keys.push.apply(keys, symbols); 43067 } 43068 return keys; 43069} 43070function _objectSpread$6(target) { 43071 for (var i2 = 1; i2 < arguments.length; i2++) { 43072 var source = null != arguments[i2] ? arguments[i2] : {}; 43073 i2 % 2 ? ownKeys$6(Object(source), true).forEach(function(key2) { 43074 _defineProperty$6(target, key2, source[key2]); 43075 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function(key2) { 43076 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 43077 }); 43078 } 43079 return target; 43080} 43081function _defineProperty$6(obj, key2, value) { 43082 key2 = _toPropertyKey$6(key2); 43083 if (key2 in obj) { 43084 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 43085 } else { 43086 obj[key2] = value; 43087 } 43088 return obj; 43089} 43090function _toPropertyKey$6(arg) { 43091 var key2 = _toPrimitive$6(arg, "string"); 43092 return _typeof$6(key2) === "symbol" ? key2 : String(key2); 43093} 43094function _toPrimitive$6(input, hint) { 43095 if (_typeof$6(input) !== "object" || input === null) return input; 43096 var prim = input[Symbol.toPrimitive]; 43097 if (prim !== void 0) { 43098 var res = prim.call(input, hint || "default"); 43099 if (_typeof$6(res) !== "object") return res; 43100 throw new TypeError("@@toPrimitive must return a primitive value."); 43101 } 43102 return (hint === "string" ? String : Number)(input); 43103} 43104function _slicedToArray(arr, i2) { 43105 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest(); 43106} 43107function _nonIterableRest() { 43108 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 43109} 43110function _unsupportedIterableToArray(o2, minLen) { 43111 if (!o2) return; 43112 if (typeof o2 === "string") return _arrayLikeToArray(o2, minLen); 43113 var n2 = Object.prototype.toString.call(o2).slice(8, -1); 43114 if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; 43115 if (n2 === "Map" || n2 === "Set") return Array.from(o2); 43116 if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray(o2, minLen); 43117} 43118function _arrayLikeToArray(arr, len2) { 43119 if (len2 == null || len2 > arr.length) len2 = arr.length; 43120 for (var i2 = 0, arr2 = new Array(len2); i2 < len2; i2++) arr2[i2] = arr[i2]; 43121 return arr2; 43122} 43123function _iterableToArrayLimit(arr, i2) { 43124 var _i2 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 43125 if (null != _i2) { 43126 var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
43127 try { 43128 if (_x = (_i2 = _i2.call(arr)).next, 0 === i2) ; 43129 else for (; !(_n = (_s = _x.call(_i2)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) ; 43130 } catch (err) { 43131 _d = true, _e = err; 43132 } finally { 43133 try { 43134 if (!_n && null != _i2.return && (_r = _i2.return(), Object(_r) !== _r)) return; 43135 } finally { 43136 if (_d) throw _e; 43137 } 43138 } 43139 return _arr; 43140 } 43141} 43142function _arrayWithHoles(arr) { 43143 if (Array.isArray(arr)) return arr; 43144} 43145var withUsage$6 = createDocumentationMessageGenerator({ 43146 name: "range-slider" 43147}); 43148var suit$3 = component("RangeSlider"); 43149var renderer$3 = function renderer4(_ref) { 43150 var containerNode = _ref.containerNode, cssClasses = _ref.cssClasses, pips = _ref.pips, step = _ref.step, tooltips = _ref.tooltips; 43151 return function(_ref22, isFirstRendering) { 43152 var refine = _ref22.refine, range2 = _ref22.range, start2 = _ref22.start; 43153 if (isFirstRendering) { 43154 return; 43155 } 43156 var minRange = range2.min, maxRange = range2.max; 43157 var _start = _slicedToArray(start2, 2), minStart = _start[0], maxStart = _start[1]; 43158 var minFinite = minStart === -Infinity ? minRange : minStart; 43159 var maxFinite = maxStart === Infinity ? maxRange : maxStart; 43160 var values = [minFinite > maxRange ? maxRange : minFinite, maxFinite < minRange ? minRange : maxFinite]; 43161 B$1(_$1(Slider, { 43162 cssClasses, 43163 refine, 43164 min: minRange, 43165 max: maxRange, 43166 values, 43167 tooltips, 43168 step, 43169 pips 43170 }), containerNode); 43171 }; 43172}; 43173var rangeSlider = function rangeSlider2(widgetParams) { 43174 var _ref3 = widgetParams || {}, container = _ref3.container, attribute = _ref3.attribute, min = _ref3.min, max = _ref3.max, _ref3$cssClasses = _ref3.cssClasses, userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses, step = _ref3.step, _ref3$pips = _ref3.pips, pips = _ref3$pips === void 0 ? true : _ref3$pips, _ref3$precision = _ref3.precision, precision = _ref3$precision === void 0 ? 0 : _ref3$precision, _ref3$tooltips = _ref3.tooltips, tooltips = _ref3$tooltips === void 0 ? true : _ref3$tooltips; 43175 if (!container) { 43176 throw new Error(withUsage$6("The `container` option is required.")); 43177 } 43178 var containerNode = getContainerNode(container);
43179 var cssClasses = { 43180 root: cx(suit$3(), userCssClasses.root), 43181 disabledRoot: cx(suit$3({ 43182 modifierName: "disabled" 43183 }), userCssClasses.disabledRoot) 43184 }; 43185 var specializedRenderer = renderer$3({ 43186 containerNode, 43187 step, 43188 pips, 43189 tooltips, 43190 cssClasses 43191 }); 43192 var makeWidget = connectRange(specializedRenderer, function() { 43193 return B$1(null, containerNode); 43194 }); 43195 return _objectSpread$6(_objectSpread$6({}, makeWidget({ 43196 attribute, 43197 min, 43198 max, 43199 precision 43200 })), {}, { 43201 $$type: "ais.rangeSlider", 43202 $$widgetType: "ais.rangeSlider" 43203 }); 43204}; 43205function _typeof$5(obj) { 43206 "@babel/helpers - typeof"; 43207 return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 43208 return typeof obj2; 43209 } : function(obj2) { 43210 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43211 }, _typeof$5(obj); 43212} 43213var _excluded = ["name", "escapedValue"], _excluded2 = ["escapedValue", "value"]; 43214function ownKeys$5(object, enumerableOnly) { 43215 var keys = Object.keys(object); 43216 if (Object.getOwnPropertySymbols) { 43217 var symbols = Object.getOwnPropertySymbols(object); 43218 enumerableOnly && (symbols = symbols.filter(function(sym) { 43219 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43220 })), keys.push.apply(keys, symbols); 43221 } 43222 return keys; 43223} 43224function _objectSpread$5(target) { 43225 for (var i2 = 1; i2 < arguments.length; i2++) { 43226 var source = null != arguments[i2] ? arguments[i2] : {}; 43227 i2 % 2 ? ownKeys$5(Object(source), true).forEach(function(key2) { 43228 _defineProperty$5(target, key2, source[key2]); 43229 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function(key2) { 43230 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 43231 }); 43232 } 43233 return target; 43234} 43235function _defineProperty$5(obj, key2, value) { 43236 key2 = _toPropertyKey$5(key2); 43237 if (key2 in obj) { 43238 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 43239 } else { 43240 obj[key2] = value; 43241 } 43242 return obj; 43243} 43244function _toPropertyKey$5(arg) { 43245 var key2 = _toPrimitive$5(arg, "string"); 43246 return _typeof$5(key2) === "symbol" ? key2 : String(key2); 43247} 43248function _toPrimitive$5(input, hint) { 43249 if (_typeof$5(input) !== "object" || input === null) return input; 43250 var prim = input[Symbol.toPrimitive]; 43251 if (prim !== void 0) { 43252 var res = prim.call(input, hint || "default"); 43253 if (_typeof$5(res) !== "object") return res; 43254 throw new TypeError("@@toPrimitive must return a primitive value."); 43255 } 43256 return (hint === "string" ? String : Number)(input); 43257} 43258function _objectWithoutProperties(source, excluded) { 43259 if (source == null) return {}; 43260 var target = _objectWithoutPropertiesLoose(source, excluded); 43261 var key2, i2; 43262 if (Object.getOwnPropertySymbols) { 43263 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 43264 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { 43265 key2 = sourceSymbolKeys[i2]; 43266 if (excluded.indexOf(key2) >= 0) continue; 43267 if (!Object.prototype.propertyIsEnumerable.call(source, key2)) continue; 43268 target[key2] = source[key2]; 43269 } 43270 } 43271 return target; 43272} 43273function _objectWithoutPropertiesLoose(source, excluded) { 43274 if (source == null) return {}; 43275 var target = {}; 43276 var sourceKeys = Object.keys(source); 43277 var key2, i2; 43278 for (i2 = 0; i2 < sourceKeys.length; i2++) { 43279 key2 = sourceKeys[i2]; 43280 if (excluded.indexOf(key2) >= 0) continue; 43281 target[key2] = source[key2]; 43282 } 43283 return target; 43284} 43285var withUsage$5 = createDocumentationMessageGenerator({ 43286 name: "refinement-list", 43287 connector: true 43288}); 43289var DEFAULT_SORT = ["isRefined", "count:desc", "name:asc"]; 43290var connectRefinementList = function connectRefinementList2(renderFn) { 43291 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 43292 checkRendering(renderFn, withUsage$5()); 43293 return function(widgetParams) { 43294 var _ref = widgetParams || {}, attribute = _ref.attribute, _ref$operator = _ref.operator, operator = _ref$operator === void 0 ? "or" : _ref$operator, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? 10 : _ref$limit, _ref$showMore = _ref.showMore, showMore = _ref$showMore === void 0 ? false : _ref$showMore, _ref$showMoreLimit = _ref.showMoreLimit, showMoreLimit = _ref$showMoreLimit === void 0 ? 20 : _ref$showMoreLimit, _ref$sortBy = _ref.sortBy, sortBy3 = _ref$sortBy === void 0 ? DEFAULT_SORT : _ref$sortBy, _ref$escapeFacetValue = _ref.escapeFacetValues, escapeFacetValues = _ref$escapeFacetValue === void 0 ? true : _ref$escapeFacetValue, _ref$transformItems = _ref.transformItems, transformItems = _ref$transformItems === void 0 ? function(items) { 43295 return items; 43296 } : _ref$transformItems; 43297 if (!attribute) { 43298 throw new Error(withUsage$5("The `attribute` option is required.")); 43299 } 43300 if (!/^(and|or)$/.test(operator)) { 43301 throw new Error(withUsage$5('The `operator` must one of: `"and"`, `"or"` (got "'.concat(operator, '").'))); 43302 } 43303 if (showMore === true && showMoreLimit <= limit) { 43304 throw new Error(withUsage$5("`showMoreLimit` should be greater than `limit`.")); 43305 } 43306 var formatItems = function formatItems2(_ref22) { 43307 var label = _ref22.name, value = _ref22.escapedValue, item3 = _objectWithoutProperties(_ref22, _excluded); 43308 return _objectSpread$5(_objectSpread$5({}, item3), {}, { 43309 value, 43310 label, 43311 highlighted: label 43312 }); 43313 }; 43314 var lastResultsFromMainSearch; 43315 var lastItemsFromMainSearch = []; 43316 var hasExhaustiveItems = true; 43317 var triggerRefine; 43318 var sendEvent; 43319 var isShowingMore = false;
vendor: 10,672 bytes, lines 43320-43546
43320 var toggleShowMore = function toggleShowMore2() { 43321 }; 43322 function cachedToggleShowMore() { 43323 toggleShowMore(); 43324 } 43325 function createToggleShowMore(renderOptions, widget) { 43326 return function() { 43327 isShowingMore = !isShowingMore; 43328 widget.render(renderOptions); 43329 }; 43330 } 43331 function getLimit() { 43332 return isShowingMore ? showMoreLimit : limit; 43333 } 43334 var searchForFacetValues = function searchForFacetValues2() { 43335 return function() { 43336 }; 43337 }; 43338 var createSearchForFacetValues = function createSearchForFacetValues2(helper, widget) { 43339 return function(renderOptions) { 43340 return function(query) { 43341 var instantSearchInstance = renderOptions.instantSearchInstance, searchResults = renderOptions.results; 43342 if (query === "" && lastItemsFromMainSearch) { 43343 renderFn(_objectSpread$5(_objectSpread$5({}, widget.getWidgetRenderState(_objectSpread$5(_objectSpread$5({}, renderOptions), {}, { 43344 results: lastResultsFromMainSearch 43345 }))), {}, { 43346 instantSearchInstance 43347 }), false); 43348 } else { 43349 var tags = { 43350 highlightPreTag: escapeFacetValues ? TAG_PLACEHOLDER.highlightPreTag : TAG_REPLACEMENT.highlightPreTag, 43351 highlightPostTag: escapeFacetValues ? TAG_PLACEHOLDER.highlightPostTag : TAG_REPLACEMENT.highlightPostTag 43352 }; 43353 helper.searchForFacetValues( 43354 attribute, 43355 query, 43356 // We cap the `maxFacetHits` value to 100 because the Algolia API 43357 // doesn't support a greater number. 43358 // See https://www.algolia.com/doc/api-reference/api-parameters/maxFacetHits/ 43359 Math.min(getLimit(), 100), 43360 tags 43361 ).then(function(results) { 43362 var facetValues = escapeFacetValues ? escapeFacets(results.facetHits) : results.facetHits; 43363 var normalizedFacetValues = transformItems(facetValues.map(function(_ref3) { 43364 var escapedValue = _ref3.escapedValue, value = _ref3.value, item3 = _objectWithoutProperties(_ref3, _excluded2); 43365 return _objectSpread$5(_objectSpread$5({}, item3), {}, { 43366 value: escapedValue, 43367 label: value 43368 }); 43369 }), { 43370 results: searchResults 43371 }); 43372 renderFn(_objectSpread$5(_objectSpread$5({}, widget.getWidgetRenderState(_objectSpread$5(_objectSpread$5({}, renderOptions), {}, { 43373 results: lastResultsFromMainSearch 43374 }))), {}, { 43375 items: normalizedFacetValues, 43376 canToggleShowMore: false, 43377 canRefine: true, 43378 isFromSearch: true, 43379 instantSearchInstance 43380 }), false); 43381 }); 43382 } 43383 }; 43384 }; 43385 }; 43386 return { 43387 $$type: "ais.refinementList", 43388 init: function init7(initOptions) { 43389 renderFn(_objectSpread$5(_objectSpread$5({}, this.getWidgetRenderState(initOptions)), {}, { 43390 instantSearchInstance: initOptions.instantSearchInstance 43391 }), true); 43392 }, 43393 render: function render6(renderOptions) { 43394 renderFn(_objectSpread$5(_objectSpread$5({}, this.getWidgetRenderState(renderOptions)), {}, { 43395 instantSearchInstance: renderOptions.instantSearchInstance 43396 }), false); 43397 }, 43398 getRenderState: function getRenderState(renderState, renderOptions) { 43399 return _objectSpread$5(_objectSpread$5({}, renderState), {}, { 43400 refinementList: _objectSpread$5(_objectSpread$5({}, renderState.refinementList), {}, _defineProperty$5({}, attribute, this.getWidgetRenderState(renderOptions))) 43401 }); 43402 }, 43403 getWidgetRenderState: function getWidgetRenderState(renderOptions) { 43404 var _this = this; 43405 var results = renderOptions.results, state = renderOptions.state, _createURL = renderOptions.createURL, instantSearchInstance = renderOptions.instantSearchInstance, helper = renderOptions.helper; 43406 var items = []; 43407 var facetValues = []; 43408 if (!sendEvent || !triggerRefine || !searchForFacetValues) { 43409 sendEvent = createSendEventForFacet({ 43410 instantSearchInstance, 43411 helper, 43412 attribute, 43413 widgetType: this.$$type 43414 }); 43415 triggerRefine = function triggerRefine2(facetValue) { 43416 sendEvent("click:internal", facetValue); 43417 helper.toggleFacetRefinement(attribute, facetValue).search(); 43418 }; 43419 searchForFacetValues = createSearchForFacetValues(helper, this); 43420 } 43421 if (results) { 43422 var values = results.getFacetValues(attribute, { 43423 sortBy: sortBy3, 43424 facetOrdering: sortBy3 === DEFAULT_SORT 43425 }); 43426 facetValues = values && Array.isArray(values) ? values : []; 43427 items = transformItems(facetValues.slice(0, getLimit()).map(formatItems), { 43428 results 43429 }); 43430 var maxValuesPerFacetConfig = state.maxValuesPerFacet; 43431 var currentLimit = getLimit(); 43432 hasExhaustiveItems = maxValuesPerFacetConfig > currentLimit ? facetValues.length <= currentLimit : facetValues.length < currentLimit; 43433 lastResultsFromMainSearch = results; 43434 lastItemsFromMainSearch = items; 43435 if (renderOptions.results) { 43436 toggleShowMore = createToggleShowMore(renderOptions, this); 43437 } 43438 } 43439 var searchFacetValues = searchForFacetValues && searchForFacetValues(renderOptions); 43440 var canShowLess = isShowingMore && lastItemsFromMainSearch.length > limit; 43441 var canShowMore = showMore && !hasExhaustiveItems; 43442 var canToggleShowMore = canShowLess || canShowMore; 43443 return { 43444 createURL: function createURL(facetValue) { 43445 return _createURL(function(uiState) { 43446 return _this.getWidgetUiState(uiState, { 43447 searchParameters: state.resetPage().toggleFacetRefinement(attribute, facetValue), 43448 helper 43449 }); 43450 }); 43451 }, 43452 items, 43453 refine: triggerRefine, 43454 searchForItems: searchFacetValues, 43455 isFromSearch: false, 43456 canRefine: items.length > 0, 43457 widgetParams, 43458 isShowingMore, 43459 canToggleShowMore, 43460 toggleShowMore: cachedToggleShowMore, 43461 sendEvent, 43462 hasExhaustiveItems 43463 }; 43464 }, 43465 dispose: function dispose(_ref42) { 43466 var state = _ref42.state; 43467 unmountFn(); 43468 var withoutMaxValuesPerFacet = state.setQueryParameter("maxValuesPerFacet", void 0); 43469 if (operator === "and") { 43470 return withoutMaxValuesPerFacet.removeFacet(attribute); 43471 } 43472 return withoutMaxValuesPerFacet.removeDisjunctiveFacet(attribute); 43473 }, 43474 getWidgetUiState: function getWidgetUiState(uiState, _ref5) { 43475 var searchParameters = _ref5.searchParameters; 43476 var values = operator === "or" ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute); 43477 return removeEmptyRefinementsFromUiState(_objectSpread$5(_objectSpread$5({}, uiState), {}, { 43478 refinementList: _objectSpread$5(_objectSpread$5({}, uiState.refinementList), {}, _defineProperty$5({}, attribute, values)) 43479 }), attribute); 43480 }, 43481 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref62) { 43482 var uiState = _ref62.uiState; 43483 var isDisjunctive = operator === "or"; 43484 if (searchParameters.isHierarchicalFacet(attribute)) { 43485 return searchParameters; 43486 } 43487 if (isDisjunctive && searchParameters.isConjunctiveFacet(attribute) || !isDisjunctive && searchParameters.isDisjunctiveFacet(attribute)) { 43488 return searchParameters; 43489 } 43490 var values = uiState.refinementList && uiState.refinementList[attribute]; 43491 var withFacetConfiguration = isDisjunctive ? searchParameters.addDisjunctiveFacet(attribute).removeDisjunctiveFacetRefinement(attribute) : searchParameters.addFacet(attribute).removeFacetRefinement(attribute); 43492 var currentMaxValuesPerFacet = withFacetConfiguration.maxValuesPerFacet || 0; 43493 var nextMaxValuesPerFacet = Math.max(currentMaxValuesPerFacet, showMore ? showMoreLimit : limit); 43494 var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter("maxValuesPerFacet", nextMaxValuesPerFacet); 43495 if (!values) { 43496 var key2 = isDisjunctive ? "disjunctiveFacetsRefinements" : "facetsRefinements"; 43497 return withMaxValuesPerFacet.setQueryParameters(_defineProperty$5({}, key2, _objectSpread$5(_objectSpread$5({}, withMaxValuesPerFacet[key2]), {}, _defineProperty$5({}, attribute, [])))); 43498 } 43499 return values.reduce(function(parameters, value) { 43500 return isDisjunctive ? parameters.addDisjunctiveFacetRefinement(attribute, value) : parameters.addFacetRefinement(attribute, value); 43501 }, withMaxValuesPerFacet); 43502 } 43503 }; 43504 }; 43505}; 43506function removeEmptyRefinementsFromUiState(indexUiState, attribute) { 43507 if (!indexUiState.refinementList) { 43508 return indexUiState; 43509 } 43510 if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) { 43511 delete indexUiState.refinementList[attribute]; 43512 } 43513 if (Object.keys(indexUiState.refinementList).length === 0) { 43514 delete indexUiState.refinementList; 43515 } 43516 return indexUiState; 43517} 43518var _ref2 = _$1("path", { 43519 d: "M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z" 43520}); 43521var _ref4 = _$1("path", { 43522 d: "M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z" 43523}); 43524var _ref6 = _$1("g", { 43525 fill: "none", 43526 "fill-rule": "evenodd" 43527}, _$1("g", { 43528 transform: "translate(1 1)", 43529 "stroke-width": "2" 43530}, _$1("circle", { 43531 "stroke-opacity": ".5", 43532 cx: "18", 43533 cy: "18", 43534 r: "18" 43535}), _$1("path", { 43536 d: "M36 18c0-9.94-8.06-18-18-18" 43537}, _$1("animateTransform", { 43538 attributeName: "transform", 43539 type: "rotate", 43540 from: "0 18 18", 43541 to: "360 18 18", 43542 dur: "1s", 43543 repeatCount: "indefinite" 43544})))); 43545var defaultTemplate = { 43546 reset: function reset(_ref) {
43547 var cssClasses = _ref.cssClasses; 43548 return _$1("svg", { 43549 className: cssClasses.resetIcon, 43550 viewBox: "0 0 20 20", 43551 width: "10", 43552 height: "10", 43553 "aria-hidden": "true" 43554 }, _ref2); 43555 }, 43556 submit: function submit(_ref3) { 43557 var cssClasses = _ref3.cssClasses; 43558 return _$1("svg", { 43559 className: cssClasses.submitIcon, 43560 width: "10", 43561 height: "10", 43562 viewBox: "0 0 40 40", 43563 "aria-hidden": "true" 43564 }, _ref4); 43565 }, 43566 loadingIndicator: function loadingIndicator(_ref5) { 43567 var cssClasses = _ref5.cssClasses; 43568 return _$1("svg", { 43569 "aria-label": "Results are loading", 43570 className: cssClasses.loadingIcon, 43571 width: "16", 43572 height: "16", 43573 viewBox: "0 0 38 38", 43574 stroke: "#444", 43575 "aria-hidden": "true" 43576 }, _ref6); 43577 } 43578}; 43579var defaultTemplates = { 43580 item: function item2(_ref) { 43581 var cssClasses = _ref.cssClasses, count = _ref.count, value = _ref.value, highlighted = _ref.highlighted, isRefined2 = _ref.isRefined, isFromSearch = _ref.isFromSearch; 43582 return _$1("label", { 43583 className: cx(cssClasses.label) 43584 }, _$1("input", { 43585 type: "checkbox", 43586 className: cx(cssClasses.checkbox), 43587 value, 43588 defaultChecked: isRefined2 43589 }), _$1("span", { 43590 className: cx(cssClasses.labelText), 43591 dangerouslySetInnerHTML: isFromSearch ? { 43592 __html: highlighted 43593 } : void 0 43594 }, !isFromSearch && highlighted), _$1("span", { 43595 className: cx(cssClasses.count) 43596 }, formatNumber(count))); 43597 }, 43598 showMoreText: function showMoreText(_ref22) { 43599 var isShowingMore = _ref22.isShowingMore; 43600 return isShowingMore ? "Show less" : "Show more"; 43601 }, 43602 searchableNoResults: function searchableNoResults() { 43603 return "No results"; 43604 } 43605}; 43606function _typeof$4(obj) { 43607 "@babel/helpers - typeof"; 43608 return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 43609 return typeof obj2; 43610 } : function(obj2) { 43611 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43612 }, _typeof$4(obj); 43613} 43614function ownKeys$4(object, enumerableOnly) { 43615 var keys = Object.keys(object); 43616 if (Object.getOwnPropertySymbols) { 43617 var symbols = Object.getOwnPropertySymbols(object); 43618 enumerableOnly && (symbols = symbols.filter(function(sym) { 43619 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43620 })), keys.push.apply(keys, symbols); 43621 } 43622 return keys; 43623} 43624function _objectSpread$4(target) { 43625 for (var i2 = 1; i2 < arguments.length; i2++) { 43626 var source = null != arguments[i2] ? arguments[i2] : {}; 43627 i2 % 2 ? ownKeys$4(Object(source), true).forEach(function(key2) { 43628 _defineProperty$4(target, key2, source[key2]); 43629 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function(key2) { 43630 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 43631 }); 43632 } 43633 return target; 43634} 43635function _defineProperty$4(obj, key2, value) { 43636 key2 = _toPropertyKey$4(key2); 43637 if (key2 in obj) { 43638 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 43639 } else { 43640 obj[key2] = value; 43641 } 43642 return obj; 43643} 43644function _toPropertyKey$4(arg) { 43645 var key2 = _toPrimitive$4(arg, "string"); 43646 return _typeof$4(key2) === "symbol" ? key2 : String(key2); 43647} 43648function _toPrimitive$4(input, hint) { 43649 if (_typeof$4(input) !== "object" || input === null) return input; 43650 var prim = input[Symbol.toPrimitive]; 43651 if (prim !== void 0) { 43652 var res = prim.call(input, hint || "default"); 43653 if (_typeof$4(res) !== "object") return res; 43654 throw new TypeError("@@toPrimitive must return a primitive value."); 43655 } 43656 return (hint === "string" ? String : Number)(input); 43657} 43658var withUsage$4 = createDocumentationMessageGenerator({ 43659 name: "refinement-list" 43660}); 43661var suit$2 = component("RefinementList"); 43662var searchBoxSuit = component("SearchBox"); 43663var renderer$2 = function renderer5(_ref) {
43664 var containerNode = _ref.containerNode, cssClasses = _ref.cssClasses, templates = _ref.templates, searchBoxTemplates = _ref.searchBoxTemplates, renderState = _ref.renderState, showMore = _ref.showMore, searchable = _ref.searchable, searchablePlaceholder = _ref.searchablePlaceholder, searchableIsAlwaysActive = _ref.searchableIsAlwaysActive; 43665 return function(_ref22, isFirstRendering) { 43666 var refine = _ref22.refine, items = _ref22.items, createURL = _ref22.createURL, searchForItems = _ref22.searchForItems, isFromSearch = _ref22.isFromSearch, instantSearchInstance = _ref22.instantSearchInstance, toggleShowMore = _ref22.toggleShowMore, isShowingMore = _ref22.isShowingMore, hasExhaustiveItems = _ref22.hasExhaustiveItems, canToggleShowMore = _ref22.canToggleShowMore; 43667 if (isFirstRendering) { 43668 renderState.templateProps = prepareTemplateProps({ 43669 defaultTemplates, 43670 templatesConfig: instantSearchInstance.templatesConfig, 43671 templates 43672 }); 43673 renderState.searchBoxTemplateProps = prepareTemplateProps({ 43674 defaultTemplates: defaultTemplate, 43675 templatesConfig: instantSearchInstance.templatesConfig, 43676 templates: searchBoxTemplates 43677 }); 43678 return; 43679 } 43680 B$1(_$1(RefinementList, { 43681 createURL, 43682 cssClasses, 43683 facetValues: items, 43684 templateProps: renderState.templateProps, 43685 searchBoxTemplateProps: renderState.searchBoxTemplateProps, 43686 toggleRefinement: refine, 43687 searchFacetValues: searchable ? searchForItems : void 0, 43688 searchPlaceholder: searchablePlaceholder, 43689 searchIsAlwaysActive: searchableIsAlwaysActive, 43690 isFromSearch, 43691 showMore: showMore && !isFromSearch && items.length > 0, 43692 toggleShowMore, 43693 isShowingMore, 43694 hasExhaustiveItems, 43695 canToggleShowMore 43696 }), containerNode); 43697 }; 43698}; 43699var refinementList = function refinementList2(widgetParams) { 43700 var _ref3 = widgetParams || {}, container = _ref3.container, attribute = _ref3.attribute, operator = _ref3.operator, sortBy3 = _ref3.sortBy, limit = _ref3.limit, showMore = _ref3.showMore, showMoreLimit = _ref3.showMoreLimit, _ref3$searchable = _ref3.searchable, searchable = _ref3$searchable === void 0 ? false : _ref3$searchable, _ref3$searchablePlace = _ref3.searchablePlaceholder, searchablePlaceholder = _ref3$searchablePlace === void 0 ? "Search..." : _ref3$searchablePlace, _ref3$searchableEscap = _ref3.searchableEscapeFacetValues, searchableEscapeFacetValues = _ref3$searchableEscap === void 0 ? true : _ref3$searchableEscap, _ref3$searchableIsAlw = _ref3.searchableIsAlwaysActive, searchableIsAlwaysActive = _ref3$searchableIsAlw === void 0 ? true : _ref3$searchableIsAlw, _ref3$cssClasses = _ref3.cssClasses, userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses, _ref3$templates = _ref3.templates, templates = _ref3$templates === void 0 ? {} : _ref3$templates, transformItems = _ref3.transformItems; 43701 if (!container) { 43702 throw new Error(withUsage$4("The `container` option is required.")); 43703 } 43704 var escapeFacetValues = searchable ? Boolean(searchableEscapeFacetValues) : false; 43705 var containerNode = getContainerNode(container);
43706 var cssClasses = { 43707 root: cx(suit$2(), userCssClasses.root), 43708 noRefinementRoot: cx(suit$2({ 43709 modifierName: "noRefinement" 43710 }), userCssClasses.noRefinementRoot), 43711 list: cx(suit$2({ 43712 descendantName: "list" 43713 }), userCssClasses.list), 43714 item: cx(suit$2({ 43715 descendantName: "item" 43716 }), userCssClasses.item), 43717 selectedItem: cx(suit$2({ 43718 descendantName: "item", 43719 modifierName: "selected" 43720 }), userCssClasses.selectedItem), 43721 searchBox: cx(suit$2({ 43722 descendantName: "searchBox" 43723 }), userCssClasses.searchBox), 43724 label: cx(suit$2({ 43725 descendantName: "label" 43726 }), userCssClasses.label), 43727 checkbox: cx(suit$2({ 43728 descendantName: "checkbox" 43729 }), userCssClasses.checkbox), 43730 labelText: cx(suit$2({ 43731 descendantName: "labelText" 43732 }), userCssClasses.labelText), 43733 count: cx(suit$2({ 43734 descendantName: "count" 43735 }), userCssClasses.count), 43736 noResults: cx(suit$2({ 43737 descendantName: "noResults" 43738 }), userCssClasses.noResults), 43739 showMore: cx(suit$2({ 43740 descendantName: "showMore" 43741 }), userCssClasses.showMore), 43742 disabledShowMore: cx(suit$2({ 43743 descendantName: "showMore", 43744 modifierName: "disabled" 43745 }), userCssClasses.disabledShowMore), 43746 searchable: { 43747 root: cx(searchBoxSuit(), userCssClasses.searchableRoot), 43748 form: cx(searchBoxSuit({ 43749 descendantName: "form" 43750 }), userCssClasses.searchableForm), 43751 input: cx(searchBoxSuit({ 43752 descendantName: "input" 43753 }), userCssClasses.searchableInput), 43754 submit: cx(searchBoxSuit({ 43755 descendantName: "submit" 43756 }), userCssClasses.searchableSubmit), 43757 submitIcon: cx(searchBoxSuit({ 43758 descendantName: "submitIcon" 43759 }), userCssClasses.searchableSubmitIcon), 43760 reset: cx(searchBoxSuit({ 43761 descendantName: "reset" 43762 }), userCssClasses.searchableReset), 43763 resetIcon: cx(searchBoxSuit({ 43764 descendantName: "resetIcon" 43765 }), userCssClasses.searchableResetIcon), 43766 loadingIndicator: cx(searchBoxSuit({ 43767 descendantName: "loadingIndicator" 43768 }), userCssClasses.searchableLoadingIndicator), 43769 loadingIcon: cx(searchBoxSuit({ 43770 descendantName: "loadingIcon" 43771 }), userCssClasses.searchableLoadingIcon) 43772 } 43773 }; 43774 var specializedRenderer = renderer$2({ 43775 containerNode, 43776 cssClasses, 43777 templates, 43778 searchBoxTemplates: { 43779 submit: templates.searchableSubmit, 43780 reset: templates.searchableReset, 43781 loadingIndicator: templates.searchableLoadingIndicator 43782 }, 43783 renderState: {}, 43784 searchable, 43785 searchablePlaceholder, 43786 searchableIsAlwaysActive, 43787 showMore 43788 }); 43789 var makeWidget = connectRefinementList(specializedRenderer, function() { 43790 return B$1(null, containerNode); 43791 }); 43792 return _objectSpread$4(_objectSpread$4({}, makeWidget({ 43793 attribute, 43794 operator, 43795 limit, 43796 showMore, 43797 showMoreLimit, 43798 sortBy: sortBy3, 43799 escapeFacetValues, 43800 transformItems 43801 })), {}, { 43802 $$widgetType: "ais.refinementList" 43803 }); 43804}; 43805function _typeof$3(obj) { 43806 "@babel/helpers - typeof"; 43807 return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 43808 return typeof obj2; 43809 } : function(obj2) { 43810 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43811 }, _typeof$3(obj); 43812} 43813function ownKeys$3(object, enumerableOnly) { 43814 var keys = Object.keys(object); 43815 if (Object.getOwnPropertySymbols) { 43816 var symbols = Object.getOwnPropertySymbols(object); 43817 enumerableOnly && (symbols = symbols.filter(function(sym) { 43818 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43819 })), keys.push.apply(keys, symbols); 43820 } 43821 return keys; 43822} 43823function _objectSpread$3(target) { 43824 for (var i2 = 1; i2 < arguments.length; i2++) { 43825 var source = null != arguments[i2] ? arguments[i2] : {}; 43826 i2 % 2 ? ownKeys$3(Object(source), true).forEach(function(key2) { 43827 _defineProperty$3(target, key2, source[key2]); 43828 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEac
43828h(function(key2) { 43829 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 43830 }); 43831 } 43832 return target; 43833} 43834function _defineProperty$3(obj, key2, value) { 43835 key2 = _toPropertyKey$3(key2); 43836 if (key2 in obj) { 43837 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 43838 } else { 43839 obj[key2] = value; 43840 } 43841 return obj; 43842} 43843function _toPropertyKey$3(arg) { 43844 var key2 = _toPrimitive$3(arg, "string"); 43845 return _typeof$3(key2) === "symbol" ? key2 : String(key2); 43846} 43847function _toPrimitive$3(input, hint) { 43848 if (_typeof$3(input) !== "object" || input === null) return input; 43849 var prim = input[Symbol.toPrimitive]; 43850 if (prim !== void 0) { 43851 var res = prim.call(input, hint || "default"); 43852 if (_typeof$3(res) !== "object") return res; 43853 throw new TypeError("@@toPrimitive must return a primitive value."); 43854 } 43855 return (hint === "string" ? String : Number)(input); 43856} 43857var withUsage$3 = createDocumentationMessageGenerator({ 43858 name: "search-box", 43859 connector: true 43860}); 43861var defaultQueryHook = function defaultQueryHook2(query, hook) { 43862 return hook(query); 43863}; 43864var connectSearchBox = function connectSearchBox2(renderFn) { 43865 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 43866 checkRendering(renderFn, withUsage$3()); 43867 return function(widgetParams) { 43868 var _ref = widgetParams || {}, _ref$queryHook = _ref.queryHook, queryHook = _ref$queryHook === void 0 ? defaultQueryHook : _ref$queryHook; 43869 var _refine; 43870 var _clear; 43871 return { 43872 $$type: "ais.searchBox", 43873 init: function init7(initOptions) { 43874 var instantSearchInstance = initOptions.instantSearchInstance; 43875 renderFn(_objectSpread$3(_objectSpread$3({}, this.getWidgetRenderState(initOptions)), {}, { 43876 instantSearchInstance 43877 }), true); 43878 }, 43879 render: function render6(renderOptions) { 43880 var instantSearchInstance = renderOptions.instantSearchInstance; 43881 renderFn(_objectSpread$3(_objectSpread$3({}, this.getWidgetRenderState(renderOptions)), {}, { 43882 instantSearchInstance 43883 }), false); 43884 }, 43885 dispose: function dispose(_ref22) { 43886 var state = _ref22.state; 43887 unmountFn(); 43888 return state.setQueryParameter("query", void 0); 43889 }, 43890 getRenderState: function getRenderState(renderState, renderOptions) { 43891 return _objectSpread$3(_objectSpread$3({}, renderState), {}, { 43892 searchBox: this.getWidgetRenderState(renderOptions) 43893 }); 43894 }, 43895 getWidgetRenderState: function getWidgetRenderState(_ref3) { 43896 var helper = _ref3.helper, instantSearchInstance = _ref3.instantSearchInstance, state = _ref3.state; 43897 if (!_refine) { 43898 _refine = function _refine2(query) { 43899 queryHook(query, function(q2) { 43900 return helper.setQuery(q2).search(); 43901 }); 43902 }; 43903 _clear = function _clear2() { 43904 helper.setQuery("").search(); 43905 }; 43906 } 43907 return { 43908 query: state.query || "", 43909 refine: _refine, 43910 clear: _clear, 43911 widgetParams, 43912 isSearchStalled: instantSearchInstance.status === "stalled" 43913 }; 43914 }, 43915 getWidgetUiState: function getWidgetUiState(uiState, _ref42) { 43916 var searchParameters = _ref42.searchParameters; 43917 var query = searchParameters.query || ""; 43918 if (query === "" || uiState && uiState.query === query) { 43919 return uiState; 43920 } 43921 return _objectSpread$3(_objectSpread$3({}, uiState), {}, { 43922 query 43923 }); 43924 }, 43925 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) { 43926 var uiState = _ref5.uiState; 43927 return searchParameters.setQueryParameter("query", uiState.query || ""); 43928 } 43929 }; 43930 }; 43931}; 43932function _typeof$2(obj) { 43933 "@babel/helpers - typeof"; 43934 return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 43935 return typeof obj2; 43936 } : function(obj2) { 43937 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43938 }, _typeof$2(obj); 43939} 43940function ownKeys$2(object, enumerableOnly) { 43941 var keys = Object.keys(object); 43942 if (Object.getOwnPropertySymbols) { 43943 var symbols = Object.getOwnPropertySymbols(object); 43944 enumerableOnly && (symbols = symbols.filter(function(sym) { 43945 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43946 })), keys.push.apply(keys, symbols); 43947 } 43948 return keys; 43949} 43950function _objectSpread$2(target) { 43951 for (var i2 = 1; i2 < arguments.length; i2++) { 43952 var source = null != arguments[i2] ? arguments[i2] : {}; 43953 i2 % 2 ? ownKeys$2(Object(source), true).forEach(function(key2) { 43954 _defineProperty$2(target, key2, source[key2]); 43955 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEac
43955h(function(key2) { 43956 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 43957 }); 43958 } 43959 return target; 43960} 43961function _defineProperty$2(obj, key2, value) { 43962 key2 = _toPropertyKey$2(key2); 43963 if (key2 in obj) { 43964 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 43965 } else { 43966 obj[key2] = value; 43967 } 43968 return obj; 43969} 43970function _toPropertyKey$2(arg) { 43971 var key2 = _toPrimitive$2(arg, "string"); 43972 return _typeof$2(key2) === "symbol" ? key2 : String(key2); 43973} 43974function _toPrimitive$2(input, hint) { 43975 if (_typeof$2(input) !== "object" || input === null) return input; 43976 var prim = input[Symbol.toPrimitive]; 43977 if (prim !== void 0) { 43978 var res = prim.call(input, hint || "default"); 43979 if (_typeof$2(res) !== "object") return res; 43980 throw new TypeError("@@toPrimitive must return a primitive value."); 43981 } 43982 return (hint === "string" ? String : Number)(input); 43983} 43984var withUsage$2 = createDocumentationMessageGenerator({ 43985 name: "search-box" 43986}); 43987var suit$1 = component("SearchBox"); 43988var renderer$1 = function renderer6(_ref) { 43989 var containerNode = _ref.containerNode, cssClasses = _ref.cssClasses, placeholder = _ref.placeholder, templates = _ref.templates, autofocus = _ref.autofocus, searchAsYouType = _ref.searchAsYouType, ignoreCompositionEvents = _ref.ignoreCompositionEvents, showReset = _ref.showReset, showSubmit = _ref.showSubmit, showLoadingIndicator = _ref.showLoadingIndicator; 43990 return function(_ref22) { 43991 var refine = _ref22.refine, query = _ref22.query, isSearchStalled = _ref22.isSearchStalled; 43992 B$1(_$1(SearchBox, { 43993 query, 43994 placeholder, 43995 autofocus, 43996 refine, 43997 searchAsYouType, 43998 ignoreCompositionEvents, 43999 templates, 44000 showSubmit, 44001 showReset, 44002 showLoadingIndicator, 44003 isSearchStalled, 44004 cssClasses 44005 }), containerNode); 44006 }; 44007}; 44008var searchBox = function searchBox2(widgetParams) { 44009 var _ref3 = widgetParams || {}, container = _ref3.container, _ref3$placeholder = _ref3.placeholder, placeholder = _ref3$placeholder === void 0 ? "" : _ref3$placeholder, _ref3$cssClasses = _ref3.cssClasses, userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses, _ref3$autofocus = _ref3.autofocus, autofocus = _ref3$autofocus === void 0 ? false : _ref3$autofocus, _ref3$searchAsYouType = _ref3.searchAsYouType, searchAsYouType = _ref3$searchAsYouType === void 0 ? true : _ref3$searchAsYouType, _ref3$ignoreCompositi = _ref3.ignoreCompositionEvents, ignoreCompositionEvents = _ref3$ignoreCompositi === void 0 ? false : _ref3$ignoreCompositi, _ref3$showReset = _ref3.showReset, showReset = _ref3$showReset === void 0 ? true : _ref3$showReset, _ref3$showSubmit = _ref3.showSubmit, showSubmit = _ref3$showSubmit === void 0 ? true : _ref3$showSubmit, _ref3$showLoadingIndi = _ref3.showLoadingIndicator, showLoadingIndicator = _ref3$showLoadingIndi === void 0 ? true : _ref3$showLoadingIndi, queryHook = _ref3.queryHook, _ref3$templates = _ref3.templates, userTemplates = _ref3$templates === void 0 ? {} : _ref3$templates; 44010 if (!container) { 44011 throw new Error(withUsage$2("The `container` option is required.")); 44012 } 44013 var containerNode = getContainerNode(container);
44014 var cssClasses = { 44015 root: cx(suit$1(), userCssClasses.root), 44016 form: cx(suit$1({ 44017 descendantName: "form" 44018 }), userCssClasses.form), 44019 input: cx(suit$1({ 44020 descendantName: "input" 44021 }), userCssClasses.input), 44022 submit: cx(suit$1({ 44023 descendantName: "submit" 44024 }), userCssClasses.submit), 44025 submitIcon: cx(suit$1({ 44026 descendantName: "submitIcon" 44027 }), userCssClasses.submitIcon), 44028 reset: cx(suit$1({ 44029 descendantName: "reset" 44030 }), userCssClasses.reset), 44031 resetIcon: cx(suit$1({ 44032 descendantName: "resetIcon" 44033 }), userCssClasses.resetIcon), 44034 loadingIndicator: cx(suit$1({ 44035 descendantName: "loadingIndicator" 44036 }), userCssClasses.loadingIndicator), 44037 loadingIcon: cx(suit$1({ 44038 descendantName: "loadingIcon" 44039 }), userCssClasses.loadingIcon) 44040 }; 44041 var templates = _objectSpread$2(_objectSpread$2({}, defaultTemplate), userTemplates); 44042 var specializedRenderer = renderer$1({ 44043 containerNode, 44044 cssClasses, 44045 placeholder, 44046 templates, 44047 autofocus, 44048 searchAsYouType, 44049 ignoreCompositionEvents, 44050 showReset, 44051 showSubmit, 44052 showLoadingIndicator 44053 }); 44054 var makeWidget = connectSearchBox(specializedRenderer, function() { 44055 return B$1(null, containerNode); 44056 }); 44057 return _objectSpread$2(_objectSpread$2({}, makeWidget({ 44058 queryHook 44059 })), {}, { 44060 $$widgetType: "ais.searchBox" 44061 }); 44062}; 44063function _typeof$1(obj) { 44064 "@babel/helpers - typeof"; 44065 return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 44066 return typeof obj2; 44067 } : function(obj2) { 44068 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 44069 }, _typeof$1(obj); 44070} 44071function ownKeys$1(object, enumerableOnly) { 44072 var keys = Object.keys(object); 44073 if (Object.getOwnPropertySymbols) { 44074 var symbols = Object.getOwnPropertySymbols(object); 44075 enumerableOnly && (symbols = symbols.filter(function(sym) { 44076 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 44077 })), keys.push.apply(keys, symbols); 44078 } 44079 return keys; 44080} 44081function _objectSpread$1(target) { 44082 for (var i2 = 1; i2 < arguments.length; i2++) { 44083 var source = null != arguments[i2] ? arguments[i2] : {}; 44084 i2 % 2 ? ownKeys$1(Object(source), true).forEach(function(key2) { 44085 _defineProperty$1(target, key2, source[key2]); 44086 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key2) { 44087 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 44088 }); 44089 } 44090 return target; 44091} 44092function _defineProperty$1(obj, key2, value) { 44093 key2 = _toPropertyKey$1(key2); 44094 if (key2 in obj) { 44095 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 44096 } else { 44097 obj[key2] = value; 44098 } 44099 return obj; 44100} 44101function _toPropertyKey$1(arg) { 44102 var key2 = _toPrimitive$1(arg, "string"); 44103 return _typeof$1(key2) === "symbol" ? key2 : String(key2); 44104} 44105function _toPrimitive$1(input, hint) { 44106 if (_typeof$1(input) !== "object" || input === null) return input; 44107 var prim = input[Symbol.toPrimitive]; 44108 if (prim !== void 0) { 44109 var res = prim.call(input, hint || "default"); 44110 if (_typeof$1(res) !== "object") return res; 44111 throw new TypeError("@@toPrimitive must return a primitive value."); 44112 } 44113 return (hint === "string" ? String : Number)(input); 44114} 44115var withUsage$1 = createDocumentationMessageGenerator({ 44116 name: "sort-by", 44117 connector: true 44118}); 44119var connectSortBy = function connectSortBy2(renderFn) { 44120 var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; 44121 checkRendering(renderFn, withUsage$1()); 44122 var connectorState = {}; 44123 return function(widgetParams) { 44124 var _ref = widgetParams || {}, items = _ref.items, _ref$transformItems = _ref.transformItems, transformItems = _ref$transformItems === void 0 ? function(x2) { 44125 return x2; 44126 } : _ref$transformItems; 44127 if (!Array.isArray(items)) { 44128 throw new Error(withUsage$1("The `items` option expects an array of objects.")); 44129 } 44130 return { 44131 $$type: "ais.sortBy", 44132 init: function init7(initOptions) { 44133 var instantSearchInstance = initOptions.instantSearchInstance; 44134 var widgetRenderState = this.getWidgetRenderState(initOptions); 44135 var currentIndex = widgetRenderState.currentRefinement; 44136 find$6(items, function(item3) { 44137 return item3.value === currentIndex; 44138 }); 44139 renderFn(_objectSpread$1(_objectSpread$1({}, widgetRenderState), {}, { 44140 instantSearchInstance 44141 }), true); 44142 }, 44143 render: function render6(renderOptions) { 44144 var instantSearchInstance = renderOptions.instantSearchInstance; 44145 renderFn(_objectSpread$1(_objectSpread$1({}, this.getWidgetRenderState(renderOptions)), {}, { 44146 instantSearchInstance 44147 }), false); 44148 }, 44149 dispose: function dispose(_ref22) { 44150 var state = _ref22.state; 44151 unmountFn(); 44152 return connectorState.initialIndex ? state.setIndex(connectorState.initialIndex) : state; 44153 }, 44154 getRenderState: function getRenderState(renderState, renderOptions) { 44155 return _objectSpread$1(_objectSpread$1({}, renderState), {}, { 44156 sortBy: this.getWidgetRenderState(renderOptions) 44157 }); 44158 }, 44159 getWidgetRenderState: function getWidgetRenderState(_ref3) { 44160 var results = _ref3.results, helper = _ref3.helper, state = _ref3.state, parent = _ref3.parent; 44161 if (!connectorState.initialIndex && parent) { 44162 connectorState.initialIndex = parent.getIndexName(); 44163 } 44164 if (!connectorState.setIndex) { 44165 connectorState.setIndex = function(indexName) { 44166 helper.setIndex(indexName).search(); 44167 }; 44168 } 44169 var hasNoResults = results ? results.nbHits === 0 : true; 44170 return { 44171 currentRefinement: state.index, 44172 options: transformItems(items, { 44173 results 44174 }), 44175 refine: connectorState.setIndex, 44176 hasNoResults, 44177 canRefine: !hasNoResults && items.length > 0, 44178 widgetParams 44179 }; 44180 }, 44181 getWidgetUiState: function getWidgetUiState(uiState, _ref42) { 44182 var searchParameters = _ref42.searchParameters; 44183 var currentIndex = searchParameters.index; 44184 return _objectSpread$1(_objectSpread$1({}, uiState), {}, { 44185 sortBy: currentIndex !== connectorState.initialIndex ? currentIndex : void 0 44186 }); 44187 }, 44188 getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) { 44189 var uiState = _ref5.uiState; 44190 return searchParameters.setQueryParameter("index", uiState.sortBy || connectorState.initialIndex || searchParameters.index); 44191 } 44192 }; 44193 }; 44194}; 44195function _typeof(obj) { 44196 "@babel/helpers - typeof"; 44197 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { 44198 return typeof obj2; 44199 } : function(obj2) { 44200 return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 44201 }, _typeof(obj); 44202} 44203function ownKeys(object, enumerableOnly) { 44204 var keys = Object.keys(object); 44205 if (Object.getOwnPropertySymbols) { 44206 var symbols = Object.getOwnPropertySymbols(object); 44207 enumerableOnly && (symbols = symbols.filter(function(sym) { 44208 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 44209 })), keys.push.apply(keys, symbols); 44210 } 44211 return keys; 44212} 44213function _objectSpread(target) { 44214 for (var i2 = 1; i2 < arguments.length; i2++) { 44215 var source = null != arguments[i2] ? arguments[i2] : {}; 44216 i2 % 2 ? ownKeys(Object(source), true).forEach(function(key2) { 44217 _defineProperty(target, key2, source[key2]); 44218 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEac
44218h(function(key2) { 44219 Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); 44220 }); 44221 } 44222 return target; 44223} 44224function _defineProperty(obj, key2, value) { 44225 key2 = _toPropertyKey(key2); 44226 if (key2 in obj) { 44227 Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); 44228 } else { 44229 obj[key2] = value; 44230 } 44231 return obj; 44232} 44233function _toPropertyKey(arg) { 44234 var key2 = _toPrimitive(arg, "string"); 44235 return _typeof(key2) === "symbol" ? key2 : String(key2); 44236} 44237function _toPrimitive(input, hint) { 44238 if (_typeof(input) !== "object" || input === null) return input; 44239 var prim = input[Symbol.toPrimitive]; 44240 if (prim !== void 0) { 44241 var res = prim.call(input, hint || "default"); 44242 if (_typeof(res) !== "object") return res; 44243 throw new TypeError("@@toPrimitive must return a primitive value."); 44244 } 44245 return (hint === "string" ? String : Number)(input); 44246} 44247var withUsage = createDocumentationMessageGenerator({ 44248 name: "sort-by" 44249}); 44250var suit = component("SortBy"); 44251var renderer7 = function renderer8(_ref) { 44252 var containerNode = _ref.containerNode, cssClasses = _ref.cssClasses; 44253 return function(_ref22, isFirstRendering) { 44254 var currentRefinement = _ref22.currentRefinement, options = _ref22.options, refine = _ref22.refine; 44255 if (isFirstRendering) { 44256 return; 44257 } 44258 B$1(_$1("div", { 44259 className: cssClasses.root 44260 }, _$1(Selector, { 44261 cssClasses, 44262 currentValue: currentRefinement, 44263 options, 44264 setValue: refine, 44265 ariaLabel: "Sort results by" 44266 })), containerNode); 44267 }; 44268}; 44269var sortBy = function sortBy2(widgetParams) { 44270 var _ref3 = widgetParams || {}, container = _ref3.container, items = _ref3.items, _ref3$cssClasses = _ref3.cssClasses, userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses, transformItems = _ref3.transformItems; 44271 if (!container) { 44272 throw new Error(withUsage("The `container` option is required.")); 44273 } 44274 var containerNode = getContainerNode(container);
44275 var cssClasses = { 44276 root: cx(suit(), userCssClasses.root), 44277 select: cx(suit({ 44278 descendantName: "select" 44279 }), userCssClasses.select), 44280 option: cx(suit({ 44281 descendantName: "option" 44282 }), userCssClasses.option) 44283 }; 44284 var specializedRenderer = renderer7({ 44285 containerNode, 44286 cssClasses 44287 }); 44288 var makeWidget = connectSortBy(specializedRenderer, function() { 44289 return B$1(null, containerNode); 44290 }); 44291 return _objectSpread(_objectSpread({}, makeWidget({ 44292 container: containerNode, 44293 items, 44294 transformItems 44295 })), {}, { 44296 $$widgetType: "ais.sortBy" 44297 }); 44298}; 44299const typesenseConfig = { 44300 apiKey: "jnN8dLa6S0Kxbsvqjn1iBOLw3PoiN9Jf", 44301 nodes: [ 44302 { 44303 host: "index.stpaulcenter.com", 44304 port: "443", 44305 protocol: "https" 44306 } 44307 ] 44308}; 44309function initContentListing$1() { 44310 const typesenseAdapter = new TypesenseInstantsearchAdapter({ 44311 server: { 44312 ...typesenseConfig 44313 }, 44314 additionalSearchParameters: { 44315 queryBy: "title,meta" 44316 } 44317 }); 44318 const search = instantsearch({ 44319 searchClient: typesenseAdapter.searchClient, 44320 indexName: "stpaulcenter" 44321 }); 44322 const categories = [ 44323 "All", 44324 "Articles", 44325 "Podcasts", 44326 "Videos", 44327 "Sunday Bible Reflections" 44328 ]; 44329 const categoryContainer = document.querySelector("#category-filters"); 44330 search.addWidgets([ 44331 searchBox({ 44332 container: "#content-search", 44333 placeholder: "What Scripture questions do you have?" 44334 }), 44335 configure({ 44336 hitsPerPage: 6, 44337 filters: `handle:posts ${""}` 44338 }), 44339 hits({ 44340 container: "#content-hits", 44341 templates: { 44342 empty: '<tr><td colspan="5">No results found.</td></tr>', 44343 item: (hit) => { 44344 var _a2; 44345 const isLibrary = hit.handle === "library"; 44346 const targetAttr = isLibrary ? 'target="_blank"' : ""; 44347 return ` 44348 44349 <div data-label="Image"> 44350 <a href="${hit.url}" ${targetAttr}> ${hit.image ? `<img src="${hit.image}&fm=webp&w=200" alt="${hit.title}" class="w-16 h-16 object-cover"/>` : '<img src="https://placehold.co/600x400?text=Image" />'}</a> 44351 </div> 44352 <div class="content-title" data-label="Title"> 44353 <a href="${hit.url}" ${targetAttr}>${hit._highlightResult.title.value}</a> 44354 </div> 44355 <div class="h6" data-label="Date" style="white-space: nowrap;"> 44356 ${new Date( 44357 hit.post_date_timestamp * 1e3 44358 ).toLocaleDateString("en-US", { 44359 month: "short", 44360 day: "numeric", 44361 year: "numeric" 44362 })} 44363 </div> 44364 <div class="item-categories" data-label="Categories"> 44365 ${Array.isArray(hit.categorization) ? hit.categorization.map((cat) => cat.replace(/-/g, " ")).join(", ") : (_a2 = hit.categorization) == null ? void 0 : _a2.replace(/-/g, " ")} 44366 ${hit.type ? `<div class="library-type">${hit.type.charAt(0).toUpperCase() + hit.type.slice(1)}</div>` : ""} 44367 </div> 44368 <div data-label="Link"> 44369 <a href="${hit.url}" class="button" ${targetAttr}> 44370 ${Array.isArray(hit.categorization) && hit.categorization.includes("podcast") ? "Listen" : hit.categorization.includes("videos") ? " Watch" : "Read"} 44371 44372</a> 44373 </div> 44374 44375 `; 44376 } 44377 } 44378 }), 44379 pagination({ 44380 container: "#content-pagination", 44381 scrollTo: false, 44382 padding: 2, 44383 showFirst: true, 44384 showLast: true, 44385 templates: { 44386 first: "«", 44387 previous: "â¹", 44388 next: "âº", 44389 last: "»" 44390 } 44391 }) 44392 ]); 44393 search.start(); 44394 $$2("#category-filters .tab-title").remove(); 44395 categories.forEach((category) => { 44396 const tabDiv = document.createElement("div"); 44397 tabDiv.className = "tab-title"; 44398 tabDiv.dataset.category = category; 44399 tabDiv.textContent = category; 44400 tabDiv.addEventListener("click", () => { 44401 document.querySelectorAll(".tab-title").forEach((tab) => { 44402 tab.classList.remove("active"); 44403 }); 44404 tabDiv.classList.add("active"); 44405 const convertCategoryToHandle = (category2) => { 44406 return category2.toLowerCase().replace(/\s+/g, "-"); 44407 }; 44408 const categoryFilter = category === "All" ? "" : `categorization:=[${convertCategoryToHandle(category)}]`; 44409 const filter = `handle:posts${categoryFilter ? ` && ${categoryFilter}` : ""}`; 44410 search.helper.setState( 44411 search.helper.state.setQueryParameter("filters", filter) 44412 ); 44413 search.helper.search(); 44414 document.querySelector(".ais-Pagination-link").click(); 44415 }); 44416 categoryContainer.appendChild(tabDiv); 44417 }); 44418} 44419document.addEventListener("turbo:load", function() { 44420 const contentListing = document.querySelector("#content-hits"); 44421 if (contentListing) initContentListing$1(); 44422 function activateTabFromHash2() { 44423 const categoryContainer = document.querySelector("#category-filters"); 44424 const hash = window.location.hash.replace("#", "").toLowerCase(); 44425 if (categoryContainer && hash) { 44426 let tabLink = Array.from( 44427 categoryContainer.querySelectorAll(".tab-title") 44428 ).find( 44429 (element) => element.dataset.category.toLowerCase().replace(/\s+/g, "-") === hash 44430 ); 44431 if (tabLink) { 44432 let sm2 = ScrollSmoother.get(); 44433 if (sm2) { 44434 sm2.scrollTo(tabLink); 44435 } else { 44436 tabLink.scrollIntoView({ behavior: "smooth" }); 44437 } 44438 tabLink.click(); 44439 } 44440 } 44441 } 44442 setTimeout(activateTabFromHash2, 500); 44443 window.addEventListener("hashchange", activateTabFromHash2); 44444}); 44445function initRelatedProducts(productId, currentId) { 44446 const client = new Typesense.Client(typesenseConfig); 44447 const currentEmbedding = `embedding:([], id: ${currentId})`; 44448 let pinnedHitIds = document.querySelector(".product-page").dataset.pinnedHitIds; 44449 const hiddenHitIds = document.querySelector(".product-page").dataset.hiddenHitIds; 44450 pinnedHitIds = pinnedHitIds ? pinnedHitIds.split(",").map((id2, index3) => `${id2.trim()}:${index3 + 1}`).join(",") : ""; 44451 return client.collections("stpaulcenter$products").documents().search({ 44452 q: "*", 44453 pinned_hits: pinnedHitIds, 44454 hidden_hits: hiddenHitIds, 44455 filter_by: `categorization:=[product] && id:!=${productId}`, 44456 limit: 6, 44457 vector_query: currentEmbedding, 44458 query_by: "embedding" 44459 }).then((results) => { 44460 return results.hits.map( 44461 (product) => ` 44462 <div class="related-product"> 44463 <a href="${product.document.url}" class="product-link"> 44464 ${product.document.image ? `<img src="${product.document.image}
44464&width=200" alt="${product.document.title}" class="product-image">` : `<div class="no-image-placeholder"></div>`} 44465 </a> 44466 </div> 44467 ` 44468 ).join(""); 44469 }); 44470} 44471function createJournalSearch({ 44472 collectionName, 44473 containerIds, 44474 searchBoxPlaceholder, 44475 hitsListClass, 44476 emptyTemplate, 44477 buildHitHtml 44478}) { 44479 return function initSearch2() { 44480 const typesenseAdapter = new TypesenseInstantsearchAdapter({ 44481 server: { 44482 ...typesenseConfig 44483 }, 44484 additionalSearchParameters: { 44485 queryBy: "title,authors,abstract,keywords,pdf_text", 44486 highlightFields: "title,authors", 44487 excludeFields: "embedding,pdf_text" 44488 } 44489 }); 44490 const initialQuery = new URLSearchParams(window.location.search).get("q") || ""; 44491 const search = instantsearch({ 44492 searchClient: typesenseAdapter.searchClient, 44493 indexName: collectionName, 44494 initialUiState: { 44495 [collectionName]: { query: initialQuery } 44496 } 44497 }); 44498 search.addWidgets([ 44499 searchBox({ 44500 container: containerIds.box, 44501 placeholder: searchBoxPlaceholder, 44502 autofocus: true 44503 }), 44504 configure({ 44505 hitsPerPage: 20, 44506 filters: "entry_type:=article" 44507 }), 44508 hits({ 44509 container: containerIds.hits, 44510 cssClasses: { 44511 list: hitsListClass 44512 }, 44513 templates: { 44514 empty: emptyTemplate, 44515 item: buildHitHtml 44516 } 44517 }), 44518 pagination({ 44519 container: containerIds.pagination, 44520 scrollTo: containerIds.box, 44521 padding: 2, 44522 showFirst: true, 44523 showLast: true, 44524 templates: { 44525 first: "«", 44526 previous: "â¹", 44527 next: "âº", 44528 last: "»" 44529 } 44530 }) 44531 ]); 44532 search.start(); 44533 }; 44534} 44535function buildNevHitHtml(hit) { 44536 var _a2, _b2, _c; 44537 const authors = Array.isArray(hit.authors) ? hit.authors.join(", ") : hit.authors || ""; 44538 const highlightedTitle = ((_b2 = (_a2 = hit._highlightResult) == null ? void 0 : _a2.title) == null ? void 0 : _b2.value) || hit.title; 44539 const highlightedAuthors = Array.isArray((_c = hit._highlightResult) == null ? void 0 : _c.authors) ? hit._highlightResult.authors.map((a2) => a2.value).join(", ") : authors; 44540 const volIssue = []; 44541 if (hit.volume_number) volIssue.push(`Vol. ${hit.volume_number}`); 44542 if (hit.issue_number) volIssue.push(`No. ${hit.issue_number}`); 44543 const volIssueHtml = volIssue.length ? `<span class="nev-article-item-vol">${volIssue.join(", ")}</span>` : ""; 44544 const embargoed = hit.embargo_until && Math.floor(Date.now() / 1e3) < hit.embargo_until; 44545 const pdfHtml = embargoed ? `<span class="nev-embargo-notice"> 44546 <span class="material-icons-outlined">lock</span> 44547 Available ${new Date(hit.embargo_until * 1e3).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })} 44548 </span>` : hit.pdf_url ? `<a href="${hit.pdf_url}" class="nev-pdf-link" target="_blank" rel="noopener" download> 44549 <span class="material-icons-outlined">picture_as_pdf</span> 44550 Download PDF 44551 </a>` : ""; 44552 const articleUrl = hit.url || null; 44553 return ` 44554 <div class="nev-article-item"> 44555 <div class="nev-article-item-main"> 44556 <h4>${articleUrl ? `<a href="${articleUrl}" class="nev-article-item-title" data-turbo="false">${highlightedTitle}</a>` : `<span class="nev-article-item-title">${highlightedTitle}</span>`}</h4> 44557 ${highlightedAuthors ? `<div class="nev-article-item-authors">${highlightedAuthors}</div>` : ""} 44558 </div> 44559 <div class="nev-article-item-meta"> 44560 ${volIssueHtml} 44561 ${pdfHtml} 44562 </div> 44563 </div> 44564 `; 44565} 44566const initNevSearch = createJournalSearch({ 44567 collectionName: "novaetvetera", 44568 containerIds: { 44569 box: "#nev-search-box", 44570 hits: "#nev-search-hits", 44571 pagination: "#nev-search-pagination" 44572 }, 44573 searchBoxPlaceholder: "Search Nova et Veteraâ¦", 44574 hitsListClass: "nev-article-list", 44575 emptyTemplate: '<p class="nev-search-empty">No articles found.</p>', 44576 buildHitHtml: buildNevHitHtml 44577}); 44578document.addEventListener("turbo:load", function() { 44579 if (document.querySelector("#nev-search-hits")) { 44580 initNevSearch(); 44581 } 44582}); 44583function buildLsHitHtml(hit) { 44584 var _a2, _b2, _c, _d, _e; 44585 const authors = Array.isArray(hit.authors) ? hit.authors.join(", ") : hit.authors || ""; 44586 const highlightedTitle = ((_b2 = (_a2 = hit._highlightResult) == null ? void 0 : _a2.title) == null ? void 0 : _b2.value) || hit.title; 44587 const highlightedAuthors = Array.isArray((_c = hit._highlightResult) == null ? void 0 : _c.authors) ? hit._highlightResult.authors.map((a2) => a2.value).join(", ") : authors; 44588 const volumeHtml = hit.volume_number ? `<span class="ls-article-item-vol">Vol. ${hit.volume_number}</span>` : "";
44589 const highlightedAbstract = ((_e = (_d = hit._highlightResult) == null ? void 0 : _d.abstract) == null ? void 0 : _e.value) || hit.abstract; 44590 const abstractHtml = highlightedAbstract ? `<div class="ls-article-item-abstract">${highlightedAbstract}</div>` : ""; 44591 const pdfHtml = hit.has_pdf && hit.pdf_url ? `<a href="${hit.pdf_url}" class="ls-pdf-link" target="_blank" rel="noopener" download> 44592 <span class="material-icons-outlined">picture_as_pdf</span> 44593 Download PDF 44594 </a>` : ""; 44595 const articleUrl = hit.url || null; 44596 return ` 44597 <div class="ls-article-item"> 44598 <div class="ls-article-item-main"> 44599 <h4>${articleUrl ? `<a href="${articleUrl}" class="ls-article-item-title" data-turbo="false">${highlightedTitle}</a>` : `<span class="ls-article-item-title">${highlightedTitle}</span>`}</h4> 44600 ${highlightedAuthors ? `<div class="ls-article-item-authors">${highlightedAuthors}</div>` : ""} 44601 ${abstractHtml} 44602 </div> 44603 <div class="ls-article-item-meta"> 44604 ${volumeHtml} 44605 ${pdfHtml} 44606 </div> 44607 </div> 44608 `; 44609} 44610const initLsSearch = createJournalSearch({ 44611 collectionName: "letterandspirit", 44612 containerIds: { 44613 box: "#ls-search-box", 44614 hits: "#ls-search-hits", 44615 pagination: "#ls-search-pagination" 44616 }, 44617 searchBoxPlaceholder: "Search Letter & Spiritâ¦", 44618 hitsListClass: "ls-article-list", 44619 emptyTemplate: '<p class="ls-search-empty">No articles found.</p>', 44620 buildHitHtml: buildLsHitHtml 44621}); 44622document.addEventListener("turbo:load", function() { 44623 if (document.querySelector("#ls-search-hits")) { 44624 initLsSearch(); 44625 } 44626}); 44627function getFlags() { 44628 const frontEndFlags = JSON.parse(localStorage.getItem("spc-feature-flags")) || []; 44629 const backEndFlags = SESSION_DATA.feature_flags ?? []; 44630 return /* @__PURE__ */ new Set([...frontEndFlags, ...backEndFlags]); 44631} 44632function setFlags(flags) { 44633 const flagsArray = Array.from(flags || []); 44634 if (flagsArray.length == 0) localStorage.removeItem("spc-feature-flags"); 44635 else localStorage.setItem("spc-feature-flags", JSON.stringify(flagsArray)); 44636} 44637function isEnabled(flag) { 44638 return getFlags().has(flag); 44639} 44640function enable(flag) { 44641 const flags = getFlags(); 44642 flags.add(flag); 44643 setFlags(flags); 44644} 44645function disable(flag) { 44646 const flags = getFlags(); 44647 flags.delete(flag); 44648 setFlags(flags); 44649} 44650const FeatureFlags = { 44651 enabled: isEnabled, 44652 isEnabled, 44653 enable, 44654 disable 44655}; 44656if (typeof SESSION_DATA != "undefined" && (((_a = SESSION_DATA.current_user_email) == null ? void 0 : _a.endsWith("@stpaulcenter.com")) || ((_b = SESSION_DATA.current_user_email) == null ? void 0 : _b.endsWith("@madebyhighland.com")))) 44657 window.FeatureFlags = FeatureFlags; 44658const e$6 = "undefined" != typeof window, i$6 = e$6 && !("onscroll" in window) || "undefined" != typeof navigator && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), n$7 = e$6 && window.devicePixelRatio > 1; 44659const a$7 = { elements_selector: ".lazy", container: i$6 || e$6 ? document : null, threshold: 300, thresholds: null, data_src: "src", data_srcset: "srcset", data_sizes: "sizes", data_bg: "bg", data_bg_hidpi: "bg-hidpi", data_bg_multi: "bg-multi", data_bg_multi_hidpi: "bg-multi-hidpi", data_bg_set: "bg-set", data_poster: "poster", class_applied: "applied", class_loading: "loading", class_loaded: "loaded", class_error: "error", class_entered: "entered", class_exited: "exited", unobserve_completed: true, unobserve_entered: false, cancel_on_exit: true, callback_enter: null, callback_exit: null, callback_applied: null, callback_loading: null, callback_loaded: null, callback_error: null, callback_finish: null, callback_cancel: null, use_native: false, restore_on_error: false }, t$8 = (l2) => Object.assign({}, a$7, l2); 44660const t$7 = function(t2, e2) { 44661 let n2; 44662 const i2 = "LazyLoad::Initialized", o2 = new t2(e2); 44663 try { 44664 n2 = new CustomEvent(i2, { detail: { instance: o2 } }); 44665 } catch (t3) { 44666 n2 = document.createEvent("CustomEvent"), n2.initCustomEvent(i2, false, false, { instance: o2 }); 44667 } 44668 window.dispatchEvent(n2); 44669}, e$5 = (e2, n2) => { 44670 if (n2) if (n2.length) for (let i2, o2 = 0; i2 = n2[o2]; o2 += 1) t$7(e2, i2); 44671 else t$7(e2, n2); 44672}; 44673const s$4 = "src", t$6 = "srcset", r$5 = "sizes", e$4 = "poster", a$6 = "llOriginalAttrs", c$3 = "data"; 44674const e$3 = "loading", d$3 = "loaded", o$5 = "applied", r$4 = "entered", a$5 = "error", n$6 = "native"; 44675const r$3 = "data-", s$3 = "ll-status", o$4 = (t2, e2) => t2.getAttribute(r$3 + e2), i$5 = (t2, e2, l2) => { 44676 const u2 = r$3 + e2; 44677 null !== l2 ? t2.setAttribute(u2, l2) : t2.removeAttribute(u2); 44678}, a$4 = (t2) => o$4(t2, s$3), m$4 = (t2, e2) => i$5(t2, s$3, e2), b$2 = (t2) => m$4(t2, null), A$1 = (t2) => null === a$4(t2), c$2 = (t2) => a$4(t2) === e$3, d$2 = (t2) => a$4(t2) === a$5, f$2 = (e2) => a$4(e2) === n$6, p$1 = [e$3, d$3, o$5, a$5], x$2 = (t2) => p$1.indexOf(a$4(t2)) >= 0; 44679const o$3 = (o2, t2, i2, n2) => { 44680 o2 && "function" == typeof o2 && (void 0 === n2 ? void 0 === i2 ? o2(t2) : o2(t2, i2) : o2(t2, i2, n2)); 44681}; 44682const o$2 = (o2, t2) => { 44683 e$6 && "" !== t2 && o2.classList.add(t2); 44684}, t$5 = (o2, t2) => { 44685 e$6 && "" !== t2 && o2.classList.remove(t2); 44686}; 44687const e$2 = (e2) => { 44688 e2.llTempImage = document.createElement("IMG"); 44689}, l$2 = (e2) => { 44690 delete e2.llTempImage; 44691}, m$3 = (e2) => e2.llTempImage; 44692const e$1 = (e2, n2) => { 44693 if (!n2) return; 44694 const r2 = n2._observer; 44695 r2 && r2.unobserve(e2); 44696}, n$5 = (e2) => { 44697 e2.disconnect(); 44698}, r$2 = (n2, r2, o2) => { 44699 r2.unobserve_entered && e$1(n2, o2); 44700}; 44701const o$1 = (o2, t2) => { 44702 o2 && (o2.loadingCount += t2); 44703}, t$4 = (o2) => { 44704 o2 && (o2.toLoadCount -= 1); 44705}, n$4 = (o2, t2) => { 44706 o2 && (o2.toLoadCount = t2); 44707}, a$3 = (o2) => o2.loadingCount > 0, d$1 = (o2) => o2.toLoadCount > 0; 44708const e = (e2) => { 44709 let t2 = []; 44710 for (let r2, a2 = 0; r2 = e2.children[a2]; a2 += 1) "SOURCE" === r2.tagName && t2.push(r2); 44711 return t2; 44712}, t$3 = (t2, r2) => { 44713 const a2 = t2.parentNode; 44714 a2 && "PICTURE" === a2.tagName && e(a2).forEach(r2); 44715}, r$1 = (t2, r2) => { 44716 e(t2).forEach(r2); 44717}; 44718const c$1 = [s$4], s$2 = [s$4, e$4], u$1 = [s$4, t$6, r$5], g$3 = [c$3], b$1 = (e2) => !!e2[a$6], i$4 = (e2) => e2[a$6], m$2 = (e2) => delete e2[a$6], f$1 = (e2, r2) => { 44719 if (b$1(e2)) return; 44720 const o2 = {}; 44721 r2.forEach((t2) => { 44722 o2[t2] = e2.getAttribute(t2); 44723 }), e2[a$6] = o2; 44724}, d = (e2) => { 44725 b$1(e2) || (e2[a$6] = { backgroundImage: e2.style.backgroundImage }); 44726}, k$1 = (t2, e2) => { 44727 if (!b$1(t2)) return; 44728 const r2 = i$4(t2); 44729 e2.forEach((e3) => { 44730 ((t3, e4, r3) => { 44731 r3 ? t3.setAttribute(e4, r3) : t3.removeAttribute(e4); 44732 })(t2, e3, r2[e3]); 44733 }); 44734}, I$2 = (t2) => { 44735 if (!b$1(t2)) return; 44736 const e2 = i$4(t2); 44737 t2.style.backgroundImage = e2.backgroundImage; 44738}; 44739const E$1 = (t2, a2, s2) => { 44740 o$2(t2, a2.class_applied), m$4(t2, o$5), s2 && (a2.unobserve_completed && e$1(t2, a2), o$3(a2.callback_applied, t2, s2)); 44741}, h = (t2, a2, s2) => { 44742 o$2(t2, a2.class_loading), m$4(t2, e$3), s2 && (o$1(s2, 1), o$3(a2.callback_loading, t2, s2)); 44743}, v = (t2, a2, s2) => { 44744 s2 && t2.setAttribute(a2, s2); 44745}, y = (a2, s2) => { 44746 v(a2, r$5, o$4(a2, s2.data_sizes)), v(a2, t$6, o$4(a2, s2.data_srcset)), v(a2, s$4, o$4(a2, s2.data_src)); 44747}, M = (t2, a2) => { 44748 t$3(t2, (t3) => { 44749 f$1(t3, u$1), y(t3, a2); 44750 }), f$1(t2, u$1), y(t2, a2); 44751}, N = (a2, s2) => { 44752 f$1(a2, c$1), v(a2, s$4, o$4(a2, s2.data_src)); 44753}, O$1 = (s2, o2) => { 44754 r$1(s2, (a2) => { 44755 f$1(a2, c$1), v(a2, s$4, o$4(a2, o2.data_src)); 44756 }), f$1(s2, s$2), v(s2, e$4, o$4(s2, o2.data_poster)), v(s2, s$4, o$4(s2, o2.data_src)), s2.load(); 44757}, S = (t2, a2) => { 44758 f$1(t2, g$3), v(t2, c$3, o$4(t2, a2.data_src)); 44759}, $ = (a2, s2, o2) => { 44760 const r2 = o$4(a2, s2.data_bg), m2 = o$4(a2, s2.data_bg_hidpi), i2 = n$7 && m2 ? m2 : r2; 44761 i2 && (a2.style.backgroundImage = `url("${i2}")`, m$3(a2).setAttribute(s$4, i2), h(a2, s2, o2)); 44762}, x$1 = (t2, a2, s2) => { 44763 const o2 = o$4(t2, a2.data_bg_multi), r2 = o$4(t2, a2.data_bg_multi_hidpi), m2 = n$7 && r2 ? r2 : o2; 44764 m2 && (t2.style.backgroundImage = m2, E$1(t2, a2, s2)); 44765}, z = (t2, a2, s2) => { 44766 const o2 = o$4(t2, a2.data_bg_set); 44767 if (!o2) return; 44768 let r2 = o2.split("|").map((t3) => `image-set(${t3})`); 44769 t2.style.backgroundImage = r2.join(), E$1(t2, a2, s2); 44770}, B = { IMG: M, IFRAME: N, VIDEO: O$1, OBJECT: S }, C = (t2, a2) => { 44771 const s2 = B[t2.tagName]; 44772 s2 && s2(t2, a2); 44773}, D$1 = (t2, a2, s2) => { 44774 const o2 = B[t2.tagName]; 44775 o2 && (o2(t2, a2), h(t2, a2, s2)); 44776}; 44777const _ = ["IMG", "IFRAME", "VIDEO", "OBJECT"], j$1 = (r2) => _.indexOf(r2.tagName) > -1, b = (r2, o2) => { 44778 !o2 || a$3(o2) || d$1(o2) || o$3(r2.callback_finish, o2); 44779}, L = (r2, o2, s2) => { 44780 r2.addEventListener(o2, s2), r2.llEvLisnrs[o2] = s2; 44781}, u = (r2, o2, s2) => { 44782 r2.removeEventListener(o2, s2); 44783}, g$2 = (r2) => !!r2.llEvLisnrs, I$1 = (r2, o2, s2) => { 44784 g$2(r2) || (r2.llEvLisnrs = {}); 44785 const e2 = "VIDEO" === r2.tagName ? "loadeddata" : "load"; 44786 L(r2, e2, o2), L(r2, "error", s2); 44787}, k = (r2) => { 44788 if (!g$2(r2)) return; 44789 const o2 = r2.llEvLisnrs; 44790 for (let s2 in o2) { 44791 const e2 = o2[s2]; 44792 u(r2, s2, e2); 44793 } 44794 delete r2.llEvLisnrs; 44795}, O = (r2, s2, e2) => { 44796 l$2(r2), o$1(e2, -1), t$4(e2), t$5(r2, s2.class_loading), s2.unobserve_completed && e$1(r2, e2); 44797}, x = (o2, a2, n2, i2) => { 44798 const m2 = f$2(a2); 44799 O(a2, n2, i2), o$2(a2, n2.class_loaded), m$4(a2, d$3), o$3(n2.callback_loaded, a2, i2), m2 || b(n2, i2); 44800}, A = (o2, l2, n2, i2) => { 44801 const m2 = f$2(l2); 44802 O(l2, n2, i2), o$2(l2, n2.class_error), m$4(l2, a$5), o$3(n2.callback_error, l2, i2), n2.restore_on_error &&
44802k$1(l2, u$1), m2 || b(n2, i2); 44803}, D = (r2, o2, s2) => { 44804 const e2 = m$3(r2) || r2; 44805 g$2(e2) || I$1(e2, (t2) => { 44806 x(0, r2, o2, s2), k(e2); 44807 }, (t2) => { 44808 A(0, r2, o2, s2), k(e2); 44809 }); 44810}; 44811const n$3 = (e2, i2, a2) => { 44812 j$1(e2) ? ((t2, o2, r2) => { 44813 D(t2, o2, r2), D$1(t2, o2, r2); 44814 })(e2, i2, a2) : ((m2, e3, i3) => { 44815 e$2(m2), D(m2, e3, i3), d(m2), $(m2, e3, i3), x$1(m2, e3, i3), z(m2, e3, i3); 44816 })(e2, i2, a2); 44817}, l$1 = (t2, o2, r2) => { 44818 t2.setAttribute("loading", "lazy"), D(t2, o2, r2), C(t2, o2), m$4(t2, n$6); 44819}; 44820const m$1 = (e2) => { 44821 e2.removeAttribute(s$4), e2.removeAttribute(t$6), e2.removeAttribute(r$5); 44822}, i$3 = (t2) => { 44823 t$3(t2, (t3) => { 44824 m$1(t3); 44825 }), m$1(t2); 44826}; 44827const f = (s2) => { 44828 t$3(s2, (s3) => { 44829 k$1(s3, u$1); 44830 }), k$1(s2, u$1); 44831}, n$2 = (s2) => { 44832 r$1(s2, (s3) => { 44833 k$1(s3, c$1); 44834 }), k$1(s2, s$2), s2.load(); 44835}, j = (s2) => { 44836 k$1(s2, c$1); 44837}, E = (s2) => { 44838 k$1(s2, g$3); 44839}, g$1 = { IMG: f, IFRAME: j, VIDEO: n$2, OBJECT: E }, I = (t2, e2) => { 44840 ((s2) => { 44841 const o2 = g$1[s2.tagName]; 44842 o2 ? o2(s2) : I$2(s2); 44843 })(t2), ((o2, t3) => { 44844 A$1(o2) || f$2(o2) || (t$5(o2, t3.class_entered), t$5(o2, t3.class_exited), t$5(o2, t3.class_applied), t$5(o2, t3.class_loading), t$5(o2, t3.class_loaded), t$5(o2, t3.class_error)); 44845 })(t2, e2), b$2(t2), m$2(t2); 44846}; 44847const i$2 = (i2, l2, p2, f$12) => { 44848 p2.cancel_on_exit && c$2(i2) && "IMG" === i2.tagName && (k(i2), i$3(i2), f(i2), t$5(i2, p2.class_loading), o$1(f$12, -1), b$2(i2), o$3(p2.callback_cancel, i2, l2, f$12)); 44849}; 44850const n$1 = (e2, a2, n2, p2) => { 44851 const f2 = x$2(e2); 44852 m$4(e2, r$4), o$2(e2, n2.class_entered), t$5(e2, n2.class_exited), r$2(e2, n2, p2), o$3(n2.callback_enter, e2, a2, p2), f2 || n$3(e2, n2, p2); 44853}, p = (o2, s2, r2, m2) => { 44854 A$1(o2) || (o$2(o2, r2.class_exited), i$2(o2, s2, r2, m2), o$3(r2.callback_exit, o2, s2, m2)); 44855}; 44856const t$2 = ["IMG", "IFRAME", "VIDEO"], r = (o2) => o2.use_native && "loading" in HTMLImageElement.prototype, a$2 = (r2, a2, m2) => { 44857 r2.forEach((e2) => { 44858 -1 !== t$2.indexOf(e2.tagName) && l$1(e2, a2, m2); 44859 }), n$4(m2, 0); 44860}; 44861const n = (r2) => r2.isIntersecting || r2.intersectionRatio > 0, s$1 = (r2, e2) => { 44862 e2.forEach((e3) => { 44863 r2.observe(e3); 44864 }); 44865}, i$1 = (r2, e2) => { 44866 n$5(r2), s$1(r2, e2); 44867}, a$1 = (t2, s2) => { 44868 r(t2) || (s2._observer = new IntersectionObserver((o2) => { 44869 ((o3, t3, s3) => { 44870 o3.forEach((o4) => n(o4) ? n$1(o4.target, o4, t3, s3) : p(o4.target, o4, t3, s3)); 44871 })(o2, t2, s2); 44872 }, ((r2) => ({ root: r2.container === document ? null : r2.container, rootMargin: r2.thresholds || r2.threshold + "px" }))(t2))); 44873}; 44874const t$1 = (e2) => Array.prototype.slice.call(e2), l = (e2) => e2.container.querySelectorAll(e2.elements_selector), o = (r2) => t$1(r2).filter(A$1), c = (e2) => d$2(e2), a = (e2) => t$1(e2).filter(c), i = (e2, r2) => o(e2 || l(r2)); 44875const t = (n2, t2) => { 44876 a(l(n2)).forEach((r2) => { 44877 t$5(r2, n2.class_error), b$2(r2); 44878 }), t2.update(); 44879}, m = (o2, e2) => { 44880 e$6 && (e2._onlineHandler = () => { 44881 t(o2, e2); 44882 }, window.addEventListener("online", e2._onlineHandler)); 44883}, s = (o2) => { 44884 e$6 && window.removeEventListener("online", o2._onlineHandler); 44885}; 44886const g = function(o2, s2) { 44887 const e2 = t$8(o2); 44888 this._settings = e2, this.loadingCount = 0, a$1(e2, this), m(e2, this), this.update(s2); 44889}; 44890g.prototype = { update: function(t2) { 44891 const o2 = this._settings, s2 = i(t2, o2); 44892 n$4(this, s2.length), i$6 ? this.loadAll(s2) : r(o2) ? a$2(s2, o2, this) : i$1(this._observer, s2); 44893}, destroy: function() { 44894 this._observer && this._observer.disconnect(), s(this), l(this._settings).forEach((t2) => { 44895 m$2(t2); 44896 }), delete this._observer, delete this._settings, delete this._onlineHandler, delete this.loadingCount, delete this.toLoadCount; 44897}, loadAll: function(t2) { 44898 const o2 = this._settings; 44899 i(t2, o2).forEach((t3) => { 44900 e$1(t3, this), n$3(t3, o2, this); 44901 }); 44902}, restoreAll: function() { 44903 const t2 = this._settings; 44904 l(t2).forEach((o2) => { 44905 I(o2, t2); 44906 }); 44907} }, g.load = (o2, i2) => { 44908 const e2 = t$8(i2); 44909 n$3(o2, e2); 44910}, g.resetStatus = (t2) => { 44911 b$2(t2); 44912}, e$6 && e$5(g, window.lazyLoadOptions); 44913let lazyLoadInstance;
44914document.addEventListener("turbo:load", function(event) { 44915 if (lazyLoadInstance) lazyLoadInstance.update(); 44916 else lazyLoadInstance = new g({}); 44917 const contentListing = document.querySelector("#content-hits"); 44918 if (contentListing) { 44919 initContentListing(); 44920 } 44921}); 44922document.addEventListener("turbo:load", () => { 44923 document.querySelectorAll(".lazy-gif").forEach((node) => { 44924 node.style.backgroundImage = `url(${node.dataset.gif})`; 44925 node.classList.remove("lazy-gif"); 44926 }); 44927}); 44928var DOCUMENT_FRAGMENT_NODE = 11; 44929function morphAttrs(fromNode, toNode) { 44930 var toNodeAttrs = toNode.attributes; 44931 var attr; 44932 var attrName; 44933 var attrNamespaceURI; 44934 var attrValue; 44935 var fromValue; 44936 if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) { 44937 return; 44938 } 44939 for (var i2 = toNodeAttrs.length - 1; i2 >= 0; i2--) { 44940 attr = toNodeAttrs[i2]; 44941 attrName = attr.name; 44942 attrNamespaceURI = attr.namespaceURI; 44943 attrValue = attr.value; 44944 if (attrNamespaceURI) { 44945 attrName = attr.localName || attrName; 44946 fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName); 44947 if (fromValue !== attrValue) { 44948 if (attr.prefix === "xmlns") { 44949 attrName = attr.name; 44950 } 44951 fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue); 44952 } 44953 } else { 44954 fromValue = fromNode.getAttribute(attrName); 44955 if (fromValue !== attrValue) { 44956 fromNode.setAttribute(attrName, attrValue); 44957 } 44958 } 44959 } 44960 var fromNodeAttrs = fromNode.attributes; 44961 for (var d2 = fromNodeAttrs.length - 1; d2 >= 0; d2--) { 44962 attr = fromNodeAttrs[d2]; 44963 attrName = attr.name; 44964 attrNamespaceURI = attr.namespaceURI; 44965 if (attrNamespaceURI) { 44966 attrName = attr.localName || attrName; 44967 if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) { 44968 fromNode.removeAttributeNS(attrNamespaceURI, attrName); 44969 } 44970 } else { 44971 if (!toNode.hasAttribute(attrName)) { 44972 fromNode.removeAttribute(attrName); 44973 } 44974 } 44975 } 44976} 44977var range; 44978var NS_XHTML = "http://www.w3.org/1999/xhtml"; 44979var doc = typeof document === "undefined" ? void 0 : document;
vendor: 9,686 bytes, lines 44980-45275
44980var HAS_TEMPLATE_SUPPORT = !!doc && "content" in doc.createElement("template"); 44981var HAS_RANGE_SUPPORT = !!doc && doc.createRange && "createContextualFragment" in doc.createRange(); 44982function createFragmentFromTemplate(str) { 44983 var template2 = doc.createElement("template"); 44984 template2.innerHTML = str; 44985 return template2.content.childNodes[0]; 44986} 44987function createFragmentFromRange(str) { 44988 if (!range) { 44989 range = doc.createRange(); 44990 range.selectNode(doc.body); 44991 } 44992 var fragment = range.createContextualFragment(str); 44993 return fragment.childNodes[0]; 44994} 44995function createFragmentFromWrap(str) { 44996 var fragment = doc.createElement("body"); 44997 fragment.innerHTML = str; 44998 return fragment.childNodes[0]; 44999} 45000function toElement(str) { 45001 str = str.trim(); 45002 if (HAS_TEMPLATE_SUPPORT) { 45003 return createFragmentFromTemplate(str); 45004 } else if (HAS_RANGE_SUPPORT) { 45005 return createFragmentFromRange(str); 45006 } 45007 return createFragmentFromWrap(str); 45008} 45009function compareNodeNames(fromEl, toEl) { 45010 var fromNodeName = fromEl.nodeName; 45011 var toNodeName = toEl.nodeName; 45012 var fromCodeStart, toCodeStart; 45013 if (fromNodeName === toNodeName) { 45014 return true; 45015 } 45016 fromCodeStart = fromNodeName.charCodeAt(0); 45017 toCodeStart = toNodeName.charCodeAt(0); 45018 if (fromCodeStart <= 90 && toCodeStart >= 97) { 45019 return fromNodeName === toNodeName.toUpperCase(); 45020 } else if (toCodeStart <= 90 && fromCodeStart >= 97) { 45021 return toNodeName === fromNodeName.toUpperCase(); 45022 } else { 45023 return false; 45024 } 45025} 45026function createElementNS(name, namespaceURI) { 45027 return !namespaceURI || namespaceURI === NS_XHTML ? doc.createElement(name) : doc.createElementNS(namespaceURI, name); 45028} 45029function moveChildren(fromEl, toEl) { 45030 var curChild = fromEl.firstChild; 45031 while (curChild) { 45032 var nextChild = curChild.nextSibling; 45033 toEl.appendChild(curChild); 45034 curChild = nextChild; 45035 } 45036 return toEl; 45037} 45038function syncBooleanAttrProp(fromEl, toEl, name) { 45039 if (fromEl[name] !== toEl[name]) { 45040 fromEl[name] = toEl[name]; 45041 if (fromEl[name]) { 45042 fromEl.setAttribute(name, ""); 45043 } else { 45044 fromEl.removeAttribute(name); 45045 } 45046 } 45047} 45048var specialElHandlers = { 45049 OPTION: function(fromEl, toEl) { 45050 var parentNode = fromEl.parentNode; 45051 if (parentNode) { 45052 var parentName = parentNode.nodeName.toUpperCase(); 45053 if (parentName === "OPTGROUP") { 45054 parentNode = parentNode.parentNode; 45055 parentName = parentNode && parentNode.nodeName.toUpperCase(); 45056 } 45057 if (parentName === "SELECT" && !parentNode.hasAttribute("multiple")) { 45058 if (fromEl.hasAttribute("selected") && !toEl.selected) { 45059 fromEl.setAttribute("selected", "selected"); 45060 fromEl.removeAttribute("selected"); 45061 } 45062 parentNode.selectedIndex = -1; 45063 } 45064 } 45065 syncBooleanAttrProp(fromEl, toEl, "selected"); 45066 }, 45067 /** 45068 * The "value" attribute is special for the <input> element since it sets 45069 * the initial value. Changing the "value" attribute without changing the 45070 * "value" property will have no effect since it is only used to the set the 45071 * initial value. Similar for the "checked" attribute, and "disabled". 45072 */ 45073 INPUT: function(fromEl, toEl) { 45074 syncBooleanAttrProp(fromEl, toEl, "checked"); 45075 syncBooleanAttrProp(fromEl, toEl, "disabled"); 45076 if (fromEl.value !== toEl.value) { 45077 fromEl.value = toEl.value; 45078 } 45079 if (!toEl.hasAttribute("value")) { 45080 fromEl.removeAttribute("value"); 45081 } 45082 }, 45083 TEXTAREA: function(fromEl, toEl) { 45084 var newValue = toEl.value; 45085 if (fromEl.value !== newValue) { 45086 fromEl.value = newValue; 45087 } 45088 var firstChild = fromEl.firstChild; 45089 if (firstChild) { 45090 var oldValue = firstChild.nodeValue; 45091 if (oldValue == newValue || !newValue && oldValue == fromEl.placeholder) { 45092 return; 45093 } 45094 firstChild.nodeValue = newValue; 45095 } 45096 }, 45097 SELECT: function(fromEl, toEl) { 45098 if (!toEl.hasAttribute("multiple")) { 45099 var selectedIndex = -1; 45100 var i2 = 0; 45101 var curChild = fromEl.firstChild; 45102 var optgroup; 45103 var nodeName; 45104 while (curChild) { 45105 nodeName = curChild.nodeName && curChild.nodeName.toUpperCase(); 45106 if (nodeName === "OPTGROUP") { 45107 optgroup = curChild; 45108 curChild = optgroup.firstChild; 45109 } else { 45110 if (nodeName === "OPTION") { 45111 if (curChild.hasAttribute("selected")) { 45112 selectedIndex = i2; 45113 break; 45114 } 45115 i2++; 45116 } 45117 curChild = curChild.nextSibling; 45118 if (!curChild && optgroup) { 45119 curChild = optgroup.nextSibling; 45120 optgroup = null; 45121 } 45122 } 45123 } 45124 fromEl.selectedIndex = selectedIndex; 45125 } 45126 } 45127}; 45128var ELEMENT_NODE = 1; 45129var DOCUMENT_FRAGMENT_NODE$1 = 11; 45130var TEXT_NODE = 3; 45131var COMMENT_NODE = 8; 45132function noop() { 45133} 45134function defaultGetNodeKey(node) { 45135 if (node) { 45136 return node.getAttribute && node.getAttribute("id") || node.id; 45137 } 45138} 45139function morphdomFactory(morphAttrs2) { 45140 return function morphdom2(fromNode, toNode, options) { 45141 if (!options) { 45142 options = {}; 45143 } 45144 if (typeof toNode === "string") { 45145 if (fromNode.nodeName === "#document" || fromNode.nodeName === "HTML" || fromNode.nodeName === "BODY") { 45146 var toNodeHtml = toNode; 45147 toNode = doc.createElement("html"); 45148 toNode.innerHTML = toNodeHtml; 45149 } else { 45150 toNode = toElement(toNode); 45151 } 45152 } else if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE$1) { 45153 toNode = toNode.firstElementChild; 45154 } 45155 var getNodeKey = options.getNodeKey || defaultGetNodeKey; 45156 var onBeforeNodeAdded = options.onBeforeNodeAdded || noop; 45157 var onNodeAdded = options.onNodeAdded || noop; 45158 var onBeforeElUpdated = options.onBeforeElUpdated || noop; 45159 var onElUpdated = options.onElUpdated || noop; 45160 var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop; 45161 var onNodeDiscarded = options.onNodeDiscarded || noop; 45162 var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop; 45163 var skipFromChildren = options.skipFromChildren || noop; 45164 var addChild = options.addChild || function(parent, child) { 45165 return parent.appendChild(child); 45166 }; 45167 var childrenOnly = options.childrenOnly === true; 45168 var fromNodesLookup = /* @__PURE__ */ Object.create(null); 45169 var keyedRemovalList = []; 45170 function addKeyedRemoval(key2) { 45171 keyedRemovalList.push(key2); 45172 } 45173 function walkDiscardedChildNodes(node, skipKeyedNodes) { 45174 if (node.nodeType === ELEMENT_NODE) { 45175 var curChild = node.firstChild; 45176 while (curChild) { 45177 var key2 = void 0; 45178 if (skipKeyedNodes && (key2 = getNodeKey(curChild))) { 45179 addKeyedRemoval(key2); 45180 } else { 45181 onNodeDiscarded(curChild); 45182 if (curChild.firstChild) { 45183 walkDiscardedChildNodes(curChild, skipKeyedNodes); 45184 } 45185 } 45186 curChild = curChild.nextSibling; 45187 } 45188 } 45189 } 45190 function removeNode(node, parentNode, skipKeyedNodes) { 45191 if (onBeforeNodeDiscarded(node) === false) { 45192 return; 45193 } 45194 if (parentNode) { 45195 parentNode.removeChild(node); 45196 } 45197 onNodeDiscarded(node); 45198 walkDiscardedChildNodes(node, skipKeyedNodes); 45199 } 45200 function indexTree(node) { 45201 if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) { 45202 var curChild = node.firstChild; 45203 while (curChild) { 45204 var key2 = getNodeKey(curChild); 45205 if (key2) { 45206 fromNodesLookup[key2] = curChild; 45207 } 45208 indexTree(curChild); 45209 curChild = curChild.nextSibling; 45210 } 45211 } 45212 } 45213 indexTree(fromNode); 45214 function handleNodeAdded(el) { 45215 onNodeAdded(el); 45216 var curChild = el.firstChild; 45217 while (curChild) { 45218 var nextSibling = curChild.nextSibling; 45219 var key2 = getNodeKey(curChild); 45220 if (key2) { 45221 var unmatchedFromEl = fromNodesLookup[key2]; 45222 if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) { 45223 curChild.parentNode.replaceChild(unmatchedFromEl, curChild); 45224 morphEl(unmatchedFromEl, curChild); 45225 } else { 45226 handleNodeAdded(curChild); 45227 } 45228 } else { 45229 handleNodeAdded(curChild); 45230 } 45231 curChild = nextSibling; 45232 } 45233 } 45234 function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) { 45235 while (curFromNodeChild) { 45236 var fromNextSibling = curFromNodeChild.nextSibling; 45237 if (curFromNodeKey = getNodeKey(curFromNodeChild)) { 45238 addKeyedRemoval(curFromNodeKey); 45239 } else { 45240 removeNode( 45241 curFromNodeChild, 45242 fromEl, 45243 true 45244 /* skip keyed nodes */ 45245 ); 45246 } 45247 curFromNodeChild = fromNextSibling; 45248 } 45249 } 45250 function morphEl(fromEl, toEl, childrenOnly2) { 45251 var toElKey = getNodeKey(toEl); 45252 if (toElKey) { 45253 delete fromNodesLookup[toElKey]; 45254 } 45255 if (!childrenOnly2) { 45256 var beforeUpdateResult = onBeforeElUpdated(fromEl, toEl); 45257 if (beforeUpdateResult === false) { 45258 return; 45259 } else if (beforeUpdateResult instanceof HTMLElement) { 45260 fromEl = beforeUpdateResult; 45261 indexTree(fromEl); 45262 } 45263 morphAttrs2(fromEl, toEl); 45264 onElUpdated(fromEl); 45265 if (onBeforeElChildrenUpdated(fromEl, toEl) === false) { 45266 return; 45267 } 45268 } 45269 if (fromEl.nodeName !== "TEXTAREA") { 45270 morphChildren2(fromEl, toEl); 45271 } else { 45272 specialElHandlers.TEXTAREA(fromEl, toEl); 45273 } 45274 } 45275 function morphChildren2(fromEl, toEl) {
45276 var skipFrom = skipFromChildren(fromEl, toEl); 45277 var curToNodeChild = toEl.firstChild; 45278 var curFromNodeChild = fromEl.firstChild; 45279 var curToNodeKey; 45280 var curFromNodeKey; 45281 var fromNextSibling; 45282 var toNextSibling; 45283 var matchingFromEl; 45284 outer: while (curToNodeChild) { 45285 toNextSibling = curToNodeChild.nextSibling; 45286 curToNodeKey = getNodeKey(curToNodeChild); 45287 while (!skipFrom && curFromNodeChild) { 45288 fromNextSibling = curFromNodeChild.nextSibling; 45289 if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) { 45290 curToNodeChild = toNextSibling; 45291 curFromNodeChild = fromNextSibling; 45292 continue outer; 45293 } 45294 curFromNodeKey = getNodeKey(curFromNodeChild); 45295 var curFromNodeType = curFromNodeChild.nodeType; 45296 var isCompatible = void 0; 45297 if (curFromNodeType === curToNodeChild.nodeType) { 45298 if (curFromNodeType === ELEMENT_NODE) { 45299 if (curToNodeKey) { 45300 if (curToNodeKey !== curFromNodeKey) { 45301 if (matchingFromEl = fromNodesLookup[curToNodeKey]) { 45302 if (fromNextSibling === matchingFromEl) { 45303 isCompatible = false; 45304 } else { 45305 fromEl.insertBefore(matchingFromEl, curFromNodeChild); 45306 if (curFromNodeKey) { 45307 addKeyedRemoval(curFromNodeKey); 45308 } else { 45309 removeNode( 45310 curFromNodeChild, 45311 fromEl, 45312 true 45313 /* skip keyed nodes */ 45314 ); 45315 } 45316 curFromNodeChild = matchingFromEl; 45317 curFromNodeKey = getNodeKey(curFromNodeChild); 45318 } 45319 } else { 45320 isCompatible = false; 45321 } 45322 } 45323 } else if (curFromNodeKey) { 45324 isCompatible = false; 45325 } 45326 isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild); 45327 if (isCompatible) { 45328 morphEl(curFromNodeChild, curToNodeChild); 45329 } 45330 } else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) { 45331 isCompatible = true; 45332 if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) { 45333 curFromNodeChild.nodeValue = curToNodeChild.nodeValue; 45334 } 45335 } 45336 } 45337 if (isCompatible) { 45338 curToNodeChild = toNextSibling; 45339 curFromNodeChild = fromNextSibling; 45340 continue outer; 45341 } 45342 if (curFromNodeKey) { 45343 addKeyedRemoval(curFromNodeKey); 45344 } else { 45345 removeNode( 45346 curFromNodeChild, 45347 fromEl, 45348 true 45349 /* skip keyed nodes */ 45350 ); 45351 } 45352 curFromNodeChild = fromNextSibling; 45353 } 45354 if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) { 45355 if (!skipFrom) { 45356 addChild(fromEl, matchingFromEl); 45357 } 45358 morphEl(matchingFromEl, curToNodeChild); 45359 } else { 45360 var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild); 45361 if (onBeforeNodeAddedResult !== false) { 45362 if (onBeforeNodeAddedResult) { 45363 curToNodeChild = onBeforeNodeAddedResult; 45364 } 45365 if (curToNodeChild.actualize) { 45366 curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc); 45367 } 45368 addChild(fromEl, curToNodeChild); 45369 handleNodeAdded(curToNodeChild); 45370 } 45371 } 45372 curToNodeChild = toNextSibling; 45373 curFromNodeChild = fromNextSibling; 45374 } 45375 cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey); 45376 var specialElHandler = specialElHandlers[fromEl.nodeName]; 45377 if (specialElHandler) { 45378 specialElHandler(fromEl, toEl); 45379 } 45380 } 45381 var morphedNode = fromNode; 45382 var morphedNodeType = morphedNode.nodeType; 45383 var toNodeType = toNode.nodeType; 45384 if (!childrenOnly) { 45385 if (morphedNodeType === ELEMENT_NODE) { 45386 if (toNodeType === ELEMENT_NODE) { 45387 if (!compareNodeNames(fromNode, toNode)) { 45388 onNodeDiscarded(fromNode); 45389 morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI)); 45390 } 45391 } else { 45392 morphedNode = toNode; 45393 } 45394 } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { 45395 if (toNodeType === morphedNodeType) { 45396 if (morphedNode.nodeValue !== toNode.nodeValue) { 45397 morphedNode.nodeValue = toNode.nodeValue; 45398 } 45399 return morphedNode; 45400 } else { 45401 morphedNode = toNode; 45402 } 45403 } 45404 } 45405 if (morphedNode === toNode) { 45406 onNodeDiscarded(fromNode); 45407 } else { 45408 if (toNode.isSameNode && toNode.isSameNode(morphedNode)) { 45409 return; 45410 } 45411 morphEl(morphedNode, toNode, childrenOnly); 45412 if (keyedRemovalList) { 45413 for (var i2 = 0, len2 = keyedRemovalList.length; i2 < len2; i2++) { 45414 var elToRemove = fromNodesLookup[keyedRemovalList[i2]]; 45415 if (elToRemove) { 45416 removeNode(elToRemove, elToRemove.parentNode, false); 45417 } 45418 } 45419 } 45420 } 45421 if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) { 45422 if (morphedNode.actualize) { 45423 morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc); 45424 } 45425 fromNode.parentNode.replaceChild(morphedNode, fromNode); 45426 } 45427 return morphedNode; 45428 }; 45429} 45430var morphdom = morphdomFactory(morphAttrs); 45431function _defineProperties(target, props) { 45432 for (var i2 = 0; i2 < props.length; i2++) { 45433 var descriptor = props[i2]; 45434 descriptor.enumerable = descriptor.enumerable || false; 45435 descriptor.configurable = true; 45436 if ("value" in descriptor) descriptor.writable = true; 45437 Object.defineProperty(target, descriptor.key, descriptor); 45438 } 45439} 45440function _createClass(Constructor, protoProps, staticProps) { 45441 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 45442 return Constructor; 45443} 45444/*! 45445 * Observer 3.12.5 45446 * https://gsap.com 45447 * 45448 * @license Copyright 2008-2024, GreenSock. All rights reserved. 45449 * Subject to the terms at https://gsap.com/standard-license or for 45450 * Club GSAP members, the agreement issued with that membership. 45451 * @author: Jack Doyle, [email protected] 45452*/ 45453var gsap$2, _coreInitted$2, _win$1, _doc$1, _docEl$2, _body$2, _isTouch, _pointerType, ScrollTrigger$2, _root$1, _normalizer$1, _eventTypes, _context$1, _getGSAP$2 = function _getGSAP4() { 45454 return gsap$2 || typeof window !== "undefined" && (gsap$2 = window.gsap) && gsap$2.registerPlugin && gsap$2; 45455}, _startup$1 = 1, _observers = [], _scrollers = [], _proxies = [], _getTime$1 = Date.now, _bridge = function _bridge2(name, value) { 45456 return value; 45457}, _integrate = function _integrate2() { 45458 var core = ScrollTrigger$2.core, data = core.bridge || {}, scrollers = core._scrollers, proxies = core._proxies; 45459 scrollers.push.apply(scrollers, _scrollers);
vendor: 9,242 bytes, lines 45460-45623
45460 proxies.push.apply(proxies, _proxies); 45461 _scrollers = scrollers; 45462 _proxies = proxies; 45463 _bridge = function _bridge3(name, value) { 45464 return data[name](value); 45465 }; 45466}, _getProxyProp = function _getProxyProp2(element, property) { 45467 return ~_proxies.indexOf(element) && _proxies[_proxies.indexOf(element) + 1][property]; 45468}, _isViewport$1 = function _isViewport(el) { 45469 return !!~_root$1.indexOf(el); 45470}, _addListener$1 = function _addListener(element, type, func, passive, capture) { 45471 return element.addEventListener(type, func, { 45472 passive: passive !== false, 45473 capture: !!capture 45474 }); 45475}, _removeListener$1 = function _removeListener(element, type, func, capture) { 45476 return element.removeEventListener(type, func, !!capture); 45477}, _scrollLeft = "scrollLeft", _scrollTop = "scrollTop", _onScroll$1 = function _onScroll() { 45478 return _normalizer$1 && _normalizer$1.isPressed || _scrollers.cache++; 45479}, _scrollCacheFunc = function _scrollCacheFunc2(f2, doNotCache) { 45480 var cachingFunc = function cachingFunc2(value) { 45481 if (value || value === 0) { 45482 _startup$1 && (_win$1.history.scrollRestoration = "manual"); 45483 var isNormalizing = _normalizer$1 && _normalizer$1.isPressed; 45484 value = cachingFunc2.v = Math.round(value) || (_normalizer$1 && _normalizer$1.iOS ? 1 : 0); 45485 f2(value); 45486 cachingFunc2.cacheID = _scrollers.cache; 45487 isNormalizing && _bridge("ss", value); 45488 } else if (doNotCache || _scrollers.cache !== cachingFunc2.cacheID || _bridge("ref")) { 45489 cachingFunc2.cacheID = _scrollers.cache; 45490 cachingFunc2.v = f2(); 45491 } 45492 return cachingFunc2.v + cachingFunc2.offset; 45493 }; 45494 cachingFunc.offset = 0; 45495 return f2 && cachingFunc; 45496}, _horizontal = { 45497 s: _scrollLeft, 45498 p: "left", 45499 p2: "Left", 45500 os: "right", 45501 os2: "Right", 45502 d: "width", 45503 d2: "Width", 45504 a: "x", 45505 sc: _scrollCacheFunc(function(value) { 45506 return arguments.length ? _win$1.scrollTo(value, _vertical.sc()) : _win$1.pageXOffset || _doc$1[_scrollLeft] || _docEl$2[_scrollLeft] || _body$2[_scrollLeft] || 0; 45507 }) 45508}, _vertical = { 45509 s: _scrollTop, 45510 p: "top", 45511 p2: "Top", 45512 os: "bottom", 45513 os2: "Bottom", 45514 d: "height", 45515 d2: "Height", 45516 a: "y", 45517 op: _horizontal, 45518 sc: _scrollCacheFunc(function(value) { 45519 return arguments.length ? _win$1.scrollTo(_horizontal.sc(), value) : _win$1.pageYOffset || _doc$1[_scrollTop] || _docEl$2[_scrollTop] || _body$2[_scrollTop] || 0; 45520 }) 45521}, _getTarget = function _getTarget2(t2, self2) { 45522 return (self2 && self2._ctx && self2._ctx.selector || gsap$2.utils.toArray)(t2)[0] || (typeof t2 === "string" && gsap$2.config().nullTargetWarn !== false ? console.warn("Element not found:", t2) : null); 45523}, _getScrollFunc = function _getScrollFunc2(element, _ref) { 45524 var s2 = _ref.s, sc = _ref.sc; 45525 _isViewport$1(element) && (element = _doc$1.scrollingElement || _docEl$2); 45526 var i2 = _scrollers.indexOf(element), offset = sc === _vertical.sc ? 1 : 2; 45527 !~i2 && (i2 = _scrollers.push(element) - 1); 45528 _scrollers[i2 + offset] || _addListener$1(element, "scroll", _onScroll$1); 45529 var prev = _scrollers[i2 + offset], func = prev || (_scrollers[i2 + offset] = _scrollCacheFunc(_getProxyProp(element, s2), true) || (_isViewport$1(element) ? sc : _scrollCacheFunc(function(value) { 45530 return arguments.length ? element[s2] = value : element[s2]; 45531 }))); 45532 func.target = element; 45533 prev || (func.smooth = gsap$2.getProperty(element, "scrollBehavior") === "smooth"); 45534 return func; 45535}, _getVelocityProp = function _getVelocityProp2(value, minTimeRefresh, useDelta) { 45536 var v1 = value, v2 = value, t1 = _getTime$1(), t2 = t1, min = minTimeRefresh || 50, dropToZeroTime = Math.max(500, min * 3), update = function update2(value2, force) { 45537 var t3 = _getTime$1(); 45538 if (force || t3 - t1 > min) { 45539 v2 = v1; 45540 v1 = value2; 45541 t2 = t1; 45542 t1 = t3; 45543 } else if (useDelta) { 45544 v1 += value2; 45545 } else { 45546 v1 = v2 + (value2 - v2) / (t3 - t2) * (t1 - t2); 45547 } 45548 }, reset2 = function reset3() { 45549 v2 = v1 = useDelta ? 0 : v1; 45550 t2 = t1 = 0; 45551 }, getVelocity = function getVelocity2(latestValue) { 45552 var tOld = t2, vOld = v2, t3 = _getTime$1(); 45553 (latestValue || latestValue === 0) && latestValue !== v1 && update(latestValue); 45554 return t1 === t2 || t3 - t2 > dropToZeroTime ? 0 : (v1 + (useDelta ? vOld : -vOld)) / ((useDelta ? t3 : t1) - tOld) * 1e3; 45555 }; 45556 return { 45557 update, 45558 reset: reset2, 45559 getVelocity 45560 }; 45561}, _getEvent = function _getEvent2(e2, preventDefault) { 45562 preventDefault && !e2._gsapAllow && e2.preventDefault(); 45563 return e2.changedTouches ? e2.changedTouches[0] : e2; 45564}, _getAbsoluteMax = function _getAbsoluteMax2(a2) { 45565 var max = Math.max.apply(Math, a2), min = Math.min.apply(Math, a2); 45566 return Math.abs(max) >= Math.abs(min) ? max : min; 45567}, _setScrollTrigger = function _setScrollTrigger2() { 45568 ScrollTrigger$2 = gsap$2.core.globals().ScrollTrigger; 45569 ScrollTrigger$2 && ScrollTrigger$2.core && _integrate(); 45570}, _initCore$1 = function _initCore4(core) { 45571 gsap$2 = core || _getGSAP$2(); 45572 if (!_coreInitted$2 && gsap$2 && typeof document !== "undefined" && document.body) { 45573 _win$1 = window; 45574 _doc$1 = document; 45575 _docEl$2 = _doc$1.documentElement; 45576 _body$2 = _doc$1.body; 45577 _root$1 = [_win$1, _doc$1, _docEl$2, _body$2]; 45578 gsap$2.utils.clamp; 45579 _context$1 = gsap$2.core.context || function() { 45580 }; 45581 _pointerType = "onpointerenter" in _body$2 ? "pointer" : "mouse"; 45582 _isTouch = Observer.isTouch = _win$1.matchMedia && _win$1.matchMedia("(hover: none), (pointer: coarse)").matches ? 1 : "ontouchstart" in _win$1 || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 ? 2 : 0; 45583 _eventTypes = Observer.eventTypes = ("ontouchstart" in _docEl$2 ? "touchstart,touchmove,touchcancel,touchend" : !("onpointerdown" in _docEl$2) ? "mousedown,mousemove,mouseup,mouseup" : "pointerdown,pointermove,pointercancel,pointerup").split(","); 45584 setTimeout(function() { 45585 return _startup$1 = 0; 45586 }, 500); 45587 _setScrollTrigger(); 45588 _coreInitted$2 = 1; 45589 } 45590 return _coreInitted$2; 45591}; 45592_horizontal.op = _vertical; 45593_scrollers.cache = 0; 45594var Observer = /* @__PURE__ */ function() { 45595 function Observer2(vars) { 45596 this.init(vars); 45597 } 45598 var _proto = Observer2.prototype; 45599 _proto.init = function init7(vars) { 45600 _coreInitted$2 || _initCore$1(gsap$2) || console.warn("Please gsap.registerPlugin(Observer)"); 45601 ScrollTrigger$2 || _setScrollTrigger(); 45602 var tolerance = vars.tolerance, dragMinimum = vars.dragMinimum, type = vars.type, target = vars.target, lineHeight = vars.lineHeight, debounce2 = vars.debounce, preventDefault = vars.preventDefault, onStop = vars.onStop, onStopDelay = vars.onStopDelay, ignore = vars.ignore, wheelSpeed = vars.wheelSpeed, event = vars.event, onDragStart = vars.onDragStart, onDragEnd = vars.onDragEnd, onDrag = vars.onDrag, onPress = vars.onPress, onRelease = vars.onRelease, onRight = vars.onRight, onLeft = vars.onLeft, onUp = vars.onUp, onDown = vars.onDown, onChangeX = vars.onChangeX, onChangeY = vars.onChangeY, onChange = vars.onChange, onToggleX = vars.onToggleX, onToggleY = vars.onToggleY, onHover = vars.onHover, onHoverEnd = vars.onHoverEnd, onMove = vars.onMove, ignoreCheck = vars.ignoreCheck, isNormalizer = vars.isNormalizer, onGestureStart = vars.onGestureStart, onGestureEnd = vars.onGestureEnd, onWheel = vars.onWheel, onEnable = vars.onEnable, onDisable = vars.onDisable, onClick = vars.onClick, scrollSpeed = vars.scrollSpeed, capture = vars.capture, allowClicks = vars.allowClicks, lockAxis = vars.lockAxis, onLockAxis = vars.onLockAxis; 45603 this.target = target = _getTarget(target) || _docEl$2; 45604 this.vars = vars; 45605 ignore && (ignore = gsap$2.utils.toArray(ignore)); 45606 tolerance = tolerance || 1e-9; 45607 dragMinimum = dragMinimum || 0; 45608 wheelSpeed = wheelSpeed || 1; 45609 scrollSpeed = scrollSpeed || 1; 45610 type = type || "wheel,touch,pointer"; 45611 debounce2 = debounce2 !== false; 45612 lineHeight || (lineHeight = parseFloat(_win$1.getComputedStyle(_body$2).lineHeight) || 22); 45613 var id2, onStopDelayedCall, dragged, moved, wheeled, locked, axis, self2 = this, prevDeltaX = 0, prevDeltaY = 0, passive = vars.passive || !preventDefault, scrollFuncX = _getScrollFunc(target, _horizontal), scrollFuncY = _getScrollFunc(target, _vertical), scrollX = scrollFuncX(), scrollY = scrollFuncY(), limitToTouch = ~type.indexOf("touch") && !~type.indexOf("pointer") && _eventTypes[0] === "pointerdown", isViewport = _isViewport$1(target), ownerDoc = target.ownerDocument || _doc$1, deltaX = [0, 0, 0], deltaY = [0, 0, 0], onClickTime = 0, clickCapture = function clickCapture2() { 45614 return onClickTime = _getTime$1(); 45615 }, _ignoreCheck = function _ignoreCheck2(e2, isPointerOrTouch) { 45616 return (self2.event = e2) && ignore && ~ignore.indexOf(e2.target) || isPointerOrTouch && limitToTouch && e2.pointerType !== "touch" || ignoreCheck && ignoreCheck(e2, isPointerOrTouch); 45617 }, onStopFunc = function onStopFunc2() { 45618 self2._vx.reset(); 45619 self2._vy.reset(); 45620 onStopDelayedCall.pause(); 45621 onStop && onStop(self2); 45622 }, update = function update2() { 45623 var dx = self2.deltaX = _getAbsoluteMax(deltaX), dy = self2.deltaY = _getAbsoluteMax(deltaY), changedX = Math.abs(dx) >= tolerance, changedY = Math.abs(dy) >= tolerance;
vendor: 9,220 bytes, lines 45624-45826
45624 onChange && (changedX || changedY) && onChange(self2, dx, dy, deltaX, deltaY); 45625 if (changedX) { 45626 onRight && self2.deltaX > 0 && onRight(self2); 45627 onLeft && self2.deltaX < 0 && onLeft(self2); 45628 onChangeX && onChangeX(self2); 45629 onToggleX && self2.deltaX < 0 !== prevDeltaX < 0 && onToggleX(self2); 45630 prevDeltaX = self2.deltaX; 45631 deltaX[0] = deltaX[1] = deltaX[2] = 0; 45632 } 45633 if (changedY) { 45634 onDown && self2.deltaY > 0 && onDown(self2); 45635 onUp && self2.deltaY < 0 && onUp(self2); 45636 onChangeY && onChangeY(self2); 45637 onToggleY && self2.deltaY < 0 !== prevDeltaY < 0 && onToggleY(self2); 45638 prevDeltaY = self2.deltaY; 45639 deltaY[0] = deltaY[1] = deltaY[2] = 0; 45640 } 45641 if (moved || dragged) { 45642 onMove && onMove(self2); 45643 if (dragged) { 45644 onDrag(self2); 45645 dragged = false; 45646 } 45647 moved = false; 45648 } 45649 locked && !(locked = false) && onLockAxis && onLockAxis(self2); 45650 if (wheeled) { 45651 onWheel(self2); 45652 wheeled = false; 45653 } 45654 id2 = 0; 45655 }, onDelta = function onDelta2(x2, y2, index3) { 45656 deltaX[index3] += x2; 45657 deltaY[index3] += y2; 45658 self2._vx.update(x2); 45659 self2._vy.update(y2); 45660 debounce2 ? id2 || (id2 = requestAnimationFrame(update)) : update(); 45661 }, onTouchOrPointerDelta = function onTouchOrPointerDelta2(x2, y2) { 45662 if (lockAxis && !axis) { 45663 self2.axis = axis = Math.abs(x2) > Math.abs(y2) ? "x" : "y"; 45664 locked = true; 45665 } 45666 if (axis !== "y") { 45667 deltaX[2] += x2; 45668 self2._vx.update(x2, true); 45669 } 45670 if (axis !== "x") { 45671 deltaY[2] += y2; 45672 self2._vy.update(y2, true); 45673 } 45674 debounce2 ? id2 || (id2 = requestAnimationFrame(update)) : update(); 45675 }, _onDrag = function _onDrag2(e2) { 45676 if (_ignoreCheck(e2, 1)) { 45677 return; 45678 } 45679 e2 = _getEvent(e2, preventDefault); 45680 var x2 = e2.clientX, y2 = e2.clientY, dx = x2 - self2.x, dy = y2 - self2.y, isDragging = self2.isDragging; 45681 self2.x = x2; 45682 self2.y = y2; 45683 if (isDragging || Math.abs(self2.startX - x2) >= dragMinimum || Math.abs(self2.startY - y2) >= dragMinimum) { 45684 onDrag && (dragged = true); 45685 isDragging || (self2.isDragging = true); 45686 onTouchOrPointerDelta(dx, dy); 45687 isDragging || onDragStart && onDragStart(self2); 45688 } 45689 }, _onPress = self2.onPress = function(e2) { 45690 if (_ignoreCheck(e2, 1) || e2 && e2.button) { 45691 return; 45692 } 45693 self2.axis = axis = null; 45694 onStopDelayedCall.pause(); 45695 self2.isPressed = true; 45696 e2 = _getEvent(e2); 45697 prevDeltaX = prevDeltaY = 0; 45698 self2.startX = self2.x = e2.clientX; 45699 self2.startY = self2.y = e2.clientY; 45700 self2._vx.reset(); 45701 self2._vy.reset(); 45702 _addListener$1(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, passive, true); 45703 self2.deltaX = self2.deltaY = 0; 45704 onPress && onPress(self2); 45705 }, _onRelease = self2.onRelease = function(e2) { 45706 if (_ignoreCheck(e2, 1)) { 45707 return; 45708 } 45709 _removeListener$1(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 45710 var isTrackingDrag = !isNaN(self2.y - self2.startY), wasDragging = self2.isDragging, isDragNotClick = wasDragging && (Math.abs(self2.x - self2.startX) > 3 || Math.abs(self2.y - self2.startY) > 3), eventData = _getEvent(e2); 45711 if (!isDragNotClick && isTrackingDrag) { 45712 self2._vx.reset(); 45713 self2._vy.reset(); 45714 if (preventDefault && allowClicks) { 45715 gsap$2.delayedCall(0.08, function() { 45716 if (_getTime$1() - onClickTime > 300 && !e2.defaultPrevented) { 45717 if (e2.target.click) { 45718 e2.target.click(); 45719 } else if (ownerDoc.createEvent) { 45720 var syntheticEvent = ownerDoc.createEvent("MouseEvents"); 45721 syntheticEvent.initMouseEvent("click", true, true, _win$1, 1, eventData.screenX, eventData.screenY, eventData.clientX, eventData.clientY, false, false, false, false, 0, null); 45722 e2.target.dispatchEvent(syntheticEvent); 45723 } 45724 } 45725 }); 45726 } 45727 } 45728 self2.isDragging = self2.isGesturing = self2.isPressed = false; 45729 onStop && wasDragging && !isNormalizer && onStopDelayedCall.restart(true); 45730 onDragEnd && wasDragging && onDragEnd(self2); 45731 onRelease && onRelease(self2, isDragNotClick); 45732 }, _onGestureStart = function _onGestureStart2(e2) { 45733 return e2.touches && e2.touches.length > 1 && (self2.isGesturing = true) && onGestureStart(e2, self2.isDragging); 45734 }, _onGestureEnd = function _onGestureEnd2() { 45735 return (self2.isGesturing = false) || onGestureEnd(self2); 45736 }, onScroll = function onScroll2(e2) { 45737 if (_ignoreCheck(e2)) { 45738 return; 45739 } 45740 var x2 = scrollFuncX(), y2 = scrollFuncY(); 45741 onDelta((x2 - scrollX) * scrollSpeed, (y2 - scrollY) * scrollSpeed, 1); 45742 scrollX = x2; 45743 scrollY = y2; 45744 onStop && onStopDelayedCall.restart(true); 45745 }, _onWheel = function _onWheel2(e2) { 45746 if (_ignoreCheck(e2)) { 45747 return; 45748 } 45749 e2 = _getEvent(e2, preventDefault); 45750 onWheel && (wheeled = true); 45751 var multiplier = (e2.deltaMode === 1 ? lineHeight : e2.deltaMode === 2 ? _win$1.innerHeight : 1) * wheelSpeed; 45752 onDelta(e2.deltaX * multiplier, e2.deltaY * multiplier, 0); 45753 onStop && !isNormalizer && onStopDelayedCall.restart(true); 45754 }, _onMove = function _onMove2(e2) { 45755 if (_ignoreCheck(e2)) { 45756 return; 45757 } 45758 var x2 = e2.clientX, y2 = e2.clientY, dx = x2 - self2.x, dy = y2 - self2.y; 45759 self2.x = x2; 45760 self2.y = y2; 45761 moved = true; 45762 onStop && onStopDelayedCall.restart(true); 45763 (dx || dy) && onTouchOrPointerDelta(dx, dy); 45764 }, _onHover = function _onHover2(e2) { 45765 self2.event = e2; 45766 onHover(self2); 45767 }, _onHoverEnd = function _onHoverEnd2(e2) { 45768 self2.event = e2; 45769 onHoverEnd(self2); 45770 }, _onClick = function _onClick2(e2) { 45771 return _ignoreCheck(e2) || _getEvent(e2, preventDefault) && onClick(self2); 45772 }; 45773 onStopDelayedCall = self2._dc = gsap$2.delayedCall(onStopDelay || 0.25, onStopFunc).pause(); 45774 self2.deltaX = self2.deltaY = 0; 45775 self2._vx = _getVelocityProp(0, 50, true); 45776 self2._vy = _getVelocityProp(0, 50, true); 45777 self2.scrollX = scrollFuncX; 45778 self2.scrollY = scrollFuncY; 45779 self2.isDragging = self2.isGesturing = self2.isPressed = false; 45780 _context$1(this); 45781 self2.enable = function(e2) { 45782 if (!self2.isEnabled) { 45783 _addListener$1(isViewport ? ownerDoc : target, "scroll", _onScroll$1); 45784 type.indexOf("scroll") >= 0 && _addListener$1(isViewport ? ownerDoc : target, "scroll", onScroll, passive, capture); 45785 type.indexOf("wheel") >= 0 && _addListener$1(target, "wheel", _onWheel, passive, capture); 45786 if (type.indexOf("touch") >= 0 && _isTouch || type.indexOf("pointer") >= 0) { 45787 _addListener$1(target, _eventTypes[0], _onPress, passive, capture); 45788 _addListener$1(ownerDoc, _eventTypes[2], _onRelease); 45789 _addListener$1(ownerDoc, _eventTypes[3], _onRelease); 45790 allowClicks && _addListener$1(target, "click", clickCapture, true, true); 45791 onClick && _addListener$1(target, "click", _onClick); 45792 onGestureStart && _addListener$1(ownerDoc, "gesturestart", _onGestureStart); 45793 onGestureEnd && _addListener$1(ownerDoc, "gestureend", _onGestureEnd); 45794 onHover && _addListener$1(target, _pointerType + "enter", _onHover); 45795 onHoverEnd && _addListener$1(target, _pointerType + "leave", _onHoverEnd); 45796 onMove && _addListener$1(target, _pointerType + "move", _onMove); 45797 } 45798 self2.isEnabled = true; 45799 e2 && e2.type && _onPress(e2); 45800 onEnable && onEnable(self2); 45801 } 45802 return self2; 45803 }; 45804 self2.disable = function() { 45805 if (self2.isEnabled) { 45806 _observers.filter(function(o2) { 45807 return o2 !== self2 && _isViewport$1(o2.target); 45808 }).length || _removeListener$1(isViewport ? ownerDoc : target, "scroll", _onScroll$1); 45809 if (self2.isPressed) { 45810 self2._vx.reset(); 45811 self2._vy.reset(); 45812 _removeListener$1(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 45813 } 45814 _removeListener$1(isViewport ? ownerDoc : target, "scroll", onScroll, capture); 45815 _removeListener$1(target, "wheel", _onWheel, capture); 45816 _removeListener$1(target, _eventTypes[0], _onPress, capture); 45817 _removeListener$1(ownerDoc, _eventTypes[2], _onRelease); 45818 _removeListener$1(ownerDoc, _eventTypes[3], _onRelease); 45819 _removeListener$1(target, "click", clickCapture, true); 45820 _removeListener$1(target, "click", _onClick); 45821 _removeListener$1(ownerDoc, "gesturestart", _onGestureStart); 45822 _removeListener$1(ownerDoc, "gestureend", _onGestureEnd); 45823 _removeListener$1(target, _pointerType + "enter", _onHover); 45824 _removeListener$1(target, _pointerType + "leave", _onHoverEnd); 45825 _removeListener$1(target, _pointerType + "move", _onMove); 45826 self2.isEnabled = self2.isPressed = self2.isDragging = false;
vendor: 5,351 bytes, lines 45827-45940
45827 onDisable && onDisable(self2); 45828 } 45829 }; 45830 self2.kill = self2.revert = function() { 45831 self2.disable(); 45832 var i2 = _observers.indexOf(self2); 45833 i2 >= 0 && _observers.splice(i2, 1); 45834 _normalizer$1 === self2 && (_normalizer$1 = 0); 45835 }; 45836 _observers.push(self2); 45837 isNormalizer && _isViewport$1(target) && (_normalizer$1 = self2); 45838 self2.enable(event); 45839 }; 45840 _createClass(Observer2, [{ 45841 key: "velocityX", 45842 get: function get4() { 45843 return this._vx.getVelocity(); 45844 } 45845 }, { 45846 key: "velocityY", 45847 get: function get4() { 45848 return this._vy.getVelocity(); 45849 } 45850 }]); 45851 return Observer2; 45852}(); 45853Observer.version = "3.12.5"; 45854Observer.create = function(vars) { 45855 return new Observer(vars); 45856}; 45857Observer.register = _initCore$1; 45858Observer.getAll = function() { 45859 return _observers.slice(); 45860}; 45861Observer.getById = function(id2) { 45862 return _observers.filter(function(o2) { 45863 return o2.vars.id === id2; 45864 })[0]; 45865}; 45866_getGSAP$2() && gsap$2.registerPlugin(Observer); 45867/*! 45868 * ScrollTrigger 3.12.5 45869 * https://gsap.com 45870 * 45871 * @license Copyright 2008-2024, GreenSock. All rights reserved. 45872 * Subject to the terms at https://gsap.com/standard-license or for 45873 * Club GSAP members, the agreement issued with that membership. 45874 * @author: Jack Doyle, [email protected] 45875*/ 45876var gsap$1, _coreInitted$1, _win, _doc, _docEl$1, _body$1, _root, _resizeDelay, _toArray$1, _clamp2, _time2, _syncInterval, _refreshing, _pointerIsDown, _transformProp, _i, _prevWidth, _prevHeight, _autoRefresh, _sort, _suppressOverwrites, _ignoreResize, _normalizer, _ignoreMobileResize, _baseScreenHeight, _baseScreenWidth, _fixIOSBug, _context, _scrollRestoration, _div100vh, _100vh, _isReverted, _clampingMax, _limitCallbacks, _startup = 1, _getTime = Date.now, _time1 = _getTime(), _lastScrollTime = 0, _enabled = 0, _parseClamp = function _parseClamp2(value, type, self2) { 45877 var clamp3 = _isString$1(value) && (value.substr(0, 6) === "clamp(" || value.indexOf("max") > -1); 45878 self2["_" + type + "Clamp"] = clamp3; 45879 return clamp3 ? value.substr(6, value.length - 7) : value; 45880}, _keepClamp = function _keepClamp2(value, clamp3) { 45881 return clamp3 && (!_isString$1(value) || value.substr(0, 6) !== "clamp(") ? "clamp(" + value + ")" : value; 45882}, _rafBugFix = function _rafBugFix2() { 45883 return _enabled && requestAnimationFrame(_rafBugFix2); 45884}, _pointerDownHandler = function _pointerDownHandler2() { 45885 return _pointerIsDown = 1; 45886}, _pointerUpHandler = function _pointerUpHandler2() { 45887 return _pointerIsDown = 0; 45888}, _passThrough2 = function _passThrough3(v2) { 45889 return v2; 45890}, _round5 = function _round6(value) { 45891 return Math.round(value * 1e5) / 1e5 || 0; 45892}, _windowExists$1 = function _windowExists4() { 45893 return typeof window !== "undefined"; 45894}, _getGSAP$1 = function _getGSAP5() { 45895 return gsap$1 || _windowExists$1() && (gsap$1 = window.gsap) && gsap$1.registerPlugin && gsap$1; 45896}, _isViewport2 = function _isViewport3(e2) { 45897 return !!~_root.indexOf(e2); 45898}, _getViewportDimension = function _getViewportDimension2(dimensionProperty) { 45899 return (dimensionProperty === "Height" ? _100vh : _win["inner" + dimensionProperty]) || _docEl$1["client" + dimensionProperty] || _body$1["client" + dimensionProperty]; 45900}, _getBoundsFunc = function _getBoundsFunc2(element) { 45901 return _getProxyProp(element, "getBoundingClientRect") || (_isViewport2(element) ? function() { 45902 _winOffsets.width = _win.innerWidth; 45903 _winOffsets.height = _100vh; 45904 return _winOffsets; 45905 } : function() { 45906 return _getBounds(element); 45907 }); 45908}, _getSizeFunc = function _getSizeFunc2(scroller, isViewport, _ref) { 45909 var d2 = _ref.d, d22 = _ref.d2, a2 = _ref.a; 45910 return (a2 = _getProxyProp(scroller, "getBoundingClientRect")) ? function() { 45911 return a2()[d2]; 45912 } : function() { 45913 return (isViewport ? _getViewportDimension(d22) : scroller["client" + d22]) || 0; 45914 }; 45915}, _getOffsetsFunc = function _getOffsetsFunc2(element, isViewport) { 45916 return !isViewport || ~_proxies.indexOf(element) ? _getBoundsFunc(element) : function() { 45917 return _winOffsets; 45918 }; 45919}, _maxScroll2 = function _maxScroll3(element, _ref22) { 45920 var s2 = _ref22.s, d2 = _ref22.d2, d3 = _ref22.d, a2 = _ref22.a; 45921 return Math.max(0, (s2 = "scroll" + d2) && (a2 = _getProxyProp(element, s2)) ? a2() - _getBoundsFunc(element)()[d3] : _isViewport2(element) ? (_docEl$1[s2] || _body$1[s2]) - _getViewportDimension(d2) : element[s2] - element["offset" + d2]); 45922}, _iterateAutoRefresh = function _iterateAutoRefresh2(func, events2) { 45923 for (var i2 = 0; i2 < _autoRefresh.length; i2 += 3) { 45924 (!events2 || ~events2.indexOf(_autoRefresh[i2 + 1])) && func(_autoRefresh[i2], _autoRefresh[i2 + 1], _autoRefresh[i2 + 2]); 45925 } 45926}, _isString$1 = function _isString3(value) { 45927 return typeof value === "string"; 45928}, _isFunction$1 = function _isFunction3(value) { 45929 return typeof value === "function"; 45930}, _isNumber3 = function _isNumber4(value) { 45931 return typeof value === "number"; 45932}, _isObject2 = function _isObject3(value) { 45933 return typeof value === "object"; 45934}, _endAnimation = function _endAnimation2(animation, reversed, pause) { 45935 return animation && animation.progress(reversed ? 0 : 1) && pause && animation.pause(); 45936}, _callback2 = function _callback3(self2, func) { 45937 if (self2.enabled) { 45938 var result = self2._ctx ? self2._ctx.add(function() { 45939 return func(self2); 45940 }) : func(self2);
vendor: 5,837 bytes, lines 45941-46069
45941 result && result.totalTime && (self2.callbackAnimation = result); 45942 } 45943}, _abs = Math.abs, _left = "left", _top = "top", _right = "right", _bottom = "bottom", _width = "width", _height = "height", _Right = "Right", _Left = "Left", _Top = "Top", _Bottom = "Bottom", _padding = "padding", _margin = "margin", _Width = "Width", _Height = "Height", _px = "px", _getComputedStyle2 = function _getComputedStyle3(element) { 45944 return _win.getComputedStyle(element); 45945}, _makePositionable = function _makePositionable2(element) { 45946 var position = _getComputedStyle2(element).position; 45947 element.style.position = position === "absolute" || position === "fixed" ? position : "relative"; 45948}, _setDefaults2 = function _setDefaults3(obj, defaults3) { 45949 for (var p2 in defaults3) { 45950 p2 in obj || (obj[p2] = defaults3[p2]); 45951 } 45952 return obj; 45953}, _getBounds = function _getBounds2(element, withoutTransforms) { 45954 var tween = withoutTransforms && _getComputedStyle2(element)[_transformProp] !== "matrix(1, 0, 0, 1, 0, 0)" && gsap$1.to(element, { 45955 x: 0, 45956 y: 0, 45957 xPercent: 0, 45958 yPercent: 0, 45959 rotation: 0, 45960 rotationX: 0, 45961 rotationY: 0, 45962 scale: 1, 45963 skewX: 0, 45964 skewY: 0 45965 }).progress(1), bounds = element.getBoundingClientRect(); 45966 tween && tween.progress(0).kill(); 45967 return bounds; 45968}, _getSize2 = function _getSize3(element, _ref3) { 45969 var d2 = _ref3.d2; 45970 return element["offset" + d2] || element["client" + d2] || 0; 45971}, _getLabelRatioArray = function _getLabelRatioArray2(timeline2) { 45972 var a2 = [], labels = timeline2.labels, duration = timeline2.duration(), p2; 45973 for (p2 in labels) { 45974 a2.push(labels[p2] / duration); 45975 } 45976 return a2; 45977}, _getClosestLabel = function _getClosestLabel2(animation) { 45978 return function(value) { 45979 return gsap$1.utils.snap(_getLabelRatioArray(animation), value); 45980 }; 45981}, _snapDirectional = function _snapDirectional2(snapIncrementOrArray) { 45982 var snap3 = gsap$1.utils.snap(snapIncrementOrArray), a2 = Array.isArray(snapIncrementOrArray) && snapIncrementOrArray.slice(0).sort(function(a3, b2) { 45983 return a3 - b2; 45984 }); 45985 return a2 ? function(value, direction, threshold) { 45986 if (threshold === void 0) { 45987 threshold = 1e-3; 45988 } 45989 var i2; 45990 if (!direction) { 45991 return snap3(value); 45992 } 45993 if (direction > 0) { 45994 value -= threshold; 45995 for (i2 = 0; i2 < a2.length; i2++) { 45996 if (a2[i2] >= value) { 45997 return a2[i2]; 45998 } 45999 } 46000 return a2[i2 - 1]; 46001 } else { 46002 i2 = a2.length; 46003 value += threshold; 46004 while (i2--) { 46005 if (a2[i2] <= value) { 46006 return a2[i2]; 46007 } 46008 } 46009 } 46010 return a2[0]; 46011 } : function(value, direction, threshold) { 46012 if (threshold === void 0) { 46013 threshold = 1e-3; 46014 } 46015 var snapped = snap3(value); 46016 return !direction || Math.abs(snapped - value) < threshold || snapped - value < 0 === direction < 0 ? snapped : snap3(direction < 0 ? value - snapIncrementOrArray : value + snapIncrementOrArray); 46017 }; 46018}, _getLabelAtDirection = function _getLabelAtDirection2(timeline2) { 46019 return function(value, st) { 46020 return _snapDirectional(_getLabelRatioArray(timeline2))(value, st.direction); 46021 }; 46022}, _multiListener = function _multiListener2(func, element, types, callback) { 46023 return types.split(",").forEach(function(type) { 46024 return func(element, type, callback); 46025 }); 46026}, _addListener2 = function _addListener3(element, type, func, nonPassive, capture) { 46027 return element.addEventListener(type, func, { 46028 passive: !nonPassive, 46029 capture: !!capture 46030 }); 46031}, _removeListener2 = function _removeListener3(element, type, func, capture) { 46032 return element.removeEventListener(type, func, !!capture); 46033}, _wheelListener = function _wheelListener2(func, el, scrollFunc) { 46034 scrollFunc = scrollFunc && scrollFunc.wheelHandler; 46035 if (scrollFunc) { 46036 func(el, "wheel", scrollFunc); 46037 func(el, "touchmove", scrollFunc); 46038 } 46039}, _markerDefaults = { 46040 startColor: "green", 46041 endColor: "red", 46042 indent: 0, 46043 fontSize: "16px", 46044 fontWeight: "normal" 46045}, _defaults = { 46046 toggleActions: "play", 46047 anticipatePin: 0 46048}, _keywords = { 46049 top: 0, 46050 left: 0, 46051 center: 0.5, 46052 bottom: 1, 46053 right: 1 46054}, _offsetToPx = function _offsetToPx2(value, size) { 46055 if (_isString$1(value)) { 46056 var eqIndex = value.indexOf("="), relative = ~eqIndex ? +(value.charAt(eqIndex - 1) + 1) * parseFloat(value.substr(eqIndex + 1)) : 0; 46057 if (~eqIndex) { 46058 value.indexOf("%") > eqIndex && (relative *= size / 100); 46059 value = value.substr(0, eqIndex - 1); 46060 } 46061 value = relative + (value in _keywords ? _keywords[value] * size : ~value.indexOf("%") ? parseFloat(value) * size / 100 : parseFloat(value) || 0); 46062 } 46063 return value; 46064}, _createMarker = function _createMarker2(type, name, container, direction, _ref42, offset, matchWidthEl, containerAnimation) { 46065 var startColor = _ref42.startColor, endColor = _ref42.endColor, fontSize = _ref42.fontSize, indent = _ref42.indent, fontWeight = _ref42.fontWeight; 46066 var e2 = _doc.createElement("div"), useFixedPosition = _isViewport2(container) || _getProxyProp(container, "pinType") === "fixed", isScroller = type.indexOf("scroller") !== -1, parent = useFixedPosition ? _body$1 : container, isStart = type.indexOf("start") !== -1, color = isStart ? startColor : endColor, css = "border-color:" + color + ";font-size:" + fontSize + ";color:" + color + ";font-weight:" + fontWeight + ";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;"; 46067 css += "position:" + ((isScroller || containerAnimation) && useFixedPosition ? "fixed;" : "absolute;"); 46068 (isScroller || containerAnimation || !useFixedPosition) && (css += (direction === _vertical ? _right : _bottom) + ":" + (offset + parseFloat(indent)) + "px;"); 46069 matchWidthEl && (css += "box-sizing:border-box;text-align:left;
vendor: 14,706 bytes, lines 46069-46403
46069width:" + matchWidthEl.offsetWidth + "px;"); 46070 e2._isStart = isStart; 46071 e2.setAttribute("class", "gsap-marker-" + type + (name ? " marker-" + name : "")); 46072 e2.style.cssText = css; 46073 e2.innerText = name || name === 0 ? type + "-" + name : type; 46074 parent.children[0] ? parent.insertBefore(e2, parent.children[0]) : parent.appendChild(e2); 46075 e2._offset = e2["offset" + direction.op.d2]; 46076 _positionMarker(e2, 0, direction, isStart); 46077 return e2; 46078}, _positionMarker = function _positionMarker2(marker, start2, direction, flipped) { 46079 var vars = { 46080 display: "block" 46081 }, side = direction[flipped ? "os2" : "p2"], oppositeSide = direction[flipped ? "p2" : "os2"]; 46082 marker._isFlipped = flipped; 46083 vars[direction.a + "Percent"] = flipped ? -100 : 0; 46084 vars[direction.a] = flipped ? "1px" : 0; 46085 vars["border" + side + _Width] = 1; 46086 vars["border" + oppositeSide + _Width] = 0; 46087 vars[direction.p] = start2 + "px"; 46088 gsap$1.set(marker, vars); 46089}, _triggers = [], _ids = {}, _rafID, _sync = function _sync2() { 46090 return _getTime() - _lastScrollTime > 34 && (_rafID || (_rafID = requestAnimationFrame(_updateAll))); 46091}, _onScroll2 = function _onScroll3() { 46092 if (!_normalizer || !_normalizer.isPressed || _normalizer.startX > _body$1.clientWidth) { 46093 _scrollers.cache++; 46094 if (_normalizer) { 46095 _rafID || (_rafID = requestAnimationFrame(_updateAll)); 46096 } else { 46097 _updateAll(); 46098 } 46099 _lastScrollTime || _dispatch2("scrollStart"); 46100 _lastScrollTime = _getTime(); 46101 } 46102}, _setBaseDimensions = function _setBaseDimensions2() { 46103 _baseScreenWidth = _win.innerWidth; 46104 _baseScreenHeight = _win.innerHeight; 46105}, _onResize = function _onResize2() { 46106 _scrollers.cache++; 46107 !_refreshing && !_ignoreResize && !_doc.fullscreenElement && !_doc.webkitFullscreenElement && (!_ignoreMobileResize || _baseScreenWidth !== _win.innerWidth || Math.abs(_win.innerHeight - _baseScreenHeight) > _win.innerHeight * 0.25) && _resizeDelay.restart(true); 46108}, _listeners = {}, _emptyArray = [], _softRefresh = function _softRefresh2() { 46109 return _removeListener2(ScrollTrigger$1, "scrollEnd", _softRefresh2) || _refreshAll(true); 46110}, _dispatch2 = function _dispatch3(type) { 46111 return _listeners[type] && _listeners[type].map(function(f2) { 46112 return f2(); 46113 }) || _emptyArray; 46114}, _savedStyles = [], _revertRecorded = function _revertRecorded2(media) { 46115 for (var i2 = 0; i2 < _savedStyles.length; i2 += 5) { 46116 if (!media || _savedStyles[i2 + 4] && _savedStyles[i2 + 4].query === media) { 46117 _savedStyles[i2].style.cssText = _savedStyles[i2 + 1]; 46118 _savedStyles[i2].getBBox && _savedStyles[i2].setAttribute("transform", _savedStyles[i2 + 2] || ""); 46119 _savedStyles[i2 + 3].uncache = 1; 46120 } 46121 } 46122}, _revertAll = function _revertAll2(kill3, media) { 46123 var trigger; 46124 for (_i = 0; _i < _triggers.length; _i++) { 46125 trigger = _triggers[_i]; 46126 if (trigger && (!media || trigger._ctx === media)) { 46127 if (kill3) { 46128 trigger.kill(1); 46129 } else { 46130 trigger.revert(true, true); 46131 } 46132 } 46133 } 46134 _isReverted = true; 46135 media && _revertRecorded(media); 46136 media || _dispatch2("revert"); 46137}, _clearScrollMemory = function _clearScrollMemory2(scrollRestoration, force) { 46138 _scrollers.cache++; 46139 (force || !_refreshingAll) && _scrollers.forEach(function(obj) { 46140 return _isFunction$1(obj) && obj.cacheID++ && (obj.rec = 0); 46141 }); 46142 _isString$1(scrollRestoration) && (_win.history.scrollRestoration = _scrollRestoration = scrollRestoration); 46143}, _refreshingAll, _refreshID = 0, _queueRefreshID, _queueRefreshAll = function _queueRefreshAll2() { 46144 if (_queueRefreshID !== _refreshID) { 46145 var id2 = _queueRefreshID = _refreshID; 46146 requestAnimationFrame(function() { 46147 return id2 === _refreshID && _refreshAll(true); 46148 }); 46149 } 46150}, _refresh100vh = function _refresh100vh2() { 46151 _body$1.appendChild(_div100vh); 46152 _100vh = !_normalizer && _div100vh.offsetHeight || _win.innerHeight; 46153 _body$1.removeChild(_div100vh); 46154}, _hideAllMarkers = function _hideAllMarkers2(hide) { 46155 return _toArray$1(".gsap-marker-start, .gsap-marker-end, .gsap-marker-scroller-start, .gsap-marker-scroller-end").forEach(function(el) { 46156 return el.style.display = hide ? "none" : "block"; 46157 }); 46158}, _refreshAll = function _refreshAll2(force, skipRevert) { 46159 if (_lastScrollTime && !force && !_isReverted) { 46160 _addListener2(ScrollTrigger$1, "scrollEnd", _softRefresh); 46161 return; 46162 } 46163 _refresh100vh(); 46164 _refreshingAll = ScrollTrigger$1.isRefreshing = true; 46165 _scrollers.forEach(function(obj) { 46166 return _isFunction$1(obj) && ++obj.cacheID && (obj.rec = obj()); 46167 }); 46168 var refreshInits = _dispatch2("refreshInit"); 46169 _sort && ScrollTrigger$1.sort(); 46170 skipRevert || _revertAll(); 46171 _scrollers.forEach(function(obj) { 46172 if (_isFunction$1(obj)) { 46173 obj.smooth && (obj.target.style.scrollBehavior = "auto"); 46174 obj(0); 46175 } 46176 }); 46177 _triggers.slice(0).forEach(function(t2) { 46178 return t2.refresh(); 46179 }); 46180 _isReverted = false; 46181 _triggers.forEach(function(t2) { 46182 if (t2._subPinOffset && t2.pin) { 46183 var prop = t2.vars.horizontal ? "offsetWidth" : "offsetHeight", original = t2.pin[prop]; 46184 t2.revert(true, 1); 46185 t2.adjustPinSpacing(t2.pin[prop] - original); 46186 t2.refresh(); 46187 } 46188 }); 46189 _clampingMax = 1; 46190 _hideAllMarkers(true); 46191 _triggers.forEach(function(t2) { 46192 var max = _maxScroll2(t2.scroller, t2._dir), endClamp = t2.vars.end === "max" || t2._endClamp && t2.end > max, startClamp = t2._startClamp && t2.start >= max; 46193 (endClamp || startClamp) && t2.setPositions(startClamp ? max - 1 : t2.start, endClamp ? Math.max(startClamp ? max : t2.start + 1, max) : t2.end, true); 46194 }); 46195 _hideAllMarkers(false); 46196 _clampingMax = 0; 46197 refreshInits.forEach(function(result) { 46198 return result && result.render && result.render(-1); 46199 }); 46200 _scrollers.forEach(function(obj) { 46201 if (_isFunction$1(obj)) { 46202 obj.smooth && requestAnimationFrame(function() { 46203 return obj.target.style.scrollBehavior = "smooth"; 46204 }); 46205 obj.rec && obj(obj.rec); 46206 } 46207 }); 46208 _clearScrollMemory(_scrollRestoration, 1); 46209 _resizeDelay.pause(); 46210 _refreshID++; 46211 _refreshingAll = 2; 46212 _updateAll(2); 46213 _triggers.forEach(function(t2) { 46214 return _isFunction$1(t2.vars.onRefresh) && t2.vars.onRefresh(t2); 46215 }); 46216 _refreshingAll = ScrollTrigger$1.isRefreshing = false; 46217 _dispatch2("refresh"); 46218}, _lastScroll = 0, _direction = 1, _primary, _updateAll = function _updateAll2(force) { 46219 if (force === 2 || !_refreshingAll && !_isReverted) { 46220 ScrollTrigger$1.isUpdating = true; 46221 _primary && _primary.update(0); 46222 var l2 = _triggers.length, time = _getTime(), recordVelocity = time - _time1 >= 50, scroll = l2 && _triggers[0].scroll(); 46223 _direction = _lastScroll > scroll ? -1 : 1; 46224 _refreshingAll || (_lastScroll = scroll); 46225 if (recordVelocity) { 46226 if (_lastScrollTime && !_pointerIsDown && time - _lastScrollTime > 200) { 46227 _lastScrollTime = 0; 46228 _dispatch2("scrollEnd"); 46229 } 46230 _time2 = _time1; 46231 _time1 = time; 46232 } 46233 if (_direction < 0) { 46234 _i = l2; 46235 while (_i-- > 0) { 46236 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 46237 } 46238 _direction = 1; 46239 } else { 46240 for (_i = 0; _i < l2; _i++) { 46241 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 46242 } 46243 } 46244 ScrollTrigger$1.isUpdating = false; 46245 } 46246 _rafID = 0; 46247}, _propNamesToCopy = [_left, _top, _bottom, _right, _margin + _Bottom, _margin + _Right, _margin + _Top, _margin + _Left, "display", "flexShrink", "float", "zIndex", "gridColumnStart", "gridColumnEnd", "gridRowStart", "gridRowEnd", "gridArea", "justifySelf", "alignSelf", "placeSelf", "order"], _stateProps = _propNamesToCopy.concat([_width, _height, "boxSizing", "max" + _Width, "max" + _Height, "position", _margin, _padding, _padding + _Top, _padding + _Right, _padding + _Bottom, _padding + _Left]), _swapPinOut = function _swapPinOut2(pin, spacer, state) { 46248 _setState(state); 46249 var cache2 = pin._gsap; 46250 if (cache2.spacerIsNative) { 46251 _setState(cache2.spacerState); 46252 } else if (pin._gsap.swappedIn) { 46253 var parent = spacer.parentNode; 46254 if (parent) { 46255 parent.insertBefore(pin, spacer); 46256 parent.removeChild(spacer); 46257 } 46258 } 46259 pin._gsap.swappedIn = false; 46260}, _swapPinIn = function _swapPinIn2(pin, spacer, cs, spacerState) { 46261 if (!pin._gsap.swappedIn) { 46262 var i2 = _propNamesToCopy.length, spacerStyle = spacer.style, pinStyle = pin.style, p2; 46263 while (i2--) { 46264 p2 = _propNamesToCopy[i2]; 46265 spacerStyle[p2] = cs[p2]; 46266 } 46267 spacerStyle.position = cs.position === "absolute" ? "absolute" : "relative"; 46268 cs.display === "inline" && (spacerStyle.display = "inline-block"); 46269 pinStyle[_bottom] = pinStyle[_right] = "auto"; 46270 spacerStyle.flexBasis = cs.flexBasis || "auto"; 46271 spacerStyle.overflow = "visible"; 46272 spacerStyle.boxSizing = "border-box"; 46273 spacerStyle[_width] = _getSize2(pin, _horizontal) + _px; 46274 spacerStyle[_height] = _getSize2(pin, _vertical) + _px; 46275 spacerStyle[_padding] = pinStyle[_margin] = pinStyle[_top] = pinStyle[_left] = "0"; 46276 _setState(spacerState); 46277 pinStyle[_width] = pinStyle["max" + _Width] = cs[_width]; 46278 pinStyle[_height] = pinStyle["max" + _Height] = cs[_height]; 46279 pinStyle[_padding] = cs[_padding]; 46280 if (pin.parentNode !== spacer) { 46281 pin.parentNode.insertBefore(spacer, pin); 46282 spacer.appendChild(pin); 46283 } 46284 pin._gsap.swappedIn = true; 46285 } 46286}, _capsExp = /([A-Z])/g, _setState = function _setState2(state) { 46287 if (state) { 46288 var style = state.t.style, l2 = state.length, i2 = 0, p2, value; 46289 (state.t._gsap || gsap$1.core.getCache(state.t)).uncache = 1; 46290 for (; i2 < l2; i2 += 2) { 46291 value = state[i2 + 1]; 46292 p2 = state[i2]; 46293 if (value) { 46294 style[p2] = value; 46295 } else if (style[p2]) { 46296 style.removeProperty(p2.replace(_capsExp, "-$1").toLowerCase()); 46297 } 46298 } 46299 } 46300}, _getState = function _getState2(element) { 46301 var l2 = _stateProps.length, style = element.style, state = [], i2 = 0; 46302 for (; i2 < l2; i2++) { 46303 state.push(_stateProps[i2], style[_stateProps[i2]]); 46304 } 46305 state.t = element; 46306 return state; 46307}, _copyState = function _copyState2(state, override, omitOffsets) { 46308 var result = [], l2 = state.length, i2 = omitOffsets ? 8 : 0, p2; 46309 for (; i2 < l2; i2 += 2) { 46310 p2 = state[i2]; 46311 result.push(p2, p2 in override ? override[p2] : state[i2 + 1]); 46312 } 46313 result.t = state.t; 46314 return result; 46315}, _winOffsets = { 46316 left: 0, 46317 top: 0 46318}, _parsePosition2 = function _parsePosition3(value, trigger, scrollerSize, direction, scroll, marker, markerScroller, self2, scrollerBounds, borderWidth, useFixedPosition, scrollerMax, containerAnimation, clampZeroProp) { 46319 _isFunction$1(value) && (value = value(self2)); 46320 if (_isString$1(value) && value.substr(0, 3) === "max") { 46321 value = scrollerMax + (value.charAt(4) === "=" ? _offsetToPx("0" + value.substr(3), scrollerSize) : 0); 46322 } 46323 var time = containerAnimation ? containerAnimation.time() : 0, p1, p2, element; 46324 containerAnimation && containerAnimation.seek(0); 46325 isNaN(value) || (value = +value); 46326 if (!_isNumber3(value)) { 46327 _isFunction$1(trigger) && (trigger = trigger(self2)); 46328 var offsets = (value || "0").split(" "), bounds, localOffset, globalOffset, display; 46329 element = _getTarget(trigger, self2) || _body$1; 46330 bounds = _getBounds(element) || {}; 46331 if ((!bounds || !bounds.left && !bounds.top) && _getComputedStyle2(element).display === "none") { 46332 display = element.style.display; 46333 element.style.display = "block"; 46334 bounds = _getBounds(element); 46335 display ? element.style.display = display : element.style.removeProperty("display"); 46336 } 46337 localOffset = _offsetToPx(offsets[0], bounds[direction.d]); 46338 globalOffset = _offsetToPx(offsets[1] || "0", scrollerSize); 46339 value = bounds[direction.p] - scrollerBounds[direction.p] - borderWidth + localOffset + scroll - globalOffset; 46340 markerScroller && _positionMarker(markerScroller, globalOffset, direction, scrollerSize - globalOffset < 20 || markerScroller._isStart && globalOffset > 20); 46341 scrollerSize -= scrollerSize - globalOffset; 46342 } else { 46343 containerAnimation && (value = gsap$1.utils.mapRange(containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, 0, scrollerMax, value)); 46344 markerScroller && _positionMarker(markerScroller, scrollerSize, direction, true); 46345 } 46346 if (clampZeroProp) { 46347 self2[clampZeroProp] = value || -1e-3; 46348 value < 0 && (value = 0); 46349 } 46350 if (marker) { 46351 var position = value + scrollerSize, isStart = marker._isStart; 46352 p1 = "scroll" + direction.d2; 46353 _positionMarker(marker, position, direction, isStart && position > 20 || !isStart && (useFixedPosition ? Math.max(_body$1[p1], _docEl$1[p1]) : marker.parentNode[p1]) <= position + 1); 46354 if (useFixedPosition) { 46355 scrollerBounds = _getBounds(markerScroller); 46356 useFixedPosition && (marker.style[direction.op.p] = scrollerBounds[direction.op.p] - direction.op.m - marker._offset + _px); 46357 } 46358 } 46359 if (containerAnimation && element) { 46360 p1 = _getBounds(element); 46361 containerAnimation.seek(scrollerMax); 46362 p2 = _getBounds(element); 46363 containerAnimation._caScrollDist = p1[direction.p] - p2[direction.p]; 46364 value = value / containerAnimation._caScrollDist * scrollerMax; 46365 } 46366 containerAnimation && containerAnimation.seek(time); 46367 return containerAnimation ? value : Math.round(value); 46368}, _prefixExp = /(webkit|moz|length|cssText|inset)/i, _reparent = function _reparent2(element, parent, top, left) { 46369 if (element.parentNode !== parent) { 46370 var style = element.style, p2, cs; 46371 if (parent === _body$1) { 46372 element._stOrig = style.cssText; 46373 cs = _getComputedStyle2(element); 46374 for (p2 in cs) { 46375 if (!+p2 && !_prefixExp.test(p2) && cs[p2] && typeof style[p2] === "string" && p2 !== "0") { 46376 style[p2] = cs[p2]; 46377 } 46378 } 46379 style.top = top; 46380 style.left = left; 46381 } else { 46382 style.cssText = element._stOrig; 46383 } 46384 gsap$1.core.getCache(element).uncache = 1; 46385 parent.appendChild(element); 46386 } 46387}, _interruptionTracker = function _interruptionTracker2(getValueFunc, initialValue, onInterrupt) { 46388 var last1 = initialValue, last2 = last1; 46389 return function(value) { 46390 var current = Math.round(getValueFunc()); 46391 if (current !== last1 && current !== last2 && Math.abs(current - last1) > 3 && Math.abs(current - last2) > 3) { 46392 value = current; 46393 onInterrupt && onInterrupt(); 46394 } 46395 last2 = last1; 46396 last1 = value; 46397 return value; 46398 }; 46399}, _shiftMarker = function _shiftMarker2(marker, direction, value) { 46400 var vars = {}; 46401 vars[direction.p] = "+=" + value; 46402 gsap$1.set(marker, vars); 46403}, _getTweenCreator = function _getTweenCreator2(scroller, direction) {
vendor: 4,306 bytes, lines 46404-46459
46404 var getScroll = _getScrollFunc(scroller, direction), prop = "_scroll" + direction.p2, getTween = function getTween2(scrollTo, vars, initialValue, change1, change2) { 46405 var tween = getTween2.tween, onComplete = vars.onComplete, modifiers = {}; 46406 initialValue = initialValue || getScroll(); 46407 var checkForInterruption = _interruptionTracker(getScroll, initialValue, function() { 46408 tween.kill(); 46409 getTween2.tween = 0; 46410 }); 46411 change2 = change1 && change2 || 0; 46412 change1 = change1 || scrollTo - initialValue; 46413 tween && tween.kill(); 46414 vars[prop] = scrollTo; 46415 vars.inherit = false; 46416 vars.modifiers = modifiers; 46417 modifiers[prop] = function() { 46418 return checkForInterruption(initialValue + change1 * tween.ratio + change2 * tween.ratio * tween.ratio); 46419 }; 46420 vars.onUpdate = function() { 46421 _scrollers.cache++; 46422 getTween2.tween && _updateAll(); 46423 }; 46424 vars.onComplete = function() { 46425 getTween2.tween = 0; 46426 onComplete && onComplete.call(tween); 46427 }; 46428 tween = getTween2.tween = gsap$1.to(scroller, vars); 46429 return tween; 46430 }; 46431 scroller[prop] = getScroll; 46432 getScroll.wheelHandler = function() { 46433 return getTween.tween && getTween.tween.kill() && (getTween.tween = 0); 46434 }; 46435 _addListener2(scroller, "wheel", getScroll.wheelHandler); 46436 ScrollTrigger$1.isTouch && _addListener2(scroller, "touchmove", getScroll.wheelHandler); 46437 return getTween; 46438}; 46439var ScrollTrigger$1 = /* @__PURE__ */ function() { 46440 function ScrollTrigger2(vars, animation) { 46441 _coreInitted$1 || ScrollTrigger2.register(gsap$1) || console.warn("Please gsap.registerPlugin(ScrollTrigger)"); 46442 _context(this); 46443 this.init(vars, animation); 46444 } 46445 var _proto = ScrollTrigger2.prototype; 46446 _proto.init = function init7(vars, animation) { 46447 this.progress = this.start = 0; 46448 this.vars && this.kill(true, true); 46449 if (!_enabled) { 46450 this.update = this.refresh = this.kill = _passThrough2; 46451 return; 46452 } 46453 vars = _setDefaults2(_isString$1(vars) || _isNumber3(vars) || vars.nodeType ? { 46454 trigger: vars 46455 } : vars, _defaults); 46456 var _vars = vars, onUpdate = _vars.onUpdate, toggleClass = _vars.toggleClass, id2 = _vars.id, onToggle = _vars.onToggle, onRefresh = _vars.onRefresh, scrub = _vars.scrub, trigger = _vars.trigger, pin = _vars.pin, pinSpacing = _vars.pinSpacing, invalidateOnRefresh = _vars.invalidateOnRefresh, anticipatePin = _vars.anticipatePin, onScrubComplete = _vars.onScrubComplete, onSnapComplete = _vars.onSnapComplete, once = _vars.once, snap3 = _vars.snap, pinReparent = _vars.pinReparent, pinSpacer = _vars.pinSpacer, containerAnimation = _vars.containerAnimation, fastScrollEnd = _vars.fastScrollEnd, preventOverlaps = _vars.preventOverlaps, direction = vars.horizontal || vars.containerAnimation && vars.horizontal !== false ? _horizontal : _vertical, isToggle = !scrub && scrub !== 0, scroller = _getTarget(vars.scroller || _win), scrollerCache = gsap$1.core.getCache(scroller), isViewport = _isViewport2(scroller), useFixedPosition = ("pinType" in vars ? vars.pinType : _getProxyProp(scroller, "pinType") || isViewport && "fixed") === "fixed", callbacks = [vars.onEnter, vars.onLeave, vars.onEnterBack, vars.onLeaveBack], toggleActions = isToggle && vars.toggleActions.split(" "), markers = "markers" in vars ? vars.markers : _defaults.markers, borderWidth = isViewport ? 0 : parseFloat(_getComputedStyle2(scroller)["border" + direction.p2 + _Width]) || 0, self2 = this, onRefreshInit = vars.onRefreshInit && function() { 46457 return vars.onRefreshInit(self2); 46458 }, getScrollerSize = _getSizeFunc(scroller, isViewport, direction), getScrollerOffsets = _getOffsetsFunc(scroller, isViewport), lastSnap = 0, lastRefresh = 0, prevProgress = 0, scrollFunc = _getScrollFunc(scroller, direction), tweenTo, pinCache, snapFunc, scroll1, scroll2, start2, end, markerStart, markerEnd, markerStartTrigger, markerEndTrigger, markerVars, executingOnRefresh, change, pinOriginalState, pinActiveState, pinState, spacer, offset, pinGetter, pinSetter, pinStart, pinChange, spacingStart, spacerState, markerStartSetter, pinMoves, markerEndSetter, cs, snap1, snap22, scrubTween, scrubSmooth, snapDurClamp, snapDelayedCall, prevScroll, prevAnimProgress, caMarkerSetter, customRevertReturn; 46459 self2._startClamp = self2._endClamp = false;
vendor: 4,379 bytes, lines 46460-46541
46460 self2._dir = direction; 46461 anticipatePin *= 45; 46462 self2.scroller = scroller; 46463 self2.scroll = containerAnimation ? containerAnimation.time.bind(containerAnimation) : scrollFunc; 46464 scroll1 = scrollFunc(); 46465 self2.vars = vars; 46466 animation = animation || vars.animation; 46467 if ("refreshPriority" in vars) { 46468 _sort = 1; 46469 vars.refreshPriority === -9999 && (_primary = self2); 46470 } 46471 scrollerCache.tweenScroll = scrollerCache.tweenScroll || { 46472 top: _getTweenCreator(scroller, _vertical), 46473 left: _getTweenCreator(scroller, _horizontal) 46474 }; 46475 self2.tweenTo = tweenTo = scrollerCache.tweenScroll[direction.p]; 46476 self2.scrubDuration = function(value) { 46477 scrubSmooth = _isNumber3(value) && value; 46478 if (!scrubSmooth) { 46479 scrubTween && scrubTween.progress(1).kill(); 46480 scrubTween = 0; 46481 } else { 46482 scrubTween ? scrubTween.duration(value) : scrubTween = gsap$1.to(animation, { 46483 ease: "expo", 46484 totalProgress: "+=0", 46485 inherit: false, 46486 duration: scrubSmooth, 46487 paused: true, 46488 onComplete: function onComplete() { 46489 return onScrubComplete && onScrubComplete(self2); 46490 } 46491 }); 46492 } 46493 }; 46494 if (animation) { 46495 animation.vars.lazy = false; 46496 animation._initted && !self2.isReverted || animation.vars.immediateRender !== false && vars.immediateRender !== false && animation.duration() && animation.render(0, true, true); 46497 self2.animation = animation.pause(); 46498 animation.scrollTrigger = self2; 46499 self2.scrubDuration(scrub); 46500 snap1 = 0; 46501 id2 || (id2 = animation.vars.id); 46502 } 46503 if (snap3) { 46504 if (!_isObject2(snap3) || snap3.push) { 46505 snap3 = { 46506 snapTo: snap3 46507 }; 46508 } 46509 "scrollBehavior" in _body$1.style && gsap$1.set(isViewport ? [_body$1, _docEl$1] : scroller, { 46510 scrollBehavior: "auto" 46511 }); 46512 _scrollers.forEach(function(o2) { 46513 return _isFunction$1(o2) && o2.target === (isViewport ? _doc.scrollingElement || _docEl$1 : scroller) && (o2.smooth = false); 46514 }); 46515 snapFunc = _isFunction$1(snap3.snapTo) ? snap3.snapTo : snap3.snapTo === "labels" ? _getClosestLabel(animation) : snap3.snapTo === "labelsDirectional" ? _getLabelAtDirection(animation) : snap3.directional !== false ? function(value, st) { 46516 return _snapDirectional(snap3.snapTo)(value, _getTime() - lastRefresh < 500 ? 0 : st.direction); 46517 } : gsap$1.utils.snap(snap3.snapTo); 46518 snapDurClamp = snap3.duration || { 46519 min: 0.1, 46520 max: 2 46521 }; 46522 snapDurClamp = _isObject2(snapDurClamp) ? _clamp2(snapDurClamp.min, snapDurClamp.max) : _clamp2(snapDurClamp, snapDurClamp); 46523 snapDelayedCall = gsap$1.delayedCall(snap3.delay || scrubSmooth / 2 || 0.1, function() { 46524 var scroll = scrollFunc(), refreshedRecently = _getTime() - lastRefresh < 500, tween = tweenTo.tween; 46525 if ((refreshedRecently || Math.abs(self2.getVelocity()) < 10) && !tween && !_pointerIsDown && lastSnap !== scroll) { 46526 var progress = (scroll - start2) / change, totalProgress = animation && !isToggle ? animation.totalProgress() : progress, velocity = refreshedRecently ? 0 : (totalProgress - snap22) / (_getTime() - _time2) * 1e3 || 0, change1 = gsap$1.utils.clamp(-progress, 1 - progress, _abs(velocity / 2) * velocity / 0.185), naturalEnd = progress + (snap3.inertia === false ? 0 : change1), endValue, endScroll, _snap = snap3, onStart = _snap.onStart, _onInterrupt = _snap.onInterrupt, _onComplete = _snap.onComplete; 46527 endValue = snapFunc(naturalEnd, self2); 46528 _isNumber3(endValue) || (endValue = naturalEnd); 46529 endScroll = Math.round(start2 + endValue * change); 46530 if (scroll <= end && scroll >= start2 && endScroll !== scroll) { 46531 if (tween && !tween._initted && tween.data <= _abs(endScroll - scroll)) { 46532 return; 46533 } 46534 if (snap3.inertia === false) { 46535 change1 = endValue - progress; 46536 } 46537 tweenTo(endScroll, { 46538 duration: snapDurClamp(_abs(Math.max(_abs(naturalEnd - totalProgress), _abs(endValue - totalProgress)) * 0.185 / velocity / 0.05 || 0)), 46539 ease: snap3.ease || "power3", 46540 data: _abs(endScroll - scroll), 46541 // record the distance so that if another snap tween occurs (conflict) we
vendor: 4,088 bytes, lines 46541-46619
46541can prioritize the closest snap. 46542 onInterrupt: function onInterrupt() { 46543 return snapDelayedCall.restart(true) && _onInterrupt && _onInterrupt(self2); 46544 }, 46545 onComplete: function onComplete() { 46546 self2.update(); 46547 lastSnap = scrollFunc(); 46548 if (animation) { 46549 scrubTween ? scrubTween.resetTo("totalProgress", endValue, animation._tTime / animation._tDur) : animation.progress(endValue); 46550 } 46551 snap1 = snap22 = animation && !isToggle ? animation.totalProgress() : self2.progress; 46552 onSnapComplete && onSnapComplete(self2); 46553 _onComplete && _onComplete(self2); 46554 } 46555 }, scroll, change1 * change, endScroll - scroll - change1 * change); 46556 onStart && onStart(self2, tweenTo.tween); 46557 } 46558 } else if (self2.isActive && lastSnap !== scroll) { 46559 snapDelayedCall.restart(true); 46560 } 46561 }).pause(); 46562 } 46563 id2 && (_ids[id2] = self2); 46564 trigger = self2.trigger = _getTarget(trigger || pin !== true && pin); 46565 customRevertReturn = trigger && trigger._gsap && trigger._gsap.stRevert; 46566 customRevertReturn && (customRevertReturn = customRevertReturn(self2)); 46567 pin = pin === true ? trigger : _getTarget(pin); 46568 _isString$1(toggleClass) && (toggleClass = { 46569 targets: trigger, 46570 className: toggleClass 46571 }); 46572 if (pin) { 46573 pinSpacing === false || pinSpacing === _margin || (pinSpacing = !pinSpacing && pin.parentNode && pin.parentNode.style && _getComputedStyle2(pin.parentNode).display === "flex" ? false : _padding); 46574 self2.pin = pin; 46575 pinCache = gsap$1.core.getCache(pin); 46576 if (!pinCache.spacer) { 46577 if (pinSpacer) { 46578 pinSpacer = _getTarget(pinSpacer); 46579 pinSpacer && !pinSpacer.nodeType && (pinSpacer = pinSpacer.current || pinSpacer.nativeElement); 46580 pinCache.spacerIsNative = !!pinSpacer; 46581 pinSpacer && (pinCache.spacerState = _getState(pinSpacer)); 46582 } 46583 pinCache.spacer = spacer = pinSpacer || _doc.createElement("div"); 46584 spacer.classList.add("pin-spacer"); 46585 id2 && spacer.classList.add("pin-spacer-" + id2); 46586 pinCache.pinState = pinOriginalState = _getState(pin); 46587 } else { 46588 pinOriginalState = pinCache.pinState; 46589 } 46590 vars.force3D !== false && gsap$1.set(pin, { 46591 force3D: true 46592 }); 46593 self2.spacer = spacer = pinCache.spacer; 46594 cs = _getComputedStyle2(pin); 46595 spacingStart = cs[pinSpacing + direction.os2]; 46596 pinGetter = gsap$1.getProperty(pin); 46597 pinSetter = gsap$1.quickSetter(pin, direction.a, _px); 46598 _swapPinIn(pin, spacer, cs); 46599 pinState = _getState(pin); 46600 } 46601 if (markers) { 46602 markerVars = _isObject2(markers) ? _setDefaults2(markers, _markerDefaults) : _markerDefaults; 46603 markerStartTrigger = _createMarker("scroller-start", id2, scroller, direction, markerVars, 0); 46604 markerEndTrigger = _createMarker("scroller-end", id2, scroller, direction, markerVars, 0, markerStartTrigger); 46605 offset = markerStartTrigger["offset" + direction.op.d2]; 46606 var content = _getTarget(_getProxyProp(scroller, "content") || scroller); 46607 markerStart = this.markerStart = _createMarker("start", id2, content, direction, markerVars, offset, 0, containerAnimation); 46608 markerEnd = this.markerEnd = _createMarker("end", id2, content, direction, markerVars, offset, 0, containerAnimation); 46609 containerAnimation && (caMarkerSetter = gsap$1.quickSetter([markerStart, markerEnd], direction.a, _px)); 46610 if (!useFixedPosition && !(_proxies.length && _getProxyProp(scroller, "fixedMarkers") === true)) { 46611 _makePositionable(isViewport ? _body$1 : scroller); 46612 gsap$1.set([markerStartTrigger, markerEndTrigger], { 46613 force3D: true 46614 }); 46615 markerStartSetter = gsap$1.quickSetter(markerStartTrigger, direction.a, _px); 46616 markerEndSetter = gsap$1.quickSetter(markerEndTrigger, direction.a, _px); 46617 } 46618 } 46619 if (containerAnimation) {
vendor: 4,780 bytes, lines 46620-46710
46620 var oldOnUpdate = containerAnimation.vars.onUpdate, oldParams = containerAnimation.vars.onUpdateParams; 46621 containerAnimation.eventCallback("onUpdate", function() { 46622 self2.update(0, 0, 1); 46623 oldOnUpdate && oldOnUpdate.apply(containerAnimation, oldParams || []); 46624 }); 46625 } 46626 self2.previous = function() { 46627 return _triggers[_triggers.indexOf(self2) - 1]; 46628 }; 46629 self2.next = function() { 46630 return _triggers[_triggers.indexOf(self2) + 1]; 46631 }; 46632 self2.revert = function(revert, temp) { 46633 if (!temp) { 46634 return self2.kill(true); 46635 } 46636 var r2 = revert !== false || !self2.enabled, prevRefreshing = _refreshing; 46637 if (r2 !== self2.isReverted) { 46638 if (r2) { 46639 prevScroll = Math.max(scrollFunc(), self2.scroll.rec || 0); 46640 prevProgress = self2.progress; 46641 prevAnimProgress = animation && animation.progress(); 46642 } 46643 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function(m2) { 46644 return m2.style.display = r2 ? "none" : "block"; 46645 }); 46646 if (r2) { 46647 _refreshing = self2; 46648 self2.update(r2); 46649 } 46650 if (pin && (!pinReparent || !self2.isActive)) { 46651 if (r2) { 46652 _swapPinOut(pin, spacer, pinOriginalState); 46653 } else { 46654 _swapPinIn(pin, spacer, _getComputedStyle2(pin), spacerState); 46655 } 46656 } 46657 r2 || self2.update(r2); 46658 _refreshing = prevRefreshing; 46659 self2.isReverted = r2; 46660 } 46661 }; 46662 self2.refresh = function(soft, force, position, pinOffset) { 46663 if ((_refreshing || !self2.enabled) && !force) { 46664 return; 46665 } 46666 if (pin && soft && _lastScrollTime) { 46667 _addListener2(ScrollTrigger2, "scrollEnd", _softRefresh); 46668 return; 46669 } 46670 !_refreshingAll && onRefreshInit && onRefreshInit(self2); 46671 _refreshing = self2; 46672 if (tweenTo.tween && !position) { 46673 tweenTo.tween.kill(); 46674 tweenTo.tween = 0; 46675 } 46676 scrubTween && scrubTween.pause(); 46677 invalidateOnRefresh && animation && animation.revert({ 46678 kill: false 46679 }).invalidate(); 46680 self2.isReverted || self2.revert(true, true); 46681 self2._subPinOffset = false; 46682 var size = getScrollerSize(), scrollerBounds = getScrollerOffsets(), max = containerAnimation ? containerAnimation.duration() : _maxScroll2(scroller, direction), isFirstRefresh = change <= 0.01, offset2 = 0, otherPinOffset = pinOffset || 0, parsedEnd = _isObject2(position) ? position.end : vars.end, parsedEndTrigger = vars.endTrigger || trigger, parsedStart = _isObject2(position) ? position.start : vars.start || (vars.start === 0 || !trigger ? 0 : pin ? "0 0" : "0 100%"), pinnedContainer = self2.pinnedContainer = vars.pinnedContainer && _getTarget(vars.pinnedContainer, self2), triggerIndex = trigger && Math.max(0, _triggers.indexOf(self2)) || 0, i2 = triggerIndex, cs2, bounds, scroll, isVertical, override, curTrigger, curPin, oppositeScroll, initted, revertedPins, forcedOverflow, markerStartOffset, markerEndOffset; 46683 if (markers && _isObject2(position)) { 46684 markerStartOffset = gsap$1.getProperty(markerStartTrigger, direction.p); 46685 markerEndOffset = gsap$1.getProperty(markerEndTrigger, direction.p); 46686 } 46687 while (i2--) { 46688 curTrigger = _triggers[i2]; 46689 curTrigger.end || curTrigger.refresh(0, 1) || (_refreshing = self2); 46690 curPin = curTrigger.pin; 46691 if (curPin && (curPin === trigger || curPin === pin || curPin === pinnedContainer) && !curTrigger.isReverted) { 46692 revertedPins || (revertedPins = []); 46693 revertedPins.unshift(curTrigger); 46694 curTrigger.revert(true, true); 46695 } 46696 if (curTrigger !== _triggers[i2]) { 46697 triggerIndex--; 46698 i2--; 46699 } 46700 } 46701 _isFunction$1(parsedStart) && (parsedStart = parsedStart(self2)); 46702 parsedStart = _parseClamp(parsedStart, "start", self2); 46703 start2 = _parsePosition2(parsedStart, trigger, size, direction, scrollFunc(), markerStart, markerStartTrigger, self2, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation, self2._startClamp && "_startClamp") || (pin ? -1e-3 : 0); 46704 _isFunction$1(parsedEnd) && (parsedEnd = parsedEnd(self2)); 46705 if (_isString$1(parsedEnd) && !parsedEnd.indexOf("+=")) { 46706 if (~parsedEnd.indexOf(" ")) { 46707 parsedEnd = (_isString$1(parsedStart) ? parsedStart.split(" ")[0] : "") + parsedEnd; 46708 } else { 46709 offset2 = _offsetToPx(parsedEnd.substr(2), size); 46710 parsedEnd = _isString$1(parsedStart) ? parsedStart : (containerAnimation ? gsap$1.utils.mapRange(0, containerAnimation.duration(), containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, start2)
vendor: 7,242 bytes, lines 46710-46853
46710: start2) + offset2; 46711 parsedEndTrigger = trigger; 46712 } 46713 } 46714 parsedEnd = _parseClamp(parsedEnd, "end", self2); 46715 end = Math.max(start2, _parsePosition2(parsedEnd || (parsedEndTrigger ? "100% 0" : max), parsedEndTrigger, size, direction, scrollFunc() + offset2, markerEnd, markerEndTrigger, self2, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation, self2._endClamp && "_endClamp")) || -1e-3; 46716 offset2 = 0; 46717 i2 = triggerIndex; 46718 while (i2--) { 46719 curTrigger = _triggers[i2]; 46720 curPin = curTrigger.pin; 46721 if (curPin && curTrigger.start - curTrigger._pinPush <= start2 && !containerAnimation && curTrigger.end > 0) { 46722 cs2 = curTrigger.end - (self2._startClamp ? Math.max(0, curTrigger.start) : curTrigger.start); 46723 if ((curPin === trigger && curTrigger.start - curTrigger._pinPush < start2 || curPin === pinnedContainer) && isNaN(parsedStart)) { 46724 offset2 += cs2 * (1 - curTrigger.progress); 46725 } 46726 curPin === pin && (otherPinOffset += cs2); 46727 } 46728 } 46729 start2 += offset2; 46730 end += offset2; 46731 self2._startClamp && (self2._startClamp += offset2); 46732 if (self2._endClamp && !_refreshingAll) { 46733 self2._endClamp = end || -1e-3; 46734 end = Math.min(end, _maxScroll2(scroller, direction)); 46735 } 46736 change = end - start2 || (start2 -= 0.01) && 1e-3; 46737 if (isFirstRefresh) { 46738 prevProgress = gsap$1.utils.clamp(0, 1, gsap$1.utils.normalize(start2, end, prevScroll)); 46739 } 46740 self2._pinPush = otherPinOffset; 46741 if (markerStart && offset2) { 46742 cs2 = {}; 46743 cs2[direction.a] = "+=" + offset2; 46744 pinnedContainer && (cs2[direction.p] = "-=" + scrollFunc()); 46745 gsap$1.set([markerStart, markerEnd], cs2); 46746 } 46747 if (pin && !(_clampingMax && self2.end >= _maxScroll2(scroller, direction))) { 46748 cs2 = _getComputedStyle2(pin); 46749 isVertical = direction === _vertical; 46750 scroll = scrollFunc(); 46751 pinStart = parseFloat(pinGetter(direction.a)) + otherPinOffset; 46752 if (!max && end > 1) { 46753 forcedOverflow = (isViewport ? _doc.scrollingElement || _docEl$1 : scroller).style; 46754 forcedOverflow = { 46755 style: forcedOverflow, 46756 value: forcedOverflow["overflow" + direction.a.toUpperCase()] 46757 }; 46758 if (isViewport && _getComputedStyle2(_body$1)["overflow" + direction.a.toUpperCase()] !== "scroll") { 46759 forcedOverflow.style["overflow" + direction.a.toUpperCase()] = "scroll"; 46760 } 46761 } 46762 _swapPinIn(pin, spacer, cs2); 46763 pinState = _getState(pin); 46764 bounds = _getBounds(pin, true); 46765 oppositeScroll = useFixedPosition && _getScrollFunc(scroller, isVertical ? _horizontal : _vertical)(); 46766 if (pinSpacing) { 46767 spacerState = [pinSpacing + direction.os2, change + otherPinOffset + _px]; 46768 spacerState.t = spacer; 46769 i2 = pinSpacing === _padding ? _getSize2(pin, direction) + change + otherPinOffset : 0; 46770 if (i2) { 46771 spacerState.push(direction.d, i2 + _px); 46772 spacer.style.flexBasis !== "auto" && (spacer.style.flexBasis = i2 + _px); 46773 } 46774 _setState(spacerState); 46775 if (pinnedContainer) { 46776 _triggers.forEach(function(t2) { 46777 if (t2.pin === pinnedContainer && t2.vars.pinSpacing !== false) { 46778 t2._subPinOffset = true; 46779 } 46780 }); 46781 } 46782 useFixedPosition && scrollFunc(prevScroll); 46783 } else { 46784 i2 = _getSize2(pin, direction); 46785 i2 && spacer.style.flexBasis !== "auto" && (spacer.style.flexBasis = i2 + _px); 46786 } 46787 if (useFixedPosition) { 46788 override = { 46789 top: bounds.top + (isVertical ? scroll - start2 : oppositeScroll) + _px, 46790 left: bounds.left + (isVertical ? oppositeScroll : scroll - start2) + _px, 46791 boxSizing: "border-box", 46792 position: "fixed" 46793 }; 46794 override[_width] = override["max" + _Width] = Math.ceil(bounds.width) + _px; 46795 override[_height] = override["max" + _Height] = Math.ceil(bounds.height) + _px; 46796 override[_margin] = override[_margin + _Top] = override[_margin + _Right] = override[_margin + _Bottom] = override[_margin + _Left] = "0"; 46797 override[_padding] = cs2[_padding]; 46798 override[_padding + _Top] = cs2[_padding + _Top]; 46799 override[_padding + _Right] = cs2[_padding + _Right]; 46800 override[_padding + _Bottom] = cs2[_padding + _Bottom]; 46801 override[_padding + _Left] = cs2[_padding + _Left]; 46802 pinActiveState = _copyState(pinOriginalState, override, pinReparent); 46803 _refreshingAll && scrollFunc(0); 46804 } 46805 if (animation) { 46806 initted = animation._initted; 46807 _suppressOverwrites(1); 46808 animation.render(animation.duration(), true, true); 46809 pinChange = pinGetter(direction.a) - pinStart + change + otherPinOffset; 46810 pinMoves = Math.abs(change - pinChange) > 1; 46811 useFixedPosition && pinMoves && pinActiveState.splice(pinActiveState.length - 2, 2); 46812 animation.render(0, true, true); 46813 initted || animation.invalidate(true); 46814 animation.parent || animation.totalTime(animation.totalTime()); 46815 _suppressOverwrites(0); 46816 } else { 46817 pinChange = change; 46818 } 46819 forcedOverflow && (forcedOverflow.value ? forcedOverflow.style["overflow" + direction.a.toUpperCase()] = forcedOverflow.value : forcedOverflow.style.removeProperty("overflow-" + direction.a)); 46820 } else if (trigger && scrollFunc() && !containerAnimation) { 46821 bounds = trigger.parentNode; 46822 while (bounds && bounds !== _body$1) { 46823 if (bounds._pinOffset) { 46824 start2 -= bounds._pinOffset; 46825 end -= bounds._pinOffset; 46826 } 46827 bounds = bounds.parentNode; 46828 } 46829 } 46830 revertedPins && revertedPins.forEach(function(t2) { 46831 return t2.revert(false, true); 46832 }); 46833 self2.start = start2; 46834 self2.end = end; 46835 scroll1 = scroll2 = _refreshingAll ? prevScroll : scrollFunc(); 46836 if (!containerAnimation && !_refreshingAll) { 46837 scroll1 < prevScroll && scrollFunc(prevScroll); 46838 self2.scroll.rec = 0; 46839 } 46840 self2.revert(false, true); 46841 lastRefresh = _getTime(); 46842 if (snapDelayedCall) { 46843 lastSnap = -1; 46844 snapDelayedCall.restart(true); 46845 } 46846 _refreshing = 0; 46847 animation && isToggle && (animation._initted || prevAnimProgress) && animation.progress() !== prevAnimProgress && animation.progress(prevAnimProgress || 0, true).render(animation.time(), true, true); 46848 if (isFirstRefresh || prevProgress !== self2.progress || containerAnimation || invalidateOnRefresh) { 46849 animation && !isToggle && animation.totalProgress(containerAnimation && start2 < -1e-3 && !prevProgress ? gsap$1.utils.normalize(start2, end, 0) : prevProgress, true); 46850 self2.progress = isFirstRefresh || (scroll1 - start2) / change === prevProgress ? 0 : prevProgress; 46851 } 46852 pin && pinSpacing && (spacer._pinOffset = Math.round(self2.progress * pinChange)); 46853 scrubTween && scrubTween.invalidate();
vendor: 26,418 bytes, lines 46854-47428
46854 if (!isNaN(markerStartOffset)) { 46855 markerStartOffset -= gsap$1.getProperty(markerStartTrigger, direction.p); 46856 markerEndOffset -= gsap$1.getProperty(markerEndTrigger, direction.p); 46857 _shiftMarker(markerStartTrigger, direction, markerStartOffset); 46858 _shiftMarker(markerStart, direction, markerStartOffset - (pinOffset || 0)); 46859 _shiftMarker(markerEndTrigger, direction, markerEndOffset); 46860 _shiftMarker(markerEnd, direction, markerEndOffset - (pinOffset || 0)); 46861 } 46862 isFirstRefresh && !_refreshingAll && self2.update(); 46863 if (onRefresh && !_refreshingAll && !executingOnRefresh) { 46864 executingOnRefresh = true; 46865 onRefresh(self2); 46866 executingOnRefresh = false; 46867 } 46868 }; 46869 self2.getVelocity = function() { 46870 return (scrollFunc() - scroll2) / (_getTime() - _time2) * 1e3 || 0; 46871 }; 46872 self2.endAnimation = function() { 46873 _endAnimation(self2.callbackAnimation); 46874 if (animation) { 46875 scrubTween ? scrubTween.progress(1) : !animation.paused() ? _endAnimation(animation, animation.reversed()) : isToggle || _endAnimation(animation, self2.direction < 0, 1); 46876 } 46877 }; 46878 self2.labelToScroll = function(label) { 46879 return animation && animation.labels && (start2 || self2.refresh() || start2) + animation.labels[label] / animation.duration() * change || 0; 46880 }; 46881 self2.getTrailing = function(name) { 46882 var i2 = _triggers.indexOf(self2), a2 = self2.direction > 0 ? _triggers.slice(0, i2).reverse() : _triggers.slice(i2 + 1); 46883 return (_isString$1(name) ? a2.filter(function(t2) { 46884 return t2.vars.preventOverlaps === name; 46885 }) : a2).filter(function(t2) { 46886 return self2.direction > 0 ? t2.end <= start2 : t2.start >= end; 46887 }); 46888 }; 46889 self2.update = function(reset2, recordVelocity, forceFake) { 46890 if (containerAnimation && !forceFake && !reset2) { 46891 return; 46892 } 46893 var scroll = _refreshingAll === true ? prevScroll : self2.scroll(), p2 = reset2 ? 0 : (scroll - start2) / change, clipped = p2 < 0 ? 0 : p2 > 1 ? 1 : p2 || 0, prevProgress2 = self2.progress, isActive, wasActive, toggleState, action, stateChanged, toggled, isAtMax, isTakingAction; 46894 if (recordVelocity) { 46895 scroll2 = scroll1; 46896 scroll1 = containerAnimation ? scrollFunc() : scroll; 46897 if (snap3) { 46898 snap22 = snap1; 46899 snap1 = animation && !isToggle ? animation.totalProgress() : clipped; 46900 } 46901 } 46902 if (anticipatePin && pin && !_refreshing && !_startup && _lastScrollTime) { 46903 if (!clipped && start2 < scroll + (scroll - scroll2) / (_getTime() - _time2) * anticipatePin) { 46904 clipped = 1e-4; 46905 } else if (clipped === 1 && end > scroll + (scroll - scroll2) / (_getTime() - _time2) * anticipatePin) { 46906 clipped = 0.9999; 46907 } 46908 } 46909 if (clipped !== prevProgress2 && self2.enabled) { 46910 isActive = self2.isActive = !!clipped && clipped < 1; 46911 wasActive = !!prevProgress2 && prevProgress2 < 1; 46912 toggled = isActive !== wasActive; 46913 stateChanged = toggled || !!clipped !== !!prevProgress2; 46914 self2.direction = clipped > prevProgress2 ? 1 : -1; 46915 self2.progress = clipped; 46916 if (stateChanged && !_refreshing) { 46917 toggleState = clipped && !prevProgress2 ? 0 : clipped === 1 ? 1 : prevProgress2 === 1 ? 2 : 3; 46918 if (isToggle) { 46919 action = !toggled && toggleActions[toggleState + 1] !== "none" && toggleActions[toggleState + 1] || toggleActions[toggleState]; 46920 isTakingAction = animation && (action === "complete" || action === "reset" || action in animation); 46921 } 46922 } 46923 preventOverlaps && (toggled || isTakingAction) && (isTakingAction || scrub || !animation) && (_isFunction$1(preventOverlaps) ? preventOverlaps(self2) : self2.getTrailing(preventOverlaps).forEach(function(t2) { 46924 return t2.endAnimation(); 46925 })); 46926 if (!isToggle) { 46927 if (scrubTween && !_refreshing && !_startup) { 46928 scrubTween._dp._time - scrubTween._start !== scrubTween._time && scrubTween.render(scrubTween._dp._time - scrubTween._start); 46929 if (scrubTween.resetTo) { 46930 scrubTween.resetTo("totalProgress", clipped, animation._tTime / animation._tDur); 46931 } else { 46932 scrubTween.vars.totalProgress = clipped; 46933 scrubTween.invalidate().restart(); 46934 } 46935 } else if (animation) { 46936 animation.totalProgress(clipped, !!(_refreshing && (lastRefresh || reset2))); 46937 } 46938 } 46939 if (pin) { 46940 reset2 && pinSpacing && (spacer.style[pinSpacing + direction.os2] = spacingStart); 46941 if (!useFixedPosition) { 46942 pinSetter(_round5(pinStart + pinChange * clipped)); 46943 } else if (stateChanged) { 46944 isAtMax = !reset2 && clipped > prevProgress2 && end + 1 > scroll && scroll + 1 >= _maxScroll2(scroller, direction); 46945 if (pinReparent) { 46946 if (!reset2 && (isActive || isAtMax)) { 46947 var bounds = _getBounds(pin, true), _offset = scroll - start2; 46948 _reparent(pin, _body$1, bounds.top + (direction === _vertical ? _offset : 0) + _px, bounds.left + (direction === _vertical ? 0 : _offset) + _px); 46949 } else { 46950 _reparent(pin, spacer); 46951 } 46952 } 46953 _setState(isActive || isAtMax ? pinActiveState : pinState); 46954 pinMoves && clipped < 1 && isActive || pinSetter(pinStart + (clipped === 1 && !isAtMax ? pinChange : 0)); 46955 } 46956 } 46957 snap3 && !tweenTo.tween && !_refreshing && !_startup && snapDelayedCall.restart(true); 46958 toggleClass && (toggled || once && clipped && (clipped < 1 || !_limitCallbacks)) && _toArray$1(toggleClass.targets).forEach(function(el) { 46959 return el.classList[isActive || once ? "add" : "remove"](toggleClass.className); 46960 }); 46961 onUpdate && !isToggle && !reset2 && onUpdate(self2); 46962 if (stateChanged && !_refreshing) { 46963 if (isToggle) { 46964 if (isTakingAction) { 46965 if (action === "complete") { 46966 animation.pause().totalProgress(1); 46967 } else if (action === "reset") { 46968 animation.restart(true).pause(); 46969 } else if (action === "restart") { 46970 animation.restart(true); 46971 } else { 46972 animation[action](); 46973 } 46974 } 46975 onUpdate && onUpdate(self2); 46976 } 46977 if (toggled || !_limitCallbacks) { 46978 onToggle && toggled && _callback2(self2, onToggle); 46979 callbacks[toggleState] && _callback2(self2, callbacks[toggleState]); 46980 once && (clipped === 1 ? self2.kill(false, 1) : callbacks[toggleState] = 0); 46981 if (!toggled) { 46982 toggleState = clipped === 1 ? 1 : 3; 46983 callbacks[toggleState] && _callback2(self2, callbacks[toggleState]); 46984 } 46985 } 46986 if (fastScrollEnd && !isActive && Math.abs(self2.getVelocity()) > (_isNumber3(fastScrollEnd) ? fastScrollEnd : 2500)) { 46987 _endAnimation(self2.callbackAnimation); 46988 scrubTween ? scrubTween.progress(1) : _endAnimation(animation, action === "reverse" ? 1 : !clipped, 1); 46989 } 46990 } else if (isToggle && onUpdate && !_refreshing) { 46991 onUpdate(self2); 46992 } 46993 } 46994 if (markerEndSetter) { 46995 var n2 = containerAnimation ? scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0) : scroll; 46996 markerStartSetter(n2 + (markerStartTrigger._isFlipped ? 1 : 0)); 46997 markerEndSetter(n2); 46998 } 46999 caMarkerSetter && caMarkerSetter(-scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0)); 47000 }; 47001 self2.enable = function(reset2, refresh) { 47002 if (!self2.enabled) { 47003 self2.enabled = true; 47004 _addListener2(scroller, "resize", _onResize); 47005 isViewport || _addListener2(scroller, "scroll", _onScroll2); 47006 onRefreshInit && _addListener2(ScrollTrigger2, "refreshInit", onRefreshInit); 47007 if (reset2 !== false) { 47008 self2.progress = prevProgress = 0; 47009 scroll1 = scroll2 = lastSnap = scrollFunc(); 47010 } 47011 refresh !== false && self2.refresh(); 47012 } 47013 }; 47014 self2.getTween = function(snap4) { 47015 return snap4 && tweenTo ? tweenTo.tween : scrubTween; 47016 }; 47017 self2.setPositions = function(newStart, newEnd, keepClamp, pinOffset) { 47018 if (containerAnimation) { 47019 var st = containerAnimation.scrollTrigger, duration = containerAnimation.duration(), _change = st.end - st.start; 47020 newStart = st.start + _change * newStart / duration; 47021 newEnd = st.start + _change * newEnd / duration; 47022 } 47023 self2.refresh(false, false, { 47024 start: _keepClamp(newStart, keepClamp && !!self2._startClamp), 47025 end: _keepClamp(newEnd, keepClamp && !!self2._endClamp) 47026 }, pinOffset); 47027 self2.update(); 47028 }; 47029 self2.adjustPinSpacing = function(amount) { 47030 if (spacerState && amount) { 47031 var i2 = spacerState.indexOf(direction.d) + 1; 47032 spacerState[i2] = parseFloat(spacerState[i2]) + amount + _px; 47033 spacerState[1] = parseFloat(spacerState[1]) + amount + _px; 47034 _setState(spacerState); 47035 } 47036 }; 47037 self2.disable = function(reset2, allowAnimation) { 47038 if (self2.enabled) { 47039 reset2 !== false && self2.revert(true, true); 47040 self2.enabled = self2.isActive = false; 47041 allowAnimation || scrubTween && scrubTween.pause(); 47042 prevScroll = 0; 47043 pinCache && (pinCache.uncache = 1); 47044 onRefreshInit && _removeListener2(ScrollTrigger2, "refreshInit", onRefreshInit); 47045 if (snapDelayedCall) { 47046 snapDelayedCall.pause(); 47047 tweenTo.tween && tweenTo.tween.kill() && (tweenTo.tween = 0); 47048 } 47049 if (!isViewport) { 47050 var i2 = _triggers.length; 47051 while (i2--) { 47052 if (_triggers[i2].scroller === scroller && _triggers[i2] !== self2) { 47053 return; 47054 } 47055 } 47056 _removeListener2(scroller, "resize", _onResize); 47057 isViewport || _removeListener2(scroller, "scroll", _onScroll2); 47058 } 47059 } 47060 }; 47061 self2.kill = function(revert, allowAnimation) { 47062 self2.disable(revert, allowAnimation); 47063 scrubTween && !allowAnimation && scrubTween.kill(); 47064 id2 && delete _ids[id2]; 47065 var i2 = _triggers.indexOf(self2); 47066 i2 >= 0 && _triggers.splice(i2, 1); 47067 i2 === _i && _direction > 0 && _i--; 47068 i2 = 0; 47069 _triggers.forEach(function(t2) { 47070 return t2.scroller === self2.scroller && (i2 = 1); 47071 }); 47072 i2 || _refreshingAll || (self2.scroll.rec = 0); 47073 if (animation) { 47074 animation.scrollTrigger = null; 47075 revert && animation.revert({ 47076 kill: false 47077 }); 47078 allowAnimation || animation.kill(); 47079 } 47080 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function(m2) { 47081 return m2.parentNode && m2.parentNode.removeChild(m2); 47082 }); 47083 _primary === self2 && (_primary = 0); 47084 if (pin) { 47085 pinCache && (pinCache.uncache = 1); 47086 i2 = 0; 47087 _triggers.forEach(function(t2) { 47088 return t2.pin === pin && i2++; 47089 }); 47090 i2 || (pinCache.spacer = 0); 47091 } 47092 vars.onKill && vars.onKill(self2); 47093 }; 47094 _triggers.push(self2); 47095 self2.enable(false, false); 47096 customRevertReturn && customRevertReturn(self2); 47097 if (animation && animation.add && !change) { 47098 var updateFunc = self2.update; 47099 self2.update = function() { 47100 self2.update = updateFunc; 47101 start2 || end || self2.refresh(); 47102 }; 47103 gsap$1.delayedCall(0.01, self2.update); 47104 change = 0.01; 47105 start2 = end = 0; 47106 } else { 47107 self2.refresh(); 47108 } 47109 pin && _queueRefreshAll(); 47110 }; 47111 ScrollTrigger2.register = function register3(core) { 47112 if (!_coreInitted$1) { 47113 gsap$1 = core || _getGSAP$1(); 47114 _windowExists$1() && window.document && ScrollTrigger2.enable(); 47115 _coreInitted$1 = _enabled; 47116 } 47117 return _coreInitted$1; 47118 }; 47119 ScrollTrigger2.defaults = function defaults3(config4) { 47120 if (config4) { 47121 for (var p2 in config4) { 47122 _defaults[p2] = config4[p2]; 47123 } 47124 } 47125 return _defaults; 47126 }; 47127 ScrollTrigger2.disable = function disable2(reset2, kill3) { 47128 _enabled = 0; 47129 _triggers.forEach(function(trigger) { 47130 return trigger[kill3 ? "kill" : "disable"](reset2); 47131 }); 47132 _removeListener2(_win, "wheel", _onScroll2); 47133 _removeListener2(_doc, "scroll", _onScroll2); 47134 clearInterval(_syncInterval); 47135 _removeListener2(_doc, "touchcancel", _passThrough2); 47136 _removeListener2(_body$1, "touchstart", _passThrough2); 47137 _multiListener(_removeListener2, _doc, "pointerdown,touchstart,mousedown", _pointerDownHandler); 47138 _multiListener(_removeListener2, _doc, "pointerup,touchend,mouseup", _pointerUpHandler); 47139 _resizeDelay.kill(); 47140 _iterateAutoRefresh(_removeListener2); 47141 for (var i2 = 0; i2 < _scrollers.length; i2 += 3) { 47142 _wheelListener(_removeListener2, _scrollers[i2], _scrollers[i2 + 1]); 47143 _wheelListener(_removeListener2, _scrollers[i2], _scrollers[i2 + 2]); 47144 } 47145 }; 47146 ScrollTrigger2.enable = function enable2() { 47147 _win = window; 47148 _doc = document; 47149 _docEl$1 = _doc.documentElement; 47150 _body$1 = _doc.body; 47151 if (gsap$1) { 47152 _toArray$1 = gsap$1.utils.toArray; 47153 _clamp2 = gsap$1.utils.clamp; 47154 _context = gsap$1.core.context || _passThrough2; 47155 _suppressOverwrites = gsap$1.core.suppressOverwrites || _passThrough2; 47156 _scrollRestoration = _win.history.scrollRestoration || "auto"; 47157 _lastScroll = _win.pageYOffset; 47158 gsap$1.core.globals("ScrollTrigger", ScrollTrigger2); 47159 if (_body$1) { 47160 _enabled = 1; 47161 _div100vh = document.createElement("div"); 47162 _div100vh.style.height = "100vh"; 47163 _div100vh.style.position = "absolute"; 47164 _refresh100vh(); 47165 _rafBugFix(); 47166 Observer.register(gsap$1); 47167 ScrollTrigger2.isTouch = Observer.isTouch; 47168 _fixIOSBug = Observer.isTouch && /(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent); 47169 _ignoreMobileResize = Observer.isTouch === 1; 47170 _addListener2(_win, "wheel", _onScroll2); 47171 _root = [_win, _doc, _docEl$1, _body$1]; 47172 if (gsap$1.matchMedia) { 47173 ScrollTrigger2.matchMedia = function(vars) { 47174 var mm = gsap$1.matchMedia(), p2; 47175 for (p2 in vars) { 47176 mm.add(p2, vars[p2]); 47177 } 47178 return mm; 47179 }; 47180 gsap$1.addEventListener("matchMediaInit", function() { 47181 return _revertAll(); 47182 }); 47183 gsap$1.addEventListener("matchMediaRevert", function() { 47184 return _revertRecorded(); 47185 }); 47186 gsap$1.addEventListener("matchMedia", function() { 47187 _refreshAll(0, 1); 47188 _dispatch2("matchMedia"); 47189 }); 47190 gsap$1.matchMedia("(orientation: portrait)", function() { 47191 _setBaseDimensions(); 47192 return _setBaseDimensions; 47193 }); 47194 } else { 47195 console.warn("Requires GSAP 3.11.0 or later"); 47196 } 47197 _setBaseDimensions(); 47198 _addListener2(_doc, "scroll", _onScroll2); 47199 var bodyStyle = _body$1.style, border = bodyStyle.borderTopStyle, AnimationProto = gsap$1.core.Animation.prototype, bounds, i2; 47200 AnimationProto.revert || Object.defineProperty(AnimationProto, "revert", { 47201 value: function value() { 47202 return this.time(-0.01, true); 47203 } 47204 }); 47205 bodyStyle.borderTopStyle = "solid"; 47206 bounds = _getBounds(_body$1); 47207 _vertical.m = Math.round(bounds.top + _vertical.sc()) || 0; 47208 _horizontal.m = Math.round(bounds.left + _horizontal.sc()) || 0; 47209 border ? bodyStyle.borderTopStyle = border : bodyStyle.removeProperty("border-top-style"); 47210 _syncInterval = setInterval(_sync, 250); 47211 gsap$1.delayedCall(0.5, function() { 47212 return _startup = 0; 47213 }); 47214 _addListener2(_doc, "touchcancel", _passThrough2); 47215 _addListener2(_body$1, "touchstart", _passThrough2); 47216 _multiListener(_addListener2, _doc, "pointerdown,touchstart,mousedown", _pointerDownHandler); 47217 _multiListener(_addListener2, _doc, "pointerup,touchend,mouseup", _pointerUpHandler); 47218 _transformProp = gsap$1.utils.checkPrefix("transform"); 47219 _stateProps.push(_transformProp); 47220 _coreInitted$1 = _getTime(); 47221 _resizeDelay = gsap$1.delayedCall(0.2, _refreshAll).pause(); 47222 _autoRefresh = [_doc, "visibilitychange", function() { 47223 var w2 = _win.innerWidth, h2 = _win.innerHeight; 47224 if (_doc.hidden) { 47225 _prevWidth = w2; 47226 _prevHeight = h2; 47227 } else if (_prevWidth !== w2 || _prevHeight !== h2) { 47228 _onResize(); 47229 } 47230 }, _doc, "DOMContentLoaded", _refreshAll, _win, "load", _refreshAll, _win, "resize", _onResize]; 47231 _iterateAutoRefresh(_addListener2); 47232 _triggers.forEach(function(trigger) { 47233 return trigger.enable(0, 1); 47234 }); 47235 for (i2 = 0; i2 < _scrollers.length; i2 += 3) { 47236 _wheelListener(_removeListener2, _scrollers[i2], _scrollers[i2 + 1]); 47237 _wheelListener(_removeListener2, _scrollers[i2], _scrollers[i2 + 2]); 47238 } 47239 } 47240 } 47241 }; 47242 ScrollTrigger2.config = function config4(vars) { 47243 "limitCallbacks" in vars && (_limitCallbacks = !!vars.limitCallbacks); 47244 var ms = vars.syncInterval; 47245 ms && clearInterval(_syncInterval) || (_syncInterval = ms) && setInterval(_sync, ms); 47246 "ignoreMobileResize" in vars && (_ignoreMobileResize = ScrollTrigger2.isTouch === 1 && vars.ignoreMobileResize); 47247 if ("autoRefreshEvents" in vars) { 47248 _iterateAutoRefresh(_removeListener2) || _iterateAutoRefresh(_addListener2, vars.autoRefreshEvents || "none"); 47249 _ignoreResize = (vars.autoRefreshEvents + "").indexOf("resize") === -1; 47250 } 47251 }; 47252 ScrollTrigger2.scrollerProxy = function scrollerProxy(target, vars) { 47253 var t2 = _getTarget(target), i2 = _scrollers.indexOf(t2), isViewport = _isViewport2(t2); 47254 if (~i2) { 47255 _scrollers.splice(i2, isViewport ? 6 : 2); 47256 } 47257 if (vars) { 47258 isViewport ? _proxies.unshift(_win, vars, _body$1, vars, _docEl$1, vars) : _proxies.unshift(t2, vars); 47259 } 47260 }; 47261 ScrollTrigger2.clearMatchMedia = function clearMatchMedia(query) { 47262 _triggers.forEach(function(t2) { 47263 return t2._ctx && t2._ctx.query === query && t2._ctx.kill(true, true); 47264 }); 47265 }; 47266 ScrollTrigger2.isInViewport = function isInViewport(element, ratio, horizontal) { 47267 var bounds = (_isString$1(element) ? _getTarget(element) : element).getBoundingClientRect(), offset = bounds[horizontal ? _width : _height] * ratio || 0; 47268 return horizontal ? bounds.right - offset > 0 && bounds.left + offset < _win.innerWidth : bounds.bottom - offset > 0 && bounds.top + offset < _win.innerHeight; 47269 }; 47270 ScrollTrigger2.positionInViewport = function positionInViewport(element, referencePoint, horizontal) { 47271 _isString$1(element) && (element = _getTarget(element)); 47272 var bounds = element.getBoundingClientRect(), size = bounds[horizontal ? _width : _height], offset = referencePoint == null ? size / 2 : referencePoint in _keywords ? _keywords[referencePoint] * size : ~referencePoint.indexOf("%") ? parseFloat(referencePoint) * size / 100 : parseFloat(referencePoint) || 0; 47273 return horizontal ? (bounds.left + offset) / _win.innerWidth : (bounds.top + offset) / _win.innerHeight; 47274 }; 47275 ScrollTrigger2.killAll = function killAll(allowListeners) { 47276 _triggers.slice(0).forEach(function(t2) { 47277 return t2.vars.id !== "ScrollSmoother" && t2.kill(); 47278 }); 47279 if (allowListeners !== true) { 47280 var listeners = _listeners.killAll || []; 47281 _listeners = {}; 47282 listeners.forEach(function(f2) { 47283 return f2(); 47284 }); 47285 } 47286 }; 47287 return ScrollTrigger2; 47288}(); 47289ScrollTrigger$1.version = "3.12.5"; 47290ScrollTrigger$1.saveStyles = function(targets) { 47291 return targets ? _toArray$1(targets).forEach(function(target) { 47292 if (target && target.style) { 47293 var i2 = _savedStyles.indexOf(target); 47294 i2 >= 0 && _savedStyles.splice(i2, 5); 47295 _savedStyles.push(target, target.style.cssText, target.getBBox && target.getAttribute("transform"), gsap$1.core.getCache(target), _context()); 47296 } 47297 }) : _savedStyles; 47298}; 47299ScrollTrigger$1.revert = function(soft, media) { 47300 return _revertAll(!soft, media); 47301}; 47302ScrollTrigger$1.create = function(vars, animation) { 47303 return new ScrollTrigger$1(vars, animation); 47304}; 47305ScrollTrigger$1.refresh = function(safe) { 47306 return safe ? _onResize() : (_coreInitted$1 || ScrollTrigger$1.register()) && _refreshAll(true); 47307}; 47308ScrollTrigger$1.update = function(force) { 47309 return ++_scrollers.cache && _updateAll(force === true ? 2 : 0); 47310}; 47311ScrollTrigger$1.clearScrollMemory = _clearScrollMemory; 47312ScrollTrigger$1.maxScroll = function(element, horizontal) { 47313 return _maxScroll2(element, horizontal ? _horizontal : _vertical); 47314}; 47315ScrollTrigger$1.getScrollFunc = function(element, horizontal) { 47316 return _getScrollFunc(_getTarget(element), horizontal ? _horizontal : _vertical); 47317}; 47318ScrollTrigger$1.getById = function(id2) { 47319 return _ids[id2]; 47320}; 47321ScrollTrigger$1.getAll = function() { 47322 return _triggers.filter(function(t2) { 47323 return t2.vars.id !== "ScrollSmoother"; 47324 }); 47325}; 47326ScrollTrigger$1.isScrolling = function() { 47327 return !!_lastScrollTime; 47328}; 47329ScrollTrigger$1.snapDirectional = _snapDirectional; 47330ScrollTrigger$1.addEventListener = function(type, callback) { 47331 var a2 = _listeners[type] || (_listeners[type] = []); 47332 ~a2.indexOf(callback) || a2.push(callback); 47333}; 47334ScrollTrigger$1.removeEventListener = function(type, callback) { 47335 var a2 = _listeners[type], i2 = a2 && a2.indexOf(callback); 47336 i2 >= 0 && a2.splice(i2, 1); 47337}; 47338ScrollTrigger$1.batch = function(targets, vars) { 47339 var result = [], varsCopy = {}, interval = vars.interval || 0.016, batchMax = vars.batchMax || 1e9, proxyCallback = function proxyCallback2(type, callback) { 47340 var elements = [], triggers = [], delay = gsap$1.delayedCall(interval, function() { 47341 callback(elements, triggers); 47342 elements = []; 47343 triggers = []; 47344 }).pause(); 47345 return function(self2) { 47346 elements.length || delay.restart(true); 47347 elements.push(self2.trigger); 47348 triggers.push(self2); 47349 batchMax <= elements.length && delay.progress(1); 47350 }; 47351 }, p2; 47352 for (p2 in vars) { 47353 varsCopy[p2] = p2.substr(0, 2) === "on" && _isFunction$1(vars[p2]) && p2 !== "onRefreshInit" ? proxyCallback(p2, vars[p2]) : vars[p2]; 47354 } 47355 if (_isFunction$1(batchMax)) { 47356 batchMax = batchMax(); 47357 _addListener2(ScrollTrigger$1, "refresh", function() { 47358 return batchMax = vars.batchMax(); 47359 }); 47360 } 47361 _toArray$1(targets).forEach(function(target) { 47362 var config4 = {}; 47363 for (p2 in varsCopy) { 47364 config4[p2] = varsCopy[p2]; 47365 } 47366 config4.trigger = target; 47367 result.push(ScrollTrigger$1.create(config4)); 47368 }); 47369 return result; 47370}; 47371var _clampScrollAndGetDurationMultiplier = function _clampScrollAndGetDurationMultiplier2(scrollFunc, current, end, max) { 47372 current > max ? scrollFunc(max) : current < 0 && scrollFunc(0); 47373 return end > max ? (max - current) / (end - current) : end < 0 ? current / (current - end) : 1; 47374}, _allowNativePanning = function _allowNativePanning2(target, direction) { 47375 if (direction === true) { 47376 target.style.removeProperty("touch-action"); 47377 } else { 47378 target.style.touchAction = direction === true ? "auto" : direction ? "pan-" + direction + (Observer.isTouch ? " pinch-zoom" : "") : "none"; 47379 } 47380 target === _docEl$1 && _allowNativePanning2(_body$1, direction); 47381}, _overflow = { 47382 auto: 1, 47383 scroll: 1 47384}, _nestedScroll = function _nestedScroll2(_ref5) { 47385 var event = _ref5.event, target = _ref5.target, axis = _ref5.axis; 47386 var node = (event.changedTouches ? event.changedTouches[0] : event).target, cache2 = node._gsap || gsap$1.core.getCache(node), time = _getTime(), cs; 47387 if (!cache2._isScrollT || time - cache2._isScrollT > 2e3) { 47388 while (node && node !== _body$1 && (node.scrollHeight <= node.clientHeight && node.scrollWidth <= node.clientWidth || !(_overflow[(cs = _getComputedStyle2(node)).overflowY] || _overflow[cs.overflowX]))) { 47389 node = node.parentNode; 47390 } 47391 cache2._isScroll = node && node !== target && !_isViewport2(node) && (_overflow[(cs = _getComputedStyle2(node)).overflowY] || _overflow[cs.overflowX]); 47392 cache2._isScrollT = time; 47393 } 47394 if (cache2._isScroll || axis === "x") { 47395 event.stopPropagation(); 47396 event._gsapAllow = true; 47397 } 47398}, _inputObserver = function _inputObserver2(target, type, inputs, nested) { 47399 return Observer.create({ 47400 target, 47401 capture: true, 47402 debounce: false, 47403 lockAxis: true, 47404 type, 47405 onWheel: nested = nested && _nestedScroll, 47406 onPress: nested, 47407 onDrag: nested, 47408 onScroll: nested, 47409 onEnable: function onEnable() { 47410 return inputs && _addListener2(_doc, Observer.eventTypes[0], _captureInputs, false, true); 47411 }, 47412 onDisable: function onDisable() { 47413 return _removeListener2(_doc, Observer.eventTypes[0], _captureInputs, true); 47414 } 47415 }); 47416}, _inputExp = /(input|label|select|textarea)/i, _inputIsFocused, _captureInputs = function _captureInputs2(e2) { 47417 var isInput = _inputExp.test(e2.target.tagName); 47418 if (isInput || _inputIsFocused) { 47419 e2._gsapAllow = true; 47420 _inputIsFocused = isInput; 47421 } 47422}, _getScrollNormalizer = function _getScrollNormalizer2(vars) { 47423 _isObject2(vars) || (vars = {}); 47424 vars.preventDefault = vars.isNormalizer = vars.allowClicks = true; 47425 vars.type || (vars.type = "wheel,touch"); 47426 vars.debounce = !!vars.debounce; 47427 vars.id = vars.id || "normalizer"; 47428 var _vars2 = vars, normalizeScrollX = _vars2.normalizeScrollX, momentum = _vars2.momentum, allowNestedScroll = _vars2.allowNestedScroll, onRelease = _vars2.onRelease, self2, maxY, target = _getTarget(vars.target) || _docEl$1, smoother = gsap$1.core.globals().ScrollSmoother, smootherInstance = smoother && smoother.get(), content = _fixIOSBug && (vars.content && _getTarget(vars.content) || smootherInstance && vars.content !== false && !smootherInstance.smooth() && smootherInstance.content()), scrollFuncY = _getScrollFunc(target, _vertical), scrollFuncX = _getScrollFunc(target, _horizontal), scale = 1, initialScale = (Observer.isTouch && _win.visualVie
vendor: 4,109 bytes, lines 47428-47511
47428wport ? _win.visualViewport.scale * _win.visualViewport.width : _win.outerWidth) / _win.innerWidth, wheelRefresh = 0, resolveMomentumDuration = _isFunction$1(momentum) ? function() { 47429 return momentum(self2); 47430 } : function() { 47431 return momentum || 2.8; 47432 }, lastRefreshID, skipTouchMove, inputObserver = _inputObserver(target, vars.type, true, allowNestedScroll), resumeTouchMove = function resumeTouchMove2() { 47433 return skipTouchMove = false; 47434 }, scrollClampX = _passThrough2, scrollClampY = _passThrough2, updateClamps = function updateClamps2() { 47435 maxY = _maxScroll2(target, _vertical); 47436 scrollClampY = _clamp2(_fixIOSBug ? 1 : 0, maxY); 47437 normalizeScrollX && (scrollClampX = _clamp2(0, _maxScroll2(target, _horizontal))); 47438 lastRefreshID = _refreshID; 47439 }, removeContentOffset = function removeContentOffset2() { 47440 content._gsap.y = _round5(parseFloat(content._gsap.y) + scrollFuncY.offset) + "px"; 47441 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + parseFloat(content._gsap.y) + ", 0, 1)"; 47442 scrollFuncY.offset = scrollFuncY.cacheID = 0; 47443 }, ignoreDrag = function ignoreDrag2() { 47444 if (skipTouchMove) { 47445 requestAnimationFrame(resumeTouchMove); 47446 var offset = _round5(self2.deltaY / 2), scroll = scrollClampY(scrollFuncY.v - offset); 47447 if (content && scroll !== scrollFuncY.v + scrollFuncY.offset) { 47448 scrollFuncY.offset = scroll - scrollFuncY.v; 47449 var y2 = _round5((parseFloat(content && content._gsap.y) || 0) - scrollFuncY.offset); 47450 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + y2 + ", 0, 1)"; 47451 content._gsap.y = y2 + "px"; 47452 scrollFuncY.cacheID = _scrollers.cache; 47453 _updateAll(); 47454 } 47455 return true; 47456 } 47457 scrollFuncY.offset && removeContentOffset(); 47458 skipTouchMove = true; 47459 }, tween, startScrollX, startScrollY, onStopDelayedCall, onResize = function onResize2() { 47460 updateClamps(); 47461 if (tween.isActive() && tween.vars.scrollY > maxY) { 47462 scrollFuncY() > maxY ? tween.progress(1) && scrollFuncY(maxY) : tween.resetTo("scrollY", maxY); 47463 } 47464 }; 47465 content && gsap$1.set(content, { 47466 y: "+=0" 47467 }); 47468 vars.ignoreCheck = function(e2) { 47469 return _fixIOSBug && e2.type === "touchmove" && ignoreDrag() || scale > 1.05 && e2.type !== "touchstart" || self2.isGesturing || e2.touches && e2.touches.length > 1; 47470 }; 47471 vars.onPress = function() { 47472 skipTouchMove = false; 47473 var prevScale = scale; 47474 scale = _round5((_win.visualViewport && _win.visualViewport.scale || 1) / initialScale); 47475 tween.pause(); 47476 prevScale !== scale && _allowNativePanning(target, scale > 1.01 ? true : normalizeScrollX ? false : "x"); 47477 startScrollX = scrollFuncX(); 47478 startScrollY = scrollFuncY(); 47479 updateClamps(); 47480 lastRefreshID = _refreshID; 47481 }; 47482 vars.onRelease = vars.onGestureStart = function(self3, wasDragging) { 47483 scrollFuncY.offset && removeContentOffset(); 47484 if (!wasDragging) { 47485 onStopDelayedCall.restart(true); 47486 } else { 47487 _scrollers.cache++; 47488 var dur = resolveMomentumDuration(), currentScroll, endScroll; 47489 if (normalizeScrollX) { 47490 currentScroll = scrollFuncX(); 47491 endScroll = currentScroll + dur * 0.05 * -self3.velocityX / 0.227; 47492 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncX, currentScroll, endScroll, _maxScroll2(target, _horizontal)); 47493 tween.vars.scrollX = scrollClampX(endScroll); 47494 } 47495 currentScroll = scrollFuncY(); 47496 endScroll = currentScroll + dur * 0.05 * -self3.velocityY / 0.227; 47497 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncY, currentScroll, endScroll, _maxScroll2(target, _vertical)); 47498 tween.vars.scrollY = scrollClampY(endScroll); 47499 tween.invalidate().duration(dur).play(0.01); 47500 if (_fixIOSBug && tween.vars.scrollY >= maxY || currentScroll >= maxY - 1) { 47501 gsap$1.to({}, { 47502 onUpdate: onResize, 47503 duration: dur 47504 }); 47505 } 47506 } 47507 onRelease && onRelease(self3); 47508 }; 47509 vars.onWheel = function() { 47510 tween._ts && tween.pause(); 47511 if (_getTime() - wheelRefresh > 1e3) {
vendor: 8,366 bytes, lines 47512-47735
47512 lastRefreshID = 0; 47513 wheelRefresh = _getTime(); 47514 } 47515 }; 47516 vars.onChange = function(self3, dx, dy, xArray, yArray) { 47517 _refreshID !== lastRefreshID && updateClamps(); 47518 dx && normalizeScrollX && scrollFuncX(scrollClampX(xArray[2] === dx ? startScrollX + (self3.startX - self3.x) : scrollFuncX() + dx - xArray[1])); 47519 if (dy) { 47520 scrollFuncY.offset && removeContentOffset(); 47521 var isTouch = yArray[2] === dy, y2 = isTouch ? startScrollY + self3.startY - self3.y : scrollFuncY() + dy - yArray[1], yClamped = scrollClampY(y2); 47522 isTouch && y2 !== yClamped && (startScrollY += yClamped - y2); 47523 scrollFuncY(yClamped); 47524 } 47525 (dy || dx) && _updateAll(); 47526 }; 47527 vars.onEnable = function() { 47528 _allowNativePanning(target, normalizeScrollX ? false : "x"); 47529 ScrollTrigger$1.addEventListener("refresh", onResize); 47530 _addListener2(_win, "resize", onResize); 47531 if (scrollFuncY.smooth) { 47532 scrollFuncY.target.style.scrollBehavior = "auto"; 47533 scrollFuncY.smooth = scrollFuncX.smooth = false; 47534 } 47535 inputObserver.enable(); 47536 }; 47537 vars.onDisable = function() { 47538 _allowNativePanning(target, true); 47539 _removeListener2(_win, "resize", onResize); 47540 ScrollTrigger$1.removeEventListener("refresh", onResize); 47541 inputObserver.kill(); 47542 }; 47543 vars.lockAxis = vars.lockAxis !== false; 47544 self2 = new Observer(vars); 47545 self2.iOS = _fixIOSBug; 47546 _fixIOSBug && !scrollFuncY() && scrollFuncY(1); 47547 _fixIOSBug && gsap$1.ticker.add(_passThrough2); 47548 onStopDelayedCall = self2._dc; 47549 tween = gsap$1.to(self2, { 47550 ease: "power4", 47551 paused: true, 47552 inherit: false, 47553 scrollX: normalizeScrollX ? "+=0.1" : "+=0", 47554 scrollY: "+=0.1", 47555 modifiers: { 47556 scrollY: _interruptionTracker(scrollFuncY, scrollFuncY(), function() { 47557 return tween.pause(); 47558 }) 47559 }, 47560 onUpdate: _updateAll, 47561 onComplete: onStopDelayedCall.vars.onComplete 47562 }); 47563 return self2; 47564}; 47565ScrollTrigger$1.sort = function(func) { 47566 return _triggers.sort(func || function(a2, b2) { 47567 return (a2.vars.refreshPriority || 0) * -1e6 + a2.start - (b2.start + (b2.vars.refreshPriority || 0) * -1e6); 47568 }); 47569}; 47570ScrollTrigger$1.observe = function(vars) { 47571 return new Observer(vars); 47572}; 47573ScrollTrigger$1.normalizeScroll = function(vars) { 47574 if (typeof vars === "undefined") { 47575 return _normalizer; 47576 } 47577 if (vars === true && _normalizer) { 47578 return _normalizer.enable(); 47579 } 47580 if (vars === false) { 47581 _normalizer && _normalizer.kill(); 47582 _normalizer = vars; 47583 return; 47584 } 47585 var normalizer = vars instanceof Observer ? vars : _getScrollNormalizer(vars); 47586 _normalizer && _normalizer.target === normalizer.target && _normalizer.kill(); 47587 _isViewport2(normalizer.target) && (_normalizer = normalizer); 47588 return normalizer; 47589}; 47590ScrollTrigger$1.core = { 47591 // smaller file size way to leverage in ScrollSmoother and Observer 47592 _getVelocityProp, 47593 _inputObserver, 47594 _scrollers, 47595 _proxies, 47596 bridge: { 47597 // when normalizeScroll sets the scroll position (ss = setScroll) 47598 ss: function ss() { 47599 _lastScrollTime || _dispatch2("scrollStart"); 47600 _lastScrollTime = _getTime(); 47601 }, 47602 // a way to get the _refreshing value in Observer 47603 ref: function ref() { 47604 return _refreshing; 47605 } 47606 } 47607}; 47608_getGSAP$1() && gsap$1.registerPlugin(ScrollTrigger$1); 47609/*! 47610 * ScrollToPlugin 3.12.5 47611 * https://gsap.com 47612 * 47613 * @license Copyright 2008-2024, GreenSock. All rights reserved. 47614 * Subject to the terms at https://gsap.com/standard-license or for 47615 * Club GSAP members, the agreement issued with that membership. 47616 * @author: Jack Doyle, [email protected] 47617*/ 47618var gsap, _coreInitted, _window, _docEl, _body, _toArray, _config, ScrollTrigger, _windowExists5 = function _windowExists6() { 47619 return typeof window !== "undefined"; 47620}, _getGSAP6 = function _getGSAP7() { 47621 return gsap || _windowExists5() && (gsap = window.gsap) && gsap.registerPlugin && gsap; 47622}, _isString4 = function _isString5(value) { 47623 return typeof value === "string"; 47624}, _isFunction4 = function _isFunction5(value) { 47625 return typeof value === "function"; 47626}, _max = function _max2(element, axis) { 47627 var dim = axis === "x" ? "Width" : "Height", scroll = "scroll" + dim, client = "client" + dim; 47628 return element === _window || element === _docEl || element === _body ? Math.max(_docEl[scroll], _body[scroll]) - (_window["inner" + dim] || _docEl[client] || _body[client]) : element[scroll] - element["offset" + dim]; 47629}, _buildGetter = function _buildGetter2(e2, axis) { 47630 var p2 = "scroll" + (axis === "x" ? "Left" : "Top"); 47631 if (e2 === _window) { 47632 if (e2.pageXOffset != null) { 47633 p2 = "page" + axis.toUpperCase() + "Offset"; 47634 } else { 47635 e2 = _docEl[p2] != null ? _docEl : _body; 47636 } 47637 } 47638 return function() { 47639 return e2[p2]; 47640 }; 47641}, _clean = function _clean2(value, index3, target, targets) { 47642 _isFunction4(value) && (value = value(index3, target, targets)); 47643 if (typeof value !== "object") { 47644 return _isString4(value) && value !== "max" && value.charAt(1) !== "=" ? { 47645 x: value, 47646 y: value 47647 } : { 47648 y: value 47649 }; 47650 } else if (value.nodeType) { 47651 return { 47652 y: value, 47653 x: value 47654 }; 47655 } else { 47656 var result = {}, p2; 47657 for (p2 in value) { 47658 result[p2] = p2 !== "onAutoKill" && _isFunction4(value[p2]) ? value[p2](index3, target, targets) : value[p2]; 47659 } 47660 return result; 47661 } 47662}, _getOffset = function _getOffset2(element, container) { 47663 element = _toArray(element)[0]; 47664 if (!element || !element.getBoundingClientRect) { 47665 return console.warn("scrollTo target doesn't exist. Using 0") || { 47666 x: 0, 47667 y: 0 47668 }; 47669 } 47670 var rect = element.getBoundingClientRect(), isRoot = !container || container === _window || container === _body, cRect = isRoot ? { 47671 top: _docEl.clientTop - (_window.pageYOffset || _docEl.scrollTop || _body.scrollTop || 0), 47672 left: _docEl.clientLeft - (_window.pageXOffset || _docEl.scrollLeft || _body.scrollLeft || 0) 47673 } : container.getBoundingClientRect(), offsets = { 47674 x: rect.left - cRect.left, 47675 y: rect.top - cRect.top 47676 }; 47677 if (!isRoot && container) { 47678 offsets.x += _buildGetter(container, "x")(); 47679 offsets.y += _buildGetter(container, "y")(); 47680 } 47681 return offsets; 47682}, _parseVal = function _parseVal2(value, target, axis, currentVal, offset) { 47683 return !isNaN(value) && typeof value !== "object" ? parseFloat(value) - offset : _isString4(value) && value.charAt(1) === "=" ? parseFloat(value.substr(2)) * (value.charAt(0) === "-" ? -1 : 1) + currentVal - offset : value === "max" ? _max(target, axis) - offset : Math.min(_max(target, axis), _getOffset(value, target)[axis] - offset); 47684}, _initCore5 = function _initCore6() { 47685 gsap = _getGSAP6(); 47686 if (_windowExists5() && gsap && typeof document !== "undefined" && document.body) { 47687 _window = window; 47688 _body = document.body; 47689 _docEl = document.documentElement; 47690 _toArray = gsap.utils.toArray; 47691 gsap.config({ 47692 autoKillThreshold: 7 47693 }); 47694 _config = gsap.config(); 47695 _coreInitted = 1; 47696 } 47697}; 47698var ScrollToPlugin = { 47699 version: "3.12.5", 47700 name: "scrollTo", 47701 rawVars: 1, 47702 register: function register2(core) { 47703 gsap = core; 47704 _initCore5(); 47705 }, 47706 init: function init6(target, value, tween, index3, targets) { 47707 _coreInitted || _initCore5(); 47708 var data = this, snapType = gsap.getProperty(target, "scrollSnapType"); 47709 data.isWin = target === _window; 47710 data.target = target; 47711 data.tween = tween; 47712 value = _clean(value, index3, target, targets); 47713 data.vars = value; 47714 data.autoKill = !!value.autoKill; 47715 data.getX = _buildGetter(target, "x"); 47716 data.getY = _buildGetter(target, "y"); 47717 data.x = data.xPrev = data.getX(); 47718 data.y = data.yPrev = data.getY(); 47719 ScrollTrigger || (ScrollTrigger = gsap.core.globals().ScrollTrigger); 47720 gsap.getProperty(target, "scrollBehavior") === "smooth" && gsap.set(target, { 47721 scrollBehavior: "auto" 47722 }); 47723 if (snapType && snapType !== "none") { 47724 data.snap = 1; 47725 data.snapInline = target.style.scrollSnapType; 47726 target.style.scrollSnapType = "none"; 47727 } 47728 if (value.x != null) { 47729 data.add(data, "x", data.x, _parseVal(value.x, target, "x", data.x, value.offsetX || 0), index3, targets); 47730 data._props.push("scrollTo_x"); 47731 } else { 47732 data.skipX = 1; 47733 } 47734 if (value.y != null) { 47735 data.add(data, "y", data.y, _parseVal(value.y, target, "y", data.y, value.offsetY || 0
vendor: 1,795 bytes, lines 47735-47786
47735), index3, targets); 47736 data._props.push("scrollTo_y"); 47737 } else { 47738 data.skipY = 1; 47739 } 47740 }, 47741 render: function render5(ratio, data) { 47742 var pt = data._pt, target = data.target, tween = data.tween, autoKill = data.autoKill, xPrev = data.xPrev, yPrev = data.yPrev, isWin = data.isWin, snap3 = data.snap, snapInline = data.snapInline, x2, y2, yDif, xDif, threshold; 47743 while (pt) { 47744 pt.r(ratio, pt.d); 47745 pt = pt._next; 47746 } 47747 x2 = isWin || !data.skipX ? data.getX() : xPrev; 47748 y2 = isWin || !data.skipY ? data.getY() : yPrev; 47749 yDif = y2 - yPrev; 47750 xDif = x2 - xPrev; 47751 threshold = _config.autoKillThreshold; 47752 if (data.x < 0) { 47753 data.x = 0; 47754 } 47755 if (data.y < 0) { 47756 data.y = 0; 47757 } 47758 if (autoKill) { 47759 if (!data.skipX && (xDif > threshold || xDif < -threshold) && x2 < _max(target, "x")) { 47760 data.skipX = 1; 47761 } 47762 if (!data.skipY && (yDif > threshold || yDif < -threshold) && y2 < _max(target, "y")) { 47763 data.skipY = 1; 47764 } 47765 if (data.skipX && data.skipY) { 47766 tween.kill(); 47767 data.vars.onAutoKill && data.vars.onAutoKill.apply(tween, data.vars.onAutoKillParams || []); 47768 } 47769 } 47770 if (isWin) { 47771 _window.scrollTo(!data.skipX ? data.x : x2, !data.skipY ? data.y : y2); 47772 } else { 47773 data.skipY || (target.scrollTop = data.y); 47774 data.skipX || (target.scrollLeft = data.x); 47775 } 47776 if (snap3 && (ratio === 1 || ratio === 0)) { 47777 y2 = target.scrollTop; 47778 x2 = target.scrollLeft; 47779 snapInline ? target.style.scrollSnapType = snapInline : target.style.removeProperty("scroll-snap-type"); 47780 target.scrollTop = y2 + 1; 47781 target.scrollLeft = x2 + 1; 47782 target.scrollTop = y2; 47783 target.scrollLeft = x2; 47784 } 47785 data.xPrev = data.x; 47786 data.yPrev = data.y;
47787 ScrollTrigger && ScrollTrigger.update(); 47788 }, 47789 kill: function kill2(property) { 47790 var both = property === "scrollTo", i2 = this._props.indexOf(property); 47791 if (both || property === "scrollTo_x") { 47792 this.skipX = 1; 47793 } 47794 if (both || property === "scrollTo_y") { 47795 this.skipY = 1; 47796 } 47797 i2 > -1 && this._props.splice(i2, 1); 47798 return !this._props.length; 47799 } 47800}; 47801ScrollToPlugin.max = _max; 47802ScrollToPlugin.getOffset = _getOffset; 47803ScrollToPlugin.buildGetter = _buildGetter; 47804_getGSAP6() && gsap.registerPlugin(ScrollToPlugin); 47805gsapWithCSS.registerPlugin(ScrollTrigger$1, ScrollSmoother, ScrollToPlugin); 47806var sm = null; 47807const ARCHIVE_BODY_CLASSES = ["nova-et-vetera", "letter-and-spirit"]; 47808const isNev = () => document.body && ARCHIVE_BODY_CLASSES.some((cls) => document.body.classList.contains(cls)); 47809function unwrapSmootherWrapper() { 47810 const wrapper = document.querySelector(".ScrollSmoother-wrapper"); 47811 if (wrapper) { 47812 while (wrapper.firstChild) { 47813 wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); 47814 } 47815 wrapper.remove(); 47816 } 47817 document.body.style.removeProperty("height"); 47818 document.body.style.removeProperty("overflow"); 47819 document.body.style.removeProperty("overscroll-behavior"); 47820 document.body.style.removeProperty("scroll-behavior"); 47821} 47822function killSmootherForNev() { 47823 ScrollTrigger$1.normalizeScroll(false); 47824 const existing = ScrollSmoother.get(); 47825 if (existing) existing.kill(); 47826 unwrapSmootherWrapper(); 47827} 47828const nevObserver = new MutationObserver(() => { 47829 if (isNev() && document.querySelector(".ScrollSmoother-wrapper")) { 47830 const existing = ScrollSmoother.get(); 47831 if (existing) existing.kill(); 47832 unwrapSmootherWrapper(); 47833 } 47834}); 47835nevObserver.observe(document.documentElement, { childList: true, subtree: true }); 47836addEventListener("turbo:before-render", (event) => { 47837 if (isNev()) return; 47838 scaffolding(); 47839 event.preventDefault(); 47840 event.detail.renderMethod = "morph"; 47841 event.detail.render = (currentElement, newElement) => { 47842 morphdom(currentElement, newElement); 47843 }; 47844 event.detail.resume(); 47845 gsapWithCSS.to("html", { opacity: 1 }); 47846}); 47847function scaffolding() { 47848 let triggers = ScrollTrigger$1.getAll(); 47849 triggers.forEach((trigger) => { 47850 trigger.kill(); 47851 }); 47852 sm = ScrollSmoother.get(); 47853 if (sm) { 47854 sm.scrollTo(0); 47855 } 47856 if (sm) sm.kill(); 47857 ScrollTrigger$1.refresh(); 47858} 47859document.addEventListener("DOMContentLoaded", function() { 47860 if (isNev()) killSmootherForNev(); 47861}); 47862document.addEventListener("turbo:load", function(event) { 47863 if (isNev()) { 47864 killSmootherForNev(); 47865 return; 47866 } 47867 if (/iPhone|iPad|iPod/i.test(window.navigator.userAgent)) { 47868 document.body.style.overscrollBehavior = "none"; 47869 document.documentElement.style.overscrollBehavior = "none"; 47870 let lastScrollTime = 0; 47871 window.addEventListener( 47872 "scroll", 47873 function(e2) { 47874 const now = Date.now(); 47875 if (now - lastScrollTime < 50) { 47876 e2.preventDefault(); 47877 return; 47878 } 47879 lastScrollTime = now; 47880 }, 47881 { passive: false } 47882 ); 47883 } 47884 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( 47885 window.navigator.userAgent 47886 )) { 47887 ScrollTrigger$1.normalizeScroll({ allowNestedScroll: true }); 47888 ScrollSmoother.create({ 47889 smooth: 1, 47890 effects: true, 47891 ignoreMobileResize: true, 47892 normalizeScroll: { allowNestedScroll: true }, 47893 preventDefault: true 47894 }); 47895 } else { 47896 ScrollTrigger$1.normalizeScroll(false); 47897 if (ScrollSmoother.get()) { 47898 ScrollSmoother.get().kill(); 47899 } 47900 } 47901 document.querySelectorAll('a[href*="#"]').forEach((anchor) => { 47902 anchor.addEventListener("click", (e2) => { 47903 const location2 = new URL(anchor.href, window.location.href); 47904 const target = document.querySelector(location2.hash); 47905 if (target) { 47906 e2.preventDefault(); 47907 sm = ScrollSmoother.get(); 47908 if (sm) { 47909 sm.scrollTo(target, true); 47910 } else if (target.classList.contains("tab")) { 47911 target.parentElement.scrollIntoView({ behavior: "smooth" }); 47912 } else { 47913 target.scrollIntoView({ behavior: "smooth" }); 47914 } 47915 } 47916 }); 47917 }); 47918}); 47919window.addEventListener("resize", () => { 47920 if (!isNev()) ScrollTrigger$1.refresh(); 47921}); 47922(function($2) { 47923 var Slick = window.Slick || {}; 47924 Slick = /* @__PURE__ */ function() { 47925 var instanceUid = 0; 47926 function Slick2(element, settings) { 47927 var _2 = this, dataSettings; 47928 _2.defaults = { 47929 accessibility: true, 47930 adaptiveHeight: false, 47931 appendArrows: $2(element), 47932 appendDots: $2(element), 47933 arrows: true, 47934 asNavFor: null, 47935 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 47936 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 47937 autoplay: false, 47938 autoplaySpeed: 3e3, 47939 centerMode: false, 47940 centerPadding: "50px", 47941 cssEase: "ease", 47942 customPaging: function(slider, i2) { 47943 return $2('<button type="button" />').text(i2 + 1); 47944 }, 47945 dots: false, 47946 dotsClass: "slick-dots", 47947 draggable: true, 47948 easing: "linear", 47949 edgeFriction: 0.35, 47950 fade: false, 47951 focusOnSelect: false, 47952 focusOnChange: false, 47953 infinite: true, 47954 initialSlide: 0, 47955 lazyLoad: "ondemand", 47956 mobileFirst: false, 47957 pauseOnHover: true, 47958 pauseOnFocus: true, 47959 pauseOnDotsHover: false, 47960 respondTo: "window", 47961 responsive: null, 47962 rows: 1, 47963 rtl: false, 47964 slide: "", 47965 slidesPerRow: 1, 47966 slidesToShow: 1, 47967 slidesToScroll: 1, 47968 speed: 500, 47969 swipe: true, 47970 swipeToSlide: false, 47971 touchMove: true, 47972 touchThreshold: 5, 47973 useCSS: true, 47974 useTransform: true, 47975 variableWidth: false, 47976 vertical: false, 47977 verticalSwiping: false, 47978 waitForAnimate: true, 47979 zIndex: 1e3 47980 }; 47981 _2.initials = { 47982 animating: false, 47983 dragging: false, 47984 autoPlayTimer: null, 47985 currentDirection: 0, 47986 currentLeft: null, 47987 currentSlide: 0, 47988 direction: 1, 47989 $dots: null, 47990 listWidth: null, 47991 listHeight: null, 47992 loadIndex: 0, 47993 $nextArrow: null, 47994 $prevArrow: null, 47995 scrolling: false, 47996 slideCount: null, 47997 slideWidth: null, 47998 $slideTrack: null, 47999 $slides: null, 48000 sliding: false, 48001 slideOffset: 0, 48002 swipeLeft: null, 48003 swiping: false, 48004 $list: null, 48005 touchObject: {}, 48006 transformsEnabled: false,
48007 unslicked: false 48008 }; 48009 $2.extend(_2, _2.initials); 48010 _2.activeBreakpoint = null; 48011 _2.animType = null; 48012 _2.animProp = null; 48013 _2.breakpoints = []; 48014 _2.breakpointSettings = []; 48015 _2.cssTransitions = false; 48016 _2.focussed = false; 48017 _2.interrupted = false; 48018 _2.hidden = "hidden"; 48019 _2.paused = true; 48020 _2.positionProp = null; 48021 _2.respondTo = null; 48022 _2.rowCount = 1; 48023 _2.shouldClick = true; 48024 _2.$slider = $2(element); 48025 _2.$slidesCache = null; 48026 _2.transformType = null; 48027 _2.transitionType = null; 48028 _2.visibilityChange = "visibilitychange"; 48029 _2.windowWidth = 0; 48030 _2.windowTimer = null; 48031 dataSettings = $2(element).data("slick") || {}; 48032 _2.options = $2.extend({}, _2.defaults, settings, dataSettings); 48033 _2.currentSlide = _2.options.initialSlide; 48034 _2.originalSettings = _2.options; 48035 if (typeof document.mozHidden !== "undefined") { 48036 _2.hidden = "mozHidden"; 48037 _2.visibilityChange = "mozvisibilitychange"; 48038 } else if (typeof document.webkitHidden !== "undefined") { 48039 _2.hidden = "webkitHidden"; 48040 _2.visibilityChange = "webkitvisibilitychange"; 48041 } 48042 _2.autoPlay = $2.proxy(_2.autoPlay, _2); 48043 _2.autoPlayClear = $2.proxy(_2.autoPlayClear, _2); 48044 _2.autoPlayIterator = $2.proxy(_2.autoPlayIterator, _2); 48045 _2.changeSlide = $2.proxy(_2.changeSlide, _2); 48046 _2.clickHandler = $2.proxy(_2.clickHandler, _2); 48047 _2.selectHandler = $2.proxy(_2.selectHandler, _2); 48048 _2.setPosition = $2.proxy(_2.setPosition, _2); 48049 _2.swipeHandler = $2.proxy(_2.swipeHandler, _2); 48050 _2.dragHandler = $2.proxy(_2.dragHandler, _2); 48051 _2.keyHandler = $2.proxy(_2.keyHandler, _2); 48052 _2.instanceUid = instanceUid++; 48053 _2.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 48054 _2.registerBreakpoints(); 48055 _2.init(true); 48056 } 48057 return Slick2; 48058 }(); 48059 Slick.prototype.activateADA = function() { 48060 var _2 = this; 48061 _2.$slideTrack.find(".slick-active").attr({ 48062 "aria-hidden": "false" 48063 }).find("a, input, button, select").attr({ 48064 "tabindex": "0" 48065 }); 48066 }; 48067 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index3, addBefore) { 48068 var _2 = this; 48069 if (typeof index3 === "boolean") { 48070 addBefore = index3; 48071 index3 = null; 48072 } else if (index3 < 0 || index3 >= _2.slideCount) { 48073 return false; 48074 } 48075 _2.unload(); 48076 if (typeof index3 === "number") { 48077 if (index3 === 0 && _2.$slides.length === 0) { 48078 $2(markup).appendTo(_2.$slideTrack); 48079 } else if (addBefore) { 48080 $2(markup).insertBefore(_2.$slides.eq(index3)); 48081 } else { 48082 $2(markup).insertAfter(_2.$slides.eq(index3)); 48083 } 48084 } else { 48085 if (addBefore === true) { 48086 $2(markup).prependTo(_2.$slideTrack); 48087 } else { 48088 $2(markup).appendTo(_2.$slideTrack); 48089 } 48090 } 48091 _2.$slides = _2.$slideTrack.children(this.options.slide); 48092 _2.$slideTrack.children(this.options.slide).detach(); 48093 _2.$slideTrack.append(_2.$slides); 48094 _2.$slides.each(function(index4, element) { 48095 $2(element).attr("data-slick-index", index4); 48096 }); 48097 _2.$slidesCache = _2.$slides; 48098 _2.reinit(); 48099 }; 48100 Slick.prototype.animateHeight = function() { 48101 var _2 = this; 48102 if (_2.options.slidesToShow === 1 && _2.options.adaptiveHeight === true && _2.options.vertical === false) { 48103 var targetHeight = _2.$slides.eq(_2.currentSlide).outerHeight(true); 48104 _2.$list.animate({ 48105 height: targetHeight 48106 }, _2.options.speed); 48107 } 48108 }; 48109 Slick.prototype.animateSlide = function(targetLeft, callback) { 48110 var animProps = {}, _2 = this; 48111 _2.animateHeight(); 48112 if (_2.options.rtl === true && _2.options.vertical === false) { 48113 targetLeft = -targetLeft; 48114 } 48115 if (_2.transformsEnabled === false) { 48116 if (_2.options.vertical === false) { 48117 _2.$slideTrack.animate({ 48118 left: targetLeft 48119 }, _2.options.speed, _2.options.easing, callback); 48120 } else { 48121 _2.$slideTrack.animate({ 48122 top: targetLeft 48123 }, _2.options.speed, _2.options.easing, callback); 48124 } 48125 } else { 48126 if (_2.cssTransitions === false) { 48127 if (_2.options.rtl === true) { 48128 _2.currentLeft = -_2.currentLeft; 48129 } 48130 $2({ 48131 animStart: _2.currentLeft 48132 }).animate({ 48133 animStart: targetLeft 48134 }, { 48135 duration: _2.options.speed, 48136 easing: _2.options.easing, 48137 step: function(now) { 48138 now = Math.ceil(now); 48139 if (_2.options.vertical === false) { 48140 animProps[_2.animType] = "translate(" + now + "px, 0px)"; 48141 _2.$slideTrack.css(animProps); 48142 } else { 48143 animProps[_2.animType] = "translate(0px," + now + "px)"; 48144 _2.$slideTrack.css(animProps); 48145 } 48146 }, 48147 complete: function() { 48148 if (callback) { 48149 callback.call(); 48150 } 48151 } 48152 }); 48153 } else { 48154 _2.applyTransition();
48155 targetLeft = Math.ceil(targetLeft); 48156 if (_2.options.vertical === false) { 48157 animProps[_2.animType] = "translate3d(" + targetLeft + "px, 0px, 0px)"; 48158 } else { 48159 animProps[_2.animType] = "translate3d(0px," + targetLeft + "px, 0px)"; 48160 } 48161 _2.$slideTrack.css(animProps); 48162 if (callback) { 48163 setTimeout(function() { 48164 _2.disableTransition(); 48165 callback.call(); 48166 }, _2.options.speed); 48167 } 48168 } 48169 } 48170 }; 48171 Slick.prototype.getNavTarget = function() { 48172 var _2 = this, asNavFor = _2.options.asNavFor; 48173 if (asNavFor && asNavFor !== null) { 48174 asNavFor = $2(asNavFor).not(_2.$slider); 48175 } 48176 return asNavFor; 48177 }; 48178 Slick.prototype.asNavFor = function(index3) { 48179 var _2 = this, asNavFor = _2.getNavTarget(); 48180 if (asNavFor !== null && typeof asNavFor === "object") { 48181 asNavFor.each(function() { 48182 var target = $2(this).slick("getSlick"); 48183 if (!target.unslicked) { 48184 target.slideHandler(index3, true); 48185 } 48186 }); 48187 } 48188 }; 48189 Slick.prototype.applyTransition = function(slide) { 48190 var _2 = this, transition = {}; 48191 if (_2.options.fade === false) { 48192 transition[_2.transitionType] = _2.transformType + " " + _2.options.speed + "ms " + _2.options.cssEase; 48193 } else { 48194 transition[_2.transitionType] = "opacity " + _2.options.speed + "ms " + _2.options.cssEase; 48195 } 48196 if (_2.options.fade === false) { 48197 _2.$slideTrack.css(transition); 48198 } else { 48199 _2.$slides.eq(slide).css(transition); 48200 } 48201 }; 48202 Slick.prototype.autoPlay = function() { 48203 var _2 = this; 48204 _2.autoPlayClear(); 48205 if (_2.slideCount > _2.options.slidesToShow) { 48206 _2.autoPlayTimer = setInterval(_2.autoPlayIterator, _2.options.autoplaySpeed); 48207 } 48208 }; 48209 Slick.prototype.autoPlayClear = function() { 48210 var _2 = this; 48211 if (_2.autoPlayTimer) { 48212 clearInterval(_2.autoPlayTimer); 48213 } 48214 }; 48215 Slick.prototype.autoPlayIterator = function() { 48216 var _2 = this, slideTo = _2.currentSlide + _2.options.slidesToScroll; 48217 if (!_2.paused && !_2.interrupted && !_2.focussed) { 48218 if (_2.options.infinite === false) { 48219 if (_2.direction === 1 && _2.currentSlide + 1 === _2.slideCount - 1) { 48220 _2.direction = 0; 48221 } else if (_2.direction === 0) { 48222 slideTo = _2.currentSlide - _2.options.slidesToScroll; 48223 if (_2.currentSlide - 1 === 0) { 48224 _2.direction = 1; 48225 } 48226 } 48227 } 48228 _2.slideHandler(slideTo); 48229 } 48230 }; 48231 Slick.prototype.buildArrows = function() { 48232 var _2 = this; 48233 if (_2.options.arrows === true) { 48234 _2.$prevArrow = $2(_2.options.prevArrow).addClass("slick-arrow"); 48235 _2.$nextArrow = $2(_2.options.nextArrow).addClass("slick-arrow"); 48236 if (_2.slideCount > _2.options.slidesToShow) { 48237 _2.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"); 48238 _2.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"); 48239 if (_2.htmlExpr.test(_2.options.prevArrow)) { 48240 _2.$prevArrow.prependTo(_2.options.appendArrows); 48241 } 48242 if (_2.htmlExpr.test(_2.options.nextArrow)) { 48243 _2.$nextArrow.appendTo(_2.options.appendArrows); 48244 } 48245 if (_2.options.infinite !== true) { 48246 _2.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"); 48247 } 48248 } else { 48249 _2.$prevArrow.add(_2.$nextArrow).addClass("slick-hidden").attr({ 48250 "aria-disabled": "true", 48251 "tabindex": "-1" 48252 }); 48253 } 48254 } 48255 }; 48256 Slick.prototype.buildDots = function() { 48257 var _2 = this, i2, dot; 48258 if (_2.options.dots === true && _2.slideCount > _2.options.slidesToShow) { 48259 _2.$slider.addClass("slick-dotted"); 48260 dot = $2("<ul />").addClass(_2.options.dotsClass); 48261 for (i2 = 0; i2 <= _2.getDotCount(); i2 += 1) { 48262 dot.append($2("<li />").append(_2.options.customPaging.call(this, _2, i2))); 48263 } 48264 _2.$dots = dot.appendTo(_2.options.appendDots); 48265 _2.$dots.find("li").first().addClass("slick-active"); 48266 } 48267 }; 48268 Slick.prototype.buildOut = function() { 48269 var _2 = this; 48270 _2.$slides = _2.$slider.children(_2.options.slide + ":not(.slick-cloned)").addClass("slick-slide"); 48271 _2.slideCount = _2.$slides.length; 48272 _2.$slides.each(function(index3, element) { 48273 $2(element).attr("data-slick-index", index3).data("originalStyling", $2(element).attr("style") || ""); 48274 }); 48275 _2.$slider.addClass("slick-slider"); 48276 _2.$slideTrack = _2.slideCount === 0 ? $2('<div class="slick-track"/>').appendTo(_2.$slider) : _2.$slides.wrapAll('<div class="slick-track"/>').parent(); 48277 _2.$list = _2.$slideTrack.wrap( 48278 '<div class="slick-list"/>' 48279 ).parent(); 48280 _2.$slideTrack.css("opacity", 0); 48281 if (_2.options.centerMode === true || _2.options.swipeToSlide === true) { 48282 _2.options.slidesToScroll = 1; 48283 } 48284 $2("img[data-lazy]", _2.$slider).not("[src]").addClass("slick-loading"); 48285 _2.setupInfinite(); 48286 _2.buildArrows(); 48287 _2.buildDots(); 48288 _2.updateDots(); 48289 _2.setSlideClasses(typeof _2.currentSlide === "number" ? _2.currentSlide : 0); 48290 if (_2.options.draggable === true) { 48291 _2.$list.addClass("draggable"); 48292 } 48293 }; 48294 Slick.prototype.buildRows = function() { 48295 var _2 = this, a2, b2, c2, newSlides, numOfSlides, originalSlides, slidesPerSection; 48296 newSlides = document.createDocumentFragment(); 48297 originalSlides = _2.$slider.children(); 48298 if (_2.options.rows > 0) { 48299 slidesPerSection = _2.options.slidesPerRow * _2.options.rows; 48300 numOfSlides = Math.ceil(
48301 originalSlides.length / slidesPerSection 48302 ); 48303 for (a2 = 0; a2 < numOfSlides; a2++) { 48304 var slide = document.createElement("div"); 48305 for (b2 = 0; b2 < _2.options.rows; b2++) { 48306 var row = document.createElement("div"); 48307 for (c2 = 0; c2 < _2.options.slidesPerRow; c2++) { 48308 var target = a2 * slidesPerSection + (b2 * _2.options.slidesPerRow + c2); 48309 if (originalSlides.get(target)) { 48310 row.appendChild(originalSlides.get(target)); 48311 } 48312 } 48313 slide.appendChild(row); 48314 } 48315 newSlides.appendChild(slide); 48316 } 48317 _2.$slider.empty().append(newSlides); 48318 _2.$slider.children().children().children().css({ 48319 "width": 100 / _2.options.slidesPerRow + "%", 48320 "display": "inline-block" 48321 }); 48322 } 48323 }; 48324 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 48325 var _2 = this, breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 48326 var sliderWidth = _2.$slider.width(); 48327 var windowWidth = window.innerWidth || $2(window).width(); 48328 if (_2.respondTo === "window") { 48329 respondToWidth = windowWidth; 48330 } else if (_2.respondTo === "slider") { 48331 respondToWidth = sliderWidth; 48332 } else if (_2.respondTo === "min") { 48333 respondToWidth = Math.min(windowWidth, sliderWidth); 48334 } 48335 if (_2.options.responsive && _2.options.responsive.length && _2.options.responsive !== null) { 48336 targetBreakpoint = null; 48337 for (breakpoint in _2.breakpoints) { 48338 if (_2.breakpoints.hasOwnProperty(breakpoint)) { 48339 if (_2.originalSettings.mobileFirst === false) { 48340 if (respondToWidth < _2.breakpoints[breakpoint]) { 48341 targetBreakpoint = _2.breakpoints[breakpoint]; 48342 } 48343 } else { 48344 if (respondToWidth > _2.breakpoints[breakpoint]) { 48345 targetBreakpoint = _2.breakpoints[breakpoint]; 48346 } 48347 } 48348 } 48349 } 48350 if (targetBreakpoint !== null) { 48351 if (_2.activeBreakpoint !== null) { 48352 if (targetBreakpoint !== _2.activeBreakpoint || forceUpdate) { 48353 _2.activeBreakpoint = targetBreakpoint; 48354 if (_2.breakpointSettings[targetBreakpoint] === "unslick") { 48355 _2.unslick(targetBreakpoint); 48356 } else { 48357 _2.options = $2.extend( 48358 {}, 48359 _2.originalSettings, 48360 _2.breakpointSettings[targetBreakpoint] 48361 ); 48362 if (initial === true) { 48363 _2.currentSlide = _2.options.initialSlide; 48364 } 48365 _2.refresh(initial); 48366 } 48367 triggerBreakpoint = targetBreakpoint; 48368 } 48369 } else { 48370 _2.activeBreakpoint = targetBreakpoint; 48371 if (_2.breakpointSettings[targetBreakpoint] === "unslick") { 48372 _2.unslick(targetBreakpoint); 48373 } else { 48374 _2.options = $2.extend( 48375 {}, 48376 _2.originalSettings, 48377 _2.breakpointSettings[targetBreakpoint] 48378 ); 48379 if (initial === true) { 48380 _2.currentSlide = _2.options.initialSlide; 48381 } 48382 _2.refresh(initial); 48383 } 48384 triggerBreakpoint = targetBreakpoint; 48385 } 48386 } else { 48387 if (_2.activeBreakpoint !== null) { 48388 _2.activeBreakpoint = null; 48389 _2.options = _2.originalSettings; 48390 if (initial === true) { 48391 _2.currentSlide = _2.options.initialSlide; 48392 } 48393 _2.refresh(initial); 48394 triggerBreakpoint = targetBreakpoint; 48395 } 48396 } 48397 if (!initial && triggerBreakpoint !== false) { 48398 _2.$slider.trigger("breakpoint", [_2, triggerBreakpoint]); 48399 } 48400 } 48401 }; 48402 Slick.prototype.changeSlide = function(event, dontAnimate) { 48403 var _2 = this, $target = $2(event.currentTarget), indexOffset, slideOffset, unevenOffset; 48404 if ($target.is("a")) { 48405 event.preventDefault(); 48406 } 48407 if (!$target.is("li")) { 48408 $target = $target.closest("li"); 48409 } 48410 unevenOffset = _2.slideCount % _2.options.slidesToScroll !== 0; 48411 indexOffset = unevenOffset ? 0 : (_2.slideCount - _2.currentSlide) % _2.options.slidesToScroll; 48412 switch (event.data.message) { 48413 case "previous": 48414 slideOffset = indexOffset === 0 ? _2.options.slidesToScroll : _2.options.slidesToShow - indexOffset; 48415 if (_2.slideCount > _2.options.slidesToShow) { 48416 _2.slideHandler(_2.currentSlide - slideOffset, false, dontAnimate); 48417 } 48418 break; 48419 case "next": 48420 slideOffset = indexOffset === 0 ? _2.options.slidesToScroll : indexOffset; 48421 if (_2.slideCount > _2.options.slidesToShow) { 48422 _2.slideHandler(_2.currentSlide + slideOffset, false, dontAnimate); 48423 } 48424 break; 48425 case "index": 48426 var index3 = event.data.index === 0 ? 0 : event.data.index || $target.index() * _2.options.slidesToScroll; 48427 _2.slideHandler(_2.checkNavigable(index3), false, dontAnimate); 48428 $target.children().trigger("focus"); 48429 break; 48430 default: 48431 return; 48432 } 48433 }; 48434 Slick.prototype.checkNavigable = function(index3) { 48435 var _2 = this, navigables, prevNavigable; 48436 navigables = _2.getNavigableIndexes(); 48437 prevNavigable = 0; 48438 if (index3 > navigables[navigables.length - 1]) { 48439 index3 = navigables[navigables.length - 1]; 48440 } else { 48441 for (var n2 in navigables) { 48442 if (index3 < navigables[n2]) { 48443 index3 = prevNavigable; 48444 break; 48445 } 48446 prevNavigable = navigables[n2]; 48447 } 48448 } 48449 return index3; 48450 }; 48451 Slick.prototype.cleanUpEvents = function() { 48452 var _2 = this; 48453 if (_2.options.dots && _2.$dots !== null) { 48454 $2("li", _2.$dots).off("click.slick", _2.changeSlide).off("mouseenter.slick", $2.proxy(_2.interrupt, _2, true)).off("mouseleave.
48454slick", $2.proxy(_2.interrupt, _2, false)); 48455 if (_2.options.accessibility === true) { 48456 _2.$dots.off("keydown.slick", _2.keyHandler); 48457 } 48458 } 48459 _2.$slider.off("focus.slick blur.slick"); 48460 if (_2.options.arrows === true && _2.slideCount > _2.options.slidesToShow) { 48461 _2.$prevArrow && _2.$prevArrow.off("click.slick", _2.changeSlide); 48462 _2.$nextArrow && _2.$nextArrow.off("click.slick", _2.changeSlide); 48463 if (_2.options.accessibility === true) { 48464 _2.$prevArrow && _2.$prevArrow.off("keydown.slick", _2.keyHandler); 48465 _2.$nextArrow && _2.$nextArrow.off("keydown.slick", _2.keyHandler); 48466 } 48467 } 48468 _2.$list.off("touchstart.slick mousedown.slick", _2.swipeHandler); 48469 _2.$list.off("touchmove.slick mousemove.slick", _2.swipeHandler); 48470 _2.$list.off("touchend.slick mouseup.slick", _2.swipeHandler); 48471 _2.$list.off("touchcancel.slick mouseleave.slick", _2.swipeHandler); 48472 _2.$list.off("click.slick", _2.clickHandler); 48473 $2(document).off(_2.visibilityChange, _2.visibility); 48474 _2.cleanUpSlideEvents(); 48475 if (_2.options.accessibility === true) { 48476 _2.$list.off("keydown.slick", _2.keyHandler); 48477 } 48478 if (_2.options.focusOnSelect === true) { 48479 $2(_2.$slideTrack).children().off("click.slick", _2.selectHandler); 48480 } 48481 $2(window).off("orientationchange.slick.slick-" + _2.instanceUid, _2.orientationChange); 48482 $2(window).off("resize.slick.slick-" + _2.instanceUid, _2.resize); 48483 $2("[draggable!=true]", _2.$slideTrack).off("dragstart", _2.preventDefault); 48484 $2(window).off("load.slick.slick-" + _2.instanceUid, _2.setPosition); 48485 }; 48486 Slick.prototype.cleanUpSlideEvents = function() { 48487 var _2 = this; 48488 _2.$list.off("mouseenter.slick", $2.proxy(_2.interrupt, _2, true)); 48489 _2.$list.off("mouseleave.slick", $2.proxy(_2.interrupt, _2, false)); 48490 }; 48491 Slick.prototype.cleanUpRows = function() { 48492 var _2 = this, originalSlides; 48493 if (_2.options.rows > 0) { 48494 originalSlides = _2.$slides.children().children(); 48495 originalSlides.removeAttr("style"); 48496 _2.$slider.empty().append(originalSlides); 48497 } 48498 }; 48499 Slick.prototype.clickHandler = function(event) { 48500 var _2 = this; 48501 if (_2.shouldClick === false) { 48502 event.stopImmediatePropagation(); 48503 event.stopPropagation(); 48504 event.preventDefault(); 48505 } 48506 }; 48507 Slick.prototype.destroy = function(refresh) { 48508 var _2 = this; 48509 _2.autoPlayClear(); 48510 _2.touchObject = {}; 48511 _2.cleanUpEvents(); 48512 $2(".slick-cloned", _2.$slider).detach(); 48513 if (_2.$dots) { 48514 _2.$dots.remove(); 48515 } 48516 if (_2.$prevArrow && _2.$prevArrow.length) { 48517 _2.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""); 48518 if (_2.htmlExpr.test(_2.options.prevArrow)) { 48519 _2.$prevArrow.remove(); 48520 } 48521 } 48522 if (_2.$nextArrow && _2.$nextArrow.length) { 48523 _2.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""); 48524 if (_2.htmlExpr.test(_2.options.nextArrow)) { 48525 _2.$nextArrow.remove(); 48526 } 48527 } 48528 if (_2.$slides) { 48529 _2.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function() { 48530 $2(this).attr("style", $2(this).data("originalStyling")); 48531 }); 48532 _2.$slideTrack.children(this.options.slide).detach(); 48533 _2.$slideTrack.detach(); 48534 _2.$list.detach(); 48535 _2.$slider.append(_2.$slides); 48536 } 48537 _2.cleanUpRows(); 48538 _2.$slider.removeClass("slick-slider"); 48539 _2.$slider.removeClass("slick-initialized"); 48540 _2.$slider.removeClass("slick-dotted"); 48541 _2.unslicked = true; 48542 if (!refresh) { 48543 _2.$slider.trigger("destroy", [_2]); 48544 } 48545 }; 48546 Slick.prototype.disableTransition = function(slide) { 48547 var _2 = this, transition = {}; 48548 transition[_2.transitionType] = ""; 48549 if (_2.options.fade === false) { 48550 _2.$slideTrack.css(transition); 48551 } else { 48552 _2.$slides.eq(slide).css(transition); 48553 } 48554 }; 48555 Slick.prototype.fadeSlide = function(slideIndex, callback) { 48556 var _2 = this; 48557 if (_2.cssTransitions === false) { 48558 _2.$slides.eq(slideIndex).css({ 48559 zIndex: _2.options.zIndex 48560 }); 48561 _2.$slides.eq(slideIndex).animate({ 48562 opacity: 1 48563 }, _2.options.speed, _2.options.easing, callback); 48564 } else { 48565 _2.applyTransition(slideIndex); 48566 _2.$slides.eq(slideIndex).css({ 48567 opacity: 1, 48568 zIndex: _2.options.zIndex 48569 }); 48570 if (callback) { 48571 setTimeout(function() { 48572 _2.disableTransition(slideIndex); 48573 callback.call(); 48574 }, _2.options.speed); 48575 } 48576 } 48577 }; 48578 Slick.prototype.fadeSlideOut = function(slideIndex) { 48579 var _2 = this; 48580 if (_2.cssTransitions === false) { 48581 _2.$slides.eq(slideIndex).animate({ 48582 opacity: 0, 48583 zIndex: _2.options.zIndex - 2 48584 }, _2.options.speed, _2.options.easing); 48585 } else { 48586 _2.applyTransition(slideIndex); 48587 _2.$slides.eq(slideIndex).css({ 48588 opacity: 0, 48589 zIndex: _2.options.zIndex - 2 48590 }); 48591 } 48592 };
48593 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 48594 var _2 = this; 48595 if (filter !== null) { 48596 _2.$slidesCache = _2.$slides; 48597 _2.unload(); 48598 _2.$slideTrack.children(this.options.slide).detach(); 48599 _2.$slidesCache.filter(filter).appendTo(_2.$slideTrack); 48600 _2.reinit(); 48601 } 48602 }; 48603 Slick.prototype.focusHandler = function() { 48604 var _2 = this; 48605 _2.$slider.off("focus.slick blur.slick").on( 48606 "focus.slick", 48607 "*", 48608 function(event) { 48609 var $sf = $2(this); 48610 setTimeout(function() { 48611 if (_2.options.pauseOnFocus) { 48612 if ($sf.is(":focus")) { 48613 _2.focussed = true; 48614 _2.autoPlay(); 48615 } 48616 } 48617 }, 0); 48618 } 48619 ).on( 48620 "blur.slick", 48621 "*", 48622 function(event) { 48623 $2(this); 48624 if (_2.options.pauseOnFocus) { 48625 _2.focussed = false; 48626 _2.autoPlay(); 48627 } 48628 } 48629 ); 48630 }; 48631 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 48632 var _2 = this; 48633 return _2.currentSlide; 48634 }; 48635 Slick.prototype.getDotCount = function() { 48636 var _2 = this; 48637 var breakPoint = 0; 48638 var counter = 0; 48639 var pagerQty = 0; 48640 if (_2.options.infinite === true) { 48641 if (_2.slideCount <= _2.options.slidesToShow) { 48642 ++pagerQty; 48643 } else { 48644 while (breakPoint < _2.slideCount) { 48645 ++pagerQty; 48646 breakPoint = counter + _2.options.slidesToScroll; 48647 counter += _2.options.slidesToScroll <= _2.options.slidesToShow ? _2.options.slidesToScroll : _2.options.slidesToShow; 48648 } 48649 } 48650 } else if (_2.options.centerMode === true) { 48651 pagerQty = _2.slideCount; 48652 } else if (!_2.options.asNavFor) { 48653 pagerQty = 1 + Math.ceil((_2.slideCount - _2.options.slidesToShow) / _2.options.slidesToScroll); 48654 } else { 48655 while (breakPoint < _2.slideCount) { 48656 ++pagerQty; 48657 breakPoint = counter + _2.options.slidesToScroll; 48658 counter += _2.options.slidesToScroll <= _2.options.slidesToShow ? _2.options.slidesToScroll : _2.options.slidesToShow; 48659 } 48660 } 48661 return pagerQty - 1; 48662 }; 48663 Slick.prototype.getLeft = function(slideIndex) { 48664 var _2 = this, targetLeft, verticalHeight, verticalOffset = 0, targetSlide, coef; 48665 _2.slideOffset = 0; 48666 verticalHeight = _2.$slides.first().outerHeight(true); 48667 if (_2.options.infinite === true) { 48668 if (_2.slideCount > _2.options.slidesToShow) { 48669 _2.slideOffset = _2.slideWidth * _2.options.slidesToShow * -1; 48670 coef = -1; 48671 if (_2.options.vertical === true && _2.options.centerMode === true) { 48672 if (_2.options.slidesToShow === 2) { 48673 coef = -1.5; 48674 } else if (_2.options.slidesToShow === 1) { 48675 coef = -2; 48676 } 48677 } 48678 verticalOffset = verticalHeight * _2.options.slidesToShow * coef; 48679 } 48680 if (_2.slideCount % _2.options.slidesToScroll !== 0) { 48681 if (slideIndex + _2.options.slidesToScroll > _2.slideCount && _2.slideCount > _2.options.slidesToShow) { 48682 if (slideIndex > _2.slideCount) {
48683 _2.slideOffset = (_2.options.slidesToShow - (slideIndex - _2.slideCount)) * _2.slideWidth * -1; 48684 verticalOffset = (_2.options.slidesToShow - (slideIndex - _2.slideCount)) * verticalHeight * -1; 48685 } else { 48686 _2.slideOffset = _2.slideCount % _2.options.slidesToScroll * _2.slideWidth * -1; 48687 verticalOffset = _2.slideCount % _2.options.slidesToScroll * verticalHeight * -1; 48688 } 48689 } 48690 } 48691 } else { 48692 if (slideIndex + _2.options.slidesToShow > _2.slideCount) { 48693 _2.slideOffset = (slideIndex + _2.options.slidesToShow - _2.slideCount) * _2.slideWidth; 48694 verticalOffset = (slideIndex + _2.options.slidesToShow - _2.slideCount) * verticalHeight; 48695 } 48696 } 48697 if (_2.slideCount <= _2.options.slidesToShow) { 48698 _2.slideOffset = 0; 48699 verticalOffset = 0; 48700 } 48701 if (_2.options.centerMode === true && _2.slideCount <= _2.options.slidesToShow) { 48702 _2.slideOffset = _2.slideWidth * Math.floor(_2.options.slidesToShow) / 2 - _2.slideWidth * _2.slideCount / 2; 48703 } else if (_2.options.centerMode === true && _2.options.infinite === true) { 48704 _2.slideOffset += _2.slideWidth * Math.floor(_2.options.slidesToShow / 2) - _2.slideWidth; 48705 } else if (_2.options.centerMode === true) { 48706 _2.slideOffset = 0; 48707 _2.slideOffset += _2.slideWidth * Math.floor(_2.options.slidesToShow / 2); 48708 } 48709 if (_2.options.vertical === false) { 48710 targetLeft = slideIndex * _2.slideWidth * -1 + _2.slideOffset; 48711 } else { 48712 targetLeft = slideIndex * verticalHeight * -1 + verticalOffset; 48713 } 48714 if (_2.options.variableWidth === true) { 48715 if (_2.slideCount <= _2.options.slidesToShow || _2.options.infinite === false) { 48716 targetSlide = _2.$slideTrack.children(".slick-slide").eq(slideIndex); 48717 } else { 48718 targetSlide = _2.$slideTrack.children(".slick-slide").eq(slideIndex + _2.options.slidesToShow); 48719 } 48720 if (_2.options.rtl === true) { 48721 if (targetSlide[0]) { 48722 targetLeft = (_2.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 48723 } else { 48724 targetLeft = 0; 48725 } 48726 } else { 48727 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 48728 } 48729 if (_2.options.centerMode === true) { 48730 if (_2.slideCount <= _2.options.slidesToShow || _2.options.infinite === false) { 48731 targetSlide = _2.$slideTrack.children(".slick-slide").eq(slideIndex); 48732 } else { 48733 targetSlide = _2.$slideTrack.children(".slick-slide").eq(slideIndex + _2.options.slidesToShow + 1); 48734 } 48735 if (_2.options.rtl === true) { 48736 if (targetSlide[0]) { 48737 targetLeft = (_2.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 48738 } else { 48739 targetLeft = 0; 48740 } 48741 } else { 48742 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 48743 } 48744 targetLeft += (_2.$list.width() - targetSlide.outerWidth()) / 2; 48745 } 48746 } 48747 return targetLeft; 48748 }; 48749 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 48750 var _2 = this; 48751 return _2.options[option]; 48752 }; 48753 Slick.prototype.getNavigableIndexes = function() { 48754 var _2 = this, breakPoint = 0, counter = 0, indexes = [], max; 48755 if (_2.options.infinite === false) { 48756 max = _2.slideCount; 48757 } else { 48758 breakPoint = _2.options.slidesToScroll * -1; 48759 counter = _2.options.slidesToScroll * -1; 48760 max = _2.slideCount * 2; 48761 } 48762 while (breakPoint < max) { 48763 indexes.push(breakPoint); 48764 breakPoint = counter + _2.options.slidesToScroll; 48765 counter += _2.options.slidesToScroll <= _2.options.slidesToShow ? _2.options.slidesToScroll : _2.options.slidesToShow; 48766 } 48767 return indexes; 48768 }; 48769 Slick.prototype.getSlick = function() { 48770 return this; 48771 }; 48772 Slick.prototype.getSlideCount = function() { 48773 var _2 = this, slidesTraversed, swipedSlide, swipeTarget, centerOffset; 48774 centerOffset = _2.options.centerMode === true ? Math.floor(_2.$list.width() / 2) : 0; 48775 swipeTarget = _2.swipeLeft * -1 + centerOffset; 48776 if (_2.options.swipeToSlide === true) { 48777 _2.$slideTrack.find(".slick-slide").each(function(index3, slide) { 48778 var slideOuterWidth, slideOffset, slideRightBoundary; 48779 slideOuterWidth = $2(slide).outerWidth(); 48780 slideOffset = slide.offsetLeft; 48781 if (_2.options.centerMode !== true) { 48782 slideOffset += slideOuterWidth / 2; 48783 } 48784 slideRightBoundary = slideOffset + slideOuterWidth; 48785 if (swipeTarget < slideRightBoundary) { 48786 swipedSlide = slide; 48787 return false;
48788 } 48789 }); 48790 slidesTraversed = Math.abs($2(swipedSlide).attr("data-slick-index") - _2.currentSlide) || 1; 48791 return slidesTraversed; 48792 } else { 48793 return _2.options.slidesToScroll; 48794 } 48795 }; 48796 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 48797 var _2 = this; 48798 _2.changeSlide({ 48799 data: { 48800 message: "index", 48801 index: parseInt(slide) 48802 } 48803 }, dontAnimate); 48804 }; 48805 Slick.prototype.init = function(creation) { 48806 var _2 = this; 48807 if (!$2(_2.$slider).hasClass("slick-initialized")) { 48808 $2(_2.$slider).addClass("slick-initialized"); 48809 _2.buildRows(); 48810 _2.buildOut(); 48811 _2.setProps(); 48812 _2.startLoad(); 48813 _2.loadSlider(); 48814 _2.initializeEvents(); 48815 _2.updateArrows(); 48816 _2.updateDots(); 48817 _2.checkResponsive(true); 48818 _2.focusHandler(); 48819 } 48820 if (creation) { 48821 _2.$slider.trigger("init", [_2]); 48822 } 48823 if (_2.options.accessibility === true) { 48824 _2.initADA(); 48825 } 48826 if (_2.options.autoplay) { 48827 _2.paused = false; 48828 _2.autoPlay(); 48829 } 48830 }; 48831 Slick.prototype.initADA = function() { 48832 var _2 = this, numDotGroups = Math.ceil(_2.slideCount / _2.options.slidesToScroll), tabControlIndexes = _2.getNavigableIndexes().filter(function(val) { 48833 return val >= 0 && val < _2.slideCount; 48834 }); 48835 _2.$slides.add(_2.$slideTrack.find(".slick-cloned")).attr({ 48836 "aria-hidden": "true", 48837 "tabindex": "-1" 48838 }).find("a, input, button, select").attr({ 48839 "tabindex": "-1" 48840 }); 48841 if (_2.$dots !== null) { 48842 _2.$slides.not(_2.$slideTrack.find(".slick-cloned")).each(function(i3) { 48843 var slideControlIndex = tabControlIndexes.indexOf(i3); 48844 $2(this).attr({ 48845 "role": "tabpanel", 48846 "id": "slick-slide" + _2.instanceUid + i3, 48847 "tabindex": -1 48848 }); 48849 if (slideControlIndex !== -1) { 48850 var ariaButtonControl = "slick-slide-control" + _2.instanceUid + slideControlIndex; 48851 if ($2("#" + ariaButtonControl).length) { 48852 $2(this).attr({ 48853 "aria-describedby": ariaButtonControl 48854 }); 48855 } 48856 } 48857 }); 48858 _2.$dots.attr("role", "tablist").find("li").each(function(i3) { 48859 var mappedSlideIndex = tabControlIndexes[i3]; 48860 $2(this).attr({ 48861 "role": "presentation" 48862 }); 48863 $2(this).find("button").first().attr({ 48864 "role": "tab", 48865 "id": "slick-slide-control" + _2.instanceUid + i3, 48866 "aria-controls": "slick-slide" + _2.instanceUid + mappedSlideIndex, 48867 "aria-label": i3 + 1 + " of " + numDotGroups, 48868 "aria-selected": null, 48869 "tabindex": "-1" 48870 }); 48871 }).eq(_2.currentSlide).find("button").attr({ 48872 "aria-selected": "true", 48873 "tabindex": "0" 48874 }).end(); 48875 } 48876 for (var i2 = _2.currentSlide, max = i2 + _2.options.slidesToShow; i2 < max; i2++) { 48877 if (_2.options.focusOnChange) { 48878 _2.$slides.eq(i2).attr({ "tabindex": "0" }); 48879 } else { 48880 _2.$slides.eq(i2).removeAttr("tabindex"); 48881 } 48882 } 48883 _2.activateADA(); 48884 }; 48885 Slick.prototype.initArrowEvents = function() { 48886 var _2 = this; 48887 if (_2.options.arrows === true && _2.slideCount > _2.options.slidesToShow) { 48888 _2.$prevArrow.off("click.slick").on("click.slick", { 48889 message: "previous" 48890 }, _2.changeSlide); 48891 _2.$nextArrow.off("click.slick").on("click.slick", { 48892 message: "next" 48893 }, _2.changeSlide); 48894 if (_2.options.accessibility === true) { 48895 _2.$prevArrow.on("keydown.slick", _2.keyHandler); 48896 _2.$nextArrow.on("keydown.slick", _2.keyHandler); 48897 } 48898 } 48899 }; 48900 Slick.prototype.initDotEvents = function() { 48901 var _2 = this; 48902 if (_2.options.dots === true && _2.slideCount > _2.options.slidesToShow) { 48903 $2("li", _2.$dots).on("click.slick", { 48904 message: "index" 48905 }, _2.changeSlide); 48906 if (_2.options.accessibility === true) { 48907 _2.$dots.on("keydown.slick", _2.keyHandler); 48908 } 48909 } 48910 if (_2.options.dots === true && _2.options.pauseOnDotsHover === true && _2.slideCount > _2.options.slidesToShow) { 48911 $2("li", _2.$dots).on("mouseenter.slick", $2.proxy(_2.interrupt, _2, true)).on("mouseleave.
48911slick", $2.proxy(_2.interrupt, _2, false)); 48912 } 48913 }; 48914 Slick.prototype.initSlideEvents = function() { 48915 var _2 = this; 48916 if (_2.options.pauseOnHover) { 48917 _2.$list.on("mouseenter.slick", $2.proxy(_2.interrupt, _2, true)); 48918 _2.$list.on("mouseleave.slick", $2.proxy(_2.interrupt, _2, false)); 48919 } 48920 }; 48921 Slick.prototype.initializeEvents = function() { 48922 var _2 = this; 48923 _2.initArrowEvents(); 48924 _2.initDotEvents(); 48925 _2.initSlideEvents(); 48926 _2.$list.on("touchstart.slick mousedown.slick", { 48927 action: "start" 48928 }, _2.swipeHandler); 48929 _2.$list.on("touchmove.slick mousemove.slick", { 48930 action: "move" 48931 }, _2.swipeHandler); 48932 _2.$list.on("touchend.slick mouseup.slick", { 48933 action: "end" 48934 }, _2.swipeHandler); 48935 _2.$list.on("touchcancel.slick mouseleave.slick", { 48936 action: "end" 48937 }, _2.swipeHandler); 48938 _2.$list.on("click.slick", _2.clickHandler); 48939 $2(document).on(_2.visibilityChange, $2.proxy(_2.visibility, _2)); 48940 if (_2.options.accessibility === true) { 48941 _2.$list.on("keydown.slick", _2.keyHandler); 48942 } 48943 if (_2.options.focusOnSelect === true) { 48944 $2(_2.$slideTrack).children().on("click.slick", _2.selectHandler); 48945 } 48946 $2(window).on("orientationchange.slick.slick-" + _2.instanceUid, $2.proxy(_2.orientationChange, _2)); 48947 $2(window).on("resize.slick.slick-" + _2.instanceUid, $2.proxy(_2.resize, _2)); 48948 $2("[draggable!=true]", _2.$slideTrack).on("dragstart", _2.preventDefault); 48949 $2(window).on("load.slick.slick-" + _2.instanceUid, _2.setPosition); 48950 $2(_2.setPosition); 48951 }; 48952 Slick.prototype.initUI = function() { 48953 var _2 = this; 48954 if (_2.options.arrows === true && _2.slideCount > _2.options.slidesToShow) { 48955 _2.$prevArrow.show(); 48956 _2.$nextArrow.show(); 48957 } 48958 if (_2.options.dots === true && _2.slideCount > _2.options.slidesToShow) { 48959 _2.$dots.show(); 48960 } 48961 }; 48962 Slick.prototype.keyHandler = function(event) { 48963 var _2 = this; 48964 if (!event.target.tagName.match("TEXTAREA|INPUT|SELECT")) { 48965 if (event.keyCode === 37 && _2.options.accessibility === true) { 48966 _2.changeSlide({ 48967 data: { 48968 message: _2.options.rtl === true ? "next" : "previous" 48969 } 48970 }); 48971 } else if (event.keyCode === 39 && _2.options.accessibility === true) { 48972 _2.changeSlide({ 48973 data: { 48974 message: _2.options.rtl === true ? "previous" : "next" 48975 } 48976 }); 48977 } 48978 } 48979 }; 48980 Slick.prototype.lazyLoad = function() { 48981 var _2 = this, loadRange, cloneRange, rangeStart, rangeEnd; 48982 function loadImages(imagesScope) { 48983 $2("img[data-lazy]", imagesScope).each(function() { 48984 var image = $2(this), imageSource = $2(this).attr("data-lazy"), imageSrcSet = $2(this).attr("data-srcset"), imageSizes = $2(this).attr("data-sizes") || _2.$slider.attr("data-sizes"), imageToLoad = document.createElement("img"); 48985 imageToLoad.onload = function() { 48986 image.animate({ opacity: 0 }, 100, function() { 48987 if (imageSrcSet) { 48988 image.attr("srcset", imageSrcSet); 48989 if (imageSizes) { 48990 image.attr("sizes", imageSizes); 48991 } 48992 } 48993 image.attr("src", imageSource).animate({ opacity: 1 }, 200, function() { 48994 image.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"); 48995 }); 48996 _2.$slider.trigger("lazyLoaded", [_2, image, imageSource]); 48997 }); 48998 }; 48999 imageToLoad.onerror = function() { 49000 image.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"); 49001 _2.$slider.trigger("lazyLoadError", [_2, image, imageSource]); 49002 }; 49003 imageToLoad.src = imageSource; 49004 }); 49005 } 49006 if (_2.options.centerMode === true) { 49007 if (_2.options.infinite === true) { 49008 rangeStart = _2.currentSlide + (_2.options.slidesToShow / 2 + 1); 49009 rangeEnd = rangeStart + _2.options.slidesToShow + 2; 49010 } else { 49011 rangeStart = Math.max(0, _2.currentSlide - (_2.options.slidesToShow / 2 + 1)); 49012 rangeEnd = 2 + (_2.options.slidesToShow / 2 + 1) + _2.currentSlide; 49013 } 49014 } else { 49015 rangeStart = _2.options.infinite ? _2.options.slidesToShow + _2.currentSlide : _2.currentSlide; 49016 rangeEnd = Math.ceil(rangeStart + _2.options.slidesToShow); 49017 if (_2.options.fade === true) { 49018 if (rangeStart > 0) rangeStart--; 49019 if (rangeEnd <= _2.slideCount) rangeEnd++; 49020 } 49021 } 49022 loadRange = _2.$slider.find(".slick-slide").slice(rangeStart, rangeEnd); 49023 if (_2.options.lazyLoad === "anticipated") { 49024 var prevSlide = rangeStart - 1, nextSlide = rangeEnd, $slides = _2.$slider.find(".slick-slide"); 49025 for (var i2 = 0; i2 < _2.options.slidesToScroll; i2++) { 49026 if (prevSlide < 0) prevSlide = _2.slideCount - 1; 49027 loadRange = loadRange.add($slides.eq(prevSlide)); 49028 loadRange = loadRange.add($slides.eq(nextSlide)); 49029 prevSlide--; 49030 nextSlide++; 49031 } 49032 } 49033 loadImages(loadRange); 49034 if (_2.slideCount <= _2.options.slidesToShow) { 49035 cloneRange = _2.$slider.find(".slick-slide"); 49036 loadImages(cloneRange); 49037 } else if (_2.currentSlide >= _2.slideCount - _2.options.slidesToShow) { 49038 cloneRange = _2.$slider.find(".slick-cloned").slice(0, _2.options.slidesToShow); 49039 loadImages(cloneRange); 49040 } else if (_2.currentSlide === 0) { 49041 cloneRange = _2.$slider.find(".slick-cloned").slice(_2.options.slidesToShow * -1); 49042 loadImages(cloneRange); 49043 } 49044 }; 49045 Slick.prototype.loadSlider = function() { 49046 var _2 = this; 49047 _2.setPosition(); 49048 _2.$slideTrack.css({ 49049 opacity: 1 49050 }); 49051 _2.$slider.removeClass("slick-loading"); 49052 _2.initUI(); 49053 if (_2.options.lazyLoad === "progressive") { 49054 _2.progressiveLazyLoad(); 49055 } 49056 }; 49057 Slick.prototype.next = Slick.prototype.slickNext = function() { 49058 var _2 = this; 49059 _2.changeSlide({ 49060 data: { 49061 message: "next" 49062 } 49063 }); 49064 }; 49065 Slick.prototype.orientationChange = function() { 49066 var _2 = this; 49067 _2.checkResponsive(); 49068 _2.setPosition(); 49069 }; 49070 Slick.prototype.pause = Slick.prototype.slickPause = function() { 49071 var _2 = this; 49072 _2.autoPlayClear(); 49073 _2.paused = true; 49074 }; 49075 Slick.prototype.play = Slick.prototype.slickPlay = function() { 49076 var _2 = this; 49077 _2.autoPlay(); 49078 _2.options.autoplay = true; 49079 _2.paused = false;
49080 _2.focussed = false; 49081 _2.interrupted = false; 49082 }; 49083 Slick.prototype.postSlide = function(index3) { 49084 var _2 = this; 49085 if (!_2.unslicked) { 49086 _2.$slider.trigger("afterChange", [_2, index3]); 49087 _2.animating = false; 49088 if (_2.slideCount > _2.options.slidesToShow) { 49089 _2.setPosition(); 49090 } 49091 _2.swipeLeft = null; 49092 if (_2.options.autoplay) { 49093 _2.autoPlay(); 49094 } 49095 if (_2.options.accessibility === true) { 49096 _2.initADA(); 49097 if (_2.options.focusOnChange) { 49098 var $currentSlide = $2(_2.$slides.get(_2.currentSlide)); 49099 $currentSlide.attr("tabindex", 0).focus(); 49100 } 49101 } 49102 } 49103 }; 49104 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 49105 var _2 = this; 49106 _2.changeSlide({ 49107 data: { 49108 message: "previous" 49109 } 49110 }); 49111 }; 49112 Slick.prototype.preventDefault = function(event) { 49113 event.preventDefault(); 49114 }; 49115 Slick.prototype.progressiveLazyLoad = function(tryCount) { 49116 tryCount = tryCount || 1; 49117 var _2 = this, $imgsToLoad = $2("img[data-lazy]", _2.$slider), image, imageSource, imageSrcSet, imageSizes, imageToLoad; 49118 if ($imgsToLoad.length) { 49119 image = $imgsToLoad.first(); 49120 imageSource = image.attr("data-lazy"); 49121 imageSrcSet = image.attr("data-srcset"); 49122 imageSizes = image.attr("data-sizes") || _2.$slider.attr("data-sizes"); 49123 imageToLoad = document.createElement("img"); 49124 imageToLoad.onload = function() { 49125 if (imageSrcSet) { 49126 image.attr("srcset", imageSrcSet); 49127 if (imageSizes) { 49128 image.attr("sizes", imageSizes); 49129 } 49130 } 49131 image.attr("src", imageSource).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"); 49132 if (_2.options.adaptiveHeight === true) { 49133 _2.setPosition(); 49134 } 49135 _2.$slider.trigger("lazyLoaded", [_2, image, imageSource]); 49136 _2.progressiveLazyLoad(); 49137 }; 49138 imageToLoad.onerror = function() { 49139 if (tryCount < 3) { 49140 setTimeout(function() { 49141 _2.progressiveLazyLoad(tryCount + 1); 49142 }, 500); 49143 } else { 49144 image.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"); 49145 _2.$slider.trigger("lazyLoadError", [_2, image, imageSource]); 49146 _2.progressiveLazyLoad(); 49147 } 49148 }; 49149 imageToLoad.src = imageSource; 49150 } else { 49151 _2.$slider.trigger("allImagesLoaded", [_2]); 49152 } 49153 }; 49154 Slick.prototype.refresh = function(initializing) { 49155 var _2 = this, currentSlide, lastVisibleIndex; 49156 lastVisibleIndex = _2.slideCount - _2.options.slidesToShow; 49157 if (!_2.options.infinite && _2.currentSlide > lastVisibleIndex) { 49158 _2.currentSlide = lastVisibleIndex; 49159 } 49160 if (_2.slideCount <= _2.options.slidesToShow) { 49161 _2.currentSlide = 0; 49162 } 49163 currentSlide = _2.currentSlide; 49164 _2.destroy(true); 49165 $2.extend(_2, _2.initials, { currentSlide }); 49166 _2.init(); 49167 if (!initializing) { 49168 _2.changeSlide({ 49169 data: { 49170 message: "index", 49171 index: currentSlide 49172 } 49173 }, false); 49174 } 49175 }; 49176 Slick.prototype.registerBreakpoints = function() { 49177 var _2 = this, breakpoint, currentBreakpoint, l2, responsiveSettings = _2.options.responsive || null; 49178 if ($2.type(responsiveSettings) === "array" && responsiveSettings.length) { 49179 _2.respondTo = _2.options.respondTo || "window"; 49180 for (breakpoint in responsiveSettings) { 49181 l2 = _2.breakpoints.length - 1; 49182 if (responsiveSettings.hasOwnProperty(breakpoint)) { 49183 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 49184 while (l2 >= 0) { 49185 if (_2.breakpoints[l2] && _2.breakpoints[l2] === currentBreakpoint) { 49186 _2.breakpoints.splice(l2, 1); 49187 } 49188 l2--; 49189 } 49190 _2.breakpoints.push(currentBreakpoint); 49191 _2.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 49192 } 49193 } 49194 _2.breakpoints.sort(function(a2, b2) { 49195 return _2.options.mobileFirst ? a2 - b2 : b2 - a2; 49196 }); 49197 } 49198 }; 49199 Slick.prototype.reinit = function() { 49200 var _2 = this; 49201 _2.$slides = _2.$slideTrack.children(_2.options.slide).addClass("slick-slide"); 49202 _2.slideCount = _2.$slides.length; 49203 if (_2.currentSlide >= _2.slideCount && _2.currentSlide !== 0) { 49204 _2.currentSlide = _2.currentSlide - _2.options.slidesToScroll; 49205 } 49206 if (_2.slideCount <= _2.options.slidesToShow) { 49207 _2.currentSlide = 0; 49208 } 49209 _2.registerBreakpoints(); 49210 _2.setProps(); 49211 _2.setupInfinite(); 49212 _2.buildArrows(); 49213 _2.updateArrows(); 49214 _2.initArrowEvents(); 49215 _2.buildDots(); 49216 _2.updateDots(); 49217 _2.initDotEvents(); 49218 _2.cleanUpSlideEvents(); 49219 _2.initSlideEvents(); 49220 _2.checkResponsive(false, true); 49221 if (_2.options.focusOnSelect === true) { 49222 $2(_2.$slideTrack).children().on("click.slick", _2.selectHandler); 49223 } 49224 _2.setSlideClasses(typeof _2.currentSlide === "number" ? _2.currentSlide : 0); 49225 _2.setPosition(); 49226 _2.focusHandler(); 49227 _2.paused = !_2.options.autoplay; 49228 _2.autoPlay(); 49229 _2.$slider.trigger("reInit", [_2]); 49230 }; 49231 Slick.prototype.resize = function() { 49232 var _2 = this; 49233 if ($2(window).width() !== _2.windowWidth) { 49234 clearTimeout(_2.windowDelay); 49235 _2.windowDelay = window.setTimeout(function() { 49236 _2.windowWidth = $2(window).width(); 49237 _2.checkResponsive(); 49238 if (!_2.unslicked) { 49239 _2.setPosition(); 49240 } 49241 }, 50); 49242 } 49243 }; 49244 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index3, removeBefore, removeAll) { 49245 var _2 = this; 49246 if (typeof index3 === "boolean") { 49247 removeBefore = index3; 49248 index3 = removeBefore === true ? 0 : _2.slideCount - 1; 49249 } else { 49250 index3 = removeBefore === true ? --index3 : index3; 49251 } 49252 if (_2.slideCount < 1 || index3 < 0 || index3 > _2.slideCount - 1) { 49253 return false;
49254 } 49255 _2.unload(); 49256 if (removeAll === true) { 49257 _2.$slideTrack.children().remove(); 49258 } else { 49259 _2.$slideTrack.children(this.options.slide).eq(index3).remove(); 49260 } 49261 _2.$slides = _2.$slideTrack.children(this.options.slide); 49262 _2.$slideTrack.children(this.options.slide).detach(); 49263 _2.$slideTrack.append(_2.$slides); 49264 _2.$slidesCache = _2.$slides; 49265 _2.reinit(); 49266 }; 49267 Slick.prototype.setCSS = function(position) { 49268 var _2 = this, positionProps = {}, x2, y2; 49269 if (_2.options.rtl === true) { 49270 position = -position; 49271 } 49272 x2 = _2.positionProp == "left" ? Math.ceil(position) + "px" : "0px"; 49273 y2 = _2.positionProp == "top" ? Math.ceil(position) + "px" : "0px"; 49274 positionProps[_2.positionProp] = position; 49275 if (_2.transformsEnabled === false) { 49276 _2.$slideTrack.css(positionProps); 49277 } else { 49278 positionProps = {}; 49279 if (_2.cssTransitions === false) { 49280 positionProps[_2.animType] = "translate(" + x2 + ", " + y2 + ")"; 49281 _2.$slideTrack.css(positionProps); 49282 } else { 49283 positionProps[_2.animType] = "translate3d(" + x2 + ", " + y2 + ", 0px)"; 49284 _2.$slideTrack.css(positionProps); 49285 } 49286 } 49287 }; 49288 Slick.prototype.setDimensions = function() { 49289 var _2 = this; 49290 if (_2.options.vertical === false) { 49291 if (_2.options.centerMode === true) { 49292 _2.$list.css({ 49293 padding: "0px " + _2.options.centerPadding 49294 }); 49295 } 49296 } else { 49297 _2.$list.height(_2.$slides.first().outerHeight(true) * _2.options.slidesToShow); 49298 if (_2.options.centerMode === true) { 49299 _2.$list.css({ 49300 padding: _2.options.centerPadding + " 0px" 49301 }); 49302 } 49303 } 49304 _2.listWidth = _2.$list.width(); 49305 _2.listHeight = _2.$list.height(); 49306 if (_2.options.vertical === false && _2.options.variableWidth === false) { 49307 _2.slideWidth = Math.ceil(_2.listWidth / _2.options.slidesToShow); 49308 _2.$slideTrack.width(Math.ceil(_2.slideWidth * _2.$slideTrack.children(".slick-slide").length)); 49309 } else if (_2.options.variableWidth === true) { 49310 _2.$slideTrack.width(5e3 * _2.slideCount); 49311 } else { 49312 _2.slideWidth = Math.ceil(_2.listWidth); 49313 _2.$slideTrack.height(Math.ceil(_2.$slides.first().outerHeight(true) * _2.$slideTrack.children(".slick-slide").length)); 49314 } 49315 var offset = _2.$slides.first().outerWidth(true) - _2.$slides.first().width(); 49316 if (_2.options.variableWidth === false) _2.$slideTrack.children(".slick-slide").width(_2.slideWidth - offset); 49317 }; 49318 Slick.prototype.setFade = function() { 49319 var _2 = this, targetLeft; 49320 _2.$slides.each(function(index3, element) { 49321 targetLeft = _2.slideWidth * index3 * -1; 49322 if (_2.options.rtl === true) { 49323 $2(element).css({ 49324 position: "relative", 49325 right: targetLeft, 49326 top: 0, 49327 zIndex: _2.options.zIndex - 2, 49328 opacity: 0 49329 }); 49330 } else { 49331 $2(element).css({ 49332 position: "relative", 49333 left: targetLeft, 49334 top: 0, 49335 zIndex: _2.options.zIndex - 2, 49336 opacity: 0 49337 }); 49338 } 49339 }); 49340 _2.$slides.eq(_2.currentSlide).css({ 49341 zIndex: _2.options.zIndex - 1, 49342 opacity: 1 49343 }); 49344 }; 49345 Slick.prototype.setHeight = function() { 49346 var _2 = this; 49347 if (_2.options.slidesToShow === 1 && _2.options.adaptiveHeight === true && _2.options.vertical === false) { 49348 var targetHeight = _2.$slides.eq(_2.currentSlide).outerHeight(true); 49349 _2.$list.css("height", targetHeight); 49350 } 49351 }; 49352 Slick.prototype.setOption = Slick.prototype.slickSetOption = function() { 49353 var _2 = this, l2, item3, option, value, refresh = false, type; 49354 if ($2.type(arguments[0]) === "object") { 49355 option = arguments[0]; 49356 refresh = arguments[1]; 49357 type = "multiple"; 49358 } else if ($2.type(arguments[0]) === "string") { 49359 option = arguments[0]; 49360 value = arguments[1]; 49361 refresh = arguments[2]; 49362 if (arguments[0] === "responsive" && $2.type(arguments[1]) === "array") { 49363 type = "responsive"; 49364 } else if (typeof arguments[1] !== "undefined") { 49365 type = "single"; 49366 } 49367 } 49368 if (type === "single") { 49369 _2.options[option] = value; 49370 } else if (type === "multiple") { 49371 $2.each(option, function(opt, val) { 49372 _2.options[opt] = val; 49373 }); 49374 } else if (type === "responsive") { 49375 for (item3 in value) { 49376 if ($2.type(_2.options.responsive) !== "array") { 49377 _2.options.responsive = [value[item3]]; 49378 } else { 49379 l2 = _2.options.responsive.length - 1; 49380 while (l2 >= 0) { 49381 if (_2.options.responsive[l2].breakpoint === value[item3].breakpoint) { 49382 _2.options.responsive.splice(l2, 1); 49383 } 49384 l2--; 49385 } 49386 _2.options.responsive.push(value[item3]); 49387 } 49388 } 49389 } 49390 if (refresh) { 49391 _2.unload(); 49392 _2.reinit(); 49393 } 49394 }; 49395 Slick.prototype.setPosition = function() { 49396 var _2 = this; 49397 _2.setDimensions(); 49398 _2.setHeight(); 49399 if (_2.options.fade === false) { 49400 _2.setCSS(_2.getLeft(_2.currentSlide)); 49401 } else { 49402 _2.setFade(); 49403 } 49404 _2.$slider.trigger("setPosition", [_2]); 49405 }; 49406 Slick.prototype.setProps = function() { 49407 var _2 = this, bodyStyle = document.body.style; 49408 _2.positionProp = _2.options.vertical === true ? "top" : "left"; 49409 if (_2.positionProp === "top") { 49410 _2.$slider.addClass("slick-vertical"); 49411 } else { 49412 _2.$slider.removeClass("slick-vertical"); 49413 } 49414 if (bodyStyle.WebkitTransition !== void 0 || bodyStyle.MozTransition !== void 0 || bodyStyle.msTransition !== void 0) { 49415 if (_2.options.useCSS === true) { 49416 _2.cssTransitions = true; 49417 } 49418 } 49419 if (_2.options.fade) { 49420 if (typeof _2.options.zIndex === "number") { 49421 if (_2.options.zIndex < 3) { 49422 _2.options.zIndex = 3; 49423 } 49424 } else { 49425 _2.options.zIndex = _2.defaults.zIndex; 49426 } 49427 } 49428 if (bodyStyle.OTransform !== void 0) { 49429 _2.animType = "OTransform"; 49430 _2.transformType = "-o-transform"; 49431 _2.transitionType = "OTransition"; 49432 if (bodyStyle.perspectiveProperty === void 0 && bodyStyle.webkitPerspective === void 0) _2.animType = false;
49433 } 49434 if (bodyStyle.MozTransform !== void 0) { 49435 _2.animType = "MozTransform"; 49436 _2.transformType = "-moz-transform"; 49437 _2.transitionType = "MozTransition"; 49438 if (bodyStyle.perspectiveProperty === void 0 && bodyStyle.MozPerspective === void 0) _2.animType = false; 49439 } 49440 if (bodyStyle.webkitTransform !== void 0) { 49441 _2.animType = "webkitTransform"; 49442 _2.transformType = "-webkit-transform"; 49443 _2.transitionType = "webkitTransition"; 49444 if (bodyStyle.perspectiveProperty === void 0 && bodyStyle.webkitPerspective === void 0) _2.animType = false; 49445 } 49446 if (bodyStyle.msTransform !== void 0) { 49447 _2.animType = "msTransform"; 49448 _2.transformType = "-ms-transform"; 49449 _2.transitionType = "msTransition"; 49450 if (bodyStyle.msTransform === void 0) _2.animType = false; 49451 } 49452 if (bodyStyle.transform !== void 0 && _2.animType !== false) { 49453 _2.animType = "transform"; 49454 _2.transformType = "transform"; 49455 _2.transitionType = "transition"; 49456 } 49457 _2.transformsEnabled = _2.options.useTransform && (_2.animType !== null && _2.animType !== false); 49458 }; 49459 Slick.prototype.setSlideClasses = function(index3) { 49460 var _2 = this, centerOffset, allSlides, indexOffset, remainder; 49461 allSlides = _2.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden", "true"); 49462 _2.$slides.eq(index3).addClass("slick-current"); 49463 if (_2.options.centerMode === true) { 49464 var evenCoef = _2.options.slidesToShow % 2 === 0 ? 1 : 0; 49465 centerOffset = Math.floor(_2.options.slidesToShow / 2); 49466 if (_2.options.infinite === true) { 49467 if (index3 >= centerOffset && index3 <= _2.slideCount - 1 - centerOffset) { 49468 _2.$slides.slice(index3 - centerOffset + evenCoef, index3 + centerOffset + 1).addClass("slick-active").attr("aria-hidden", "false"); 49469 } else { 49470 indexOffset = _2.options.slidesToShow + index3; 49471 allSlides.slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2).addClass("slick-active").attr("aria-hidden", "false"); 49472 } 49473 if (index3 === 0) { 49474 allSlides.eq(_2.options.slidesToShow + _2.slideCount + 1).addClass("slick-center"); 49475 } else if (index3 === _2.slideCount - 1) { 49476 allSlides.eq(_2.options.slidesToShow).addClass("slick-center"); 49477 } 49478 } 49479 _2.$slides.eq(index3).addClass("slick-center"); 49480 } else { 49481 if (index3 >= 0 && index3 <= _2.slideCount - _2.options.slidesToShow) { 49482 _2.$slides.slice(index3, index3 + _2.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false"); 49483 } else if (allSlides.length <= _2.options.slidesToShow) { 49484 allSlides.addClass("slick-active").attr("aria-hidden", "false"); 49485 } else { 49486 remainder = _2.slideCount % _2.options.slidesToShow; 49487 indexOffset = _2.options.infinite === true ? _2.options.slidesToShow + index3 : index3; 49488 if (_2.options.slidesToShow == _2.options.slidesToScroll && _2.slideCount - index3 < _2.options.slidesToShow) { 49489 allSlides.slice(indexOffset - (_2.options.slidesToShow - remainder), indexOffset + remainder).addClass("slick-active").attr("aria-hidden", "false"); 49490 } else { 49491 allSlides.slice(indexOffset, indexOffset + _2.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false"); 49492 } 49493 } 49494 } 49495 if (_2.options.lazyLoad === "ondemand" || _2.options.lazyLoad === "anticipated") { 49496 _2.lazyLoad(); 49497 } 49498 }; 49499 Slick.prototype.setupInfinite = function() { 49500 var _2 = this, i2, slideIndex, infiniteCount; 49501 if (_2.options.fade === true) { 49502 _2.options.centerMode = false; 49503 } 49504 if (_2.options.infinite === true && _2.options.fade === false) { 49505 slideIndex = null; 49506 if (_2.slideCount > _2.options.slidesToShow) { 49507 if (_2.options.centerMode === true) { 49508 infiniteCount = _2.options.slidesToShow + 1; 49509 } else { 49510 infiniteCount = _2.options.slidesToShow; 49511 } 49512 for (i2 = _2.slideCount; i2 > _2.slideCount - infiniteCount; i2 -= 1) { 49513 slideIndex = i2 - 1; 49514 $2(_2.$slides[slideIndex]).clone(true).attr("id", "").attr("data-slick-index", slideIndex - _2.slideCount).prependTo(_2.$slideTrack).addClass("slick-cloned"); 49515 } 49516 for (i2 = 0; i2 < infiniteCount + _2.slideCount; i2 += 1) { 49517 slideIndex = i2; 49518 $2(_2.$slides[slideIndex]).clone(true).attr("id", "").attr("data-slick-index", slideIndex + _2.slideCount).appendTo(_2.$slideTrack).addClass("slick-cloned"); 49519 } 49520 _2.$slideTrack.find(".slick-cloned").find("[id]").each(function() { 49521 $2(this).attr("id", ""); 49522 }); 49523 } 49524 } 49525 }; 49526 Slick.prototype.interrupt = function(toggle) { 49527 var _2 = this; 49528 if (!toggle) { 49529 _2.autoPlay(); 49530 } 49531 _2.interrupted = toggle; 49532 }; 49533 Slick.prototype.selectHandler = function(event) { 49534 var _2 = this; 49535 var targetElement = $2(event.target).is(".slick-slide") ? $2(event.target) : $2(event.target).parents(".slick-slide"); 49536 var index3 = parseInt(targetElement.attr("data-slick-index")); 49537 if (!index3) index3 = 0; 49538 if (_2.slideCount <= _2.options.slidesToShow) { 49539 _2.slideHandler(index3, false, true); 49540 return; 49541 } 49542 _2.slideHandler(index3); 49543 }; 49544 Slick.prototype.slideHandler = function(index3, sync, dontAnimate) { 49545 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, _2 = this, navTarget; 49546 sync = sync || false; 49547 if (_2.animating === true && _2.options.waitForAnimate === true) { 49548 return; 49549 } 49550 if (_2.options.fade === true && _2.currentSlide === index3) { 49551 return; 49552 } 49553 if (sync === false) { 49554 _2.asNavFor(index3); 49555 } 49556 targetSlide = index3; 49557 targetLeft = _2.getLeft(targetSlide); 49558 slideLeft = _2.getLeft(_2.currentSlide); 49559 _2.currentLeft = _2.swipeLeft === null ? slideLeft : _2.swipeLeft; 49560 if (_2.options.infinite === false && _2.options.centerMode === false && (index3 < 0 || index3 > _2.getDotCount() * _2.options.slidesToScroll)) { 49561 if (_2.options.fade === false) { 49562 targetSlide = _2.currentSlide; 49563 if (dontAnimate !== true && _2.slideCount > _2.options.slidesToShow) { 49564 _2.animateSlide(slideLeft, function() { 49565 _2.postSlide(targetSlide); 49566 }); 49567 } else { 49568 _2.postSlide(targetSlide); 49569 } 49570 } 49571 return; 49572 } else if (_2.options.infinite === false && _2.options.centerMode === true && (index3 < 0 || index3 > _2.slideCount - _2.options.slidesToScroll)) { 49573 if (_2.options.fade === false) { 49574 targetSlide = _2.currentSlide; 49575 if (dontAnimate !== true && _2.slideCount > _2.options.slidesToShow) { 49576 _2.animateSlide(slideLeft, function() { 49577 _2.postSlide(targetSlide); 49578 }); 49579 } else { 49580 _2.postSlide(targetSlide); 49581 } 49582 } 49583 return; 49584 } 49585 if (_2.options.autoplay) { 49586 clearInterval(_2.autoPlayTimer); 49587 }
49588 if (targetSlide < 0) { 49589 if (_2.slideCount % _2.options.slidesToScroll !== 0) { 49590 animSlide = _2.slideCount - _2.slideCount % _2.options.slidesToScroll; 49591 } else { 49592 animSlide = _2.slideCount + targetSlide; 49593 } 49594 } else if (targetSlide >= _2.slideCount) { 49595 if (_2.slideCount % _2.options.slidesToScroll !== 0) { 49596 animSlide = 0; 49597 } else { 49598 animSlide = targetSlide - _2.slideCount; 49599 } 49600 } else { 49601 animSlide = targetSlide; 49602 } 49603 _2.animating = true; 49604 _2.$slider.trigger("beforeChange", [_2, _2.currentSlide, animSlide]); 49605 oldSlide = _2.currentSlide; 49606 _2.currentSlide = animSlide; 49607 _2.setSlideClasses(_2.currentSlide); 49608 if (_2.options.asNavFor) { 49609 navTarget = _2.getNavTarget(); 49610 navTarget = navTarget.slick("getSlick"); 49611 if (navTarget.slideCount <= navTarget.options.slidesToShow) { 49612 navTarget.setSlideClasses(_2.currentSlide); 49613 } 49614 } 49615 _2.updateDots(); 49616 _2.updateArrows(); 49617 if (_2.options.fade === true) { 49618 if (dontAnimate !== true) { 49619 _2.fadeSlideOut(oldSlide); 49620 _2.fadeSlide(animSlide, function() { 49621 _2.postSlide(animSlide); 49622 }); 49623 } else { 49624 _2.postSlide(animSlide); 49625 } 49626 _2.animateHeight(); 49627 return; 49628 } 49629 if (dontAnimate !== true && _2.slideCount > _2.options.slidesToShow) { 49630 _2.animateSlide(targetLeft, function() { 49631 _2.postSlide(animSlide); 49632 }); 49633 } else { 49634 _2.postSlide(animSlide); 49635 } 49636 }; 49637 Slick.prototype.startLoad = function() { 49638 var _2 = this; 49639 if (_2.options.arrows === true && _2.slideCount > _2.options.slidesToShow) { 49640 _2.$prevArrow.hide(); 49641 _2.$nextArrow.hide(); 49642 } 49643 if (_2.options.dots === true && _2.slideCount > _2.options.slidesToShow) { 49644 _2.$dots.hide(); 49645 } 49646 _2.$slider.addClass("slick-loading"); 49647 }; 49648 Slick.prototype.swipeDirection = function() { 49649 var xDist, yDist, r2, swipeAngle, _2 = this; 49650 xDist = _2.touchObject.startX - _2.touchObject.curX; 49651 yDist = _2.touchObject.startY - _2.touchObject.curY; 49652 r2 = Math.atan2(yDist, xDist); 49653 swipeAngle = Math.round(r2 * 180 / Math.PI); 49654 if (swipeAngle < 0) { 49655 swipeAngle = 360 - Math.abs(swipeAngle); 49656 } 49657 if (swipeAngle <= 45 && swipeAngle >= 0) { 49658 return _2.options.rtl === false ? "left" : "right"; 49659 } 49660 if (swipeAngle <= 360 && swipeAngle >= 315) { 49661 return _2.options.rtl === false ? "left" : "right"; 49662 } 49663 if (swipeAngle >= 135 && swipeAngle <= 225) { 49664 return _2.options.rtl === false ? "right" : "left"; 49665 } 49666 if (_2.options.verticalSwiping === true) { 49667 if (swipeAngle >= 35 && swipeAngle <= 135) { 49668 return "down"; 49669 } else { 49670 return "up"; 49671 } 49672 } 49673 return "vertical"; 49674 }; 49675 Slick.prototype.swipeEnd = function(event) { 49676 var _2 = this, slideCount, direction; 49677 _2.dragging = false; 49678 _2.swiping = false; 49679 if (_2.scrolling) { 49680 _2.scrolling = false; 49681 return false; 49682 } 49683 _2.interrupted = false; 49684 _2.shouldClick = _2.touchObject.swipeLength > 10 ? false : true; 49685 if (_2.touchObject.curX === void 0) { 49686 return false; 49687 } 49688 if (_2.touchObject.edgeHit === true) { 49689 _2.$slider.trigger("edge", [_2, _2.swipeDirection()]); 49690 } 49691 if (_2.touchObject.swipeLength >= _2.touchObject.minSwipe) { 49692 direction = _2.swipeDirection(); 49693 switch (direction) { 49694 case "left": 49695 case "down": 49696 slideCount = _2.options.swipeToSlide ? _2.checkNavigable(_2.currentSlide + _2.getSlideCount()) : _2.currentSlide + _2.getSlideCount(); 49697 _2.currentDirection = 0; 49698 break; 49699 case "right": 49700 case "up": 49701 slideCount = _2.options.swipeToSlide ? _2.checkNavigable(_2.currentSlide - _2.getSlideCount()) : _2.currentSlide - _2.getSlideCount(); 49702 _2.currentDirection = 1; 49703 break; 49704 } 49705 if (direction != "vertical") { 49706 _2.slideHandler(slideCount); 49707 _2.touchObject = {}; 49708 _2.$slider.trigger("swipe", [_2, direction]); 49709 } 49710 } else { 49711 if (_2.touchObject.startX !== _2.touchObject.curX) { 49712 _2.slideHandler(_2.currentSlide); 49713 _2.touchObject = {}; 49714 } 49715 } 49716 }; 49717 Slick.prototype.swipeHandler = function(event) { 49718 var _2 = this; 49719 if (_2.options.swipe === false || "ontouchend" in document && _2.options.swipe === false) { 49720 return; 49721 } else if (_2.options.draggable === false && event.type.indexOf("mou
49721se") !== -1) { 49722 return; 49723 } 49724 _2.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== void 0 ? event.originalEvent.touches.length : 1; 49725 _2.touchObject.minSwipe = _2.listWidth / _2.options.touchThreshold; 49726 if (_2.options.verticalSwiping === true) { 49727 _2.touchObject.minSwipe = _2.listHeight / _2.options.touchThreshold; 49728 } 49729 switch (event.data.action) { 49730 case "start": 49731 _2.swipeStart(event); 49732 break; 49733 case "move": 49734 _2.swipeMove(event); 49735 break; 49736 case "end": 49737 _2.swipeEnd(event); 49738 break; 49739 } 49740 }; 49741 Slick.prototype.swipeMove = function(event) { 49742 var _2 = this, curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 49743 touches = event.originalEvent !== void 0 ? event.originalEvent.touches : null; 49744 if (!_2.dragging || _2.scrolling || touches && touches.length !== 1) { 49745 return false; 49746 } 49747 curLeft = _2.getLeft(_2.currentSlide); 49748 _2.touchObject.curX = touches !== void 0 ? touches[0].pageX : event.clientX; 49749 _2.touchObject.curY = touches !== void 0 ? touches[0].pageY : event.clientY; 49750 _2.touchObject.swipeLength = Math.round(Math.sqrt( 49751 Math.pow(_2.touchObject.curX - _2.touchObject.startX, 2) 49752 )); 49753 verticalSwipeLength = Math.round(Math.sqrt( 49754 Math.pow(_2.touchObject.curY - _2.touchObject.startY, 2) 49755 )); 49756 if (!_2.options.verticalSwiping && !_2.swiping && verticalSwipeLength > 4) { 49757 _2.scrolling = true; 49758 return false; 49759 } 49760 if (_2.options.verticalSwiping === true) { 49761 _2.touchObject.swipeLength = verticalSwipeLength; 49762 } 49763 swipeDirection = _2.swipeDirection(); 49764 if (event.originalEvent !== void 0 && _2.touchObject.swipeLength > 4) { 49765 _2.swiping = true; 49766 event.preventDefault(); 49767 } 49768 positionOffset = (_2.options.rtl === false ? 1 : -1) * (_2.touchObject.curX > _2.touchObject.startX ? 1 : -1); 49769 if (_2.options.verticalSwiping === true) { 49770 positionOffset = _2.touchObject.curY > _2.touchObject.startY ? 1 : -1; 49771 } 49772 swipeLength = _2.touchObject.swipeLength; 49773 _2.touchObject.edgeHit = false; 49774 if (_2.options.infinite === false) { 49775 if (_2.currentSlide === 0 && swipeDirection === "right" || _2.currentSlide >= _2.getDotCount() && swipeDirection === "left") { 49776 swipeLength = _2.touchObject.swipeLength * _2.options.edgeFriction; 49777 _2.touchObject.edgeHit = true; 49778 } 49779 } 49780 if (_2.options.vertical === false) { 49781 _2.swipeLeft = curLeft + swipeLength * positionOffset; 49782 } else { 49783 _2.swipeLeft = curLeft + swipeLength * (_2.$list.height() / _2.listWidth) * positionOffset; 49784 } 49785 if (_2.options.verticalSwiping === true) { 49786 _2.swipeLeft = curLeft + swipeLength * positionOffset; 49787 } 49788 if (_2.options.fade === true || _2.options.touchMove === false) { 49789 return false; 49790 } 49791 if (_2.animating === true) { 49792 _2.swipeLeft = null; 49793 return false; 49794 } 49795 _2.setCSS(_2.swipeLeft); 49796 }; 49797 Slick.prototype.swipeStart = function(event) { 49798 var _2 = this, touches; 49799 _2.interrupted = true; 49800 if (_2.touchObject.fingerCount !== 1 || _2.slideCount <= _2.options.slidesToShow) { 49801 _2.touchObject = {}; 49802 return false; 49803 } 49804 if (event.originalEvent !== void 0 && event.originalEvent.touches !== void 0) { 49805 touches = event.originalEvent.touches[0]; 49806 } 49807 _2.touchObject.startX = _2.touchObject.curX = touches !== void 0 ? touches.pageX : event.clientX; 49808 _2.touchObject.startY = _2.touchObject.curY = touches !== void 0 ? touches.pageY : event.clientY; 49809 _2.dragging = true; 49810 }; 49811 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 49812 var _2 = this; 49813 if (_2.$slidesCache !== null) { 49814 _2.unload(); 49815 _2.$slideTrack.children(this.options.slide).detach(); 49816 _2.$slidesCache.appendTo(_2.$slideTrack); 49817 _2.reinit(); 49818 } 49819 }; 49820 Slick.prototype.unload = function() { 49821 var _2 = this; 49822 $2(".slick-cloned", _2.$slider).remove(); 49823 if (_2.$dots) { 49824 _2.$dots.remove(); 49825 } 49826 if (_2.$prevArrow && _2.htmlExpr.test(_2.options.prevArrow)) { 49827 _2.$prevArrow.remove(); 49828 } 49829 if (_2.$nextArrow && _2.htmlExpr.test(_2.options.nextArrow)) { 49830 _2.$nextArrow.remove(); 49831 } 49832 _2.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden", "true").css("width", ""); 49833 };
49834 Slick.prototype.unslick = function(fromBreakpoint) { 49835 var _2 = this; 49836 _2.$slider.trigger("unslick", [_2, fromBreakpoint]); 49837 _2.destroy(); 49838 }; 49839 Slick.prototype.updateArrows = function() { 49840 var _2 = this; 49841 Math.floor(_2.options.slidesToShow / 2); 49842 if (_2.options.arrows === true && _2.slideCount > _2.options.slidesToShow && !_2.options.infinite) { 49843 _2.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); 49844 _2.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); 49845 if (_2.currentSlide === 0) { 49846 _2.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"); 49847 _2.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); 49848 } else if (_2.currentSlide >= _2.slideCount - _2.options.slidesToShow && _2.options.centerMode === false) { 49849 _2.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"); 49850 _2.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); 49851 } else if (_2.currentSlide >= _2.slideCount - 1 && _2.options.centerMode === true) { 49852 _2.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"); 49853 _2.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); 49854 } 49855 } 49856 }; 49857 Slick.prototype.updateDots = function() { 49858 var _2 = this; 49859 if (_2.$dots !== null) { 49860 _2.$dots.find("li").removeClass("slick-active").end(); 49861 _2.$dots.find("li").eq(Math.floor(_2.currentSlide / _2.options.slidesToScroll)).addClass("slick-active"); 49862 } 49863 }; 49864 Slick.prototype.visibility = function() { 49865 var _2 = this; 49866 if (_2.options.autoplay) { 49867 if (document[_2.hidden]) { 49868 _2.interrupted = true; 49869 } else { 49870 _2.interrupted = false; 49871 } 49872 } 49873 }; 49874 $2.fn.slick = function() { 49875 var _2 = this, opt = arguments[0], args = Array.prototype.slice.call(arguments, 1), l2 = _2.length, i2, ret; 49876 for (i2 = 0; i2 < l2; i2++) { 49877 if (typeof opt == "object" || typeof opt == "undefined") { 49878 _2[i2].slick = new Slick(_2[i2], opt); 49879 } else { 49880 ret = _2[i2].slick[opt].apply(_2[i2].slick, args); 49881 } 49882 if (typeof ret != "undefined") return ret; 49883 } 49884 return _2; 49885 }; 49886})($$2); 49887$$2(document).ready(function($2) { 49888 window.slickReady = true; 49889}); 49890async function check_login_state() { 49891 const auth_status = await fetch_auth_status(); 49892 set_membership_status(auth_status); 49893 const domains_match = get_domain(window.location.origin) == get_domain(SESSION_DATA.auth_site); 49894 if (auth_status == null && !domains_match) { 49895 console.error( 49896 `Auth status can not be fetched unless the domain matches the auth server. Please visit /login to refresh auth status.` 49897 ); 49898 return; 49899 } else if (login_state_in_sync(auth_status)) { 49900 clear_recent_sync_attempts(); 49901 if (auth_status.i) { 49902 show_impersonation_notice(); 49903 } 49904 return; 49905 } 49906 if (get_recent_sync_attempts() > MAX_SYNC_ATTEMPTS) { 49907 console.warn( 49908 "Too many attempts to sync with the St. Paul Center auth server login state have been made recently. Auto sync has been temporarily disabled." 49909 ); 49910 return; 49911 } 49912 increment_sync_attempts(); 49913 sign_in_or_out(auth_status); 49914} 49915const DEV_AUTH_STATUS = null; 49916async function fetch_auth_status() { 49917 let status = get_auth_status_cookie(); 49918 if (!status) { 49919 if (SESSION_DATA.environment == "dev") return DEV_AUTH_STATUS; 49920 const response = await fetch(`${SESSION_DATA.auth_site}/api/v1/s`, { 49921 credentials: "include" 49922 }); 49923 status = await response.json(); 49924 } 49925 return status; 49926} 49927function set_membership_status(auth_status) { 49928 dataLayer.push({ 49929 event: "membership_status_set", 49930 user_membership_status: (auth_status == null ? void 0 : auth_status.m) ?? "non_member", 49931 user_membership_expiring: (auth_status == null ? void 0 : auth_status.x) ?? false 49932 }); 49933} 49934function login_state_in_sync(auth_status) { 49935 const currently_signed_in = SESSION_DATA.is_logged_in; 49936 if (auth_status.s && currently_signed_in && auth_status.e == SESSION_DATA.current_user_email) { 49937 return true; 49938 } 49939 if (!auth_status.s && !currently_signed_in) { 49940 return true; 49941 } 49942 return false;
49943} 49944const DEFAULT_SYNC_ATTEMPT_DATA = { 49945 attempts: 0, 49946 last_attempt_at: 0 49947}; 49948function get_sync_attempts() { 49949 return JSON.parse(sessionStorage.getItem("spc-login-sync")) || DEFAULT_SYNC_ATTEMPT_DATA; 49950} 49951function get_recent_sync_attempts() { 49952 const sync_attempt = get_sync_attempts(); 49953 const two_minutes_ago = Date.now() - 2 * 60 * 1e3; 49954 return sync_attempt.last_attempt_at < two_minutes_ago ? 0 : sync_attempt.attempts; 49955} 49956function increment_sync_attempts() { 49957 const recent_attempts = get_recent_sync_attempts(); 49958 sessionStorage.setItem( 49959 "spc-login-sync", 49960 JSON.stringify({ 49961 attempts: recent_attempts + 1, 49962 last_attempt_at: Date.now() 49963 }) 49964 ); 49965} 49966function clear_recent_sync_attempts() { 49967 sessionStorage.removeItem("spc-login-sync"); 49968} 49969const get_cookie = (key2) => { 49970 const cookieRegex = new RegExp(`(^| )${key2}=([^;]+)`); 49971 const match = document.cookie.match(cookieRegex); 49972 return match ? parse_cookie(match[2]) : null; 49973}; 49974const parse_cookie = (value) => { 49975 if (value == null) { 49976 return null; 49977 } 49978 value = decodeURIComponent(value); 49979 try { 49980 value = JSON.parse(value); 49981 } catch (ignored) { 49982 } 49983 return value; 49984}; 49985function get_auth_status_cookie() { 49986 return get_cookie(SESSION_DATA.environment == "staging" ? "spcsas" : "spcas"); 49987} 49988function sign_in_or_out(auth_status) { 49989 const currently_signed_in = SESSION_DATA.is_logged_in; 49990 document.documentElement.style.display = "none"; 49991 if (auth_status.s && (!currently_signed_in || auth_status.e != SESSION_DATA.current_user_email)) { 49992 window.location.href = "/login"; 49993 } else if (!auth_status.s && currently_signed_in) { 49994 window.location.href = "/logout"; 49995 } 49996} 49997const get_domain = (url) => new URL(url).hostname.split(".").slice(-2).join("."); 49998function show_impersonation_notice() { 49999 const impersonationSpacer = document.querySelector(".impersonation-spacer"); 50000 impersonationSpacer.classList.add("visible"); 50001 const impersonationBar = document.querySelector(".impersonation-bar"); 50002 impersonationBar.classList.add("visible"); 50003 impersonationBar.querySelector(".impersonation-stop").addEventListener("click", stop_impersonating); 50004} 50005async function stop_impersonating() { 50006 const response = await fetch( 50007 `${SESSION_DATA.auth_site}/api/v1/users/stop_impersonating`, 50008 { 50009 method: "DELETE", 50010 credentials: "include" 50011 } 50012 ); 50013 if (response.ok) { 50014 window.location.reload(); 50015 } 50016} 50017function update_become_member_cta_visibility(auth_status) { 50018 const membershipStatus = (auth_status == null ? void 0 : auth_status.m) ?? "non_member"; 50019 const isNonMember = membershipStatus === "non_member"; 50020 document.querySelectorAll('a[href="/memberships"], a[href="/memberships/options"]').forEach((el) => { 50021 el.style.display = isNonMember ? "" : "none"; 50022 }); 50023} 50024document.addEventListener("turbo:load", async () => { 50025 const auth_status = await fetch_auth_status(); 50026 update_become_member_cta_visibility(auth_status); 50027}); 50028const MAX_SYNC_ATTEMPTS = 8; 50029check_login_state(); 50030class EventListener { 50031 constructor(eventTarget, eventName, eventOptions) { 50032 this.eventTarget = eventTarget; 50033 this.eventName = eventName; 50034 this.eventOptions = eventOptions; 50035 this.unorderedBindings = /* @__PURE__ */ new Set(); 50036 } 50037 connect() { 50038 this.eventTarget.addEventListener(this.eventName, this, this.eventOptions); 50039 } 50040 disconnect() { 50041 this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions); 50042 } 50043 bindingConnected(binding) { 50044 this.unorderedBindings.add(binding); 50045 } 50046 bindingDisconnected(binding) { 50047 this.unorderedBindings.delete(binding); 50048 } 50049 handleEvent(event) { 50050 const extendedEvent = extendEvent(event); 50051 for (const binding of this.bindings) { 50052 if (extendedEvent.immediatePropagationStopped) { 50053 break; 50054 } else { 50055 binding.handleEvent(extendedEvent); 50056 } 50057 } 50058 } 50059 hasBindings() { 50060 return this.unorderedBindings.size > 0; 50061 } 50062 get bindings() { 50063 return Array.from(this.unorderedBindings).sort((left, right) => { 50064 const leftIndex = left.index, rightIndex = right.index; 50065 return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0; 50066 }); 50067 } 50068} 50069function extendEvent(event) { 50070 if ("immediatePropagationStopped" in event) { 50071 return event; 50072 } else { 50073 const { stopImmediatePropagation } = event; 50074 return Object.assign(event, { 50075 immediatePropagationStopped: false, 50076 stopImmediatePropagation() { 50077 this.immediatePropagationStopped = true; 50078 stopImmediatePropagation.call(this); 50079 } 50080 }); 50081 } 50082} 50083class Dispatcher { 50084 constructor(application) { 50085 this.application = application; 50086 this.eventListenerMaps = /* @__PURE__ */ new Map(); 50087 this.started = false;
vendor: 75,385 bytes, lines 50088-52369
50088 } 50089 start() { 50090 if (!this.started) { 50091 this.started = true; 50092 this.eventListeners.forEach((eventListener) => eventListener.connect()); 50093 } 50094 } 50095 stop() { 50096 if (this.started) { 50097 this.started = false; 50098 this.eventListeners.forEach((eventListener) => eventListener.disconnect()); 50099 } 50100 } 50101 get eventListeners() { 50102 return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []); 50103 } 50104 bindingConnected(binding) { 50105 this.fetchEventListenerForBinding(binding).bindingConnected(binding); 50106 } 50107 bindingDisconnected(binding, clearEventListeners = false) { 50108 this.fetchEventListenerForBinding(binding).bindingDisconnected(binding); 50109 if (clearEventListeners) 50110 this.clearEventListenersForBinding(binding); 50111 } 50112 handleError(error2, message, detail = {}) { 50113 this.application.handleError(error2, `Error ${message}`, detail); 50114 } 50115 clearEventListenersForBinding(binding) { 50116 const eventListener = this.fetchEventListenerForBinding(binding); 50117 if (!eventListener.hasBindings()) { 50118 eventListener.disconnect(); 50119 this.removeMappedEventListenerFor(binding); 50120 } 50121 } 50122 removeMappedEventListenerFor(binding) { 50123 const { eventTarget, eventName, eventOptions } = binding; 50124 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 50125 const cacheKey = this.cacheKey(eventName, eventOptions); 50126 eventListenerMap.delete(cacheKey); 50127 if (eventListenerMap.size == 0) 50128 this.eventListenerMaps.delete(eventTarget); 50129 } 50130 fetchEventListenerForBinding(binding) { 50131 const { eventTarget, eventName, eventOptions } = binding; 50132 return this.fetchEventListener(eventTarget, eventName, eventOptions); 50133 } 50134 fetchEventListener(eventTarget, eventName, eventOptions) { 50135 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 50136 const cacheKey = this.cacheKey(eventName, eventOptions); 50137 let eventListener = eventListenerMap.get(cacheKey); 50138 if (!eventListener) { 50139 eventListener = this.createEventListener(eventTarget, eventName, eventOptions); 50140 eventListenerMap.set(cacheKey, eventListener); 50141 } 50142 return eventListener; 50143 } 50144 createEventListener(eventTarget, eventName, eventOptions) { 50145 const eventListener = new EventListener(eventTarget, eventName, eventOptions); 50146 if (this.started) { 50147 eventListener.connect(); 50148 } 50149 return eventListener; 50150 } 50151 fetchEventListenerMapForEventTarget(eventTarget) { 50152 let eventListenerMap = this.eventListenerMaps.get(eventTarget); 50153 if (!eventListenerMap) { 50154 eventListenerMap = /* @__PURE__ */ new Map(); 50155 this.eventListenerMaps.set(eventTarget, eventListenerMap); 50156 } 50157 return eventListenerMap; 50158 } 50159 cacheKey(eventName, eventOptions) { 50160 const parts = [eventName]; 50161 Object.keys(eventOptions).sort().forEach((key2) => { 50162 parts.push(`${eventOptions[key2] ? "" : "!"}${key2}`); 50163 }); 50164 return parts.join(":"); 50165 } 50166} 50167const defaultActionDescriptorFilters = { 50168 stop({ event, value }) { 50169 if (value) 50170 event.stopPropagation(); 50171 return true; 50172 }, 50173 prevent({ event, value }) { 50174 if (value) 50175 event.preventDefault(); 50176 return true; 50177 }, 50178 self({ event, value, element }) { 50179 if (value) { 50180 return element === event.target; 50181 } else { 50182 return true; 50183 } 50184 } 50185}; 50186const descriptorPattern = /^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/; 50187function parseActionDescriptorString(descriptorString) { 50188 const source = descriptorString.trim(); 50189 const matches = source.match(descriptorPattern) || []; 50190 let eventName = matches[2]; 50191 let keyFilter = matches[3]; 50192 if (keyFilter && !["keydown", "keyup", "keypress"].includes(eventName)) { 50193 eventName += `.${keyFilter}`; 50194 keyFilter = ""; 50195 } 50196 return { 50197 eventTarget: parseEventTarget(matches[4]), 50198 eventName, 50199 eventOptions: matches[7] ? parseEventOptions(matches[7]) : {}, 50200 identifier: matches[5], 50201 methodName: matches[6], 50202 keyFilter: matches[1] || keyFilter 50203 }; 50204} 50205function parseEventTarget(eventTargetName) { 50206 if (eventTargetName == "window") { 50207 return window; 50208 } else if (eventTargetName == "document") { 50209 return document; 50210 } 50211} 50212function parseEventOptions(eventOptions) { 50213 return eventOptions.split(":").reduce((options, token) => Object.assign(options, { [token.replace(/^!/, "")]: !/^!/.test(token) }), {}); 50214} 50215function stringifyEventTarget(eventTarget) { 50216 if (eventTarget == window) { 50217 return "window"; 50218 } else if (eventTarget == document) { 50219 return "document"; 50220 } 50221} 50222function camelize(value) { 50223 return value.replace(/(?:[_-])([a-z0-9])/g, (_2, char) => char.toUpperCase()); 50224} 50225function namespaceCamelize(value) { 50226 return camelize(value.replace(/--/g, "-").replace(/__/g, "_")); 50227} 50228function capitalize(value) { 50229 return value.charAt(0).toUpperCase() + value.slice(1); 50230} 50231function dasherize(value) { 50232 return value.replace(/([A-Z])/g, (_2, char) => `-${char.toLowerCase()}`); 50233} 50234function tokenize(value) { 50235 return value.match(/[^\s]+/g) || []; 50236} 50237function isSomething(object) { 50238 return object !== null && object !== void 0; 50239} 50240function hasProperty(object, property) { 50241 return Object.prototype.hasOwnProperty.call(object, property); 50242} 50243const allModifiers = ["meta", "ctrl", "alt", "shift"]; 50244class Action { 50245 constructor(element, index3, descriptor, schema) { 50246 this.element = element; 50247 this.index = index3; 50248 this.eventTarget = descriptor.eventTarget || element; 50249 this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error("missing event name"); 50250 this.eventOptions = descriptor.eventOptions || {}; 50251 this.identifier = descriptor.identifier || error("missing identifier"); 50252 this.methodName = descriptor.methodName || error("missing method name"); 50253 this.keyFilter = descriptor.keyFilter || ""; 50254 this.schema = schema; 50255 } 50256 static forToken(token, schema) { 50257 return new this(token.element, token.index, parseActionDescriptorString(token.content), schema); 50258 } 50259 toString() { 50260 const eventFilter = this.keyFilter ? `.${this.keyFilter}` : ""; 50261 const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : ""; 50262 return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`; 50263 } 50264 shouldIgnoreKeyboardEvent(event) { 50265 if (!this.keyFilter) { 50266 return false; 50267 } 50268 const filters = this.keyFilter.split("+"); 50269 if (this.keyFilterDissatisfied(event, filters)) { 50270 return true; 50271 } 50272 const standardFilter = filters.filter((key2) => !allModifiers.includes(key2))[0]; 50273 if (!standardFilter) { 50274 return false; 50275 } 50276 if (!hasProperty(this.keyMappings, standardFilter)) { 50277 error(`contains unknown key filter: ${this.keyFilter}`); 50278 } 50279 return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase(); 50280 } 50281 shouldIgnoreMouseEvent(event) { 50282 if (!this.keyFilter) { 50283 return false; 50284 } 50285 const filters = [this.keyFilter]; 50286 if (this.keyFilterDissatisfied(event, filters)) { 50287 return true; 50288 } 50289 return false; 50290 } 50291 get params() { 50292 const params = {}; 50293 const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, "i"); 50294 for (const { name, value } of Array.from(this.element.attributes)) { 50295 const match = name.match(pattern); 50296 const key2 = match && match[1]; 50297 if (key2) { 50298 params[camelize(key2)] = typecast(value); 50299 } 50300 } 50301 return params; 50302 } 50303 get eventTargetName() { 50304 return stringifyEventTarget(this.eventTarget); 50305 } 50306 get keyMappings() { 50307 return this.schema.keyMappings; 50308 } 50309 keyFilterDissatisfied(event, filters) { 50310 const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier)); 50311 return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift; 50312 } 50313} 50314const defaultEventNames = { 50315 a: () => "click", 50316 button: () => "click", 50317 form: () => "submit", 50318 details: () => "toggle", 50319 input: (e2) => e2.getAttribute("type") == "submit" ? "click" : "input", 50320 select: () => "change", 50321 textarea: () => "input" 50322}; 50323function getDefaultEventNameForElement(element) { 50324 const tagName = element.tagName.toLowerCase(); 50325 if (tagName in defaultEventNames) { 50326 return defaultEventNames[tagName](element); 50327 } 50328} 50329function error(message) { 50330 throw new Error(message); 50331} 50332function typecast(value) { 50333 try { 50334 return JSON.parse(value); 50335 } catch (o_O) { 50336 return value; 50337 } 50338} 50339class Binding { 50340 constructor(context3, action) { 50341 this.context = context3; 50342 this.action = action; 50343 } 50344 get index() { 50345 return this.action.index; 50346 } 50347 get eventTarget() { 50348 return this.action.eventTarget; 50349 } 50350 get eventOptions() { 50351 return this.action.eventOptions; 50352 } 50353 get identifier() { 50354 return this.context.identifier; 50355 } 50356 handleEvent(event) { 50357 const actionEvent = this.prepareActionEvent(event); 50358 if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) { 50359 this.invokeWithEvent(actionEvent); 50360 } 50361 } 50362 get eventName() { 50363 return this.action.eventName; 50364 } 50365 get method() { 50366 const method = this.controller[this.methodName]; 50367 if (typeof method == "function") { 50368 return method; 50369 } 50370 throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`); 50371 } 50372 applyEventModifiers(event) { 50373 const { element } = this.action; 50374 const { actionDescriptorFilters } = this.context.application; 50375 const { controller } = this.context; 50376 let passes = true; 50377 for (const [name, value] of Object.entries(this.eventOptions)) { 50378 if (name in actionDescriptorFilters) { 50379 const filter = actionDescriptorFilters[name]; 50380 passes = passes && filter({ name, value, event, element, controller }); 50381 } else { 50382 continue; 50383 } 50384 } 50385 return passes; 50386 } 50387 prepareActionEvent(event) { 50388 return Object.assign(event, { params: this.action.params }); 50389 } 50390 invokeWithEvent(event) { 50391 const { target, currentTarget } = event; 50392 try { 50393 this.method.call(this.controller, event); 50394 this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName }); 50395 } catch (error2) { 50396 const { identifier, controller, element, index: index3 } = this; 50397 const detail = { identifier, controller, element, index: index3, event }; 50398 this.context.handleError(error2, `invoking action "${this.action}"`, detail); 50399 } 50400 } 50401 willBeInvokedByEvent(event) { 50402 const eventTarget = event.target; 50403 if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) { 50404 return false; 50405 } 50406 if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) { 50407 return false; 50408 } 50409 if (this.element === eventTarget) { 50410 return true; 50411 } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) { 50412 return this.scope.containsElement(eventTarget); 50413 } else { 50414 return this.scope.containsElement(this.action.element); 50415 } 50416 } 50417 get controller() { 50418 return this.context.controller; 50419 } 50420 get methodName() { 50421 return this.action.methodName; 50422 } 50423 get element() { 50424 return this.scope.element; 50425 } 50426 get scope() { 50427 return this.context.scope; 50428 } 50429} 50430class ElementObserver { 50431 constructor(element, delegate) { 50432 this.mutationObserverInit = { attributes: true, childList: true, subtree: true }; 50433 this.element = element; 50434 this.started = false; 50435 this.delegate = delegate; 50436 this.elements = /* @__PURE__ */ new Set(); 50437 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 50438 } 50439 start() { 50440 if (!this.started) { 50441 this.started = true; 50442 this.mutationObserver.observe(this.element, this.mutationObserverInit); 50443 this.refresh(); 50444 } 50445 } 50446 pause(callback) { 50447 if (this.started) { 50448 this.mutationObserver.disconnect(); 50449 this.started = false; 50450 } 50451 callback(); 50452 if (!this.started) { 50453 this.mutationObserver.observe(this.element, this.mutationObserverInit); 50454 this.started = true; 50455 } 50456 } 50457 stop() { 50458 if (this.started) { 50459 this.mutationObserver.takeRecords(); 50460 this.mutationObserver.disconnect(); 50461 this.started = false; 50462 } 50463 } 50464 refresh() { 50465 if (this.started) { 50466 const matches = new Set(this.matchElementsInTree()); 50467 for (const element of Array.from(this.elements)) { 50468 if (!matches.has(element)) { 50469 this.removeElement(element); 50470 } 50471 } 50472 for (const element of Array.from(matches)) { 50473 this.addElement(element); 50474 } 50475 } 50476 } 50477 processMutations(mutations) { 50478 if (this.started) { 50479 for (const mutation of mutations) { 50480 this.processMutation(mutation); 50481 } 50482 } 50483 } 50484 processMutation(mutation) { 50485 if (mutation.type == "attributes") { 50486 this.processAttributeChange(mutation.target, mutation.attributeName); 50487 } else if (mutation.type == "childList") { 50488 this.processRemovedNodes(mutation.removedNodes); 50489 this.processAddedNodes(mutation.addedNodes); 50490 } 50491 } 50492 processAttributeChange(element, attributeName) { 50493 if (this.elements.has(element)) { 50494 if (this.delegate.elementAttributeChanged && this.matchElement(element)) { 50495 this.delegate.elementAttributeChanged(element, attributeName); 50496 } else { 50497 this.removeElement(element); 50498 } 50499 } else if (this.matchElement(element)) { 50500 this.addElement(element); 50501 } 50502 } 50503 processRemovedNodes(nodes) { 50504 for (const node of Array.from(nodes)) { 50505 const element = this.elementFromNode(node); 50506 if (element) { 50507 this.processTree(element, this.removeElement); 50508 } 50509 } 50510 } 50511 processAddedNodes(nodes) { 50512 for (const node of Array.from(nodes)) { 50513 const element = this.elementFromNode(node); 50514 if (element && this.elementIsActive(element)) { 50515 this.processTree(element, this.addElement); 50516 } 50517 } 50518 } 50519 matchElement(element) { 50520 return this.delegate.matchElement(element); 50521 } 50522 matchElementsInTree(tree = this.element) { 50523 return this.delegate.matchElementsInTree(tree); 50524 } 50525 processTree(tree, processor) { 50526 for (const element of this.matchElementsInTree(tree)) { 50527 processor.call(this, element); 50528 } 50529 } 50530 elementFromNode(node) { 50531 if (node.nodeType == Node.ELEMENT_NODE) { 50532 return node; 50533 } 50534 } 50535 elementIsActive(element) { 50536 if (element.isConnected != this.element.isConnected) { 50537 return false; 50538 } else { 50539 return this.element.contains(element); 50540 } 50541 } 50542 addElement(element) { 50543 if (!this.elements.has(element)) { 50544 if (this.elementIsActive(element)) { 50545 this.elements.add(element); 50546 if (this.delegate.elementMatched) { 50547 this.delegate.elementMatched(element); 50548 } 50549 } 50550 } 50551 } 50552 removeElement(element) { 50553 if (this.elements.has(element)) { 50554 this.elements.delete(element); 50555 if (this.delegate.elementUnmatched) { 50556 this.delegate.elementUnmatched(element); 50557 } 50558 } 50559 } 50560} 50561class AttributeObserver { 50562 constructor(element, attributeName, delegate) { 50563 this.attributeName = attributeName; 50564 this.delegate = delegate; 50565 this.elementObserver = new ElementObserver(element, this); 50566 } 50567 get element() { 50568 return this.elementObserver.element; 50569 } 50570 get selector() { 50571 return `[${this.attributeName}]`; 50572 } 50573 start() { 50574 this.elementObserver.start(); 50575 } 50576 pause(callback) { 50577 this.elementObserver.pause(callback); 50578 } 50579 stop() { 50580 this.elementObserver.stop(); 50581 } 50582 refresh() { 50583 this.elementObserver.refresh(); 50584 } 50585 get started() { 50586 return this.elementObserver.started; 50587 } 50588 matchElement(element) { 50589 return element.hasAttribute(this.attributeName); 50590 } 50591 matchElementsInTree(tree) { 50592 const match = this.matchElement(tree) ? [tree] : []; 50593 const matches = Array.from(tree.querySelectorAll(this.selector)); 50594 return match.concat(matches); 50595 } 50596 elementMatched(element) { 50597 if (this.delegate.elementMatchedAttribute) { 50598 this.delegate.elementMatchedAttribute(element, this.attributeName); 50599 } 50600 } 50601 elementUnmatched(element) { 50602 if (this.delegate.elementUnmatchedAttribute) { 50603 this.delegate.elementUnmatchedAttribute(element, this.attributeName); 50604 } 50605 } 50606 elementAttributeChanged(element, attributeName) { 50607 if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) { 50608 this.delegate.elementAttributeValueChanged(element, attributeName); 50609 } 50610 } 50611} 50612function add(map, key2, value) { 50613 fetch$1(map, key2).add(value); 50614} 50615function del(map, key2, value) { 50616 fetch$1(map, key2).delete(value); 50617 prune(map, key2); 50618} 50619function fetch$1(map, key2) { 50620 let values = map.get(key2); 50621 if (!values) { 50622 values = /* @__PURE__ */ new Set(); 50623 map.set(key2, values); 50624 } 50625 return values; 50626} 50627function prune(map, key2) { 50628 const values = map.get(key2); 50629 if (values != null && values.size == 0) { 50630 map.delete(key2); 50631 } 50632} 50633class Multimap { 50634 constructor() { 50635 this.valuesByKey = /* @__PURE__ */ new Map(); 50636 } 50637 get keys() { 50638 return Array.from(this.valuesByKey.keys()); 50639 } 50640 get values() { 50641 const sets = Array.from(this.valuesByKey.values()); 50642 return sets.reduce((values, set) => values.concat(Array.from(set)), []); 50643 } 50644 get size() { 50645 const sets = Array.from(this.valuesByKey.values()); 50646 return sets.reduce((size, set) => size + set.size, 0); 50647 } 50648 add(key2, value) { 50649 add(this.valuesByKey, key2, value); 50650 } 50651 delete(key2, value) { 50652 del(this.valuesByKey, key2, value); 50653 } 50654 has(key2, value) { 50655 const values = this.valuesByKey.get(key2); 50656 return values != null && values.has(value); 50657 } 50658 hasKey(key2) { 50659 return this.valuesByKey.has(key2); 50660 } 50661 hasValue(value) { 50662 const sets = Array.from(this.valuesByKey.values()); 50663 return sets.some((set) => set.has(value)); 50664 } 50665 getValuesForKey(key2) { 50666 const values = this.valuesByKey.get(key2); 50667 return values ? Array.from(values) : []; 50668 } 50669 getKeysForValue(value) { 50670 return Array.from(this.valuesByKey).filter(([_key, values]) => values.has(value)).map(([key2, _values]) => key2); 50671 } 50672} 50673class SelectorObserver { 50674 constructor(element, selector3, delegate, details) { 50675 this._selector = selector3; 50676 this.details = details; 50677 this.elementObserver = new ElementObserver(element, this); 50678 this.delegate = delegate; 50679 this.matchesByElement = new Multimap(); 50680 } 50681 get started() { 50682 return this.elementObserver.started; 50683 } 50684 get selector() { 50685 return this._selector; 50686 } 50687 set selector(selector3) { 50688 this._selector = selector3; 50689 this.refresh(); 50690 } 50691 start() { 50692 this.elementObserver.start(); 50693 } 50694 pause(callback) { 50695 this.elementObserver.pause(callback); 50696 } 50697 stop() { 50698 this.elementObserver.stop(); 50699 } 50700 refresh() { 50701 this.elementObserver.refresh(); 50702 } 50703 get element() { 50704 return this.elementObserver.element; 50705 } 50706 matchElement(element) { 50707 const { selector: selector3 } = this; 50708 if (selector3) { 50709 const matches = element.matches(selector3); 50710 if (this.delegate.selectorMatchElement) { 50711 return matches && this.delegate.selectorMatchElement(element, this.details); 50712 } 50713 return matches; 50714 } else { 50715 return false; 50716 } 50717 } 50718 matchElementsInTree(tree) { 50719 const { selector: selector3 } = this; 50720 if (selector3) { 50721 const match = this.matchElement(tree) ? [tree] : []; 50722 const matches = Array.from(tree.querySelectorAll(selector3)).filter((match2) => this.matchElement(match2)); 50723 return match.concat(matches); 50724 } else { 50725 return []; 50726 } 50727 } 50728 elementMatched(element) { 50729 const { selector: selector3 } = this; 50730 if (selector3) { 50731 this.selectorMatched(element, selector3); 50732 } 50733 } 50734 elementUnmatched(element) { 50735 const selectors = this.matchesByElement.getKeysForValue(element); 50736 for (const selector3 of selectors) { 50737 this.selectorUnmatched(element, selector3); 50738 } 50739 } 50740 elementAttributeChanged(element, _attributeName) { 50741 const { selector: selector3 } = this; 50742 if (selector3) { 50743 const matches = this.matchElement(element); 50744 const matchedBefore = this.matchesByElement.has(selector3, element); 50745 if (matches && !matchedBefore) { 50746 this.selectorMatched(element, selector3); 50747 } else if (!matches && matchedBefore) { 50748 this.selectorUnmatched(element, selector3); 50749 } 50750 } 50751 } 50752 selectorMatched(element, selector3) { 50753 this.delegate.selectorMatched(element, selector3, this.details); 50754 this.matchesByElement.add(selector3, element); 50755 } 50756 selectorUnmatched(element, selector3) { 50757 this.delegate.selectorUnmatched(element, selector3, this.details); 50758 this.matchesByElement.delete(selector3, element); 50759 } 50760} 50761class StringMapObserver { 50762 constructor(element, delegate) { 50763 this.element = element; 50764 this.delegate = delegate; 50765 this.started = false; 50766 this.stringMap = /* @__PURE__ */ new Map(); 50767 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 50768 } 50769 start() { 50770 if (!this.started) { 50771 this.started = true; 50772 this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true }); 50773 this.refresh(); 50774 } 50775 } 50776 stop() { 50777 if (this.started) { 50778 this.mutationObserver.takeRecords(); 50779 this.mutationObserver.disconnect(); 50780 this.started = false; 50781 } 50782 } 50783 refresh() { 50784 if (this.started) { 50785 for (const attributeName of this.knownAttributeNames) { 50786 this.refreshAttribute(attributeName, null); 50787 } 50788 } 50789 } 50790 processMutations(mutations) { 50791 if (this.started) { 50792 for (const mutation of mutations) { 50793 this.processMutation(mutation); 50794 } 50795 } 50796 } 50797 processMutation(mutation) { 50798 const attributeName = mutation.attributeName; 50799 if (attributeName) { 50800 this.refreshAttribute(attributeName, mutation.oldValue); 50801 } 50802 } 50803 refreshAttribute(attributeName, oldValue) { 50804 const key2 = this.delegate.getStringMapKeyForAttribute(attributeName); 50805 if (key2 != null) { 50806 if (!this.stringMap.has(attributeName)) { 50807 this.stringMapKeyAdded(key2, attributeName); 50808 } 50809 const value = this.element.getAttribute(attributeName); 50810 if (this.stringMap.get(attributeName) != value) { 50811 this.stringMapValueChanged(value, key2, oldValue); 50812 } 50813 if (value == null) { 50814 const oldValue2 = this.stringMap.get(attributeName); 50815 this.stringMap.delete(attributeName); 50816 if (oldValue2) 50817 this.stringMapKeyRemoved(key2, attributeName, oldValue2); 50818 } else { 50819 this.stringMap.set(attributeName, value); 50820 } 50821 } 50822 } 50823 stringMapKeyAdded(key2, attributeName) { 50824 if (this.delegate.stringMapKeyAdded) { 50825 this.delegate.stringMapKeyAdded(key2, attributeName); 50826 } 50827 } 50828 stringMapValueChanged(value, key2, oldValue) { 50829 if (this.delegate.stringMapValueChanged) { 50830 this.delegate.stringMapValueChanged(value, key2, oldValue); 50831 } 50832 } 50833 stringMapKeyRemoved(key2, attributeName, oldValue) { 50834 if (this.delegate.stringMapKeyRemoved) { 50835 this.delegate.stringMapKeyRemoved(key2, attributeName, oldValue); 50836 } 50837 } 50838 get knownAttributeNames() { 50839 return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames))); 50840 } 50841 get currentAttributeNames() { 50842 return Array.from(this.element.attributes).map((attribute) => attribute.name); 50843 } 50844 get recordedAttributeNames() { 50845 return Array.from(this.stringMap.keys()); 50846 } 50847} 50848class TokenListObserver { 50849 constructor(element, attributeName, delegate) { 50850 this.attributeObserver = new AttributeObserver(element, attributeName, this); 50851 this.delegate = delegate; 50852 this.tokensByElement = new Multimap(); 50853 } 50854 get started() { 50855 return this.attributeObserver.started; 50856 } 50857 start() { 50858 this.attributeObserver.start(); 50859 } 50860 pause(callback) { 50861 this.attributeObserver.pause(callback); 50862 } 50863 stop() { 50864 this.attributeObserver.stop(); 50865 } 50866 refresh() { 50867 this.attributeObserver.refresh(); 50868 } 50869 get element() { 50870 return this.attributeObserver.element; 50871 } 50872 get attributeName() { 50873 return this.attributeObserver.attributeName; 50874 } 50875 elementMatchedAttribute(element) { 50876 this.tokensMatched(this.readTokensForElement(element)); 50877 } 50878 elementAttributeValueChanged(element) { 50879 const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element); 50880 this.tokensUnmatched(unmatchedTokens); 50881 this.tokensMatched(matchedTokens); 50882 } 50883 elementUnmatchedAttribute(element) { 50884 this.tokensUnmatched(this.tokensByElement.getValuesForKey(element)); 50885 } 50886 tokensMatched(tokens) { 50887 tokens.forEach((token) => this.tokenMatched(token)); 50888 } 50889 tokensUnmatched(tokens) { 50890 tokens.forEach((token) => this.tokenUnmatched(token)); 50891 } 50892 tokenMatched(token) { 50893 this.delegate.tokenMatched(token); 50894 this.tokensByElement.add(token.element, token); 50895 } 50896 tokenUnmatched(token) { 50897 this.delegate.tokenUnmatched(token); 50898 this.tokensByElement.delete(token.element, token); 50899 } 50900 refreshTokensForElement(element) { 50901 const previousTokens = this.tokensByElement.getValuesForKey(element); 50902 const currentTokens = this.readTokensForElement(element); 50903 const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken)); 50904 if (firstDifferingIndex == -1) { 50905 return [[], []]; 50906 } else { 50907 return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)]; 50908 } 50909 } 50910 readTokensForElement(element) { 50911 const attributeName = this.attributeName; 50912 const tokenString = element.getAttribute(attributeName) || ""; 50913 return parseTokenString(tokenString, element, attributeName); 50914 } 50915} 50916function parseTokenString(tokenString, element, attributeName) { 50917 return tokenString.trim().split(/\s+/).filter((content) => content.length).map((content, index3) => ({ element, attributeName, content, index: index3 })); 50918} 50919function zip(left, right) { 50920 const length = Math.max(left.length, right.length); 50921 return Array.from({ length }, (_2, index3) => [left[index3], right[index3]]); 50922} 50923function tokensAreEqual(left, right) { 50924 return left && right && left.index == right.index && left.content == right.content; 50925} 50926class ValueListObserver { 50927 constructor(element, attributeName, delegate) { 50928 this.tokenListObserver = new TokenListObserver(element, attributeName, this); 50929 this.delegate = delegate; 50930 this.parseResultsByToken = /* @__PURE__ */ new WeakMap(); 50931 this.valuesByTokenByElement = /* @__PURE__ */ new WeakMap(); 50932 } 50933 get started() { 50934 return this.tokenListObserver.started; 50935 } 50936 start() { 50937 this.tokenListObserver.start(); 50938 } 50939 stop() { 50940 this.tokenListObserver.stop(); 50941 } 50942 refresh() { 50943 this.tokenListObserver.refresh(); 50944 } 50945 get element() { 50946 return this.tokenListObserver.element; 50947 } 50948 get attributeName() { 50949 return this.tokenListObserver.attributeName; 50950 } 50951 tokenMatched(token) { 50952 const { element } = token; 50953 const { value } = this.fetchParseResultForToken(token); 50954 if (value) { 50955 this.fetchValuesByTokenForElement(element).set(token, value); 50956 this.delegate.elementMatchedValue(element, value); 50957 } 50958 } 50959 tokenUnmatched(token) { 50960 const { element } = token; 50961 const { value } = this.fetchParseResultForToken(token); 50962 if (value) { 50963 this.fetchValuesByTokenForElement(element).delete(token); 50964 this.delegate.elementUnmatchedValue(element, value); 50965 } 50966 } 50967 fetchParseResultForToken(token) { 50968 let parseResult = this.parseResultsByToken.get(token); 50969 if (!parseResult) { 50970 parseResult = this.parseToken(token); 50971 this.parseResultsByToken.set(token, parseResult); 50972 } 50973 return parseResult; 50974 } 50975 fetchValuesByTokenForElement(element) { 50976 let valuesByToken = this.valuesByTokenByElement.get(element); 50977 if (!valuesByToken) { 50978 valuesByToken = /* @__PURE__ */ new Map(); 50979 this.valuesByTokenByElement.set(element, valuesByToken); 50980 } 50981 return valuesByToken; 50982 } 50983 parseToken(token) { 50984 try { 50985 const value = this.delegate.parseValueForToken(token); 50986 return { value }; 50987 } catch (error2) { 50988 return { error: error2 }; 50989 } 50990 } 50991} 50992class BindingObserver { 50993 constructor(context3, delegate) { 50994 this.context = context3; 50995 this.delegate = delegate; 50996 this.bindingsByAction = /* @__PURE__ */ new Map(); 50997 } 50998 start() { 50999 if (!this.valueListObserver) { 51000 this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this); 51001 this.valueListObserver.start(); 51002 } 51003 } 51004 stop() { 51005 if (this.valueListObserver) { 51006 this.valueListObserver.stop(); 51007 delete this.valueListObserver; 51008 this.disconnectAllActions(); 51009 } 51010 } 51011 get element() { 51012 return this.context.element; 51013 } 51014 get identifier() { 51015 return this.context.identifier; 51016 } 51017 get actionAttribute() { 51018 return this.schema.actionAttribute; 51019 } 51020 get schema() { 51021 return this.context.schema; 51022 } 51023 get bindings() { 51024 return Array.from(this.bindingsByAction.values()); 51025 } 51026 connectAction(action) { 51027 const binding = new Binding(this.context, action); 51028 this.bindingsByAction.set(action, binding); 51029 this.delegate.bindingConnected(binding); 51030 } 51031 disconnectAction(action) { 51032 const binding = this.bindingsByAction.get(action); 51033 if (binding) { 51034 this.bindingsByAction.delete(action); 51035 this.delegate.bindingDisconnected(binding); 51036 } 51037 } 51038 disconnectAllActions() { 51039 this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true)); 51040 this.bindingsByAction.clear(); 51041 } 51042 parseValueForToken(token) { 51043 const action = Action.forToken(token, this.schema); 51044 if (action.identifier == this.identifier) { 51045 return action; 51046 } 51047 } 51048 elementMatchedValue(element, action) { 51049 this.connectAction(action); 51050 } 51051 elementUnmatchedValue(element, action) { 51052 this.disconnectAction(action); 51053 } 51054} 51055class ValueObserver { 51056 constructor(context3, receiver) { 51057 this.context = context3; 51058 this.receiver = receiver; 51059 this.stringMapObserver = new StringMapObserver(this.element, this); 51060 this.valueDescriptorMap = this.controller.valueDescriptorMap; 51061 } 51062 start() { 51063 this.stringMapObserver.start(); 51064 this.invokeChangedCallbacksForDefaultValues(); 51065 } 51066 stop() { 51067 this.stringMapObserver.stop(); 51068 } 51069 get element() { 51070 return this.context.element; 51071 } 51072 get controller() { 51073 return this.context.controller; 51074 } 51075 getStringMapKeyForAttribute(attributeName) { 51076 if (attributeName in this.valueDescriptorMap) { 51077 return this.valueDescriptorMap[attributeName].name; 51078 } 51079 } 51080 stringMapKeyAdded(key2, attributeName) { 51081 const descriptor = this.valueDescriptorMap[attributeName]; 51082 if (!this.hasValue(key2)) { 51083 this.invokeChangedCallback(key2, descriptor.writer(this.receiver[key2]), descriptor.writer(descriptor.defaultValue)); 51084 } 51085 } 51086 stringMapValueChanged(value, name, oldValue) { 51087 const descriptor = this.valueDescriptorNameMap[name]; 51088 if (value === null) 51089 return; 51090 if (oldValue === null) { 51091 oldValue = descriptor.writer(descriptor.defaultValue); 51092 } 51093 this.invokeChangedCallback(name, value, oldValue); 51094 } 51095 stringMapKeyRemoved(key2, attributeName, oldValue) { 51096 const descriptor = this.valueDescriptorNameMap[key2]; 51097 if (this.hasValue(key2)) { 51098 this.invokeChangedCallback(key2, descriptor.writer(this.receiver[key2]), oldValue); 51099 } else { 51100 this.invokeChangedCallback(key2, descriptor.writer(descriptor.defaultValue), oldValue); 51101 } 51102 } 51103 invokeChangedCallbacksForDefaultValues() { 51104 for (const { key: key2, name, defaultValue, writer } of this.valueDescriptors) { 51105 if (defaultValue != void 0 && !this.controller.data.has(key2)) { 51106 this.invokeChangedCallback(name, writer(defaultValue), void 0); 51107 } 51108 } 51109 } 51110 invokeChangedCallback(name, rawValue, rawOldValue) { 51111 const changedMethodName = `${name}Changed`; 51112 const changedMethod = this.receiver[changedMethodName]; 51113 if (typeof changedMethod == "function") { 51114 const descriptor = this.valueDescriptorNameMap[name]; 51115 try { 51116 const value = descriptor.reader(rawValue); 51117 let oldValue = rawOldValue; 51118 if (rawOldValue) { 51119 oldValue = descriptor.reader(rawOldValue); 51120 } 51121 changedMethod.call(this.receiver, value, oldValue); 51122 } catch (error2) { 51123 if (error2 instanceof TypeError) { 51124 error2.message = `Stimulus Value "${this.context.identifier}.${descriptor.name}" - ${error2.message}`; 51125 } 51126 throw error2; 51127 } 51128 } 51129 } 51130 get valueDescriptors() { 51131 const { valueDescriptorMap } = this; 51132 return Object.keys(valueDescriptorMap).map((key2) => valueDescriptorMap[key2]); 51133 } 51134 get valueDescriptorNameMap() { 51135 const descriptors = {}; 51136 Object.keys(this.valueDescriptorMap).forEach((key2) => { 51137 const descriptor = this.valueDescriptorMap[key2]; 51138 descriptors[descriptor.name] = descriptor; 51139 }); 51140 return descriptors; 51141 } 51142 hasValue(attributeName) { 51143 const descriptor = this.valueDescriptorNameMap[attributeName]; 51144 const hasMethodName = `has${capitalize(descriptor.name)}`; 51145 return this.receiver[hasMethodName]; 51146 } 51147} 51148class TargetObserver { 51149 constructor(context3, delegate) { 51150 this.context = context3; 51151 this.delegate = delegate; 51152 this.targetsByName = new Multimap(); 51153 } 51154 start() { 51155 if (!this.tokenListObserver) { 51156 this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this); 51157 this.tokenListObserver.start(); 51158 } 51159 } 51160 stop() { 51161 if (this.tokenListObserver) { 51162 this.disconnectAllTargets(); 51163 this.tokenListObserver.stop(); 51164 delete this.tokenListObserver; 51165 } 51166 } 51167 tokenMatched({ element, content: name }) { 51168 if (this.scope.containsElement(element)) { 51169 this.connectTarget(element, name); 51170 } 51171 } 51172 tokenUnmatched({ element, content: name }) { 51173 this.disconnectTarget(element, name); 51174 } 51175 connectTarget(element, name) { 51176 var _a2; 51177 if (!this.targetsByName.has(name, element)) { 51178 this.targetsByName.add(name, element); 51179 (_a2 = this.tokenListObserver) === null || _a2 === void 0 ? void 0 : _a2.pause(() => this.delegate.targetConnected(element, name)); 51180 } 51181 } 51182 disconnectTarget(element, name) { 51183 var _a2; 51184 if (this.targetsByName.has(name, element)) { 51185 this.targetsByName.delete(name, element); 51186 (_a2 = this.tokenListObserver) === null || _a2 === void 0 ? void 0 : _a2.pause(() => this.delegate.targetDisconnected(element, name)); 51187 } 51188 } 51189 disconnectAllTargets() { 51190 for (const name of this.targetsByName.keys) { 51191 for (const element of this.targetsByName.getValuesForKey(name)) { 51192 this.disconnectTarget(element, name); 51193 } 51194 } 51195 } 51196 get attributeName() { 51197 return `data-${this.context.identifier}-target`; 51198 } 51199 get element() { 51200 return this.context.element; 51201 } 51202 get scope() { 51203 return this.context.scope; 51204 } 51205} 51206function readInheritableStaticArrayValues(constructor, propertyName) { 51207 const ancestors = getAncestorsForConstructor(constructor); 51208 return Array.from(ancestors.reduce((values, constructor2) => { 51209 getOwnStaticArrayValues(constructor2, propertyName).forEach((name) => values.add(name)); 51210 return values; 51211 }, /* @__PURE__ */ new Set())); 51212} 51213function readInheritableStaticObjectPairs(constructor, propertyName) { 51214 const ancestors = getAncestorsForConstructor(constructor); 51215 return ancestors.reduce((pairs, constructor2) => { 51216 pairs.push(...getOwnStaticObjectPairs(constructor2, propertyName)); 51217 return pairs; 51218 }, []); 51219} 51220function getAncestorsForConstructor(constructor) { 51221 const ancestors = []; 51222 while (constructor) { 51223 ancestors.push(constructor); 51224 constructor = Object.getPrototypeOf(constructor); 51225 } 51226 return ancestors.reverse(); 51227} 51228function getOwnStaticArrayValues(constructor, propertyName) { 51229 const definition = constructor[propertyName]; 51230 return Array.isArray(definition) ? definition : []; 51231} 51232function getOwnStaticObjectPairs(constructor, propertyName) { 51233 const definition = constructor[propertyName]; 51234 return definition ? Object.keys(definition).map((key2) => [key2, definition[key2]]) : []; 51235} 51236class OutletObserver { 51237 constructor(context3, delegate) { 51238 this.started = false; 51239 this.context = context3; 51240 this.delegate = delegate; 51241 this.outletsByName = new Multimap(); 51242 this.outletElementsByName = new Multimap(); 51243 this.selectorObserverMap = /* @__PURE__ */ new Map(); 51244 this.attributeObserverMap = /* @__PURE__ */ new Map(); 51245 } 51246 start() { 51247 if (!this.started) { 51248 this.outletDefinitions.forEach((outletName) => { 51249 this.setupSelectorObserverForOutlet(outletName); 51250 this.setupAttributeObserverForOutlet(outletName); 51251 }); 51252 this.started = true; 51253 this.dependentContexts.forEach((context3) => context3.refresh()); 51254 } 51255 } 51256 refresh() { 51257 this.selectorObserverMap.forEach((observer) => observer.refresh()); 51258 this.attributeObserverMap.forEach((observer) => observer.refresh()); 51259 } 51260 stop() { 51261 if (this.started) { 51262 this.started = false; 51263 this.disconnectAllOutlets(); 51264 this.stopSelectorObservers(); 51265 this.stopAttributeObservers(); 51266 } 51267 } 51268 stopSelectorObservers() { 51269 if (this.selectorObserverMap.size > 0) { 51270 this.selectorObserverMap.forEach((observer) => observer.stop()); 51271 this.selectorObserverMap.clear(); 51272 } 51273 } 51274 stopAttributeObservers() { 51275 if (this.attributeObserverMap.size > 0) { 51276 this.attributeObserverMap.forEach((observer) => observer.stop()); 51277 this.attributeObserverMap.clear(); 51278 } 51279 } 51280 selectorMatched(element, _selector, { outletName }) { 51281 const outlet = this.getOutlet(element, outletName); 51282 if (outlet) { 51283 this.connectOutlet(outlet, element, outletName); 51284 } 51285 } 51286 selectorUnmatched(element, _selector, { outletName }) { 51287 const outlet = this.getOutletFromMap(element, outletName); 51288 if (outlet) { 51289 this.disconnectOutlet(outlet, element, outletName); 51290 } 51291 } 51292 selectorMatchElement(element, { outletName }) { 51293 const selector3 = this.selector(outletName); 51294 const hasOutlet = this.hasOutlet(element, outletName); 51295 const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`); 51296 if (selector3) { 51297 return hasOutlet && hasOutletController && element.matches(selector3); 51298 } else { 51299 return false; 51300 } 51301 } 51302 elementMatchedAttribute(_element, attributeName) { 51303 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 51304 if (outletName) { 51305 this.updateSelectorObserverForOutlet(outletName); 51306 } 51307 } 51308 elementAttributeValueChanged(_element, attributeName) { 51309 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 51310 if (outletName) { 51311 this.updateSelectorObserverForOutlet(outletName); 51312 } 51313 } 51314 elementUnmatchedAttribute(_element, attributeName) { 51315 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 51316 if (outletName) { 51317 this.updateSelectorObserverForOutlet(outletName); 51318 } 51319 } 51320 connectOutlet(outlet, element, outletName) { 51321 var _a2; 51322 if (!this.outletElementsByName.has(outletName, element)) { 51323 this.outletsByName.add(outletName, outlet); 51324 this.outletElementsByName.add(outletName, element); 51325 (_a2 = this.selectorObserverMap.get(outletName)) === null || _a2 === void 0 ? void 0 : _a2.pause(() => this.delegate.outletConnected(outlet, element, outletName)); 51326 } 51327 } 51328 disconnectOutlet(outlet, element, outletName) { 51329 var _a2; 51330 if (this.outletElementsByName.has(outletName, element)) { 51331 this.outletsByName.delete(outletName, outlet); 51332 this.outletElementsByName.delete(outletName, element); 51333 (_a2 = this.selectorObserverMap.get(outletName)) === null || _a2 === void 0 ? void 0 : _a2.pause(() => this.delegate.outletDisconnected(outlet, element, outletName)); 51334 } 51335 } 51336 disconnectAllOutlets() { 51337 for (const outletName of this.outletElementsByName.keys) { 51338 for (const element of this.outletElementsByName.getValuesForKey(outletName)) { 51339 for (const outlet of this.outletsByName.getValuesForKey(outletName)) { 51340 this.disconnectOutlet(outlet, element, outletName); 51341 } 51342 } 51343 } 51344 } 51345 updateSelectorObserverForOutlet(outletName) { 51346 const observer = this.selectorObserverMap.get(outletName); 51347 if (observer) { 51348 observer.selector = this.selector(outletName); 51349 } 51350 } 51351 setupSelectorObserverForOutlet(outletName) { 51352 const selector3 = this.selector(outletName); 51353 const selectorObserver = new SelectorObserver(document.body, selector3, this, { outletName }); 51354 this.selectorObserverMap.set(outletName, selectorObserver); 51355 selectorObserver.start(); 51356 } 51357 setupAttributeObserverForOutlet(outletName) { 51358 const attributeName = this.attributeNameForOutletName(outletName); 51359 const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this); 51360 this.attributeObserverMap.set(outletName, attributeObserver); 51361 attributeObserver.start(); 51362 } 51363 selector(outletName) { 51364 return this.scope.outlets.getSelectorForOutletName(outletName); 51365 } 51366 attributeNameForOutletName(outletName) { 51367 return this.scope.schema.outletAttributeForScope(this.identifier, outletName); 51368 } 51369 getOutletNameFromOutletAttributeName(attributeName) { 51370 return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName); 51371 } 51372 get outletDependencies() { 51373 const dependencies = new Multimap(); 51374 this.router.modules.forEach((module) => { 51375 const constructor = module.definition.controllerConstructor; 51376 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 51377 outlets.forEach((outlet) => dependencies.add(outlet, module.identifier)); 51378 }); 51379 return dependencies; 51380 } 51381 get outletDefinitions() { 51382 return this.outletDependencies.getKeysForValue(this.identifier); 51383 } 51384 get dependentControllerIdentifiers() { 51385 return this.outletDependencies.getValuesForKey(this.identifier); 51386 } 51387 get dependentContexts() { 51388 const identifiers = this.dependentControllerIdentifiers; 51389 return this.router.contexts.filter((context3) => identifiers.includes(context3.identifier)); 51390 } 51391 hasOutlet(element, outletName) { 51392 return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName); 51393 } 51394 getOutlet(element, outletName) { 51395 return this.application.getControllerForElementAndIdentifier(element, outletName); 51396 } 51397 getOutletFromMap(element, outletName) { 51398 return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element); 51399 } 51400 get scope() { 51401 return this.context.scope; 51402 } 51403 get schema() { 51404 return this.context.schema; 51405 } 51406 get identifier() { 51407 return this.context.identifier; 51408 } 51409 get application() { 51410 return this.context.application; 51411 } 51412 get router() { 51413 return this.application.router; 51414 } 51415} 51416class Context { 51417 constructor(module, scope) { 51418 this.logDebugActivity = (functionName, detail = {}) => { 51419 const { identifier, controller, element } = this; 51420 detail = Object.assign({ identifier, controller, element }, detail); 51421 this.application.logDebugActivity(this.identifier, functionName, detail); 51422 }; 51423 this.module = module; 51424 this.scope = scope; 51425 this.controller = new module.controllerConstructor(this); 51426 this.bindingObserver = new BindingObserver(this, this.dispatcher); 51427 this.valueObserver = new ValueObserver(this, this.controller); 51428 this.targetObserver = new TargetObserver(this, this); 51429 this.outletObserver = new OutletObserver(this, this); 51430 try { 51431 this.controller.initialize(); 51432 this.logDebugActivity("initialize"); 51433 } catch (error2) { 51434 this.handleError(error2, "initializing controller"); 51435 } 51436 } 51437 connect() { 51438 this.bindingObserver.start(); 51439 this.valueObserver.start(); 51440 this.targetObserver.start(); 51441 this.outletObserver.start(); 51442 try { 51443 this.controller.connect(); 51444 this.logDebugActivity("connect"); 51445 } catch (error2) { 51446 this.handleError(error2, "connecting controller"); 51447 } 51448 } 51449 refresh() { 51450 this.outletObserver.refresh(); 51451 } 51452 disconnect() { 51453 try { 51454 this.controller.disconnect(); 51455 this.logDebugActivity("disconnect"); 51456 } catch (error2) { 51457 this.handleError(error2, "disconnecting controller"); 51458 } 51459 this.outletObserver.stop(); 51460 this.targetObserver.stop(); 51461 this.valueObserver.stop(); 51462 this.bindingObserver.stop(); 51463 } 51464 get application() { 51465 return this.module.application; 51466 } 51467 get identifier() { 51468 return this.module.identifier; 51469 } 51470 get schema() { 51471 return this.application.schema; 51472 } 51473 get dispatcher() { 51474 return this.application.dispatcher; 51475 } 51476 get element() { 51477 return this.scope.element; 51478 } 51479 get parentElement() { 51480 return this.element.parentElement; 51481 } 51482 handleError(error2, message, detail = {}) { 51483 const { identifier, controller, element } = this; 51484 detail = Object.assign({ identifier, controller, element }, detail); 51485 this.application.handleError(error2, `Error ${message}`, detail); 51486 } 51487 targetConnected(element, name) { 51488 this.invokeControllerMethod(`${name}TargetConnected`, element); 51489 } 51490 targetDisconnected(element, name) { 51491 this.invokeControllerMethod(`${name}TargetDisconnected`, element); 51492 } 51493 outletConnected(outlet, element, name) { 51494 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element); 51495 } 51496 outletDisconnected(outlet, element, name) { 51497 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element); 51498 } 51499 invokeControllerMethod(methodName, ...args) { 51500 const controller = this.controller; 51501 if (typeof controller[methodName] == "function") { 51502 controller[methodName](...args); 51503 } 51504 } 51505} 51506function bless(constructor) { 51507 return shadow(constructor, getBlessedProperties(constructor)); 51508} 51509function shadow(constructor, properties) { 51510 const shadowConstructor = extend(constructor); 51511 const shadowProperties = getShadowProperties(constructor.prototype, properties); 51512 Object.defineProperties(shadowConstructor.prototype, shadowProperties); 51513 return shadowConstructor; 51514} 51515function getBlessedProperties(constructor) { 51516 const blessings = readInheritableStaticArrayValues(constructor, "blessings"); 51517 return blessings.reduce((blessedProperties, blessing) => { 51518 const properties = blessing(constructor); 51519 for (const key2 in properties) { 51520 const descriptor = blessedProperties[key2] || {}; 51521 blessedProperties[key2] = Object.assign(descriptor, properties[key2]); 51522 } 51523 return blessedProperties; 51524 }, {}); 51525} 51526function getShadowProperties(prototype, properties) { 51527 return getOwnKeys(properties).reduce((shadowProperties, key2) => { 51528 const descriptor = getShadowedDescriptor(prototype, properties, key2); 51529 if (descriptor) { 51530 Object.assign(shadowProperties, { [key2]: descriptor }); 51531 } 51532 return shadowProperties; 51533 }, {}); 51534} 51535function getShadowedDescriptor(prototype, properties, key2) { 51536 const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key2); 51537 const shadowedByValue = shadowingDescriptor && "value" in shadowingDescriptor; 51538 if (!shadowedByValue) { 51539 const descriptor = Object.getOwnPropertyDescriptor(properties, key2).value; 51540 if (shadowingDescriptor) { 51541 descriptor.get = shadowingDescriptor.get || descriptor.get; 51542 descriptor.set = shadowingDescriptor.set || descriptor.set; 51543 } 51544 return descriptor; 51545 } 51546} 51547const getOwnKeys = (() => { 51548 if (typeof Object.getOwnPropertySymbols == "function") { 51549 return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]; 51550 } else { 51551 return Object.getOwnPropertyNames; 51552 } 51553})(); 51554const extend = (() => { 51555 function extendWithReflect(constructor) { 51556 function extended() { 51557 return Reflect.construct(constructor, arguments, new.target); 51558 } 51559 extended.prototype = Object.create(constructor.prototype, { 51560 constructor: { value: extended } 51561 }); 51562 Reflect.setPrototypeOf(extended, constructor); 51563 return extended; 51564 } 51565 function testReflectExtension() { 51566 const a2 = function() { 51567 this.a.call(this); 51568 }; 51569 const b2 = extendWithReflect(a2); 51570 b2.prototype.a = function() { 51571 }; 51572 return new b2(); 51573 } 51574 try { 51575 testReflectExtension(); 51576 return extendWithReflect; 51577 } catch (error2) { 51578 return (constructor) => class extended extends constructor { 51579 }; 51580 } 51581})(); 51582function blessDefinition(definition) { 51583 return { 51584 identifier: definition.identifier, 51585 controllerConstructor: bless(definition.controllerConstructor) 51586 }; 51587} 51588class Module { 51589 constructor(application, definition) { 51590 this.application = application; 51591 this.definition = blessDefinition(definition); 51592 this.contextsByScope = /* @__PURE__ */ new WeakMap(); 51593 this.connectedContexts = /* @__PURE__ */ new Set(); 51594 } 51595 get identifier() { 51596 return this.definition.identifier; 51597 } 51598 get controllerConstructor() { 51599 return this.definition.controllerConstructor; 51600 } 51601 get contexts() { 51602 return Array.from(this.connectedContexts); 51603 } 51604 connectContextForScope(scope) { 51605 const context3 = this.fetchContextForScope(scope); 51606 this.connectedContexts.add(context3); 51607 context3.connect(); 51608 } 51609 disconnectContextForScope(scope) { 51610 const context3 = this.contextsByScope.get(scope); 51611 if (context3) { 51612 this.connectedContexts.delete(context3); 51613 context3.disconnect(); 51614 } 51615 } 51616 fetchContextForScope(scope) { 51617 let context3 = this.contextsByScope.get(scope); 51618 if (!context3) { 51619 context3 = new Context(this, scope); 51620 this.contextsByScope.set(scope, context3); 51621 } 51622 return context3; 51623 } 51624} 51625class ClassMap { 51626 constructor(scope) { 51627 this.scope = scope; 51628 } 51629 has(name) { 51630 return this.data.has(this.getDataKey(name)); 51631 } 51632 get(name) { 51633 return this.getAll(name)[0]; 51634 } 51635 getAll(name) { 51636 const tokenString = this.data.get(this.getDataKey(name)) || ""; 51637 return tokenize(tokenString); 51638 } 51639 getAttributeName(name) { 51640 return this.data.getAttributeNameForKey(this.getDataKey(name)); 51641 } 51642 getDataKey(name) { 51643 return `${name}-class`; 51644 } 51645 get data() { 51646 return this.scope.data; 51647 } 51648} 51649class DataMap { 51650 constructor(scope) { 51651 this.scope = scope; 51652 } 51653 get element() { 51654 return this.scope.element; 51655 } 51656 get identifier() { 51657 return this.scope.identifier; 51658 } 51659 get(key2) { 51660 const name = this.getAttributeNameForKey(key2); 51661 return this.element.getAttribute(name); 51662 } 51663 set(key2, value) { 51664 const name = this.getAttributeNameForKey(key2); 51665 this.element.setAttribute(name, value); 51666 return this.get(key2); 51667 } 51668 has(key2) { 51669 const name = this.getAttributeNameForKey(key2); 51670 return this.element.hasAttribute(name); 51671 } 51672 delete(key2) { 51673 if (this.has(key2)) { 51674 const name = this.getAttributeNameForKey(key2); 51675 this.element.removeAttribute(name); 51676 return true; 51677 } else { 51678 return false; 51679 } 51680 } 51681 getAttributeNameForKey(key2) { 51682 return `data-${this.identifier}-${dasherize(key2)}`; 51683 } 51684} 51685class Guide { 51686 constructor(logger) { 51687 this.warnedKeysByObject = /* @__PURE__ */ new WeakMap(); 51688 this.logger = logger; 51689 } 51690 warn(object, key2, message) { 51691 let warnedKeys = this.warnedKeysByObject.get(object); 51692 if (!warnedKeys) { 51693 warnedKeys = /* @__PURE__ */ new Set(); 51694 this.warnedKeysByObject.set(object, warnedKeys); 51695 } 51696 if (!warnedKeys.has(key2)) { 51697 warnedKeys.add(key2); 51698 this.logger.warn(message, object); 51699 } 51700 } 51701} 51702function attributeValueContainsToken(attributeName, token) { 51703 return `[${attributeName}~="${token}"]`; 51704} 51705class TargetSet { 51706 constructor(scope) { 51707 this.scope = scope; 51708 } 51709 get element() { 51710 return this.scope.element; 51711 } 51712 get identifier() { 51713 return this.scope.identifier; 51714 } 51715 get schema() { 51716 return this.scope.schema; 51717 } 51718 has(targetName) { 51719 return this.find(targetName) != null; 51720 } 51721 find(...targetNames) { 51722 return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), void 0); 51723 } 51724 findAll(...targetNames) { 51725 return targetNames.reduce((targets, targetName) => [ 51726 ...targets, 51727 ...this.findAllTargets(targetName), 51728 ...this.findAllLegacyTargets(targetName) 51729 ], []); 51730 } 51731 findTarget(targetName) { 51732 const selector3 = this.getSelectorForTargetName(targetName); 51733 return this.scope.findElement(selector3); 51734 } 51735 findAllTargets(targetName) { 51736 const selector3 = this.getSelectorForTargetName(targetName); 51737 return this.scope.findAllElements(selector3); 51738 } 51739 getSelectorForTargetName(targetName) { 51740 const attributeName = this.schema.targetAttributeForScope(this.identifier); 51741 return attributeValueContainsToken(attributeName, targetName); 51742 } 51743 findLegacyTarget(targetName) { 51744 const selector3 = this.getLegacySelectorForTargetName(targetName); 51745 return this.deprecate(this.scope.findElement(selector3), targetName); 51746 } 51747 findAllLegacyTargets(targetName) { 51748 const selector3 = this.getLegacySelectorForTargetName(targetName); 51749 return this.scope.findAllElements(selector3).map((element) => this.deprecate(element, targetName)); 51750 } 51751 getLegacySelectorForTargetName(targetName) { 51752 const targetDescriptor = `${this.identifier}.${targetName}`; 51753 return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor); 51754 } 51755 deprecate(element, targetName) { 51756 if (element) { 51757 const { identifier } = this; 51758 const attributeName = this.schema.targetAttribute; 51759 const revisedAttributeName = this.schema.targetAttributeForScope(identifier); 51760 this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}="${identifier}.${targetName}" with ${revisedAttributeName}="${targetName}". The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`); 51761 } 51762 return element; 51763 } 51764 get guide() { 51765 return this.scope.guide; 51766 } 51767} 51768class OutletSet { 51769 constructor(scope, controllerElement) { 51770 this.scope = scope; 51771 this.controllerElement = controllerElement; 51772 } 51773 get element() { 51774 return this.scope.element; 51775 } 51776 get identifier() { 51777 return this.scope.identifier; 51778 } 51779 get schema() { 51780 return this.scope.schema; 51781 } 51782 has(outletName) { 51783 return this.find(outletName) != null; 51784 } 51785 find(...outletNames) { 51786 return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), void 0); 51787 } 51788 findAll(...outletNames) { 51789 return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []); 51790 } 51791 getSelectorForOutletName(outletName) { 51792 const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName); 51793 return this.controllerElement.getAttribute(attributeName); 51794 } 51795 findOutlet(outletName) { 51796 const selector3 = this.getSelectorForOutletName(outletName); 51797 if (selector3) 51798 return this.findElement(selector3, outletName); 51799 } 51800 findAllOutlets(outletName) { 51801 const selector3 = this.getSelectorForOutletName(outletName); 51802 return selector3 ? this.findAllElements(selector3, outletName) : []; 51803 } 51804 findElement(selector3, outletName) { 51805 const elements = this.scope.queryElements(selector3); 51806 return elements.filter((element) => this.matchesElement(element, selector3, outletName))[0]; 51807 } 51808 findAllElements(selector3, outletName) { 51809 const elements = this.scope.queryElements(selector3); 51810 return elements.filter((element) => this.matchesElement(element, selector3, outletName)); 51811 } 51812 matchesElement(element, selector3, outletName) { 51813 const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || ""; 51814 return element.matches(selector3) && controllerAttribute.split(" ").includes(outletName); 51815 } 51816} 51817class Scope { 51818 constructor(schema, element, identifier, logger) { 51819 this.targets = new TargetSet(this); 51820 this.classes = new ClassMap(this); 51821 this.data = new DataMap(this); 51822 this.containsElement = (element2) => { 51823 return element2.closest(this.controllerSelector) === this.element; 51824 }; 51825 this.schema = schema; 51826 this.element = element; 51827 this.identifier = identifier; 51828 this.guide = new Guide(logger); 51829 this.outlets = new OutletSet(this.documentScope, element); 51830 } 51831 findElement(selector3) { 51832 return this.element.matches(selector3) ? this.element : this.queryElements(selector3).find(this.containsElement); 51833 } 51834 findAllElements(selector3) { 51835 return [ 51836 ...this.element.matches(selector3) ? [this.element] : [], 51837 ...this.queryElements(selector3).filter(this.containsElement) 51838 ]; 51839 } 51840 queryElements(selector3) { 51841 return Array.from(this.element.querySelectorAll(selector3)); 51842 } 51843 get controllerSelector() { 51844 return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier); 51845 } 51846 get isDocumentScope() { 51847 return this.element === document.documentElement; 51848 } 51849 get documentScope() { 51850 return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger); 51851 } 51852} 51853class ScopeObserver { 51854 constructor(element, schema, delegate) { 51855 this.element = element; 51856 this.schema = schema; 51857 this.delegate = delegate; 51858 this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this); 51859 this.scopesByIdentifierByElement = /* @__PURE__ */ new WeakMap(); 51860 this.scopeReferenceCounts = /* @__PURE__ */ new WeakMap(); 51861 } 51862 start() { 51863 this.valueListObserver.start(); 51864 } 51865 stop() { 51866 this.valueListObserver.stop(); 51867 } 51868 get controllerAttribute() { 51869 return this.schema.controllerAttribute; 51870 } 51871 parseValueForToken(token) { 51872 const { element, content: identifier } = token; 51873 return this.parseValueForElementAndIdentifier(element, identifier); 51874 } 51875 parseValueForElementAndIdentifier(element, identifier) { 51876 const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element); 51877 let scope = scopesByIdentifier.get(identifier); 51878 if (!scope) { 51879 scope = this.delegate.createScopeForElementAndIdentifier(element, identifier); 51880 scopesByIdentifier.set(identifier, scope); 51881 } 51882 return scope; 51883 } 51884 elementMatchedValue(element, value) { 51885 const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1; 51886 this.scopeReferenceCounts.set(value, referenceCount); 51887 if (referenceCount == 1) { 51888 this.delegate.scopeConnected(value); 51889 } 51890 } 51891 elementUnmatchedValue(element, value) { 51892 const referenceCount = this.scopeReferenceCounts.get(value); 51893 if (referenceCount) { 51894 this.scopeReferenceCounts.set(value, referenceCount - 1); 51895 if (referenceCount == 1) { 51896 this.delegate.scopeDisconnected(value); 51897 } 51898 } 51899 } 51900 fetchScopesByIdentifierForElement(element) { 51901 let scopesByIdentifier = this.scopesByIdentifierByElement.get(element); 51902 if (!scopesByIdentifier) { 51903 scopesByIdentifier = /* @__PURE__ */ new Map(); 51904 this.scopesByIdentifierByElement.set(element, scopesByIdentifier); 51905 } 51906 return scopesByIdentifier; 51907 } 51908} 51909class Router { 51910 constructor(application) { 51911 this.application = application; 51912 this.scopeObserver = new ScopeObserver(this.element, this.schema, this); 51913 this.scopesByIdentifier = new Multimap(); 51914 this.modulesByIdentifier = /* @__PURE__ */ new Map(); 51915 } 51916 get element() { 51917 return this.application.element; 51918 } 51919 get schema() { 51920 return this.application.schema; 51921 } 51922 get logger() { 51923 return this.application.logger; 51924 } 51925 get controllerAttribute() { 51926 return this.schema.controllerAttribute; 51927 } 51928 get modules() { 51929 return Array.from(this.modulesByIdentifier.values()); 51930 } 51931 get contexts() { 51932 return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []); 51933 } 51934 start() { 51935 this.scopeObserver.start(); 51936 } 51937 stop() { 51938 this.scopeObserver.stop(); 51939 } 51940 loadDefinition(definition) { 51941 this.unloadIdentifier(definition.identifier); 51942 const module = new Module(this.application, definition); 51943 this.connectModule(module); 51944 const afterLoad = definition.controllerConstructor.afterLoad; 51945 if (afterLoad) { 51946 afterLoad.call(definition.controllerConstructor, definition.identifier, this.application); 51947 } 51948 } 51949 unloadIdentifier(identifier) { 51950 const module = this.modulesByIdentifier.get(identifier); 51951 if (module) { 51952 this.disconnectModule(module); 51953 } 51954 } 51955 getContextForElementAndIdentifier(element, identifier) { 51956 const module = this.modulesByIdentifier.get(identifier); 51957 if (module) { 51958 return module.contexts.find((context3) => context3.element == element); 51959 } 51960 } 51961 proposeToConnectScopeForElementAndIdentifier(element, identifier) { 51962 const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier); 51963 if (scope) { 51964 this.scopeObserver.elementMatchedValue(scope.element, scope); 51965 } else { 51966 console.error(`Couldn't find or create scope for identifier: "${identifier}" and element:`, element); 51967 } 51968 } 51969 handleError(error2, message, detail) { 51970 this.application.handleError(error2, message, detail); 51971 } 51972 createScopeForElementAndIdentifier(element, identifier) { 51973 return new Scope(this.schema, element, identifier, this.logger); 51974 } 51975 scopeConnected(scope) { 51976 this.scopesByIdentifier.add(scope.identifier, scope); 51977 const module = this.modulesByIdentifier.get(scope.identifier); 51978 if (module) { 51979 module.connectContextForScope(scope); 51980 } 51981 } 51982 scopeDisconnected(scope) { 51983 this.scopesByIdentifier.delete(scope.identifier, scope); 51984 const module = this.modulesByIdentifier.get(scope.identifier); 51985 if (module) { 51986 module.disconnectContextForScope(scope); 51987 } 51988 } 51989 connectModule(module) { 51990 this.modulesByIdentifier.set(module.identifier, module); 51991 const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier); 51992 scopes.forEach((scope) => module.connectContextForScope(scope)); 51993 } 51994 disconnectModule(module) { 51995 this.modulesByIdentifier.delete(module.identifier); 51996 const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier); 51997 scopes.forEach((scope) => module.disconnectContextForScope(scope)); 51998 } 51999} 52000const defaultSchema = { 52001 controllerAttribute: "data-controller", 52002 actionAttribute: "data-action", 52003 targetAttribute: "data-target", 52004 targetAttributeForScope: (identifier) => `data-${identifier}-target`, 52005 outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`, 52006 keyMappings: Object.assign(Object.assign({ enter: "Enter", tab: "Tab", esc: "Escape", space: " ", up: "ArrowUp", down: "ArrowDown", left: "ArrowLeft", right: "ArrowRight", home: "Home", end: "End", page_up: "PageUp", page_down: "PageDown" }, objectFromEntries("abcdefghijklmnopqrstuvwxyz".split("").map((c2) => [c2, c2]))), objectFromEntries("0123456789".split("").map((n2) => [n2, n2]))) 52007}; 52008function objectFromEntries(array) { 52009 return array.reduce((memo, [k2, v2]) => Object.assign(Object.assign({}, memo), { [k2]: v2 }), {}); 52010} 52011class Application { 52012 constructor(element = document.documentElement, schema = defaultSchema) { 52013 this.logger = console; 52014 this.debug = false; 52015 this.logDebugActivity = (identifier, functionName, detail = {}) => { 52016 if (this.debug) { 52017 this.logFormattedMessage(identifier, functionName, detail); 52018 } 52019 }; 52020 this.element = element; 52021 this.schema = schema; 52022 this.dispatcher = new Dispatcher(this); 52023 this.router = new Router(this); 52024 this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters); 52025 } 52026 static start(element, schema) { 52027 const application = new this(element, schema); 52028 application.start(); 52029 return application; 52030 } 52031 async start() { 52032 await domReady(); 52033 this.logDebugActivity("application", "starting"); 52034 this.dispatcher.start(); 52035 this.router.start(); 52036 this.logDebugActivity("application", "start"); 52037 } 52038 stop() { 52039 this.logDebugActivity("application", "stopping"); 52040 this.dispatcher.stop(); 52041 this.router.stop(); 52042 this.logDebugActivity("application", "stop"); 52043 } 52044 register(identifier, controllerConstructor) { 52045 this.load({ identifier, controllerConstructor }); 52046 } 52047 registerActionOption(name, filter) { 52048 this.actionDescriptorFilters[name] = filter; 52049 } 52050 load(head, ...rest) { 52051 const definitions = Array.isArray(head) ? head : [head, ...rest]; 52052 definitions.forEach((definition) => { 52053 if (definition.controllerConstructor.shouldLoad) { 52054 this.router.loadDefinition(definition); 52055 } 52056 }); 52057 } 52058 unload(head, ...rest) { 52059 const identifiers = Array.isArray(head) ? head : [head, ...rest]; 52060 identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier)); 52061 } 52062 get controllers() { 52063 return this.router.contexts.map((context3) => context3.controller); 52064 } 52065 getControllerForElementAndIdentifier(element, identifier) { 52066 const context3 = this.router.getContextForElementAndIdentifier(element, identifier); 52067 return context3 ? context3.controller : null; 52068 } 52069 handleError(error2, message, detail) { 52070 var _a2; 52071 this.logger.error(`%s 52072 52073%o 52074 52075%o`, message, error2, detail); 52076 (_a2 = window.onerror) === null || _a2 === void 0 ? void 0 : _a2.call(window, message, "", 0, 0, error2); 52077 } 52078 logFormattedMessage(identifier, functionName, detail = {}) { 52079 detail = Object.assign({ application: this }, detail); 52080 this.logger.groupCollapsed(`${identifier} #${functionName}`); 52081 this.logger.log("details:", Object.assign({}, detail)); 52082 this.logger.groupEnd(); 52083 } 52084} 52085function domReady() { 52086 return new Promise((resolve) => { 52087 if (document.readyState == "loading") { 52088 document.addEventListener("DOMContentLoaded", () => resolve()); 52089 } else { 52090 resolve(); 52091 } 52092 }); 52093} 52094function ClassPropertiesBlessing(constructor) { 52095 const classes = readInheritableStaticArrayValues(constructor, "classes"); 52096 return classes.reduce((properties, classDefinition) => { 52097 return Object.assign(properties, propertiesForClassDefinition(classDefinition)); 52098 }, {}); 52099} 52100function propertiesForClassDefinition(key2) { 52101 return { 52102 [`${key2}Class`]: { 52103 get() { 52104 const { classes } = this; 52105 if (classes.has(key2)) { 52106 return classes.get(key2); 52107 } else { 52108 const attribute = classes.getAttributeName(key2); 52109 throw new Error(`Missing attribute "${attribute}"`); 52110 } 52111 } 52112 }, 52113 [`${key2}Classes`]: { 52114 get() { 52115 return this.classes.getAll(key2); 52116 } 52117 }, 52118 [`has${capitalize(key2)}Class`]: { 52119 get() { 52120 return this.classes.has(key2); 52121 } 52122 } 52123 }; 52124} 52125function OutletPropertiesBlessing(constructor) { 52126 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 52127 return outlets.reduce((properties, outletDefinition) => { 52128 return Object.assign(properties, propertiesForOutletDefinition(outletDefinition)); 52129 }, {}); 52130} 52131function getOutletController(controller, element, identifier) { 52132 return controller.application.getControllerForElementAndIdentifier(element, identifier); 52133} 52134function getControllerAndEnsureConnectedScope(controller, element, outletName) { 52135 let outletController = getOutletController(controller, element, outletName); 52136 if (outletController) 52137 return outletController; 52138 controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName); 52139 outletController = getOutletController(controller, element, outletName); 52140 if (outletController) 52141 return outletController; 52142} 52143function propertiesForOutletDefinition(name) { 52144 const camelizedName = namespaceCamelize(name); 52145 return { 52146 [`${camelizedName}Outlet`]: { 52147 get() { 52148 const outletElement = this.outlets.find(name); 52149 const selector3 = this.outlets.getSelectorForOutletName(name); 52150 if (outletElement) { 52151 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 52152 if (outletController) 52153 return outletController; 52154 throw new Error(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`); 52155 } 52156 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector3}".`); 52157 } 52158 }, 52159 [`${camelizedName}Outlets`]: { 52160 get() { 52161 const outlets = this.outlets.findAll(name); 52162 if (outlets.length > 0) { 52163 return outlets.map((outletElement) => { 52164 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 52165 if (outletController) 52166 return outletController; 52167 console.warn(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`, outletElement); 52168 }).filter((controller) => controller); 52169 } 52170 return []; 52171 } 52172 }, 52173 [`${camelizedName}OutletElement`]: { 52174 get() { 52175 const outletElement = this.outlets.find(name); 52176 const selector3 = this.outlets.getSelectorForOutletName(name); 52177 if (outletElement) { 52178 return outletElement; 52179 } else { 52180 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector3}".`); 52181 } 52182 } 52183 }, 52184 [`${camelizedName}OutletElements`]: { 52185 get() { 52186 return this.outlets.findAll(name); 52187 } 52188 }, 52189 [`has${capitalize(camelizedName)}Outlet`]: { 52190 get() { 52191 return this.outlets.has(name); 52192 } 52193 } 52194 }; 52195} 52196function TargetPropertiesBlessing(constructor) { 52197 const targets = readInheritableStaticArrayValues(constructor, "targets"); 52198 return targets.reduce((properties, targetDefinition) => { 52199 return Object.assign(properties, propertiesForTargetDefinition(targetDefinition)); 52200 }, {}); 52201} 52202function propertiesForTargetDefinition(name) { 52203 return { 52204 [`${name}Target`]: { 52205 get() { 52206 const target = this.targets.find(name); 52207 if (target) { 52208 return target; 52209 } else { 52210 throw new Error(`Missing target element "${name}" for "${this.identifier}" controller`); 52211 } 52212 } 52213 }, 52214 [`${name}Targets`]: { 52215 get() { 52216 return this.targets.findAll(name); 52217 } 52218 }, 52219 [`has${capitalize(name)}Target`]: { 52220 get() { 52221 return this.targets.has(name); 52222 } 52223 } 52224 }; 52225} 52226function ValuePropertiesBlessing(constructor) { 52227 const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, "values"); 52228 const propertyDescriptorMap = { 52229 valueDescriptorMap: { 52230 get() { 52231 return valueDefinitionPairs.reduce((result, valueDefinitionPair) => { 52232 const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier); 52233 const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key); 52234 return Object.assign(result, { [attributeName]: valueDescriptor }); 52235 }, {}); 52236 } 52237 } 52238 }; 52239 return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => { 52240 return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair)); 52241 }, propertyDescriptorMap); 52242} 52243function propertiesForValueDefinitionPair(valueDefinitionPair, controller) { 52244 const definition = parseValueDefinitionPair(valueDefinitionPair, controller); 52245 const { key: key2, name, reader: read, writer: write } = definition; 52246 return { 52247 [name]: { 52248 get() { 52249 const value = this.data.get(key2); 52250 if (value !== null) { 52251 return read(value); 52252 } else { 52253 return definition.defaultValue; 52254 } 52255 }, 52256 set(value) { 52257 if (value === void 0) { 52258 this.data.delete(key2); 52259 } else { 52260 this.data.set(key2, write(value)); 52261 } 52262 } 52263 }, 52264 [`has${capitalize(name)}`]: { 52265 get() { 52266 return this.data.has(key2) || definition.hasCustomDefaultValue; 52267 } 52268 } 52269 }; 52270} 52271function parseValueDefinitionPair([token, typeDefinition], controller) { 52272 return valueDescriptorForTokenAndTypeDefinition({ 52273 controller, 52274 token, 52275 typeDefinition 52276 }); 52277} 52278function parseValueTypeConstant(constant) { 52279 switch (constant) { 52280 case Array: 52281 return "array"; 52282 case Boolean: 52283 return "boolean"; 52284 case Number: 52285 return "number"; 52286 case Object: 52287 return "object"; 52288 case String: 52289 return "string"; 52290 } 52291} 52292function parseValueTypeDefault(defaultValue) { 52293 switch (typeof defaultValue) { 52294 case "boolean": 52295 return "boolean"; 52296 case "number": 52297 return "number"; 52298 case "string": 52299 return "string"; 52300 } 52301 if (Array.isArray(defaultValue)) 52302 return "array"; 52303 if (Object.prototype.toString.call(defaultValue) === "[object Object]") 52304 return "object"; 52305} 52306function parseValueTypeObject(payload) { 52307 const { controller, token, typeObject } = payload; 52308 const hasType = isSomething(typeObject.type); 52309 const hasDefault = isSomething(typeObject.default); 52310 const fullObject = hasType && hasDefault; 52311 const onlyType = hasType && !hasDefault; 52312 const onlyDefault = !hasType && hasDefault; 52313 const typeFromObject = parseValueTypeConstant(typeObject.type); 52314 const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default); 52315 if (onlyType) 52316 return typeFromObject; 52317 if (onlyDefault) 52318 return typeFromDefaultValue; 52319 if (typeFromObject !== typeFromDefaultValue) { 52320 const propertyPath = controller ? `${controller}.${token}` : token; 52321 throw new Error(`The specified default value for the Stimulus Value "${propertyPath}" must match the defined type "${typeFromObject}". The provided default value of "${typeObject.default}" is of type "${typeFromDefaultValue}".`); 52322 } 52323 if (fullObject) 52324 return typeFromObject; 52325} 52326function parseValueTypeDefinition(payload) { 52327 const { controller, token, typeDefinition } = payload; 52328 const typeObject = { controller, token, typeObject: typeDefinition }; 52329 const typeFromObject = parseValueTypeObject(typeObject); 52330 const typeFromDefaultValue = parseValueTypeDefault(typeDefinition); 52331 const typeFromConstant = parseValueTypeConstant(typeDefinition); 52332 const type = typeFromObject || typeFromDefaultValue || typeFromConstant; 52333 if (type) 52334 return type; 52335 const propertyPath = controller ? `${controller}.${typeDefinition}` : token; 52336 throw new Error(`Unknown value type "${propertyPath}" for "${token}" value`); 52337} 52338function defaultValueForDefinition(typeDefinition) { 52339 const constant = parseValueTypeConstant(typeDefinition); 52340 if (constant) 52341 return defaultValuesByType[constant]; 52342 const hasDefault = hasProperty(typeDefinition, "default"); 52343 const hasType = hasProperty(typeDefinition, "type"); 52344 const typeObject = typeDefinition; 52345 if (hasDefault) 52346 return typeObject.default; 52347 if (hasType) { 52348 const { type } = typeObject; 52349 const constantFromType = parseValueTypeConstant(type); 52350 if (constantFromType) 52351 return defaultValuesByType[constantFromType]; 52352 } 52353 return typeDefinition; 52354} 52355function valueDescriptorForTokenAndTypeDefinition(payload) { 52356 const { token, typeDefinition } = payload; 52357 const key2 = `${dasherize(token)}-value`; 52358 const type = parseValueTypeDefinition(payload); 52359 return { 52360 type, 52361 key: key2, 52362 name: camelize(key2), 52363 get defaultValue() { 52364 return defaultValueForDefinition(typeDefinition); 52365 }, 52366 get hasCustomDefaultValue() { 52367 return parseValueTypeDefault(typeDefinition) !== void 0; 52368 }, 52369 reader: readers[type],
52370 writer: writers[type] || writers.default 52371 }; 52372} 52373const defaultValuesByType = { 52374 get array() { 52375 return []; 52376 }, 52377 boolean: false, 52378 number: 0, 52379 get object() { 52380 return {}; 52381 }, 52382 string: "" 52383}; 52384const readers = { 52385 array(value) { 52386 const array = JSON.parse(value); 52387 if (!Array.isArray(array)) { 52388 throw new TypeError(`expected value of type "array" but instead got value "${value}" of type "${parseValueTypeDefault(array)}"`); 52389 } 52390 return array; 52391 }, 52392 boolean(value) { 52393 return !(value == "0" || String(value).toLowerCase() == "false"); 52394 }, 52395 number(value) { 52396 return Number(value.replace(/_/g, "")); 52397 }, 52398 object(value) { 52399 const object = JSON.parse(value); 52400 if (object === null || typeof object != "object" || Array.isArray(object)) { 52401 throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseValueTypeDefault(object)}"`); 52402 } 52403 return object; 52404 }, 52405 string(value) { 52406 return value; 52407 } 52408}; 52409const writers = { 52410 default: writeString, 52411 array: writeJSON, 52412 object: writeJSON 52413}; 52414function writeJSON(value) { 52415 return JSON.stringify(value); 52416} 52417function writeString(value) { 52418 return `${value}`; 52419} 52420class Controller { 52421 constructor(context3) { 52422 this.context = context3; 52423 } 52424 static get shouldLoad() { 52425 return true; 52426 } 52427 static afterLoad(_identifier, _application) { 52428 return; 52429 } 52430 get application() { 52431 return this.context.application; 52432 } 52433 get scope() { 52434 return this.context.scope; 52435 } 52436 get element() { 52437 return this.scope.element; 52438 } 52439 get identifier() { 52440 return this.scope.identifier; 52441 } 52442 get targets() { 52443 return this.scope.targets; 52444 } 52445 get outlets() { 52446 return this.scope.outlets; 52447 } 52448 get classes() { 52449 return this.scope.classes; 52450 } 52451 get data() { 52452 return this.scope.data; 52453 } 52454 initialize() { 52455 } 52456 connect() { 52457 } 52458 disconnect() { 52459 } 52460 dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) { 52461 const type = prefix ? `${prefix}:${eventName}` : eventName; 52462 const event = new CustomEvent(type, { detail, bubbles, cancelable }); 52463 target.dispatchEvent(event); 52464 return event; 52465 } 52466} 52467Controller.blessings = [ 52468 ClassPropertiesBlessing, 52469 TargetPropertiesBlessing, 52470 ValuePropertiesBlessing, 52471 OutletPropertiesBlessing 52472]; 52473Controller.targets = []; 52474Controller.outlets = []; 52475Controller.values = {}; 52476const API_VERSION = "2026-01"; 52477const CART_ATTRIBUTES = ` 52478 id 52479 checkoutUrl 52480 totalQuantity 52481 buyerIdentity { 52482 customer { 52483 email 52484 tags 52485 } 52486 } 52487 lines(first: 250) { 52488 nodes { 52489 id 52490 quantity 52491 merchandise { 52492 ... on ProductVariant { 52493 id 52494 title 52495 image { 52496 url(transform: { maxWidth: 120 }) 52497 } 52498 product { 52499 id 52500 handle 52501 title 52502 productType 52503 vendor 52504 variantsCount { 52505 count 52506 } 52507 stock_status: metafield(namespace: "spc", key: "stock_status") { 52508 value 52509 } 52510 when_available: metafield(namespace: "spc", key: "when_available") { 52511 value 52512 } 52513 } 52514 } 52515 } 52516 cost { 52517 subtotalAmount { 52518 amount 52519 currencyCode 52520 } 52521 totalAmount { 52522 amount 52523 currencyCode 52524 } 52525 } 52526 } 52527 } 52528 cost { 52529 subtotalAmount { 52530 amount 52531 currencyCode 52532 } 52533 } 52534 discountCodes { 52535 applicable 52536 code 52537 } 52538`; 52539const CREATE_CART_MUTATION = ` 52540 mutation cartCreate($input: CartInput) { 52541 cartCreate(input: $input) { 52542 cart { ${CART_ATTRIBUTES} } 52543 userErrors { 52544 field 52545 message 52546 } 52547 } 52548 } 52549`; 52550const ADD_LINES_MUTATION = ` 52551 mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) { 52552 cartLinesAdd(cartId: $cartId, lines: $lines) { 52553 cart { ${CART_ATTRIBUTES} } 52554 userErrors { 52555 field 52556 message 52557 } 52558 } 52559 } 52560`; 52561const UPDATE_LINES_MUTATION = ` 52562 mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) { 52563 cartLinesUpdate(cartId: $cartId, lines: $lines) { 52564 cart { ${CART_ATTRIBUTES} } 52565 userErrors { 52566 field 52567 message 52568 } 52569 } 52570 } 52571`; 52572const REMOVE_LINES_MUTATION = ` 52573 mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) { 52574 cartLinesRemove(cartId: $cartId, lineIds: $lineIds) { 52575 cart { ${CART_ATTRIBUTES} } 52576 userErrors { 52577 field 52578 message 52579 } 52580 } 52581 } 52582`; 52583const UPDATE_DISCOUNTS_MUTATION = ` 52584 mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) { 52585 cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) { 52586 cart { ${CART_ATTRIBUTES} } 52587 userErrors { 52588 field 52589 message 52590 } 52591 } 52592} 52593`; 52594const GET_CART_QUERY = ` 52595 query getCart($cartId: ID!) { 52596 cart(id: $cartId) { ${CART_ATTRIBUTES} } 52597 } 52598`; 52599const GET_VARIANT_QUERY = ` 52600 query getVariant($variantId: ID!) { 52601 node(id: $variantId) { 52602 ...on ProductVariant { 52603 id 52604 title 52605 product { 52606 handle 52607 title 52608 variantsCount { 52609 count 52610 } 52611 } 52612 sellingPlanAllocations(first: 1) { 52613 nodes { 52614 sellingPlan { 52615 id 52616 } 52617 } 52618 } 52619 } 52620 } 52621 } 52622`; 52623const CREATE_CUSTOMER_ACCESS_TOKEN_MUTATION = ` 52624 mutation($multipassToken: String!) { 52625 customerAccessTokenCreateWithMultipass(multipassToken: $multipassToken) { 52626 customerAccessToken { 52627 accessToken 52628 expiresAt 52629 } 52630 customerUserErrors { 52631 code 52632 field 52633 message 52634 } 52635 } 52636 } 52637`; 52638const UPDATE_BUYER_IDENTITY_MUTATION = ` 52639 mutation cartBuyerIdentityUpdate($buyerIdentity: CartBuyerIdentityInput!, $cartId: ID!) { 52640 cartBuyerIdentityUpdate(buyerIdentity: $buyerIdentity, cartId: $cartId) { 52641 cart { ${CART_ATTRIBUTES} } 52642 userErrors { 52643 field 52644 message 52645 } 52646 } 52647 } 52648`; 52649function logCartActivity(data) { 52650 const body = JSON.stringify(data); 52651 if (navigator.sendBeacon) { 52652 navigator.sendBeacon( 52653 "/shop/cart-log", 52654 new Blob([body], { type: "application/json" }) 52655 ); 52656 } else { 52657 fetch("/shop/cart-log", { 52658 method: "POST", 52659 headers: { "Content-Type": "application/json" }, 52660 body 52661 }).catch(() => { 52662 }); 52663 } 52664} 52665async function executeGraphQL(query, variables) { 52666 const response = await fetch( 52667 `https://${shopifySite}/api/${API_VERSION}/graphql.json`, 52668 { 52669 method: "POST", 52670 headers: { 52671 "Content-Type": "application/json", 52672 "X-Shopify-Storefront-Access-Token": "3fb710549018b8ea18b5b7616e2f5dd7" 52673 }, 52674 body: JSON.stringify({ query, variables }) 52675 } 52676 ); 52677 const data = await response.json(); 52678 if (data.errors) throw new Error(data.errors[0].message); 52679 return data.data; 52680} 52681async function createCart() { 52682 const data = await executeGraphQL(CREATE_CART_MUTATION); 52683 const cart = data.cartCreate.cart; 52684 logCartActivity({ action: "createCart", cartId: cart.id }); 52685 return cart; 52686} 52687async function addItemToCart(cartId, merchandiseId, quantity) { 52688 var _a2; 52689 const lines = [{ merchandiseId, quantity }]; 52690 const data = await executeGraphQL(ADD_LINES_MUTATION, { cartId, lines }); 52691 const userError = (_a2 = data.cartLinesAdd.userErrors[0]) == null ? void 0 : _a2.message; 52692 if (userError) throw new Error(userError); 52693 logCartActivity({ action: "addLines", cartId, merchandiseId, quantity }); 52694 return data.cartLinesAdd.cart; 52695} 52696async function updateItemInCart(cartId, lineId, quantity) { 52697 var _a2; 52698 const lines = [{ id: lineId, quantity }]; 52699 const data = await executeGraphQL(UPDATE_LINES_MUTATION, { cartId, lines }); 52700 const userError = (_a2 = data.cartLinesUpdate.userErrors[0]) == null ? void 0 : _a2.message; 52701 if (userError) throw new Error(userError); 52702 logCartActivity({ action: "updateLines", cartId, lineId, quantity }); 52703 return data.cartLinesUpdate.cart; 52704} 52705async function removeItemFromCart(cartId, lineIds) { 52706 var _a2; 52707 const data = await executeGraphQL(REMOVE_LINES_MUTATION, { cartId, lineIds }); 52708 const userError = (_a2 = data.cartLinesRemove.userErrors[0]) == null ? void 0 : _a2.message; 52709 if (userError) throw new Error(userError); 52710 logCartActivity({ action: "removeLines", cartId, lineIds }); 52711 return data.cartLinesRemove.cart; 52712} 52713async function getCart$1(cartId) { 52714 const data = await executeGraphQL(GET_CART_QUERY, { cartId }); 52715 logCartActivity({ action: "getCart", cartId }); 52716 return data.cart; 52717} 52718async function getVariant(variantId) { 52719 const data = await executeGraphQL(GET_VARIANT_QUERY, { variantId }); 52720 return data.node; 52721} 52722async function createCustomerAccessToken(multipassToken) { 52723 const data = await executeGraphQL(CREATE_CUSTOMER_ACCESS_TOKEN_MUTATION, { 52724 multipassToken 52725 }); 52726 if (data.customerAccessTokenCreateWithMultipass.customerUserErrors.length) 52727 throw new Error( 52728 data.customerAccessTokenCreateWithMultipass.customerUserErrors[0].message 52729 ); 52730 return data.customerAccessTokenCreateWithMultipass.customerAccessToken; 52731} 52732async function setBuyerIdentity(cart, customerAccessToken, email) { 52733 const response = await executeGraphQL(UPDATE_BUYER_IDENTITY_MUTATION, { 52734 cartId: cart.id, 52735 buyerIdentity: { 52736 customerAccessToken, 52737 email 52738 } 52739 }); 52740 logCartActivity({ 52741 action: "setBuyerIdentity", 52742 cartId: cart.id, 52743 hasEmail: !!email, 52744 hasCustomerAccessToken: !!customerAccessToken 52745 }); 52746 return response.cartBuyerIdentityUpdate.cart; 52747} 52748const DEV_MULTIPASS_TOKEN = null; 52749async function getMultipassToken() { 52750 if (SESSION_DATA.environment == "dev") return DEV_MULTIPASS_TOKEN; 52751 const response = await fetch( 52752 `${SESSION_DATA.auth_site}/api/v1/users/current/multipass-token`, 52753 { 52754 credentials: "include" 52755 } 52756 ); 52757 const token = await response.json(); 52758 return token; 52759} 52760document.addEventListener("turbo:load", async () => { 52761 if (!onCartPage()) return; 52762 await awaitShopInitialized(); 52763 document.querySelector(".cart-container").addEventListener("click", (e2) => { 52764 if (e2.target.classList.contains("adjust-button")) handleAdjustClick$1(e2); 52765 else if (e2.target.classList.contains("cart-continue-shopping")) 52766 setDrawerOpen(false); 52767 }); 52768 updateCartPage(getCart(), getCartError()); 52769}); 52770function updateCartPage(cart, cartError) { 52771 const cartContainer = document.querySelector(".cart-container"); 52772 cartContainer.innerHTML = renderCart$1({ cart, cartError }); 52773} 52774const renderCart$1 = ({ cart, cartError }) => { 52775 const loading = cart.lines.nodes.some((l2) => l2.loading); 52776 const currencyCode = cart.cost.subtotalAmount.currencyCode; 52777 let cartListItems = "";
52778 cart.lines.nodes.forEach( 52779 (item3) => cartListItems += renderCartListItem$1({ item: item3, currencyCode }) 52780 ); 52781 return cart.lines.nodes.length == 0 ? renderEmptyCart$1({ cartError }) : ` 52782 ${cartError ? `<div class="cart-error">${cartError}</div>` : ""} 52783 <div class="cart-list"> 52784 <div class="cart-list-header"> 52785 <div>Item</div> 52786 <div class="quantity-section"> 52787 <div>Quantity</div> 52788 <div class="header-cost">Cost</div> 52789 </div> 52790 </div> 52791 <div class="cart-list-items">${cartListItems}</div> 52792 </div> 52793 <div class="bottom-section"> 52794 <a 52795 class="button cart-continue-shopping outlined" 52796 href="/store" 52797 > 52798 Continue Shopping 52799 </a> 52800 <div class="subtotal-section"> 52801 <div class="subtotal"> 52802 <div>Subtotal (tax excl.)</div> 52803 <div class="subtotal-price"> 52804 ${loading ? "<div class='skeleton text'>$xx.xx</div>" : formatCurrency( 52805 cart.cost.subtotalAmount.amount, 52806 currencyCode 52807 )}
52807 52808 </div> 52809 </div> 52810 <a 52811 class="button filled ${loading ? "disabled" : ""}" 52812 href=${getCheckoutUrl$1(cart)} 52813 > 52814 Checkout 52815 </a> 52816 </div> 52817 </div> 52818 `; 52819}; 52820const renderEmptyCart$1 = ({ cartError }) => ` 52821 <div class="empty-cart"> 52822 <div> 52823 <h3>Your cart is empty.</h3> 52824 ${cartError ? `<div class="cart-error">${cartError}</div>` : ""} 52825 </div> 52826 <a class="button filled white" href="/store">Start Shopping</a> 52827 </div> 52828`; 52829function renderCartListItem$1({ item: item3, currencyCode }) { 52830 var _a2, _b2; 52831 const productHasOnlyDefaultVariant = item3.merchandise.product.variantsCount.count == 1; 52832 const lineTitle = productHasOnlyDefaultVariant ? item3.merchandise.product.title : `${item3.merchandise.product.title} - ${item3.merchandise.title}`; 52833 const loading = item3.loading; 52834 return ` 52835 <div class='line' data-id='${item3.id}'> 52836 <div class='line-info'> 52837 <a 52838 class='line-title' 52839 href='/products/${item3.merchandise.product.handle}' 52840 > 52841 ${lineTitle} 52842 </a> 52843 ${((_a2 = item3.merchandise.product.stock_status) == null ? void 0 : _a2.value) ? ` 52844 <span class='stock-status ${item3.merchandise.product.stock_status.value === "Pre-release" ? "pre-order" : item3.merchandise.product.stock_status.value.toLowerCase().replaceAll(" ", "-")}'> 52845 ${item3.merchandise.product.stock_status.value === "Pre-release" ? "Pre-order" : item3.merchandise.product.stock_status.value}${((_b2 = item3.merchandise.product.when_available) == null ? void 0 : _b2.value) ? `: Available ${item3.merchandise.product.when_available.value}` : ""} 52846 </span> 52847 ` : ""} 52848 </div> 52849 <div class="quantity-section"> 52850 <div class='line-quantity'> 52851 <span 52852 class=' 52853 material-icons 52854 remove-quantity 52855 adjust-button 52856 ${loading ? "disabled" : ""} 52857 ' 52858 data-quantity='${item3.quantity - 1}' 52859 > 52860 remove_circle_outline 52861 </span> 52862 ${item3.quantity} 52863 <span 52864 class=' 52865 material-icons 52866 add-quantity 52867 adjust-button 52868 ${loading ? "disabled" : ""} 52869 ' 52870 data-quantity='${item3.quantity + 1}' 52871 > 52872 add_circle_outline 52873 </span> 52874 </div> 52875 <div class='remove-item'> 52876 <span 52877 class=' 52878 material-icons 52879 adjust-button 52880 zero-quantity 52881 ${loading ? "disabled" : ""} 52882 ' 52883 data-quantity='0' 52884 > 52885 delete_outline 52886 </span> 52887 </div> 52888 <div class='line-total'> 52889 ${loading || item3.cost.subtotalAmount.amount === item3.cost.totalAmount.amount ? "" : `<span class="compare-at-price">${formatCurrency(item3.cost.subtotalAmount.amount, currencyCode)}</span>`} 52890 ${loading ? "<div class='skeleton text'>$xx.xx</div>" : formatCurrency(item3.cost.totalAmount.amount, currencyCode)} 52891 </div> 52892 </div> 52893 </div> 52894 `; 52895} 52896function getCheckoutUrl$1(cart) { 52897 let checkoutUrl; 52898 if (SESSION_DATA.is_logged_in) { 52899 checkoutUrl = cart.checkoutUrl; 52900 } else { 52901 const url = new URL(cart.checkoutUrl); 52902 const checkoutUrlWithoutHost = url.pathname + url.search; 52903 checkoutUrl = `https://${shopifySite}/account/logout?return_url=${encodeURIComponent( 52904 checkoutUrlWithoutHost 52905 )}`; 52906 } 52907 return checkoutUrl; 52908} 52909async function handleAdjustClick$1({ target }) { 52910 try { 52911 const quantity = parseInt(target.dataset.quantity); 52912 const lineId = target.closest(".line").dataset.id; 52913 setLoadingCart( 52914 [{ quantity, id: lineId }], 52915 quantity == 0 ? "delete" : "update" 52916 ); 52917 let cart = getCart(); 52918 if (quantity === 0) { 52919 cart = await removeItemFromCart(cart.id, [lineId]); 52920 } else { 52921 cart = await updateItemInCart(cart.id, lineId, quantity); 52922 } 52923 setCart(cart); 52924 } catch (error2) { 52925 console.error(error2); 52926 rollbackLoadingCart(); 52927 setCartError(error2); 52928 } 52929} 52930const sleep$2 = (ms) => new Promise((res) => setTimeout(res, ms)); 52931const round = (num, decimals) => Math.round(num * 10 ** decimals) / 10 ** decimals; 52932const breakpoints = { 52933 lg: 100 * 16, 52934 md: 68 * 16, 52935 sm: 48 * 16, 52936 xs: 36 * 16 52937}; 52938const isSmallScreen = () => window.innerWidth <= breakpoints.sm; 52939const bindEvents = (selector3, event, handler) => document.querySelectorAll(selector3).forEach((el) => el[event] = handler); 52940function shopifyImageUrl(url, options = {}) { 52941 if (!url) return ""; 52942 if (!url.includes("cdn.shopify.com")) return url; 52943 const newUrl = new URL(url); 52944 if (options.width) newUrl.searchParams.set("width", options.width); 52945 if (options.height) newUrl.searchParams.set("width", options.height); 52946 if (options.crop) newUrl.searchParams.set("crop", options.crop); 52947 if (options.padColor) newUrl.searchParams.set("pad_color", options.padColor); 52948 return newUrl.toString(); 52949} 52950const pluralize = (str, num) => num == 1 ? str : str + "s"; 52951function toSentence(list, { lastSeparator = "and" }) { 52952 if (list.length === 0) return ""; 52953 if (list.length === 1) return list[0]; 52954 if (list.length === 2) return `${list[0]} ${lastSeparator} ${list[1]}`; 52955 return `${list.slice(0, -1).join(", ")}, ${lastSeparator} ${list[len - 1]}`; 52956} 52957const MEMBERSHIP_TAGS = [ 52958 "all-access-membership", 52959 "all-access-membership-gift", 52960 "all-access-membership-donor", 52961 "all-access-membership-priest", 52962 "all-access-membership-partial-scholarship", 52963 "all-access-membership-full-scholarship", 52964 "all-access-membership-woo" 52965];
52966let ANNUAL_VARIANT_ID = "gid://shopify/ProductVariant/46133103263970"; 52967let APPSTLE_SELLING_PLAN_ID = "gid://shopify/SellingPlan/4934303970"; 52968let HARDCOVER_BIBLE_VARIANT_ID = "gid://shopify/ProductVariant/46186553409762"; 52969if (SESSION_DATA.environment != "production") { 52970 ANNUAL_VARIANT_ID = "gid://shopify/ProductVariant/46410258448604"; 52971 APPSTLE_SELLING_PLAN_ID = "gid://shopify/SellingPlan/32488358108"; 52972 HARDCOVER_BIBLE_VARIANT_ID = "gid://shopify/ProductVariant/46410082484444"; 52973} 52974document.addEventListener("turbo:load", async () => { 52975 var _a2; 52976 (_a2 = document.querySelector(".account-page")) == null ? void 0 : _a2.addEventListener("changepage", handleChangePage); 52977}); 52978function handleChangePage({ detail: { page: page2 } }) { 52979 if (page2 == "membership-page") renderMembershipPage(); 52980} 52981async function renderMembershipPage() { 52982 var _a2, _b2, _c; 52983 const customerTags = ((_c = (_b2 = (_a2 = getCart()) == null ? void 0 : _a2.buyerIdentity) == null ? void 0 : _b2.customer) == null ? void 0 : _c.tags) || []; 52984 const hasMembership = customerTags.some((t2) => MEMBERSHIP_TAGS.includes(t2)); 52985 const hasPriestMembership = customerTags.includes( 52986 "all-access-membership-priest" 52987 ); 52988 const hasWooMembership = customerTags.includes("all-access-membership-woo"); 52989 const subscriptions = await fetchMembershipSubscriptions(); 52990 const membershipPage = document.querySelector(".membership-page"); 52991 const activeSubscription = subscriptions.find( 52992 (s2) => s2.status.toLowerCase() == "active" 52993 ); 52994 const now = /* @__PURE__ */ new Date(); 52995 const recentlyCancelledSubscription = subscriptions.find( 52996 (s2) => s2.status.toLowerCase() == "cancelled" && new Date(s2.nextBillingDate) > now 52997 ); 52998 membershipPage.innerHTML = !hasMembership ? renderNotAMember() : hasMembership && !activeSubscription ? renderNonSubscriptionMember({ recentlyCancelledSubscription, hasPriestMembership, hasWooMembership }) : hasMembership && activeSubscription ? renderSubscriptionMember({ subscriptions, activeSubscription }) : ""; 52999 membershipPage.onclick = async (e2) => { 53000 const target = e2.target; 53001 if (target.classList.contains("switch-membership")) { 53002 document.querySelector(".switch-membership-modal").classList.add("open"); 53003 } else if (target.classList.contains("membership-page-back")) { 53004 setCurrentPage$2("mobile-account-menu"); 53005 } 53006 }; 53007 document.querySelectorAll(".switch-membership-modal .confirm-switch-to-annual").forEach( 53008 (el) => el.onclick = (e2) => handleConfirmSwitchClick(e2, activeSubscription) 53009 ); 53010} 53011const renderNotAMember = () => ` 53012 <div class="membership-page-back material-icons-outlined"> 53013 arrow_back_ios 53014 </div> 53015 <div class="not-member"> 53016 <p>It looks like you're not a member of our All-Access community.</p> 53017 <p> 53018 If you want to grow in your knowledge of Sacred Scripture with today's most 53019 trusted theologians as your guide, explore our All-Access Membership options. 53020 </p> 53021 <div> 53022 <a class="button outlined white" href="/memberships">Learn More</a> 53023 <a class="button filled white" href="/memberships/options">Become a Member</a> 53024 </div> 53025 </div> 53026`; 53027const renderNonSubscriptionMember = ({ 53028 recentlyCancelledSubscription, 53029 hasPriestMembership, 53030 hasWooMembership 53031}) => ` 53032 <div class="membership-page-back material-icons-outlined"> 53033 arrow_back_ios 53034 </div> 53035 <div class="non-subscription-member"> 53036 <p> 53037 You are an All-Access Member without an active subscription. 53038 ${recentlyCancelledSubscription ? ` Your benefits will end on ${formatBenefitEndDate(recentlyCancelledSubscription.nextBillingDate)}.` : ""} 53039 </p> 53040 ${hasPriestMembership ? `<p> 53041 If you are a priest, you enjoy <b>lifetime access</b> to your benefits thanks to the 53042 support of our donors and subscribers. 53043 </p>` : ""} 53044 ${hasWooMembership ? `<p> 53045 Your subscription has not yet been migrated to our new system. To manage your subscription, 53046 <a href="https://archive.stpaulcenter.com/my-account/">click here</a>. 53047 </p>` : ""} 53048 <p>For any questions regarding your membership, please contact our customer relations.</p> 53049 <a class="button filled white" href="/contact">Contact Us</a> 53050 </div> 53051`; 53052const POLICY_INTERVAL_NAMES = { 53053 DAY: "Daily", 53054 MONTH: "Monthly", 53055 WEEK: "Weekly", 53056 YEAR: "Annual" 53057}; 53058const renderSubscriptionMember = ({ subscriptions, activeSubscription }) => { 53059 let rows = ""; 53060 subscriptions.forEach( 53061 (subscription) => rows += renderMembershipTableRow({ subscription }) 53062 ); 53063 return ` 53064 <div class="membership-page-back material-icons-outlined">
53065 arrow_back_ios 53066 </div> 53067 ${renderMembershipTable({ subscriptions })} 53068 ${renderMembershipActions({ activeSubscription })} 53069 ${renderMembershipList({ subscriptions })} 53070 `; 53071}; 53072const renderMembershipTable = ({ subscriptions }) => { 53073 let rows = ""; 53074 subscriptions.forEach( 53075 (subscription) => rows += renderMembershipTableRow({ subscription }) 53076 ); 53077 return ` 53078 <div class="membership-table hideOnMobile"> 53079 <table> 53080 <thead> 53081 <th>Plan</th> 53082 <th>Renewal Rate</th> 53083 <th>Status</th> 53084 <th>Next Bill</th> 53085 </thead> 53086 <tbody> 53087 ${rows} 53088 </tbody> 53089 </table> 53090 </div> 53091 `; 53092}; 53093const renderMembershipTableRow = ({ subscription }) => { 53094 var _a2, _b2; 53095 return ` 53096 <tr> 53097 <td>All-Access Membership</td> 53098 <td>${POLICY_INTERVAL_NAMES[((_a2 = subscription.billingPolicyInterval) == null ? void 0 : _a2.toUpperCase()) ?? ((_b2 = subscription.billingPolicy) == null ? void 0 : _b2.interval)]}</td> 53099 <td>${toTitleCase(subscription.status)}</td> 53100 <td>${subscription.status == "CANCELLED" ? "" : formatBillingDate(subscription.nextBillingDate)}</td> 53101 </tr> 53102`; 53103}; 53104const renderMembershipList = ({ subscriptions }) => { 53105 let rows = ""; 53106 subscriptions.forEach( 53107 (subscription) => rows += renderMembershipListItem({ subscription }) 53108 ); 53109 return `<div class="membership-list hideOnDesktop">${rows}</div>`; 53110}; 53111const renderMembershipListItem = ({ subscription }) => { 53112 var _a2, _b2; 53113 return ` 53114 <div class="membership-list-item"> 53115 <div class="membership-list-item-title"> 53116 All-Access Membership - ${POLICY_INTERVAL_NAMES[((_a2 = subscription.billingPolicyInterval) == null ? void 0 : _a2.toUpperCase()) ?? ((_b2 = subscription.billingPolicy) == null ? void 0 : _b2.interval)]} 53117 </div> 53118 <div> 53119 ${subscription.status == "ACTIVE" ? `Active, next bill on ${formatBillingDate(subscription.nextBillingDate)}` : toTitleCase(subscription.status)} 53120 </div> 53121 </div> 53122`; 53123}; 53124const renderMembershipActions = ({ activeSubscription }) => { 53125 var _a2; 53126 const billingPolicyInterval = activeSubscription.billingPolicyInterval ?? ((_a2 = activeSubscription.billingPolicy) == null ? void 0 : _a2.interval); 53127 const hasActiveMonthlySubscription = billingPolicyInterval.toLowerCase() == "month"; 53128 return ` 53129 <div class="membership-actions"> 53130 ${hasActiveMonthlySubscription ? '<button class="switch-membership">Upgrade to Annual</button>' : ""} 53131 <a 53132 href="/account/subscriptions/manage" 53133 class="button outlined white" 53134 > 53135 Manage Membership 53136 </a> 53137 </div> 53138 ${renderSwitchModal()} 53139 `; 53140}; 53141const renderSwitchModal = () => ` 53142 <div data-controller="modal" class="switch-membership-modal"> 53143 <div class="modal-container"> 53144 <div class="modal-title">Upgrade to Annual</div> 53145 <button class="modal-close"></button> 53146 <p> 53147 Thank you for upgrading your membership to our annual All-Access Membership. 53148 Once you check out with your new annual Membership and free study Bible, 53149 your monthly Membership will be canceled, your annual Membership will begin, 53150 and we will send you your free copy of the complete 53151 <i>Ignatius Catholic Study Bible</i>. 53152 <p> 53153 <p> 53154 In the meantime, continue to enjoy access to Emmaus Academy, 53155 <i>The Word of the Lord</i>, 53156 and all the other perks of All-Access Membership. 53157 </p> 53158 <div class="switch-membership-error"></div> 53159 <div class="modal-actions"> 53160 <button class="outlined" data-action="modal#close">Close</button> 53161 <button 53162 class="confirm-switch-to-annual filled loadable" 53163 data-bible-id="${HARDCOVER_BIBLE_VARIANT_ID}" 53164 > 53165 Get Free Bible 53166 </button> 53167 </div> 53168 <div class="switch-membership-helper-text"> 53169 <i>International shipping not included.</i> 53170 <br> 53171 <i>To upgrade without the free Bible, <a href="/memberships/annual">click here</a></i> 53172 </div> 53173 </div> 53174 </div> 53175`; 53176async function fetchMembershipSubscriptions() { 53177 const response = await fetch("/actions/spc/subscriptions"); 53178 const subscriptions = await response.json(); 53179 return subscriptions.filter( 53180 (c2) => c2.contractDetails.some((l2) => l2.title == "All-Access Membership") 53181 ); 53182} 53183async function handleConfirmSwitchClick(e2, activeSubscription) { 53184 document.querySelector(".switch-membership-error").innerText = ""; 53185 document.querySelectorAll(".confirm-switch-to-annual").forEach((el) => el.disabled = true); 53186 e2.target.classList.add("loading"); 53187 try { 53188 if (!activeSubscription.billingPolicyInterval == "MONTH") 53189 throw new Error("Your current subscription must be monthly to upgrade."); 53190 const customerAccessToken = await getCustomerAccessToken(); 53191 let response = await executeGraphQL(CREATE_CART_MUTATION, { 53192 input: { 53193 buyerIdentity: { 53194 customerAccessToken 53195 }, 53196 lines: [ 53197 {
53198 merchandiseId: ANNUAL_VARIANT_ID, 53199 sellingPlanId: APPSTLE_SELLING_PLAN_ID, 53200 quantity: 1, 53201 attributes: [ 53202 { 53203 key: "Switch From", 53204 value: "Monthly" 53205 } 53206 ] 53207 }, 53208 ...e2.target.dataset.bibleId ? [{ merchandiseId: e2.target.dataset.bibleId, quantity: 1 }] : [] 53209 ] 53210 } 53211 }); 53212 if (response.cartCreate.userErrors[0]) 53213 throw new Error(response.cartCreate.userErrors[0].message); 53214 const cart = response.cartCreate.cart; 53215 logCartActivity({ 53216 action: "switchMembership", 53217 cartId: cart.id, 53218 hasCustomerAccessToken: !!customerAccessToken 53219 }); 53220 window.location.href = cart.checkoutUrl; 53221 } catch (error2) { 53222 console.error(error2); 53223 document.querySelector(".switch-membership-error").innerText = error2.message || error2; 53224 document.querySelectorAll(".confirm-switch-to-annual").forEach((el) => el.disabled = false); 53225 e2.target.classList.remove("loading"); 53226 } 53227} 53228const toTitleCase = (str) => { 53229 const lowercased = str.toLowerCase(); 53230 return lowercased.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "); 53231}; 53232const formatBillingDate = (str) => new Date(str).toLocaleDateString("en-US", { 53233 month: "2-digit", 53234 day: "2-digit", 53235 year: "2-digit" 53236}); 53237const formatBenefitEndDate = (str) => new Date(str).toLocaleDateString("en-US", { 53238 month: "2-digit", 53239 day: "2-digit", 53240 year: "numeric" 53241}); 53242document.addEventListener("turbo:load", (e2) => { 53243 var _a2; 53244 const accountPage = document.querySelector(".account-page"); 53245 if (accountPage) { 53246 (_a2 = document.querySelector(".top-menu-drawer")) == null ? void 0 : _a2.addEventListener("changepage", handleDrawerChangePage); 53247 accountPage.querySelectorAll( 53248 ".desktop-account-menu > [data-page], .mobile-account-menu-menu-list > [data-page]" 53249 ).forEach((el) => el.onclick = handleMenuButtonClick); 53250 accountPage.querySelector(".information-page-back").onclick = () => setCurrentPage$2("mobile-account-menu"); 53251 } 53252}); 53253function handleMenuButtonClick(e2) { 53254 if (e2.currentTarget.dataset.page) { 53255 const page2 = e2.currentTarget.dataset.page; 53256 const currentPage = getCurrentPage$2(); 53257 if (currentPage != page2) setCurrentPage$2(page2); 53258 } 53259} 53260function handleDrawerChangePage({ detail: { page: page2 } }) { 53261 if (page2 == "account-page") { 53262 setCurrentPage$2(isSmallScreen() ? "mobile-account-menu" : "membership-page"); 53263 } else { 53264 setCurrentPage$2(null); 53265 } 53266} 53267const getCurrentPage$2 = () => document.querySelector(".account-page .paginator").dataset.currentPage; 53268async function setCurrentPage$2(page2) { 53269 var _a2, _b2; 53270 const currentPage = getCurrentPage$2(); 53271 if (currentPage == page2) return; 53272 const buttons = document.querySelector(".desktop-account-menu"); 53273 const selectedButton = buttons.querySelector(".selected");
53274 const pageButton = buttons.querySelector(`[data-page="${page2}"]`); 53275 if (selectedButton && selectedButton != pageButton) 53276 selectedButton.classList.remove("selected"); 53277 if (pageButton) pageButton.classList.add("selected"); 53278 const paginator = document.querySelector(".account-page .paginator"); 53279 const currentPageNode = paginator.querySelector(`.${currentPage}`); 53280 paginator.dataset.currentPage = page2; 53281 if (currentPageNode) { 53282 currentPageNode.classList.remove("visible"); 53283 await sleep$2(300); 53284 } 53285 (_b2 = (_a2 = paginator.querySelector(`.${page2}`)) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.add("visible"); 53286 document.querySelector(".account-page").dispatchEvent(new CustomEvent("changepage", { detail: { page: page2 } })); 53287} 53288document.addEventListener("DOMContentLoaded", () => { 53289 const bigMenu = document.querySelector(".big-menu"); 53290 if (!bigMenu) return; 53291 bigMenu.querySelector(".menu-container-main-list").addEventListener("mouseover", (event) => { 53292 if (event.target.classList.contains("menu-container-main-list-item")) { 53293 if (getSelectedMainListItem() == event.target) 53294 setSelectedMainListItem(null); 53295 else setSelectedMainListItem(event.target); 53296 } 53297 }); 53298 const mainDrawer = document.querySelector(".main-menu-drawer"); 53299 mainDrawer.addEventListener("close", () => setSelectedMainListItem(null)); 53300 mainDrawer.addEventListener("changepage", ({ detail: { page: page2 } }) => { 53301 if (page2 != "big-menu") setSelectedMainListItem(null); 53302 }); 53303}); 53304const getSelectedMainListItem = () => document.querySelector(".big-menu .menu-container-main-list-item.selected"); 53305function setSelectedMainListItem(node) { 53306 var _a2, _b2; 53307 const bigMenu = document.querySelector(".big-menu"); 53308 const mainList = bigMenu.querySelector(".menu-container-main-list"); 53309 (_b2 = (_a2 = mainList.querySelector(".selected")) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.remove("selected"); 53310 if (node) node.classList.add("selected"); 53311 const mainItems = Array.from(mainList.children).filter( 53312 (item3) => item3.classList.contains("menu-container-main-list-item") 53313 ); 53314 const nodeIndex = mainItems.indexOf(node); 53315 const pageIndex = nodeIndex + 1; 53316 bigMenu.querySelectorAll(".menu-container-page.visible").forEach((node2) => node2.classList.remove("visible")); 53317 bigMenu.querySelector(`.menu-container-page:nth-child(${pageIndex + 1}`).classList.add("visible"); 53318} 53319const _state = { 53320 mainSearch: null, 53321 popupSections: [] 53322}; 53323const searchDrawerStates = [ 53324 { 53325 name: "store", 53326 instance: null, 53327 container: "#store-hits", 53328 highestTextMatch: 0, 53329 totalTextMatch: 0, 53330 closestVectorMatch: 1 53331 }, 53332 { 53333 name: "pages", 53334 instance: null, 53335 container: "#pages-hits", 53336 highestTextMatch: 0, 53337 totalTextMatch: 0, 53338 closestVectorMatch: 1 53339 }, 53340 { 53341 name: "library", 53342 instance: null, 53343 container: "#library-hits", 53344 highestTextMatch: 0, 53345 totalTextMatch: 0, 53346 closestVectorMatch: 1 53347 }, 53348 { 53349 name: "bible", 53350 instance: null, 53351 container: "#sunday-bible-reflections-hits", 53352 highestTextMatch: 0, 53353 totalTextMatch: 0, 53354 closestVectorMatch: 1 53355 }, 53356 { 53357 name: "events", 53358 instance: null, 53359 container: "#events-hits", 53360 highestTextMatch: 0, 53361 totalTextMatch: 0, 53362 closestVectorMatch: 1 53363 }, 53364 { 53365 name: "media", 53366 instance: null, 53367 container: "#media-hits", 53368 highestTextMatch: 0, 53369 totalTextMatch: 0, 53370 closestVectorMatch: 1 53371 } 53372]; 53373function reorderSearchPageSections(storeInstance, contentInstance) { 53374 var _a2, _b2; 53375 if (storeInstance.helper.state.page == 0 && contentInstance.helper.state.page == 0) { 53376 const storeResults = storeInstance.helper.lastResults; 53377 const contentResults = contentInstance.helper.lastResults; 53378 if (!storeResults || !contentResults) return; 53379 const storeTop = (_a2 = storeResults.hits[0]) == null ? void 0 : _a2.text_match; 53380 const contentTop = (_b2 = contentResults.hits[0]) == null ? void 0 : _b2.text_match; 53381 const storeSection = document.querySelector( 53382 ".search-page .search-section.store" 53383 ); 53384 const contentSection = document.querySelector( 53385 ".search-page .search-section.content" 53386 ); 53387 const parent = storeSection == null ? void 0 : storeSection.parentNode; 53388 if (contentTop > storeTop && parent.firstElementChild !== contentSection) { 53389 parent.insertBefore(contentSection, storeSection); 53390 } else if (storeTop >= contentTop && parent.firstElementChild !== storeSection) { 53391 parent.insertBefore(storeSection, contentSection); 53392 } 53393 } 53394} 53395function debounce(fn, delay) { 53396 let timer = null; 53397 return function(...args) { 53398 clearTimeout(timer); 53399 timer = setTimeout(() => fn.apply(this, args), delay); 53400 }; 53401} 53402function initSearch() { 53403 var _a2, _b2; 53404 if (_state.mainSearch) { 53405 _state.mainSearch.dispose(); 53406 } 53407 if (_state.popupSections.length) { 53408 _state.popupSections.forEach((search) => search.dispose()); 53409 _state.popupSections = []; 53410 } 53411 const typesenseInstantsearchAdapter = new TypesenseInstantsearchAdapter({ 53412 server: { 53413 ...typesenseConfig 53414 }, 53415 additionalSearchParameters: { 53416 query_by: "title, author, keywords, categorization, speakers, event_types, locations, embedding", 53417 highlight_fields: "title", 53418 // exposes text_match score 53419 vector_query: "embedding:([], k: 200, distance_threshold: 0.19)", 53420 exclude_fields: "embedding" 53421 } 53422 }); 53423 const isSearchPage = document.querySelector("#searchbar"); 53424 if (!isSearchPage) { 53425 _state.mainSearch = instantsearch({ 53426 searchClient: typesenseInstantsearchAdapter.searchClient, 53427 indexName: "stpaulcenter" 53428 }); 53429 (_a2 = document.querySelector(".search-placeholder")) == null ? void 0 : _a2.remove(); 53430 _state.mainSearch.addWidgets([ 53431 searchBox({ 53432 container: "#searchbox", 53433 placeholder: "I want to find...", 53434 queryHook: debounce(function(query, search) { 53435 _state.popupSections.forEach((search2) => { 53436 search2.helper.setQuery(query).search(); 53437 }); 53438 search(query); 53439 }, 181) 53440 // 181ms debounce 53441 }) 53442 ]); 53443 const sectionInstances = [ 53444 initStoreSection(typesenseInstantsearchAdapter, "store-hits"), 53445 initPagesSection(typesenseInstantsearchAdapter, "pages-hits"), 53446 initLibrarySection(typesenseInstantsearchAdapter, "library-hits"), 53447 initBibleStudiesSection( 53448 typesenseInstantsearchAdapter, 53449 "sunday-bible-reflections-hits" 53450 ), 53451 initEventsSection(typesenseInstantsearchAdapter, "events-hits"), 53452 initMediaSection(typesenseInstantsearchAdapter, "media-hits") 53453 ]; 53454 _state.popupSections = sectionInstances;
53455 sectionInstances.forEach((section, index3) => { 53456 section.on("render", () => { 53457 const results = section.helper.lastResults; 53458 const { highest, total, closest } = getSectionMatches(results); 53459 searchDrawerStates[index3].highestTextMatch = highest; 53460 searchDrawerStates[index3].totalTextMatch = total; 53461 searchDrawerStates[index3].closestVectorMatch = closest; 53462 reorderSearchDrawerSections(); 53463 }); 53464 searchDrawerStates[index3].instance = section; 53465 }); 53466 _state.mainSearch.start(); 53467 _state.mainSearch.on("render", () => { 53468 const query = _state.mainSearch.helper.state.query; 53469 document.querySelectorAll(".search-section").forEach((section) => { 53470 const type = section.classList[1]; 53471 const viewAllLink = section.querySelector(".section-header a"); 53472 if (viewAllLink) { 53473 const updatedUrl = `/search?q=${encodeURIComponent(query)}&type=${encodeURIComponent(type)}`; 53474 viewAllLink.setAttribute("href", updatedUrl); 53475 } 53476 }); 53477 }); 53478 _state.popupSections.forEach((search) => search.start()); 53479 setupSearchListeners(_state.mainSearch); 53480 } else { 53481 const urlParams = new URLSearchParams(window.location.search); 53482 const initialTypes = ((_b2 = urlParams.get("type")) == null ? void 0 : _b2.split(",")) || []; 53483 const initialQuery = urlParams.get("q"); 53484 let initialContentFilters = []; 53485 if (initialTypes.length > 0) { 53486 initialTypes.forEach((type) => { 53487 if (type !== "store") { 53488 switch (type) { 53489 case "pages": 53490 initialContentFilters.push("categorization:=[page]"); 53491 break; 53492 case "library": 53493 initialContentFilters.push("categorization:=[library]"); 53494 break; 53495 case "sunday-bible-reflections": 53496 initialContentFilters.push( 53497 "categorization:=[sunday-bible-reflections]" 53498 ); 53499 break; 53500 case "events": 53501 initialContentFilters.push("categorization:=[events]"); 53502 break; 53503 case "media": 53504 initialContentFilters.push( 53505 "(categorization:=[articles] || categorization:=[videos] || categorization:=[podcasts])" 53506 ); 53507 break; 53508 } 53509 } 53510 }); 53511 } 53512 const contentFilters = initialContentFilters.filter((filter) => filter !== "library"); 53513 const initialContentFilterString = contentFilters.length > 0 ? contentFilters.join(" || ") : "(categorization:[page] || categorization:=[sunday-bible-reflections] || categorization:=[events] || categorization:=[articles] || categorization:=[videos] || categorization:=[podcasts])"; 53514 const contentSectionInstance = initAllSection( 53515 typesenseInstantsearchAdapter, 53516 "page-content-hits", 53517 initialQuery, 53518 true, 53519 24, 53520 initialContentFilterString 53521 ); 53522 const searchPageSearch = instantsearch({ 53523 searchClient: typesenseInstantsearchAdapter.searchClient, 53524 indexName: "stpaulcenter", 53525 routing: { 53526 router: historyRouter({ 53527 push(url) { 53528 window.history.replaceState(window.history.state, "", url); 53529 } 53530 }), 53531 stateMapping: { 53532 stateToRoute(uiState) { 53533 var _a3, _b3; 53534 return { 53535 q: ((_a3 = uiState.stpaulcenter) == null ? void 0 : _a3.query) || "", 53536 type: initialTypes.join(","), 53537 page: ((_b3 = uiState.stpaulcenter) == null ? void 0 : _b3.page) || 1 53538 }; 53539 }, 53540 routeToState(routeState) { 53541 return { 53542 stpaulcenter: { 53543 query: routeState.q || "", 53544 page: parseInt(routeState.page, 10) || 1 53545 } 53546 }; 53547 } 53548 } 53549 }, 53550 ...initialQuery ? { 53551 searchFunction(helper) { 53552 helper.setQuery(initialQuery).search(); 53553 } 53554 } : {} 53555 }); 53556 const librarySectionInstance = initLibrarySection( 53557 typesenseInstantsearchAdapter, 53558 "page-library-hits", 53559 initialQuery, 53560 true, 53561 9 53562 ); 53563 const pageSections = [ 53564 initStoreSection( 53565 typesenseInstantsearchAdapter, 53566 "page-store-hits", 53567 initialQuery, 53568 true, 53569 9 53570 ), 53571 contentSectionInstance, 53572 librarySectionInstance 53573 ]; 53574 searchPageSearch.addWidgets([ 53575 searchBox({ 53576 container: "#searchbar", 53577 placeholder: "I want to find...", 53578 queryHook: debounce(function(query, search) { 53579 pageSections.forEach((search2) => { 53580 search2.helper.setQuery(query).search(); 53581 }); 53582 search(query); 53583 }, 180), 53584 // 180ms debounce 53585 ...initialQuery ? { defaultValue: initialQuery } : {} 53586 }), 53587 pagination({ 53588 container: "#pagination", 53589 showFirst: true, 53590 showLast: true, 53591 showPrevious: true, 53592 showNext: true 53593 }), 53594 configure({ 53595 hitsPerPage: 10 53596 }) 53597 ]); 53598 const storeSection = document.querySelector( 53599 ".search-page .search-section.store" 53600 ); 53601 const contentSection = document.querySelector( 53602 ".search-page .search-section.content" 53603 ); 53604 const librarySection = document.querySelector( 53605 ".search-page .search-section.library" 53606 ); 53607 if (initialTypes.length === 0) { 53608 storeSection.style.display = "block"; 53609 contentSection.style.display = "block"; 53610 librarySection.style.display = "block"; 53611 } else { 53612 storeSection.style.display = initialTypes.includes("store") ? "block" : "none"; 53613 librarySection.style.display = initialTypes.includes("library") ? "block" : "none"; 53614 const hasNonBookNonLibraryFilters = initialTypes.some((type) => type !== "store" && type !== "library"); 53615 contentSection.style.display = hasNonBookNonLibraryFilters ? "block" : "none"; 53616 } 53617 setupSearchPageFilters( 53618 typesenseInstantsearchAdapter, 53619 contentSectionInstance 53620 ); 53621 setupToggleFilters(); 53622 if (initialTypes.length > 0) {
53623 initialTypes.forEach((type) => { 53624 const checkbox = document.querySelector(`#filter-${type}`); 53625 if (checkbox) { 53626 checkbox.checked = true; 53627 } 53628 }); 53629 } 53630 searchPageSearch.start(); 53631 pageSections.forEach((search) => search.start()); 53632 pageSections[0].on( 53633 "render", 53634 () => reorderSearchPageSections(pageSections[0], pageSections[1]) 53635 ); 53636 pageSections[1].on( 53637 "render", 53638 () => reorderSearchPageSections(pageSections[0], pageSections[1]) 53639 ); 53640 } 53641} 53642function initStoreSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53643 const paginationId = `${containerId}-pagination`; 53644 const widgets = [ 53645 configure({ 53646 hitsPerPage, 53647 query: initialQuery || "*", 53648 page: 0 53649 }), 53650 hits({ 53651 container: "#" + containerId, 53652 templates: { 53653 item: (hit) => ` 53654 <div class="book-card"> 53655 <a href="${hit.url}"> 53656 <div class="image-container"> 53657 <img src="${shopifyImageUrl(hit.image, { width: 300 })}" alt="${hit.title}" /> 53658 ${hit.stock_status ? '<div class="badge stock-status ' + (hit.stock_status === "Pre-release" ? "pre-order" : hit.stock_status.toLowerCase().replaceAll(" ", "-")) + '">' + (hit.stock_status === "Pre-release" ? "Pre-order" : hit.stock_status) + (hit.when_available ? ": Available " + hit.when_available : "") + "</div>" : ""} 53659 </div> 53660 <div class="details"> 53661 <div class="title">${hit.title}</div> 53662 ${hit.author ? `<div class="author">${hit.author.join(", ")}</div>` : ""} 53663 <div class="price">$${hit.price.toFixed(2)}</div> 53664 </div> 53665 </a> 53666 </div> 53667 ` 53668 } 53669 }) 53670 ]; 53671 if (isPage) { 53672 widgets.push( 53673 pagination({ 53674 container: "#" + paginationId, 53675 showFirst: true, 53676 showLast: true, 53677 showPrevious: true, 53678 showNext: true, 53679 scrollTo: false 53680 }) 53681 ); 53682 } 53683 return instantsearch({ 53684 searchClient: typesenseAdapter.searchClient, 53685 indexName: "stpaulcenter$products", 53686 routing: false, 53687 ...initialQuery ? { 53688 searchFunction(helper) { 53689 if (!helper.state.query) { 53690 helper.setQuery(initialQuery); 53691 } 53692 helper.search(); 53693 } 53694 } : {} 53695 }).addWidgets(widgets); 53696} 53697function initPagesSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53698 return instantsearch({ 53699 searchClient: typesenseAdapter.searchClient, 53700 indexName: "stpaulcenter", 53701 routing: false, 53702 ...initialQuery ? { 53703 searchFunction(helper) { 53704 helper.setQuery(initialQuery).search(); 53705 } 53706 } : {} 53707 }).addWidgets([ 53708 configure({ 53709 hitsPerPage, 53710 filters: "categorization:=[page]", 53711 query: initialQuery || "*" 53712 }), 53713 hits({ 53714 container: "#" + containerId, 53715 templates: { 53716 item: (hit) => ` 53717 <div class="media-card"> 53718 <a href="${hit.url}"> 53719 ${hit.meta ? `<div class="meta">${hit.meta}</div>` : ""} 53720 <h5>${hit.title}</h5> 53721 </a> 53722 </div> 53723 ` 53724 } 53725 }) 53726 ]); 53727} 53728function initLibrarySection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53729 const paginationId = `${containerId}-pagination`; 53730 const widgets = [ 53731 configure({ 53732 hitsPerPage, 53733 filters: "categorization:=[library]", 53734 query: initialQuery || "*", 53735 page: 0 53736 }), 53737 hits({ 53738 container: "#" + containerId, 53739 templates: { 53740 empty: '<div class="no-results">No library items found.</div>', 53741 item: (hit) => ` 53742 <div class="library-card"> 53743 <a href="${hit.url}" target="_blank"> 53744 53745 <img src="${hit.thumbnail_url || ""}" alt="${hit.title}" /> 53746 <div class="details"> 53747 <div class="title">${hit.title}</div> 53748 ${hit.presenter ? `<div class="presenter">${hit.presenter}</div>` : ""} 53749 </div> 53750 </a> 53751 </div> 53752 ` 53753 } 53754 }) 53755 ]; 53756 if (isPage) { 53757 widgets.push( 53758 pagination({ 53759 container: "#" + paginationId, 53760 showFirst: true, 53761 showLast: true, 53762 showPrevious: true, 53763 showNext: true, 53764 scrollTo: false 53765 }) 53766 ); 53767 } 53768 return instantsearch({ 53769 searchClient: typesenseAdapter.searchClient, 53770 indexName: "my_stpaulcenter", 53771 routing: false, 53772 ...initialQuery ? { 53773 searchFunction(helper) { 53774 if (!helper.state.query) { 53775 helper.setQuery(initialQuery); 53776 } 53777 helper.search(); 53778 } 53779 } : {} 53780 }
53780).addWidgets(widgets); 53781} 53782function initBibleStudiesSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53783 return instantsearch({ 53784 searchClient: typesenseAdapter.searchClient, 53785 indexName: "stpaulcenter", 53786 routing: false, 53787 ...initialQuery ? { 53788 searchFunction(helper) { 53789 helper.setQuery(initialQuery).search(); 53790 } 53791 } : {} 53792 }).addWidgets([ 53793 configure({ 53794 hitsPerPage, 53795 filters: "categorization:=[sunday-bible-reflections]", 53796 query: initialQuery || "*" 53797 }), 53798 hits({ 53799 container: "#" + containerId, 53800 templates: { 53801 item: (hit) => ` 53802 <div class="study-card"> 53803 <a href="${hit.url}"> 53804 <img src="${hit.image || ""}" alt="${hit.title}" /> 53805 <div class="details"> 53806 <h5>${hit.title}</h5> 53807 </div> 53808 </a> 53809 </div> 53810 ` 53811 } 53812 }) 53813 ]); 53814} 53815function initEventsSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53816 return instantsearch({ 53817 searchClient: typesenseAdapter.searchClient, 53818 indexName: "stpaulcenter", 53819 routing: false, 53820 ...initialQuery ? { 53821 searchFunction(helper) { 53822 helper.setQuery(initialQuery).search(); 53823 } 53824 } : {} 53825 }).addWidgets([ 53826 configure({ 53827 hitsPerPage, 53828 filters: "categorization:=[events]", 53829 query: initialQuery || "*" 53830 }), 53831 hits({ 53832 container: "#" + containerId, 53833 templates: { 53834 item: (hit) => ` 53835 <div class="event-card"> 53836 <a href="${hit.url}"> 53837 ${hit.meta ? `<div class="date">${hit.meta}</div>` : ""} 53838 <h5>${hit.title}</h5> 53839 </a> 53840 </div> 53841 ` 53842 } 53843 }) 53844 ]); 53845} 53846function initMediaSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3) { 53847 return instantsearch({ 53848 searchClient: typesenseAdapter.searchClient, 53849 indexName: "stpaulcenter", 53850 routing: false, 53851 ...initialQuery ? { 53852 searchFunction(helper) { 53853 helper.setQuery(initialQuery).search(); 53854 } 53855 } : {} 53856 }).addWidgets([ 53857 configure({ 53858 hitsPerPage, 53859 filters: "(categorization:=[articles] || categorization:=[videos] || categorization:=[podcasts])", 53860 query: initialQuery || "*" 53861 }), 53862 hits({ 53863 container: "#" + containerId, 53864 templates: { 53865 item: (hit) => ` 53866 <div class="media-card"> 53867 <a href="${hit.url}"> 53868 <h6>${hit.categorization[0] ? hit.categorization[0].replace("-", " ").replace("-", " ") : ""}</h6> 53869 <h5>${hit.title}</h5> 53870 </a> 53871 </div> 53872 ` 53873 } 53874 }) 53875 ]); 53876} 53877function initAllSection(typesenseAdapter, containerId, initialQuery = "", isPage = false, hitsPerPage = 3, filters = "") { 53878 const paginationId = `${containerId}-pagination`; 53879 return instantsearch({ 53880 searchClient: typesenseAdapter.searchClient, 53881 indexName: "stpaulcenter", 53882 ...initialQuery ? { 53883 searchFunction(helper) { 53884 if (!helper.state.query) { 53885 helper.setQuery(initialQuery); 53886 } 53887 helper.search(); 53888 } 53889 } : {} 53890 }).addWidgets([ 53891 configure({ 53892 hitsPerPage, 53893 filters, 53894 query: initialQuery || "*", 53895 page: 0 53896 }), 53897 hits({ 53898 container: "#" + containerId, 53899 templates: { 53900 item: (hit) => { 53901 const islibrary = hit.handle === "library"; 53902 const targetAttr = islibrary ? 'target="_blank"' : ""; 53903 return ` 53904 <div class="media-card ${islibrary ? "library-item" : ""}"> 53905 <a href="${hit.url}" ${targetAttr}> 53906 ${islibrary && hit.thumbnail_url ? `<div class="media-card"><img src="${hit.thumbnail_url}" alt="${hit.title}" class="library-thumbnail"/></div>` : ""} 53907 <h5>${hit.title}</h5> 53908 ${islibrary && hit.presenter ? `<div class="presenter">${hit.presenter}</div>` : ""} 53909 ${!islibrary && hit.meta ? `<div class="meta">${hit.meta}</div>` : ""} 53910 </a> 53911 </div> 53912 `; 53913 } 53914 } 53915 }), 53916 pagination({ 53917 container: "#" + paginationId, 53918 showFirst: true, 53919 showLast: true, 53920 showPrevious: true, 53921 showNext: true, 53922 scrollTo: false 53923 }) 53924 ]); 53925} 53926function setupSearchPageFilters(typesenseAdapter, contentSectionInstance) { 53927 const filterCheckboxes = document.querySelectorAll( 53928 '#content-type-filters input[type="checkbox"]' 53929 ); 53930 const contentSection = document.querySelector( 53931 ".search-page .search-section.content" 53932 ); 53933 const storeSection = document.querySelector( 53934 ".search-page .search-section.store" 53935 ); 53936 const librarySection = document.querySelector( 53937 ".search-page .search-section.library" 53938 );
53939 filterCheckboxes.forEach((checkbox) => { 53940 checkbox.addEventListener("change", () => { 53941 const activeFilters = Array.from(filterCheckboxes).filter((cb) => cb.checked).map((cb) => cb.value); 53942 if (activeFilters.length === 0) { 53943 storeSection.style.display = "block"; 53944 contentSection.style.display = "block"; 53945 librarySection.style.display = "block"; 53946 contentSectionInstance.helper.setQueryParameter("filters", "(categorization:=[page] || categorization:=[sunday-bible-reflections] || categorization:=[events] || categorization:=[articles] || categorization:=[videos] || categorization:=[podcasts])").search(); 53947 } else { 53948 storeSection.style.display = activeFilters.includes("store") ? "block" : "none"; 53949 librarySection.style.display = activeFilters.includes("library") ? "block" : "none"; 53950 const hasNonBookNonLibraryFilters = activeFilters.some( 53951 (filter) => filter !== "store" && filter !== "library" 53952 ); 53953 contentSection.style.display = hasNonBookNonLibraryFilters ? "block" : "none"; 53954 let contentFilters = []; 53955 activeFilters.forEach((filter) => { 53956 if (filter !== "store" && filter !== "library") { 53957 switch (filter) { 53958 case "pages": 53959 contentFilters.push("categorization:=[page]"); 53960 break; 53961 case "sunday-bible-reflections": 53962 contentFilters.push( 53963 "categorization:=[sunday-bible-reflections]" 53964 ); 53965 break; 53966 case "events": 53967 contentFilters.push("categorization:=[events]"); 53968 break; 53969 case "media": 53970 contentFilters.push( 53971 "(categorization:=[articles] || categorization:=[videos] || categorization:=[podcasts])" 53972 ); 53973 break; 53974 } 53975 } 53976 }); 53977 const filterString = contentFilters.length > 0 ? contentFilters.join(" || ") : ""; 53978 contentSectionInstance.helper.setQueryParameter("filters", filterString).search(); 53979 } 53980 const currentParams = new URLSearchParams(window.location.search); 53981 if (activeFilters.length > 0) { 53982 currentParams.set("type", activeFilters.join(",")); 53983 } else { 53984 currentParams.delete("type"); 53985 } 53986 const newUrl = `${window.location.pathname}${currentParams.toString() ? "?" + currentParams.toString() : ""}`; 53987 history.replaceState(window.history.state, "", newUrl); 53988 }); 53989 }); 53990} 53991function setupSearchListeners(search) { 53992 $$2("#searchbox").on("click", function() { 53993 search.helper.search(); 53994 }); 53995 $$2(".ais-SearchBox-reset, .overlay, .overlay-close").on( 53996 "click", 53997 function() { 53998 } 53999 ); 54000} 54001function getSectionMatches(results) { 54002 if (!results) { 54003 return { highest: null, total: null }; 54004 } 54005 const scores = results.hits.map((hit) => hit.text_match); 54006 const vectorScores = results.hits.map((hit) => hit.vector_distance); 54007 return { 54008 highest: Math.max(...scores), 54009 total: scores.reduce((a2, b2) => a2 + b2, 0), 54010 closest: Math.min(...vectorScores) 54011 }; 54012} 54013function reorderSearchDrawerSections() { 54014 const sorted = [...searchDrawerStates].sort((a2, b2) => { 54015 if (b2.highestTextMatch !== a2.highestTextMatch) { 54016 return b2.highestTextMatch - a2.highestTextMatch; 54017 } else { 54018 if (a2.name === "store" && b2.name !== "store") { 54019 return -1; 54020 } else if (b2.name === "store" && a2.name !== "store") { 54021 return 1; 54022 } else if (b2.totalTextMatch !== a2.totalTextMatch) { 54023 return b2.totalTextMatch - a2.totalTextMatch; 54024 } else { 54025 return a2.closestVectorMatch - b2.closestVectorMatch; 54026 } 54027 } 54028 }); 54029 const parent = document.querySelector("#hits-container"); 54030 sorted.forEach((section) => { 54031 parent.appendChild( 54032 document.querySelector(section.container).closest(".search-section") 54033 ); 54034 }); 54035} 54036let filtersCollapsed = null; 54037function updateButtonStates(storeBtn, contentBtn, libraryBtn, isCollapsed) { 54038 const allButtons = [storeBtn, contentBtn, libraryBtn]; 54039 allButtons.forEach((btn) => { 54040 if (btn) { 54041 const toggleText = btn.querySelector(".toggle-text"); 54042 const toggleIcon = btn.querySelector(".toggle-icon"); 54043 if (toggleText) 54044 toggleText.textContent = isCollapsed ? "Show Filters" : "Hide Filters"; 54045 if (toggleIcon) toggleIcon.textContent = isCollapsed ? "+" : "â"; 54046 } 54047 }); 54048} 54049function updateHeaderVisibility(storeSection, contentSection, librarySection, storeHeader, contentHeader, libraryHeader, storeBtn, contentBtn, libraryBtn, storeSectionHeader, contentSectionHeader, librarySectionHeader) { 54050 const storeVisible = storeSection && storeSection.style.display !== "none";
54051 const contentVisible = contentSection && contentSection.style.display !== "none"; 54052 const libraryVisible = librarySection && librarySection.style.display !== "none"; 54053 if (storeVisible && contentVisible && libraryVisible) { 54054 const searchSections = document.querySelector("#search-sections"); 54055 const sections = searchSections.querySelectorAll(".search-section"); 54056 let firstVisibleSection = null; 54057 for (let section of sections) { 54058 if (section.style.display !== "none") { 54059 firstVisibleSection = section; 54060 break; 54061 } 54062 } 54063 if (firstVisibleSection && firstVisibleSection.classList.contains("store")) { 54064 storeHeader.style.display = "flex"; 54065 contentHeader.style.display = "none"; 54066 libraryHeader.style.display = "none"; 54067 storeBtn.style.display = "flex"; 54068 contentBtn.style.display = "none"; 54069 libraryBtn.style.display = "none"; 54070 storeSectionHeader.style.display = "none"; 54071 contentSectionHeader.style.display = "flex"; 54072 librarySectionHeader.style.display = "flex"; 54073 } else if (firstVisibleSection && firstVisibleSection.classList.contains("content")) { 54074 storeHeader.style.display = "none"; 54075 contentHeader.style.display = "flex"; 54076 libraryHeader.style.display = "none"; 54077 storeBtn.style.display = "none"; 54078 contentBtn.style.display = "flex"; 54079 libraryBtn.style.display = "none"; 54080 storeSectionHeader.style.display = "flex"; 54081 contentSectionHeader.style.display = "none"; 54082 librarySectionHeader.style.display = "flex"; 54083 } else if (firstVisibleSection && firstVisibleSection.classList.contains("library")) { 54084 storeHeader.style.display = "none"; 54085 contentHeader.style.display = "none"; 54086 libraryHeader.style.display = "flex"; 54087 storeBtn.style.display = "none"; 54088 contentBtn.style.display = "none"; 54089 libraryBtn.style.display = "flex"; 54090 storeSectionHeader.style.display = "flex"; 54091 contentSectionHeader.style.display = "flex"; 54092 librarySectionHeader.style.display = "none"; 54093 } else { 54094 storeHeader.style.display = "flex"; 54095 contentHeader.style.display = "none"; 54096 libraryHeader.style.display = "none"; 54097 storeBtn.style.display = "flex"; 54098 contentBtn.style.display = "none"; 54099 libraryBtn.style.display = "none"; 54100 storeSectionHeader.style.display = "none"; 54101 contentSectionHeader.style.display = "flex"; 54102 librarySectionHeader.style.display = "flex"; 54103 } 54104 } else if (storeVisible && contentVisible) { 54105 const searchSections = document.querySelector("#search-sections"); 54106 const sections = searchSections.querySelectorAll(".search-section"); 54107 let firstVisibleSection = null; 54108 for (let section of sections) { 54109 if (section.style.display !== "none") { 54110 firstVisibleSection = section; 54111 break; 54112 } 54113 } 54114 if (firstVisibleSection && firstVisibleSection.classList.contains("store")) { 54115 storeHeader.style.display = "flex"; 54116 contentHeader.style.display = "none"; 54117 libraryHeader.style.display = "none"; 54118 storeBtn.style.display = "flex"; 54119 contentBtn.style.display = "none"; 54120 libraryBtn.style.display = "none"; 54121 storeSectionHeader.style.display = "none"; 54122 contentSectionHeader.style.display = "flex"; 54123 librarySectionHeader.style.display = "none"; 54124 } else if (firstVisibleSection && firstVisibleSection.classList.contains("content")) { 54125 storeHeader.style.display = "none"; 54126 contentHeader.style.display = "flex"; 54127 libraryHeader.style.display = "none"; 54128 storeBtn.style.display = "none"; 54129 contentBtn.style.display = "flex"; 54130 libraryBtn.style.display = "none"; 54131 storeSectionHeader.style.display = "flex"; 54132 contentSectionHeader.style.display = "none"; 54133 librarySectionHeader.style.display = "none"; 54134 } else { 54135 storeHeader.style.display = "flex"; 54136 contentHeader.style.display = "none"; 54137 libraryHeader.style.display = "none"; 54138 storeBtn.style.display = "flex"; 54139 contentBtn.style.display = "none"; 54140 libraryBtn.style.display = "none"; 54141 storeSectionHeader.style.display = "none"; 54142 contentSectionHeader.style.display = "flex"; 54143 librarySectionHeader.style.display = "none"; 54144 } 54145 } else if (storeVisible && libraryVisible) { 54146 const searchSections = document.querySelector("#search-sections"); 54147 const sections = searchSections.querySelectorAll(".search-section");
54148 let firstVisibleSection = null; 54149 for (let section of sections) { 54150 if (section.style.display !== "none") { 54151 firstVisibleSection = section; 54152 break; 54153 } 54154 } 54155 if (firstVisibleSection && firstVisibleSection.classList.contains("store")) { 54156 storeHeader.style.display = "flex"; 54157 contentHeader.style.display = "none"; 54158 libraryHeader.style.display = "none"; 54159 storeBtn.style.display = "flex"; 54160 contentBtn.style.display = "none"; 54161 libraryBtn.style.display = "none"; 54162 storeSectionHeader.style.display = "none"; 54163 contentSectionHeader.style.display = "none"; 54164 librarySectionHeader.style.display = "flex"; 54165 } else if (firstVisibleSection && firstVisibleSection.classList.contains("library")) { 54166 storeHeader.style.display = "none"; 54167 contentHeader.style.display = "none"; 54168 libraryHeader.style.display = "flex"; 54169 storeBtn.style.display = "none"; 54170 contentBtn.style.display = "none"; 54171 libraryBtn.style.display = "flex"; 54172 storeSectionHeader.style.display = "flex"; 54173 contentSectionHeader.style.display = "none"; 54174 librarySectionHeader.style.display = "none"; 54175 } else { 54176 storeHeader.style.display = "flex"; 54177 contentHeader.style.display = "none"; 54178 libraryHeader.style.display = "none"; 54179 storeBtn.style.display = "flex"; 54180 contentBtn.style.display = "none"; 54181 libraryBtn.style.display = "none"; 54182 storeSectionHeader.style.display = "none"; 54183 contentSectionHeader.style.display = "none"; 54184 librarySectionHeader.style.display = "flex"; 54185 } 54186 } else if (contentVisible && libraryVisible) { 54187 const searchSections = document.querySelector("#search-sections"); 54188 const sections = searchSections.querySelectorAll(".search-section"); 54189 let firstVisibleSection = null; 54190 for (let section of sections) { 54191 if (section.style.display !== "none") { 54192 firstVisibleSection = section; 54193 break; 54194 } 54195 } 54196 if (firstVisibleSection && firstVisibleSection.classList.contains("content")) { 54197 storeHeader.style.display = "none"; 54198 contentHeader.style.display = "flex"; 54199 libraryHeader.style.display = "none"; 54200 storeBtn.style.display = "none"; 54201 contentBtn.style.display = "flex"; 54202 libraryBtn.style.display = "none"; 54203 storeSectionHeader.style.display = "none"; 54204 contentSectionHeader.style.display = "none"; 54205 librarySectionHeader.style.display = "flex"; 54206 } else if (firstVisibleSection && firstVisibleSection.classList.contains("library")) { 54207 storeHeader.style.display = "none"; 54208 contentHeader.style.display = "none"; 54209 libraryHeader.style.display = "flex"; 54210 storeBtn.style.display = "none"; 54211 contentBtn.style.display = "none"; 54212 libraryBtn.style.display = "flex"; 54213 storeSectionHeader.style.display = "none"; 54214 contentSectionHeader.style.display = "flex"; 54215 librarySectionHeader.style.display = "none"; 54216 } else { 54217 storeHeader.style.display = "none"; 54218 contentHeader.style.display = "flex"; 54219 libraryHeader.style.display = "none"; 54220 storeBtn.style.display = "none"; 54221 contentBtn.style.display = "flex"; 54222 libraryBtn.style.display = "none"; 54223 storeSectionHeader.style.display = "none"; 54224 contentSectionHeader.style.display = "none"; 54225 librarySectionHeader.style.display = "flex"; 54226 } 54227 } else if (storeVisible) { 54228 storeHeader.style.display = "flex"; 54229 contentHeader.style.display = "none"; 54230 libraryHeader.style.display = "none"; 54231 storeBtn.style.display = "flex"; 54232 contentBtn.style.display = "none"; 54233 libraryBtn.style.display = "none"; 54234 storeSectionHeader.style.display = "none"; 54235 contentSectionHeader.style.display = "none"; 54236 librarySectionHeader.style.display = "none"; 54237 } else if (contentVisible) { 54238 storeHeader.style.display = "none"; 54239 contentHeader.style.display = "flex"; 54240 libraryHeader.style.display = "none"; 54241 storeBtn.style.display = "none"; 54242 contentBtn.style.display = "flex"; 54243 libraryBtn.style.display = "none"; 54244 storeSectionHeader.style.display = "none"; 54245 contentSectionHeader.style.display = "none"; 54246 librarySectionHeader.style.display = "none"; 54247 } else if (libraryVisible) { 54248 storeHeader.style.display = "none"; 54249 contentHeader.style.display = "none"; 54250 libraryHeader.style.display = "flex"; 54251 storeBtn.style.display = "none"; 54252 contentBtn.style.display = "none"; 54253 libraryBtn.style.display = "flex"; 54254 storeSectionHeader.style.display = "none"; 54255 contentSectionHeader.style.display = "none"; 54256 librarySectionHeader.style.display = "none"; 54257 } else { 54258 storeHeader.style.display = "none"; 54259 contentHeader.style.display = "none"; 54260 libraryHeader.style.display = "none"; 54261 storeBtn.style.display = "none"; 54262 contentBtn.style.display = "none"; 54263 libraryBtn.style.display = "none"; 54264 storeSectionHeader.style.display = "none"; 54265 contentSectionHeader.style.display = "none"; 54266 librarySectionHeader.style.display = "none"; 54267 } 54268} 54269function handleToggleClick(searchContainer, storeBtn, contentBtn, libraryBtn, isCollapsedRef) { 54270 const isCollapsed = searchContainer.classList.contains("filters-collapsed"); 54271 if (isCollapsed) { 54272 searchContainer.classList.remove("filters-collapsed"); 54273 isCollapsedRef.value = false;
54274 } else { 54275 searchContainer.classList.add("filters-collapsed"); 54276 isCollapsedRef.value = true; 54277 } 54278 updateButtonStates(storeBtn, contentBtn, libraryBtn, !isCollapsed); 54279} 54280function setupToggleFilters() { 54281 if (isSmallScreen() && filtersCollapsed === null) { 54282 filtersCollapsed = true; 54283 } 54284 const storeBtn = document.querySelector("#toggle-filters-store"); 54285 const contentBtn = document.querySelector("#toggle-filters-content"); 54286 const libraryBtn = document.querySelector("#toggle-filters-library"); 54287 const searchContainer = document.querySelector(".search-page-container"); 54288 const storeSection = document.querySelector(".search-section.store"); 54289 const contentSection = document.querySelector(".search-section.content"); 54290 const librarySection = document.querySelector(".search-section.library"); 54291 const storeHeader = document.querySelector(".store-header"); 54292 const contentHeader = document.querySelector(".content-header"); 54293 const libraryHeader = document.querySelector(".library-header"); 54294 const storeSectionHeader = document.querySelector(".store-section-header"); 54295 const contentSectionHeader = document.querySelector(".content-section-header"); 54296 const librarySectionHeader = document.querySelector(".library-section-header"); 54297 if (!storeBtn || !contentBtn || !libraryBtn || !searchContainer) return; 54298 const isCollapsedRef = { value: filtersCollapsed }; 54299 if (filtersCollapsed) { 54300 searchContainer.classList.add("filters-collapsed"); 54301 updateButtonStates(storeBtn, contentBtn, libraryBtn, true); 54302 } 54303 storeBtn.addEventListener( 54304 "click", 54305 () => handleToggleClick(searchContainer, storeBtn, contentBtn, libraryBtn, isCollapsedRef) 54306 ); 54307 contentBtn.addEventListener( 54308 "click", 54309 () => handleToggleClick(searchContainer, storeBtn, contentBtn, libraryBtn, isCollapsedRef) 54310 ); 54311 libraryBtn.addEventListener( 54312 "click", 54313 () => handleToggleClick(searchContainer, storeBtn, contentBtn, libraryBtn, isCollapsedRef) 54314 ); 54315 updateHeaderVisibility( 54316 storeSection, 54317 contentSection, 54318 librarySection, 54319 storeHeader, 54320 contentHeader, 54321 libraryHeader, 54322 storeBtn, 54323 contentBtn, 54324 libraryBtn, 54325 storeSectionHeader, 54326 contentSectionHeader, 54327 librarySectionHeader 54328 ); 54329 const observer = new MutationObserver(() => { 54330 updateHeaderVisibility( 54331 storeSection, 54332 contentSection, 54333 librarySection, 54334 storeHeader, 54335 contentHeader, 54336 libraryHeader, 54337 storeBtn, 54338 contentBtn, 54339 libraryBtn, 54340 storeSectionHeader, 54341 contentSectionHeader, 54342 librarySectionHeader 54343 ); 54344 }); 54345 const searchSections = document.querySelector("#search-sections"); 54346 if (searchSections) { 54347 observer.observe(searchSections, { 54348 childList: true, 54349 subtree: true 54350 }); 54351 } 54352 if (storeSection) { 54353 observer.observe(storeSection, { 54354 attributes: true, 54355 attributeFilter: ["style"] 54356 }); 54357 } 54358 if (contentSection) { 54359 observer.observe(contentSection, { 54360 attributes: true, 54361 attributeFilter: ["style"] 54362 }); 54363 } 54364} 54365function attachHeaderListeners() { 54366 var _a2; 54367 const header2 = document.querySelector("#header"); 54368 if (!header2) return; 54369 header2.querySelector("#menu-toggle").onclick = handleMenuToggleClick; 54370 (_a2 = header2.querySelector(".search-icon")) == null ? void 0 : _a2.addEventListener("click", handleSearchIconClick); 54371} 54372document.addEventListener("turbo:load", attachHeaderListeners); 54373function handleMenuToggleClick(e2) { 54374 e2.preventDefault(); 54375 if (getDrawerOpen$1() && getCurrentPage$1() == "big-menu") { 54376 setDrawerOpen$2(false); 54377 updateIcons(); 54378 } else { 54379 setDrawerOpen$2(true); 54380 setCurrentPage$1("big-menu"); 54381 if (window.outerWidth >= breakpoints.sm) loadLazyImages(); 54382 } 54383 updateIcons(); 54384} 54385function handleSearchIconClick(e2) { 54386 var _a2; 54387 e2.preventDefault(); 54388 if (getDrawerOpen$1() && getCurrentPage$1() == "search") { 54389 const searchInput = document.querySelector("#searchbox input"); 54390 if (searchInput) { 54391 searchInput.value = ""; 54392 } 54393 if (window._state && window._state.mainSearch) { 54394 const searchBoxWidget = window._state.mainSearch.getWidgets().find((widget) => widget.$$type === "ais.searchBox"); 54395 if (searchBoxWidget) { 54396 searchBoxWidget.setQuery(""); 54397 } 54398 window._state.mainSearch.helper.setQuery("").search(); 54399 if (window._state.popupSections) { 54400 window._state.popupSections.forEach((section) => { 54401 section.helper.setQuery("").search(); 54402 }); 54403 } 54404 } 54405 (_a2 = document.activeElement) == null ? void 0 : _a2.blur(); 54406 setDrawerOpen$2(false); 54407 updateIcons(); 54408 setTimeout(() => { 54409 const searchInput2 = document.querySelector("#searchbox input"); 54410 if (searchInput2) { 54411 searchInput2.value = ""; 54412 searchInput2.dispatchEvent(new Event("input", { bubbles: true })); 54413 } 54414 }, 50); 54415 } else { 54416 header.querySelector(".main-menu-search input").focus(); 54417 } 54418} 54419const headerCtx = gsapWithCSS.context(() => { 54420}); 54421document.addEventListener("turbo:load", async () => { 54422 headerCtx.revert(); 54423 headerCtx.add(() => { 54424 gsapWithCSS.to(".main-menu", { 54425 scrollTrigger: { 54426 trigger: ".content", 54427 start: 10, 54428 end: "bottom -500%", 54429 toggleActions: "play none none reverse", 54430 toggleClass: { targets: ["#header"], className: "scrolled" }, 54431 onToggle: (self2) => setTopMenuVisible(!self2.isActive) 54432 } 54433 }); 54434 }); 54435 await sleep$1(300); 54436 setUpSearch(); 54437}); 54438const getDrawerOpen$1 = () => document.querySelector(".main-menu-drawer").classList.contains("open"); 54439const setDrawerOpen$2 = (open) => { 54440 var _a2, _b2;
54441 const mainMenuDrawer = document.querySelector(".main-menu-drawer"); 54442 const drawerOpen = getDrawerOpen$1(); 54443 const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 54444 if (open && !drawerOpen) { 54445 mainMenuDrawer.classList.add("open"); 54446 mainMenuDrawer.dispatchEvent(new Event("open")); 54447 (_a2 = ScrollSmoother.get()) == null ? void 0 : _a2.paused(true); 54448 document.body.classList.add("no-scroll"); 54449 header.classList.add("no-transition"); 54450 document.documentElement.style.setProperty( 54451 "--scrollbar-compensate", 54452 `${scrollbarWidth}px` 54453 ); 54454 requestAnimationFrame(() => header.classList.remove("no-transition")); 54455 } else if (!open && drawerOpen) { 54456 mainMenuDrawer.classList.remove("open"); 54457 mainMenuDrawer.dispatchEvent(new Event("close")); 54458 (_b2 = ScrollSmoother.get()) == null ? void 0 : _b2.paused(false); 54459 document.body.classList.remove("no-scroll"); 54460 header.classList.add("no-transition"); 54461 document.documentElement.style.setProperty("--scrollbar-compensate", `0px`); 54462 requestAnimationFrame(() => header.classList.remove("no-transition")); 54463 } 54464}; 54465const getCurrentPage$1 = () => getDrawerOpen$1() ? document.querySelector(".main-menu-drawer .paginator").dataset.currentPage : null; 54466async function setCurrentPage$1(page2) { 54467 const currentPage = getCurrentPage$1(); 54468 if (currentPage == page2) return; 54469 const paginator = document.querySelector(".main-menu-drawer .paginator"); 54470 const currentPageNode = paginator.querySelector(`.${currentPage}`); 54471 paginator.dataset.currentPage = page2; 54472 if (currentPageNode) { 54473 currentPageNode.classList.remove("visible"); 54474 await sleep$1(300); 54475 } 54476 paginator.querySelector(`.${page2}`).classList.add("visible"); 54477 document.querySelector(".main-menu-drawer").dispatchEvent(new CustomEvent("changepage", { detail: { page: page2 } })); 54478} 54479const sleep$1 = (ms) => new Promise((res) => setTimeout(res, ms)); 54480const menuButtonIcons = { 54481 menu: '<span class="material-icons-outlined">menu</span>', 54482 close: '<span class="material-icons-outlined">close</span>' 54483}; 54484function updateIcons() { 54485 const drawerOpen = getDrawerOpen$1(); 54486 const currentPage = getCurrentPage$1(); 54487 const header2 = document.querySelector("#header"); 54488 const menuButton = header2.querySelector("#menu-toggle"); 54489 const newMenuButtonState = drawerOpen && currentPage == "big-menu" ? "close" : "menu"; 54490 menuButton.innerHTML = menuButtonIcons[newMenuButtonState]; 54491 menuButton.dataset.state = newMenuButtonState; 54492 const searchIcon = header2.querySelector(".search-icon"); 54493 const newSearchIconState = drawerOpen && currentPage == "search" ? "close" : "search"; 54494 searchIcon.innerHTML = newSearchIconState; 54495 searchIcon.dataset.state = newSearchIconState; 54496} 54497function setUpSearch() { 54498 var _a2; 54499 if (!document.querySelector("#searchbox") && !document.querySelector("#searchbar")) { 54500 return; 54501 } 54502 initSearch(); 54503 (_a2 = document.querySelector(".main-menu-search input")) == null ? void 0 : _a2.addEventListener("focus", async () => { 54504 setDrawerOpen$2(true); 54505 setCurrentPage$1("search"); 54506 updateIcons(); 54507 }); 54508} 54509function loadLazyImages() { 54510 document.querySelectorAll(".big-menu .lazy-header-img:not([src])").forEach((img) => { 54511 img.src = img.dataset.src; 54512 }); 54513} 54514document.addEventListener("turbo:load", () => { 54515 const menuItems = document.querySelectorAll( 54516 ".dropdown-menu .dropdown-menu-item" 54517 ); 54518 menuItems.forEach((item3) => { 54519 const dropdownContent = item3.querySelector(".dropdown-content"); 54520 const arrow = item3.querySelector(".arrow"); 54521 gsapWithCSS.set(dropdownContent, { height: 0, autoAlpha: 0 }); 54522 item3.addEventListener("mouseenter", () => { 54523 menuItems.forEach((otherItem) => { 54524 if (otherItem !== item3) { 54525 const otherContent = otherItem.querySelector(".dropdown-content"); 54526 const otherArrow = otherItem.querySelector(".arrow"); 54527 if (otherContent.classList.contains("active")) { 54528 gsapWithCSS.to(otherContent, { 54529 height: 0, 54530 autoAlpha: 0, 54531 duration: 0.3 54532 }); 54533 gsapWithCSS.to(otherArrow, { 54534 rotation: 0, 54535 duration: 0.3 54536 }); 54537 otherContent.classList.remove("active"); 54538 } 54539 } 54540 }); 54541 gsapWithCSS.to(dropdownContent, { 54542 height: "auto", 54543 autoAlpha: 1, 54544 duration: 0.3 54545 }); 54546 gsapWithCSS.to(arrow, { 54547 rotation: 180, 54548 duration: 0.3 54549 }); 54550 dropdownContent.classList.add("active"); 54551 }); 54552 item3.addEventListener("mouseleave", () => { 54553 gsapWithCSS.to(dropdownContent, { 54554 height: 0, 54555 autoAlpha: 0, 54556 duration: 0.3 54557 }); 54558 gsapWithCSS.to(arrow, { 54559 rotation: 0, 54560 duration: 0.3 54561 }); 54562 dropdownContent.classList.remove("active"); 54563 }); 54564 }); 54565}); 54566document.addEventListener("turbo:load", () => { 54567 setHeaderHeight(); 54568}); 54569function setTopMenuVisible(visible) { 54570 const topMenu = document.querySelector(".menu"); 54571 if (!topMenu) return; 54572 const topMenuVisible = topMenu.clientHeight > 0; 54573 if (visible == topMenuVisible) return; 54574 if (visible) { 54575 gsapWithCSS.to(topMenu, { 54576 duration: 0.3, 54577 ease: "power1.in", 54578 height: "auto", 54579 y: "0", 54580 autoAlpha: 1 54581 }); 54582 } else { 54583 gsapWithCSS.to(topMenu, { 54584 duration: 0.3, 54585 ease: "power1.out", 54586 height: 0, 54587 y: "-100%", 54588 autoAlpha: 0 54589 }); 54590 } 54591} 54592window.addEventListener("resize", setHeaderHeight); 54593function setHeaderHeight() { 54594 if ($$2(".white-header").length || $$2("#body.posts").length) { 54595 const header2 = document.querySelector("#header"); 54596 if (!header2) return; 54597 const headerHeight = header2.getBoundingClientRect().height + 24; 54598 document.documentElement.style.setProperty( 54599 `--header-height`, 54600 `${headerHeight}px` 54601 ); 54602 } else { 54603 document.documentElement.style.setProperty(`--header-height`, `0px`); 54604 } 54605} 54606document.addEventListener("turbo:load", (e2) => { 54607 if (!document.querySelector(".top-menu-drawer")) return; 54608 const url = new URL(e2.detail.url); 54609 if (url.searchParams.has("top-menu")) { 54610 setDrawerOpen$1(true); 54611 setCurrentPage(url.searchParams.get("top-menu")); 54612 removeSearchParam("top-menu"); 54613 } 54614 document.querySelector(".top-menu-drawer").addEventListener("click", (e3) => {
54615 if (e3.target.classList.contains("drawer-overlay") && getDrawerOpen()) { 54616 setDrawerOpen$1(false); 54617 } 54618 }); 54619 document.querySelector(".top-menu-drawer-buttons").onclick = (e3) => { 54620 const button = e3.target.closest(".menu-button"); 54621 if (button.dataset.page) { 54622 const page2 = button.dataset.page; 54623 const currentPage = getCurrentPage(); 54624 const drawerOpen = getDrawerOpen(); 54625 if (drawerOpen && currentPage == page2) { 54626 setCurrentPage(null); 54627 setDrawerOpen$1(false); 54628 } else { 54629 setDrawerOpen$1(true); 54630 setCurrentPage(page2); 54631 } 54632 } 54633 }; 54634}); 54635const getDrawerOpen = () => document.querySelector(".top-menu-drawer").classList.contains("open"); 54636const setDrawerOpen$1 = (open) => { 54637 var _a2, _b2; 54638 const drawer = document.querySelector(".top-menu-drawer"); 54639 const drawerOpen = getDrawerOpen(); 54640 if (open && !drawerOpen) { 54641 drawer.classList.add("open"); 54642 drawer.dispatchEvent(new Event("open")); 54643 (_a2 = ScrollSmoother.get()) == null ? void 0 : _a2.paused(true); 54644 setTopMenuVisible(true); 54645 } else if (!open && drawerOpen) { 54646 const currentPage = getCurrentPage(); 54647 if (currentPage) { 54648 setCurrentPage(null); 54649 } 54650 drawer.classList.remove("open"); 54651 drawer.dispatchEvent(new Event("close")); 54652 (_b2 = ScrollSmoother.get()) == null ? void 0 : _b2.paused(false); 54653 if (document.querySelector("#header.scrolled")) setTopMenuVisible(false); 54654 } 54655}; 54656const getCurrentPage = () => getDrawerOpen() ? document.querySelector(".top-menu-drawer .paginator").dataset.currentPage : null; 54657async function setCurrentPage(page2) { 54658 var _a2, _b2; 54659 const currentPage = getCurrentPage(); 54660 if (currentPage == page2) return; 54661 const buttons = document.querySelector(".top-menu-drawer-buttons"); 54662 const selectedButton = buttons.querySelector(".selected"); 54663 const pageButton = buttons.querySelector(`*[data-page="${page2}"]`); 54664 if (selectedButton && selectedButton != pageButton) 54665 selectedButton.classList.remove("selected"); 54666 if (pageButton) pageButton.classList.add("selected"); 54667 const paginator = document.querySelector(".top-menu-drawer .paginator"); 54668 const currentPageNode = paginator.querySelector(`.${currentPage}`); 54669 paginator.dataset.currentPage = page2; 54670 if (currentPageNode) { 54671 currentPageNode.classList.remove("visible"); 54672 await sleep(300); 54673 } 54674 (_b2 = (_a2 = paginator.querySelector(`.${page2}`)) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.add("visible"); 54675 document.querySelector(".top-menu-drawer").dispatchEvent(new CustomEvent("changepage", { detail: { page: page2 } })); 54676} 54677const sleep = (ms) => new Promise((res) => setTimeout(res, ms)); 54678function removeSearchParam(key2) { 54679 const url = new URL(window.location.href); 54680 const params = new URLSearchParams(url.search); 54681 params.delete(key2); 54682 url.search = params.toString(); 54683 window.history.pushState({}, document.title, url); 54684} 54685document.addEventListener("turbo:load", async () => { 54686 await awaitShopInitialized(); 54687 const cartPage = document.querySelector(".cart-page"); 54688 if (!cartPage) return; 54689 cartPage.onclick = (e2) => { 54690 if (e2.target.classList.contains("adjust-button")) handleAdjustClick(e2); 54691 else if (e2.target.classList.contains("cart-continue-shopping")) 54692 setDrawerOpen$1(false); 54693 }; 54694 updateCartMenu(getCart(), getCartError()); 54695}); 54696function updateCartMenu(cart, cartError) { 54697 const cartPage = document.querySelector(".cart-page"); 54698 setBadgeCount(cart.totalQuantity); 54699 if (cartPage) cartPage.innerHTML = renderCart({ cart, cartError }); 54700} 54701function renderCart({ cart, cartError }) { 54702 const currencyCode = cart.cost.subtotalAmount.currencyCode; 54703 let cartListItems = "";
54704 cart.lines.nodes.forEach( 54705 (item3) => cartListItems += renderCartListItem({ item: item3, currencyCode }) 54706 ); 54707 const loading = cart.lines.nodes.some((l2) => l2.loading); 54708 return cart.lines.nodes.length == 0 ? renderEmptyCart({ cartError }) : ` 54709 ${cartError ? `<div class="cart-error">${cartError}</div>` : ""} 54710 <div class="cart-list"> 54711 <div class="cart-list-header"> 54712 <div>Item</div> 54713 <div class="quantity-section"> 54714 <div>Quantity</div> 54715 <div class="header-cost">Cost</div> 54716 </div> 54717 </div> 54718 <div class="cart-list-items">${cartListItems}</div> 54719 </div> 54720 <div class="bottom-section"> 54721 <button 54722 class="cart-continue-shopping outlined white" 54723 > 54724 Continue Shopping 54725 </button> 54726 <div class="subtotal-section"> 54727 <div class="subtotal"> 54728 <div>Subtotal (tax excl.)</div> 54729 <div class="subtotal-price"> 54730 ${loading ? "<div class='skeleton text'>$xx.xx</div>" : formatCurrency( 54731 cart.cost.subtotalAmount.amount, 54732 currencyCode 54733 )}
54733 54734 </div> 54735 </div> 54736 <a 54737 class="button filled white ${loading ? "disabled" : ""}" 54738 href=${getCheckoutUrl(cart)} 54739 > 54740 Checkout 54741 </a> 54742 </div> 54743 </div> 54744 `; 54745} 54746const renderEmptyCart = ({ cartError }) => ` 54747 <div class="empty-cart"> 54748 <div> 54749 <h3>Your cart is empty.</h3> 54750 ${cartError ? `<div class="cart-error">${cartError}</div>` : ""} 54751 </div> 54752 <a class="button filled white" href="/store">Start Shopping</a> 54753 </div> 54754`; 54755function renderCartListItem({ item: item3, currencyCode }) { 54756 var _a2, _b2; 54757 const productHasOnlyDefaultVariant = item3.merchandise.product.variantsCount.count == 1; 54758 const lineTitle = productHasOnlyDefaultVariant ? item3.merchandise.product.title : `${item3.merchandise.product.title} - ${item3.merchandise.title}`; 54759 const loading = item3.loading; 54760 return ` 54761 <div class='line' data-id='${item3.id}'> 54762 <div class="line-info"> 54763 <a 54764 class='line-title' 54765 href='/products/${item3.merchandise.product.handle}' 54766 > 54767 ${lineTitle} 54768 </a> 54769 ${((_a2 = item3.merchandise.product.stock_status) == null ? void 0 : _a2.value) ? ` 54770 <span class='stock-status ${item3.merchandise.product.stock_status.value === "Pre-release" ? "pre-order" : item3.merchandise.product.stock_status.value.toLowerCase().replaceAll(" ", "-")}'> 54771 ${item3.merchandise.product.stock_status.value === "Pre-release" ? "Pre-order" : item3.merchandise.product.stock_status.value}${((_b2 = item3.merchandise.product.when_available) == null ? void 0 : _b2.value) ? `: Available ${item3.merchandise.product.when_available.value}` : ""} 54772 </span> 54773 ` : ""} 54774 </div> 54775 <div class="quantity-section"> 54776 <div class='line-quantity'> 54777 <span 54778 class=' 54779 material-icons 54780 remove-quantity 54781 adjust-button 54782 ${loading ? "disabled" : ""} 54783 ' 54784 data-quantity='${item3.quantity - 1}' 54785 > 54786 remove_circle_outline 54787 </span> 54788 ${item3.quantity} 54789 <span 54790 class=' 54791 material-icons 54792 add-quantity 54793 adjust-button 54794 ${loading ? "disabled" : ""} 54795 ' 54796 data-quantity='${item3.quantity + 1}' 54797 > 54798 add_circle_outline 54799 </span> 54800 </div> 54801 <div class='remove-item'> 54802 <span 54803 class=' 54804 material-icons 54805 adjust-button 54806 zero-quantity 54807 ${loading ? "disabled" : ""} 54808 ' 54809 data-quantity='0' 54810 > 54811 delete_outline 54812 </span> 54813 </div> 54814 <div class='line-total'> 54815 ${loading || item3.cost.subtotalAmount.amount === item3.cost.totalAmount.amount ? "" : `<span class="compare-at-price">${formatCurrency(item3.cost.subtotalAmount.amount, currencyCode)}</span>`} 54816 ${loading ? "<div class='skeleton text'>$xx.xx</div>" : formatCurrency(item3.cost.totalAmount.amount, currencyCode)} 54817 </div> 54818 </div> 54819 </div> 54820 `; 54821} 54822function setBadgeCount(count) { 54823 const countBadge = document.querySelector(".cart-count-badge"); 54824 if (count > 0) { 54825 countBadge.innerText = count; 54826 countBadge.classList.remove("hidden"); 54827 } else { 54828 countBadge.innerText = ""; 54829 countBadge.classList.add("hidden"); 54830 } 54831} 54832function getCheckoutUrl(cart) { 54833 let checkoutUrl; 54834 if (SESSION_DATA.is_logged_in) { 54835 checkoutUrl = cart.checkoutUrl; 54836 } else { 54837 const url = new URL(cart.checkoutUrl); 54838 const checkoutUrlWithoutHost = url.pathname + url.search; 54839 checkoutUrl = `https://${shopifySite}/account/logout?return_url=${encodeURIComponent( 54840 checkoutUrlWithoutHost 54841 )}`; 54842 } 54843 return checkoutUrl; 54844} 54845async function handleAdjustClick({ target }) { 54846 try { 54847 const quantity = parseInt(target.dataset.quantity); 54848 const lineId = target.closest(".line").dataset.id; 54849 setLoadingCart( 54850 [{ quantity, id: lineId }], 54851 quantity == 0 ? "delete" : "update" 54852 );
54853 let cart = getCart(); 54854 if (quantity === 0) { 54855 cart = await removeItemFromCart(cart.id, [lineId]); 54856 } else { 54857 cart = await updateItemInCart(cart.id, lineId, quantity); 54858 } 54859 setCart(cart); 54860 } catch (error2) { 54861 console.error(error2); 54862 rollbackLoadingCart(); 54863 setCartError(error2); 54864 } 54865} 54866const BUY_NOW_REGEX = /^\/buy-now(\/$)?$/i; 54867document.addEventListener("turbo:load", async () => { 54868 if (!window.location.pathname.match(BUY_NOW_REGEX)) return; 54869 try { 54870 await processBuyNow(); 54871 } catch (e2) { 54872 console.error(e2); 54873 setCartError(e2.message ?? e2.toString(), false); 54874 window.location.href = "/cart"; 54875 } 54876}); 54877async function processBuyNow() { 54878 var _a2; 54879 await awaitShopInitialized(); 54880 const itemsParam = getAndRemoveSearchParam$1("items"); 54881 const ids = (itemsParam == null ? void 0 : itemsParam.split(",").filter(Boolean)) || []; 54882 if (!ids.length) throw new Error("No items provided"); 54883 const discountCodes = ((_a2 = getAndRemoveSearchParam$1("discount")) == null ? void 0 : _a2.split(",")) || []; 54884 const attributes = []; 54885 const attributesParam = getAndRemoveSearchParam$1("attributes"); 54886 if (attributesParam) { 54887 attributesParam.split(",").forEach((attribute) => { 54888 const [key2, value = "true"] = attribute.split(":"); 54889 attributes.push({ key: key2, value }); 54890 }); 54891 } 54892 const lines = await getLinesFromIds(ids, { format: "input" }); 54893 if (!lines.length) 54894 throw new Error( 54895 `No ${pluralize("product", ids.length)} could be found with ${pluralize("id", ids.length)} ${toSentence(ids, { lastSeparator: "or" })}` 54896 ); 54897 const multipassToken = getAndRemoveSearchParam$1("spc_multipass"); 54898 const customerAccessToken = await getBuyNowCustomerAccessToken(multipassToken); 54899 let response = await executeGraphQL(CREATE_CART_MUTATION, { 54900 input: { 54901 buyerIdentity: { 54902 customerAccessToken 54903 }, 54904 lines, 54905 discountCodes, 54906 attributes 54907 } 54908 }); 54909 if (response.cartCreate.userErrors[0]) 54910 throw new Error(response.cartCreate.userErrors[0].message); 54911 const cart = response.cartCreate.cart; 54912 logCartActivity({ 54913 action: "buyNow", 54914 cartId: cart.id, 54915 hasCustomerAccessToken: !!customerAccessToken, 54916 discountCodes, 54917 lines: lines.map((l2) => ({ 54918 merchandiseId: l2.merchandiseId, 54919 quantity: l2.quantity 54920 })) 54921 }); 54922 window.location.href = cart.checkoutUrl; 54923} 54924async function getBuyNowCustomerAccessToken(multipassToken) { 54925 if (!multipassToken) return getCustomerAccessToken(); 54926 try { 54927 const token = await createCustomerAccessToken(multipassToken); 54928 return token.accessToken; 54929 } catch (e2) { 54930 console.error("Failed to exchange Multipass token for checkout", e2); 54931 return null; 54932 } 54933} 54934function getAndRemoveSearchParam$1(key2) { 54935 const searchParams = new URLSearchParams(window.location.search); 54936 const value = searchParams.get(key2); 54937 searchParams.delete(key2); 54938 const searchString = searchParams.size ? `?${searchParams}` : ""; 54939 window.history.replaceState( 54940 null, 54941 "", 54942 `${window.location.pathname}${searchString}` 54943 ); 54944 return value; 54945} 54946const shopifySite = "0d83c4-8f.myshopify.com"; 54947let shopInitialized = false; 54948document.addEventListener("DOMContentLoaded", async () => { 54949 var _a2; 54950 if (!localStorage.getItem("cart-reset")) { 54951 localStorage.removeItem("cart"); 54952 localStorage.setItem("cart-reset", "true"); 54953 } 54954 const storedCart = getCart(); 54955 const refreshedCart = storedCart ? await getCart$1(storedCart.id) : null; 54956 let cart = refreshedCart ? refreshedCart : await createCart(); 54957 if (SESSION_DATA.current_user_email != ((_a2 = cart.buyerIdentity.customer) == null ? void 0 : _a2.email)) { 54958 const customerAccessToken = await getCustomerAccessToken(); 54959 if (customerAccessToken) { 54960 cart = await setBuyerIdentity( 54961 cart, 54962 customerAccessToken, 54963 SESSION_DATA.current_user_email 54964 ); 54965 } 54966 } 54967 setCart(cart, false); 54968 shopInitialized = true; 54969 document.dispatchEvent(new CustomEvent("shop:initialized")); 54970 await sleep$2(1e3); 54971 setCartError(null, false); 54972}); 54973const awaitShopInitialized = () => shopInitialized ? true : new Promise((res) => document.addEventListener("shop:initialized", res)); 54974function updatePage(cart, cartError) { 54975 updateCartMenu(cart, cartError); 54976 if (onCartPage()) updateCartPage(cart, cartError); 54977 if (cartError) setCartError(null, false); 54978} 54979const CART_PAGE_REGEX = /^\/cart(\/$)?$/i; 54980const onCartPage = () => window.location.pathname.match(CART_PAGE_REGEX); 54981function getCart() { 54982 return JSON.parse(window.localStorage.getItem("cart")); 54983} 54984function setCart(cart, updateUI = true) { 54985 window.localStorage.setItem("cart", JSON.stringify(cart)); 54986 if (updateUI) updatePage(cart, getCartError()); 54987} 54988let preLoadingState = null; 54989function setLoadingCart(lines, mutation = "add") { 54990 const cart = getCart(); 54991 preLoadingState = JSON.parse(JSON.stringify(cart));
54992 lines.forEach((line) => { 54993 let cartLine = cart.lines.nodes.find( 54994 (l2) => { 54995 var _a2; 54996 return line.id && l2.id == line.id || ((_a2 = line.merchandise) == null ? void 0 : _a2.id) == l2.merchandise.id; 54997 } 54998 ); 54999 if (cartLine) { 55000 cartLine.loading = true; 55001 if (mutation == "update") cartLine.quantity = line.quantity; 55002 else if (mutation == "add") cartLine.quantity += line.quantity; 55003 } else { 55004 cart.lines.nodes.unshift({ ...line, loading: true }); 55005 } 55006 }); 55007 setCart(cart); 55008} 55009function rollbackLoadingCart() { 55010 if (!preLoadingState) return; 55011 setCart(preLoadingState); 55012 preLoadingState = null; 55013} 55014function getCartError() { 55015 return JSON.parse(sessionStorage.getItem("cart-error")); 55016} 55017function setCartError(error2, updateUI = true) { 55018 sessionStorage.setItem("cart-error", JSON.stringify(error2)); 55019 if (updateUI) { 55020 const cart = getCart(); 55021 cart.lines.nodes.forEach((l2) => { 55022 if (l2.loading) l2.loading = false; 55023 }); 55024 updatePage(cart, error2); 55025 } 55026} 55027function formatCurrency(amount, code = "USD") { 55028 let format2 = new Intl.NumberFormat("en-US", { 55029 style: "currency", 55030 currency: code 55031 }); 55032 return format2.format(amount); 55033} 55034async function getCustomerAccessToken() { 55035 if (!SESSION_DATA.is_logged_in) return null; 55036 const storedToken = JSON.parse( 55037 window.localStorage.getItem("customerAccessToken") 55038 ); 55039 const tokenExpired = storedToken && new Date(storedToken.expiresAt) < /* @__PURE__ */ new Date(); 55040 const currentUserEmail = SESSION_DATA.current_user_email; 55041 const userMatches = (storedToken == null ? void 0 : storedToken.user_email) == currentUserEmail; 55042 if (!tokenExpired && userMatches) return storedToken.accessToken; 55043 const multipassToken = await getMultipassToken(); 55044 if (!multipassToken) return null; 55045 const newToken = await createCustomerAccessToken(multipassToken); 55046 newToken.user_email = currentUserEmail; 55047 window.localStorage.setItem("customerAccessToken", JSON.stringify(newToken)); 55048 return newToken.accessToken; 55049} 55050document.addEventListener("turbo:load", async () => { 55051 if (window.location.pathname.startsWith("/buy-now")) return; 55052 await awaitShopInitialized(); 55053 handleAddToCartParam(); 55054 handleDiscountParam(); 55055}); 55056function handleAddToCartParam() { 55057 const addToCartParam = getAndRemoveSearchParam("add_to_cart") ?? getAndRemoveSearchParam("add-to-cart"); 55058 if (!addToCartParam) return; 55059 const ids = addToCartParam.split(","); 55060 if (ids.length) addToCart(ids); 55061} 55062function handleDiscountParam() { 55063 const discountParam = getAndRemoveSearchParam("discount"); 55064 if (!discountParam) return; 55065 const discountCodes = discountParam.split(","); 55066 if (discountCodes.length) addDiscounts(discountCodes); 55067} 55068async function addToCart(ids) { 55069 var _a2; 55070 const lines = await getLinesFromIds(ids); 55071 if (lines.length == 0) return; 55072 setLoadingCart(lines); 55073 if (!onCartPage()) { 55074 setDrawerOpen$1(true); 55075 setCurrentPage("cart-page"); 55076 } 55077 const cartLinesAddResponse = await executeGraphQL(ADD_LINES_MUTATION, { 55078 cartId: getCart().id, 55079 lines: lines.map((l2) => ({ 55080 merchandiseId: l2.merchandise.id, 55081 quantity: l2.quantity, 55082 sellingPlanId: l2.sellingPlanId 55083 })) 55084 }); 55085 const error2 = (_a2 = cartLinesAddResponse.cartLinesAdd.userErrors[0]) == null ? void 0 : _a2.message; 55086 if (error2) { 55087 rollbackLoadingCart(); 55088 setCartError(error2); 55089 } else { 55090 logCartActivity({ 55091 action: "addToCart", 55092 cartId: getCart().id, 55093 lines: lines.map((l2) => ({ 55094 merchandiseId: l2.merchandise.id, 55095 quantity: l2.quantity, 55096 sellingPlanId: l2.sellingPlanId 55097 })) 55098 }); 55099 setCart(cartLinesAddResponse.cartLinesAdd.cart); 55100 } 55101} 55102async function setDiscounts(discountCodes) { 55103 var _a2; 55104 const cartId = getCart().id; 55105 const response = await executeGraphQL(UPDATE_DISCOUNTS_MUTATION, { 55106 cartId, 55107 discountCodes 55108 }); 55109 const error2 = (_a2 = response.cartDiscountCodesUpdate.userErrors[0]) == null ? void 0 : _a2.message; 55110 if (error2) { 55111 setCartError(error2); 55112 } else { 55113 logCartActivity({ action: "updateDiscounts", cartId, discountCodes }); 55114 setCart(response.cartDiscountCodesUpdate.cart); 55115 } 55116} 55117async function addDiscounts(codes) { 55118 const currentCodes = getCart().discountCodes.map((c2) => c2.code); 55119 const codesToAdd = codes.filter((c2) => !currentCodes.includes(c2)); 55120 if (codesToAdd.length) await setDiscounts([...currentCodes, ...codesToAdd]); 55121} 55122async function getLinesFromIds(ids, { format: format2 = "output" } = {}) { 55123 const lines = await awaitAll(ids.map((id2) => getLineFromId(id2, { format: format2 }))); 55124 return lines.filter((line) => line != null); 55125} 55126async function getLineFromId(id2, { format: format2 = "output" }) { 55127 var _a2, _b2, _c, _d; 55128 const variantId = id2.startsWith("gid://shopify/ProductVariant") ? id2 : `gid://shopify/ProductVariant/${id2}`;
55129 const variant = await getVariant(variantId); 55130 if (!variant) return null; 55131 const line = { 55132 quantity: 1 55133 }; 55134 if (format2 == "input") line.merchandiseId = variant.id; 55135 else if (format2 == "output") line.merchandise = variant; 55136 if ((_d = (_c = (_b2 = (_a2 = variant.sellingPlanAllocations) == null ? void 0 : _a2.nodes) == null ? void 0 : _b2[0]) == null ? void 0 : _c.sellingPlan) == null ? void 0 : _d.id) { 55137 line.sellingPlanId = variant.sellingPlanAllocations.nodes[0].sellingPlan.id; 55138 } 55139 return line; 55140} 55141const awaitAll = async (promises) => (await Promise.allSettled(promises)).map(({ value }) => value); 55142function getAndRemoveSearchParam(key2) { 55143 const searchParams = new URLSearchParams(window.location.search); 55144 const value = searchParams.get(key2); 55145 if (!value) return null; 55146 searchParams.delete(key2); 55147 const searchString = searchParams.size ? `?${searchParams}` : ""; 55148 window.history.replaceState( 55149 null, 55150 "", 55151 `${window.location.pathname}${searchString}` 55152 ); 55153 return value; 55154} 55155class addToCartController extends Controller { 55156 add(event) { 55157 event.preventDefault(); 55158 addToCart(this.variantIdsValue.split(",")); 55159 } 55160} 55161__publicField(addToCartController, "values", { variantIds: String }); 55162const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 55163 __proto__: null, 55164 default: addToCartController 55165}, Symbol.toStringTag, { value: "Module" })); 55166class ModalController extends Controller { 55167 connect() { 55168 this.element.dataset.action = "click->modal#handleOverlayClick"; 55169 this.element.querySelectorAll(".modal-close").forEach((el) => { 55170 el.dataset.action = "click->modal#close"; 55171 }); 55172 } 55173 close() { 55174 this.element.classList.remove("open"); 55175 } 55176 handleOverlayClick({ target }) { 55177 if (target == this.element) this.close(); 55178 } 55179} 55180const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 55181 __proto__: null, 55182 default: ModalController 55183}, Symbol.toStringTag, { value: "Module" })); 55184window.Stimulus = Application.start(); 55185function getControllerName(path) { 55186 const fileName = path.split("/").pop(); 55187 let name = fileName.replace("Controller.js", ""); 55188 name = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 55189 return name; 55190} 55191const controllerModules = /* @__PURE__ */ Object.assign({ 55192 "./addToCartController.js": __vite_glob_0_0, 55193 "./modalController.js": __vite_glob_0_1 55194}); 55195Object.entries(controllerModules).forEach(([path, controllerModule]) => { 55196 Stimulus.register(getControllerName(path), controllerModule.default); 55197}); 55198document.addEventListener("turbo:load", function() { 55199 const tabs = document.querySelectorAll(".tab-container .tab");
55200 tabs.forEach((tab, index3) => { 55201 if (index3 !== 0) { 55202 gsapWithCSS.set(tab, { autoAlpha: 0, display: "none" }); 55203 } 55204 }); 55205 const tabTitles = document.querySelectorAll(".tab-title"); 55206 let currentTab = tabs[0]; 55207 $$2(tabTitles[0]).addClass("active"); 55208 tabTitles.forEach((title) => { 55209 title.addEventListener("click", () => { 55210 const targetTabId = title.getAttribute("data-tab-id"); 55211 const targetTab = document.querySelector(targetTabId); 55212 if (targetTab !== currentTab) { 55213 gsapWithCSS.to(currentTab, { 55214 autoAlpha: 0, 55215 duration: 0.3, 55216 onComplete: () => { 55217 gsapWithCSS.set(currentTab, { display: "none" }); 55218 gsapWithCSS.set(targetTab, { display: "block" }); 55219 gsapWithCSS.to(targetTab, { 55220 autoAlpha: 1, 55221 duration: 0.3 55222 }); 55223 currentTab = targetTab; 55224 } 55225 }); 55226 tabTitles.forEach((t2) => t2.classList.remove("active")); 55227 title.classList.add("active"); 55228 } 55229 }); 55230 }); 55231 setTimeout(activateTabFromHash, 500); 55232 window.addEventListener("hashchange", activateTabFromHash); 55233}); 55234function activateTabFromHash() { 55235 var hash = window.location.hash; 55236 if (hash) { 55237 var tabLink = document.querySelector('[data-tab-id="' + hash + '"]'); 55238 if (tabLink) { 55239 let sm2 = ScrollSmoother.get(); 55240 if (sm2) { 55241 sm2.scrollTo(tabLink); 55242 } else { 55243 tabLink.scrollIntoView({ behavior: "smooth" }); 55244 } 55245 tabLink.click(); 55246 } 55247 } 55248} 55249document.addEventListener("DOMContentLoaded", () => { 55250 animateHeroText(); 55251}); 55252document.addEventListener("turbo:load", async () => { 55253 const heroBlocks = document.querySelectorAll(".hero-text"); 55254 heroBlocks.forEach((block) => { 55255 const container = block.closest(".block-container"); 55256 ScrollTrigger$1.create({ 55257 trigger: container, 55258 onUpdate: (self2) => { 55259 self2.trigger.style.opacity = 1 - round(self2.progress, 2); 55260 }, 55261 // Start when the center of the section is in the center of the viewport. 55262 start: "center center" 55263 // End when the bottom of the section is at the top of the viewport (default). 55264 }); 55265 }); 55266 const scroll = document.querySelectorAll(".hero-text-scroll"); 55267 scroll.forEach((scroll2) => { 55268 let scrollTl = gsapWithCSS.timeline({ repeat: -1 }); 55269 scrollTl.to(scroll2, { y: 10, duration: 1 }); 55270 scrollTl.to(scroll2, { y: 0, duration: 1 }); 55271 $$2(scroll2).on("click", function(e2) { 55272 const sm2 = ScrollSmoother.get(); 55273 if (sm2) { 55274 sm2.scrollTo(scroll2, true); 55275 } else { 55276 scroll2.scrollIntoView({ behavior: "smooth" }); 55277 } 55278 }); 55279 }); 55280 animateHeroText(); 55281}); 55282async function animateHeroText() { 55283 const heros = document.querySelectorAll( 55284 ".hero-text:not(.animated):not(.skip-animation)" 55285 ); 55286 heros.forEach((hero) => { 55287 const text = hero.querySelector(".hero-text-text"); 55288 var split2 = new SplitText(text, { 55289 type: "words,chars" 55290 }); 55291 gsapWithCSS.from(split2.chars, { 55292 autoAlpha: 0, 55293 stagger: 0.02, 55294 y: -2 55295 }); 55296 hero.classList.add("animated"); 55297 }); 55298} 55299document.addEventListener("turbo:load", () => { 55300 document.querySelectorAll(".quick-add").forEach((node) => { 55301 node.onclick = handleQuickAddClick; 55302 }); 55303}); 55304async function handleQuickAddClick(e2) { 55305 var _a2; 55306 e2.preventDefault(); 55307 const node = e2.target; 55308 let variantId = null; 55309 if (node.dataset.variantId) { 55310 variantId = node.dataset.variantId; 55311 } else if (node.dataset.id) { 55312 const productId = node.dataset.id; 55313 const res = await fetch(`/products/${productId}.json`); 55314 const product = await res.json(); 55315 variantId = product.defaultVariantId; 55316 } 55317 if (!variantId) return; 55318 if (["nova-et-vetera", "letter-and-spirit"].some( 55319 (cls) => document.body.classList.contains(cls) 55320 )) { 55321 const primarySiteUrl = (_a2 = window.SESSION_DATA) == null ? void 0 : _a2.primary_site_url; 55322 if (primarySiteUrl) { 55323 window.location.href = `${primarySiteUrl}/cart/?add_to_cart=${variantId}`; 55324 } 55325 return; 55326 } 55327 addToCart([variantId]); 55328} 55329let productsearch; 55330function initProductSearch(refinementSections = [], publisherFilter = "*", tagFilter = "*", excludeTagFilter = "*") { 55331 const typesenseInstantsearchAdapter = new TypesenseInstantsearchAdapter({ 55332 server: { 55333 ...typesenseConfig 55334 }, 55335 additionalSearchParameters: { 55336 query_by: "title,author,embedding", 55337 vector_query: "embedding:([], k: 200, distance_threshold: 0.19)", 55338 exclude_fields: "embedding" 55339 } 55340 }); 55341 const dynamicRefinements = createDynamicRefinements(refinementSections); 55342 let categorizationFilter = "categorization:=product";
55343 if (tagFilter !== "*") { 55344 const additionalTags = tagFilter.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0); 55345 if (additionalTags.length > 0) { 55346 const tagFilters = additionalTags.map((tag) => `tags:=${tag}`); 55347 categorizationFilter = `${categorizationFilter} && ${tagFilters.join(" && ")}`; 55348 } 55349 } 55350 const publisherFilterText = publisherFilter !== "*" ? ` && publisher:="${publisherFilter}"` : ""; 55351 let excludeTagFilterText = ""; 55352 if (excludeTagFilter !== "*") { 55353 const excludeTags = excludeTagFilter.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0); 55354 if (excludeTags.length > 0) { 55355 excludeTagFilterText = " && " + excludeTags.map((tag) => `tags:!="${tag}"`).join(" && "); 55356 } 55357 } 55358 const filtersExpression = `${categorizationFilter}${publisherFilterText}${excludeTagFilterText}`; 55359 if (productsearch) productsearch.dispose(); 55360 productsearch = instantsearch({ 55361 searchClient: typesenseInstantsearchAdapter.searchClient, 55362 indexName: "stpaulcenter$products/sort/post_date_timestamp:desc", 55363 routing: { 55364 router: historyRouter({ 55365 push(url) { 55366 window.history.replaceState(window.history.state, "", url); 55367 } 55368 }), 55369 stateMapping: { 55370 stateToRoute(uiState) { 55371 const indexState = uiState["stpaulcenter$products/sort/post_date_timestamp:desc"] || {}; 55372 const route = { 55373 q: indexState.query || "", 55374 page: indexState.page || 1 55375 }; 55376 if (indexState.sortBy) { 55377 route.sortBy = indexState.sortBy; 55378 } 55379 if (indexState.refinementList) { 55380 route.refinementList = JSON.stringify(indexState.refinementList); 55381 } 55382 if (indexState.range) { 55383 route.range = JSON.stringify(indexState.range); 55384 } 55385 return route; 55386 }, 55387 routeToState(routeState) { 55388 const state = { 55389 query: routeState.q || "", 55390 page: parseInt(routeState.page, 10) || 1 55391 }; 55392 if (routeState.sortBy) { 55393 state.sortBy = routeState.sortBy; 55394 } 55395 if (routeState.refinementList) { 55396 try { 55397 state.refinementList = JSON.parse(routeState.refinementList); 55398 } catch (e2) { 55399 console.error("Failed to parse refinementList from URL", e2); 55400 } 55401 } 55402 if (routeState.range) { 55403 try { 55404 state.range = JSON.parse(routeState.range); 55405 } catch (e2) { 55406 console.error("Failed to parse range from URL", e2); 55407 } 55408 } 55409 return { 55410 ["stpaulcenter$products/sort/post_date_timestamp:desc"]: state 55411 }; 55412 } 55413 } 55414 } 55415 }); 55416 productsearch.addWidgets([ 55417 ...dynamicRefinements, 55418 configure({ 55419 hitsPerPage: 12, 55420 filters: filtersExpression, 55421 facetingAfterDistinct: true, 55422 query: "*" 55423 }), 55424 ...createProductSearchWidgets(productsearch) 55425 // Added spread operator here 55426 ]); 55427 productsearch.on("render", () => { 55428 }); 55429 productsearch.start(); 55430 return productsearch; 55431} 55432function createDynamicRefinements(sections) { 55433 return Array.from(sections).map((section, index3) => { 55434 const allowedTags = section.dataset.tags.split(",").map((tag) => tag.trim()); 55435 return refinementList({ 55436 container: `#refinement-filter-${index3 + 1}`, 55437 attribute: "tags", 55438 limit: 100, 55439 // Ensure we get all possible values 55440 showMore: false, 55441 templates: { 55442 item: (item3) => { 55443 if (!allowedTags.includes(item3.value)) return ""; 55444 return ` 55445 <label class="refinement-label"> 55446 <input 55447 type="checkbox" 55448 value="${item3.value}" 55449 ${item3.isRefined ? "checked" : ""} 55450 > 55451 <span class="category-name">${item3.label}</span> 55452 <span class="count">(${item3.count})</span> 55453 </label> 55454 `; 55455 } 55456 }, 55457 transformItems: (items) => { 55458 const itemMap = items.reduce((map, item3) => { 55459 map[item3.value] = item3; 55460 return map; 55461 }, {}); 55462 return allowedTags.map((tag) => { 55463 if (itemMap[tag]) { 55464 return itemMap[tag]; 55465 } else { 55466 return { 55467 value: tag, 55468 label: tag, 55469 // You might want to format this 55470 count: 0,
55471 isRefined: false 55472 }; 55473 } 55474 }); 55475 }, 55476 operator: "and" 55477 }); 55478 }); 55479} 55480function createProductSearchWidgets(search) { 55481 return [ 55482 searchBox({ 55483 container: "#product-searchbox", 55484 placeholder: "Search products...", 55485 queryHook(query, performSearch) { 55486 if (query && query.trim() !== "") { 55487 if (search.helper.state.index !== "stpaulcenter$products") { 55488 search.helper.setIndex("stpaulcenter$products"); 55489 } 55490 } else { 55491 if (search.helper.state.index !== "stpaulcenter$products/sort/post_date_timestamp:desc") { 55492 search.helper.setIndex( 55493 "stpaulcenter$products/sort/post_date_timestamp:desc" 55494 ); 55495 } 55496 } 55497 performSearch(query); 55498 } 55499 }), 55500 sortBy({ 55501 container: "#sort-by", 55502 items: [ 55503 { 55504 label: "Publish Date", 55505 value: "stpaulcenter$products/sort/post_date_timestamp:desc" 55506 }, 55507 { label: "Relevance", value: "stpaulcenter$products" }, 55508 { label: "Price (asc)", value: "stpaulcenter$products/sort/price:asc" }, 55509 { 55510 label: "Price (desc)", 55511 value: "stpaulcenter$products/sort/price:desc" 55512 } 55513 ] 55514 }), 55515 clearRefinements2({ 55516 container: "#clear-refinements" 55517 }), 55518 rangeSlider({ 55519 container: "#price-slider", 55520 attribute: "price", 55521 tooltips: { 55522 format: (value) => `$${Math.round(value)}` 55523 }, 55524 pips: false, 55525 step: 1 55526 }), 55527 hits({ 55528 container: "#product-hits", 55529 templates: { 55530 item: renderProduct 55531 } 55532 }), 55533 pagination({ 55534 container: "#product-pagination" 55535 }) 55536 ]; 55537} 55538const renderProduct = (hit) => ` 55539 <a 55540 class=" 55541 card 55542 product-search 55543 ${hit.productType === "variable" || hit.productType === "eBook" ? "alternate" : ""} 55544 " 55545 href="${hit.url}" 55546 > 55547 <div class="product-card-image"> 55548 ${hit.image ? ` 55549 <div class="image-container"> 55550 <img src="${shopifyImageUrl(hit.image, { width: 200 })}" alt="${hit.title}" /> 55551 ${hit.stock_status == "Out of stock" ? "" : ` 55552 <div class="hover-overlay"> 55553 <button 55554 class="hover-button button light quick-add" 55555 data-variant-id="${hit.meta}" 55556 > 55557 ${{ "Out of stock": "Sold Out", "Pre-order": "Pre-order", "Pre-release": "Pre-order", Backordered: "Place Backorder" }[hit.stock_status] || "Quick Add"} 55558 </button> 55559 </div>`} 55560 ${hit.stock_status ? '<div class="badge stock-status ' + (hit.stock_status === "Pre-release" ? "pre-order" : hit.stock_status.toLowerCase().replaceAll(" ", "-")) + '">' + (hit.stock_status === "Pre-release" ? "Pre-order" : hit.stock_status) + (hit.when_available ? ": Available " + hit.when_available : "") + "</div>" : ""} 55561 </div> 55562 ` : '<div class="no-image-placeholder"></div>'} 55563 </div> 55564 <div class="product-card-details"> 55565 <div class="item"> 55566 <div class="item-title">${hit._highlightResult.title.value}</div> 55567 ${hit.authors ? ` 55568 <div class="creator"> 55569 ${hit.authors.map( 55570 (author, index3, array) => `${author}${index3 < array.length - 1 ? " and " : ""}` 55571).join("")} 55572 </div> 55573 ` : ""} 55574 <div class="meta"> 55575 ${hit.price ? `$${hit.price}` : ""} 55576 </div> 55577 </div> 55578 </div> 55579 </a> 55580`; 55581document.addEventListener("turbo:load", () => { 55582 const productArchive = document.querySelector(".product-archive"); 55583 if (!productArchive) return; 55584 const refinementSections = document.querySelectorAll("[data-tags]"); 55585 const tagFilter = productArchive.dataset.onlytags; 55586 const excludeTagFilter = productArchive.dataset.excludetags; 55587 const publisherFilter = productArchive.dataset.publisher; 55588 initProductSearch(refinementSections, publisherFilter, tagFilter, excludeTagFilter); 55589 productArchive.onclick = (e2) => { 55590 if (e2.target.classList.contains("quick-add")) handleQuickAddClick(e2); 55591 }; 55592 const refinementsHeader = document.querySelector(".refinements-header"); 55593 if (refinementsHeader) refinementsHeader.onclick = toggleRefinementsSection; 55594}); 55595function toggleRefinementsSection() { 55596 const refinementsSection = document.querySelector(".refinements"); 55597 const contentWrapper = refinementsSection.querySelector( 55598 ".refinements-content" 55599 ); 55600 const isOpen = refinementsSection.classList.contains("open"); 55601 if (isOpen) { 55602 refinementsSection.classList.remove("open"); 55603 gsapWithCSS.to(contentWrapper, { 55604 height: 0, 55605 duration: 0.3, 55606 ease: "power2.out" 55607 }); 55608 } else { 55609 refinementsSection.classList.add("open"); 55610 gsapWithCSS.fromTo( 55611 contentWrapper, 55612 { height: 0 }, 55613 { height: "auto", duration: 0.3, ease: "power2.out" } 55614 ); 55615 } 55616} 55617let ctx; 55618document.addEventListener("turbo:load", () => { 55619 if (ctx) { 55620 ctx.revert(); 55621 ctx = null; 55622 } 55623 const heroCarousels = document.querySelectorAll(".hero-carousel"); 55624 if (!heroCarousels.length) return; 55625 ctx = gsapWithCSS.context(() => {
55626 heroCarousels.forEach((carousel) => { 55627 const pagers = carousel.querySelectorAll(".hero-carousel-pager>div"); 55628 carousel.querySelectorAll(".hero-carousel-item").forEach((item3, i2) => { 55629 if (i2 !== 0) gsapWithCSS.set(item3, { autoAlpha: 0 }); 55630 }); 55631 setCurrentPageIndex(carousel, 0); 55632 const autoCycle = gsapWithCSS.to( 55633 {}, 55634 { 55635 duration: 5, 55636 repeat: -1, 55637 onRepeat: () => { 55638 const currentIndex = getCurrentPageIndex(carousel); 55639 let nextIndex = currentIndex + 1; 55640 if (nextIndex >= pagers.length) nextIndex = 0; 55641 setCurrentPageIndex(carousel, nextIndex); 55642 } 55643 } 55644 ); 55645 pagers.forEach((pager, i2) => { 55646 pager.onclick = () => { 55647 autoCycle.restart(); 55648 setCurrentPageIndex(carousel, i2); 55649 }; 55650 }); 55651 }); 55652 }); 55653}); 55654const getCurrentPageIndex = (carousel) => Array.from(carousel.querySelectorAll(".hero-carousel-item")).findIndex( 55655 (item3) => item3.style.opacity == 1 55656); 55657function setCurrentPageIndex(carousel, index3) { 55658 if (getCurrentPageIndex(carousel) == index3) return; 55659 const pages = carousel.querySelectorAll(".hero-carousel-item"); 55660 const pagerContainer = carousel.querySelector(".hero-carousel-pager"); 55661 const pagers = pagerContainer.querySelectorAll(".hero-carousel-page"); 55662 const blob = carousel.querySelector(".hero-carousel-blob"); 55663 const page2 = pages[index3]; 55664 const pager = pagers[index3]; 55665 gsapWithCSS.timeline().addLabel("start").to(pages, { autoAlpha: 0 }, "start").to(page2, { autoAlpha: 1 }, "start").from( 55666 page2.querySelector(".background"), 55667 { scale: 1.2, duration: 3 }, 55668 "start" 55669 ); 55670 const newBlobX = pager.getBoundingClientRect().x - pagerContainer.getBoundingClientRect().x; 55671 gsapWithCSS.timeline().addLabel("blobMove").to( 55672 blob, 55673 { 55674 x: newBlobX, 55675 duration: 0.5 55676 }, 55677 "<" 55678 ).to( 55679 blob, 55680 { 55681 scale: 0.5, 55682 duration: 0.25 55683 }, 55684 "<" 55685 ).to( 55686 blob, 55687 { 55688 scale: 1, 55689 y: 0, 55690 duration: 0.25 55691 }, 55692 ">" 55693 ); 55694} 55695document.addEventListener("turbo:load", () => { 55696 $$2(".accordion-header").on("click", function() { 55697 $$2(this).toggleClass("active").next().slideToggle(); 55698 if ($$2(this).hasClass("active")) { 55699 gsapWithCSS.to($$2(this), { 55700 "--rotation": "90deg" 55701 }); 55702 } else { 55703 gsapWithCSS.to($$2(this), { 55704 "--rotation": "0deg" 55705 }); 55706 } 55707 }); 55708}); 55709document.addEventListener("turbo:load", async () => { 55710 let attempts = 0; 55711 const maxAttempts = 10; 55712 let slickLoaded = false; 55713 while (!slickLoaded && attempts < maxAttempts) { 55714 slickLoaded = typeof $$2.fn.slick !== "undefined"; 55715 if (!slickLoaded) await sleep$2(500); 55716 attempts++; 55717 } 55718 if (!slickLoaded) { 55719 console.error("Failed to initialize Slick carousel after maximum attempts"); 55720 return; 55721 } 55722 $$2(".carousel").each(function(index3) { 55723 if (!$$2(this).hasClass("slick-initialized")) { 55724 $$2(this).slick({ 55725 slidesToShow: 2, 55726 infinite: true, 55727 arrows: true, 55728 prevArrow: '<div class="slick-prev"><span class="material-icons material-icons-outlined">arrow_back_ios</span></div>', 55729 nextArrow: '<div class="slick-next"><span class="material-icons material-icons-outlined">arrow_forward_ios</span></div>', 55730 responsive: [ 55731 { 55732 breakpoint: 1024, 55733 settings: {} 55734 }, 55735 { 55736 breakpoint: 600, 55737 settings: {} 55738 }, 55739 { 55740 breakpoint: 300, 55741 settings: "unslick" 55742 } 55743 ] 55744 }); 55745 } 55746 }); 55747}); 55748document.addEventListener("turbo:load", function() { 55749 const countUpElements = document.querySelectorAll(".countups .item-title"); 55750 countUpElements.forEach((el) => { 55751 const hasPlus = el.textContent.includes("+"); 55752 const endValue = parseInt(el.textContent); 55753 el.textContent = "0"; 55754 gsapWithCSS.to(el, { 55755 scrollTrigger: { 55756 trigger: el, 55757 start: "top 80%", 55758 toggleActions: "play" 55759 }, 55760 textContent: endValue, 55761 duration: 2, 55762 ease: "power1.out", 55763 snap: { textContent: 1 }, 55764 stagger: 1, 55765 onUpdate: function() { 55766 el.textContent = Math.round( 55767 this.targets()[0].textContent
55768 ).toLocaleString("en-US"); 55769 }, 55770 onComplete: function() { 55771 if (hasPlus) { 55772 el.textContent += "+"; 55773 } 55774 } 55775 }); 55776 }); 55777}); 55778document.addEventListener("turbo:load", () => { 55779 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( 55780 window.navigator.userAgent 55781 )) { 55782 const horizontalSections = gsapWithCSS.utils.toArray([ 55783 ".block-horizontalCards", 55784 ".block-horizontalTextChunks" 55785 ]); 55786 horizontalSections.forEach(function(sec, i2) { 55787 const pinWrap = sec.querySelector(".cards.horizontal"); 55788 let pinWrapWidth; 55789 let horizontalScrollLength; 55790 function refresh() { 55791 pinWrapWidth = pinWrap.scrollWidth; 55792 horizontalScrollLength = pinWrapWidth - window.innerWidth; 55793 } 55794 refresh(); 55795 gsapWithCSS.to(pinWrap, { 55796 scrollTrigger: { 55797 scrub: 0.2, 55798 trigger: sec, 55799 pin: sec, 55800 pinSpacing: true, 55801 start: "bottom 80%", 55802 invalidateOnRefresh: true 55803 }, 55804 x: () => -horizontalScrollLength, 55805 ease: "none" 55806 }); 55807 }); 55808 } 55809}); 55810document.addEventListener("turbo:load", () => { 55811 animateCards(); 55812 animateCardTitles(); 55813 animateRevealCards(); 55814}); 55815function animateCards() { 55816 document.querySelectorAll([ 55817 ".block-cards:not(.animateTitles):not(.countups)", 55818 ".block-staggeredCards", 55819 ".block-bigCards", 55820 ".block-bigCardsWhiteText" 55821 ]).forEach((section) => { 55822 const revealOnScroll = section.classList.contains("revealOnScroll"); 55823 const tl = revealOnScroll ? gsapWithCSS.timeline({ 55824 paused: true, 55825 scrollTrigger: { 55826 trigger: section, 55827 start: "clamp(top bottom)", 55828 end: "bottom top", 55829 toggleActions: "play none none none" 55830 } 55831 }) : null; 55832 section.querySelectorAll(".card").forEach((card) => { 55833 if (revealOnScroll) tl.from(card, { autoAlpha: 0 }); 55834 card.onmouseover = scaleDown; 55835 card.onmouseout = scaleUp; 55836 }); 55837 }); 55838} 55839const scaleDown = (e2) => gsapWithCSS.to(e2.currentTarget, { scale: 0.98 }); 55840const scaleUp = (e2) => gsapWithCSS.to(e2.currentTarget, { scale: 1 }); 55841function animateCardTitles() { 55842 document.querySelectorAll(".animateTitles").forEach((section) => { 55843 var cardTl = gsapWithCSS.timeline({ 55844 paused: true, 55845 scrollTrigger: { 55846 trigger: section, 55847 start: "clamp(top bottom)", 55848 end: "bottom top", 55849 toggleActions: "play reverse play reset" 55850 } 55851 }); 55852 section.querySelectorAll(".card").forEach((card) => { 55853 cardTl.from(card, { autoAlpha: 0 }); 55854 const title = card.querySelector(".item-title"); 55855 card.onmouseover = scaleUp; 55856 card.onmouseout = scaleNormal; 55857 card.onmouseover = () => gsapWithCSS.to(title, { scale: 1.1 }); 55858 card.onmouseout = () => gsapWithCSS.to(title, { scale: 1 }); 55859 }); 55860 }); 55861} 55862function animateRevealCards() { 55863 document.querySelectorAll(".hoverRevealsH5 .card").forEach((card) => { 55864 const heading = card.querySelector(".card-overlay h5"); 55865 const background = card.querySelector(".background"); 55866 const link = card.querySelector(".list-link"); 55867 gsapWithCSS.set(heading, { 55868 height: "100px", 55869 overflow: "hidden" 55870 }); 55871 gsapWithCSS.set(link, { 55872 height: "0px", 55873 overflow: "hidden" 55874 }); 55875 const cardTl = gsapWithCSS.timeline({ paused: true }); 55876 cardTl.addLabel("start").to( 55877 heading, 55878 { 55879 height: "auto", 55880 duration: 0.4, 55881 maskImage: "none", 55882 ease: "power2.out" 55883 }, 55884 "start" 55885 ).to( 55886 link, 55887 { 55888 height: "auto", 55889 marginTop: 16, 55890 duration: 0.4, 55891 maskImage: "none", 55892 ease: "power2.out" 55893 }, 55894 "start" 55895 ).to( 55896 background, 55897 { 55898 filter: "blur(4px) brightness(0.7)", 55899 duration: 0.4 55900 }, 55901 "start" 55902 ); 55903 card.addEventListener("mouseenter", () => cardTl.play()); 55904 card.addEventListener("mouseleave", () => cardTl.reverse()); 55905 }); 55906} 55907document.addEventListener("turbo:load", function(event) { 55908 initializeEventsPagination(); 55909}); 55910function initializeEventsPagination() { 55911 const eventsTable = document.querySelector(".events-table tbody"); 55912 if (!eventsTable) return; 55913 const rows = Array.from(eventsTable.querySelectorAll("tr")); 55914 const itemsPerPage = 10; 55915 if (rows.length <= itemsPerPage) return; 55916 const totalPages = Math.ceil(rows.length / itemsPerPage); 55917 let currentPage = 1; 55918 const paginationContainer = document.createElement("div"); 55919 paginationContainer.className = "flex items-center justify-center gap-4 mt-6"; 55920 paginationContainer.innerHTML = ` 55921 <button class="prev text-gray-600 hover:text-gray-900">â¹</button>
55922 <span class="page-info text-sm">1 of ${totalPages}</span> 55923 <button class="next text-gray-600 hover:text-gray-900">âº</button> 55924 `; 55925 eventsTable.parentNode.after(paginationContainer); 55926 function showPage(pageNum) { 55927 const start2 = (pageNum - 1) * itemsPerPage; 55928 const end = start2 + itemsPerPage; 55929 const tl = gsapWithCSS.timeline(); 55930 tl.to(rows, { 55931 autoAlpha: 0, 55932 duration: 0.2, 55933 onComplete: () => { 55934 rows.forEach((row) => row.style.display = "none"); 55935 rows.slice(start2, end).forEach((row) => row.style.display = ""); 55936 paginationContainer.querySelector(".page-info").textContent = `${pageNum} of ${totalPages}`; 55937 gsapWithCSS.to(rows.slice(start2, end), { 55938 autoAlpha: 1, 55939 duration: 0.3, 55940 stagger: 0.05 55941 }); 55942 } 55943 }); 55944 } 55945 paginationContainer.querySelector(".prev").addEventListener("click", () => { 55946 if (currentPage > 1) { 55947 currentPage--; 55948 showPage(currentPage); 55949 } 55950 }); 55951 paginationContainer.querySelector(".next").addEventListener("click", () => { 55952 if (currentPage < totalPages) { 55953 currentPage++; 55954 showPage(currentPage); 55955 } 55956 }); 55957 showPage(1); 55958} 55959document.addEventListener("turbo:load", function() { 55960 const entrySections = gsapWithCSS.utils.toArray([".entry-feature-block"]); 55961 entrySections.forEach(function(cards, i2) { 55962 let cardsArray = gsapWithCSS.utils.toArray(".card", cards); 55963 var cardTl = gsapWithCSS.timeline({ 55964 paused: true, 55965 scrollTrigger: { 55966 trigger: cards, 55967 start: "clamp(top bottom)", 55968 end: "bottom top", 55969 toggleActions: "play none none none" 55970 } 55971 }); 55972 cardsArray.forEach(function(card, i3) { 55973 let cardBack = card.querySelector(".background"); 55974 let cardItem = card.querySelector(".item"); 55975 cardTl.from(card, { 55976 autoAlpha: 0 55977 }); 55978 $$2(card).on("mouseover", function(e2) { 55979 if (cardBack) { 55980 gsapWithCSS.to(cardBack, { scale: 1.1 }); 55981 } 55982 gsapWithCSS.to(cardItem, { scale: 0.95 }); 55983 }); 55984 $$2(card).on("mouseout", function(e2) { 55985 if (cardBack) { 55986 gsapWithCSS.to(cardBack, { scale: 1 }); 55987 } 55988 gsapWithCSS.to(cardItem, { scale: 1 }); 55989 }); 55990 }); 55991 }); 55992}); 55993document.addEventListener("turbo:load", function() { 55994 const videos = document.querySelectorAll(".video"); 55995 videos.forEach((video) => { 55996 let thisVideo = gsapWithCSS.utils.selector(video); 55997 let videoHolder = thisVideo(".video-holder"); 55998 let videoActor = thisVideo(".video-actor"); 55999 let videoButton = thisVideo(".play-button"); 56000 let videoId = "#" + $$2(videoHolder).data("id"); 56001 gsapWithCSS.set(videoHolder, { autoAlpha: 0 }); 56002 $$2(videoButton).on("click", function(e2) { 56003 gsapWithCSS.to(videoButton, { scale: 0.5 }); 56004 gsapWithCSS.to(videoActor, { autoAlpha: 0 }, "<"); 56005 $$2(videoId)[0].src += "&autoplay=1"; 56006 gsapWithCSS.to(videoHolder, { autoAlpha: 1, duration: 1 }, "<"); 56007 }); 56008 }); 56009}); 56010document.addEventListener("turbo:load", function() { 56011 document.querySelectorAll(".sprout-video-preview").forEach( 56012 (node) => node.addEventListener("click", ({ target }) => { 56013 const block = target.closest(".sprout-video"); 56014 const iframe = block.querySelector("iframe"); 56015 if (!iframe) return; 56016 block.classList.add("clicked"); 56017 const autoplayAllowed = iframe.allow.includes("autoplay"); 56018 if (autoplayAllowed) { 56019 const videoId = iframe.src.match(/\/embed\/([^\/]+)/)[1]; 56020 const player = new SV.Player({ videoId, target: iframe }); 56021 player.play(); 56022 } 56023 }) 56024 ); 56025}); 56026document.addEventListener("turbo:load", function() { 56027 document.querySelectorAll(".cloudinary-video-preview").forEach( 56028 (node) => node.addEventListener("click", ({ target }) => { 56029 const block = target.closest(".cloudinary-video"); 56030 const iframe = block == null ? void 0 : block.querySelector("iframe"); 56031 if (!block || !iframe) return; 56032 block.classList.add("clicked"); 56033 const autoplayAllowed = iframe.allow.includes("autoplay"); 56034 if (!autoplayAllowed) return; 56035 const embedUrl = iframe.dataset.embedUrl; 56036 if (!embedUrl) return; 56037 const url = new URL(embedUrl); 56038 url.searchParams.set("player[autoplay_mode]", "always"); 56039 iframe.src = url.toString(); 56040 }) 56041 ); 56042}); 56043document.addEventListener("turbo:load", function() { 56044 const superfeatures = document.querySelectorAll(".superfeatures");
56045 superfeatures.forEach((superfeature, i2) => { 56046 let thisSuperfeature = gsapWithCSS.utils.selector(superfeature); 56047 $$2(thisSuperfeature(".superfeature-pager>div")).on( 56048 "mouseover", 56049 function(e2) { 56050 let thisXY = this.getBoundingClientRect(); 56051 let boxXY = $$2(this).parent()[0].getBoundingClientRect(); 56052 let targetId = $$2(this).data("id"); 56053 let activeSuperfeature = gsapWithCSS.utils.selector(targetId); 56054 gsapWithCSS.timeline().addLabel("start").to( 56055 thisSuperfeature(".superfeature"), 56056 { 56057 autoAlpha: 0 56058 }, 56059 "start" 56060 ).to( 56061 targetId, 56062 { 56063 autoAlpha: 1 56064 }, 56065 "start" 56066 ).addLabel("background").from( 56067 activeSuperfeature(".background"), 56068 { 56069 scale: 1.2, 56070 duration: 3 56071 }, 56072 "start" 56073 ); 56074 gsapWithCSS.timeline().addLabel("blobMove").to( 56075 ".superfeature-blob", 56076 { 56077 y: thisXY.y - boxXY.y, 56078 duration: 0.5 56079 }, 56080 "<" 56081 ).to( 56082 ".superfeature-blob", 56083 { 56084 scale: 0.5, 56085 duration: 0.25 56086 }, 56087 "<" 56088 ).to( 56089 ".superfeature-blob", 56090 { 56091 scale: 1, 56092 duration: 0.25 56093 }, 56094 ">" 56095 ); 56096 } 56097 ); 56098 }); 56099}); 56100document.addEventListener("turbo:load", function() { 56101 const productTabsLinks = document.querySelectorAll(".product-tabs-links"); 56102 productTabsLinks.forEach((linksGroup) => { 56103 linksGroup.addEventListener("click", ({ target }) => { 56104 var _a2, _b2, _c, _d; 56105 if (target.classList.contains("product-tab-title")) { 56106 (_b2 = (_a2 = linksGroup.querySelector(".selected")) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.remove("selected"); 56107 const tabIndex = Array.from(linksGroup.children).indexOf(target); 56108 target.classList.add("selected"); 56109 const paginator = target.closest(".product-tabs").querySelector(".paginator"); 56110 (_d = (_c = paginator.querySelector(".visible")) == null ? void 0 : _c.classList) == null ? void 0 : _d.remove("visible"); 56111 paginator.children[tabIndex].classList.add("visible"); 56112 } 56113 }); 56114 }); 56115}); 56116document.addEventListener("turbo:load", function(event) { 56117 parallaxHandler(); 56118 stickyImagesHandler(); 56119 interactionHandler(); 56120}); 56121function parallaxHandler() { 56122 const boxes = gsapWithCSS.utils.toArray(".parallax"); 56123 boxes.forEach((box) => { 56124 const img = box.querySelector("img"); 56125 const container = box.parentElement; 56126 if (img && container) { 56127 box.setAttribute("data-speed", "auto"); 56128 img.setAttribute("data-speed", "auto"); 56129 gsapWithCSS.fromTo( 56130 img, 56131 { 56132 yPercent: -20 56133 // Start position matching CSS 56134 }, 56135 { 56136 yPercent: 20, 56137 // End position - creates 40% movement range 56138 ease: "none", 56139 overwrite: true, 56140 // Override any other transforms including ScrollSmoother 56141 scrollTrigger: { 56142 trigger: container, 56143 start: "top bottom", 56144 // Start when top of container hits bottom of viewport 56145 end: "bottom top", 56146 // End when bottom of container hits top of viewport 56147 scrub: true, 56148 // Smooth scrubbing 56149 invalidateOnRefresh: true 56150 } 56151 } 56152 ); 56153 } 56154 }); 56155} 56156function stickyImagesHandler() { 56157 if (window.innerWidth <= 768) return; 56158 const stickyContainers = document.querySelectorAll( 56159 ".block-container.stickyImages" 56160 ); 56161 stickyContainers.forEach((container) => { 56162 const desktopWrapper = container.querySelector(".sticky-desktop-wrapper"); 56163 if (!desktopWrapper) return; 56164 const leftContent = desktopWrapper.querySelector(".sticky-content-left"); 56165 const rightContent = desktopWrapper.querySelector(".sticky-content-right"); 56166 const imageBlocks = Array.from(desktopWrapper.querySelectorAll(".sticky-image-block")); 56167 if (!leftContent || !rightContent || imageBlocks.length === 0) return; 56168 const contentBlocks = leftContent.children; 56169 const pinPosition = window.innerHeight * 0.15; 56170 const lastContentBlock = contentBlocks[contentBlocks.length - 1]; 56171 ScrollTrigger$1.create({ 56172 trigger: leftContent, 56173 start: `top top+=${pinPosition}`, 56174 end: () => `${lastContentBlock.offsetTop + leftContent.offsetTop} top+=${pinPosition}`, 56175 pin: rightContent, 56176 pinSpacing: false, 56177 anticipatePin: 1, 56178 invalidateOnRefresh: true, 56179 onRefresh: (self2) =>
56179 self2.update() 56180 }); 56181 imageBlocks.forEach((block, index3) => { 56182 block.style.zIndex = imageBlocks.length - index3; 56183 gsapWithCSS.set(block, { opacity: 0 }); 56184 }); 56185 Array.from(contentBlocks).forEach((block) => { 56186 gsapWithCSS.set(block, { opacity: 0 }); 56187 }); 56188 Array.from(contentBlocks).forEach((block, index3) => { 56189 const imageBlock = imageBlocks[index3]; 56190 if (imageBlock) { 56191 gsapWithCSS.timeline({ 56192 scrollTrigger: { 56193 trigger: block, 56194 start: "top 70%", 56195 end: "bottom 30%", 56196 scrub: 2, 56197 // Slower scrub for smoother, coordinated movement 56198 invalidateOnRefresh: true, 56199 onEnter: () => { 56200 imageBlocks.forEach((b2, i2) => { 56201 b2.style.zIndex = i2 === index3 ? imageBlocks.length + 1 : imageBlocks.length - i2; 56202 }); 56203 }, 56204 onLeaveBack: () => { 56205 if (index3 > 0) { 56206 imageBlocks.forEach((b2, i2) => { 56207 b2.style.zIndex = i2 === index3 - 1 ? imageBlocks.length + 1 : imageBlocks.length - i2; 56208 }); 56209 } 56210 } 56211 } 56212 }).to(block, { opacity: 1, duration: 0.3 }, 0).to(imageBlock, { opacity: 1, duration: 0.3 }, 0).to(block, { opacity: 1, duration: 0.4 }, 0.3).to(imageBlock, { opacity: 1, duration: 0.4 }, 0.3).to(block, { opacity: 0, duration: 0.3 }, 0.7).to(imageBlock, { opacity: 0, duration: 0.3 }, 0.7); 56213 gsapWithCSS.fromTo( 56214 block, 56215 { y: 100 }, 56216 // Increased from 50 to make more obvious 56217 { 56218 y: -100, 56219 // Increased from -50 to make more obvious 56220 ease: "none", 56221 scrollTrigger: { 56222 trigger: block, 56223 start: "top bottom", 56224 end: "bottom top", 56225 scrub: 8, 56226 // Increased from 5 for even slower, more dramatic effect 56227 invalidateOnRefresh: true 56228 } 56229 } 56230 ); 56231 if (index3 > 0) { 56232 gsapWithCSS.timeline({ 56233 scrollTrigger: { 56234 trigger: block, 56235 start: "top 70%", 56236 end: "top 50%", 56237 scrub: 2, 56238 invalidateOnRefresh: true 56239 } 56240 }).to( 56241 imageBlocks.slice(0, index3), 56242 { opacity: 0, duration: 0.2 }, 56243 0 56244 ); 56245 } 56246 } 56247 }); 56248 if (imageBlocks.length > contentBlocks.length) { 56249 const lastContentBlock2 = contentBlocks[contentBlocks.length - 1]; 56250 for (let i2 = contentBlocks.length; i2 < imageBlocks.length; i2++) { 56251 const imageBlock = imageBlocks[i2]; 56252 ScrollTrigger$1.create({ 56253 trigger: lastContentBlock2, 56254 start: `bottom-=${(imageBlocks.length - i2) * 200} center`, 56255 onEnter: () => { 56256 for (let j2 = 0; j2 < i2; j2++) { 56257 imageBlocks[j2].classList.remove("is-visible"); 56258 } 56259 imageBlock.classList.add("is-visible"); 56260 imageBlocks.forEach((block, idx) => { 56261 block.style.zIndex = idx === i2 ? imageBlocks.length + 1 : imageBlocks.length - idx; 56262 }); 56263 }, 56264 onLeaveBack: () => { 56265 imageBlock.classList.remove("is-visible"); 56266 if (i2 > 0) { 56267 imageBlocks[i2 - 1].classList.add("is-visible"); 56268 } 56269 } 56270 }); 56271 } 56272 } 56273 setTimeout(() => { 56274 ScrollTrigger$1.refresh(); 56275 const scrollY = window.scrollY; 56276 let visibleIndex = -1;
56277 Array.from(contentBlocks).forEach((block, index3) => { 56278 const rect = block.getBoundingClientRect(); 56279 const blockTop = rect.top + scrollY; 56280 const blockBottom = blockTop + rect.height; 56281 const viewportMiddle = scrollY + window.innerHeight * 0.6; 56282 if (viewportMiddle >= blockTop && viewportMiddle <= blockBottom && imageBlocks[index3]) { 56283 visibleIndex = index3; 56284 } 56285 }); 56286 if (visibleIndex === -1 && scrollY > 0) { 56287 const containerTop = container.getBoundingClientRect().top + scrollY; 56288 if (scrollY > containerTop) { 56289 for (let i2 = contentBlocks.length - 1; i2 >= 0; i2--) { 56290 const rect = contentBlocks[i2].getBoundingClientRect(); 56291 const blockTop = rect.top + scrollY; 56292 if (blockTop < scrollY + window.innerHeight * 0.6) { 56293 visibleIndex = i2; 56294 break; 56295 } 56296 } 56297 } 56298 } 56299 if (visibleIndex >= 0 && imageBlocks[visibleIndex]) { 56300 gsapWithCSS.set(imageBlocks[visibleIndex], { opacity: 1 }); 56301 gsapWithCSS.set(contentBlocks[visibleIndex], { opacity: 1, y: 0 }); 56302 imageBlocks.forEach((block, i2) => { 56303 block.style.zIndex = i2 === visibleIndex ? imageBlocks.length + 1 : imageBlocks.length - i2; 56304 }); 56305 } else if (visibleIndex === -1 && imageBlocks[0] && contentBlocks[0]) { 56306 gsapWithCSS.set(imageBlocks[0], { opacity: 1 }); 56307 gsapWithCSS.set(contentBlocks[0], { opacity: 1, y: 100 }); 56308 } 56309 }, 100); 56310 }); 56311} 56312function interactionHandler() { 56313 const fadeElements = gsapWithCSS.utils.toArray(".fadeInContents"); 56314 fadeElements.forEach((element) => { 56315 gsapWithCSS.set(element, { autoAlpha: 0 }); 56316 ScrollTrigger$1.create({ 56317 trigger: element, 56318 start: "top 70%", 56319 // Triggers when top of element hits 80% down the viewport 56320 once: true, 56321 // Only triggers once 56322 onEnter: () => { 56323 gsapWithCSS.to(element, { 56324 duration: 2, 56325 autoAlpha: 1, 56326 y: 0, 56327 ease: "power2.out", 56328 overwrite: "auto" 56329 }); 56330 } 56331 }); 56332 }); 56333 const hiddens = document.querySelectorAll(".arise"); 56334 hiddens.forEach((hidden) => { 56335 $$2(hidden).parent().on("mouseover", function() { 56336 gsapWithCSS.to(hidden, { autoAlpha: 1 }); 56337 }); 56338 $$2(hidden).parent().on("mouseout", function() { 56339 gsapWithCSS.to(hidden, { autoAlpha: 0 }); 56340 }); 56341 }); 56342} 56343document.addEventListener("turbo:load", () => { 56344 const popups = document.querySelectorAll(".popup"); 56345 popups.forEach(async (popup) => { 56346 const popupId = popup.dataset.id; 56347 if (window.localStorage.getItem(popupId)) { 56348 popup.remove(); 56349 return; 56350 } 56351 await sleep$2(1e4); 56352 popup.classList.remove("hidden"); 56353 popup.classList.add("visible"); 56354 window.localStorage.setItem(popupId, "popped"); 56355 const closeButton = popup.querySelector(".popup-close"); 56356 if (closeButton) { 56357 closeButton.onclick = async () => { 56358 popup.classList.remove("visible"); 56359 await sleep$2(1e3); 56360 popup.remove(); 56361 }; 56362 } 56363 }); 56364}); 56365const clickHandlers = { 56366 ".product-expand-description": handleExpandClick, 56367 ".product-toc-heading": handleExpandClick, 56368 ".variant-buttons > div": handleVariantClick, 56369 ".buy-button": handleBuyClick 56370}; 56371document.addEventListener("turbo:load", () => { 56372 var _a2, _b2; 56373 productDisplayHandler(); 56374 initCollapsibleSections(); 56375 const isLoggedIn = ((_a2 = window.SESSION_DATA) == null ? void 0 : _a2.is_logged_in) || false; 56376 const loggedInElements = document.querySelectorAll("[data-logged-in-only]"); 56377 const loggedOutElements = document.querySelectorAll("[data-logged-out-only]"); 56378 if (isLoggedIn) { 56379 loggedInElements.forEach((el) => el.style.display = ""); 56380 loggedOutElements.forEach((el) => el.style.display = "none"); 56381 } else { 56382 loggedInElements.forEach((el) => el.style.display = "none"); 56383 loggedOutElements.forEach((el) => el.style.display = ""); 56384 } 56385 const thumbnails = document.querySelectorAll(".thumbnail"); 56386 const mainImage = document.querySelector(".main-image");
56387 thumbnails.forEach((thumbnail) => { 56388 thumbnail.addEventListener("click", () => { 56389 const fullImageSrc = thumbnail.getAttribute("data-full-image"); 56390 let imageTl = gsapWithCSS.timeline({}); 56391 imageTl.to(mainImage, { 56392 opacity: 0, 56393 scale: 0.8, 56394 duration: 0.3, 56395 onComplete: () => { 56396 mainImage.src = fullImageSrc; 56397 mainImage.dataset.zoomSrc = fullImageSrc; 56398 } 56399 }); 56400 imageTl.to(mainImage, { 56401 opacity: 1, 56402 scale: 1, 56403 duration: 0.3, 56404 ease: "power1.out", 56405 delay: 0.1, 56406 // Otherwise GSAP's own inline transform sticks around and 56407 // overrides the CSS-driven hover-zoom transform afterward. 56408 clearProps: "transform" 56409 }); 56410 }); 56411 }); 56412 initThumbnailsScrollIndicator(); 56413 initImageZoom(); 56414 Object.entries(clickHandlers).forEach( 56415 ([selector3, handler]) => bindEvents(selector3, "onclick", handler) 56416 ); 56417 document.querySelector(".product-page"); 56418 const stars = document.querySelectorAll(".star"); 56419 const ratingInput = document.getElementById("ratingInput"); 56420 stars.forEach((star) => { 56421 star.addEventListener("click", () => { 56422 const rating = parseInt(star.dataset.rating); 56423 ratingInput.value = rating; 56424 stars.forEach((s2) => { 56425 const starRating = parseInt(s2.dataset.rating); 56426 if (starRating <= rating) { 56427 s2.classList.add("active"); 56428 } else { 56429 s2.classList.remove("active"); 56430 } 56431 }); 56432 }); 56433 star.addEventListener("mouseenter", () => { 56434 const rating = parseInt(star.dataset.rating); 56435 stars.forEach((s2) => { 56436 const starRating = parseInt(s2.dataset.rating); 56437 if (starRating <= rating) { 56438 s2.classList.add("hover"); 56439 } else { 56440 s2.classList.remove("hover"); 56441 } 56442 }); 56443 }); 56444 }); 56445 const starsContainer = document.querySelector(".stars"); 56446 if (starsContainer) { 56447 starsContainer.addEventListener("mouseleave", () => { 56448 stars.forEach((star) => star.classList.remove("hover")); 56449 }); 56450 } 56451 const inputs = document.querySelectorAll(".form-input"); 56452 inputs.forEach((input) => { 56453 const label = input.nextElementSibling; 56454 input.addEventListener("focus", () => { 56455 gsapWithCSS.to(label, { 56456 duration: 0.3, 56457 y: -28, 56458 scale: 0.8, 56459 color: "#4a90e2", 56460 ease: "power2.out" 56461 }); 56462 }); 56463 input.addEventListener("blur", () => { 56464 if (!input.value) { 56465 gsapWithCSS.to(label, { 56466 duration: 0.3, 56467 y: 0, 56468 scale: 1, 56469 color: "#757575", 56470 ease: "power2.out" 56471 }); 56472 } 56473 }); 56474 if (input.value) { 56475 gsapWithCSS.set(label, { 56476 y: -28, 56477 scale: 0.8, 56478 color: "#4a90e2" 56479 }); 56480 } 56481 }); 56482 (_b2 = document.querySelector(".review-form")) == null ? void 0 : _b2.addEventListener("submit", (e2) => { 56483 e2.preventDefault(); 56484 const form = e2.target; 56485 const formData = new FormData(form); 56486 const submitButton = form.querySelector("button[type='submit']"); 56487 if (!formData.get("fields[rating]") || formData.get("fields[rating]") === "0") { 56488 gsapWithCSS.fromTo( 56489 starsContainer, 56490 { x: -10 }, 56491 { x: 10, duration: 0.1, yoyo: true, repeat: 3, clearProps: "x" } 56492 ); 56493 return; 56494 } 56495 submitButton.classList.add("loading"); 56496 submitButton.disabled = true; 56497 let formAction = form.getAttribute("action"); 56498 if (!formAction || typeof formAction !== "string" || formAction.trim() === "") { 56499 formAction = window.location.href; 56500 } else if (!formAction.startsWith("http") && !formAction.startsWith("/")) { 56501 formAction = new URL(formAction, window.location.href).href; 56502 } 56503 fetch(formAction, { 56504 method: "POST", 56505 body: formData 56506 }).then((response) => { 56507 submitButton.classList.remove("loading"); 56508 submitButton.disabled = false; 56509 if (response.ok) { 56510 form.reset(); 56511 document.getElementById("ratingInput").value = "0"; 56512 const stars2 = document.querySelectorAll(".star"); 56513 stars2.forEach((star) => star.classList.remove("active")); 56514 const labels = form.querySelectorAll(".floating-label");
56515 labels.forEach((label) => { 56516 gsapWithCSS.to(label, { 56517 duration: 0.3, 56518 y: 0, 56519 scale: 1, 56520 color: "#757575", 56521 ease: "power2.out" 56522 }); 56523 }); 56524 showNotification( 56525 "success", 56526 "Thank you for your review! We'll publish it shortly after our team reviews it." 56527 ); 56528 } else { 56529 console.error( 56530 "Review submission failed:", 56531 response.status, 56532 response.statusText 56533 ); 56534 response.text().then((text) => { 56535 console.error("Error details:", text); 56536 showNotification( 56537 "error", 56538 "There was an error submitting your review. Please try again or contact support." 56539 ); 56540 }); 56541 } 56542 }).catch((error2) => { 56543 submitButton.classList.remove("loading"); 56544 submitButton.disabled = false; 56545 console.error("Network error submitting review:", error2); 56546 showNotification( 56547 "error", 56548 "There was a network error submitting your review. Please check your connection and try again." 56549 ); 56550 }); 56551 }); 56552}); 56553function showNotification(type, message) { 56554 const notificationContainer = document.getElementById("review-notification"); 56555 if (!notificationContainer) return; 56556 const iconName = type === "success" ? "check_circle" : "error"; 56557 const className = type === "success" ? "success-message" : "error-message"; 56558 notificationContainer.innerHTML = ` 56559 <div class="${className}" role="alert"> 56560 <span class="material-icons material-icons-round">${iconName}</span> 56561 ${message} 56562 </div> 56563 `; 56564} 56565function initImageZoom() { 56566 const container = document.querySelector(".main-image-container"); 56567 const mainImage = container == null ? void 0 : container.querySelector(".main-image"); 56568 const zoomHint = container == null ? void 0 : container.querySelector(".main-image-zoom-hint"); 56569 if (!container || !mainImage) return; 56570 if (zoomHint) { 56571 const positionZoomHint = () => { 56572 if (!mainImage.naturalWidth) return; 56573 const containerRect = container.getBoundingClientRect(); 56574 const containerRatio = containerRect.width / containerRect.height; 56575 const naturalRatio = mainImage.naturalWidth / mainImage.naturalHeight; 56576 const insetX = naturalRatio > containerRatio ? 0 : (containerRect.width - containerRect.height * naturalRatio) / 2; 56577 const insetY = naturalRatio > containerRatio ? (containerRect.height - containerRect.width / naturalRatio) / 2 : 0; 56578 zoomHint.style.top = `calc(0.75rem + ${insetY}px)`; 56579 zoomHint.style.right = `calc(0.75rem + ${insetX}px)`; 56580 }; 56581 mainImage.addEventListener("load", positionZoomHint); 56582 window.addEventListener("resize", positionZoomHint); 56583 positionZoomHint(); 56584 } 56585 if (window.matchMedia("(hover: hover)").matches) { 56586 let zoomed = false; 56587 container.addEventListener("mousemove", (event) => { 56588 if (!zoomed) return; 56589 const rect = container.getBoundingClientRect(); 56590 const x2 = (event.clientX - rect.left) / rect.width * 100; 56591 const y2 = (event.clientY - rect.top) / rect.height * 100; 56592 mainImage.style.transformOrigin = `${x2}% ${y2}%`; 56593 }); 56594 container.addEventListener("click", () => { 56595 zoomed = !zoomed; 56596 mainImage.classList.toggle("zoomed", zoomed); 56597 }); 56598 container.addEventListener("mouseleave", () => { 56599 zoomed = false; 56600 mainImage.classList.remove("zoomed"); 56601 }); 56602 } else { 56603 const lightbox = document.querySelector(".image-lightbox"); 56604 const lightboxImage = lightbox == null ? void 0 : lightbox.querySelector(".lightbox-image"); 56605 if (lightbox && lightboxImage) initLightboxPinchZoom(lightboxImage); 56606 container.addEventListener("click", () => { 56607 if (!lightbox || !lightboxImage) return; 56608 lightboxImage.src = mainImage.dataset.zoomSrc || mainImage.src; 56609 resetLightboxZoom(lightboxImage); 56610 lightbox.classList.add("open"); 56611 }); 56612 } 56613} 56614const lightboxZoomState = { scale: 1, x: 0, y: 0 }; 56615function resetLightboxZoom(image) { 56616 lightboxZoomState.scale = 1; 56617 lightboxZoomState.x = 0; 56618 lightboxZoomState.y = 0; 56619 image.style.transform = ""; 56620} 56621function applyLightboxTransform(image) { 56622 const { scale, x: x2, y: y2 } = lightboxZoomState; 56623 image.style.transform = `translate(${x2}px, ${y2}px) scale(${scale})`; 56624} 56625function clampLightboxPan(image) { 56626 const container = image.closest(".lightbox-container"); 56627 if (!container) return; 56628 const { scale } = lightboxZoomState; 56629 const maxX = Math.max( 56630 0, 56631 (image.offsetWidth * scale - container.clientWidth) / 2 56632 ); 56633 const maxY = Math.max( 56634 0, 56635 (image.offsetHeight * scale - container.clientHeight) / 2 56636 ); 56637 lightboxZoomState.x = Math.min(maxX, Math.max(-maxX, lightboxZoomState.x)); 56638 lightboxZoomState.y = Math.min(maxY, Math.max(-maxY, lightboxZoomState.y)); 56639}
56640function initLightboxPinchZoom(image) { 56641 const DOUBLE_TAP_SCALE = 2.5; 56642 const MAX_SCALE = 4; 56643 const DOUBLE_TAP_WINDOW_MS = 300; 56644 let lastTapTime = 0; 56645 let pinchStartDistance = 0; 56646 let pinchStartScale = 1; 56647 let panStart = null; 56648 const touchDistance = ([a2, b2]) => Math.hypot(a2.clientX - b2.clientX, a2.clientY - b2.clientY); 56649 image.addEventListener( 56650 "touchstart", 56651 (event) => { 56652 if (event.touches.length === 2) { 56653 pinchStartDistance = touchDistance(event.touches); 56654 pinchStartScale = lightboxZoomState.scale; 56655 panStart = null; 56656 return; 56657 } 56658 if (event.touches.length !== 1) return; 56659 const now = Date.now(); 56660 if (now - lastTapTime < DOUBLE_TAP_WINDOW_MS) { 56661 lastTapTime = 0; 56662 if (lightboxZoomState.scale > 1) { 56663 resetLightboxZoom(image); 56664 } else { 56665 lightboxZoomState.scale = DOUBLE_TAP_SCALE; 56666 applyLightboxTransform(image); 56667 } 56668 return; 56669 } 56670 lastTapTime = now; 56671 if (lightboxZoomState.scale > 1) { 56672 panStart = { 56673 x: event.touches[0].clientX, 56674 y: event.touches[0].clientY, 56675 originX: lightboxZoomState.x, 56676 originY: lightboxZoomState.y 56677 }; 56678 } 56679 }, 56680 { passive: true } 56681 ); 56682 image.addEventListener( 56683 "touchmove", 56684 (event) => { 56685 if (event.touches.length === 2) { 56686 event.preventDefault(); 56687 const scale = Math.min( 56688 MAX_SCALE, 56689 Math.max( 56690 1, 56691 pinchStartScale * (touchDistance(event.touches) / pinchStartDistance) 56692 ) 56693 ); 56694 lightboxZoomState.scale = scale; 56695 clampLightboxPan(image); 56696 applyLightboxTransform(image); 56697 } else if (event.touches.length === 1 && panStart) { 56698 event.preventDefault(); 56699 lightboxZoomState.x = panStart.originX + (event.touches[0].clientX - panStart.x); 56700 lightboxZoomState.y = panStart.originY + (event.touches[0].clientY - panStart.y); 56701 clampLightboxPan(image); 56702 applyLightboxTransform(image); 56703 } 56704 }, 56705 { passive: false } 56706 ); 56707 image.addEventListener("touchend", () => { 56708 panStart = null; 56709 }); 56710} 56711function initThumbnailsScrollIndicator() { 56712 var _a2; 56713 const thumbnails = document.querySelector(".thumbnails"); 56714 const arrow = document.querySelector(".thumbnails-more"); 56715 if (!thumbnails || !arrow) return; 56716 const items = thumbnails.querySelectorAll(".thumbnail"); 56717 const step = items.length > 1 ? items[1].offsetTop - items[0].offsetTop : ((_a2 = items[0]) == null ? void 0 : _a2.clientHeight) ?? 112; 56718 const updateArrow = () => { 56719 const hasMore = thumbnails.scrollHeight - thumbnails.scrollTop - thumbnails.clientHeight > 1; 56720 arrow.classList.toggle("hidden", !hasMore); 56721 }; 56722 thumbnails.addEventListener("scroll", updateArrow); 56723 arrow.addEventListener( 56724 "click", 56725 () => thumbnails.scrollBy({ top: step, behavior: "smooth" }) 56726 ); 56727 updateArrow(); 56728} 56729function initCollapsibleSections() { 56730 document.querySelectorAll("[data-collapsible]").forEach((section) => { 56731 const toggle = section.nextElementSibling; 56732 const heading = section.previousElementSibling; 56733 const hasToggleLink = toggle == null ? void 0 : toggle.classList.contains( 56734 "product-expand-description" 56735 ); 56736 const hasHeading = heading == null ? void 0 : heading.classList.contains("product-toc-heading"); 56737 const overflowing = section.scrollHeight > section.clientHeight + 1; 56738 if (overflowing) { 56739 if (hasToggleLink) toggle.classList.remove("hidden"); 56740 if (hasHeading) heading.classList.add("has-toggle"); 56741 } else if (hasToggleLink) { 56742 toggle.remove(); 56743 } 56744 }); 56745} 56746function handleExpandClick({ currentTarget }) { 56747 const targetClass = currentTarget.dataset.target; 56748 const container = currentTarget.parentElement; 56749 const target = container.querySelector(`.${targetClass}`); 56750 const collapsed = target.classList.contains("collapsed"); 56751 target.classList.toggle("collapsed", !collapsed); 56752 container.querySelectorAll(`[data-target="${targetClass}"]`).forEach((toggle) => { 56753 toggle.classList.toggle("expanded", collapsed); 56754 if (toggle.classList.contains("product-expand-description")) { 56755 toggle.innerText = collapsed ? "read less" : "read more"; 56756 } 56757 }); 56758} 56759function variantLabel(product, variant) { 56760 return variant.title === "Default Title" ? product.title : variant.title; 56761} 56762function handleVariantClick({ currentTarget }) { 56763 var _a2, _b2;
56764 const container = currentTarget.closest(".variants"); 56765 (_b2 = (_a2 = container.querySelector(".checked")) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.remove("checked"); 56766 currentTarget.classList.add("checked"); 56767 const variantId = currentTarget.dataset.value; 56768 const product = JSON.parse( 56769 document.querySelector(".buy-button").dataset.product 56770 ); 56771 const variant = product.variants.nodes.find((v2) => v2.id == variantId); 56772 const label = variant ? variantLabel(product, variant) : ""; 56773 const isbnDiv = document.getElementById("variant-isbn"); 56774 if (isbnDiv) { 56775 if (variant && variant.barcode) { 56776 isbnDiv.innerHTML = `${label} ISBN: ${variant.barcode}`; 56777 } else { 56778 isbnDiv.innerHTML = ""; 56779 } 56780 } 56781 const skuDiv = document.getElementById("variant-sku"); 56782 if (skuDiv) { 56783 if (variant && variant.sku) { 56784 skuDiv.innerHTML = `${label} SKU: ${variant.sku}`; 56785 } else { 56786 skuDiv.innerHTML = ""; 56787 } 56788 } 56789} 56790async function handleBuyClick({ target }) { 56791 const variants = target.closest(".variants"); 56792 try { 56793 const quantity = parseInt( 56794 variants.querySelector("select[name='quantity']").value 56795 ); 56796 const variantId = variants.querySelector(".variant-buttons .checked").dataset.value; 56797 const product = JSON.parse(target.dataset.product); 56798 const variant = product.variants.nodes.find((v2) => v2.id == variantId); 56799 const line = { 56800 quantity, 56801 merchandise: { 56802 id: variantId, 56803 title: variant.title, 56804 product 56805 } 56806 }; 56807 setCurrentPage("cart-page"); 56808 setDrawerOpen$1(true); 56809 setLoadingCart([line]); 56810 const cart = await addItemToCart(getCart().id, variantId, quantity); 56811 setCart(cart); 56812 } catch (error2) { 56813 console.error(error2); 56814 rollbackLoadingCart(); 56815 setCartError(error2); 56816 } 56817} 56818function productDisplayHandler() { 56819 if (document.querySelector(".related-products-container")) { 56820 const productIdElement = document.querySelector("[data-product-id]"); 56821 if (productIdElement) { 56822 const currentProductId = productIdElement.dataset.productId; 56823 const currentId = productIdElement.dataset.id; 56824 initRelatedProducts(currentProductId, currentId).then((html) => { 56825 document.querySelector(".related-products-scroller").innerHTML = html; 56826 }).catch(() => { 56827 const relatedProductsContainer = document.querySelector( 56828 ".related-products-container" 56829 ); 56830 relatedProductsContainer.classList.add("hidden"); 56831 }); 56832 } 56833 } 56834} 56835const EVENT_REGISTER_REGEX = /^\/events\/[^\/]+\/register(\/$)?$/i; 56836document.addEventListener("turbo:load", function(event) { 56837 const url = new URL(event.detail.url); 56838 if (url.pathname.match(EVENT_REGISTER_REGEX)) handleEventRegistration(); 56839}); 56840const FORM_VALIDATIONS = { 56841 email: { 56842 inputClass: "email-input", 56843 errorClass: "email-input-error", 56844 regex: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, 56845 errorMessage: "Please enter a valid email address." 56846 }, 56847 url: { 56848 inputClass: "url-input", 56849 errorClass: "url-input-error", 56850 regex: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-._~:/?#[\]@!$&'()*+,;=]*)?$/, 56851 errorMessage: "Please enter a valid url." 56852 }, 56853 phone: { 56854 inputClass: "phone-input", 56855 errorClass: "phone-input-error", 56856 regex: /^[0-9+\-\s()]{7,}$/, 56857 errorMessage: "Please enter a valid phone number." 56858 }, 56859 zip: { 56860 inputClass: "zip-input", 56861 errorClass: "zip-input-error", 56862 regex: /^\d{5}(-\d{4})?$/, 56863 errorMessage: "Please enter a valid zip-code." 56864 } 56865}; 56866const LOCATION_DEPENDENT_FIELDS = ["zip"]; 56867function initializeRegisterEventListeners(page2) { 56868 Object.keys(FORM_VALIDATIONS).forEach((fieldType) => { 56869 const config4 = FORM_VALIDATIONS[fieldType]; 56870 const inputs = page2.querySelectorAll(`input.${config4.inputClass}`); 56871 inputs.forEach((input) => { 56872 input.addEventListener( 56873 "blur", 56874 () => validateField(fieldType, input, page2) 56875 ); 56876 input.addEventListener( 56877 "input", 56878 () => handleInputChange(fieldType, input, config4, page2) 56879 ); 56880 }); 56881 }); 56882 setupCountrySelectListeners(page2); 56883} 56884function handleInputChange(fieldType, input, config4, page2) { 56885 const errorElement = findCorrespondingErrorElement(input, config4.errorClass); 56886 if (errorElement) { 56887 setErrorElementText(errorElement, fieldType, input); 56888 errorElement.classList.remove("has-error"); 56889 updateSubmitButtonState(page2); 56890 } 56891} 56892function setupCountrySelectListeners(page2) { 56893 page2.querySelectorAll(".address-block").forEach((addressBlock) => { 56894 const countrySelect = addressBlock.querySelector(".country-select"); 56895 const otherCountryContainer = addressBlock.querySelector( 56896 ".other-country-container" 56897 ); 56898 const otherCountryInput = addressBlock.querySelector( 56899 ".other-country-input" 56900 ); 56901 const stateLabel = addressBlock.querySelector(".state-input-error"); 56902 const zipLabel = addressBlock.querySelector(".zip-input-error"); 56903 const stateSelectContainer = addressBlock.querySelector( 56904 ".state-select-container" 56905 ); 56906 const stateSelect = addressBlock.querySelector(".state-select"); 56907 const stateInputContainer = addressBlock.querySelector( 56908 ".state-input-container" 56909 ); 56910 const stateInput = addressBlock.querySelector(".state-input"); 56911 if (countrySelect && otherCountryContainer && otherCountryInput && stateSelectContainer && stateSelect && stateInputContainer && stateInput && stateLabel) { 56912 let toggleOtherCountry2 = function() { 56913 if (countrySelect.value === "International") { 56914 otherCountryContainer.style.display = ""; 56915 otherCountryInput.required = true; 56916 stateSelectContainer.style.display = "none"; 56917 stateSelect.required = false;
56918 stateInputContainer.style.display = ""; 56919 stateInput.required = true; 56920 zipLabel.textContent = zipLabel.dataset.alt || zipLabel.dataset.title || ""; 56921 } else { 56922 otherCountryContainer.style.display = "none"; 56923 otherCountryInput.required = false; 56924 stateSelectContainer.style.display = ""; 56925 stateSelect.required = true; 56926 stateInputContainer.style.display = "none"; 56927 stateInput.required = false; 56928 zipLabel.textContent = zipLabel.dataset.title || ""; 56929 } 56930 const zipInput = addressBlock.querySelector(".zip-input"); 56931 if (zipInput) validateField("zip", zipInput, page2); 56932 }; 56933 var toggleOtherCountry = toggleOtherCountry2; 56934 countrySelect.addEventListener("change", toggleOtherCountry2); 56935 toggleOtherCountry2(); 56936 } 56937 }); 56938} 56939function findCorrespondingErrorElement(inputElement, errorClass) { 56940 const container = inputElement.closest(".floating-input-container"); 56941 if (container) { 56942 return container.querySelector(`.${errorClass}`); 56943 } 56944 let nextElement = inputElement.nextElementSibling; 56945 while (nextElement) { 56946 if (nextElement.classList.contains(errorClass)) { 56947 return nextElement; 56948 } 56949 nextElement = nextElement.nextElementSibling; 56950 } 56951 return null; 56952} 56953function isInternationalAddress(inputElement) { 56954 const addressBlock = inputElement.closest(".address-block"); 56955 if (!addressBlock) return false; 56956 const countrySelect = addressBlock.querySelector(".country-select"); 56957 return countrySelect && countrySelect.value !== "United States"; 56958} 56959function validateField(fieldType, inputElement, page2) { 56960 const config4 = FORM_VALIDATIONS[fieldType]; 56961 if (!config4) return; 56962 if (LOCATION_DEPENDENT_FIELDS.includes(fieldType) && isInternationalAddress(inputElement)) { 56963 const errorElement2 = findCorrespondingErrorElement( 56964 inputElement, 56965 config4.errorClass 56966 ); 56967 if (errorElement2) { 56968 setErrorElementText(errorElement2, fieldType, inputElement); 56969 errorElement2.classList.remove("has-error"); 56970 updateSubmitButtonState(page2); 56971 } 56972 return; 56973 } 56974 const errorElement = findCorrespondingErrorElement( 56975 inputElement, 56976 config4.errorClass 56977 ); 56978 if (!errorElement) return; 56979 const hasValue = inputElement.value.trim(); 56980 const isValid = hasValue && config4.regex.test(inputElement.value); 56981 if (hasValue && !isValid) { 56982 errorElement.textContent = config4.errorMessage; 56983 errorElement.classList.add("has-error"); 56984 } else { 56985 setErrorElementText(errorElement, fieldType, inputElement); 56986 errorElement.classList.remove("has-error"); 56987 } 56988 updateSubmitButtonState(page2); 56989} 56990function setErrorElementText(errorElement, fieldType, inputElement) { 56991 if (LOCATION_DEPENDENT_FIELDS.includes(fieldType) && isInternationalAddress(inputElement)) { 56992 errorElement.textContent = errorElement.dataset.alt || errorElement.dataset.title || ""; 56993 } else { 56994 errorElement.textContent = errorElement.dataset.title || ""; 56995 } 56996} 56997function updateSubmitButtonState(page2) { 56998 const form = page2.querySelector("form"); 56999 const submitBtn = form.querySelector("button[type='submit']"); 57000 const hasError = Array.from(form.querySelectorAll(".form-error")).some( 57001 (el) => el.textContent && el.textContent !== el.dataset.title && el.textContent !== el.dataset.alt 57002 ); 57003 submitBtn.disabled = hasError; 57004} 57005function handleEventRegistration() { 57006 const page2 = document.querySelector(".event-register"); 57007 const hasRegistrationForm = JSON.parse(page2.dataset.hasRegistrationForm); 57008 const defaultVariantId = page2.dataset.defaultVariantId; 57009 document.querySelectorAll(".variants > .store-btn").forEach( 57010 (node) => node.addEventListener("click", ({ target }) => { 57011 const input = page2.querySelector("input[name='variant-id']"); 57012 const variants = target.closest(".variants"); 57013 variants.querySelector(".selected").classList.remove("selected"); 57014 node.classList.add("selected"); 57015 input.value = node.dataset.value; 57016 }) 57017 ); 57018 if (hasRegistrationForm) { 57019 initializeRegisterEventListeners(page2); 57020 $$2(".event-register form").on("submit", function(event) { 57021 event.preventDefault(); 57022 const formData = new FormData(event.target); 57023 const variantId = formData.get("variant-id"); 57024 formData.delete("variant-id"); 57025 const attributes = [...formData].map(([key2, value]) => ({ 57026 key: key2, 57027 value: value || "empty" 57028 })); 57029 addTicketToCart(variantId, attributes); 57030 }); 57031 page2.classList.remove("hidden"); 57032 } else { 57033 addTicketToCart(defaultVariantId); 57034 } 57035} 57036async function addTicketToCart(merchandiseId, attributes = null) { 57037 const cartId = getCart().id; 57038 const line = { merchandiseId, quantity: 1 }; 57039 if (attributes) line.attributes = attributes; 57040 const response = await executeGraphQL(ADD_LINES_MUTATION, { 57041 cartId, 57042 lines: [line] 57043 }); 57044 logCartActivity({ action: "addTicketToCart", cartId, merchandiseId }); 57045 setCart(response.cartLinesAdd.cart); 57046 Turbo.visit("/cart"); 57047} 57048if (!window.jQuery) window.jQuery = $$2; 57049if (!window.$) window.$ = $$2; 57050gsapWithCSS.registerPlugin(Flip, TextPlugin, SplitText, MorphSVGPlugin);
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.