vendor: 1,719 bytes, lines 1-46
1var __create = Object.create; 2var __getProtoOf = Object.getPrototypeOf; 3var __defProp = Object.defineProperty; 4var __getOwnPropNames = Object.getOwnPropertyNames; 5var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6var __hasOwnProp = Object.prototype.hasOwnProperty; 7function __accessProp(key) { 8 return this[key]; 9} 10var __toESMCache_node; 11var __toESMCache_esm; 12var __toESM = (mod, isNodeMode, target) => { 13 var canCache = mod != null && typeof mod === "object"; 14 if (canCache) { 15 var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap; 16 var cached = cache.get(mod); 17 if (cached) 18 return cached; 19 } 20 target = mod != null ? __create(__getProtoOf(mod)) : {}; 21 const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target; 22 if (mod && typeof mod === "object" || typeof mod === "function") { 23 for (let key of __getOwnPropNames(mod)) 24 if (!__hasOwnProp.call(to, key)) 25 __defProp(to, key, { 26 get: __accessProp.bind(mod, key), 27 enumerable: true 28 }); 29 } 30 if (canCache) 31 cache.set(mod, to); 32 return to; 33}; 34var __toCommonJS = (from) => { 35 var entry = (__moduleCache ??= new WeakMap).get(from), desc; 36 if (entry) 37 return entry; 38 entry = __defProp({}, "__esModule", { value: true }); 39 if (from && typeof from === "object" || typeof from === "function") { 40 for (var key of __getOwnPropNames(from)) 41 if (!__hasOwnProp.call(entry, key)) 42 __defProp(entry, key, { 43 get: __accessProp.bind(from, key), 44 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable 45 }); 46 }
47 __moduleCache.set(from, entry); 48 return entry; 49}; 50var __moduleCache; 51var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); 52var __returnValue = (v) => v; 53function __exportSetter(name, newValue) { 54 this[name] = __returnValue.bind(null, newValue); 55} 56var __export = (target, all2) => { 57 for (var name in all2) 58 __defProp(target, name, { 59 get: all2[name], 60 enumerable: true, 61 configurable: true, 62 set: __exportSetter.bind(all2, name) 63 }); 64}; 65var __esm = (fn2, res, err) => () => { 66 if (fn2) 67 try { 68 res = fn2(fn2 = 0); 69 } catch (e) { 70 err = [e]; 71 } 72 if (err) 73 throw err[0]; 74 return res; 75}; 76
vendor: 215,185 bytes, lines 77-5910
77// node_modules/jquery/dist/jquery.js 78var require_jquery = __commonJS(function(exports2, module2) { 79 /*! 80 * jQuery JavaScript Library v3.7.1 81 * https://jquery.com/ 82 * 83 * Copyright OpenJS Foundation and other contributors 84 * Released under the MIT license 85 * https://jquery.org/license 86 * 87 * Date: 2023-08-28T13:37Z 88 */ 89 (function(global2, factory) { 90 if (typeof module2 === "object" && typeof module2.exports === "object") { 91 module2.exports = global2.document ? factory(global2, true) : function(w) { 92 if (!w.document) { 93 throw new Error("jQuery requires a window with a document"); 94 } 95 return factory(w); 96 }; 97 } else { 98 factory(global2); 99 } 100 })(typeof window !== "undefined" ? window : exports2, function(window2, noGlobal) { 101 var arr = []; 102 var getProto = Object.getPrototypeOf; 103 var slice = arr.slice; 104 var flat = arr.flat ? function(array) { 105 return arr.flat.call(array); 106 } : function(array) { 107 return arr.concat.apply([], array); 108 }; 109 var push = arr.push; 110 var indexOf = arr.indexOf; 111 var class2type = {}; 112 var toString = class2type.toString; 113 var hasOwn = class2type.hasOwnProperty; 114 var fnToString = hasOwn.toString; 115 var ObjectFunctionString = fnToString.call(Object); 116 var support = {}; 117 var isFunction = function isFunction(obj2) { 118 return typeof obj2 === "function" && typeof obj2.nodeType !== "number" && typeof obj2.item !== "function"; 119 }; 120 var isWindow = function isWindow(obj2) { 121 return obj2 != null && obj2 === obj2.window; 122 }; 123 var document2 = window2.document; 124 var preservedScriptAttributes = { 125 type: true, 126 src: true, 127 nonce: true, 128 noModule: true 129 }; 130 function DOMEval(code, node, doc) { 131 doc = doc || document2; 132 var i, val, script = doc.createElement("script"); 133 script.text = code; 134 if (node) { 135 for (i in preservedScriptAttributes) { 136 val = node[i] || node.getAttribute && node.getAttribute(i); 137 if (val) { 138 script.setAttribute(i, val); 139 } 140 } 141 } 142 doc.head.appendChild(script).parentNode.removeChild(script); 143 } 144 function toType(obj2) { 145 if (obj2 == null) { 146 return obj2 + ""; 147 } 148 return typeof obj2 === "object" || typeof obj2 === "function" ? class2type[toString.call(obj2)] || "object" : typeof obj2; 149 } 150 var version = "3.7.1", rhtmlSuffix = /HTML$/i, jQuery2 = function(selector, context) { 151 return new jQuery2.fn.init(selector, context); 152 }; 153 jQuery2.fn = jQuery2.prototype = { 154 jquery: version, 155 constructor: jQuery2, 156 length: 0, 157 toArray: function() { 158 return slice.call(this); 159 }, 160 get: function(num) { 161 if (num == null) { 162 return slice.call(this); 163 } 164 return num < 0 ? this[num + this.length] : this[num]; 165 }, 166 pushStack: function(elems) { 167 var ret2 = jQuery2.merge(this.constructor(), elems); 168 ret2.prevObject = this; 169 return ret2; 170 }, 171 each: function(callback) { 172 return jQuery2.each(this, callback); 173 }, 174 map: function(callback) { 175 return this.pushStack(jQuery2.map(this, function(elem, i) { 176 return callback.call(elem, i, elem); 177 })); 178 }, 179 slice: function() { 180 return this.pushStack(slice.apply(this, arguments)); 181 }, 182 first: function() { 183 return this.eq(0); 184 }, 185 last: function() { 186 return this.eq(-1); 187 }, 188 even: function() { 189 return this.pushStack(jQuery2.grep(this, function(_elem, i) { 190 return (i + 1) % 2; 191 })); 192 }, 193 odd: function() { 194 return this.pushStack(jQuery2.grep(this, function(_elem, i) { 195 return i % 2; 196 })); 197 }, 198 eq: function(i) { 199 var len = this.length, j = +i + (i < 0 ? len : 0); 200 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 201 }, 202 end: function() { 203 return this.prevObject || this.constructor(); 204 }, 205 push, 206 sort: arr.sort, 207 splice: arr.splice 208 }; 209 jQuery2.extend = jQuery2.fn.extend = function() { 210 var options2, name, src, copy, copyIsArray, clone2, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; 211 if (typeof target === "boolean") { 212 deep = target; 213 target = arguments[i] || {}; 214 i++; 215 } 216 if (typeof target !== "object" && !isFunction(target)) { 217 target = {}; 218 } 219 if (i === length) { 220 target = this; 221 i--; 222 } 223 for (;i < length; i++) { 224 if ((options2 = arguments[i]) != null) { 225 for (name in options2) { 226 copy = options2[name]; 227 if (name === "__proto__" || target === copy) { 228 continue; 229 } 230 if (deep && copy && (jQuery2.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { 231 src = target[name]; 232 if (copyIsArray && !Array.isArray(src)) { 233 clone2 = []; 234 } else if (!copyIsArray && !jQuery2.isPlainObject(src)) { 235 clone2 = {}; 236 } else { 237 clone2 = src; 238 } 239 copyIsArray = false; 240 target[name] = jQuery2.extend(deep, clone2, copy); 241 } else if (copy !== undefined) { 242 target[name] = copy; 243 } 244 } 245 } 246 } 247 return target; 248 }; 249 jQuery2.extend({ 250 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 251 isReady: true, 252 error: function(msg) { 253 throw new Error(msg); 254 }, 255 noop: function() {}, 256 isPlainObject: function(obj2) { 257 var proto, Ctor; 258 if (!obj2 || toString.call(obj2) !== "[object Object]") { 259 return false; 260 } 261 proto = getProto(obj2); 262 if (!proto) { 263 return true; 264 } 265 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 266 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 267 }, 268 isEmptyObject: function(obj2) { 269 var name; 270 for (name in obj2) { 271 return false; 272 } 273 return true; 274 }, 275 globalEval: function(code, options2, doc) { 276 DOMEval(code, { nonce: options2 && options2.nonce }, doc); 277 }, 278 each: function(obj2, callback) { 279 var length, i = 0; 280 if (isArrayLike(obj2)) { 281 length = obj2.length; 282 for (;i < length; i++) { 283 if (callback.call(obj2[i], i, obj2[i]) === false) { 284 break; 285 } 286 } 287 } else { 288 for (i in obj2) { 289 if (callback.call(obj2[i], i, obj2[i]) === false) { 290 break; 291 } 292 } 293 } 294 return obj2; 295 }, 296 text: function(elem) { 297 var node, ret2 = "", i = 0, nodeType = elem.nodeType; 298 if (!nodeType) { 299 while (node = elem[i++]) { 300 ret2 += jQuery2.text(node); 301 } 302 } 303 if (nodeType === 1 || nodeType === 11) { 304 return elem.textContent; 305 } 306 if (nodeType === 9) { 307 return elem.documentElement.textContent; 308 } 309 if (nodeType === 3 || nodeType === 4) { 310 return elem.nodeValue; 311 } 312 return ret2; 313 }, 314 makeArray: function(arr, results) { 315 var ret2 = results || []; 316 if (arr != null) { 317 if (isArrayLike(Object(arr))) { 318 jQuery2.merge(ret2, typeof arr === "string" ? [arr] : arr); 319 } else { 320 push.call(ret2, arr); 321 } 322 } 323 return ret2; 324 }, 325 inArray: function(elem, arr, i) { 326 return arr == null ? -1 : indexOf.call(arr, elem, i); 327 }, 328 isXMLDoc: function(elem) { 329 var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement; 330 return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML"); 331 }, 332 merge: function(first, second) { 333 var len = +second.length, j = 0, i = first.length; 334 for (;j < len; j++) { 335 first[i++] = second[j]; 336 } 337 first.length = i; 338 return first; 339 }, 340 grep: function(elems, callback, invert) { 341 var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; 342 for (;i < length; i++) { 343 callbackInverse = !callback(elems[i], i); 344 if (callbackInverse !== callbackExpect) { 345 matches.push(elems[i]); 346 } 347 } 348 return matches; 349 }, 350 map: function(elems, callback, arg) { 351 var length, value, i = 0, ret2 = []; 352 if (isArrayLike(elems)) { 353 length = elems.length; 354 for (;i < length; i++) { 355 value = callback(elems[i], i, arg); 356 if (value != null) { 357 ret2.push(value); 358 } 359 } 360 } else { 361 for (i in elems) { 362 value = callback(elems[i], i, arg); 363 if (value != null) { 364 ret2.push(value); 365 } 366 } 367 } 368 return flat(ret2); 369 }, 370 guid: 1, 371 support 372 }); 373 if (typeof Symbol === "function") { 374 jQuery2.fn[Symbol.iterator] = arr[Symbol.iterator]; 375 } 376 jQuery2.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(_i, name) { 377 class2type["[object " + name + "]"] = name.toLowerCase(); 378 }); 379 function isArrayLike(obj2) { 380 var length = !!obj2 && "length" in obj2 && obj2.length, type = toType(obj2); 381 if (isFunction(obj2) || isWindow(obj2)) { 382 return false; 383 } 384 return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj2; 385 } 386 function nodeName(elem, name) { 387 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 388 } 389 var pop = arr.pop; 390 var sort = arr.sort; 391 var splice = arr.splice; 392 var whitespace = "[\\x20\\t\\r\\n\\f]"; 393 var rtrimCSS = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"); 394 jQuery2.contains = function(a, b) { 395 var bup = b && b.parentNode; 396 return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); 397 }; 398 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 399 function fcssescape(ch, asCodePoint) { 400 if (asCodePoint) { 401 if (ch === "\x00") { 402 return "�"; 403 } 404 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 405 } 406 return "\\" + ch; 407 } 408 jQuery2.escapeSelector = function(sel) { 409 return (sel + "").replace(rcssescape, fcssescape); 410 }; 411 var preferredDoc = document2, pushNative = push; 412 (function() { 413 var i, Expr, outermostContext, sortInput, hasDuplicate, push = pushNative, document2, documentElement, documentIsHTML, rbuggyQSA, matches, expando = jQuery2.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) { 414 if (a === b) { 415 hasDuplicate = true; 416 } 417 return 0; 418 }, 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-]|[^\x00-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + 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 = { 419 ID: new RegExp("^#(" + identifier + ")"), 420 CLASS: new RegExp("^\\.(" + identifier + ")"), 421 TAG: new RegExp("^(" + identifier + "|[*])"), 422 ATTR: new RegExp("^" + attributes), 423 PSEUDO: new RegExp("^" + pseudos), 424 CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 425 bool: new RegExp("^(?:" + booleans + ")$", "i"), 426 needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 427 }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) { 428 var high = "0x" + escape2.slice(1) - 65536; 429 if (nonHex) { 430 return nonHex; 431 } 432 return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); 433 }, unloadHandler = function() { 434 setDocument(); 435 }, inDisabledFieldset = addCombinator(function(elem) { 436 return elem.disabled === true && nodeName(elem, "fieldset"); 437 }, { dir: "parentNode", next: "legend" }); 438 function safeActiveElement() { 439 try { 440 return document2.activeElement; 441 } catch (err) {} 442 } 443 try { 444 push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); 445 arr[preferredDoc.childNodes.length].nodeType; 446 } catch (e) { 447 push = { 448 apply: function(target, els) { 449 pushNative.apply(target, slice.call(els)); 450 }, 451 call: function(target) { 452 pushNative.apply(target, slice.call(arguments, 1)); 453 } 454 }; 455 } 456 function find(selector, context, results, seed) { 457 var m2, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9; 458 results = results || []; 459 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 460 return results; 461 } 462 if (!seed) { 463 setDocument(context); 464 context = context || document2; 465 if (documentIsHTML) { 466 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) { 467 if (m2 = match[1]) { 468 if (nodeType === 9) { 469 if (elem = context.getElementById(m2)) { 470 if (elem.id === m2) { 471 push.call(results, elem); 472 return results; 473 } 474 } else { 475 return results; 476 } 477 } else { 478 if (newContext && (elem = newContext.getElementById(m2)) && find.contains(context, elem) && elem.id === m2) { 479 push.call(results, elem); 480 return results; 481 } 482 } 483 } else if (match[2]) { 484 push.apply(results, context.getElementsByTagName(selector)); 485 return results; 486 } else if ((m2 = match[3]) && context.getElementsByClassName) { 487 push.apply(results, context.getElementsByClassName(m2)); 488 return results; 489 } 490 } 491 if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) { 492 newSelector = selector; 493 newContext = context; 494 if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) { 495 newContext = rsibling.test(selector) && testContext(context.parentNode) || context; 496 if (newContext != context || !support.scope) { 497 if (nid = context.getAttribute("id")) { 498 nid = jQuery2.escapeSelector(nid); 499 } else { 500 context.setAttribute("id", nid = expando); 501 } 502 } 503 groups = tokenize(selector); 504 i = groups.length; 505 while (i--) { 506 groups[i] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i]); 507 } 508 newSelector = groups.join(","); 509 } 510 try { 511 push.apply(results, newContext.querySelectorAll(newSelector)); 512 return results; 513 } catch (qsaError) { 514 nonnativeSelectorCache(selector, true); 515 } finally { 516 if (nid === expando) { 517 context.removeAttribute("id"); 518 } 519 } 520 } 521 } 522 } 523 return select2(selector.replace(rtrimCSS, "$1"), context, results, seed); 524 } 525 function createCache() { 526 var keys = []; 527 function cache(key, value) { 528 if (keys.push(key + " ") > Expr.cacheLength) { 529 delete cache[keys.shift()]; 530 } 531 return cache[key + " "] = value; 532 } 533 return cache; 534 } 535 function markFunction(fn2) { 536 fn2[expando] = true; 537 return fn2; 538 } 539 function assert(fn2) { 540 var el = document2.createElement("fieldset"); 541 try { 542 return !!fn2(el); 543 } catch (e) { 544 return false; 545 } finally { 546 if (el.parentNode) { 547 el.parentNode.removeChild(el); 548 } 549 el = null; 550 } 551 } 552 function createInputPseudo(type) { 553 return function(elem) { 554 return nodeName(elem, "input") && elem.type === type; 555 }; 556 } 557 function createButtonPseudo(type) { 558 return function(elem) { 559 return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type; 560 }; 561 } 562 function createDisabledPseudo(disabled) { 563 return function(elem) { 564 if ("form" in elem) { 565 if (elem.parentNode && elem.disabled === false) { 566 if ("label" in elem) { 567 if ("label" in elem.parentNode) { 568 return elem.parentNode.disabled === disabled; 569 } else { 570 return elem.disabled === disabled; 571 } 572 } 573 return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled; 574 } 575 return elem.disabled === disabled; 576 } else if ("label" in elem) { 577 return elem.disabled === disabled; 578 } 579 return false; 580 }; 581 } 582 function createPositionalPseudo(fn2) { 583 return markFunction(function(argument) { 584 argument = +argument; 585 return markFunction(function(seed, matches) { 586 var j, matchIndexes = fn2([], seed.length, argument), i = matchIndexes.length; 587 while (i--) { 588 if (seed[j = matchIndexes[i]]) { 589 seed[j] = !(matches[j] = seed[j]); 590 } 591 } 592 }); 593 }); 594 } 595 function testContext(context) { 596 return context && typeof context.getElementsByTagName !== "undefined" && context; 597 } 598 function setDocument(node) { 599 var subWindow, doc = node ? node.ownerDocument || node : preferredDoc; 600 if (doc == document2 || doc.nodeType !== 9 || !doc.documentElement) { 601 return document2; 602 } 603 document2 = doc; 604 documentElement = document2.documentElement; 605 documentIsHTML = !jQuery2.isXMLDoc(document2); 606 matches = documentElement.matches || documentElement.webkitMatchesSelector || documentElement.msMatchesSelector; 607 if (documentElement.msMatchesSelector && preferredDoc != document2 && (subWindow = document2.defaultView) && subWindow.top !== subWindow) { 608 subWindow.addEventListener("unload", unloadHandler); 609 } 610 support.getById = assert(function(el) { 611 documentElement.appendChild(el).id = jQuery2.expando; 612 return !document2.getElementsByName || !document2.getElementsByName(jQuery2.expando).length; 613 }); 614 support.disconnectedMatch = assert(function(el) { 615 return matches.call(el, "*"); 616 }); 617 support.scope = assert(function() { 618 return document2.querySelectorAll(":scope"); 619 }); 620 support.cssHas = assert(function() { 621 try { 622 document2.querySelector(":has(*,:jqfake)"); 623 return false; 624 } catch (e) { 625 return true; 626 } 627 }); 628 if (support.getById) { 629 Expr.filter.ID = function(id) { 630 var attrId = id.replace(runescape, funescape); 631 return function(elem) { 632 return elem.getAttribute("id") === attrId; 633 }; 634 }; 635 Expr.find.ID = function(id, context) { 636 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 637 var elem = context.getElementById(id); 638 return elem ? [elem] : []; 639 } 640 }; 641 } else { 642 Expr.filter.ID = function(id) { 643 var attrId = id.replace(runescape, funescape); 644 return function(elem) { 645 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 646 return node && node.value === attrId; 647 }; 648 }; 649 Expr.find.ID = function(id, context) { 650 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 651 var node, i, elems, elem = context.getElementById(id); 652 if (elem) { 653 node = elem.getAttributeNode("id"); 654 if (node && node.value === id) { 655 return [elem]; 656 } 657 elems = context.getElementsByName(id); 658 i = 0; 659 while (elem = elems[i++]) { 660 node = elem.getAttributeNode("id"); 661 if (node && node.value === id) { 662 return [elem]; 663 } 664 } 665 } 666 return []; 667 } 668 }; 669 } 670 Expr.find.TAG = function(tag, context) { 671 if (typeof context.getElementsByTagName !== "undefined") { 672 return context.getElementsByTagName(tag); 673 } else { 674 return context.querySelectorAll(tag); 675 } 676 }; 677 Expr.find.CLASS = function(className, context) { 678 if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { 679 return context.getElementsByClassName(className); 680 } 681 }; 682 rbuggyQSA = []; 683 assert(function(el) { 684 var input; 685 documentElement.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a>" + "<select id='" + expando + "-\r\\' disabled='disabled'>" + "<option selected=''></option></select>"; 686 if (!el.querySelectorAll("[selected]").length) { 687 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 688 } 689 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 690 rbuggyQSA.push("~="); 691 } 692 if (!el.querySelectorAll("a#" + expando + "+*").length) { 693 rbuggyQSA.push(".#.+[+~]"); 694 } 695 if (!el.querySelectorAll(":checked").length) { 696 rbuggyQSA.push(":checked"); 697 } 698 input = document2.createElement("input"); 699 input.setAttribute("type", "hidden"); 700 el.appendChild(input).setAttribute("name", "D"); 701 documentElement.appendChild(el).disabled = true; 702 if (el.querySelectorAll(":disabled").length !== 2) { 703 rbuggyQSA.push(":enabled", ":disabled"); 704 } 705 input = document2.createElement("input"); 706 input.setAttribute("name", ""); 707 el.appendChild(input); 708 if (!el.querySelectorAll("[name='']").length) { 709 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`); 710 } 711 }); 712 if (!support.cssHas) { 713 rbuggyQSA.push(":has"); 714 } 715 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 716 sortOrder = function(a, b) { 717 if (a === b) { 718 hasDuplicate = true; 719 return 0; 720 } 721 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 722 if (compare) { 723 return compare; 724 } 725 compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1; 726 if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) { 727 if (a === document2 || a.ownerDocument == preferredDoc && find.contains(preferredDoc, a)) { 728 return -1; 729 } 730 if (b === document2 || b.ownerDocument == preferredDoc && find.contains(preferredDoc, b)) { 731 return 1; 732 } 733 return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0; 734 } 735 return compare & 4 ? -1 : 1; 736 }; 737 return document2; 738 } 739 find.matches = function(expr, elements) { 740 return find(expr, null, null, elements); 741 }; 742 find.matchesSelector = function(elem, expr) { 743 setDocument(elem); 744 if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) { 745 try { 746 var ret2 = matches.call(elem, expr); 747 if (ret2 || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { 748 return ret2; 749 } 750 } catch (e) { 751 nonnativeSelectorCache(expr, true); 752 } 753 } 754 return find(expr, document2, null, [elem]).length > 0; 755 }; 756 find.contains = function(context, elem) { 757 if ((context.ownerDocument || context) != document2) { 758 setDocument(context); 759 } 760 return jQuery2.contains(context, elem); 761 }; 762 find.attr = function(elem, name) { 763 if ((elem.ownerDocument || elem) != document2) { 764 setDocument(elem); 765 } 766 var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : undefined; 767 if (val !== undefined) { 768 return val; 769 } 770 return elem.getAttribute(name); 771 }; 772 find.error = function(msg) { 773 throw new Error("Syntax error, unrecognized expression: " + msg); 774 }; 775 jQuery2.uniqueSort = function(results) { 776 var elem, duplicates = [], j = 0, i = 0; 777 hasDuplicate = !support.sortStable; 778 sortInput = !support.sortStable && slice.call(results, 0); 779 sort.call(results, sortOrder); 780 if (hasDuplicate) { 781 while (elem = results[i++]) { 782 if (elem === results[i]) { 783 j = duplicates.push(i); 784 } 785 } 786 while (j--) { 787 splice.call(results, duplicates[j], 1); 788 } 789 } 790 sortInput = null; 791 return results; 792 }; 793 jQuery2.fn.uniqueSort = function() { 794 return this.pushStack(jQuery2.uniqueSort(slice.apply(this))); 795 }; 796 Expr = jQuery2.expr = { 797 cacheLength: 50, 798 createPseudo: markFunction, 799 match: matchExpr, 800 attrHandle: {}, 801 find: {}, 802 relative: { 803 ">": { dir: "parentNode", first: true }, 804 " ": { dir: "parentNode" }, 805 "+": { dir: "previousSibling", first: true }, 806 "~": { dir: "previousSibling" } 807 }, 808 preFilter: { 809 ATTR: function(match) { 810 match[1] = match[1].replace(runescape, funescape); 811 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); 812 if (match[2] === "~=") { 813 match[3] = " " + match[3] + " "; 814 } 815 return match.slice(0, 4); 816 }, 817 CHILD: function(match) { 818 match[1] = match[1].toLowerCase(); 819 if (match[1].slice(0, 3) === "nth") { 820 if (!match[3]) { 821 find.error(match[0]); 822 } 823 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); 824 match[5] = +(match[7] + match[8] || match[3] === "odd"); 825 } else if (match[3]) { 826 find.error(match[0]); 827 } 828 return match; 829 }, 830 PSEUDO: function(match) { 831 var excess, unquoted = !match[6] && match[2]; 832 if (matchExpr.CHILD.test(match[0])) { 833 return null; 834 } 835 if (match[3]) { 836 match[2] = match[4] || match[5] || ""; 837 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 838 match[0] = match[0].slice(0, excess); 839 match[2] = unquoted.slice(0, excess); 840 } 841 return match.slice(0, 3); 842 } 843 }, 844 filter: { 845 TAG: function(nodeNameSelector) { 846 var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 847 return nodeNameSelector === "*" ? function() { 848 return true; 849 } : function(elem) { 850 return nodeName(elem, expectedNodeName); 851 }; 852 }, 853 CLASS: function(className) { 854 var pattern = classCache[className + " "]; 855 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) { 856 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""); 857 }); 858 }, 859 ATTR: function(name, operator, check) { 860 return function(elem) { 861 var result = find.attr(elem, name); 862 if (result == null) { 863 return operator === "!="; 864 } 865 if (!operator) { 866 return true; 867 } 868 result += ""; 869 if (operator === "=") { 870 return result === check; 871 } 872 if (operator === "!=") { 873 return result !== check; 874 } 875 if (operator === "^=") { 876 return check && result.indexOf(check) === 0; 877 } 878 if (operator === "*=") { 879 return check && result.indexOf(check) > -1; 880 } 881 if (operator === "$=") { 882 return check && result.slice(-check.length) === check; 883 } 884 if (operator === "~=") { 885 return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1; 886 } 887 if (operator === "|=") { 888 return result === check || result.slice(0, check.length + 1) === check + "-"; 889 } 890 return false; 891 }; 892 }, 893 CHILD: function(type, what, _argument, first, last) { 894 var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type"; 895 return first === 1 && last === 0 ? function(elem) { 896 return !!elem.parentNode; 897 } : function(elem, _context, xml) { 898 var cache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; 899 if (parent) { 900 if (simple) { 901 while (dir) { 902 node = elem; 903 while (node = node[dir]) { 904 if (ofType ? nodeName(node, name) : node.nodeType === 1) { 905 return false; 906 } 907 } 908 start = dir = type === "only" && !start && "nextSibling"; 909 } 910 return true; 911 } 912 start = [forward ? parent.firstChild : parent.lastChild]; 913 if (forward && useCache) { 914 outerCache = parent[expando] || (parent[expando] = {}); 915 cache = outerCache[type] || []; 916 nodeIndex = cache[0] === dirruns && cache[1]; 917 diff = nodeIndex && cache[2]; 918 node = nodeIndex && parent.childNodes[nodeIndex]; 919 while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { 920 if (node.nodeType === 1 && ++diff && node === elem) { 921 outerCache[type] = [dirruns, nodeIndex, diff]; 922 break; 923 } 924 } 925 } else { 926 if (useCache) { 927 outerCache = elem[expando] || (elem[expando] = {}); 928 cache = outerCache[type] || []; 929 nodeIndex = cache[0] === dirruns && cache[1]; 930 diff = nodeIndex; 931 } 932 if (diff === false) { 933 while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { 934 if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) { 935 if (useCache) { 936 outerCache = node[expando] || (node[expando] = {}); 937 outerCache[type] = [dirruns, diff]; 938 } 939 if (node === elem) { 940 break; 941 } 942 } 943 } 944 } 945 } 946 diff -= last; 947 return diff === first || diff % first === 0 && diff / first >= 0; 948 } 949 }; 950 }, 951 PSEUDO: function(pseudo, argument) { 952 var args2, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find.error("unsupported pseudo: " + pseudo); 953 if (fn2[expando]) { 954 return fn2(argument); 955 } 956 if (fn2.length > 1) { 957 args2 = [pseudo, pseudo, "", argument]; 958 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) { 959 var idx, matched = fn2(seed, argument), i = matched.length; 960 while (i--) { 961 idx = indexOf.call(seed, matched[i]); 962 seed[idx] = !(matches[idx] = matched[i]); 963 } 964 }) : function(elem) { 965 return fn2(elem, 0, args2); 966 }; 967 } 968 return fn2; 969 } 970 }, 971 pseudos: { 972 not: markFunction(function(selector) { 973 var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1")); 974 return matcher[expando] ? markFunction(function(seed, matches, _context, xml) { 975 var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; 976 while (i--) { 977 if (elem = unmatched[i]) { 978 seed[i] = !(matches[i] = elem); 979 } 980 } 981 }) : function(elem, _context, xml) { 982 input[0] = elem; 983 matcher(input, null, xml, results); 984 input[0] = null; 985 return !results.pop(); 986 }; 987 }), 988 has: markFunction(function(selector) { 989 return function(elem) { 990 return find(selector, elem).length > 0; 991 }; 992 }), 993 contains: markFunction(function(text2) { 994 text2 = text2.replace(runescape, funescape); 995 return function(elem) { 996 return (elem.textContent || jQuery2.text(elem)).indexOf(text2) > -1; 997 }; 998 }), 999 lang: markFunction(function(lang) { 1000 if (!ridentifier.test(lang || "")) { 1001 find.error("unsupported lang: " + lang); 1002 } 1003 lang = lang.replace(runescape, funescape).toLowerCase(); 1004 return function(elem) { 1005 var elemLang; 1006 do { 1007 if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { 1008 elemLang = elemLang.toLowerCase(); 1009 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 1010 } 1011 } while ((elem = elem.parentNode) && elem.nodeType === 1); 1012 return false; 1013 }; 1014 }), 1015 target: function(elem) { 1016 var hash = window2.location && window2.location.hash; 1017 return hash && hash.slice(1) === elem.id; 1018 }, 1019 root: function(elem) { 1020 return elem === documentElement; 1021 }, 1022 focus: function(elem) { 1023 return elem === safeActiveElement() && document2.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex); 1024 }, 1025 enabled: createDisabledPseudo(false), 1026 disabled: createDisabledPseudo(true), 1027 checked: function(elem) { 1028 return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected; 1029 }, 1030 selected: function(elem) { 1031 if (elem.parentNode) { 1032 elem.parentNode.selectedIndex; 1033 } 1034 return elem.selected === true; 1035 }, 1036 empty: function(elem) { 1037 for (elem = elem.firstChild;elem; elem = elem.nextSibling) { 1038 if (elem.nodeType < 6) { 1039 return false; 1040 } 1041 } 1042 return true; 1043 }, 1044 parent: function(elem) { 1045 return !Expr.pseudos.empty(elem); 1046 }, 1047 header: function(elem) { 1048 return rheader.test(elem.nodeName); 1049 }, 1050 input: function(elem) { 1051 return rinputs.test(elem.nodeName); 1052 }, 1053 button: function(elem) { 1054 return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button"); 1055 }, 1056 text: function(elem) { 1057 var attr; 1058 return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); 1059 }, 1060 first: createPositionalPseudo(function() { 1061 return [0]; 1062 }), 1063 last: createPositionalPseudo(function(_matchIndexes, length) { 1064 return [length - 1]; 1065 }), 1066 eq: createPositionalPseudo(function(_matchIndexes, length, argument) { 1067 return [argument < 0 ? argument + length : argument]; 1068 }), 1069 even: createPositionalPseudo(function(matchIndexes, length) { 1070 var i = 0; 1071 for (;i < length; i += 2) { 1072 matchIndexes.push(i); 1073 } 1074 return matchIndexes; 1075 }), 1076 odd: createPositionalPseudo(function(matchIndexes, length) { 1077 var i = 1; 1078 for (;i < length; i += 2) { 1079 matchIndexes.push(i); 1080 } 1081 return matchIndexes; 1082 }), 1083 lt: createPositionalPseudo(function(matchIndexes, length, argument) { 1084 var i; 1085 if (argument < 0) { 1086 i = argument + length; 1087 } else if (argument > length) { 1088 i = length; 1089 } else { 1090 i = argument; 1091 } 1092 for (;--i >= 0; ) { 1093 matchIndexes.push(i); 1094 } 1095 return matchIndexes; 1096 }), 1097 gt: createPositionalPseudo(function(matchIndexes, length, argument) { 1098 var i = argument < 0 ? argument + length : argument; 1099 for (;++i < length; ) { 1100 matchIndexes.push(i); 1101 } 1102 return matchIndexes; 1103 }) 1104 } 1105 }; 1106 Expr.pseudos.nth = Expr.pseudos.eq; 1107 for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { 1108 Expr.pseudos[i] = createInputPseudo(i); 1109 } 1110 for (i in { submit: true, reset: true }) { 1111 Expr.pseudos[i] = createButtonPseudo(i); 1112 } 1113 function setFilters() {} 1114 setFilters.prototype = Expr.filters = Expr.pseudos; 1115 Expr.setFilters = new setFilters; 1116 function tokenize(selector, parseOnly) { 1117 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "]; 1118 if (cached) { 1119 return parseOnly ? 0 : cached.slice(0); 1120 } 1121 soFar = selector; 1122 groups = []; 1123 preFilters = Expr.preFilter; 1124 while (soFar) { 1125 if (!matched || (match = rcomma.exec(soFar))) { 1126 if (match) { 1127 soFar = soFar.slice(match[0].length) || soFar; 1128 } 1129 groups.push(tokens = []); 1130 } 1131 matched = false; 1132 if (match = rleadingCombinator.exec(soFar)) { 1133 matched = match.shift(); 1134 tokens.push({ 1135 value: matched, 1136 type: match[0].replace(rtrimCSS, " ") 1137 }); 1138 soFar = soFar.slice(matched.length); 1139 } 1140 for (type in Expr.filter) { 1141 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { 1142 matched = match.shift(); 1143 tokens.push({ 1144 value: matched, 1145 type, 1146 matches: match 1147 }); 1148 soFar = soFar.slice(matched.length); 1149 } 1150 } 1151 if (!matched) { 1152 break; 1153 } 1154 } 1155 if (parseOnly) { 1156 return soFar.length; 1157 } 1158 return soFar ? find.error(selector) : tokenCache(selector, groups).slice(0); 1159 } 1160 function toSelector(tokens) { 1161 var i = 0, len = tokens.length, selector = ""; 1162 for (;i < len; i++) { 1163 selector += tokens[i].value; 1164 } 1165 return selector; 1166 } 1167 function addCombinator(matcher, combinator, base) { 1168 var { dir, next: skip } = combinator, key = skip || dir, checkNonElements = base && key === "parentNode", doneName = done++; 1169 return combinator.first ? function(elem, context, xml) { 1170 while (elem = elem[dir]) { 1171 if (elem.nodeType === 1 || checkNonElements) { 1172 return matcher(elem, context, xml); 1173 } 1174 } 1175 return false; 1176 } : function(elem, context, xml) { 1177 var oldCache, outerCache, newCache = [dirruns, doneName]; 1178 if (xml) { 1179 while (elem = elem[dir]) { 1180 if (elem.nodeType === 1 || checkNonElements) { 1181 if (matcher(elem, context, xml)) { 1182 return true; 1183 } 1184 } 1185 } 1186 } else { 1187 while (elem = elem[dir]) { 1188 if (elem.nodeType === 1 || checkNonElements) { 1189 outerCache = elem[expando] || (elem[expando] = {}); 1190 if (skip && nodeName(elem, skip)) { 1191 elem = elem[dir] || elem; 1192 } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) { 1193 return newCache[2] = oldCache[2]; 1194 } else { 1195 outerCache[key] = newCache; 1196 if (newCache[2] = matcher(elem, context, xml)) { 1197 return true; 1198 } 1199 } 1200 } 1201 } 1202 } 1203 return false; 1204 }; 1205 } 1206 function elementMatcher(matchers) { 1207 return matchers.length > 1 ? function(elem, context, xml) { 1208 var i = matchers.length; 1209 while (i--) { 1210 if (!matchers[i](elem, context, xml)) { 1211 return false; 1212 } 1213 } 1214 return true; 1215 } : matchers[0]; 1216 } 1217 function multipleContexts(selector, contexts, results) { 1218 var i = 0, len = contexts.length; 1219 for (;i < len; i++) { 1220 find(selector, contexts[i], results); 1221 } 1222 return results; 1223 } 1224 function condense(unmatched, map, filter, context, xml) { 1225 var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; 1226 for (;i < len; i++) { 1227 if (elem = unmatched[i]) { 1228 if (!filter || filter(elem, context, xml)) { 1229 newUnmatched.push(elem); 1230 if (mapped) { 1231 map.push(i); 1232 } 1233 } 1234 } 1235 } 1236 return newUnmatched; 1237 } 1238 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 1239 if (postFilter && !postFilter[expando]) { 1240 postFilter = setMatcher(postFilter); 1241 } 1242 if (postFinder && !postFinder[expando]) { 1243 postFinder = setMatcher(postFinder, postSelector); 1244 } 1245 return markFunction(function(seed, results, context, xml) { 1246 var temp, i, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems; 1247 if (matcher) { 1248 matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results; 1249 matcher(matcherIn, matcherOut, context, xml); 1250 } else { 1251 matcherOut = matcherIn; 1252 } 1253 if (postFilter) { 1254 temp = condense(matcherOut, postMap); 1255 postFilter(temp, [], context, xml); 1256 i = temp.length; 1257 while (i--) { 1258 if (elem = temp[i]) { 1259 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); 1260 } 1261 } 1262 } 1263 if (seed) { 1264 if (postFinder || preFilter) { 1265 if (postFinder) { 1266 temp = []; 1267 i = matcherOut.length; 1268 while (i--) { 1269 if (elem = matcherOut[i]) { 1270 temp.push(matcherIn[i] = elem); 1271 } 1272 } 1273 postFinder(null, matcherOut = [], temp, xml); 1274 } 1275 i = matcherOut.length; 1276 while (i--) { 1277 if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) { 1278 seed[temp] = !(results[temp] = elem); 1279 } 1280 } 1281 } 1282 } else { 1283 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); 1284 if (postFinder) { 1285 postFinder(null, results, matcherOut, xml); 1286 } else { 1287 push.apply(results, matcherOut); 1288 } 1289 } 1290 }); 1291 } 1292 function matcherFromTokens(tokens) { 1293 var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) { 1294 return elem === checkContext; 1295 }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) { 1296 return indexOf.call(checkContext, elem) > -1; 1297 }, implicitRelative, true), matchers = [function(elem, context, xml) { 1298 var ret2 = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); 1299 checkContext = null; 1300 return ret2; 1301 }]; 1302 for (;i < len; i++) { 1303 if (matcher = Expr.relative[tokens[i].type]) { 1304 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 1305 } else { 1306 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); 1307 if (matcher[expando]) { 1308 j = ++i; 1309 for (;j < len; j++) { 1310 if (Expr.relative[tokens[j].type]) { 1311 break; 1312 } 1313 } 1314 return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrimCSS, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens)); 1315 } 1316 matchers.push(matcher); 1317 } 1318 } 1319 return elementMatcher(matchers); 1320 } 1321 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 1322 var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) { 1323 var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length; 1324 if (outermost) { 1325 outermostContext = context == document2 || context || outermost; 1326 } 1327 for (;i !== len && (elem = elems[i]) != null; i++) { 1328 if (byElement && elem) { 1329 j = 0; 1330 if (!context && elem.ownerDocument != document2) { 1331 setDocument(elem); 1332 xml = !documentIsHTML; 1333 } 1334 while (matcher = elementMatchers[j++]) { 1335 if (matcher(elem, context || document2, xml)) { 1336 push.call(results, elem); 1337 break; 1338 } 1339 } 1340 if (outermost) { 1341 dirruns = dirrunsUnique; 1342 } 1343 } 1344 if (bySet) { 1345 if (elem = !matcher && elem) { 1346 matchedCount--; 1347 } 1348 if (seed) { 1349 unmatched.push(elem); 1350 } 1351 } 1352 } 1353 matchedCount += i; 1354 if (bySet && i !== matchedCount) { 1355 j = 0; 1356 while (matcher = setMatchers[j++]) { 1357 matcher(unmatched, setMatched, context, xml); 1358 } 1359 if (seed) { 1360 if (matchedCount > 0) { 1361 while (i--) { 1362 if (!(unmatched[i] || setMatched[i])) { 1363 setMatched[i] = pop.call(results); 1364 } 1365 } 1366 } 1367 setMatched = condense(setMatched); 1368 } 1369 push.apply(results, setMatched); 1370 if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { 1371 jQuery2.uniqueSort(results); 1372 } 1373 } 1374 if (outermost) { 1375 dirruns = dirrunsUnique; 1376 outermostContext = contextBackup; 1377 } 1378 return unmatched; 1379 }; 1380 return bySet ? markFunction(superMatcher) : superMatcher; 1381 } 1382 function compile(selector, match) { 1383 var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "]; 1384 if (!cached) { 1385 if (!match) { 1386 match = tokenize(selector); 1387 } 1388 i = match.length; 1389 while (i--) { 1390 cached = matcherFromTokens(match[i]); 1391 if (cached[expando]) { 1392 setMatchers.push(cached); 1393 } else { 1394 elementMatchers.push(cached); 1395 } 1396 } 1397 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); 1398 cached.selector = selector; 1399 } 1400 return cached; 1401 } 1402 function select2(selector, context, results, seed) { 1403 var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector); 1404 results = results || []; 1405 if (match.length === 1) { 1406 tokens = match[0] = match[0].slice(0); 1407 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 1408 context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0]; 1409 if (!context) { 1410 return results; 1411 } else if (compiled) { 1412 context = context.parentNode; 1413 } 1414 selector = selector.slice(tokens.shift().value.length); 1415 } 1416 i = matchExpr.needsContext.test(selector) ? 0 : tokens.length; 1417 while (i--) { 1418 token = tokens[i]; 1419 if (Expr.relative[type = token.type]) { 1420 break; 1421 } 1422 if (find = Expr.find[type]) { 1423 if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) { 1424 tokens.splice(i, 1); 1425 selector = seed.length && toSelector(tokens); 1426 if (!selector) { 1427 push.apply(results, seed); 1428 return results; 1429 } 1430 break; 1431 } 1432 } 1433 } 1434 } 1435 (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context); 1436 return results; 1437 } 1438 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 1439 setDocument(); 1440 support.sortDetached = assert(function(el) { 1441 return el.compareDocumentPosition(document2.createElement("fieldset")) & 1; 1442 }); 1443 jQuery2.find = find; 1444 jQuery2.expr[":"] = jQuery2.expr.pseudos; 1445 jQuery2.unique = jQuery2.uniqueSort; 1446 find.compile = compile; 1447 find.select = select2; 1448 find.setDocument = setDocument; 1449 find.tokenize = tokenize; 1450 find.escape = jQuery2.escapeSelector; 1451 find.getText = jQuery2.text; 1452 find.isXML = jQuery2.isXMLDoc; 1453 find.selectors = jQuery2.expr; 1454 find.support = jQuery2.support; 1455 find.uniqueSort = jQuery2.uniqueSort; 1456 })(); 1457 var dir = function(elem, dir, until) { 1458 var matched = [], truncate = until !== undefined; 1459 while ((elem = elem[dir]) && elem.nodeType !== 9) { 1460 if (elem.nodeType === 1) { 1461 if (truncate && jQuery2(elem).is(until)) { 1462 break; 1463 } 1464 matched.push(elem); 1465 } 1466 } 1467 return matched; 1468 }; 1469 var siblings = function(n, elem) { 1470 var matched = []; 1471 for (;n; n = n.nextSibling) { 1472 if (n.nodeType === 1 && n !== elem) { 1473 matched.push(n); 1474 } 1475 } 1476 return matched; 1477 }; 1478 var rneedsContext = jQuery2.expr.match.needsContext; 1479 var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; 1480 function winnow(elements, qualifier, not) { 1481 if (isFunction(qualifier)) { 1482 return jQuery2.grep(elements, function(elem, i) { 1483 return !!qualifier.call(elem, i, elem) !== not; 1484 }); 1485 } 1486 if (qualifier.nodeType) { 1487 return jQuery2.grep(elements, function(elem) { 1488 return elem === qualifier !== not; 1489 }); 1490 } 1491 if (typeof qualifier !== "string") { 1492 return jQuery2.grep(elements, function(elem) { 1493 return indexOf.call(qualifier, elem) > -1 !== not; 1494 }); 1495 } 1496 return jQuery2.filter(qualifier, elements, not); 1497 } 1498 jQuery2.filter = function(expr, elems, not) { 1499 var elem = elems[0]; 1500 if (not) { 1501 expr = ":not(" + expr + ")"; 1502 } 1503 if (elems.length === 1 && elem.nodeType === 1) { 1504 return jQuery2.find.matchesSelector(elem, expr) ? [elem] : []; 1505 } 1506 return jQuery2.find.matches(expr, jQuery2.grep(elems, function(elem) { 1507 return elem.nodeType === 1; 1508 })); 1509 }; 1510 jQuery2.fn.extend({ 1511 find: function(selector) { 1512 var i, ret2, len = this.length, self2 = this; 1513 if (typeof selector !== "string") { 1514 return this.pushStack(jQuery2(selector).filter(function() { 1515 for (i = 0;i < len; i++) { 1516 if (jQuery2.contains(self2[i], this)) { 1517 return true; 1518 } 1519 } 1520 })); 1521 } 1522 ret2 = this.pushStack([]); 1523 for (i = 0;i < len; i++) { 1524 jQuery2.find(selector, self2[i], ret2); 1525 } 1526 return len > 1 ? jQuery2.uniqueSort(ret2) : ret2; 1527 }, 1528 filter: function(selector) { 1529 return this.pushStack(winnow(this, selector || [], false)); 1530 }, 1531 not: function(selector) { 1532 return this.pushStack(winnow(this, selector || [], true)); 1533 }, 1534 is: function(selector) { 1535 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery2(selector) : selector || [], false).length; 1536 } 1537 }); 1538 var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery2.fn.init = function(selector, context, root2) { 1539 var match, elem; 1540 if (!selector) { 1541 return this; 1542 } 1543 root2 = root2 || rootjQuery; 1544 if (typeof selector === "string") { 1545 if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) { 1546 match = [null, selector, null]; 1547 } else { 1548 match = rquickExpr.exec(selector); 1549 } 1550 if (match && (match[1] || !context)) { 1551 if (match[1]) { 1552 context = context instanceof jQuery2 ? context[0] : context; 1553 jQuery2.merge(this, jQuery2.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document2, true)); 1554 if (rsingleTag.test(match[1]) && jQuery2.isPlainObject(context)) { 1555 for (match in context) { 1556 if (isFunction(this[match])) { 1557 this[match](context[match]); 1558 } else { 1559 this.attr(match, context[match]); 1560 } 1561 } 1562 } 1563 return this; 1564 } else { 1565 elem = document2.getElementById(match[2]); 1566 if (elem) { 1567 this[0] = elem; 1568 this.length = 1; 1569 } 1570 return this; 1571 } 1572 } else if (!context || context.jquery) { 1573 return (context || root2).find(selector); 1574 } else { 1575 return this.constructor(context).find(selector); 1576 } 1577 } else if (selector.nodeType) { 1578 this[0] = selector; 1579 this.length = 1; 1580 return this; 1581 } else if (isFunction(selector)) { 1582 return root2.ready !== undefined ? root2.ready(selector) : selector(jQuery2); 1583 } 1584 return jQuery2.makeArray(selector, this); 1585 }; 1586 init.prototype = jQuery2.fn; 1587 rootjQuery = jQuery2(document2); 1588 var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = { 1589 children: true, 1590 contents: true, 1591 next: true, 1592 prev: true 1593 }; 1594 jQuery2.fn.extend({ 1595 has: function(target) { 1596 var targets = jQuery2(target, this), l = targets.length; 1597 return this.filter(function() { 1598 var i = 0; 1599 for (;i < l; i++) { 1600 if (jQuery2.contains(this, targets[i])) { 1601 return true; 1602 } 1603 } 1604 }); 1605 }, 1606 closest: function(selectors, context) { 1607 var cur, i = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery2(selectors); 1608 if (!rneedsContext.test(selectors)) { 1609 for (;i < l; i++) { 1610 for (cur = this[i];cur && cur !== context; cur = cur.parentNode) { 1611 if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery2.find.matchesSelector(cur, selectors))) { 1612 matched.push(cur); 1613 break; 1614 } 1615 } 1616 } 1617 } 1618 return this.pushStack(matched.length > 1 ? jQuery2.uniqueSort(matched) : matched); 1619 }, 1620 index: function(elem) { 1621 if (!elem) { 1622 return this[0] && this[0].parentNode ? this.first().prevAll().length : -1; 1623 } 1624 if (typeof elem === "string") { 1625 return indexOf.call(jQuery2(elem), this[0]); 1626 } 1627 return indexOf.call(this, elem.jquery ? elem[0] : elem); 1628 }, 1629 add: function(selector, context) { 1630 return this.pushStack(jQuery2.uniqueSort(jQuery2.merge(this.get(), jQuery2(selector, context)))); 1631 }, 1632 addBack: function(selector) { 1633 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); 1634 } 1635 }); 1636 function sibling(cur, dir) { 1637 while ((cur = cur[dir]) && cur.nodeType !== 1) {} 1638 return cur; 1639 } 1640 jQuery2.each({ 1641 parent: function(elem) { 1642 var parent = elem.parentNode; 1643 return parent && parent.nodeType !== 11 ? parent : null; 1644 }, 1645 parents: function(elem) { 1646 return dir(elem, "parentNode"); 1647 }, 1648 parentsUntil: function(elem, _i, until) { 1649 return dir(elem, "parentNode", until); 1650 }, 1651 next: function(elem) { 1652 return sibling(elem, "nextSibling"); 1653 }, 1654 prev: function(elem) { 1655 return sibling(elem, "previousSibling"); 1656 }, 1657 nextAll: function(elem) { 1658 return dir(elem, "nextSibling"); 1659 }, 1660 prevAll: function(elem) { 1661 return dir(elem, "previousSibling"); 1662 }, 1663 nextUntil: function(elem, _i, until) { 1664 return dir(elem, "nextSibling", until); 1665 }, 1666 prevUntil: function(elem, _i, until) { 1667 return dir(elem, "previousSibling", until); 1668 }, 1669 siblings: function(elem) { 1670 return siblings((elem.parentNode || {}).firstChild, elem); 1671 }, 1672 children: function(elem) { 1673 return siblings(elem.firstChild); 1674 }, 1675 contents: function(elem) { 1676 if (elem.contentDocument != null && getProto(elem.contentDocument)) { 1677 return elem.contentDocument; 1678 } 1679 if (nodeName(elem, "template")) { 1680 elem = elem.content || elem; 1681 } 1682 return jQuery2.merge([], elem.childNodes); 1683 } 1684 }, function(name, fn2) { 1685 jQuery2.fn[name] = function(until, selector) { 1686 var matched = jQuery2.map(this, fn2, until); 1687 if (name.slice(-5) !== "Until") { 1688 selector = until; 1689 } 1690 if (selector && typeof selector === "string") { 1691 matched = jQuery2.filter(selector, matched); 1692 } 1693 if (this.length > 1) { 1694 if (!guaranteedUnique[name]) { 1695 jQuery2.uniqueSort(matched); 1696 } 1697 if (rparentsprev.test(name)) { 1698 matched.reverse(); 1699 } 1700 } 1701 return this.pushStack(matched); 1702 }; 1703 }); 1704 var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; 1705 function createOptions(options2) { 1706 var object = {}; 1707 jQuery2.each(options2.match(rnothtmlwhite) || [], function(_, flag) { 1708 object[flag] = true; 1709 }); 1710 return object; 1711 } 1712 jQuery2.Callbacks = function(options2) { 1713 options2 = typeof options2 === "string" ? createOptions(options2) : jQuery2.extend({}, options2); 1714 var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() { 1715 locked = locked || options2.once; 1716 fired = firing = true; 1717 for (;queue.length; firingIndex = -1) { 1718 memory = queue.shift(); 1719 while (++firingIndex < list.length) { 1720 if (list[firingIndex].apply(memory[0], memory[1]) === false && options2.stopOnFalse) { 1721 firingIndex = list.length; 1722 memory = false; 1723 } 1724 } 1725 } 1726 if (!options2.memory) { 1727 memory = false; 1728 } 1729 firing = false; 1730 if (locked) { 1731 if (memory) { 1732 list = []; 1733 } else { 1734 list = ""; 1735 } 1736 } 1737 }, self2 = { 1738 add: function() { 1739 if (list) { 1740 if (memory && !firing) { 1741 firingIndex = list.length - 1; 1742 queue.push(memory); 1743 } 1744 (function add(args2) { 1745 jQuery2.each(args2, function(_, arg) { 1746 if (isFunction(arg)) { 1747 if (!options2.unique || !self2.has(arg)) { 1748 list.push(arg); 1749 } 1750 } else if (arg && arg.length && toType(arg) !== "string") { 1751 add(arg); 1752 } 1753 }); 1754 })(arguments); 1755 if (memory && !firing) { 1756 fire(); 1757 } 1758 } 1759 return this; 1760 }, 1761 remove: function() { 1762 jQuery2.each(arguments, function(_, arg) { 1763 var index; 1764 while ((index = jQuery2.inArray(arg, list, index)) > -1) { 1765 list.splice(index, 1); 1766 if (index <= firingIndex) { 1767 firingIndex--; 1768 } 1769 } 1770 }); 1771 return this; 1772 }, 1773 has: function(fn2) { 1774 return fn2 ? jQuery2.inArray(fn2, list) > -1 : list.length > 0; 1775 }, 1776 empty: function() { 1777 if (list) { 1778 list = []; 1779 } 1780 return this; 1781 }, 1782 disable: function() { 1783 locked = queue = []; 1784 list = memory = ""; 1785 return this; 1786 }, 1787 disabled: function() { 1788 return !list; 1789 }, 1790 lock: function() { 1791 locked = queue = []; 1792 if (!memory && !firing) { 1793 list = memory = ""; 1794 } 1795 return this; 1796 }, 1797 locked: function() { 1798 return !!locked; 1799 }, 1800 fireWith: function(context, args2) { 1801 if (!locked) { 1802 args2 = args2 || []; 1803 args2 = [context, args2.slice ? args2.slice() : args2]; 1804 queue.push(args2); 1805 if (!firing) { 1806 fire(); 1807 } 1808 } 1809 return this; 1810 }, 1811 fire: function() { 1812 self2.fireWith(this, arguments); 1813 return this; 1814 }, 1815 fired: function() { 1816 return !!fired; 1817 } 1818 }; 1819 return self2; 1820 }; 1821 function Identity(v) { 1822 return v; 1823 } 1824 function Thrower(ex) { 1825 throw ex; 1826 } 1827 function adoptValue(value, resolve, reject, noValue) { 1828 var method; 1829 try { 1830 if (value && isFunction(method = value.promise)) { 1831 method.call(value).done(resolve).fail(reject); 1832 } else if (value && isFunction(method = value.then)) { 1833 method.call(value, resolve, reject); 1834 } else { 1835 resolve.apply(undefined, [value].slice(noValue)); 1836 } 1837 } catch (value) { 1838 reject.apply(undefined, [value]); 1839 } 1840 } 1841 jQuery2.extend({ 1842 Deferred: function(func) { 1843 var tuples = [ 1844 [ 1845 "notify", 1846 "progress", 1847 jQuery2.Callbacks("memory"), 1848 jQuery2.Callbacks("memory"), 1849 2 1850 ], 1851 [ 1852 "resolve", 1853 "done", 1854 jQuery2.Callbacks("once memory"), 1855 jQuery2.Callbacks("once memory"), 1856 0, 1857 "resolved" 1858 ], 1859 [ 1860 "reject", 1861 "fail", 1862 jQuery2.Callbacks("once memory"), 1863 jQuery2.Callbacks("once memory"), 1864 1, 1865 "rejected" 1866 ] 1867 ], state = "pending", promise = { 1868 state: function() { 1869 return state; 1870 }, 1871 always: function() { 1872 deferred2.done(arguments).fail(arguments); 1873 return this; 1874 }, 1875 catch: function(fn2) { 1876 return promise.then(null, fn2); 1877 }, 1878 pipe: function() { 1879 var fns = arguments; 1880 return jQuery2.Deferred(function(newDefer) { 1881 jQuery2.each(tuples, function(_i, tuple) { 1882 var fn2 = isFunction(fns[tuple[4]]) && fns[tuple[4]]; 1883 deferred2[tuple[1]](function() { 1884 var returned = fn2 && fn2.apply(this, arguments); 1885 if (returned && isFunction(returned.promise)) { 1886 returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject); 1887 } else { 1888 newDefer[tuple[0] + "With"](this, fn2 ? [returned] : arguments); 1889 } 1890 }); 1891 }); 1892 fns = null; 1893 }).promise(); 1894 }, 1895 then: function(onFulfilled, onRejected, onProgress) { 1896 var maxDepth = 0; 1897 function resolve(depth, deferred2, handler, special) { 1898 return function() { 1899 var that = this, args2 = arguments, mightThrow = function() { 1900 var returned, then; 1901 if (depth < maxDepth) { 1902 return; 1903 } 1904 returned = handler.apply(that, args2); 1905 if (returned === deferred2.promise()) { 1906 throw new TypeError("Thenable self-resolution"); 1907 } 1908 then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then; 1909 if (isFunction(then)) { 1910 if (special) { 1911 then.call(returned, resolve(maxDepth, deferred2, Identity, special), resolve(maxDepth, deferred2, Thrower, special)); 1912 } else { 1913 maxDepth++; 1914 then.call(returned, resolve(maxDepth, deferred2, Identity, special), resolve(maxDepth, deferred2, Thrower, special), resolve(maxDepth, deferred2, Identity, deferred2.notifyWith)); 1915 } 1916 } else { 1917 if (handler !== Identity) { 1918 that = undefined; 1919 args2 = [returned]; 1920 } 1921 (special || deferred2.resolveWith)(that, args2); 1922 } 1923 }, process = special ? mightThrow : function() { 1924 try { 1925 mightThrow(); 1926 } catch (e) { 1927 if (jQuery2.Deferred.exceptionHook) { 1928 jQuery2.Deferred.exceptionHook(e, process.error); 1929 } 1930 if (depth + 1 >= maxDepth) { 1931 if (handler !== Thrower) { 1932 that = undefined; 1933 args2 = [e]; 1934 } 1935 deferred2.rejectWith(that, args2); 1936 } 1937 } 1938 }; 1939 if (depth) { 1940 process(); 1941 } else { 1942 if (jQuery2.Deferred.getErrorHook) { 1943 process.error = jQuery2.Deferred.getErrorHook(); 1944 } else if (jQuery2.Deferred.getStackHook) { 1945 process.error = jQuery2.Deferred.getStackHook(); 1946 } 1947 window2.setTimeout(process); 1948 } 1949 }; 1950 } 1951 return jQuery2.Deferred(function(newDefer) { 1952 tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith)); 1953 tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity)); 1954 tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower)); 1955 }).promise(); 1956 }, 1957 promise: function(obj2) { 1958 return obj2 != null ? jQuery2.extend(obj2, promise) : promise; 1959 } 1960 }, deferred2 = {}; 1961 jQuery2.each(tuples, function(i, tuple) { 1962 var list = tuple[2], stateString = tuple[5]; 1963 promise[tuple[1]] = list.add; 1964 if (stateString) { 1965 list.add(function() { 1966 state = stateString; 1967 }, tuples[3 - i][2].disable, tuples[3 - i][3].disable, tuples[0][2].lock, tuples[0][3].lock); 1968 } 1969 list.add(tuple[3].fire); 1970 deferred2[tuple[0]] = function() { 1971 deferred2[tuple[0] + "With"](this === deferred2 ? undefined : this, arguments); 1972 return this; 1973 }; 1974 deferred2[tuple[0] + "With"] = list.fireWith; 1975 }); 1976 promise.promise(deferred2); 1977 if (func) { 1978 func.call(deferred2, deferred2); 1979 } 1980 return deferred2; 1981 }, 1982 when: function(singleValue) { 1983 var remaining = arguments.length, i = remaining, resolveContexts = Array(i), resolveValues = slice.call(arguments), primary = jQuery2.Deferred(), updateFunc = function(i) { 1984 return function(value) { 1985 resolveContexts[i] = this; 1986 resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value; 1987 if (!--remaining) { 1988 primary.resolveWith(resolveContexts, resolveValues); 1989 } 1990 }; 1991 }; 1992 if (remaining <= 1) { 1993 adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, !remaining); 1994 if (primary.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) { 1995 return primary.then(); 1996 } 1997 } 1998 while (i--) { 1999 adoptValue(resolveValues[i], updateFunc(i), primary.reject); 2000 } 2001 return primary.promise(); 2002 } 2003 }); 2004 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 2005 jQuery2.Deferred.exceptionHook = function(error, asyncError) { 2006 if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) { 2007 window2.console.warn("jQuery.Deferred exception: " + error.message, error.stack, asyncError); 2008 } 2009 }; 2010 jQuery2.readyException = function(error) { 2011 window2.setTimeout(function() { 2012 throw error; 2013 }); 2014 }; 2015 var readyList = jQuery2.Deferred(); 2016 jQuery2.fn.ready = function(fn2) { 2017 readyList.then(fn2).catch(function(error) { 2018 jQuery2.readyException(error); 2019 }); 2020 return this; 2021 }; 2022 jQuery2.extend({ 2023 isReady: false, 2024 readyWait: 1, 2025 ready: function(wait) { 2026 if (wait === true ? --jQuery2.readyWait : jQuery2.isReady) { 2027 return; 2028 } 2029 jQuery2.isReady = true; 2030 if (wait !== true && --jQuery2.readyWait > 0) { 2031 return; 2032 } 2033 readyList.resolveWith(document2, [jQuery2]); 2034 } 2035 }); 2036 jQuery2.ready.then = readyList.then; 2037 function completed() { 2038 document2.removeEventListener("DOMContentLoaded", completed); 2039 window2.removeEventListener("load", completed); 2040 jQuery2.ready(); 2041 } 2042 if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) { 2043 window2.setTimeout(jQuery2.ready); 2044 } else { 2045 document2.addEventListener("DOMContentLoaded", completed); 2046 window2.addEventListener("load", completed); 2047 } 2048 var access = function(elems, fn2, key, value, chainable, emptyGet, raw) { 2049 var i = 0, len = elems.length, bulk = key == null; 2050 if (toType(key) === "object") { 2051 chainable = true; 2052 for (i in key) { 2053 access(elems, fn2, i, key[i], true, emptyGet, raw); 2054 } 2055 } else if (value !== undefined) { 2056 chainable = true; 2057 if (!isFunction(value)) { 2058 raw = true; 2059 } 2060 if (bulk) { 2061 if (raw) { 2062 fn2.call(elems, value); 2063 fn2 = null; 2064 } else { 2065 bulk = fn2; 2066 fn2 = function(elem, _key, value) { 2067 return bulk.call(jQuery2(elem), value); 2068 }; 2069 } 2070 } 2071 if (fn2) { 2072 for (;i < len; i++) { 2073 fn2(elems[i], key, raw ? value : value.call(elems[i], i, fn2(elems[i], key))); 2074 } 2075 } 2076 } 2077 if (chainable) { 2078 return elems; 2079 } 2080 if (bulk) { 2081 return fn2.call(elems); 2082 } 2083 return len ? fn2(elems[0], key) : emptyGet; 2084 }; 2085 var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g; 2086 function fcamelCase(_all, letter) { 2087 return letter.toUpperCase(); 2088 } 2089 function camelCase(string2) { 2090 return string2.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 2091 } 2092 var acceptData = function(owner) { 2093 return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; 2094 }; 2095 function Data() { 2096 this.expando = jQuery2.expando + Data.uid++; 2097 } 2098 Data.uid = 1; 2099 Data.prototype = { 2100 cache: function(owner) { 2101 var value = owner[this.expando]; 2102 if (!value) { 2103 value = {}; 2104 if (acceptData(owner)) { 2105 if (owner.nodeType) { 2106 owner[this.expando] = value; 2107 } else { 2108 Object.defineProperty(owner, this.expando, { 2109 value, 2110 configurable: true 2111 }); 2112 } 2113 } 2114 } 2115 return value; 2116 }, 2117 set: function(owner, data, value) { 2118 var prop, cache = this.cache(owner); 2119 if (typeof data === "string") { 2120 cache[camelCase(data)] = value; 2121 } else { 2122 for (prop in data) { 2123 cache[camelCase(prop)] = data[prop]; 2124 } 2125 } 2126 return cache; 2127 }, 2128 get: function(owner, key) { 2129 return key === undefined ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase(key)]; 2130 }, 2131 access: function(owner, key, value) { 2132 if (key === undefined || key && typeof key === "string" && value === undefined) { 2133 return this.get(owner, key); 2134 } 2135 this.set(owner, key, value); 2136 return value !== undefined ? value : key; 2137 }, 2138 remove: function(owner, key) { 2139 var i, cache = owner[this.expando]; 2140 if (cache === undefined) { 2141 return; 2142 } 2143 if (key !== undefined) { 2144 if (Array.isArray(key)) { 2145 key = key.map(camelCase); 2146 } else { 2147 key = camelCase(key); 2148 key = key in cache ? [key] : key.match(rnothtmlwhite) || []; 2149 } 2150 i = key.length; 2151 while (i--) { 2152 delete cache[key[i]]; 2153 } 2154 } 2155 if (key === undefined || jQuery2.isEmptyObject(cache)) { 2156 if (owner.nodeType) { 2157 owner[this.expando] = undefined; 2158 } else { 2159 delete owner[this.expando]; 2160 } 2161 } 2162 }, 2163 hasData: function(owner) { 2164 var cache = owner[this.expando]; 2165 return cache !== undefined && !jQuery2.isEmptyObject(cache); 2166 } 2167 }; 2168 var dataPriv = new Data; 2169 var dataUser = new Data; 2170 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; 2171 function getData(data) { 2172 if (data === "true") { 2173 return true; 2174 } 2175 if (data === "false") { 2176 return false; 2177 } 2178 if (data === "null") { 2179 return null; 2180 } 2181 if (data === +data + "") { 2182 return +data; 2183 } 2184 if (rbrace.test(data)) { 2185 return JSON.parse(data); 2186 } 2187 return data; 2188 } 2189 function dataAttr(elem, key, data) { 2190 var name; 2191 if (data === undefined && elem.nodeType === 1) { 2192 name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); 2193 data = elem.getAttribute(name); 2194 if (typeof data === "string") { 2195 try { 2196 data = getData(data); 2197 } catch (e) {} 2198 dataUser.set(elem, key, data); 2199 } else { 2200 data = undefined; 2201 } 2202 } 2203 return data; 2204 } 2205 jQuery2.extend({ 2206 hasData: function(elem) { 2207 return dataUser.hasData(elem) || dataPriv.hasData(elem); 2208 }, 2209 data: function(elem, name, data) { 2210 return dataUser.access(elem, name, data); 2211 }, 2212 removeData: function(elem, name) { 2213 dataUser.remove(elem, name); 2214 }, 2215 _data: function(elem, name, data) { 2216 return dataPriv.access(elem, name, data); 2217 }, 2218 _removeData: function(elem, name) { 2219 dataPriv.remove(elem, name); 2220 } 2221 }); 2222 jQuery2.fn.extend({ 2223 data: function(key, value) { 2224 var i, name, data, elem = this[0], attrs = elem && elem.attributes; 2225 if (key === undefined) { 2226 if (this.length) { 2227 data = dataUser.get(elem); 2228 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 2229 i = attrs.length; 2230 while (i--) { 2231 if (attrs[i]) { 2232 name = attrs[i].name; 2233 if (name.indexOf("data-") === 0) { 2234 name = camelCase(name.slice(5)); 2235 dataAttr(elem, name, data[name]); 2236 } 2237 } 2238 } 2239 dataPriv.set(elem, "hasDataAttrs", true); 2240 } 2241 } 2242 return data; 2243 } 2244 if (typeof key === "object") { 2245 return this.each(function() { 2246 dataUser.set(this, key); 2247 }); 2248 } 2249 return access(this, function(value) { 2250 var data; 2251 if (elem && value === undefined) { 2252 data = dataUser.get(elem, key); 2253 if (data !== undefined) { 2254 return data; 2255 } 2256 data = dataAttr(elem, key); 2257 if (data !== undefined) { 2258 return data; 2259 } 2260 return; 2261 } 2262 this.each(function() { 2263 dataUser.set(this, key, value); 2264 }); 2265 }, null, value, arguments.length > 1, null, true); 2266 }, 2267 removeData: function(key) { 2268 return this.each(function() { 2269 dataUser.remove(this, key); 2270 }); 2271 } 2272 }); 2273 jQuery2.extend({ 2274 queue: function(elem, type, data) { 2275 var queue; 2276 if (elem) { 2277 type = (type || "fx") + "queue"; 2278 queue = dataPriv.get(elem, type); 2279 if (data) { 2280 if (!queue || Array.isArray(data)) { 2281 queue = dataPriv.access(elem, type, jQuery2.makeArray(data)); 2282 } else { 2283 queue.push(data); 2284 } 2285 } 2286 return queue || []; 2287 } 2288 }, 2289 dequeue: function(elem, type) { 2290 type = type || "fx"; 2291 var queue = jQuery2.queue(elem, type), startLength = queue.length, fn2 = queue.shift(), hooks = jQuery2._queueHooks(elem, type), next = function() { 2292 jQuery2.dequeue(elem, type); 2293 }; 2294 if (fn2 === "inprogress") { 2295 fn2 = queue.shift(); 2296 startLength--; 2297 } 2298 if (fn2) { 2299 if (type === "fx") { 2300 queue.unshift("inprogress"); 2301 } 2302 delete hooks.stop; 2303 fn2.call(elem, next, hooks); 2304 } 2305 if (!startLength && hooks) { 2306 hooks.empty.fire(); 2307 } 2308 }, 2309 _queueHooks: function(elem, type) { 2310 var key = type + "queueHooks"; 2311 return dataPriv.get(elem, key) || dataPriv.access(elem, key, { 2312 empty: jQuery2.Callbacks("once memory").add(function() { 2313 dataPriv.remove(elem, [type + "queue", key]); 2314 }) 2315 }); 2316 } 2317 }); 2318 jQuery2.fn.extend({ 2319 queue: function(type, data) { 2320 var setter = 2; 2321 if (typeof type !== "string") { 2322 data = type; 2323 type = "fx"; 2324 setter--; 2325 } 2326 if (arguments.length < setter) { 2327 return jQuery2.queue(this[0], type); 2328 } 2329 return data === undefined ? this : this.each(function() { 2330 var queue = jQuery2.queue(this, type, data); 2331 jQuery2._queueHooks(this, type); 2332 if (type === "fx" && queue[0] !== "inprogress") { 2333 jQuery2.dequeue(this, type); 2334 } 2335 }); 2336 }, 2337 dequeue: function(type) { 2338 return this.each(function() { 2339 jQuery2.dequeue(this, type); 2340 }); 2341 }, 2342 clearQueue: function(type) { 2343 return this.queue(type || "fx", []); 2344 }, 2345 promise: function(type, obj2) { 2346 var tmp, count = 1, defer = jQuery2.Deferred(), elements = this, i = this.length, resolve = function() { 2347 if (!--count) { 2348 defer.resolveWith(elements, [elements]); 2349 } 2350 }; 2351 if (typeof type !== "string") { 2352 obj2 = type; 2353 type = undefined; 2354 } 2355 type = type || "fx"; 2356 while (i--) { 2357 tmp = dataPriv.get(elements[i], type + "queueHooks"); 2358 if (tmp && tmp.empty) { 2359 count++; 2360 tmp.empty.add(resolve); 2361 } 2362 } 2363 resolve(); 2364 return defer.promise(obj2); 2365 } 2366 }); 2367 var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; 2368 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 2369 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 2370 var documentElement = document2.documentElement; 2371 var isAttached = function(elem) { 2372 return jQuery2.contains(elem.ownerDocument, elem); 2373 }, composed = { composed: true }; 2374 if (documentElement.getRootNode) { 2375 isAttached = function(elem) { 2376 return jQuery2.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument; 2377 }; 2378 } 2379 var isHiddenWithinTree = function(elem, el) { 2380 elem = el || elem; 2381 return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery2.css(elem, "display") === "none"; 2382 }; 2383 function adjustCSS(elem, prop, valueParts, tween) { 2384 var adjusted, scale, maxIterations = 20, currentValue = tween ? function() { 2385 return tween.cur(); 2386 } : function() { 2387 return jQuery2.css(elem, prop, ""); 2388 }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery2.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery2.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery2.css(elem, prop)); 2389 if (initialInUnit && initialInUnit[3] !== unit) { 2390 initial = initial / 2; 2391 unit = unit || initialInUnit[3]; 2392 initialInUnit = +initial || 1; 2393 while (maxIterations--) { 2394 jQuery2.style(elem, prop, initialInUnit + unit); 2395 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 2396 maxIterations = 0; 2397 } 2398 initialInUnit = initialInUnit / scale; 2399 } 2400 initialInUnit = initialInUnit * 2; 2401 jQuery2.style(elem, prop, initialInUnit + unit); 2402 valueParts = valueParts || []; 2403 } 2404 if (valueParts) { 2405 initialInUnit = +initialInUnit || +initial || 0; 2406 adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2]; 2407 if (tween) { 2408 tween.unit = unit; 2409 tween.start = initialInUnit; 2410 tween.end = adjusted; 2411 } 2412 } 2413 return adjusted; 2414 } 2415 var defaultDisplayMap = {}; 2416 function getDefaultDisplay(elem) { 2417 var temp, { ownerDocument: doc, nodeName } = elem, display = defaultDisplayMap[nodeName]; 2418 if (display) { 2419 return display; 2420 } 2421 temp = doc.body.appendChild(doc.createElement(nodeName)); 2422 display = jQuery2.css(temp, "display"); 2423 temp.parentNode.removeChild(temp); 2424 if (display === "none") { 2425 display = "block"; 2426 } 2427 defaultDisplayMap[nodeName] = display; 2428 return display; 2429 } 2430 function showHide(elements, show) { 2431 var display, elem, values = [], index = 0, length = elements.length; 2432 for (;index < length; index++) { 2433 elem = elements[index]; 2434 if (!elem.style) { 2435 continue; 2436 } 2437 display = elem.style.display; 2438 if (show) { 2439 if (display === "none") { 2440 values[index] = dataPriv.get(elem, "display") || null; 2441 if (!values[index]) { 2442 elem.style.display = ""; 2443 } 2444 } 2445 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 2446 values[index] = getDefaultDisplay(elem); 2447 } 2448 } else { 2449 if (display !== "none") { 2450 values[index] = "none"; 2451 dataPriv.set(elem, "display", display); 2452 } 2453 } 2454 } 2455 for (index = 0;index < length; index++) { 2456 if (values[index] != null) { 2457 elements[index].style.display = values[index]; 2458 } 2459 } 2460 return elements; 2461 } 2462 jQuery2.fn.extend({ 2463 show: function() { 2464 return showHide(this, true); 2465 }, 2466 hide: function() { 2467 return showHide(this); 2468 }, 2469 toggle: function(state) { 2470 if (typeof state === "boolean") { 2471 return state ? this.show() : this.hide(); 2472 } 2473 return this.each(function() { 2474 if (isHiddenWithinTree(this)) { 2475 jQuery2(this).show(); 2476 } else { 2477 jQuery2(this).hide(); 2478 } 2479 }); 2480 } 2481 }); 2482 var rcheckableType = /^(?:checkbox|radio)$/i; 2483 var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; 2484 var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; 2485 (function() { 2486 var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input"); 2487 input.setAttribute("type", "radio"); 2488 input.setAttribute("checked", "checked"); 2489 input.setAttribute("name", "t"); 2490 div.appendChild(input); 2491 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 2492 div.innerHTML = "<textarea>x</textarea>"; 2493 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 2494 div.innerHTML = "<option></option>"; 2495 support.option = !!div.lastChild; 2496 })(); 2497 var wrapMap = { 2498 thead: [1, "<table>", "</table>"], 2499 col: [2, "<table><colgroup>", "</colgroup></table>"], 2500 tr: [2, "<table><tbody>", "</tbody></table>"], 2501 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 2502 _default: [0, "", ""] 2503 }; 2504 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 2505 wrapMap.th = wrapMap.td; 2506 if (!support.option) { 2507 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 2508 } 2509 function getAll(context, tag) { 2510 var ret2; 2511 if (typeof context.getElementsByTagName !== "undefined") { 2512 ret2 = context.getElementsByTagName(tag || "*"); 2513 } else if (typeof context.querySelectorAll !== "undefined") { 2514 ret2 = context.querySelectorAll(tag || "*"); 2515 } else { 2516 ret2 = []; 2517 } 2518 if (tag === undefined || tag && nodeName(context, tag)) { 2519 return jQuery2.merge([context], ret2); 2520 } 2521 return ret2; 2522 } 2523 function setGlobalEval(elems, refElements) { 2524 var i = 0, l = elems.length; 2525 for (;i < l; i++) { 2526 dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval")); 2527 } 2528 } 2529 var rhtml = /<|&#?\w+;/; 2530 function buildFragment(elems, context, scripts, selection, ignored) { 2531 var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; 2532 for (;i < l; i++) { 2533 elem = elems[i]; 2534 if (elem || elem === 0) { 2535 if (toType(elem) === "object") { 2536 jQuery2.merge(nodes, elem.nodeType ? [elem] : elem); 2537 } else if (!rhtml.test(elem)) { 2538 nodes.push(context.createTextNode(elem)); 2539 } else { 2540 tmp = tmp || fragment.appendChild(context.createElement("div")); 2541 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 2542 wrap = wrapMap[tag] || wrapMap._default; 2543 tmp.innerHTML = wrap[1] + jQuery2.htmlPrefilter(elem) + wrap[2]; 2544 j = wrap[0]; 2545 while (j--) { 2546 tmp = tmp.lastChild; 2547 } 2548 jQuery2.merge(nodes, tmp.childNodes); 2549 tmp = fragment.firstChild; 2550 tmp.textContent = ""; 2551 } 2552 } 2553 } 2554 fragment.textContent = ""; 2555 i = 0; 2556 while (elem = nodes[i++]) { 2557 if (selection && jQuery2.inArray(elem, selection) > -1) { 2558 if (ignored) { 2559 ignored.push(elem); 2560 } 2561 continue; 2562 } 2563 attached = isAttached(elem); 2564 tmp = getAll(fragment.appendChild(elem), "script"); 2565 if (attached) { 2566 setGlobalEval(tmp); 2567 } 2568 if (scripts) { 2569 j = 0; 2570 while (elem = tmp[j++]) { 2571 if (rscriptType.test(elem.type || "")) { 2572 scripts.push(elem); 2573 } 2574 } 2575 } 2576 } 2577 return fragment; 2578 } 2579 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 2580 function returnTrue() { 2581 return true; 2582 } 2583 function returnFalse() { 2584 return false; 2585 } 2586 function on(elem, types, selector, data, fn2, one) { 2587 var origFn, type; 2588 if (typeof types === "object") { 2589 if (typeof selector !== "string") { 2590 data = data || selector; 2591 selector = undefined; 2592 } 2593 for (type in types) { 2594 on(elem, type, selector, data, types[type], one); 2595 } 2596 return elem; 2597 } 2598 if (data == null && fn2 == null) { 2599 fn2 = selector; 2600 data = selector = undefined; 2601 } else if (fn2 == null) { 2602 if (typeof selector === "string") { 2603 fn2 = data; 2604 data = undefined; 2605 } else { 2606 fn2 = data; 2607 data = selector; 2608 selector = undefined; 2609 } 2610 } 2611 if (fn2 === false) { 2612 fn2 = returnFalse; 2613 } else if (!fn2) { 2614 return elem; 2615 } 2616 if (one === 1) { 2617 origFn = fn2; 2618 fn2 = function(event) { 2619 jQuery2().off(event); 2620 return origFn.apply(this, arguments); 2621 }; 2622 fn2.guid = origFn.guid || (origFn.guid = jQuery2.guid++); 2623 } 2624 return elem.each(function() { 2625 jQuery2.event.add(this, types, fn2, data, selector); 2626 }); 2627 } 2628 jQuery2.event = { 2629 global: {}, 2630 add: function(elem, types, handler, data, selector) { 2631 var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem); 2632 if (!acceptData(elem)) { 2633 return; 2634 } 2635 if (handler.handler) { 2636 handleObjIn = handler; 2637 handler = handleObjIn.handler; 2638 selector = handleObjIn.selector; 2639 } 2640 if (selector) { 2641 jQuery2.find.matchesSelector(documentElement, selector); 2642 } 2643 if (!handler.guid) { 2644 handler.guid = jQuery2.guid++; 2645 } 2646 if (!(events = elemData.events)) { 2647 events = elemData.events = Object.create(null); 2648 } 2649 if (!(eventHandle = elemData.handle)) { 2650 eventHandle = elemData.handle = function(e) { 2651 return typeof jQuery2 !== "undefined" && jQuery2.event.triggered !== e.type ? jQuery2.event.dispatch.apply(elem, arguments) : undefined; 2652 }; 2653 } 2654 types = (types || "").match(rnothtmlwhite) || [""]; 2655 t = types.length; 2656 while (t--) { 2657 tmp = rtypenamespace.exec(types[t]) || []; 2658 type = origType = tmp[1]; 2659 namespaces = (tmp[2] || "").split(".").sort(); 2660 if (!type) { 2661 continue; 2662 } 2663 special = jQuery2.event.special[type] || {}; 2664 type = (selector ? special.delegateType : special.bindType) || type; 2665 special = jQuery2.event.special[type] || {}; 2666 handleObj = jQuery2.extend({ 2667 type, 2668 origType, 2669 data, 2670 handler, 2671 guid: handler.guid, 2672 selector, 2673 needsContext: selector && jQuery2.expr.match.needsContext.test(selector), 2674 namespace: namespaces.join(".") 2675 }, handleObjIn); 2676 if (!(handlers = events[type])) { 2677 handlers = events[type] = []; 2678 handlers.delegateCount = 0; 2679 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 2680 if (elem.addEventListener) { 2681 elem.addEventListener(type, eventHandle); 2682 } 2683 } 2684 } 2685 if (special.add) { 2686 special.add.call(elem, handleObj); 2687 if (!handleObj.handler.guid) { 2688 handleObj.handler.guid = handler.guid; 2689 } 2690 } 2691 if (selector) { 2692 handlers.splice(handlers.delegateCount++, 0, handleObj); 2693 } else { 2694 handlers.push(handleObj); 2695 } 2696 jQuery2.event.global[type] = true; 2697 } 2698 }, 2699 remove: function(elem, types, handler, selector, mappedTypes) { 2700 var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 2701 if (!elemData || !(events = elemData.events)) { 2702 return; 2703 } 2704 types = (types || "").match(rnothtmlwhite) || [""]; 2705 t = types.length; 2706 while (t--) { 2707 tmp = rtypenamespace.exec(types[t]) || []; 2708 type = origType = tmp[1]; 2709 namespaces = (tmp[2] || "").split(".").sort(); 2710 if (!type) { 2711 for (type in events) { 2712 jQuery2.event.remove(elem, type + types[t], handler, selector, true); 2713 } 2714 continue; 2715 } 2716 special = jQuery2.event.special[type] || {}; 2717 type = (selector ? special.delegateType : special.bindType) || type; 2718 handlers = events[type] || []; 2719 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 2720 origCount = j = handlers.length; 2721 while (j--) { 2722 handleObj = handlers[j]; 2723 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { 2724 handlers.splice(j, 1); 2725 if (handleObj.selector) { 2726 handlers.delegateCount--; 2727 } 2728 if (special.remove) { 2729 special.remove.call(elem, handleObj); 2730 } 2731 } 2732 } 2733 if (origCount && !handlers.length) { 2734 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { 2735 jQuery2.removeEvent(elem, type, elemData.handle); 2736 } 2737 delete events[type]; 2738 } 2739 } 2740 if (jQuery2.isEmptyObject(events)) { 2741 dataPriv.remove(elem, "handle events"); 2742 } 2743 }, 2744 dispatch: function(nativeEvent) { 2745 var i, j, ret2, matched, handleObj, handlerQueue, args2 = new Array(arguments.length), event = jQuery2.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || Object.create(null))[event.type] || [], special = jQuery2.event.special[event.type] || {}; 2746 args2[0] = event; 2747 for (i = 1;i < arguments.length; i++) { 2748 args2[i] = arguments[i]; 2749 } 2750 event.delegateTarget = this; 2751 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 2752 return; 2753 } 2754 handlerQueue = jQuery2.event.handlers.call(this, event, handlers); 2755 i = 0; 2756 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 2757 event.currentTarget = matched.elem; 2758 j = 0; 2759 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { 2760 if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) { 2761 event.handleObj = handleObj; 2762 event.data = handleObj.data; 2763 ret2 = ((jQuery2.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args2); 2764 if (ret2 !== undefined) { 2765 if ((event.result = ret2) === false) { 2766 event.preventDefault(); 2767 event.stopPropagation(); 2768 } 2769 } 2770 } 2771 } 2772 } 2773 if (special.postDispatch) { 2774 special.postDispatch.call(this, event); 2775 } 2776 return event.result; 2777 }, 2778 handlers: function(event, handlers) { 2779 var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; 2780 if (delegateCount && cur.nodeType && !(event.type === "click" && event.button >= 1)) { 2781 for (;cur !== this; cur = cur.parentNode || this) { 2782 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 2783 matchedHandlers = []; 2784 matchedSelectors = {}; 2785 for (i = 0;i < delegateCount; i++) { 2786 handleObj = handlers[i]; 2787 sel = handleObj.selector + " "; 2788 if (matchedSelectors[sel] === undefined) { 2789 matchedSelectors[sel] = handleObj.needsContext ? jQuery2(sel, this).index(cur) > -1 : jQuery2.find(sel, this, null, [cur]).length; 2790 } 2791 if (matchedSelectors[sel]) { 2792 matchedHandlers.push(handleObj); 2793 } 2794 } 2795 if (matchedHandlers.length) { 2796 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 2797 } 2798 } 2799 } 2800 } 2801 cur = this; 2802 if (delegateCount < handlers.length) { 2803 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 2804 } 2805 return handlerQueue; 2806 }, 2807 addProp: function(name, hook) { 2808 Object.defineProperty(jQuery2.Event.prototype, name, { 2809 enumerable: true, 2810 configurable: true, 2811 get: isFunction(hook) ? function() { 2812 if (this.originalEvent) { 2813 return hook(this.originalEvent); 2814 } 2815 } : function() { 2816 if (this.originalEvent) { 2817 return this.originalEvent[name]; 2818 } 2819 }, 2820 set: function(value) { 2821 Object.defineProperty(this, name, { 2822 enumerable: true, 2823 configurable: true, 2824 writable: true, 2825 value 2826 }); 2827 } 2828 }); 2829 }, 2830 fix: function(originalEvent) { 2831 return originalEvent[jQuery2.expando] ? originalEvent : new jQuery2.Event(originalEvent); 2832 }, 2833 special: { 2834 load: { 2835 noBubble: true 2836 }, 2837 click: { 2838 setup: function(data) { 2839 var el = this || data; 2840 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 2841 leverageNative(el, "click", true); 2842 } 2843 return false; 2844 }, 2845 trigger: function(data) { 2846 var el = this || data; 2847 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 2848 leverageNative(el, "click"); 2849 } 2850 return true; 2851 }, 2852 _default: function(event) { 2853 var target = event.target; 2854 return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a"); 2855 } 2856 }, 2857 beforeunload: { 2858 postDispatch: function(event) { 2859 if (event.result !== undefined && event.originalEvent) { 2860 event.originalEvent.returnValue = event.result; 2861 } 2862 } 2863 } 2864 } 2865 }; 2866 function leverageNative(el, type, isSetup) { 2867 if (!isSetup) { 2868 if (dataPriv.get(el, type) === undefined) { 2869 jQuery2.event.add(el, type, returnTrue); 2870 } 2871 return; 2872 } 2873 dataPriv.set(el, type, false); 2874 jQuery2.event.add(el, type, { 2875 namespace: false, 2876 handler: function(event) { 2877 var result, saved = dataPriv.get(this, type); 2878 if (event.isTrigger & 1 && this[type]) { 2879 if (!saved) { 2880 saved = slice.call(arguments); 2881 dataPriv.set(this, type, saved); 2882 this[type](); 2883 result = dataPriv.get(this, type); 2884 dataPriv.set(this, type, false); 2885 if (saved !== result) { 2886 event.stopImmediatePropagation(); 2887 event.preventDefault(); 2888 return result; 2889 } 2890 } else if ((jQuery2.event.special[type] || {}).delegateType) { 2891 event.stopPropagation(); 2892 } 2893 } else if (saved) { 2894 dataPriv.set(this, type, jQuery2.event.trigger(saved[0], saved.slice(1), this)); 2895 event.stopPropagation(); 2896 event.isImmediatePropagationStopped = returnTrue; 2897 } 2898 } 2899 }); 2900 } 2901 jQuery2.removeEvent = function(elem, type, handle) { 2902 if (elem.removeEventListener) { 2903 elem.removeEventListener(type, handle); 2904 } 2905 }; 2906 jQuery2.Event = function(src, props) { 2907 if (!(this instanceof jQuery2.Event)) { 2908 return new jQuery2.Event(src, props); 2909 } 2910 if (src && src.type) { 2911 this.originalEvent = src; 2912 this.type = src.type; 2913 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse; 2914 this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target; 2915 this.currentTarget = src.currentTarget; 2916 this.relatedTarget = src.relatedTarget; 2917 } else { 2918 this.type = src; 2919 } 2920 if (props) { 2921 jQuery2.extend(this, props); 2922 } 2923 this.timeStamp = src && src.timeStamp || Date.now(); 2924 this[jQuery2.expando] = true; 2925 }; 2926 jQuery2.Event.prototype = { 2927 constructor: jQuery2.Event, 2928 isDefaultPrevented: returnFalse, 2929 isPropagationStopped: returnFalse, 2930 isImmediatePropagationStopped: returnFalse, 2931 isSimulated: false, 2932 preventDefault: function() { 2933 var e = this.originalEvent; 2934 this.isDefaultPrevented = returnTrue; 2935 if (e && !this.isSimulated) { 2936 e.preventDefault(); 2937 } 2938 }, 2939 stopPropagation: function() { 2940 var e = this.originalEvent; 2941 this.isPropagationStopped = returnTrue; 2942 if (e && !this.isSimulated) { 2943 e.stopPropagation(); 2944 } 2945 }, 2946 stopImmediatePropagation: function() { 2947 var e = this.originalEvent; 2948 this.isImmediatePropagationStopped = returnTrue; 2949 if (e && !this.isSimulated) { 2950 e.stopImmediatePropagation(); 2951 } 2952 this.stopPropagation(); 2953 } 2954 }; 2955 jQuery2.each({ 2956 altKey: true, 2957 bubbles: true, 2958 cancelable: true, 2959 changedTouches: true, 2960 ctrlKey: true, 2961 detail: true, 2962 eventPhase: true, 2963 metaKey: true, 2964 pageX: true, 2965 pageY: true, 2966 shiftKey: true, 2967 view: true, 2968 char: true, 2969 code: true, 2970 charCode: true, 2971 key: true, 2972 keyCode: true, 2973 button: true, 2974 buttons: true, 2975 clientX: true, 2976 clientY: true, 2977 offsetX: true, 2978 offsetY: true, 2979 pointerId: true, 2980 pointerType: true, 2981 screenX: true, 2982 screenY: true, 2983 targetTouches: true, 2984 toElement: true, 2985 touches: true, 2986 which: true 2987 }, jQuery2.event.addProp); 2988 jQuery2.each({ focus: "focusin", blur: "focusout" }, function(type, delegateType) { 2989 function focusMappedHandler(nativeEvent) { 2990 if (document2.documentMode) { 2991 var handle = dataPriv.get(this, "handle"), event = jQuery2.event.fix(nativeEvent); 2992 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 2993 event.isSimulated = true; 2994 handle(nativeEvent); 2995 if (event.target === event.currentTarget) { 2996 handle(event); 2997 } 2998 } else { 2999 jQuery2.event.simulate(delegateType, nativeEvent.target, jQuery2.event.fix(nativeEvent)); 3000 } 3001 } 3002 jQuery2.event.special[type] = { 3003 setup: function() { 3004 var attaches; 3005 leverageNative(this, type, true); 3006 if (document2.documentMode) { 3007 attaches = dataPriv.get(this, delegateType); 3008 if (!attaches) { 3009 this.addEventListener(delegateType, focusMappedHandler); 3010 } 3011 dataPriv.set(this, delegateType, (attaches || 0) + 1); 3012 } else { 3013 return false; 3014 } 3015 }, 3016 trigger: function() { 3017 leverageNative(this, type); 3018 return true; 3019 }, 3020 teardown: function() { 3021 var attaches; 3022 if (document2.documentMode) { 3023 attaches = dataPriv.get(this, delegateType) - 1; 3024 if (!attaches) { 3025 this.removeEventListener(delegateType, focusMappedHandler); 3026 dataPriv.remove(this, delegateType); 3027 } else { 3028 dataPriv.set(this, delegateType, attaches); 3029 } 3030 } else { 3031 return false; 3032 } 3033 }, 3034 _default: function(event) { 3035 return dataPriv.get(event.target, type); 3036 }, 3037 delegateType 3038 }; 3039 jQuery2.event.special[delegateType] = { 3040 setup: function() { 3041 var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType); 3042 if (!attaches) { 3043 if (document2.documentMode) { 3044 this.addEventListener(delegateType, focusMappedHandler); 3045 } else { 3046 doc.addEventListener(type, focusMappedHandler, true); 3047 } 3048 } 3049 dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1); 3050 }, 3051 teardown: function() { 3052 var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1; 3053 if (!attaches) { 3054 if (document2.documentMode) { 3055 this.removeEventListener(delegateType, focusMappedHandler); 3056 } else { 3057 doc.removeEventListener(type, focusMappedHandler, true); 3058 } 3059 dataPriv.remove(dataHolder, delegateType); 3060 } else { 3061 dataPriv.set(dataHolder, delegateType, attaches); 3062 } 3063 } 3064 }; 3065 }); 3066 jQuery2.each({ 3067 mouseenter: "mouseover", 3068 mouseleave: "mouseout", 3069 pointerenter: "pointerover", 3070 pointerleave: "pointerout" 3071 }, function(orig, fix) { 3072 jQuery2.event.special[orig] = { 3073 delegateType: fix, 3074 bindType: fix, 3075 handle: function(event) { 3076 var ret2, target = this, { relatedTarget: related, handleObj } = event; 3077 if (!related || related !== target && !jQuery2.contains(target, related)) { 3078 event.type = handleObj.origType; 3079 ret2 = handleObj.handler.apply(this, arguments); 3080 event.type = fix; 3081 } 3082 return ret2; 3083 } 3084 }; 3085 }); 3086 jQuery2.fn.extend({ 3087 on: function(types, selector, data, fn2) { 3088 return on(this, types, selector, data, fn2); 3089 }, 3090 one: function(types, selector, data, fn2) { 3091 return on(this, types, selector, data, fn2, 1); 3092 }, 3093 off: function(types, selector, fn2) { 3094 var handleObj, type; 3095 if (types && types.preventDefault && types.handleObj) { 3096 handleObj = types.handleObj; 3097 jQuery2(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler); 3098 return this; 3099 } 3100 if (typeof types === "object") { 3101 for (type in types) { 3102 this.off(type, selector, types[type]); 3103 } 3104 return this; 3105 } 3106 if (selector === false || typeof selector === "function") { 3107 fn2 = selector; 3108 selector = undefined; 3109 } 3110 if (fn2 === false) { 3111 fn2 = returnFalse; 3112 } 3113 return this.each(function() { 3114 jQuery2.event.remove(this, types, fn2, selector); 3115 }); 3116 } 3117 }); 3118 var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 3119 function manipulationTarget(elem, content) { 3120 if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 3121 return jQuery2(elem).children("tbody")[0] || elem; 3122 } 3123 return elem; 3124 } 3125 function disableScript(elem) { 3126 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 3127 return elem; 3128 } 3129 function restoreScript(elem) { 3130 if ((elem.type || "").slice(0, 5) === "true/") { 3131 elem.type = elem.type.slice(5); 3132 } else { 3133 elem.removeAttribute("type"); 3134 } 3135 return elem; 3136 } 3137 function cloneCopyEvent(src, dest) { 3138 var i, l, type, pdataOld, udataOld, udataCur, events; 3139 if (dest.nodeType !== 1) { 3140 return; 3141 } 3142 if (dataPriv.hasData(src)) { 3143 pdataOld = dataPriv.get(src); 3144 events = pdataOld.events; 3145 if (events) { 3146 dataPriv.remove(dest, "handle events"); 3147 for (type in events) { 3148 for (i = 0, l = events[type].length;i < l; i++) { 3149 jQuery2.event.add(dest, type, events[type][i]); 3150 } 3151 } 3152 } 3153 } 3154 if (dataUser.hasData(src)) { 3155 udataOld = dataUser.access(src); 3156 udataCur = jQuery2.extend({}, udataOld); 3157 dataUser.set(dest, udataCur); 3158 } 3159 } 3160 function fixInput(src, dest) { 3161 var nodeName = dest.nodeName.toLowerCase(); 3162 if (nodeName === "input" && rcheckableType.test(src.type)) { 3163 dest.checked = src.checked; 3164 } else if (nodeName === "input" || nodeName === "textarea") { 3165 dest.defaultValue = src.defaultValue; 3166 } 3167 } 3168 function domManip(collection, args2, callback, ignored) { 3169 args2 = flat(args2); 3170 var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args2[0], valueIsFunction = isFunction(value); 3171 if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) { 3172 return collection.each(function(index) { 3173 var self2 = collection.eq(index); 3174 if (valueIsFunction) { 3175 args2[0] = value.call(this, index, self2.html()); 3176 } 3177 domManip(self2, args2, callback, ignored); 3178 }); 3179 } 3180 if (l) { 3181 fragment = buildFragment(args2, collection[0].ownerDocument, false, collection, ignored); 3182 first = fragment.firstChild; 3183 if (fragment.childNodes.length === 1) { 3184 fragment = first; 3185 } 3186 if (first || ignored) { 3187 scripts = jQuery2.map(getAll(fragment, "script"), disableScript); 3188 hasScripts = scripts.length; 3189 for (;i < l; i++) { 3190 node = fragment; 3191 if (i !== iNoClone) { 3192 node = jQuery2.clone(node, true, true); 3193 if (hasScripts) { 3194 jQuery2.merge(scripts, getAll(node, "script")); 3195 } 3196 } 3197 callback.call(collection[i], node, i); 3198 } 3199 if (hasScripts) { 3200 doc = scripts[scripts.length - 1].ownerDocument; 3201 jQuery2.map(scripts, restoreScript); 3202 for (i = 0;i < hasScripts; i++) { 3203 node = scripts[i]; 3204 if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery2.contains(doc, node)) { 3205 if (node.src && (node.type || "").toLowerCase() !== "module") { 3206 if (jQuery2._evalUrl && !node.noModule) { 3207 jQuery2._evalUrl(node.src, { 3208 nonce: node.nonce || node.getAttribute("nonce") 3209 }, doc); 3210 } 3211 } else { 3212 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); 3213 } 3214 } 3215 } 3216 } 3217 } 3218 } 3219 return collection; 3220 } 3221 function remove2(elem, selector, keepData) { 3222 var node, nodes = selector ? jQuery2.filter(selector, elem) : elem, i = 0; 3223 for (;(node = nodes[i]) != null; i++) { 3224 if (!keepData && node.nodeType === 1) { 3225 jQuery2.cleanData(getAll(node)); 3226 } 3227 if (node.parentNode) { 3228 if (keepData && isAttached(node)) { 3229 setGlobalEval(getAll(node, "script")); 3230 } 3231 node.parentNode.removeChild(node); 3232 } 3233 } 3234 return elem; 3235 } 3236 jQuery2.extend({ 3237 htmlPrefilter: function(html) { 3238 return html; 3239 }, 3240 clone: function(elem, dataAndEvents, deepDataAndEvents) { 3241 var i, l, srcElements, destElements, clone2 = elem.cloneNode(true), inPage = isAttached(elem); 3242 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery2.isXMLDoc(elem)) { 3243 destElements = getAll(clone2); 3244 srcElements = getAll(elem); 3245 for (i = 0, l = srcElements.length;i < l; i++) { 3246 fixInput(srcElements[i], destElements[i]); 3247 } 3248 } 3249 if (dataAndEvents) { 3250 if (deepDataAndEvents) { 3251 srcElements = srcElements || getAll(elem); 3252 destElements = destElements || getAll(clone2); 3253 for (i = 0, l = srcElements.length;i < l; i++) { 3254 cloneCopyEvent(srcElements[i], destElements[i]); 3255 } 3256 } else { 3257 cloneCopyEvent(elem, clone2); 3258 } 3259 } 3260 destElements = getAll(clone2, "script"); 3261 if (destElements.length > 0) { 3262 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 3263 } 3264 return clone2; 3265 }, 3266 cleanData: function(elems) { 3267 var data, elem, type, special = jQuery2.event.special, i = 0; 3268 for (;(elem = elems[i]) !== undefined; i++) { 3269 if (acceptData(elem)) { 3270 if (data = elem[dataPriv.expando]) { 3271 if (data.events) { 3272 for (type in data.events) { 3273 if (special[type]) { 3274 jQuery2.event.remove(elem, type); 3275 } else { 3276 jQuery2.removeEvent(elem, type, data.handle); 3277 } 3278 } 3279 } 3280 elem[dataPriv.expando] = undefined; 3281 } 3282 if (elem[dataUser.expando]) { 3283 elem[dataUser.expando] = undefined; 3284 } 3285 } 3286 } 3287 } 3288 }); 3289 jQuery2.fn.extend({ 3290 detach: function(selector) { 3291 return remove2(this, selector, true); 3292 }, 3293 remove: function(selector) { 3294 return remove2(this, selector); 3295 }, 3296 text: function(value) { 3297 return access(this, function(value) { 3298 return value === undefined ? jQuery2.text(this) : this.empty().each(function() { 3299 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3300 this.textContent = value; 3301 } 3302 }); 3303 }, null, value, arguments.length); 3304 }, 3305 append: function() { 3306 return domManip(this, arguments, function(elem) { 3307 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3308 var target = manipulationTarget(this, elem); 3309 target.appendChild(elem); 3310 } 3311 }); 3312 }, 3313 prepend: function() { 3314 return domManip(this, arguments, function(elem) { 3315 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3316 var target = manipulationTarget(this, elem); 3317 target.insertBefore(elem, target.firstChild); 3318 } 3319 }); 3320 }, 3321 before: function() { 3322 return domManip(this, arguments, function(elem) { 3323 if (this.parentNode) { 3324 this.parentNode.insertBefore(elem, this); 3325 } 3326 }); 3327 }, 3328 after: function() { 3329 return domManip(this, arguments, function(elem) { 3330 if (this.parentNode) { 3331 this.parentNode.insertBefore(elem, this.nextSibling); 3332 } 3333 }); 3334 }, 3335 empty: function() { 3336 var elem, i = 0; 3337 for (;(elem = this[i]) != null; i++) { 3338 if (elem.nodeType === 1) { 3339 jQuery2.cleanData(getAll(elem, false)); 3340 elem.textContent = ""; 3341 } 3342 } 3343 return this; 3344 }, 3345 clone: function(dataAndEvents, deepDataAndEvents) { 3346 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 3347 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 3348 return this.map(function() { 3349 return jQuery2.clone(this, dataAndEvents, deepDataAndEvents); 3350 }); 3351 }, 3352 html: function(value) { 3353 return access(this, function(value) { 3354 var elem = this[0] || {}, i = 0, l = this.length; 3355 if (value === undefined && elem.nodeType === 1) { 3356 return elem.innerHTML; 3357 } 3358 if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { 3359 value = jQuery2.htmlPrefilter(value); 3360 try { 3361 for (;i < l; i++) { 3362 elem = this[i] || {}; 3363 if (elem.nodeType === 1) { 3364 jQuery2.cleanData(getAll(elem, false)); 3365 elem.innerHTML = value; 3366 } 3367 } 3368 elem = 0; 3369 } catch (e) {} 3370 } 3371 if (elem) { 3372 this.empty().append(value); 3373 } 3374 }, null, value, arguments.length); 3375 }, 3376 replaceWith: function() { 3377 var ignored = []; 3378 return domManip(this, arguments, function(elem) { 3379 var parent = this.parentNode; 3380 if (jQuery2.inArray(this, ignored) < 0) { 3381 jQuery2.cleanData(getAll(this)); 3382 if (parent) { 3383 parent.replaceChild(elem, this); 3384 } 3385 } 3386 }, ignored); 3387 } 3388 }); 3389 jQuery2.each({ 3390 appendTo: "append", 3391 prependTo: "prepend", 3392 insertBefore: "before", 3393 insertAfter: "after", 3394 replaceAll: "replaceWith" 3395 }, function(name, original) { 3396 jQuery2.fn[name] = function(selector) { 3397 var elems, ret2 = [], insert = jQuery2(selector), last = insert.length - 1, i = 0; 3398 for (;i <= last; i++) { 3399 elems = i === last ? this : this.clone(true); 3400 jQuery2(insert[i])[original](elems); 3401 push.apply(ret2, elems.get()); 3402 } 3403 return this.pushStack(ret2); 3404 }; 3405 }); 3406 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 3407 var rcustomProp = /^--/; 3408 var getStyles = function(elem) { 3409 var view = elem.ownerDocument.defaultView; 3410 if (!view || !view.opener) { 3411 view = window2; 3412 } 3413 return view.getComputedStyle(elem); 3414 }; 3415 var swap = function(elem, options2, callback) { 3416 var ret2, name, old = {}; 3417 for (name in options2) { 3418 old[name] = elem.style[name]; 3419 elem.style[name] = options2[name]; 3420 } 3421 ret2 = callback.call(elem); 3422 for (name in options2) { 3423 elem.style[name] = old[name]; 3424 } 3425 return ret2; 3426 }; 3427 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 3428 (function() { 3429 function computeStyleTests() { 3430 if (!div) { 3431 return; 3432 } 3433 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0"; 3434 div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%"; 3435 documentElement.appendChild(container).appendChild(div); 3436 var divStyle = window2.getComputedStyle(div); 3437 pixelPositionVal = divStyle.top !== "1%"; 3438 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 3439 div.style.right = "60%"; 3440 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 3441 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 3442 div.style.position = "absolute"; 3443 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 3444 documentElement.removeChild(container); 3445 div = null; 3446 } 3447 function roundPixelMeasures(measure) { 3448 return Math.round(parseFloat(measure)); 3449 } 3450 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div"); 3451 if (!div.style) { 3452 return; 3453 } 3454 div.style.backgroundClip = "content-box"; 3455 div.cloneNode(true).style.backgroundClip = ""; 3456 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 3457 jQuery2.extend(support, { 3458 boxSizingReliable: function() { 3459 computeStyleTests(); 3460 return boxSizingReliableVal; 3461 }, 3462 pixelBoxStyles: function() { 3463 computeStyleTests(); 3464 return pixelBoxStylesVal; 3465 }, 3466 pixelPosition: function() { 3467 computeStyleTests(); 3468 return pixelPositionVal; 3469 }, 3470 reliableMarginLeft: function() { 3471 computeStyleTests(); 3472 return reliableMarginLeftVal; 3473 }, 3474 scrollboxSize: function() { 3475 computeStyleTests(); 3476 return scrollboxSizeVal; 3477 }, 3478 reliableTrDimensions: function() { 3479 var table, tr, trChild, trStyle; 3480 if (reliableTrDimensionsVal == null) { 3481 table = document2.createElement("table"); 3482 tr = document2.createElement("tr"); 3483 trChild = document2.createElement("div"); 3484 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 3485 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 3486 tr.style.height = "1px"; 3487 trChild.style.height = "9px"; 3488 trChild.style.display = "block"; 3489 documentElement.appendChild(table).appendChild(tr).appendChild(trChild); 3490 trStyle = window2.getComputedStyle(tr); 3491 reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight; 3492 documentElement.removeChild(table); 3493 } 3494 return reliableTrDimensionsVal; 3495 } 3496 }); 3497 })(); 3498 function curCSS(elem, name, computed) { 3499 var width, minWidth, maxWidth, ret2, isCustomProp = rcustomProp.test(name), style = elem.style; 3500 computed = computed || getStyles(elem); 3501 if (computed) { 3502 ret2 = computed.getPropertyValue(name) || computed[name]; 3503 if (isCustomProp && ret2) { 3504 ret2 = ret2.replace(rtrimCSS, "$1") || undefined; 3505 } 3506 if (ret2 === "" && !isAttached(elem)) { 3507 ret2 = jQuery2.style(elem, name); 3508 } 3509 if (!support.pixelBoxStyles() && rnumnonpx.test(ret2) && rboxStyle.test(name)) { 3510 width = style.width; 3511 minWidth = style.minWidth; 3512 maxWidth = style.maxWidth; 3513 style.minWidth = style.maxWidth = style.width = ret2; 3514 ret2 = computed.width; 3515 style.width = width; 3516 style.minWidth = minWidth; 3517 style.maxWidth = maxWidth; 3518 } 3519 } 3520 return ret2 !== undefined ? ret2 + "" : ret2; 3521 } 3522 function addGetHookIf(conditionFn, hookFn) { 3523 return { 3524 get: function() { 3525 if (conditionFn()) { 3526 delete this.get; 3527 return; 3528 } 3529 return (this.get = hookFn).apply(this, arguments); 3530 } 3531 }; 3532 } 3533 var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {}; 3534 function vendorPropName(name) { 3535 var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length; 3536 while (i--) { 3537 name = cssPrefixes[i] + capName; 3538 if (name in emptyStyle) { 3539 return name; 3540 } 3541 } 3542 } 3543 function finalPropName(name) { 3544 var final = jQuery2.cssProps[name] || vendorProps[name]; 3545 if (final) { 3546 return final; 3547 } 3548 if (name in emptyStyle) { 3549 return name; 3550 } 3551 return vendorProps[name] = vendorPropName(name) || name; 3552 } 3553 var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { 3554 letterSpacing: "0", 3555 fontWeight: "400" 3556 }; 3557 function setPositiveNumber(_elem, value, subtract) { 3558 var matches = rcssNum.exec(value); 3559 return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value; 3560 } 3561 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 3562 var i = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0; 3563 if (box === (isBorderBox ? "border" : "content")) { 3564 return 0; 3565 } 3566 for (;i < 4; i += 2) { 3567 if (box === "margin") { 3568 marginDelta += jQuery2.css(elem, box + cssExpand[i], true, styles); 3569 } 3570 if (!isBorderBox) { 3571 delta += jQuery2.css(elem, "padding" + cssExpand[i], true, styles); 3572 if (box !== "padding") { 3573 delta += jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3574 } else { 3575 extra += jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3576 } 3577 } else { 3578 if (box === "content") { 3579 delta -= jQuery2.css(elem, "padding" + cssExpand[i], true, styles); 3580 } 3581 if (box !== "margin") { 3582 delta -= jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 3583 } 3584 } 3585 } 3586 if (!isBorderBox && computedVal >= 0) { 3587 delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5)) || 0; 3588 } 3589 return delta + marginDelta; 3590 } 3591 function getWidthOrHeight(elem, dimension, extra) { 3592 var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery2.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 3593 if (rnumnonpx.test(val)) { 3594 if (!extra) { 3595 return val; 3596 } 3597 val = "auto"; 3598 } 3599 if ((!support.boxSizingReliable() && isBorderBox || !support.reliableTrDimensions() && nodeName(elem, "tr") || val === "auto" || !parseFloat(val) && jQuery2.css(elem, "display", false, styles) === "inline") && elem.getClientRects().length) { 3600 isBorderBox = jQuery2.css(elem, "boxSizing", false, styles) === "border-box"; 3601 valueIsBorderBox = offsetProp in elem; 3602 if (valueIsBorderBox) { 3603 val = elem[offsetProp]; 3604 } 3605 } 3606 val = parseFloat(val) || 0; 3607 return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles, val) + "px"; 3608 } 3609 jQuery2.extend({ 3610 cssHooks: { 3611 opacity: { 3612 get: function(elem, computed) { 3613 if (computed) { 3614 var ret2 = curCSS(elem, "opacity"); 3615 return ret2 === "" ? "1" : ret2; 3616 } 3617 } 3618 } 3619 }, 3620 cssNumber: { 3621 animationIterationCount: true, 3622 aspectRatio: true, 3623 borderImageSlice: true, 3624 columnCount: true, 3625 flexGrow: true, 3626 flexShrink: true, 3627 fontWeight: true, 3628 gridArea: true, 3629 gridColumn: true, 3630 gridColumnEnd: true, 3631 gridColumnStart: true, 3632 gridRow: true, 3633 gridRowEnd: true, 3634 gridRowStart: true, 3635 lineHeight: true, 3636 opacity: true, 3637 order: true, 3638 orphans: true, 3639 scale: true, 3640 widows: true, 3641 zIndex: true, 3642 zoom: true, 3643 fillOpacity: true, 3644 floodOpacity: true, 3645 stopOpacity: true, 3646 strokeMiterlimit: true, 3647 strokeOpacity: true 3648 }, 3649 cssProps: {}, 3650 style: function(elem, name, value, extra) { 3651 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 3652 return; 3653 } 3654 var ret2, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style; 3655 if (!isCustomProp) { 3656 name = finalPropName(origName); 3657 } 3658 hooks = jQuery2.cssHooks[name] || jQuery2.cssHooks[origName]; 3659 if (value !== undefined) { 3660 type = typeof value; 3661 if (type === "string" && (ret2 = rcssNum.exec(value)) && ret2[1]) { 3662 value = adjustCSS(elem, name, ret2); 3663 type = "number"; 3664 } 3665 if (value == null || value !== value) { 3666 return; 3667 } 3668 if (type === "number" && !isCustomProp) { 3669 value += ret2 && ret2[3] || (jQuery2.cssNumber[origName] ? "" : "px"); 3670 } 3671 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 3672 style[name] = "inherit"; 3673 } 3674 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { 3675 if (isCustomProp) { 3676 style.setProperty(name, value); 3677 } else { 3678 style[name] = value; 3679 } 3680 } 3681 } else { 3682 if (hooks && "get" in hooks && (ret2 = hooks.get(elem, false, extra)) !== undefined) { 3683 return ret2; 3684 } 3685 return style[name]; 3686 } 3687 }, 3688 css: function(elem, name, extra, styles) { 3689 var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name); 3690 if (!isCustomProp) { 3691 name = finalPropName(origName); 3692 } 3693 hooks = jQuery2.cssHooks[name] || jQuery2.cssHooks[origName]; 3694 if (hooks && "get" in hooks) { 3695 val = hooks.get(elem, true, extra); 3696 } 3697 if (val === undefined) { 3698 val = curCSS(elem, name, styles); 3699 } 3700 if (val === "normal" && name in cssNormalTransform) { 3701 val = cssNormalTransform[name]; 3702 } 3703 if (extra === "" || extra) { 3704 num = parseFloat(val); 3705 return extra === true || isFinite(num) ? num || 0 : val; 3706 } 3707 return val; 3708 } 3709 }); 3710 jQuery2.each(["height", "width"], function(_i, dimension) { 3711 jQuery2.cssHooks[dimension] = { 3712 get: function(elem, computed, extra) { 3713 if (computed) { 3714 return rdisplayswap.test(jQuery2.css(elem, "display")) && (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() { 3715 return getWidthOrHeight(elem, dimension, extra); 3716 }) : getWidthOrHeight(elem, dimension, extra); 3717 } 3718 }, 3719 set: function(elem, value, extra) { 3720 var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery2.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) : 0; 3721 if (isBorderBox && scrollboxSizeBuggy) { 3722 subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5); 3723 } 3724 if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") { 3725 elem.style[dimension] = value; 3726 value = jQuery2.css(elem, dimension); 3727 } 3728 return setPositiveNumber(elem, value, subtract); 3729 } 3730 }; 3731 }); 3732 jQuery2.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function(elem, computed) { 3733 if (computed) { 3734 return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() { 3735 return elem.getBoundingClientRect().left; 3736 })) + "px"; 3737 } 3738 }); 3739 jQuery2.each({ 3740 margin: "", 3741 padding: "", 3742 border: "Width" 3743 }, function(prefix, suffix) { 3744 jQuery2.cssHooks[prefix + suffix] = { 3745 expand: function(value) { 3746 var i = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value]; 3747 for (;i < 4; i++) { 3748 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; 3749 } 3750 return expanded; 3751 } 3752 }; 3753 if (prefix !== "margin") { 3754 jQuery2.cssHooks[prefix + suffix].set = setPositiveNumber; 3755 } 3756 }); 3757 jQuery2.fn.extend({ 3758 css: function(name, value) { 3759 return access(this, function(elem, name, value) { 3760 var styles, len, map = {}, i = 0; 3761 if (Array.isArray(name)) { 3762 styles = getStyles(elem); 3763 len = name.length; 3764 for (;i < len; i++) { 3765 map[name[i]] = jQuery2.css(elem, name[i], false, styles); 3766 } 3767 return map; 3768 } 3769 return value !== undefined ? jQuery2.style(elem, name, value) : jQuery2.css(elem, name); 3770 }, name, value, arguments.length > 1); 3771 } 3772 }); 3773 function Tween(elem, options2, prop, end, easing) { 3774 return new Tween.prototype.init(elem, options2, prop, end, easing); 3775 } 3776 jQuery2.Tween = Tween; 3777 Tween.prototype = { 3778 constructor: Tween, 3779 init: function(elem, options2, prop, end, easing, unit) { 3780 this.elem = elem; 3781 this.prop = prop; 3782 this.easing = easing || jQuery2.easing._default; 3783 this.options = options2; 3784 this.start = this.now = this.cur(); 3785 this.end = end; 3786 this.unit = unit || (jQuery2.cssNumber[prop] ? "" : "px"); 3787 }, 3788 cur: function() { 3789 var hooks = Tween.propHooks[this.prop]; 3790 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); 3791 }, 3792 run: function(percent) { 3793 var eased, hooks = Tween.propHooks[this.prop]; 3794 if (this.options.duration) { 3795 this.pos = eased = jQuery2.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration); 3796 } else { 3797 this.pos = eased = percent; 3798 } 3799 this.now = (this.end - this.start) * eased + this.start; 3800 if (this.options.step) { 3801 this.options.step.call(this.elem, this.now, this); 3802 } 3803 if (hooks && hooks.set) { 3804 hooks.set(this); 3805 } else { 3806 Tween.propHooks._default.set(this); 3807 } 3808 return this; 3809 } 3810 }; 3811 Tween.prototype.init.prototype = Tween.prototype; 3812 Tween.propHooks = { 3813 _default: { 3814 get: function(tween) { 3815 var result; 3816 if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 3817 return tween.elem[tween.prop]; 3818 } 3819 result = jQuery2.css(tween.elem, tween.prop, ""); 3820 return !result || result === "auto" ? 0 : result; 3821 }, 3822 set: function(tween) { 3823 if (jQuery2.fx.step[tween.prop]) { 3824 jQuery2.fx.step[tween.prop](tween); 3825 } else if (tween.elem.nodeType === 1 && (jQuery2.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) { 3826 jQuery2.style(tween.elem, tween.prop, tween.now + tween.unit); 3827 } else { 3828 tween.elem[tween.prop] = tween.now; 3829 } 3830 } 3831 } 3832 }; 3833 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 3834 set: function(tween) { 3835 if (tween.elem.nodeType && tween.elem.parentNode) { 3836 tween.elem[tween.prop] = tween.now; 3837 } 3838 } 3839 }; 3840 jQuery2.easing = { 3841 linear: function(p) { 3842 return p; 3843 }, 3844 swing: function(p) { 3845 return 0.5 - Math.cos(p * Math.PI) / 2; 3846 }, 3847 _default: "swing" 3848 }; 3849 jQuery2.fx = Tween.prototype.init; 3850 jQuery2.fx.step = {}; 3851 var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; 3852 function schedule() { 3853 if (inProgress) { 3854 if (document2.hidden === false && window2.requestAnimationFrame) { 3855 window2.requestAnimationFrame(schedule); 3856 } else { 3857 window2.setTimeout(schedule, jQuery2.fx.interval); 3858 } 3859 jQuery2.fx.tick(); 3860 } 3861 } 3862 function createFxNow() { 3863 window2.setTimeout(function() { 3864 fxNow = undefined; 3865 }); 3866 return fxNow = Date.now(); 3867 } 3868 function genFx(type, includeWidth) { 3869 var which, i = 0, attrs = { height: type }; 3870 includeWidth = includeWidth ? 1 : 0; 3871 for (;i < 4; i += 2 - includeWidth) { 3872 which = cssExpand[i]; 3873 attrs["margin" + which] = attrs["padding" + which] = type; 3874 } 3875 if (includeWidth) { 3876 attrs.opacity = attrs.width = type; 3877 } 3878 return attrs; 3879 } 3880 function createTween(value, prop, animation) { 3881 var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index = 0, length = collection.length; 3882 for (;index < length; index++) { 3883 if (tween = collection[index].call(animation, prop, value)) { 3884 return tween; 3885 } 3886 } 3887 } 3888 function defaultPrefilter(elem, props, opts) { 3889 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"); 3890 if (!opts.queue) { 3891 hooks = jQuery2._queueHooks(elem, "fx"); 3892 if (hooks.unqueued == null) { 3893 hooks.unqueued = 0; 3894 oldfire = hooks.empty.fire; 3895 hooks.empty.fire = function() { 3896 if (!hooks.unqueued) { 3897 oldfire(); 3898 } 3899 }; 3900 } 3901 hooks.unqueued++; 3902 anim.always(function() { 3903 anim.always(function() { 3904 hooks.unqueued--; 3905 if (!jQuery2.queue(elem, "fx").length) { 3906 hooks.empty.fire(); 3907 } 3908 }); 3909 }); 3910 } 3911 for (prop in props) { 3912 value = props[prop]; 3913 if (rfxtypes.test(value)) { 3914 delete props[prop]; 3915 toggle = toggle || value === "toggle"; 3916 if (value === (hidden ? "hide" : "show")) { 3917 if (value === "show" && dataShow && dataShow[prop] !== undefined) { 3918 hidden = true; 3919 } else { 3920 continue; 3921 } 3922 } 3923 orig[prop] = dataShow && dataShow[prop] || jQuery2.style(elem, prop); 3924 } 3925 } 3926 propTween = !jQuery2.isEmptyObject(props); 3927 if (!propTween && jQuery2.isEmptyObject(orig)) { 3928 return; 3929 } 3930 if (isBox && elem.nodeType === 1) { 3931 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 3932 restoreDisplay = dataShow && dataShow.display; 3933 if (restoreDisplay == null) { 3934 restoreDisplay = dataPriv.get(elem, "display"); 3935 } 3936 display = jQuery2.css(elem, "display"); 3937 if (display === "none") { 3938 if (restoreDisplay) { 3939 display = restoreDisplay; 3940 } else { 3941 showHide([elem], true); 3942 restoreDisplay = elem.style.display || restoreDisplay; 3943 display = jQuery2.css(elem, "display"); 3944 showHide([elem]); 3945 } 3946 } 3947 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 3948 if (jQuery2.css(elem, "float") === "none") { 3949 if (!propTween) { 3950 anim.done(function() { 3951 style.display = restoreDisplay; 3952 }); 3953 if (restoreDisplay == null) { 3954 display = style.display; 3955 restoreDisplay = display === "none" ? "" : display; 3956 } 3957 } 3958 style.display = "inline-block"; 3959 } 3960 } 3961 } 3962 if (opts.overflow) { 3963 style.overflow = "hidden"; 3964 anim.always(function() { 3965 style.overflow = opts.overflow[0]; 3966 style.overflowX = opts.overflow[1]; 3967 style.overflowY = opts.overflow[2]; 3968 }); 3969 } 3970 propTween = false; 3971 for (prop in orig) { 3972 if (!propTween) { 3973 if (dataShow) { 3974 if ("hidden" in dataShow) { 3975 hidden = dataShow.hidden; 3976 } 3977 } else { 3978 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 3979 } 3980 if (toggle) { 3981 dataShow.hidden = !hidden; 3982 } 3983 if (hidden) { 3984 showHide([elem], true); 3985 } 3986 anim.done(function() { 3987 if (!hidden) { 3988 showHide([elem]); 3989 } 3990 dataPriv.remove(elem, "fxshow"); 3991 for (prop in orig) { 3992 jQuery2.style(elem, prop, orig[prop]); 3993 } 3994 }); 3995 } 3996 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 3997 if (!(prop in dataShow)) { 3998 dataShow[prop] = propTween.start; 3999 if (hidden) { 4000 propTween.end = propTween.start; 4001 propTween.start = 0; 4002 } 4003 } 4004 } 4005 } 4006 function propFilter(props, specialEasing) { 4007 var index, name, easing, value, hooks; 4008 for (index in props) { 4009 name = camelCase(index); 4010 easing = specialEasing[name]; 4011 value = props[index]; 4012 if (Array.isArray(value)) { 4013 easing = value[1]; 4014 value = props[index] = value[0]; 4015 } 4016 if (index !== name) { 4017 props[name] = value; 4018 delete props[index]; 4019 } 4020 hooks = jQuery2.cssHooks[name]; 4021 if (hooks && "expand" in hooks) { 4022 value = hooks.expand(value); 4023 delete props[name]; 4024 for (index in value) { 4025 if (!(index in props)) { 4026 props[index] = value[index]; 4027 specialEasing[index] = easing; 4028 } 4029 } 4030 } else { 4031 specialEasing[name] = easing; 4032 } 4033 } 4034 } 4035 function Animation(elem, properties, options2) { 4036 var result, stopped, index = 0, length = Animation.prefilters.length, deferred2 = jQuery2.Deferred().always(function() { 4037 delete tick.elem; 4038 }), tick = function() { 4039 if (stopped) { 4040 return false; 4041 } 4042 var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; 4043 for (;index < length; index++) { 4044 animation.tweens[index].run(percent); 4045 } 4046 deferred2.notifyWith(elem, [animation, percent, remaining]); 4047 if (percent < 1 && length) { 4048 return remaining; 4049 } 4050 if (!length) { 4051 deferred2.notifyWith(elem, [animation, 1, 0]); 4052 } 4053 deferred2.resolveWith(elem, [animation]); 4054 return false; 4055 }, animation = deferred2.promise({ 4056 elem, 4057 props: jQuery2.extend({}, properties), 4058 opts: jQuery2.extend(true, { 4059 specialEasing: {}, 4060 easing: jQuery2.easing._default 4061 }, options2), 4062 originalProperties: properties, 4063 originalOptions: options2, 4064 startTime: fxNow || createFxNow(), 4065 duration: options2.duration, 4066 tweens: [], 4067 createTween: function(prop, end) { 4068 var tween = jQuery2.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing); 4069 animation.tweens.push(tween); 4070 return tween; 4071 }, 4072 stop: function(gotoEnd) { 4073 var index = 0, length = gotoEnd ? animation.tweens.length : 0; 4074 if (stopped) { 4075 return this; 4076 } 4077 stopped = true; 4078 for (;index < length; index++) { 4079 animation.tweens[index].run(1); 4080 } 4081 if (gotoEnd) { 4082 deferred2.notifyWith(elem, [animation, 1, 0]); 4083 deferred2.resolveWith(elem, [animation, gotoEnd]); 4084 } else { 4085 deferred2.rejectWith(elem, [animation, gotoEnd]); 4086 } 4087 return this; 4088 } 4089 }), props = animation.props; 4090 propFilter(props, animation.opts.specialEasing); 4091 for (;index < length; index++) { 4092 result = Animation.prefilters[index].call(animation, elem, props, animation.opts); 4093 if (result) { 4094 if (isFunction(result.stop)) { 4095 jQuery2._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result); 4096 } 4097 return result; 4098 } 4099 } 4100 jQuery2.map(props, createTween, animation); 4101 if (isFunction(animation.opts.start)) { 4102 animation.opts.start.call(elem, animation); 4103 } 4104 animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always); 4105 jQuery2.fx.timer(jQuery2.extend(tick, { 4106 elem, 4107 anim: animation, 4108 queue: animation.opts.queue 4109 })); 4110 return animation; 4111 } 4112 jQuery2.Animation = jQuery2.extend(Animation, { 4113 tweeners: { 4114 "*": [function(prop, value) { 4115 var tween = this.createTween(prop, value); 4116 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 4117 return tween; 4118 }] 4119 }, 4120 tweener: function(props, callback) { 4121 if (isFunction(props)) { 4122 callback = props; 4123 props = ["*"]; 4124 } else { 4125 props = props.match(rnothtmlwhite); 4126 } 4127 var prop, index = 0, length = props.length; 4128 for (;index < length; index++) { 4129 prop = props[index]; 4130 Animation.tweeners[prop] = Animation.tweeners[prop] || []; 4131 Animation.tweeners[prop].unshift(callback); 4132 } 4133 }, 4134 prefilters: [defaultPrefilter], 4135 prefilter: function(callback, prepend) { 4136 if (prepend) { 4137 Animation.prefilters.unshift(callback); 4138 } else { 4139 Animation.prefilters.push(callback); 4140 } 4141 } 4142 }); 4143 jQuery2.speed = function(speed, easing, fn2) { 4144 var opt = speed && typeof speed === "object" ? jQuery2.extend({}, speed) : { 4145 complete: fn2 || !fn2 && easing || isFunction(speed) && speed, 4146 duration: speed, 4147 easing: fn2 && easing || easing && !isFunction(easing) && easing 4148 }; 4149 if (jQuery2.fx.off) { 4150 opt.duration = 0; 4151 } else { 4152 if (typeof opt.duration !== "number") { 4153 if (opt.duration in jQuery2.fx.speeds) { 4154 opt.duration = jQuery2.fx.speeds[opt.duration]; 4155 } else { 4156 opt.duration = jQuery2.fx.speeds._default; 4157 } 4158 } 4159 } 4160 if (opt.queue == null || opt.queue === true) { 4161 opt.queue = "fx"; 4162 } 4163 opt.old = opt.complete; 4164 opt.complete = function() { 4165 if (isFunction(opt.old)) { 4166 opt.old.call(this); 4167 } 4168 if (opt.queue) { 4169 jQuery2.dequeue(this, opt.queue); 4170 } 4171 }; 4172 return opt; 4173 }; 4174 jQuery2.fn.extend({ 4175 fadeTo: function(speed, to, easing, callback) { 4176 return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback); 4177 }, 4178 animate: function(prop, speed, easing, callback) { 4179 var empty = jQuery2.isEmptyObject(prop), optall = jQuery2.speed(speed, easing, callback), doAnimation = function() { 4180 var anim = Animation(this, jQuery2.extend({}, prop), optall); 4181 if (empty || dataPriv.get(this, "finish")) { 4182 anim.stop(true); 4183 } 4184 }; 4185 doAnimation.finish = doAnimation; 4186 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); 4187 }, 4188 stop: function(type, clearQueue, gotoEnd) { 4189 var stopQueue = function(hooks) { 4190 var stop = hooks.stop; 4191 delete hooks.stop; 4192 stop(gotoEnd); 4193 }; 4194 if (typeof type !== "string") { 4195 gotoEnd = clearQueue; 4196 clearQueue = type; 4197 type = undefined; 4198 } 4199 if (clearQueue) { 4200 this.queue(type || "fx", []); 4201 } 4202 return this.each(function() { 4203 var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery2.timers, data = dataPriv.get(this); 4204 if (index) { 4205 if (data[index] && data[index].stop) { 4206 stopQueue(data[index]); 4207 } 4208 } else { 4209 for (index in data) { 4210 if (data[index] && data[index].stop && rrun.test(index)) { 4211 stopQueue(data[index]); 4212 } 4213 } 4214 } 4215 for (index = timers.length;index--; ) { 4216 if (timers[index].elem === this && (type == null || timers[index].queue === type)) { 4217 timers[index].anim.stop(gotoEnd); 4218 dequeue = false; 4219 timers.splice(index, 1); 4220 } 4221 } 4222 if (dequeue || !gotoEnd) { 4223 jQuery2.dequeue(this, type); 4224 } 4225 }); 4226 }, 4227 finish: function(type) { 4228 if (type !== false) { 4229 type = type || "fx"; 4230 } 4231 return this.each(function() { 4232 var index, data = dataPriv.get(this), queue = data[type + "queue"], hooks = data[type + "queueHooks"], timers = jQuery2.timers, length = queue ? queue.length : 0; 4233 data.finish = true; 4234 jQuery2.queue(this, type, []); 4235 if (hooks && hooks.stop) { 4236 hooks.stop.call(this, true); 4237 } 4238 for (index = timers.length;index--; ) { 4239 if (timers[index].elem === this && timers[index].queue === type) { 4240 timers[index].anim.stop(true); 4241 timers.splice(index, 1); 4242 } 4243 } 4244 for (index = 0;index < length; index++) { 4245 if (queue[index] && queue[index].finish) { 4246 queue[index].finish.call(this); 4247 } 4248 } 4249 delete data.finish; 4250 }); 4251 } 4252 }); 4253 jQuery2.each(["toggle", "show", "hide"], function(_i, name) { 4254 var cssFn = jQuery2.fn[name]; 4255 jQuery2.fn[name] = function(speed, easing, callback) { 4256 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); 4257 }; 4258 }); 4259 jQuery2.each({ 4260 slideDown: genFx("show"), 4261 slideUp: genFx("hide"), 4262 slideToggle: genFx("toggle"), 4263 fadeIn: { opacity: "show" }, 4264 fadeOut: { opacity: "hide" }, 4265 fadeToggle: { opacity: "toggle" } 4266 }, function(name, props) { 4267 jQuery2.fn[name] = function(speed, easing, callback) { 4268 return this.animate(props, speed, easing, callback); 4269 }; 4270 }); 4271 jQuery2.timers = []; 4272 jQuery2.fx.tick = function() { 4273 var timer, i = 0, timers = jQuery2.timers; 4274 fxNow = Date.now(); 4275 for (;i < timers.length; i++) { 4276 timer = timers[i]; 4277 if (!timer() && timers[i] === timer) { 4278 timers.splice(i--, 1); 4279 } 4280 } 4281 if (!timers.length) { 4282 jQuery2.fx.stop(); 4283 } 4284 fxNow = undefined; 4285 }; 4286 jQuery2.fx.timer = function(timer) { 4287 jQuery2.timers.push(timer); 4288 jQuery2.fx.start(); 4289 }; 4290 jQuery2.fx.interval = 13; 4291 jQuery2.fx.start = function() { 4292 if (inProgress) { 4293 return; 4294 } 4295 inProgress = true; 4296 schedule(); 4297 }; 4298 jQuery2.fx.stop = function() { 4299 inProgress = null; 4300 }; 4301 jQuery2.fx.speeds = { 4302 slow: 600, 4303 fast: 200, 4304 _default: 400 4305 }; 4306 jQuery2.fn.delay = function(time, type) { 4307 time = jQuery2.fx ? jQuery2.fx.speeds[time] || time : time; 4308 type = type || "fx"; 4309 return this.queue(type, function(next, hooks) { 4310 var timeout = window2.setTimeout(next, time); 4311 hooks.stop = function() { 4312 window2.clearTimeout(timeout); 4313 }; 4314 }); 4315 }; 4316 (function() { 4317 var input = document2.createElement("input"), select2 = document2.createElement("select"), opt = select2.appendChild(document2.createElement("option")); 4318 input.type = "checkbox"; 4319 support.checkOn = input.value !== ""; 4320 support.optSelected = opt.selected; 4321 input = document2.createElement("input"); 4322 input.value = "t"; 4323 input.type = "radio"; 4324 support.radioValue = input.value === "t"; 4325 })(); 4326 var boolHook, attrHandle = jQuery2.expr.attrHandle; 4327 jQuery2.fn.extend({ 4328 attr: function(name, value) { 4329 return access(this, jQuery2.attr, name, value, arguments.length > 1); 4330 }, 4331 removeAttr: function(name) { 4332 return this.each(function() { 4333 jQuery2.removeAttr(this, name); 4334 }); 4335 } 4336 }); 4337 jQuery2.extend({ 4338 attr: function(elem, name, value) { 4339 var ret2, hooks, nType = elem.nodeType; 4340 if (nType === 3 || nType === 8 || nType === 2) { 4341 return; 4342 } 4343 if (typeof elem.getAttribute === "undefined") { 4344 return jQuery2.prop(elem, name, value); 4345 } 4346 if (nType !== 1 || !jQuery2.isXMLDoc(elem)) { 4347 hooks = jQuery2.attrHooks[name.toLowerCase()] || (jQuery2.expr.match.bool.test(name) ? boolHook : undefined); 4348 } 4349 if (value !== undefined) { 4350 if (value === null) { 4351 jQuery2.removeAttr(elem, name); 4352 return; 4353 } 4354 if (hooks && "set" in hooks && (ret2 = hooks.set(elem, value, name)) !== undefined) { 4355 return ret2; 4356 } 4357 elem.setAttribute(name, value + ""); 4358 return value; 4359 } 4360 if (hooks && "get" in hooks && (ret2 = hooks.get(elem, name)) !== null) { 4361 return ret2; 4362 } 4363 ret2 = jQuery2.find.attr(elem, name); 4364 return ret2 == null ? undefined : ret2; 4365 }, 4366 attrHooks: { 4367 type: { 4368 set: function(elem, value) { 4369 if (!support.radioValue && value === "radio" && nodeName(elem, "input")) { 4370 var val = elem.value; 4371 elem.setAttribute("type", value); 4372 if (val) { 4373 elem.value = val; 4374 } 4375 return value; 4376 } 4377 } 4378 } 4379 }, 4380 removeAttr: function(elem, value) { 4381 var name, i = 0, attrNames = value && value.match(rnothtmlwhite); 4382 if (attrNames && elem.nodeType === 1) { 4383 while (name = attrNames[i++]) { 4384 elem.removeAttribute(name); 4385 } 4386 } 4387 } 4388 }); 4389 boolHook = { 4390 set: function(elem, value, name) { 4391 if (value === false) { 4392 jQuery2.removeAttr(elem, name); 4393 } else { 4394 elem.setAttribute(name, name); 4395 } 4396 return name; 4397 } 4398 }; 4399 jQuery2.each(jQuery2.expr.match.bool.source.match(/\w+/g), function(_i, name) { 4400 var getter = attrHandle[name] || jQuery2.find.attr; 4401 attrHandle[name] = function(elem, name, isXML) { 4402 var ret2, handle, lowercaseName = name.toLowerCase(); 4403 if (!isXML) { 4404 handle = attrHandle[lowercaseName]; 4405 attrHandle[lowercaseName] = ret2; 4406 ret2 = getter(elem, name, isXML) != null ? lowercaseName : null; 4407 attrHandle[lowercaseName] = handle; 4408 } 4409 return ret2; 4410 }; 4411 }); 4412 var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; 4413 jQuery2.fn.extend({ 4414 prop: function(name, value) { 4415 return access(this, jQuery2.prop, name, value, arguments.length > 1); 4416 }, 4417 removeProp: function(name) { 4418 return this.each(function() { 4419 delete this[jQuery2.propFix[name] || name]; 4420 }); 4421 } 4422 }); 4423 jQuery2.extend({ 4424 prop: function(elem, name, value) { 4425 var ret2, hooks, nType = elem.nodeType; 4426 if (nType === 3 || nType === 8 || nType === 2) { 4427 return; 4428 } 4429 if (nType !== 1 || !jQuery2.isXMLDoc(elem)) { 4430 name = jQuery2.propFix[name] || name; 4431 hooks = jQuery2.propHooks[name]; 4432 } 4433 if (value !== undefined) { 4434 if (hooks && "set" in hooks && (ret2 = hooks.set(elem, value, name)) !== undefined) { 4435 return ret2; 4436 } 4437 return elem[name] = value; 4438 } 4439 if (hooks && "get" in hooks && (ret2 = hooks.get(elem, name)) !== null) { 4440 return ret2; 4441 } 4442 return elem[name]; 4443 }, 4444 propHooks: { 4445 tabIndex: { 4446 get: function(elem) { 4447 var tabindex = jQuery2.find.attr(elem, "tabindex"); 4448 if (tabindex) { 4449 return parseInt(tabindex, 10); 4450 } 4451 if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) { 4452 return 0; 4453 } 4454 return -1; 4455 } 4456 } 4457 }, 4458 propFix: { 4459 for: "htmlFor", 4460 class: "className" 4461 } 4462 }); 4463 if (!support.optSelected) { 4464 jQuery2.propHooks.selected = { 4465 get: function(elem) { 4466 var parent = elem.parentNode; 4467 if (parent && parent.parentNode) { 4468 parent.parentNode.selectedIndex; 4469 } 4470 return null; 4471 }, 4472 set: function(elem) { 4473 var parent = elem.parentNode; 4474 if (parent) { 4475 parent.selectedIndex; 4476 if (parent.parentNode) { 4477 parent.parentNode.selectedIndex; 4478 } 4479 } 4480 } 4481 }; 4482 } 4483 jQuery2.each([ 4484 "tabIndex", 4485 "readOnly", 4486 "maxLength", 4487 "cellSpacing", 4488 "cellPadding", 4489 "rowSpan", 4490 "colSpan", 4491 "useMap", 4492 "frameBorder", 4493 "contentEditable" 4494 ], function() { 4495 jQuery2.propFix[this.toLowerCase()] = this; 4496 }); 4497 function stripAndCollapse(value) { 4498 var tokens = value.match(rnothtmlwhite) || []; 4499 return tokens.join(" "); 4500 } 4501 function getClass(elem) { 4502 return elem.getAttribute && elem.getAttribute("class") || ""; 4503 } 4504 function classesToArray(value) { 4505 if (Array.isArray(value)) { 4506 return value; 4507 } 4508 if (typeof value === "string") { 4509 return value.match(rnothtmlwhite) || []; 4510 } 4511 return []; 4512 } 4513 jQuery2.fn.extend({ 4514 addClass: function(value) { 4515 var classNames, cur, curValue, className, i, finalValue; 4516 if (isFunction(value)) { 4517 return this.each(function(j) { 4518 jQuery2(this).addClass(value.call(this, j, getClass(this))); 4519 }); 4520 } 4521 classNames = classesToArray(value); 4522 if (classNames.length) { 4523 return this.each(function() { 4524 curValue = getClass(this); 4525 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4526 if (cur) { 4527 for (i = 0;i < classNames.length; i++) { 4528 className = classNames[i]; 4529 if (cur.indexOf(" " + className + " ") < 0) { 4530 cur += className + " "; 4531 } 4532 } 4533 finalValue = stripAndCollapse(cur); 4534 if (curValue !== finalValue) { 4535 this.setAttribute("class", finalValue); 4536 } 4537 } 4538 }); 4539 } 4540 return this; 4541 }, 4542 removeClass: function(value) { 4543 var classNames, cur, curValue, className, i, finalValue; 4544 if (isFunction(value)) { 4545 return this.each(function(j) { 4546 jQuery2(this).removeClass(value.call(this, j, getClass(this))); 4547 }); 4548 } 4549 if (!arguments.length) { 4550 return this.attr("class", ""); 4551 } 4552 classNames = classesToArray(value); 4553 if (classNames.length) { 4554 return this.each(function() { 4555 curValue = getClass(this); 4556 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 4557 if (cur) { 4558 for (i = 0;i < classNames.length; i++) { 4559 className = classNames[i]; 4560 while (cur.indexOf(" " + className + " ") > -1) { 4561 cur = cur.replace(" " + className + " ", " "); 4562 } 4563 } 4564 finalValue = stripAndCollapse(cur); 4565 if (curValue !== finalValue) { 4566 this.setAttribute("class", finalValue); 4567 } 4568 } 4569 }); 4570 } 4571 return this; 4572 }, 4573 toggleClass: function(value, stateVal) { 4574 var classNames, className, i, self2, type = typeof value, isValidValue = type === "string" || Array.isArray(value); 4575 if (isFunction(value)) { 4576 return this.each(function(i) { 4577 jQuery2(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal); 4578 }); 4579 } 4580 if (typeof stateVal === "boolean" && isValidValue) { 4581 return stateVal ? this.addClass(value) : this.removeClass(value); 4582 } 4583 classNames = classesToArray(value); 4584 return this.each(function() { 4585 if (isValidValue) { 4586 self2 = jQuery2(this); 4587 for (i = 0;i < classNames.length; i++) { 4588 className = classNames[i]; 4589 if (self2.hasClass(className)) { 4590 self2.removeClass(className); 4591 } else { 4592 self2.addClass(className); 4593 } 4594 } 4595 } else if (value === undefined || type === "boolean") { 4596 className = getClass(this); 4597 if (className) { 4598 dataPriv.set(this, "__className__", className); 4599 } 4600 if (this.setAttribute) { 4601 this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || ""); 4602 } 4603 } 4604 }); 4605 }, 4606 hasClass: function(selector) { 4607 var className, elem, i = 0; 4608 className = " " + selector + " "; 4609 while (elem = this[i++]) { 4610 if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 4611 return true; 4612 } 4613 } 4614 return false; 4615 } 4616 }); 4617 var rreturn = /\r/g; 4618 jQuery2.fn.extend({ 4619 val: function(value) { 4620 var hooks, ret2, valueIsFunction, elem = this[0]; 4621 if (!arguments.length) { 4622 if (elem) { 4623 hooks = jQuery2.valHooks[elem.type] || jQuery2.valHooks[elem.nodeName.toLowerCase()]; 4624 if (hooks && "get" in hooks && (ret2 = hooks.get(elem, "value")) !== undefined) { 4625 return ret2; 4626 } 4627 ret2 = elem.value; 4628 if (typeof ret2 === "string") { 4629 return ret2.replace(rreturn, ""); 4630 } 4631 return ret2 == null ? "" : ret2; 4632 } 4633 return; 4634 } 4635 valueIsFunction = isFunction(value); 4636 return this.each(function(i) { 4637 var val; 4638 if (this.nodeType !== 1) { 4639 return; 4640 } 4641 if (valueIsFunction) { 4642 val = value.call(this, i, jQuery2(this).val()); 4643 } else { 4644 val = value; 4645 } 4646 if (val == null) { 4647 val = ""; 4648 } else if (typeof val === "number") { 4649 val += ""; 4650 } else if (Array.isArray(val)) { 4651 val = jQuery2.map(val, function(value) { 4652 return value == null ? "" : value + ""; 4653 }); 4654 } 4655 hooks = jQuery2.valHooks[this.type] || jQuery2.valHooks[this.nodeName.toLowerCase()]; 4656 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 4657 this.value = val; 4658 } 4659 }); 4660 } 4661 }); 4662 jQuery2.extend({ 4663 valHooks: { 4664 option: { 4665 get: function(elem) { 4666 var val = jQuery2.find.attr(elem, "value"); 4667 return val != null ? val : stripAndCollapse(jQuery2.text(elem)); 4668 } 4669 }, 4670 select: { 4671 get: function(elem) { 4672 var value, option, i, { options: options2, selectedIndex: index } = elem, one = elem.type === "select-one", values = one ? null : [], max = one ? index + 1 : options2.length; 4673 if (index < 0) { 4674 i = max; 4675 } else { 4676 i = one ? index : 0; 4677 } 4678 for (;i < max; i++) { 4679 option = options2[i]; 4680 if ((option.selected || i === index) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) { 4681 value = jQuery2(option).val(); 4682 if (one) { 4683 return value; 4684 } 4685 values.push(value); 4686 } 4687 } 4688 return values; 4689 }, 4690 set: function(elem, value) { 4691 var optionSet, option, options2 = elem.options, values = jQuery2.makeArray(value), i = options2.length; 4692 while (i--) { 4693 option = options2[i]; 4694 if (option.selected = jQuery2.inArray(jQuery2.valHooks.option.get(option), values) > -1) { 4695 optionSet = true; 4696 } 4697 } 4698 if (!optionSet) { 4699 elem.selectedIndex = -1; 4700 } 4701 return values; 4702 } 4703 } 4704 } 4705 }); 4706 jQuery2.each(["radio", "checkbox"], function() { 4707 jQuery2.valHooks[this] = { 4708 set: function(elem, value) { 4709 if (Array.isArray(value)) { 4710 return elem.checked = jQuery2.inArray(jQuery2(elem).val(), value) > -1; 4711 } 4712 } 4713 }; 4714 if (!support.checkOn) { 4715 jQuery2.valHooks[this].get = function(elem) { 4716 return elem.getAttribute("value") === null ? "on" : elem.value; 4717 }; 4718 } 4719 }); 4720 var location2 = window2.location; 4721 var nonce = { guid: Date.now() }; 4722 var rquery = /\?/; 4723 jQuery2.parseXML = function(data) { 4724 var xml, parserErrorElem; 4725 if (!data || typeof data !== "string") { 4726 return null; 4727 } 4728 try { 4729 xml = new window2.DOMParser().parseFromString(data, "text/xml"); 4730 } catch (e) {} 4731 parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0]; 4732 if (!xml || parserErrorElem) { 4733 jQuery2.error("Invalid XML: " + (parserErrorElem ? jQuery2.map(parserErrorElem.childNodes, function(el) { 4734 return el.textContent; 4735 }).join(` 4736`) : data)); 4737 } 4738 return xml; 4739 }; 4740 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) { 4741 e.stopPropagation(); 4742 }; 4743 jQuery2.extend(jQuery2.event, { 4744 trigger: function(event, data, elem, onlyHandlers) { 4745 var i, 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(".") : []; 4746 cur = lastElement = tmp = elem = elem || document2; 4747 if (elem.nodeType === 3 || elem.nodeType === 8) { 4748 return; 4749 } 4750 if (rfocusMorph.test(type + jQuery2.event.triggered)) { 4751 return; 4752 } 4753 if (type.indexOf(".") > -1) { 4754 namespaces = type.split("."); 4755 type = namespaces.shift(); 4756 namespaces.sort(); 4757 } 4758 ontype = type.indexOf(":") < 0 && "on" + type; 4759 event = event[jQuery2.expando] ? event : new jQuery2.Event(type, typeof event === "object" && event); 4760 event.isTrigger = onlyHandlers ? 2 : 3; 4761 event.namespace = namespaces.join("."); 4762 event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 4763 event.result = undefined; 4764 if (!event.target) { 4765 event.target = elem; 4766 } 4767 data = data == null ? [event] : jQuery2.makeArray(data, [event]); 4768 special = jQuery2.event.special[type] || {}; 4769 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 4770 return; 4771 } 4772 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 4773 bubbleType = special.delegateType || type; 4774 if (!rfocusMorph.test(bubbleType + type)) { 4775 cur = cur.parentNode; 4776 } 4777 for (;cur; cur = cur.parentNode) { 4778 eventPath.push(cur); 4779 tmp = cur; 4780 } 4781 if (tmp === (elem.ownerDocument || document2)) { 4782 eventPath.push(tmp.defaultView || tmp.parentWindow || window2); 4783 } 4784 } 4785 i = 0; 4786 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 4787 lastElement = cur; 4788 event.type = i > 1 ? bubbleType : special.bindType || type; 4789 handle = (dataPriv.get(cur, "events") || Object.create(null))[event.type] && dataPriv.get(cur, "handle"); 4790 if (handle) { 4791 handle.apply(cur, data); 4792 } 4793 handle = ontype && cur[ontype]; 4794 if (handle && handle.apply && acceptData(cur)) { 4795 event.result = handle.apply(cur, data); 4796 if (event.result === false) { 4797 event.preventDefault(); 4798 } 4799 } 4800 } 4801 event.type = type; 4802 if (!onlyHandlers && !event.isDefaultPrevented()) { 4803 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) { 4804 if (ontype && isFunction(elem[type]) && !isWindow(elem)) { 4805 tmp = elem[ontype]; 4806 if (tmp) { 4807 elem[ontype] = null; 4808 } 4809 jQuery2.event.triggered = type; 4810 if (event.isPropagationStopped()) { 4811 lastElement.addEventListener(type, stopPropagationCallback); 4812 } 4813 elem[type](); 4814 if (event.isPropagationStopped()) { 4815 lastElement.removeEventListener(type, stopPropagationCallback); 4816 } 4817 jQuery2.event.triggered = undefined; 4818 if (tmp) { 4819 elem[ontype] = tmp; 4820 } 4821 } 4822 } 4823 } 4824 return event.result; 4825 }, 4826 simulate: function(type, elem, event) { 4827 var e = jQuery2.extend(new jQuery2.Event, event, { 4828 type, 4829 isSimulated: true 4830 }); 4831 jQuery2.event.trigger(e, null, elem); 4832 } 4833 }); 4834 jQuery2.fn.extend({ 4835 trigger: function(type, data) { 4836 return this.each(function() { 4837 jQuery2.event.trigger(type, data, this); 4838 }); 4839 }, 4840 triggerHandler: function(type, data) { 4841 var elem = this[0]; 4842 if (elem) { 4843 return jQuery2.event.trigger(type, data, elem, true); 4844 } 4845 } 4846 }); 4847 var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; 4848 function buildParams(prefix, obj2, traditional, add) { 4849 var name; 4850 if (Array.isArray(obj2)) { 4851 jQuery2.each(obj2, function(i, v) { 4852 if (traditional || rbracket.test(prefix)) { 4853 add(prefix, v); 4854 } else { 4855 buildParams(prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", v, traditional, add); 4856 } 4857 }); 4858 } else if (!traditional && toType(obj2) === "object") { 4859 for (name in obj2) { 4860 buildParams(prefix + "[" + name + "]", obj2[name], traditional, add); 4861 } 4862 } else { 4863 add(prefix, obj2); 4864 } 4865 } 4866 jQuery2.param = function(a, traditional) { 4867 var prefix, s = [], add = function(key, valueOrFunction) { 4868 var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction; 4869 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value); 4870 }; 4871 if (a == null) { 4872 return ""; 4873 } 4874 if (Array.isArray(a) || a.jquery && !jQuery2.isPlainObject(a)) { 4875 jQuery2.each(a, function() { 4876 add(this.name, this.value); 4877 }); 4878 } else { 4879 for (prefix in a) { 4880 buildParams(prefix, a[prefix], traditional, add); 4881 } 4882 } 4883 return s.join("&"); 4884 }; 4885 jQuery2.fn.extend({ 4886 serialize: function() { 4887 return jQuery2.param(this.serializeArray()); 4888 }, 4889 serializeArray: function() { 4890 return this.map(function() { 4891 var elements = jQuery2.prop(this, "elements"); 4892 return elements ? jQuery2.makeArray(elements) : this; 4893 }).filter(function() { 4894 var type = this.type; 4895 return this.name && !jQuery2(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type)); 4896 }).map(function(_i, elem) { 4897 var val = jQuery2(this).val(); 4898 if (val == null) { 4899 return null; 4900 } 4901 if (Array.isArray(val)) { 4902 return jQuery2.map(val, function(val) { 4903 return { name: elem.name, value: val.replace(rCRLF, `\r 4904`) }; 4905 }); 4906 } 4907 return { name: elem.name, value: val.replace(rCRLF, `\r 4908`) }; 4909 }).get(); 4910 } 4911 }); 4912 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"); 4913 originAnchor.href = location2.href; 4914 function addToPrefiltersOrTransports(structure) { 4915 return function(dataTypeExpression, func) { 4916 if (typeof dataTypeExpression !== "string") { 4917 func = dataTypeExpression; 4918 dataTypeExpression = "*"; 4919 } 4920 var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 4921 if (isFunction(func)) { 4922 while (dataType = dataTypes[i++]) { 4923 if (dataType[0] === "+") { 4924 dataType = dataType.slice(1) || "*"; 4925 (structure[dataType] = structure[dataType] || []).unshift(func); 4926 } else { 4927 (structure[dataType] = structure[dataType] || []).push(func); 4928 } 4929 } 4930 } 4931 }; 4932 } 4933 function inspectPrefiltersOrTransports(structure, options2, originalOptions, jqXHR) { 4934 var inspected = {}, seekingTransport = structure === transports; 4935 function inspect(dataType) { 4936 var selected; 4937 inspected[dataType] = true; 4938 jQuery2.each(structure[dataType] || [], function(_, prefilterOrFactory) { 4939 var dataTypeOrTransport = prefilterOrFactory(options2, originalOptions, jqXHR); 4940 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { 4941 options2.dataTypes.unshift(dataTypeOrTransport); 4942 inspect(dataTypeOrTransport); 4943 return false; 4944 } else if (seekingTransport) { 4945 return !(selected = dataTypeOrTransport); 4946 } 4947 }); 4948 return selected; 4949 } 4950 return inspect(options2.dataTypes[0]) || !inspected["*"] && inspect("*"); 4951 } 4952 function ajaxExtend(target, src) { 4953 var key, deep, flatOptions = jQuery2.ajaxSettings.flatOptions || {}; 4954 for (key in src) { 4955 if (src[key] !== undefined) { 4956 (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]; 4957 } 4958 } 4959 if (deep) { 4960 jQuery2.extend(true, target, deep); 4961 } 4962 return target; 4963 } 4964 function ajaxHandleResponses(s, jqXHR, responses) { 4965 var ct, type, finalDataType, firstDataType, { contents, dataTypes } = s; 4966 while (dataTypes[0] === "*") { 4967 dataTypes.shift(); 4968 if (ct === undefined) { 4969 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 4970 } 4971 } 4972 if (ct) { 4973 for (type in contents) { 4974 if (contents[type] && contents[type].test(ct)) { 4975 dataTypes.unshift(type); 4976 break; 4977 } 4978 } 4979 } 4980 if (dataTypes[0] in responses) { 4981 finalDataType = dataTypes[0]; 4982 } else { 4983 for (type in responses) { 4984 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 4985 finalDataType = type; 4986 break; 4987 } 4988 if (!firstDataType) { 4989 firstDataType = type; 4990 } 4991 } 4992 finalDataType = finalDataType || firstDataType; 4993 } 4994 if (finalDataType) { 4995 if (finalDataType !== dataTypes[0]) { 4996 dataTypes.unshift(finalDataType); 4997 } 4998 return responses[finalDataType]; 4999 } 5000 } 5001 function ajaxConvert(s, response, jqXHR, isSuccess) { 5002 var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice(); 5003 if (dataTypes[1]) { 5004 for (conv in s.converters) { 5005 converters[conv.toLowerCase()] = s.converters[conv]; 5006 } 5007 } 5008 current = dataTypes.shift(); 5009 while (current) { 5010 if (s.responseFields[current]) { 5011 jqXHR[s.responseFields[current]] = response; 5012 } 5013 if (!prev && isSuccess && s.dataFilter) { 5014 response = s.dataFilter(response, s.dataType); 5015 } 5016 prev = current; 5017 current = dataTypes.shift(); 5018 if (current) { 5019 if (current === "*") { 5020 current = prev; 5021 } else if (prev !== "*" && prev !== current) { 5022 conv = converters[prev + " " + current] || converters["* " + current]; 5023 if (!conv) { 5024 for (conv2 in converters) { 5025 tmp = conv2.split(" "); 5026 if (tmp[1] === current) { 5027 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; 5028 if (conv) { 5029 if (conv === true) { 5030 conv = converters[conv2]; 5031 } else if (converters[conv2] !== true) { 5032 current = tmp[0]; 5033 dataTypes.unshift(tmp[1]); 5034 } 5035 break; 5036 } 5037 } 5038 } 5039 } 5040 if (conv !== true) { 5041 if (conv && s.throws) { 5042 response = conv(response); 5043 } else { 5044 try { 5045 response = conv(response); 5046 } catch (e) { 5047 return { 5048 state: "parsererror", 5049 error: conv ? e : "No conversion from " + prev + " to " + current 5050 }; 5051 } 5052 } 5053 } 5054 } 5055 } 5056 } 5057 return { state: "success", data: response }; 5058 } 5059 jQuery2.extend({ 5060 active: 0, 5061 lastModified: {}, 5062 etag: {}, 5063 ajaxSettings: { 5064 url: location2.href, 5065 type: "GET", 5066 isLocal: rlocalProtocol.test(location2.protocol), 5067 global: true, 5068 processData: true, 5069 async: true, 5070 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 5071 accepts: { 5072 "*": allTypes, 5073 text: "text/plain", 5074 html: "text/html", 5075 xml: "application/xml, text/xml", 5076 json: "application/json, text/javascript" 5077 }, 5078 contents: { 5079 xml: /\bxml\b/, 5080 html: /\bhtml/, 5081 json: /\bjson\b/ 5082 }, 5083 responseFields: { 5084 xml: "responseXML", 5085 text: "responseText", 5086 json: "responseJSON" 5087 }, 5088 converters: { 5089 "* text": String, 5090 "text html": true, 5091 "text json": JSON.parse, 5092 "text xml": jQuery2.parseXML 5093 }, 5094 flatOptions: { 5095 url: true, 5096 context: true 5097 } 5098 }, 5099 ajaxSetup: function(target, settings2) { 5100 return settings2 ? ajaxExtend(ajaxExtend(target, jQuery2.ajaxSettings), settings2) : ajaxExtend(jQuery2.ajaxSettings, target); 5101 }, 5102 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 5103 ajaxTransport: addToPrefiltersOrTransports(transports), 5104 ajax: function(url, options2) { 5105 if (typeof url === "object") { 5106 options2 = url; 5107 url = undefined; 5108 } 5109 options2 = options2 || {}; 5110 var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed, fireGlobals, i, uncached, s = jQuery2.ajaxSetup({}, options2), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery2(callbackContext) : jQuery2.event, deferred2 = jQuery2.Deferred(), completeDeferred = jQuery2.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = { 5111 readyState: 0, 5112 getResponseHeader: function(key) { 5113 var match; 5114 if (completed) { 5115 if (!responseHeaders) { 5116 responseHeaders = {}; 5117 while (match = rheaders.exec(responseHeadersString)) { 5118 responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]); 5119 } 5120 } 5121 match = responseHeaders[key.toLowerCase() + " "]; 5122 } 5123 return match == null ? null : match.join(", "); 5124 }, 5125 getAllResponseHeaders: function() { 5126 return completed ? responseHeadersString : null; 5127 }, 5128 setRequestHeader: function(name, value) { 5129 if (completed == null) { 5130 name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name; 5131 requestHeaders[name] = value; 5132 } 5133 return this; 5134 }, 5135 overrideMimeType: function(type) { 5136 if (completed == null) { 5137 s.mimeType = type; 5138 } 5139 return this; 5140 }, 5141 statusCode: function(map) { 5142 var code; 5143 if (map) { 5144 if (completed) { 5145 jqXHR.always(map[jqXHR.status]); 5146 } else { 5147 for (code in map) { 5148 statusCode[code] = [statusCode[code], map[code]]; 5149 } 5150 } 5151 } 5152 return this; 5153 }, 5154 abort: function(statusText) { 5155 var finalText = statusText || strAbort; 5156 if (transport) { 5157 transport.abort(finalText); 5158 } 5159 done(0, finalText); 5160 return this; 5161 } 5162 }; 5163 deferred2.promise(jqXHR); 5164 s.url = ((url || s.url || location2.href) + "").replace(rprotocol, location2.protocol + "//"); 5165 s.type = options2.method || options2.type || s.method || s.type; 5166 s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 5167 if (s.crossDomain == null) { 5168 urlAnchor = document2.createElement("a"); 5169 try { 5170 urlAnchor.href = s.url; 5171 urlAnchor.href = urlAnchor.href; 5172 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; 5173 } catch (e) { 5174 s.crossDomain = true; 5175 } 5176 } 5177 if (s.data && s.processData && typeof s.data !== "string") { 5178 s.data = jQuery2.param(s.data, s.traditional); 5179 } 5180 inspectPrefiltersOrTransports(prefilters, s, options2, jqXHR); 5181 if (completed) { 5182 return jqXHR; 5183 } 5184 fireGlobals = jQuery2.event && s.global; 5185 if (fireGlobals && jQuery2.active++ === 0) { 5186 jQuery2.event.trigger("ajaxStart"); 5187 } 5188 s.type = s.type.toUpperCase(); 5189 s.hasContent = !rnoContent.test(s.type); 5190 cacheURL = s.url.replace(rhash, ""); 5191 if (!s.hasContent) { 5192 uncached = s.url.slice(cacheURL.length); 5193 if (s.data && (s.processData || typeof s.data === "string")) { 5194 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; 5195 delete s.data; 5196 } 5197 if (s.cache === false) { 5198 cacheURL = cacheURL.replace(rantiCache, "$1"); 5199 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached; 5200 } 5201 s.url = cacheURL + uncached; 5202 } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 5203 s.data = s.data.replace(r20, "+"); 5204 } 5205 if (s.ifModified) { 5206 if (jQuery2.lastModified[cacheURL]) { 5207 jqXHR.setRequestHeader("If-Modified-Since", jQuery2.lastModified[cacheURL]); 5208 } 5209 if (jQuery2.etag[cacheURL]) { 5210 jqXHR.setRequestHeader("If-None-Match", jQuery2.etag[cacheURL]); 5211 } 5212 } 5213 if (s.data && s.hasContent && s.contentType !== false || options2.contentType) { 5214 jqXHR.setRequestHeader("Content-Type", s.contentType); 5215 } 5216 jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]); 5217 for (i in s.headers) { 5218 jqXHR.setRequestHeader(i, s.headers[i]); 5219 } 5220 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) { 5221 return jqXHR.abort(); 5222 } 5223 strAbort = "abort"; 5224 completeDeferred.add(s.complete); 5225 jqXHR.done(s.success); 5226 jqXHR.fail(s.error); 5227 transport = inspectPrefiltersOrTransports(transports, s, options2, jqXHR); 5228 if (!transport) { 5229 done(-1, "No Transport"); 5230 } else { 5231 jqXHR.readyState = 1; 5232 if (fireGlobals) { 5233 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 5234 } 5235 if (completed) { 5236 return jqXHR; 5237 } 5238 if (s.async && s.timeout > 0) { 5239 timeoutTimer = window2.setTimeout(function() { 5240 jqXHR.abort("timeout"); 5241 }, s.timeout); 5242 } 5243 try { 5244 completed = false; 5245 transport.send(requestHeaders, done); 5246 } catch (e) { 5247 if (completed) { 5248 throw e; 5249 } 5250 done(-1, e); 5251 } 5252 } 5253 function done(status, nativeStatusText, responses, headers) { 5254 var isSuccess, success, error, response, modified, statusText = nativeStatusText; 5255 if (completed) { 5256 return; 5257 } 5258 completed = true; 5259 if (timeoutTimer) { 5260 window2.clearTimeout(timeoutTimer); 5261 } 5262 transport = undefined; 5263 responseHeadersString = headers || ""; 5264 jqXHR.readyState = status > 0 ? 4 : 0; 5265 isSuccess = status >= 200 && status < 300 || status === 304; 5266 if (responses) { 5267 response = ajaxHandleResponses(s, jqXHR, responses); 5268 } 5269 if (!isSuccess && jQuery2.inArray("script", s.dataTypes) > -1 && jQuery2.inArray("json", s.dataTypes) < 0) { 5270 s.converters["text script"] = function() {}; 5271 } 5272 response = ajaxConvert(s, response, jqXHR, isSuccess); 5273 if (isSuccess) { 5274 if (s.ifModified) { 5275 modified = jqXHR.getResponseHeader("Last-Modified"); 5276 if (modified) { 5277 jQuery2.lastModified[cacheURL] = modified; 5278 } 5279 modified = jqXHR.getResponseHeader("etag"); 5280 if (modified) { 5281 jQuery2.etag[cacheURL] = modified; 5282 } 5283 } 5284 if (status === 204 || s.type === "HEAD") { 5285 statusText = "nocontent"; 5286 } else if (status === 304) { 5287 statusText = "notmodified"; 5288 } else { 5289 statusText = response.state; 5290 success = response.data; 5291 error = response.error; 5292 isSuccess = !error; 5293 } 5294 } else { 5295 error = statusText; 5296 if (status || !statusText) { 5297 statusText = "error"; 5298 if (status < 0) { 5299 status = 0; 5300 } 5301 } 5302 } 5303 jqXHR.status = status; 5304 jqXHR.statusText = (nativeStatusText || statusText) + ""; 5305 if (isSuccess) { 5306 deferred2.resolveWith(callbackContext, [success, statusText, jqXHR]); 5307 } else { 5308 deferred2.rejectWith(callbackContext, [jqXHR, statusText, error]); 5309 } 5310 jqXHR.statusCode(statusCode); 5311 statusCode = undefined; 5312 if (fireGlobals) { 5313 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]); 5314 } 5315 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 5316 if (fireGlobals) { 5317 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 5318 if (!--jQuery2.active) { 5319 jQuery2.event.trigger("ajaxStop"); 5320 } 5321 } 5322 } 5323 return jqXHR; 5324 }, 5325 getJSON: function(url, data, callback) { 5326 return jQuery2.get(url, data, callback, "json"); 5327 }, 5328 getScript: function(url, callback) { 5329 return jQuery2.get(url, undefined, callback, "script"); 5330 } 5331 }); 5332 jQuery2.each(["get", "post"], function(_i, method) { 5333 jQuery2[method] = function(url, data, callback, type) { 5334 if (isFunction(data)) { 5335 type = type || callback; 5336 callback = data; 5337 data = undefined; 5338 } 5339 return jQuery2.ajax(jQuery2.extend({ 5340 url, 5341 type: method, 5342 dataType: type, 5343 data, 5344 success: callback 5345 }, jQuery2.isPlainObject(url) && url)); 5346 }; 5347 }); 5348 jQuery2.ajaxPrefilter(function(s) { 5349 var i; 5350 for (i in s.headers) { 5351 if (i.toLowerCase() === "content-type") { 5352 s.contentType = s.headers[i] || ""; 5353 } 5354 } 5355 }); 5356 jQuery2._evalUrl = function(url, options2, doc) { 5357 return jQuery2.ajax({ 5358 url, 5359 type: "GET", 5360 dataType: "script", 5361 cache: true, 5362 async: false, 5363 global: false, 5364 converters: { 5365 "text script": function() {} 5366 }, 5367 dataFilter: function(response) { 5368 jQuery2.globalEval(response, options2, doc); 5369 } 5370 }); 5371 }; 5372 jQuery2.fn.extend({ 5373 wrapAll: function(html) { 5374 var wrap; 5375 if (this[0]) { 5376 if (isFunction(html)) { 5377 html = html.call(this[0]); 5378 } 5379 wrap = jQuery2(html, this[0].ownerDocument).eq(0).clone(true); 5380 if (this[0].parentNode) { 5381 wrap.insertBefore(this[0]); 5382 } 5383 wrap.map(function() { 5384 var elem = this; 5385 while (elem.firstElementChild) { 5386 elem = elem.firstElementChild; 5387 } 5388 return elem; 5389 }).append(this); 5390 } 5391 return this; 5392 }, 5393 wrapInner: function(html) { 5394 if (isFunction(html)) { 5395 return this.each(function(i) { 5396 jQuery2(this).wrapInner(html.call(this, i)); 5397 }); 5398 } 5399 return this.each(function() { 5400 var self2 = jQuery2(this), contents = self2.contents(); 5401 if (contents.length) { 5402 contents.wrapAll(html); 5403 } else { 5404 self2.append(html); 5405 } 5406 }); 5407 }, 5408 wrap: function(html) { 5409 var htmlIsFunction = isFunction(html); 5410 return this.each(function(i) { 5411 jQuery2(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); 5412 }); 5413 }, 5414 unwrap: function(selector) { 5415 this.parent(selector).not("body").each(function() { 5416 jQuery2(this).replaceWith(this.childNodes); 5417 }); 5418 return this; 5419 } 5420 }); 5421 jQuery2.expr.pseudos.hidden = function(elem) { 5422 return !jQuery2.expr.pseudos.visible(elem); 5423 }; 5424 jQuery2.expr.pseudos.visible = function(elem) { 5425 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 5426 }; 5427 jQuery2.ajaxSettings.xhr = function() { 5428 try { 5429 return new window2.XMLHttpRequest; 5430 } catch (e) {} 5431 }; 5432 var xhrSuccessStatus = { 5433 0: 200, 5434 1223: 204 5435 }, xhrSupported = jQuery2.ajaxSettings.xhr(); 5436 support.cors = !!xhrSupported && "withCredentials" in xhrSupported; 5437 support.ajax = xhrSupported = !!xhrSupported; 5438 jQuery2.ajaxTransport(function(options2) { 5439 var callback, errorCallback; 5440 if (support.cors || xhrSupported && !options2.crossDomain) { 5441 return { 5442 send: function(headers, complete) { 5443 var i, xhr = options2.xhr(); 5444 xhr.open(options2.type, options2.url, options2.async, options2.username, options2.password); 5445 if (options2.xhrFields) { 5446 for (i in options2.xhrFields) { 5447 xhr[i] = options2.xhrFields[i]; 5448 } 5449 } 5450 if (options2.mimeType && xhr.overrideMimeType) { 5451 xhr.overrideMimeType(options2.mimeType); 5452 } 5453 if (!options2.crossDomain && !headers["X-Requested-With"]) { 5454 headers["X-Requested-With"] = "XMLHttpRequest"; 5455 } 5456 for (i in headers) { 5457 xhr.setRequestHeader(i, headers[i]); 5458 } 5459 callback = function(type) { 5460 return function() { 5461 if (callback) { 5462 callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null; 5463 if (type === "abort") { 5464 xhr.abort(); 5465 } else if (type === "error") { 5466 if (typeof xhr.status !== "number") { 5467 complete(0, "error"); 5468 } else { 5469 complete(xhr.status, xhr.statusText); 5470 } 5471 } else { 5472 complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders()); 5473 } 5474 } 5475 }; 5476 }; 5477 xhr.onload = callback(); 5478 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 5479 if (xhr.onabort !== undefined) { 5480 xhr.onabort = errorCallback; 5481 } else { 5482 xhr.onreadystatechange = function() { 5483 if (xhr.readyState === 4) { 5484 window2.setTimeout(function() { 5485 if (callback) { 5486 errorCallback(); 5487 } 5488 }); 5489 } 5490 }; 5491 } 5492 callback = callback("abort"); 5493 try { 5494 xhr.send(options2.hasContent && options2.data || null); 5495 } catch (e) { 5496 if (callback) { 5497 throw e; 5498 } 5499 } 5500 }, 5501 abort: function() { 5502 if (callback) { 5503 callback(); 5504 } 5505 } 5506 }; 5507 } 5508 }); 5509 jQuery2.ajaxPrefilter(function(s) { 5510 if (s.crossDomain) { 5511 s.contents.script = false; 5512 } 5513 }); 5514 jQuery2.ajaxSetup({ 5515 accepts: { 5516 script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript" 5517 }, 5518 contents: { 5519 script: /\b(?:java|ecma)script\b/ 5520 }, 5521 converters: { 5522 "text script": function(text2) { 5523 jQuery2.globalEval(text2); 5524 return text2; 5525 } 5526 } 5527 }); 5528 jQuery2.ajaxPrefilter("script", function(s) { 5529 if (s.cache === undefined) { 5530 s.cache = false; 5531 } 5532 if (s.crossDomain) { 5533 s.type = "GET"; 5534 } 5535 }); 5536 jQuery2.ajaxTransport("script", function(s) { 5537 if (s.crossDomain || s.scriptAttrs) { 5538 var script, callback; 5539 return { 5540 send: function(_, complete) { 5541 script = jQuery2("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback = function(evt) { 5542 script.remove(); 5543 callback = null; 5544 if (evt) { 5545 complete(evt.type === "error" ? 404 : 200, evt.type); 5546 } 5547 }); 5548 document2.head.appendChild(script[0]); 5549 }, 5550 abort: function() { 5551 if (callback) { 5552 callback(); 5553 } 5554 } 5555 }; 5556 } 5557 }); 5558 var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; 5559 jQuery2.ajaxSetup({ 5560 jsonp: "callback", 5561 jsonpCallback: function() { 5562 var callback = oldCallbacks.pop() || jQuery2.expando + "_" + nonce.guid++; 5563 this[callback] = true; 5564 return callback; 5565 } 5566 }); 5567 jQuery2.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) { 5568 var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data"); 5569 if (jsonProp || s.dataTypes[0] === "jsonp") { 5570 callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback; 5571 if (jsonProp) { 5572 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); 5573 } else if (s.jsonp !== false) { 5574 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; 5575 } 5576 s.converters["script json"] = function() { 5577 if (!responseContainer) { 5578 jQuery2.error(callbackName + " was not called"); 5579 } 5580 return responseContainer[0]; 5581 }; 5582 s.dataTypes[0] = "json"; 5583 overwritten = window2[callbackName]; 5584 window2[callbackName] = function() { 5585 responseContainer = arguments; 5586 }; 5587 jqXHR.always(function() { 5588 if (overwritten === undefined) { 5589 jQuery2(window2).removeProp(callbackName); 5590 } else { 5591 window2[callbackName] = overwritten; 5592 } 5593 if (s[callbackName]) { 5594 s.jsonpCallback = originalSettings.jsonpCallback; 5595 oldCallbacks.push(callbackName); 5596 } 5597 if (responseContainer && isFunction(overwritten)) { 5598 overwritten(responseContainer[0]); 5599 } 5600 responseContainer = overwritten = undefined; 5601 }); 5602 return "script"; 5603 } 5604 }); 5605 support.createHTMLDocument = function() { 5606 var body = document2.implementation.createHTMLDocument("").body; 5607 body.innerHTML = "<form></form><form></form>"; 5608 return body.childNodes.length === 2; 5609 }(); 5610 jQuery2.parseHTML = function(data, context, keepScripts) { 5611 if (typeof data !== "string") { 5612 return []; 5613 } 5614 if (typeof context === "boolean") { 5615 keepScripts = context; 5616 context = false; 5617 } 5618 var base, parsed, scripts; 5619 if (!context) { 5620 if (support.createHTMLDocument) { 5621 context = document2.implementation.createHTMLDocument(""); 5622 base = context.createElement("base"); 5623 base.href = document2.location.href; 5624 context.head.appendChild(base); 5625 } else { 5626 context = document2; 5627 } 5628 } 5629 parsed = rsingleTag.exec(data); 5630 scripts = !keepScripts && []; 5631 if (parsed) { 5632 return [context.createElement(parsed[1])]; 5633 } 5634 parsed = buildFragment([data], context, scripts); 5635 if (scripts && scripts.length) { 5636 jQuery2(scripts).remove(); 5637 } 5638 return jQuery2.merge([], parsed.childNodes); 5639 }; 5640 jQuery2.fn.load = function(url, params, callback) { 5641 var selector, type, response, self2 = this, off = url.indexOf(" "); 5642 if (off > -1) { 5643 selector = stripAndCollapse(url.slice(off)); 5644 url = url.slice(0, off); 5645 } 5646 if (isFunction(params)) { 5647 callback = params; 5648 params = undefined; 5649 } else if (params && typeof params === "object") { 5650 type = "POST"; 5651 } 5652 if (self2.length > 0) { 5653 jQuery2.ajax({ 5654 url, 5655 type: type || "GET", 5656 dataType: "html", 5657 data: params 5658 }).done(function(responseText) { 5659 response = arguments; 5660 self2.html(selector ? jQuery2("<div>").append(jQuery2.parseHTML(responseText)).find(selector) : responseText); 5661 }).always(callback && function(jqXHR, status) { 5662 self2.each(function() { 5663 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 5664 }); 5665 }); 5666 } 5667 return this; 5668 }; 5669 jQuery2.expr.pseudos.animated = function(elem) { 5670 return jQuery2.grep(jQuery2.timers, function(fn2) { 5671 return elem === fn2.elem; 5672 }).length; 5673 }; 5674 jQuery2.offset = { 5675 setOffset: function(elem, options2, i) { 5676 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery2.css(elem, "position"), curElem = jQuery2(elem), props = {}; 5677 if (position === "static") { 5678 elem.style.position = "relative"; 5679 } 5680 curOffset = curElem.offset(); 5681 curCSSTop = jQuery2.css(elem, "top"); 5682 curCSSLeft = jQuery2.css(elem, "left"); 5683 calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1; 5684 if (calculatePosition) { 5685 curPosition = curElem.position(); 5686 curTop = curPosition.top; 5687 curLeft = curPosition.left; 5688 } else { 5689 curTop = parseFloat(curCSSTop) || 0; 5690 curLeft = parseFloat(curCSSLeft) || 0; 5691 } 5692 if (isFunction(options2)) { 5693 options2 = options2.call(elem, i, jQuery2.extend({}, curOffset)); 5694 } 5695 if (options2.top != null) { 5696 props.top = options2.top - curOffset.top + curTop; 5697 } 5698 if (options2.left != null) { 5699 props.left = options2.left - curOffset.left + curLeft; 5700 } 5701 if ("using" in options2) { 5702 options2.using.call(elem, props); 5703 } else { 5704 curElem.css(props); 5705 } 5706 } 5707 }; 5708 jQuery2.fn.extend({ 5709 offset: function(options2) { 5710 if (arguments.length) { 5711 return options2 === undefined ? this : this.each(function(i) { 5712 jQuery2.offset.setOffset(this, options2, i); 5713 }); 5714 } 5715 var rect, win, elem = this[0]; 5716 if (!elem) { 5717 return; 5718 } 5719 if (!elem.getClientRects().length) { 5720 return { top: 0, left: 0 }; 5721 } 5722 rect = elem.getBoundingClientRect(); 5723 win = elem.ownerDocument.defaultView; 5724 return { 5725 top: rect.top + win.pageYOffset, 5726 left: rect.left + win.pageXOffset 5727 }; 5728 }, 5729 position: function() { 5730 if (!this[0]) { 5731 return; 5732 } 5733 var offsetParent, offset, doc, elem = this[0], parentOffset = { top: 0, left: 0 }; 5734 if (jQuery2.css(elem, "position") === "fixed") { 5735 offset = elem.getBoundingClientRect(); 5736 } else { 5737 offset = this.offset(); 5738 doc = elem.ownerDocument; 5739 offsetParent = elem.offsetParent || doc.documentElement; 5740 while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery2.css(offsetParent, "position") === "static") { 5741 offsetParent = offsetParent.parentNode; 5742 } 5743 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 5744 parentOffset = jQuery2(offsetParent).offset(); 5745 parentOffset.top += jQuery2.css(offsetParent, "borderTopWidth", true); 5746 parentOffset.left += jQuery2.css(offsetParent, "borderLeftWidth", true); 5747 } 5748 } 5749 return { 5750 top: offset.top - parentOffset.top - jQuery2.css(elem, "marginTop", true), 5751 left: offset.left - parentOffset.left - jQuery2.css(elem, "marginLeft", true) 5752 }; 5753 }, 5754 offsetParent: function() { 5755 return this.map(function() { 5756 var offsetParent = this.offsetParent; 5757 while (offsetParent && jQuery2.css(offsetParent, "position") === "static") { 5758 offsetParent = offsetParent.offsetParent; 5759 } 5760 return offsetParent || documentElement; 5761 }); 5762 } 5763 }); 5764 jQuery2.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) { 5765 var top = prop === "pageYOffset"; 5766 jQuery2.fn[method] = function(val) { 5767 return access(this, function(elem, method, val) { 5768 var win; 5769 if (isWindow(elem)) { 5770 win = elem; 5771 } else if (elem.nodeType === 9) { 5772 win = elem.defaultView; 5773 } 5774 if (val === undefined) { 5775 return win ? win[prop] : elem[method]; 5776 } 5777 if (win) { 5778 win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset); 5779 } else { 5780 elem[method] = val; 5781 } 5782 }, method, val, arguments.length); 5783 }; 5784 }); 5785 jQuery2.each(["top", "left"], function(_i, prop) { 5786 jQuery2.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) { 5787 if (computed) { 5788 computed = curCSS(elem, prop); 5789 return rnumnonpx.test(computed) ? jQuery2(elem).position()[prop] + "px" : computed; 5790 } 5791 }); 5792 }); 5793 jQuery2.each({ Height: "height", Width: "width" }, function(name, type) { 5794 jQuery2.each({ 5795 padding: "inner" + name, 5796 content: type, 5797 "": "outer" + name 5798 }, function(defaultExtra, funcName) { 5799 jQuery2.fn[funcName] = function(margin, value) { 5800 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 5801 return access(this, function(elem, type, value) { 5802 var doc; 5803 if (isWindow(elem)) { 5804 return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name]; 5805 } 5806 if (elem.nodeType === 9) { 5807 doc = elem.documentElement; 5808 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]); 5809 } 5810 return value === undefined ? jQuery2.css(elem, type, extra) : jQuery2.style(elem, type, value, extra); 5811 }, type, chainable ? margin : undefined, chainable); 5812 }; 5813 }); 5814 }); 5815 jQuery2.each([ 5816 "ajaxStart", 5817 "ajaxStop", 5818 "ajaxComplete", 5819 "ajaxError", 5820 "ajaxSuccess", 5821 "ajaxSend" 5822 ], function(_i, type) { 5823 jQuery2.fn[type] = function(fn2) { 5824 return this.on(type, fn2); 5825 }; 5826 }); 5827 jQuery2.fn.extend({ 5828 bind: function(types, data, fn2) { 5829 return this.on(types, null, data, fn2); 5830 }, 5831 unbind: function(types, fn2) { 5832 return this.off(types, null, fn2); 5833 }, 5834 delegate: function(selector, types, data, fn2) { 5835 return this.on(types, selector, data, fn2); 5836 }, 5837 undelegate: function(selector, types, fn2) { 5838 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2); 5839 }, 5840 hover: function(fnOver, fnOut) { 5841 return this.on("mouseenter", fnOver).on("mouseleave", fnOut || fnOver); 5842 } 5843 }); 5844 jQuery2.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function(_i, name) { 5845 jQuery2.fn[name] = function(data, fn2) { 5846 return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name); 5847 }; 5848 }); 5849 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 5850 jQuery2.proxy = function(fn2, context) { 5851 var tmp, args2, proxy; 5852 if (typeof context === "string") { 5853 tmp = fn2[context]; 5854 context = fn2; 5855 fn2 = tmp; 5856 } 5857 if (!isFunction(fn2)) { 5858 return; 5859 } 5860 args2 = slice.call(arguments, 2); 5861 proxy = function() { 5862 return fn2.apply(context || this, args2.concat(slice.call(arguments))); 5863 }; 5864 proxy.guid = fn2.guid = fn2.guid || jQuery2.guid++; 5865 return proxy; 5866 }; 5867 jQuery2.holdReady = function(hold) { 5868 if (hold) { 5869 jQuery2.readyWait++; 5870 } else { 5871 jQuery2.ready(true); 5872 } 5873 }; 5874 jQuery2.isArray = Array.isArray; 5875 jQuery2.parseJSON = JSON.parse; 5876 jQuery2.nodeName = nodeName; 5877 jQuery2.isFunction = isFunction; 5878 jQuery2.isWindow = isWindow; 5879 jQuery2.camelCase = camelCase; 5880 jQuery2.type = toType; 5881 jQuery2.now = Date.now; 5882 jQuery2.isNumeric = function(obj2) { 5883 var type = jQuery2.type(obj2); 5884 return (type === "number" || type === "string") && !isNaN(obj2 - parseFloat(obj2)); 5885 }; 5886 jQuery2.trim = function(text2) { 5887 return text2 == null ? "" : (text2 + "").replace(rtrim, "$1"); 5888 }; 5889 if (typeof define === "function" && define.amd) { 5890 define("jquery", [], function() { 5891 return jQuery2; 5892 }); 5893 } 5894 var { jQuery: _jQuery, $: _$ } = window2; 5895 jQuery2.noConflict = function(deep) { 5896 if (window2.$ === jQuery2) { 5897 window2.$ = _$; 5898 } 5899 if (deep && window2.jQuery === jQuery2) { 5900 window2.jQuery = _jQuery; 5901 } 5902 return jQuery2; 5903 }; 5904 if (typeof noGlobal === "undefined") { 5905 window2.jQuery = window2.$ = jQuery2; 5906 } 5907 return jQuery2; 5908 }); 5909}); 5910
vendor: 50,546 bytes, lines 5911-7133
5911// node_modules/popper.js/dist/umd/popper.js 5912var require_popper = __commonJS(function(exports2, module2) { 5913 (function(global2, factory) { 5914 typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.Popper = factory(); 5915 })(exports2, function() { 5916 var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof navigator !== "undefined"; 5917 var timeoutDuration = function() { 5918 var longerTimeoutBrowsers = ["Edge", "Trident", "Firefox"]; 5919 for (var i = 0;i < longerTimeoutBrowsers.length; i += 1) { 5920 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 5921 return 1; 5922 } 5923 } 5924 return 0; 5925 }(); 5926 function microtaskDebounce(fn2) { 5927 var called = false; 5928 return function() { 5929 if (called) { 5930 return; 5931 } 5932 called = true; 5933 window.Promise.resolve().then(function() { 5934 called = false; 5935 fn2(); 5936 }); 5937 }; 5938 } 5939 function taskDebounce(fn2) { 5940 var scheduled = false; 5941 return function() { 5942 if (!scheduled) { 5943 scheduled = true; 5944 setTimeout(function() { 5945 scheduled = false; 5946 fn2(); 5947 }, timeoutDuration); 5948 } 5949 }; 5950 } 5951 var supportsMicroTasks = isBrowser && window.Promise; 5952 var debounce2 = supportsMicroTasks ? microtaskDebounce : taskDebounce; 5953 function isFunction(functionToCheck) { 5954 var getType = {}; 5955 return functionToCheck && getType.toString.call(functionToCheck) === "[object Function]"; 5956 } 5957 function getStyleComputedProperty(element, property) { 5958 if (element.nodeType !== 1) { 5959 return []; 5960 } 5961 var window2 = element.ownerDocument.defaultView; 5962 var css2 = window2.getComputedStyle(element, null); 5963 return property ? css2[property] : css2; 5964 } 5965 function getParentNode(element) { 5966 if (element.nodeName === "HTML") { 5967 return element; 5968 } 5969 return element.parentNode || element.host; 5970 } 5971 function getScrollParent(element) { 5972 if (!element) { 5973 return document.body; 5974 } 5975 switch (element.nodeName) { 5976 case "HTML": 5977 case "BODY": 5978 return element.ownerDocument.body; 5979 case "#document": 5980 return element.body; 5981 } 5982 var _getStyleComputedProp = getStyleComputedProperty(element), { overflow, overflowX, overflowY } = _getStyleComputedProp; 5983 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 5984 return element; 5985 } 5986 return getScrollParent(getParentNode(element)); 5987 } 5988 function getReferenceNode(reference) { 5989 return reference && reference.referenceNode ? reference.referenceNode : reference; 5990 } 5991 var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 5992 var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 5993 function isIE(version) { 5994 if (version === 11) { 5995 return isIE11; 5996 } 5997 if (version === 10) { 5998 return isIE10; 5999 } 6000 return isIE11 || isIE10; 6001 } 6002 function getOffsetParent(element) { 6003 if (!element) { 6004 return document.documentElement; 6005 } 6006 var noOffsetParent = isIE(10) ? document.body : null; 6007 var offsetParent = element.offsetParent || null; 6008 while (offsetParent === noOffsetParent && element.nextElementSibling) { 6009 offsetParent = (element = element.nextElementSibling).offsetParent; 6010 } 6011 var nodeName = offsetParent && offsetParent.nodeName; 6012 if (!nodeName || nodeName === "BODY" || nodeName === "HTML") { 6013 return element ? element.ownerDocument.documentElement : document.documentElement; 6014 } 6015 if (["TH", "TD", "TABLE"].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, "position") === "static") { 6016 return getOffsetParent(offsetParent); 6017 } 6018 return offsetParent; 6019 } 6020 function isOffsetContainer(element) { 6021 var nodeName = element.nodeName; 6022 if (nodeName === "BODY") { 6023 return false; 6024 } 6025 return nodeName === "HTML" || getOffsetParent(element.firstElementChild) === element; 6026 } 6027 function getRoot(node) { 6028 if (node.parentNode !== null) { 6029 return getRoot(node.parentNode); 6030 } 6031 return node; 6032 } 6033 function findCommonOffsetParent(element1, element2) { 6034 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 6035 return document.documentElement; 6036 } 6037 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 6038 var start = order ? element1 : element2; 6039 var end = order ? element2 : element1; 6040 var range = document.createRange(); 6041 range.setStart(start, 0); 6042 range.setEnd(end, 0); 6043 var commonAncestorContainer = range.commonAncestorContainer; 6044 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 6045 if (isOffsetContainer(commonAncestorContainer)) { 6046 return commonAncestorContainer; 6047 } 6048 return getOffsetParent(commonAncestorContainer); 6049 } 6050 var element1root = getRoot(element1); 6051 if (element1root.host) { 6052 return findCommonOffsetParent(element1root.host, element2); 6053 } else { 6054 return findCommonOffsetParent(element1, getRoot(element2).host); 6055 } 6056 } 6057 function getScroll(element) { 6058 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "top"; 6059 var upperSide = side === "top" ? "scrollTop" : "scrollLeft"; 6060 var nodeName = element.nodeName; 6061 if (nodeName === "BODY" || nodeName === "HTML") { 6062 var html = element.ownerDocument.documentElement; 6063 var scrollingElement = element.ownerDocument.scrollingElement || html; 6064 return scrollingElement[upperSide]; 6065 } 6066 return element[upperSide]; 6067 } 6068 function includeScroll(rect, element) { 6069 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 6070 var scrollTop = getScroll(element, "top"); 6071 var scrollLeft = getScroll(element, "left"); 6072 var modifier = subtract ? -1 : 1; 6073 rect.top += scrollTop * modifier; 6074 rect.bottom += scrollTop * modifier; 6075 rect.left += scrollLeft * modifier; 6076 rect.right += scrollLeft * modifier; 6077 return rect; 6078 } 6079 function getBordersSize(styles, axis) { 6080 var sideA = axis === "x" ? "Left" : "Top"; 6081 var sideB = sideA === "Left" ? "Right" : "Bottom"; 6082 return parseFloat(styles["border" + sideA + "Width"]) + parseFloat(styles["border" + sideB + "Width"]); 6083 } 6084 function getSize(axis, body, html, computedStyle) { 6085 return Math.max(body["offset" + axis], body["scroll" + axis], html["client" + axis], html["offset" + axis], html["scroll" + axis], isIE(10) ? parseInt(html["offset" + axis]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Top" : "Left")]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Bottom" : "Right")]) : 0); 6086 } 6087 function getWindowSizes(document2) { 6088 var body = document2.body; 6089 var html = document2.documentElement; 6090 var computedStyle = isIE(10) && getComputedStyle(html); 6091 return { 6092 height: getSize("Height", body, html, computedStyle), 6093 width: getSize("Width", body, html, computedStyle) 6094 }; 6095 } 6096 var classCallCheck = function(instance, Constructor) { 6097 if (!(instance instanceof Constructor)) { 6098 throw new TypeError("Cannot call a class as a function"); 6099 } 6100 }; 6101 var createClass = function() { 6102 function defineProperties(target, props) { 6103 for (var i = 0;i < props.length; i++) { 6104 var descriptor = props[i]; 6105 descriptor.enumerable = descriptor.enumerable || false; 6106 descriptor.configurable = true; 6107 if ("value" in descriptor) 6108 descriptor.writable = true; 6109 Object.defineProperty(target, descriptor.key, descriptor); 6110 } 6111 } 6112 return function(Constructor, protoProps, staticProps) { 6113 if (protoProps) 6114 defineProperties(Constructor.prototype, protoProps); 6115 if (staticProps) 6116 defineProperties(Constructor, staticProps); 6117 return Constructor; 6118 }; 6119 }(); 6120 var defineProperty = function(obj2, key, value) { 6121 if (key in obj2) { 6122 Object.defineProperty(obj2, key, { 6123 value, 6124 enumerable: true, 6125 configurable: true, 6126 writable: true 6127 }); 6128 } else { 6129 obj2[key] = value; 6130 } 6131 return obj2; 6132 }; 6133 var _extends = Object.assign || function(target) { 6134 for (var i = 1;i < arguments.length; i++) { 6135 var source = arguments[i]; 6136 for (var key in source) { 6137 if (Object.prototype.hasOwnProperty.call(source, key)) { 6138 target[key] = source[key]; 6139 } 6140 } 6141 } 6142 return target; 6143 }; 6144 function getClientRect(offsets) { 6145 return _extends({}, offsets, { 6146 right: offsets.left + offsets.width, 6147 bottom: offsets.top + offsets.height 6148 }); 6149 } 6150 function getBoundingClientRect(element) { 6151 var rect = {}; 6152 try { 6153 if (isIE(10)) { 6154 rect = element.getBoundingClientRect(); 6155 var scrollTop = getScroll(element, "top"); 6156 var scrollLeft = getScroll(element, "left"); 6157 rect.top += scrollTop; 6158 rect.left += scrollLeft; 6159 rect.bottom += scrollTop; 6160 rect.right += scrollLeft; 6161 } else { 6162 rect = element.getBoundingClientRect(); 6163 } 6164 } catch (e) {} 6165 var result = { 6166 left: rect.left, 6167 top: rect.top, 6168 width: rect.right - rect.left, 6169 height: rect.bottom - rect.top 6170 }; 6171 var sizes = element.nodeName === "HTML" ? getWindowSizes(element.ownerDocument) : {}; 6172 var width = sizes.width || element.clientWidth || result.width; 6173 var height = sizes.height || element.clientHeight || result.height; 6174 var horizScrollbar = element.offsetWidth - width; 6175 var vertScrollbar = element.offsetHeight - height; 6176 if (horizScrollbar || vertScrollbar) { 6177 var styles = getStyleComputedProperty(element); 6178 horizScrollbar -= getBordersSize(styles, "x"); 6179 vertScrollbar -= getBordersSize(styles, "y"); 6180 result.width -= horizScrollbar; 6181 result.height -= vertScrollbar; 6182 } 6183 return getClientRect(result); 6184 } 6185 function getOffsetRectRelativeToArbitraryNode(children, parent) { 6186 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 6187 var isIE10 = isIE(10); 6188 var isHTML = parent.nodeName === "HTML"; 6189 var childrenRect = getBoundingClientRect(children); 6190 var parentRect = getBoundingClientRect(parent); 6191 var scrollParent = getScrollParent(children); 6192 var styles = getStyleComputedProperty(parent); 6193 var borderTopWidth = parseFloat(styles.borderTopWidth); 6194 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 6195 if (fixedPosition && isHTML) { 6196 parentRect.top = Math.max(parentRect.top, 0); 6197 parentRect.left = Math.max(parentRect.left, 0); 6198 } 6199 var offsets = getClientRect({ 6200 top: childrenRect.top - parentRect.top - borderTopWidth, 6201 left: childrenRect.left - parentRect.left - borderLeftWidth, 6202 width: childrenRect.width, 6203 height: childrenRect.height 6204 }); 6205 offsets.marginTop = 0; 6206 offsets.marginLeft = 0; 6207 if (!isIE10 && isHTML) { 6208 var marginTop = parseFloat(styles.marginTop); 6209 var marginLeft = parseFloat(styles.marginLeft); 6210 offsets.top -= borderTopWidth - marginTop; 6211 offsets.bottom -= borderTopWidth - marginTop; 6212 offsets.left -= borderLeftWidth - marginLeft; 6213 offsets.right -= borderLeftWidth - marginLeft; 6214 offsets.marginTop = marginTop; 6215 offsets.marginLeft = marginLeft; 6216 } 6217 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== "BODY") { 6218 offsets = includeScroll(offsets, parent); 6219 } 6220 return offsets; 6221 } 6222 function getViewportOffsetRectRelativeToArtbitraryNode(element) { 6223 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 6224 var html = element.ownerDocument.documentElement; 6225 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 6226 var width = Math.max(html.clientWidth, window.innerWidth || 0); 6227 var height = Math.max(html.clientHeight, window.innerHeight || 0); 6228 var scrollTop = !excludeScroll ? getScroll(html) : 0; 6229 var scrollLeft = !excludeScroll ? getScroll(html, "left") : 0; 6230 var offset = { 6231 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 6232 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 6233 width, 6234 height 6235 }; 6236 return getClientRect(offset); 6237 } 6238 function isFixed(element) { 6239 var nodeName = element.nodeName; 6240 if (nodeName === "BODY" || nodeName === "HTML") { 6241 return false; 6242 } 6243 if (getStyleComputedProperty(element, "position") === "fixed") { 6244 return true; 6245 } 6246 var parentNode = getParentNode(element); 6247 if (!parentNode) { 6248 return false; 6249 } 6250 return isFixed(parentNode); 6251 } 6252 function getFixedPositionOffsetParent(element) { 6253 if (!element || !element.parentElement || isIE()) { 6254 return document.documentElement; 6255 } 6256 var el = element.parentElement; 6257 while (el && getStyleComputedProperty(el, "transform") === "none") { 6258 el = el.parentElement; 6259 } 6260 return el || document.documentElement; 6261 } 6262 function getBoundaries(popper, reference, padding, boundariesElement) { 6263 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 6264 var boundaries = { top: 0, left: 0 }; 6265 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 6266 if (boundariesElement === "viewport") { 6267 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 6268 } else { 6269 var boundariesNode = undefined; 6270 if (boundariesElement === "scrollParent") { 6271 boundariesNode = getScrollParent(getParentNode(reference)); 6272 if (boundariesNode.nodeName === "BODY") { 6273 boundariesNode = popper.ownerDocument.documentElement; 6274 } 6275 } else if (boundariesElement === "window") { 6276 boundariesNode = popper.ownerDocument.documentElement; 6277 } else { 6278 boundariesNode = boundariesElement; 6279 } 6280 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 6281 if (boundariesNode.nodeName === "HTML" && !isFixed(offsetParent)) { 6282 var _getWindowSizes = getWindowSizes(popper.ownerDocument), { height, width } = _getWindowSizes; 6283 boundaries.top += offsets.top - offsets.marginTop; 6284 boundaries.bottom = height + offsets.top; 6285 boundaries.left += offsets.left - offsets.marginLeft; 6286 boundaries.right = width + offsets.left; 6287 } else { 6288 boundaries = offsets; 6289 } 6290 } 6291 padding = padding || 0; 6292 var isPaddingNumber = typeof padding === "number"; 6293 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 6294 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 6295 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 6296 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 6297 return boundaries; 6298 } 6299 function getArea(_ref) { 6300 var { width, height } = _ref; 6301 return width * height; 6302 } 6303 function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 6304 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 6305 if (placement.indexOf("auto") === -1) { 6306 return placement; 6307 } 6308 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 6309 var rects = { 6310 top: { 6311 width: boundaries.width, 6312 height: refRect.top - boundaries.top 6313 }, 6314 right: { 6315 width: boundaries.right - refRect.right, 6316 height: boundaries.height 6317 }, 6318 bottom: { 6319 width: boundaries.width, 6320 height: boundaries.bottom - refRect.bottom 6321 }, 6322 left: { 6323 width: refRect.left - boundaries.left, 6324 height: boundaries.height 6325 } 6326 }; 6327 var sortedAreas = Object.keys(rects).map(function(key) { 6328 return _extends({ 6329 key 6330 }, rects[key], { 6331 area: getArea(rects[key]) 6332 }); 6333 }).sort(function(a, b) { 6334 return b.area - a.area; 6335 }); 6336 var filteredAreas = sortedAreas.filter(function(_ref2) { 6337 var { width, height } = _ref2; 6338 return width >= popper.clientWidth && height >= popper.clientHeight; 6339 }); 6340 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 6341 var variation = placement.split("-")[1]; 6342 return computedPlacement + (variation ? "-" + variation : ""); 6343 } 6344 function getReferenceOffsets(state, popper, reference) { 6345 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 6346 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 6347 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 6348 } 6349 function getOuterSizes(element) { 6350 var window2 = element.ownerDocument.defaultView; 6351 var styles = window2.getComputedStyle(element); 6352 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 6353 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 6354 var result = { 6355 width: element.offsetWidth + y, 6356 height: element.offsetHeight + x 6357 }; 6358 return result; 6359 } 6360 function getOppositePlacement(placement) { 6361 var hash = { left: "right", right: "left", bottom: "top", top: "bottom" }; 6362 return placement.replace(/left|right|bottom|top/g, function(matched) { 6363 return hash[matched]; 6364 }); 6365 } 6366 function getPopperOffsets(popper, referenceOffsets, placement) { 6367 placement = placement.split("-")[0]; 6368 var popperRect = getOuterSizes(popper); 6369 var popperOffsets = { 6370 width: popperRect.width, 6371 height: popperRect.height 6372 }; 6373 var isHoriz = ["right", "left"].indexOf(placement) !== -1; 6374 var mainSide = isHoriz ? "top" : "left"; 6375 var secondarySide = isHoriz ? "left" : "top"; 6376 var measurement = isHoriz ? "height" : "width"; 6377 var secondaryMeasurement = !isHoriz ? "height" : "width"; 6378 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 6379 if (placement === secondarySide) { 6380 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 6381 } else { 6382 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 6383 } 6384 return popperOffsets; 6385 } 6386 function find(arr, check) { 6387 if (Array.prototype.find) { 6388 return arr.find(check); 6389 } 6390 return arr.filter(check)[0]; 6391 } 6392 function findIndex(arr, prop, value) { 6393 if (Array.prototype.findIndex) { 6394 return arr.findIndex(function(cur) { 6395 return cur[prop] === value; 6396 }); 6397 } 6398 var match = find(arr, function(obj2) { 6399 return obj2[prop] === value; 6400 }); 6401 return arr.indexOf(match); 6402 } 6403 function runModifiers(modifiers, data, ends) { 6404 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, "name", ends)); 6405 modifiersToRun.forEach(function(modifier) { 6406 if (modifier["function"]) { 6407 console.warn("`modifier.function` is deprecated, use `modifier.fn`!"); 6408 } 6409 var fn2 = modifier["function"] || modifier.fn; 6410 if (modifier.enabled && isFunction(fn2)) { 6411 data.offsets.popper = getClientRect(data.offsets.popper); 6412 data.offsets.reference = getClientRect(data.offsets.reference); 6413 data = fn2(data, modifier); 6414 } 6415 }); 6416 return data; 6417 } 6418 function update() { 6419 if (this.state.isDestroyed) { 6420 return; 6421 } 6422 var data = { 6423 instance: this, 6424 styles: {}, 6425 arrowStyles: {}, 6426 attributes: {}, 6427 flipped: false, 6428 offsets: {} 6429 }; 6430 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 6431 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 6432 data.originalPlacement = data.placement; 6433 data.positionFixed = this.options.positionFixed; 6434 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 6435 data.offsets.popper.position = this.options.positionFixed ? "fixed" : "absolute"; 6436 data = runModifiers(this.modifiers, data); 6437 if (!this.state.isCreated) { 6438 this.state.isCreated = true; 6439 this.options.onCreate(data); 6440 } else { 6441 this.options.onUpdate(data); 6442 } 6443 } 6444 function isModifierEnabled(modifiers, modifierName) { 6445 return modifiers.some(function(_ref) { 6446 var { name, enabled } = _ref; 6447 return enabled && name === modifierName; 6448 }); 6449 } 6450 function getSupportedPropertyName(property) { 6451 var prefixes = [false, "ms", "Webkit", "Moz", "O"]; 6452 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 6453 for (var i = 0;i < prefixes.length; i++) { 6454 var prefix = prefixes[i]; 6455 var toCheck = prefix ? "" + prefix + upperProp : property; 6456 if (typeof document.body.style[toCheck] !== "undefined") { 6457 return toCheck; 6458 } 6459 } 6460 return null; 6461 } 6462 function destroy() { 6463 this.state.isDestroyed = true; 6464 if (isModifierEnabled(this.modifiers, "applyStyle")) { 6465 this.popper.removeAttribute("x-placement"); 6466 this.popper.style.position = ""; 6467 this.popper.style.top = ""; 6468 this.popper.style.left = ""; 6469 this.popper.style.right = ""; 6470 this.popper.style.bottom = ""; 6471 this.popper.style.willChange = ""; 6472 this.popper.style[getSupportedPropertyName("transform")] = ""; 6473 } 6474 this.disableEventListeners(); 6475 if (this.options.removeOnDestroy) { 6476 this.popper.parentNode.removeChild(this.popper); 6477 } 6478 return this; 6479 } 6480 function getWindow(element) { 6481 var ownerDocument = element.ownerDocument; 6482 return ownerDocument ? ownerDocument.defaultView : window; 6483 } 6484 function attachToScrollParents(scrollParent, event, callback, scrollParents) { 6485 var isBody = scrollParent.nodeName === "BODY"; 6486 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 6487 target.addEventListener(event, callback, { passive: true }); 6488 if (!isBody) { 6489 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 6490 } 6491 scrollParents.push(target); 6492 } 6493 function setupEventListeners(reference, options2, state, updateBound) { 6494 state.updateBound = updateBound; 6495 getWindow(reference).addEventListener("resize", state.updateBound, { passive: true }); 6496 var scrollElement = getScrollParent(reference); 6497 attachToScrollParents(scrollElement, "scroll", state.updateBound, state.scrollParents); 6498 state.scrollElement = scrollElement; 6499 state.eventsEnabled = true; 6500 return state; 6501 } 6502 function enableEventListeners() { 6503 if (!this.state.eventsEnabled) { 6504 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 6505 } 6506 } 6507 function removeEventListeners(reference, state) { 6508 getWindow(reference).removeEventListener("resize", state.updateBound); 6509 state.scrollParents.forEach(function(target) { 6510 target.removeEventListener("scroll", state.updateBound); 6511 }); 6512 state.updateBound = null; 6513 state.scrollParents = []; 6514 state.scrollElement = null; 6515 state.eventsEnabled = false; 6516 return state; 6517 } 6518 function disableEventListeners() { 6519 if (this.state.eventsEnabled) { 6520 cancelAnimationFrame(this.scheduleUpdate); 6521 this.state = removeEventListeners(this.reference, this.state); 6522 } 6523 } 6524 function isNumeric(n) { 6525 return n !== "" && !isNaN(parseFloat(n)) && isFinite(n); 6526 } 6527 function setStyles(element, styles) { 6528 Object.keys(styles).forEach(function(prop) { 6529 var unit = ""; 6530 if (["width", "height", "top", "right", "bottom", "left"].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 6531 unit = "px"; 6532 } 6533 element.style[prop] = styles[prop] + unit; 6534 }); 6535 } 6536 function setAttributes(element, attributes) { 6537 Object.keys(attributes).forEach(function(prop) { 6538 var value = attributes[prop]; 6539 if (value !== false) { 6540 element.setAttribute(prop, attributes[prop]); 6541 } else { 6542 element.removeAttribute(prop); 6543 } 6544 }); 6545 } 6546 function applyStyle(data) { 6547 setStyles(data.instance.popper, data.styles); 6548 setAttributes(data.instance.popper, data.attributes); 6549 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 6550 setStyles(data.arrowElement, data.arrowStyles); 6551 } 6552 return data; 6553 } 6554 function applyStyleOnLoad(reference, popper, options2, modifierOptions, state) { 6555 var referenceOffsets = getReferenceOffsets(state, popper, reference, options2.positionFixed); 6556 var placement = computeAutoPlacement(options2.placement, referenceOffsets, popper, reference, options2.modifiers.flip.boundariesElement, options2.modifiers.flip.padding); 6557 popper.setAttribute("x-placement", placement); 6558 setStyles(popper, { position: options2.positionFixed ? "fixed" : "absolute" }); 6559 return options2; 6560 } 6561 function getRoundedOffsets(data, shouldRound) { 6562 var _data$offsets = data.offsets, { popper, reference } = _data$offsets; 6563 var { round, floor } = Math; 6564 var noRound = function noRound(v) { 6565 return v; 6566 }; 6567 var referenceWidth = round(reference.width); 6568 var popperWidth = round(popper.width); 6569 var isVertical = ["left", "right"].indexOf(data.placement) !== -1; 6570 var isVariation = data.placement.indexOf("-") !== -1; 6571 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 6572 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 6573 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 6574 var verticalToInteger = !shouldRound ? noRound : round; 6575 return { 6576 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 6577 top: verticalToInteger(popper.top), 6578 bottom: verticalToInteger(popper.bottom), 6579 right: horizontalToInteger(popper.right) 6580 }; 6581 } 6582 var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 6583 function computeStyle(data, options2) { 6584 var { x, y } = options2; 6585 var popper = data.offsets.popper; 6586 var legacyGpuAccelerationOption = find(data.instance.modifiers, function(modifier) { 6587 return modifier.name === "applyStyle"; 6588 }).gpuAcceleration; 6589 if (legacyGpuAccelerationOption !== undefined) { 6590 console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!"); 6591 } 6592 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options2.gpuAcceleration; 6593 var offsetParent = getOffsetParent(data.instance.popper); 6594 var offsetParentRect = getBoundingClientRect(offsetParent); 6595 var styles = { 6596 position: popper.position 6597 }; 6598 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 6599 var sideA = x === "bottom" ? "top" : "bottom"; 6600 var sideB = y === "right" ? "left" : "right"; 6601 var prefixedProperty = getSupportedPropertyName("transform"); 6602 var left = undefined, top = undefined; 6603 if (sideA === "bottom") { 6604 if (offsetParent.nodeName === "HTML") { 6605 top = -offsetParent.clientHeight + offsets.bottom; 6606 } else { 6607 top = -offsetParentRect.height + offsets.bottom; 6608 } 6609 } else { 6610 top = offsets.top; 6611 } 6612 if (sideB === "right") { 6613 if (offsetParent.nodeName === "HTML") { 6614 left = -offsetParent.clientWidth + offsets.right; 6615 } else { 6616 left = -offsetParentRect.width + offsets.right; 6617 } 6618 } else { 6619 left = offsets.left; 6620 } 6621 if (gpuAcceleration && prefixedProperty) { 6622 styles[prefixedProperty] = "translate3d(" + left + "px, " + top + "px, 0)"; 6623 styles[sideA] = 0; 6624 styles[sideB] = 0; 6625 styles.willChange = "transform"; 6626 } else { 6627 var invertTop = sideA === "bottom" ? -1 : 1; 6628 var invertLeft = sideB === "right" ? -1 : 1; 6629 styles[sideA] = top * invertTop; 6630 styles[sideB] = left * invertLeft; 6631 styles.willChange = sideA + ", " + sideB; 6632 } 6633 var attributes = { 6634 "x-placement": data.placement 6635 }; 6636 data.attributes = _extends({}, attributes, data.attributes); 6637 data.styles = _extends({}, styles, data.styles); 6638 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 6639 return data; 6640 } 6641 function isModifierRequired(modifiers, requestingName, requestedName) { 6642 var requesting = find(modifiers, function(_ref) { 6643 var name = _ref.name; 6644 return name === requestingName; 6645 }); 6646 var isRequired = !!requesting && modifiers.some(function(modifier) { 6647 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 6648 }); 6649 if (!isRequired) { 6650 var _requesting = "`" + requestingName + "`"; 6651 var requested = "`" + requestedName + "`"; 6652 console.warn(requested + " modifier is required by " + _requesting + " modifier in order to work, be sure to include it before " + _requesting + "!"); 6653 } 6654 return isRequired; 6655 } 6656 function arrow(data, options2) { 6657 var _data$offsets$arrow; 6658 if (!isModifierRequired(data.instance.modifiers, "arrow", "keepTogether")) { 6659 return data; 6660 } 6661 var arrowElement = options2.element; 6662 if (typeof arrowElement === "string") { 6663 arrowElement = data.instance.popper.querySelector(arrowElement); 6664 if (!arrowElement) { 6665 return data; 6666 } 6667 } else { 6668 if (!data.instance.popper.contains(arrowElement)) { 6669 console.warn("WARNING: `arrow.element` must be child of its popper element!"); 6670 return data; 6671 } 6672 } 6673 var placement = data.placement.split("-")[0]; 6674 var _data$offsets = data.offsets, { popper, reference } = _data$offsets; 6675 var isVertical = ["left", "right"].indexOf(placement) !== -1; 6676 var len = isVertical ? "height" : "width"; 6677 var sideCapitalized = isVertical ? "Top" : "Left"; 6678 var side = sideCapitalized.toLowerCase(); 6679 var altSide = isVertical ? "left" : "top"; 6680 var opSide = isVertical ? "bottom" : "right"; 6681 var arrowElementSize = getOuterSizes(arrowElement)[len]; 6682 if (reference[opSide] - arrowElementSize < popper[side]) { 6683 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 6684 } 6685 if (reference[side] + arrowElementSize > popper[opSide]) { 6686 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 6687 } 6688 data.offsets.popper = getClientRect(data.offsets.popper); 6689 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 6690 var css2 = getStyleComputedProperty(data.instance.popper); 6691 var popperMarginSide = parseFloat(css2["margin" + sideCapitalized]); 6692 var popperBorderSide = parseFloat(css2["border" + sideCapitalized + "Width"]); 6693 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 6694 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 6695 data.arrowElement = arrowElement; 6696 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ""), _data$offsets$arrow); 6697 return data; 6698 } 6699 function getOppositeVariation(variation) { 6700 if (variation === "end") { 6701 return "start"; 6702 } else if (variation === "start") { 6703 return "end"; 6704 } 6705 return variation; 6706 } 6707 var placements = ["auto-start", "auto", "auto-end", "top-start", "top", "top-end", "right-start", "right", "right-end", "bottom-end", "bottom", "bottom-start", "left-end", "left", "left-start"]; 6708 var validPlacements = placements.slice(3); 6709 function clockwise(placement) { 6710 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 6711 var index = validPlacements.indexOf(placement); 6712 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 6713 return counter ? arr.reverse() : arr; 6714 } 6715 var BEHAVIORS = { 6716 FLIP: "flip", 6717 CLOCKWISE: "clockwise", 6718 COUNTERCLOCKWISE: "counterclockwise" 6719 }; 6720 function flip(data, options2) { 6721 if (isModifierEnabled(data.instance.modifiers, "inner")) { 6722 return data; 6723 } 6724 if (data.flipped && data.placement === data.originalPlacement) { 6725 return data; 6726 } 6727 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options2.padding, options2.boundariesElement, data.positionFixed); 6728 var placement = data.placement.split("-")[0]; 6729 var placementOpposite = getOppositePlacement(placement); 6730 var variation = data.placement.split("-")[1] || ""; 6731 var flipOrder = []; 6732 switch (options2.behavior) { 6733 case BEHAVIORS.FLIP: 6734 flipOrder = [placement, placementOpposite]; 6735 break; 6736 case BEHAVIORS.CLOCKWISE: 6737 flipOrder = clockwise(placement); 6738 break; 6739 case BEHAVIORS.COUNTERCLOCKWISE: 6740 flipOrder = clockwise(placement, true); 6741 break; 6742 default: 6743 flipOrder = options2.behavior; 6744 } 6745 flipOrder.forEach(function(step, index) { 6746 if (placement !== step || flipOrder.length === index + 1) { 6747 return data; 6748 } 6749 placement = data.placement.split("-")[0]; 6750 placementOpposite = getOppositePlacement(placement); 6751 var popperOffsets = data.offsets.popper; 6752 var refOffsets = data.offsets.reference; 6753 var floor = Math.floor; 6754 var overlapsRef = placement === "left" && floor(popperOffsets.right) > floor(refOffsets.left) || placement === "right" && floor(popperOffsets.left) < floor(refOffsets.right) || placement === "top" && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === "bottom" && floor(popperOffsets.top) < floor(refOffsets.bottom); 6755 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 6756 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 6757 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 6758 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 6759 var overflowsBoundaries = placement === "left" && overflowsLeft || placement === "right" && overflowsRight || placement === "top" && overflowsTop || placement === "bottom" && overflowsBottom; 6760 var isVertical = ["top", "bottom"].indexOf(placement) !== -1; 6761 var flippedVariationByRef = !!options2.flipVariations && (isVertical && variation === "start" && overflowsLeft || isVertical && variation === "end" && overflowsRight || !isVertical && variation === "start" && overflowsTop || !isVertical && variation === "end" && overflowsBottom); 6762 var flippedVariationByContent = !!options2.flipVariationsByContent && (isVertical && variation === "start" && overflowsRight || isVertical && variation === "end" && overflowsLeft || !isVertical && variation === "start" && overflowsBottom || !isVertical && variation === "end" && overflowsTop); 6763 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 6764 if (overlapsRef || overflowsBoundaries || flippedVariation) { 6765 data.flipped = true; 6766 if (overlapsRef || overflowsBoundaries) { 6767 placement = flipOrder[index + 1]; 6768 } 6769 if (flippedVariation) { 6770 variation = getOppositeVariation(variation); 6771 } 6772 data.placement = placement + (variation ? "-" + variation : ""); 6773 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 6774 data = runModifiers(data.instance.modifiers, data, "flip"); 6775 } 6776 }); 6777 return data; 6778 } 6779 function keepTogether(data) { 6780 var _data$offsets = data.offsets, { popper, reference } = _data$offsets; 6781 var placement = data.placement.split("-")[0]; 6782 var floor = Math.floor; 6783 var isVertical = ["top", "bottom"].indexOf(placement) !== -1; 6784 var side = isVertical ? "right" : "bottom"; 6785 var opSide = isVertical ? "left" : "top"; 6786 var measurement = isVertical ? "width" : "height"; 6787 if (popper[side] < floor(reference[opSide])) { 6788 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 6789 } 6790 if (popper[opSide] > floor(reference[side])) { 6791 data.offsets.popper[opSide] = floor(reference[side]); 6792 } 6793 return data; 6794 } 6795 function toValue(str, measurement, popperOffsets, referenceOffsets) { 6796 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 6797 var value = +split[1]; 6798 var unit = split[2]; 6799 if (!value) { 6800 return str; 6801 } 6802 if (unit.indexOf("%") === 0) { 6803 var element = undefined; 6804 switch (unit) { 6805 case "%p": 6806 element = popperOffsets; 6807 break; 6808 case "%": 6809 case "%r": 6810 default: 6811 element = referenceOffsets; 6812 } 6813 var rect = getClientRect(element); 6814 return rect[measurement] / 100 * value; 6815 } else if (unit === "vh" || unit === "vw") { 6816 var size = undefined; 6817 if (unit === "vh") { 6818 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 6819 } else { 6820 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 6821 } 6822 return size / 100 * value; 6823 } else { 6824 return value; 6825 } 6826 } 6827 function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 6828 var offsets = [0, 0]; 6829 var useHeight = ["right", "left"].indexOf(basePlacement) !== -1; 6830 var fragments = offset.split(/(\+|\-)/).map(function(frag) { 6831 return frag.trim(); 6832 }); 6833 var divider = fragments.indexOf(find(fragments, function(frag) { 6834 return frag.search(/,|\s/) !== -1; 6835 })); 6836 if (fragments[divider] && fragments[divider].indexOf(",") === -1) { 6837 console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead."); 6838 } 6839 var splitRegex = /\s*,\s*|\s+/; 6840 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 6841 ops = ops.map(function(op, index) { 6842 var measurement = (index === 1 ? !useHeight : useHeight) ? "height" : "width"; 6843 var mergeWithPrevious = false; 6844 return op.reduce(function(a, b) { 6845 if (a[a.length - 1] === "" && ["+", "-"].indexOf(b) !== -1) { 6846 a[a.length - 1] = b; 6847 mergeWithPrevious = true; 6848 return a; 6849 } else if (mergeWithPrevious) { 6850 a[a.length - 1] += b; 6851 mergeWithPrevious = false; 6852 return a; 6853 } else { 6854 return a.concat(b); 6855 } 6856 }, []).map(function(str) { 6857 return toValue(str, measurement, popperOffsets, referenceOffsets); 6858 }); 6859 }); 6860 ops.forEach(function(op, index) { 6861 op.forEach(function(frag, index2) { 6862 if (isNumeric(frag)) { 6863 offsets[index] += frag * (op[index2 - 1] === "-" ? -1 : 1); 6864 } 6865 }); 6866 }); 6867 return offsets; 6868 } 6869 function offset(data, _ref) { 6870 var offset = _ref.offset; 6871 var { placement, offsets: _data$offsets } = data, { popper, reference } = _data$offsets; 6872 var basePlacement = placement.split("-")[0]; 6873 var offsets = undefined; 6874 if (isNumeric(+offset)) { 6875 offsets = [+offset, 0]; 6876 } else { 6877 offsets = parseOffset(offset, popper, reference, basePlacement); 6878 } 6879 if (basePlacement === "left") { 6880 popper.top += offsets[0]; 6881 popper.left -= offsets[1]; 6882 } else if (basePlacement === "right") { 6883 popper.top += offsets[0]; 6884 popper.left += offsets[1]; 6885 } else if (basePlacement === "top") { 6886 popper.left += offsets[0]; 6887 popper.top -= offsets[1]; 6888 } else if (basePlacement === "bottom") { 6889 popper.left += offsets[0]; 6890 popper.top += offsets[1]; 6891 } 6892 data.popper = popper; 6893 return data; 6894 } 6895 function preventOverflow(data, options2) { 6896 var boundariesElement = options2.boundariesElement || getOffsetParent(data.instance.popper); 6897 if (data.instance.reference === boundariesElement) { 6898 boundariesElement = getOffsetParent(boundariesElement); 6899 } 6900 var transformProp = getSupportedPropertyName("transform"); 6901 var popperStyles = data.instance.popper.style; 6902 var { top, left } = popperStyles, transform = popperStyles[transformProp]; 6903 popperStyles.top = ""; 6904 popperStyles.left = ""; 6905 popperStyles[transformProp] = ""; 6906 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options2.padding, boundariesElement, data.positionFixed); 6907 popperStyles.top = top; 6908 popperStyles.left = left; 6909 popperStyles[transformProp] = transform; 6910 options2.boundaries = boundaries; 6911 var order = options2.priority; 6912 var popper = data.offsets.popper; 6913 var check = { 6914 primary: function primary(placement) { 6915 var value = popper[placement]; 6916 if (popper[placement] < boundaries[placement] && !options2.escapeWithReference) { 6917 value = Math.max(popper[placement], boundaries[placement]); 6918 } 6919 return defineProperty({}, placement, value); 6920 }, 6921 secondary: function secondary(placement) { 6922 var mainSide = placement === "right" ? "left" : "top"; 6923 var value = popper[mainSide]; 6924 if (popper[placement] > boundaries[placement] && !options2.escapeWithReference) { 6925 value = Math.min(popper[mainSide], boundaries[placement] - (placement === "right" ? popper.width : popper.height)); 6926 } 6927 return defineProperty({}, mainSide, value); 6928 } 6929 }; 6930 order.forEach(function(placement) { 6931 var side = ["left", "top"].indexOf(placement) !== -1 ? "primary" : "secondary"; 6932 popper = _extends({}, popper, check[side](placement)); 6933 }); 6934 data.offsets.popper = popper; 6935 return data; 6936 } 6937 function shift(data) { 6938 var placement = data.placement; 6939 var basePlacement = placement.split("-")[0]; 6940 var shiftvariation = placement.split("-")[1]; 6941 if (shiftvariation) { 6942 var _data$offsets = data.offsets, { reference, popper } = _data$offsets; 6943 var isVertical = ["bottom", "top"].indexOf(basePlacement) !== -1; 6944 var side = isVertical ? "left" : "top"; 6945 var measurement = isVertical ? "width" : "height"; 6946 var shiftOffsets = { 6947 start: defineProperty({}, side, reference[side]), 6948 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 6949 }; 6950 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 6951 } 6952 return data; 6953 } 6954 function hide(data) { 6955 if (!isModifierRequired(data.instance.modifiers, "hide", "preventOverflow")) { 6956 return data; 6957 } 6958 var refRect = data.offsets.reference; 6959 var bound = find(data.instance.modifiers, function(modifier) { 6960 return modifier.name === "preventOverflow"; 6961 }).boundaries; 6962 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 6963 if (data.hide === true) { 6964 return data; 6965 } 6966 data.hide = true; 6967 data.attributes["x-out-of-boundaries"] = ""; 6968 } else { 6969 if (data.hide === false) { 6970 return data; 6971 } 6972 data.hide = false; 6973 data.attributes["x-out-of-boundaries"] = false; 6974 } 6975 return data; 6976 } 6977 function inner(data) { 6978 var placement = data.placement; 6979 var basePlacement = placement.split("-")[0]; 6980 var _data$offsets = data.offsets, { popper, reference } = _data$offsets; 6981 var isHoriz = ["left", "right"].indexOf(basePlacement) !== -1; 6982 var subtractLength = ["top", "left"].indexOf(basePlacement) === -1; 6983 popper[isHoriz ? "left" : "top"] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? "width" : "height"] : 0); 6984 data.placement = getOppositePlacement(placement); 6985 data.offsets.popper = getClientRect(popper); 6986 return data; 6987 } 6988 var modifiers = { 6989 shift: { 6990 order: 100, 6991 enabled: true, 6992 fn: shift 6993 }, 6994 offset: { 6995 order: 200, 6996 enabled: true, 6997 fn: offset, 6998 offset: 0 6999 }, 7000 preventOverflow: { 7001 order: 300, 7002 enabled: true, 7003 fn: preventOverflow, 7004 priority: ["left", "right", "top", "bottom"], 7005 padding: 5, 7006 boundariesElement: "scrollParent" 7007 }, 7008 keepTogether: { 7009 order: 400, 7010 enabled: true, 7011 fn: keepTogether 7012 }, 7013 arrow: { 7014 order: 500, 7015 enabled: true, 7016 fn: arrow, 7017 element: "[x-arrow]" 7018 }, 7019 flip: { 7020 order: 600, 7021 enabled: true, 7022 fn: flip, 7023 behavior: "flip", 7024 padding: 5, 7025 boundariesElement: "viewport", 7026 flipVariations: false, 7027 flipVariationsByContent: false 7028 }, 7029 inner: { 7030 order: 700, 7031 enabled: false, 7032 fn: inner 7033 }, 7034 hide: { 7035 order: 800, 7036 enabled: true, 7037 fn: hide 7038 }, 7039 computeStyle: { 7040 order: 850, 7041 enabled: true, 7042 fn: computeStyle, 7043 gpuAcceleration: true, 7044 x: "bottom", 7045 y: "right" 7046 }, 7047 applyStyle: { 7048 order: 900, 7049 enabled: true, 7050 fn: applyStyle, 7051 onLoad: applyStyleOnLoad, 7052 gpuAcceleration: undefined 7053 } 7054 }; 7055 var Defaults = { 7056 placement: "bottom", 7057 positionFixed: false, 7058 eventsEnabled: true, 7059 removeOnDestroy: false, 7060 onCreate: function onCreate() {}, 7061 onUpdate: function onUpdate() {}, 7062 modifiers 7063 }; 7064 var Popper = function() { 7065 function Popper(reference, popper) { 7066 var _this = this; 7067 var options2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 7068 classCallCheck(this, Popper); 7069 this.scheduleUpdate = function() { 7070 return requestAnimationFrame(_this.update); 7071 }; 7072 this.update = debounce2(this.update.bind(this)); 7073 this.options = _extends({}, Popper.Defaults, options2); 7074 this.state = { 7075 isDestroyed: false, 7076 isCreated: false, 7077 scrollParents: [] 7078 }; 7079 this.reference = reference && reference.jquery ? reference[0] : reference; 7080 this.popper = popper && popper.jquery ? popper[0] : popper; 7081 this.options.modifiers = {}; 7082 Object.keys(_extends({}, Popper.Defaults.modifiers, options2.modifiers)).forEach(function(name) { 7083 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options2.modifiers ? options2.modifiers[name] : {}); 7084 }); 7085 this.modifiers = Object.keys(this.options.modifiers).map(function(name) { 7086 return _extends({ 7087 name 7088 }, _this.options.modifiers[name]); 7089 }).sort(function(a, b) { 7090 return a.order - b.order; 7091 }); 7092 this.modifiers.forEach(function(modifierOptions) { 7093 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 7094 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 7095 } 7096 }); 7097 this.update(); 7098 var eventsEnabled = this.options.eventsEnabled; 7099 if (eventsEnabled) { 7100 this.enableEventListeners(); 7101 } 7102 this.state.eventsEnabled = eventsEnabled; 7103 } 7104 createClass(Popper, [{ 7105 key: "update", 7106 value: function update$$1() { 7107 return update.call(this); 7108 } 7109 }, { 7110 key: "destroy", 7111 value: function destroy$$1() { 7112 return destroy.call(this); 7113 } 7114 }, { 7115 key: "enableEventListeners", 7116 value: function enableEventListeners$$1() { 7117 return enableEventListeners.call(this); 7118 } 7119 }, { 7120 key: "disableEventListeners", 7121 value: function disableEventListeners$$1() { 7122 return disableEventListeners.call(this); 7123 } 7124 }]); 7125 return Popper; 7126 }(); 7127 Popper.Utils = (typeof window !== "undefined" ? window : global).PopperUtils; 7128 Popper.placements = placements; 7129 Popper.Defaults = Defaults; 7130 return Popper; 7131 }); 7132}); 7133
vendor: 122,157 bytes, lines 7134-10370
7134// node_modules/bootstrap/dist/js/bootstrap.js 7135var require_bootstrap = __commonJS(function(exports2, module2) { 7136 /*! 7137 * Bootstrap v4.3.1 (https://getbootstrap.com/) 7138 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 7139 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7140 */ 7141 (function(global2, factory) { 7142 typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2, require_jquery(), require_popper()) : typeof define === "function" && define.amd ? define(["exports", "jquery", "popper.js"], factory) : (global2 = global2 || self, factory(global2.bootstrap = {}, global2.jQuery, global2.Popper)); 7143 })(exports2, function(exports3, $2, Popper) { 7144 $2 = $2 && $2.hasOwnProperty("default") ? $2["default"] : $2; 7145 Popper = Popper && Popper.hasOwnProperty("default") ? Popper["default"] : Popper; 7146 function _defineProperties(target, props) { 7147 for (var i = 0;i < props.length; i++) { 7148 var descriptor = props[i]; 7149 descriptor.enumerable = descriptor.enumerable || false; 7150 descriptor.configurable = true; 7151 if ("value" in descriptor) 7152 descriptor.writable = true; 7153 Object.defineProperty(target, descriptor.key, descriptor); 7154 } 7155 } 7156 function _createClass(Constructor, protoProps, staticProps) { 7157 if (protoProps) 7158 _defineProperties(Constructor.prototype, protoProps); 7159 if (staticProps) 7160 _defineProperties(Constructor, staticProps); 7161 return Constructor; 7162 } 7163 function _defineProperty(obj2, key, value) { 7164 if (key in obj2) { 7165 Object.defineProperty(obj2, key, { 7166 value, 7167 enumerable: true, 7168 configurable: true, 7169 writable: true 7170 }); 7171 } else { 7172 obj2[key] = value; 7173 } 7174 return obj2; 7175 } 7176 function _objectSpread(target) { 7177 for (var i = 1;i < arguments.length; i++) { 7178 var source = arguments[i] != null ? arguments[i] : {}; 7179 var ownKeys = Object.keys(source); 7180 if (typeof Object.getOwnPropertySymbols === "function") { 7181 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { 7182 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 7183 })); 7184 } 7185 ownKeys.forEach(function(key) { 7186 _defineProperty(target, key, source[key]); 7187 }); 7188 } 7189 return target; 7190 } 7191 function _inheritsLoose(subClass, superClass) { 7192 subClass.prototype = Object.create(superClass.prototype); 7193 subClass.prototype.constructor = subClass; 7194 subClass.__proto__ = superClass; 7195 } 7196 var TRANSITION_END = "transitionend"; 7197 var MAX_UID = 1e6; 7198 var MILLISECONDS_MULTIPLIER = 1000; 7199 function toType(obj2) { 7200 return {}.toString.call(obj2).match(/\s([a-z]+)/i)[1].toLowerCase(); 7201 } 7202 function getSpecialTransitionEndEvent() { 7203 return { 7204 bindType: TRANSITION_END, 7205 delegateType: TRANSITION_END, 7206 handle: function handle(event) { 7207 if ($2(event.target).is(this)) { 7208 return event.handleObj.handler.apply(this, arguments); 7209 } 7210 return; 7211 } 7212 }; 7213 } 7214 function transitionEndEmulator(duration) { 7215 var _this = this; 7216 var called = false; 7217 $2(this).one(Util.TRANSITION_END, function() { 7218 called = true; 7219 }); 7220 setTimeout(function() { 7221 if (!called) { 7222 Util.triggerTransitionEnd(_this); 7223 } 7224 }, duration); 7225 return this; 7226 } 7227 function setTransitionEndSupport() { 7228 $2.fn.emulateTransitionEnd = transitionEndEmulator; 7229 $2.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 7230 } 7231 var Util = { 7232 TRANSITION_END: "bsTransitionEnd", 7233 getUID: function getUID(prefix) { 7234 do { 7235 prefix += ~~(Math.random() * MAX_UID); 7236 } while (document.getElementById(prefix)); 7237 return prefix; 7238 }, 7239 getSelectorFromElement: function getSelectorFromElement(element) { 7240 var selector = element.getAttribute("data-target"); 7241 if (!selector || selector === "#") { 7242 var hrefAttr = element.getAttribute("href"); 7243 selector = hrefAttr && hrefAttr !== "#" ? hrefAttr.trim() : ""; 7244 } 7245 try { 7246 return document.querySelector(selector) ? selector : null; 7247 } catch (err) { 7248 return null; 7249 } 7250 }, 7251 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 7252 if (!element) { 7253 return 0; 7254 } 7255 var transitionDuration = $2(element).css("transition-duration"); 7256 var transitionDelay = $2(element).css("transition-delay"); 7257 var floatTransitionDuration = parseFloat(transitionDuration); 7258 var floatTransitionDelay = parseFloat(transitionDelay); 7259 if (!floatTransitionDuration && !floatTransitionDelay) { 7260 return 0; 7261 } 7262 transitionDuration = transitionDuration.split(",")[0]; 7263 transitionDelay = transitionDelay.split(",")[0]; 7264 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 7265 }, 7266 reflow: function reflow(element) { 7267 return element.offsetHeight; 7268 }, 7269 triggerTransitionEnd: function triggerTransitionEnd(element) { 7270 $2(element).trigger(TRANSITION_END); 7271 }, 7272 supportsTransitionEnd: function supportsTransitionEnd() { 7273 return Boolean(TRANSITION_END); 7274 }, 7275 isElement: function isElement(obj2) { 7276 return (obj2[0] || obj2).nodeType; 7277 }, 7278 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 7279 for (var property in configTypes) { 7280 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 7281 var expectedTypes = configTypes[property]; 7282 var value = config[property]; 7283 var valueType = value && Util.isElement(value) ? "element" : toType(value); 7284 if (!new RegExp(expectedTypes).test(valueType)) { 7285 throw new Error(componentName.toUpperCase() + ": " + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); 7286 } 7287 } 7288 } 7289 }, 7290 findShadowRoot: function findShadowRoot(element) { 7291 if (!document.documentElement.attachShadow) { 7292 return null; 7293 } 7294 if (typeof element.getRootNode === "function") { 7295 var root2 = element.getRootNode(); 7296 return root2 instanceof ShadowRoot ? root2 : null; 7297 } 7298 if (element instanceof ShadowRoot) { 7299 return element; 7300 } 7301 if (!element.parentNode) { 7302 return null; 7303 } 7304 return Util.findShadowRoot(element.parentNode); 7305 } 7306 }; 7307 setTransitionEndSupport(); 7308 var NAME = "alert"; 7309 var VERSION = "4.3.1"; 7310 var DATA_KEY = "bs.alert"; 7311 var EVENT_KEY = "." + DATA_KEY; 7312 var DATA_API_KEY = ".data-api"; 7313 var JQUERY_NO_CONFLICT = $2.fn[NAME]; 7314 var Selector = { 7315 DISMISS: '[data-dismiss="alert"]' 7316 }; 7317 var Event2 = { 7318 CLOSE: "close" + EVENT_KEY, 7319 CLOSED: "closed" + EVENT_KEY, 7320 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 7321 }; 7322 var ClassName = { 7323 ALERT: "alert", 7324 FADE: "fade", 7325 SHOW: "show" 7326 }; 7327 var Alert = /* @__PURE__ */ function() { 7328 function Alert(element) { 7329 this._element = element; 7330 } 7331 var _proto = Alert.prototype; 7332 _proto.close = function close(element) { 7333 var rootElement = this._element; 7334 if (element) { 7335 rootElement = this._getRootElement(element); 7336 } 7337 var customEvent = this._triggerCloseEvent(rootElement); 7338 if (customEvent.isDefaultPrevented()) { 7339 return; 7340 } 7341 this._removeElement(rootElement); 7342 }; 7343 _proto.dispose = function dispose() { 7344 $2.removeData(this._element, DATA_KEY); 7345 this._element = null; 7346 }; 7347 _proto._getRootElement = function _getRootElement(element) { 7348 var selector = Util.getSelectorFromElement(element); 7349 var parent = false; 7350 if (selector) { 7351 parent = document.querySelector(selector); 7352 } 7353 if (!parent) { 7354 parent = $2(element).closest("." + ClassName.ALERT)[0]; 7355 } 7356 return parent; 7357 }; 7358 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 7359 var closeEvent = $2.Event(Event2.CLOSE); 7360 $2(element).trigger(closeEvent); 7361 return closeEvent; 7362 }; 7363 _proto._removeElement = function _removeElement(element) { 7364 var _this = this; 7365 $2(element).removeClass(ClassName.SHOW); 7366 if (!$2(element).hasClass(ClassName.FADE)) { 7367 this._destroyElement(element); 7368 return; 7369 } 7370 var transitionDuration = Util.getTransitionDurationFromElement(element); 7371 $2(element).one(Util.TRANSITION_END, function(event) { 7372 return _this._destroyElement(element, event); 7373 }).emulateTransitionEnd(transitionDuration); 7374 }; 7375 _proto._destroyElement = function _destroyElement(element) { 7376 $2(element).detach().trigger(Event2.CLOSED).remove(); 7377 }; 7378 Alert._jQueryInterface = function _jQueryInterface(config) { 7379 return this.each(function() { 7380 var $element = $2(this); 7381 var data = $element.data(DATA_KEY); 7382 if (!data) { 7383 data = new Alert(this); 7384 $element.data(DATA_KEY, data); 7385 } 7386 if (config === "close") { 7387 data[config](this); 7388 } 7389 }); 7390 }; 7391 Alert._handleDismiss = function _handleDismiss(alertInstance) { 7392 return function(event) { 7393 if (event) { 7394 event.preventDefault(); 7395 } 7396 alertInstance.close(this); 7397 }; 7398 }; 7399 _createClass(Alert, null, [{ 7400 key: "VERSION", 7401 get: function get() { 7402 return VERSION; 7403 } 7404 }]); 7405 return Alert; 7406 }(); 7407 $2(document).on(Event2.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert)); 7408 $2.fn[NAME] = Alert._jQueryInterface; 7409 $2.fn[NAME].Constructor = Alert; 7410 $2.fn[NAME].noConflict = function() { 7411 $2.fn[NAME] = JQUERY_NO_CONFLICT; 7412 return Alert._jQueryInterface; 7413 }; 7414 var NAME$1 = "button"; 7415 var VERSION$1 = "4.3.1"; 7416 var DATA_KEY$1 = "bs.button"; 7417 var EVENT_KEY$1 = "." + DATA_KEY$1; 7418 var DATA_API_KEY$1 = ".data-api"; 7419 var JQUERY_NO_CONFLICT$1 = $2.fn[NAME$1]; 7420 var ClassName$1 = { 7421 ACTIVE: "active", 7422 BUTTON: "btn", 7423 FOCUS: "focus" 7424 }; 7425 var Selector$1 = { 7426 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 7427 DATA_TOGGLE: '[data-toggle="buttons"]', 7428 INPUT: 'input:not([type="hidden"])', 7429 ACTIVE: ".active", 7430 BUTTON: ".btn" 7431 }; 7432 var Event$1 = { 7433 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 7434 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1) 7435 }; 7436 var Button = /* @__PURE__ */ function() { 7437 function Button(element) { 7438 this._element = element; 7439 } 7440 var _proto = Button.prototype; 7441 _proto.toggle = function toggle() { 7442 var triggerChangeEvent = true; 7443 var addAriaPressed = true; 7444 var rootElement = $2(this._element).closest(Selector$1.DATA_TOGGLE)[0]; 7445 if (rootElement) { 7446 var input = this._element.querySelector(Selector$1.INPUT); 7447 if (input) { 7448 if (input.type === "radio") { 7449 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 7450 triggerChangeEvent = false; 7451 } else { 7452 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 7453 if (activeElement) { 7454 $2(activeElement).removeClass(ClassName$1.ACTIVE); 7455 } 7456 } 7457 } 7458 if (triggerChangeEvent) { 7459 if (input.hasAttribute("disabled") || rootElement.hasAttribute("disabled") || input.classList.contains("disabled") || rootElement.classList.contains("disabled")) { 7460 return; 7461 } 7462 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 7463 $2(input).trigger("change"); 7464 } 7465 input.focus(); 7466 addAriaPressed = false; 7467 } 7468 } 7469 if (addAriaPressed) { 7470 this._element.setAttribute("aria-pressed", !this._element.classList.contains(ClassName$1.ACTIVE)); 7471 } 7472 if (triggerChangeEvent) { 7473 $2(this._element).toggleClass(ClassName$1.ACTIVE); 7474 } 7475 }; 7476 _proto.dispose = function dispose() { 7477 $2.removeData(this._element, DATA_KEY$1); 7478 this._element = null; 7479 }; 7480 Button._jQueryInterface = function _jQueryInterface(config) { 7481 return this.each(function() { 7482 var data = $2(this).data(DATA_KEY$1); 7483 if (!data) { 7484 data = new Button(this); 7485 $2(this).data(DATA_KEY$1, data); 7486 } 7487 if (config === "toggle") { 7488 data[config](); 7489 } 7490 }); 7491 }; 7492 _createClass(Button, null, [{ 7493 key: "VERSION", 7494 get: function get() { 7495 return VERSION$1; 7496 } 7497 }]); 7498 return Button; 7499 }(); 7500 $2(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function(event) { 7501 event.preventDefault(); 7502 var button = event.target; 7503 if (!$2(button).hasClass(ClassName$1.BUTTON)) { 7504 button = $2(button).closest(Selector$1.BUTTON); 7505 } 7506 Button._jQueryInterface.call($2(button), "toggle"); 7507 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function(event) { 7508 var button = $2(event.target).closest(Selector$1.BUTTON)[0]; 7509 $2(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 7510 }); 7511 $2.fn[NAME$1] = Button._jQueryInterface; 7512 $2.fn[NAME$1].Constructor = Button; 7513 $2.fn[NAME$1].noConflict = function() { 7514 $2.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 7515 return Button._jQueryInterface; 7516 }; 7517 var NAME$2 = "carousel"; 7518 var VERSION$2 = "4.3.1"; 7519 var DATA_KEY$2 = "bs.carousel"; 7520 var EVENT_KEY$2 = "." + DATA_KEY$2; 7521 var DATA_API_KEY$2 = ".data-api"; 7522 var JQUERY_NO_CONFLICT$2 = $2.fn[NAME$2]; 7523 var ARROW_LEFT_KEYCODE = 37; 7524 var ARROW_RIGHT_KEYCODE = 39; 7525 var TOUCHEVENT_COMPAT_WAIT = 500; 7526 var SWIPE_THRESHOLD = 40; 7527 var Default = { 7528 interval: 5000, 7529 keyboard: true, 7530 slide: false, 7531 pause: "hover", 7532 wrap: true, 7533 touch: true 7534 }; 7535 var DefaultType = { 7536 interval: "(number|boolean)", 7537 keyboard: "boolean", 7538 slide: "(boolean|string)", 7539 pause: "(string|boolean)", 7540 wrap: "boolean", 7541 touch: "boolean" 7542 }; 7543 var Direction = { 7544 NEXT: "next", 7545 PREV: "prev", 7546 LEFT: "left", 7547 RIGHT: "right" 7548 }; 7549 var Event$2 = { 7550 SLIDE: "slide" + EVENT_KEY$2, 7551 SLID: "slid" + EVENT_KEY$2, 7552 KEYDOWN: "keydown" + EVENT_KEY$2, 7553 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 7554 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 7555 TOUCHSTART: "touchstart" + EVENT_KEY$2, 7556 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 7557 TOUCHEND: "touchend" + EVENT_KEY$2, 7558 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 7559 POINTERUP: "pointerup" + EVENT_KEY$2, 7560 DRAG_START: "dragstart" + EVENT_KEY$2, 7561 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 7562 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 7563 }; 7564 var ClassName$2 = { 7565 CAROUSEL: "carousel", 7566 ACTIVE: "active", 7567 SLIDE: "slide", 7568 RIGHT: "carousel-item-right", 7569 LEFT: "carousel-item-left", 7570 NEXT: "carousel-item-next", 7571 PREV: "carousel-item-prev", 7572 ITEM: "carousel-item", 7573 POINTER_EVENT: "pointer-event" 7574 }; 7575 var Selector$2 = { 7576 ACTIVE: ".active", 7577 ACTIVE_ITEM: ".active.carousel-item", 7578 ITEM: ".carousel-item", 7579 ITEM_IMG: ".carousel-item img", 7580 NEXT_PREV: ".carousel-item-next, .carousel-item-prev", 7581 INDICATORS: ".carousel-indicators", 7582 DATA_SLIDE: "[data-slide], [data-slide-to]", 7583 DATA_RIDE: '[data-ride="carousel"]' 7584 }; 7585 var PointerType = { 7586 TOUCH: "touch", 7587 PEN: "pen" 7588 }; 7589 var Carousel = /* @__PURE__ */ function() { 7590 function Carousel(element, config) { 7591 this._items = null; 7592 this._interval = null; 7593 this._activeElement = null; 7594 this._isPaused = false; 7595 this._isSliding = false; 7596 this.touchTimeout = null; 7597 this.touchStartX = 0; 7598 this.touchDeltaX = 0; 7599 this._config = this._getConfig(config); 7600 this._element = element; 7601 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 7602 this._touchSupported = "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0; 7603 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 7604 this._addEventListeners(); 7605 } 7606 var _proto = Carousel.prototype; 7607 _proto.next = function next() { 7608 if (!this._isSliding) { 7609 this._slide(Direction.NEXT); 7610 } 7611 }; 7612 _proto.nextWhenVisible = function nextWhenVisible() { 7613 if (!document.hidden && $2(this._element).is(":visible") && $2(this._element).css("visibility") !== "hidden") { 7614 this.next(); 7615 } 7616 }; 7617 _proto.prev = function prev() { 7618 if (!this._isSliding) { 7619 this._slide(Direction.PREV); 7620 } 7621 }; 7622 _proto.pause = function pause(event) { 7623 if (!event) { 7624 this._isPaused = true; 7625 } 7626 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 7627 Util.triggerTransitionEnd(this._element); 7628 this.cycle(true); 7629 } 7630 clearInterval(this._interval); 7631 this._interval = null; 7632 }; 7633 _proto.cycle = function cycle(event) { 7634 if (!event) { 7635 this._isPaused = false; 7636 } 7637 if (this._interval) { 7638 clearInterval(this._interval); 7639 this._interval = null; 7640 } 7641 if (this._config.interval && !this._isPaused) { 7642 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 7643 } 7644 }; 7645 _proto.to = function to(index) { 7646 var _this = this; 7647 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 7648 var activeIndex = this._getItemIndex(this._activeElement); 7649 if (index > this._items.length - 1 || index < 0) { 7650 return; 7651 } 7652 if (this._isSliding) { 7653 $2(this._element).one(Event$2.SLID, function() { 7654 return _this.to(index); 7655 }); 7656 return; 7657 } 7658 if (activeIndex === index) { 7659 this.pause(); 7660 this.cycle(); 7661 return; 7662 } 7663 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 7664 this._slide(direction, this._items[index]); 7665 }; 7666 _proto.dispose = function dispose() { 7667 $2(this._element).off(EVENT_KEY$2); 7668 $2.removeData(this._element, DATA_KEY$2); 7669 this._items = null; 7670 this._config = null; 7671 this._element = null; 7672 this._interval = null; 7673 this._isPaused = null; 7674 this._isSliding = null; 7675 this._activeElement = null; 7676 this._indicatorsElement = null; 7677 }; 7678 _proto._getConfig = function _getConfig(config) { 7679 config = _objectSpread({}, Default, config); 7680 Util.typeCheckConfig(NAME$2, config, DefaultType); 7681 return config; 7682 }; 7683 _proto._handleSwipe = function _handleSwipe() { 7684 var absDeltax = Math.abs(this.touchDeltaX); 7685 if (absDeltax <= SWIPE_THRESHOLD) { 7686 return; 7687 } 7688 var direction = absDeltax / this.touchDeltaX; 7689 if (direction > 0) { 7690 this.prev(); 7691 } 7692 if (direction < 0) { 7693 this.next(); 7694 } 7695 }; 7696 _proto._addEventListeners = function _addEventListeners() { 7697 var _this2 = this; 7698 if (this._config.keyboard) { 7699 $2(this._element).on(Event$2.KEYDOWN, function(event) { 7700 return _this2._keydown(event); 7701 }); 7702 } 7703 if (this._config.pause === "hover") { 7704 $2(this._element).on(Event$2.MOUSEENTER, function(event) { 7705 return _this2.pause(event); 7706 }).on(Event$2.MOUSELEAVE, function(event) { 7707 return _this2.cycle(event); 7708 }); 7709 } 7710 if (this._config.touch) { 7711 this._addTouchEventListeners(); 7712 } 7713 }; 7714 _proto._addTouchEventListeners = function _addTouchEventListeners() { 7715 var _this3 = this; 7716 if (!this._touchSupported) { 7717 return; 7718 } 7719 var start = function start(event) { 7720 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 7721 _this3.touchStartX = event.originalEvent.clientX; 7722 } else if (!_this3._pointerEvent) { 7723 _this3.touchStartX = event.originalEvent.touches[0].clientX; 7724 } 7725 }; 7726 var move = function move(event) { 7727 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 7728 _this3.touchDeltaX = 0; 7729 } else { 7730 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 7731 } 7732 }; 7733 var end = function end(event) { 7734 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 7735 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 7736 } 7737 _this3._handleSwipe(); 7738 if (_this3._config.pause === "hover") { 7739 _this3.pause(); 7740 if (_this3.touchTimeout) { 7741 clearTimeout(_this3.touchTimeout); 7742 } 7743 _this3.touchTimeout = setTimeout(function(event) { 7744 return _this3.cycle(event); 7745 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 7746 } 7747 }; 7748 $2(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function(e) { 7749 return e.preventDefault(); 7750 }); 7751 if (this._pointerEvent) { 7752 $2(this._element).on(Event$2.POINTERDOWN, function(event) { 7753 return start(event); 7754 }); 7755 $2(this._element).on(Event$2.POINTERUP, function(event) { 7756 return end(event); 7757 }); 7758 this._element.classList.add(ClassName$2.POINTER_EVENT); 7759 } else { 7760 $2(this._element).on(Event$2.TOUCHSTART, function(event) { 7761 return start(event); 7762 }); 7763 $2(this._element).on(Event$2.TOUCHMOVE, function(event) { 7764 return move(event); 7765 }); 7766 $2(this._element).on(Event$2.TOUCHEND, function(event) { 7767 return end(event); 7768 }); 7769 } 7770 }; 7771 _proto._keydown = function _keydown(event) { 7772 if (/input|textarea/i.test(event.target.tagName)) { 7773 return; 7774 } 7775 switch (event.which) { 7776 case ARROW_LEFT_KEYCODE: 7777 event.preventDefault(); 7778 this.prev(); 7779 break; 7780 case ARROW_RIGHT_KEYCODE: 7781 event.preventDefault(); 7782 this.next(); 7783 break; 7784 default: 7785 } 7786 }; 7787 _proto._getItemIndex = function _getItemIndex(element) { 7788 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 7789 return this._items.indexOf(element); 7790 }; 7791 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 7792 var isNextDirection = direction === Direction.NEXT; 7793 var isPrevDirection = direction === Direction.PREV; 7794 var activeIndex = this._getItemIndex(activeElement); 7795 var lastItemIndex = this._items.length - 1; 7796 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 7797 if (isGoingToWrap && !this._config.wrap) { 7798 return activeElement; 7799 } 7800 var delta = direction === Direction.PREV ? -1 : 1; 7801 var itemIndex = (activeIndex + delta) % this._items.length; 7802 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 7803 }; 7804 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 7805 var targetIndex = this._getItemIndex(relatedTarget); 7806 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 7807 var slideEvent = $2.Event(Event$2.SLIDE, { 7808 relatedTarget, 7809 direction: eventDirectionName, 7810 from: fromIndex, 7811 to: targetIndex 7812 }); 7813 $2(this._element).trigger(slideEvent); 7814 return slideEvent; 7815 }; 7816 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 7817 if (this._indicatorsElement) { 7818 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 7819 $2(indicators).removeClass(ClassName$2.ACTIVE); 7820 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 7821 if (nextIndicator) { 7822 $2(nextIndicator).addClass(ClassName$2.ACTIVE); 7823 } 7824 } 7825 }; 7826 _proto._slide = function _slide(direction, element) { 7827 var _this4 = this; 7828 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 7829 var activeElementIndex = this._getItemIndex(activeElement); 7830 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 7831 var nextElementIndex = this._getItemIndex(nextElement); 7832 var isCycling = Boolean(this._interval); 7833 var directionalClassName; 7834 var orderClassName; 7835 var eventDirectionName; 7836 if (direction === Direction.NEXT) { 7837 directionalClassName = ClassName$2.LEFT; 7838 orderClassName = ClassName$2.NEXT; 7839 eventDirectionName = Direction.LEFT; 7840 } else { 7841 directionalClassName = ClassName$2.RIGHT; 7842 orderClassName = ClassName$2.PREV; 7843 eventDirectionName = Direction.RIGHT; 7844 } 7845 if (nextElement && $2(nextElement).hasClass(ClassName$2.ACTIVE)) { 7846 this._isSliding = false; 7847 return; 7848 } 7849 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 7850 if (slideEvent.isDefaultPrevented()) { 7851 return; 7852 } 7853 if (!activeElement || !nextElement) { 7854 return; 7855 } 7856 this._isSliding = true; 7857 if (isCycling) { 7858 this.pause(); 7859 } 7860 this._setActiveIndicatorElement(nextElement); 7861 var slidEvent = $2.Event(Event$2.SLID, { 7862 relatedTarget: nextElement, 7863 direction: eventDirectionName, 7864 from: activeElementIndex, 7865 to: nextElementIndex 7866 }); 7867 if ($2(this._element).hasClass(ClassName$2.SLIDE)) { 7868 $2(nextElement).addClass(orderClassName); 7869 Util.reflow(nextElement); 7870 $2(activeElement).addClass(directionalClassName); 7871 $2(nextElement).addClass(directionalClassName); 7872 var nextElementInterval = parseInt(nextElement.getAttribute("data-interval"), 10); 7873 if (nextElementInterval) { 7874 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 7875 this._config.interval = nextElementInterval; 7876 } else { 7877 this._config.interval = this._config.defaultInterval || this._config.interval; 7878 } 7879 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 7880 $2(activeElement).one(Util.TRANSITION_END, function() { 7881 $2(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 7882 $2(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 7883 _this4._isSliding = false; 7884 setTimeout(function() { 7885 return $2(_this4._element).trigger(slidEvent); 7886 }, 0); 7887 }).emulateTransitionEnd(transitionDuration); 7888 } else { 7889 $2(activeElement).removeClass(ClassName$2.ACTIVE); 7890 $2(nextElement).addClass(ClassName$2.ACTIVE); 7891 this._isSliding = false; 7892 $2(this._element).trigger(slidEvent); 7893 } 7894 if (isCycling) { 7895 this.cycle(); 7896 } 7897 }; 7898 Carousel._jQueryInterface = function _jQueryInterface(config) { 7899 return this.each(function() { 7900 var data = $2(this).data(DATA_KEY$2); 7901 var _config = _objectSpread({}, Default, $2(this).data()); 7902 if (typeof config === "object") { 7903 _config = _objectSpread({}, _config, config); 7904 } 7905 var action = typeof config === "string" ? config : _config.slide; 7906 if (!data) { 7907 data = new Carousel(this, _config); 7908 $2(this).data(DATA_KEY$2, data); 7909 } 7910 if (typeof config === "number") { 7911 data.to(config); 7912 } else if (typeof action === "string") { 7913 if (typeof data[action] === "undefined") { 7914 throw new TypeError('No method named "' + action + '"'); 7915 } 7916 data[action](); 7917 } else if (_config.interval && _config.ride) { 7918 data.pause(); 7919 data.cycle(); 7920 } 7921 }); 7922 }; 7923 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 7924 var selector = Util.getSelectorFromElement(this); 7925 if (!selector) { 7926 return; 7927 } 7928 var target = $2(selector)[0]; 7929 if (!target || !$2(target).hasClass(ClassName$2.CAROUSEL)) { 7930 return; 7931 } 7932 var config = _objectSpread({}, $2(target).data(), $2(this).data()); 7933 var slideIndex = this.getAttribute("data-slide-to"); 7934 if (slideIndex) { 7935 config.interval = false; 7936 } 7937 Carousel._jQueryInterface.call($2(target), config); 7938 if (slideIndex) { 7939 $2(target).data(DATA_KEY$2).to(slideIndex); 7940 } 7941 event.preventDefault(); 7942 }; 7943 _createClass(Carousel, null, [{ 7944 key: "VERSION", 7945 get: function get() { 7946 return VERSION$2; 7947 } 7948 }, { 7949 key: "Default", 7950 get: function get() { 7951 return Default; 7952 } 7953 }]); 7954 return Carousel; 7955 }(); 7956 $2(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 7957 $2(window).on(Event$2.LOAD_DATA_API, function() { 7958 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 7959 for (var i = 0, len = carousels.length;i < len; i++) { 7960 var $carousel = $2(carousels[i]); 7961 Carousel._jQueryInterface.call($carousel, $carousel.data()); 7962 } 7963 }); 7964 $2.fn[NAME$2] = Carousel._jQueryInterface; 7965 $2.fn[NAME$2].Constructor = Carousel; 7966 $2.fn[NAME$2].noConflict = function() { 7967 $2.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 7968 return Carousel._jQueryInterface; 7969 }; 7970 var NAME$3 = "collapse"; 7971 var VERSION$3 = "4.3.1"; 7972 var DATA_KEY$3 = "bs.collapse"; 7973 var EVENT_KEY$3 = "." + DATA_KEY$3; 7974 var DATA_API_KEY$3 = ".data-api"; 7975 var JQUERY_NO_CONFLICT$3 = $2.fn[NAME$3]; 7976 var Default$1 = { 7977 toggle: true, 7978 parent: "" 7979 }; 7980 var DefaultType$1 = { 7981 toggle: "boolean", 7982 parent: "(string|element)" 7983 }; 7984 var Event$3 = { 7985 SHOW: "show" + EVENT_KEY$3, 7986 SHOWN: "shown" + EVENT_KEY$3, 7987 HIDE: "hide" + EVENT_KEY$3, 7988 HIDDEN: "hidden" + EVENT_KEY$3, 7989 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 7990 }; 7991 var ClassName$3 = { 7992 SHOW: "show", 7993 COLLAPSE: "collapse", 7994 COLLAPSING: "collapsing", 7995 COLLAPSED: "collapsed" 7996 }; 7997 var Dimension = { 7998 WIDTH: "width", 7999 HEIGHT: "height" 8000 }; 8001 var Selector$3 = { 8002 ACTIVES: ".show, .collapsing", 8003 DATA_TOGGLE: '[data-toggle="collapse"]' 8004 }; 8005 var Collapse = /* @__PURE__ */ function() { 8006 function Collapse(element, config) { 8007 this._isTransitioning = false; 8008 this._element = element; 8009 this._config = this._getConfig(config); 8010 this._triggerArray = [].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]'))); 8011 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 8012 for (var i = 0, len = toggleList.length;i < len; i++) { 8013 var elem = toggleList[i]; 8014 var selector = Util.getSelectorFromElement(elem); 8015 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function(foundElem) { 8016 return foundElem === element; 8017 }); 8018 if (selector !== null && filterElement.length > 0) { 8019 this._selector = selector; 8020 this._triggerArray.push(elem); 8021 } 8022 } 8023 this._parent = this._config.parent ? this._getParent() : null; 8024 if (!this._config.parent) { 8025 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 8026 } 8027 if (this._config.toggle) { 8028 this.toggle(); 8029 } 8030 } 8031 var _proto = Collapse.prototype; 8032 _proto.toggle = function toggle() { 8033 if ($2(this._element).hasClass(ClassName$3.SHOW)) { 8034 this.hide(); 8035 } else { 8036 this.show(); 8037 } 8038 }; 8039 _proto.show = function show() { 8040 var _this = this; 8041 if (this._isTransitioning || $2(this._element).hasClass(ClassName$3.SHOW)) { 8042 return; 8043 } 8044 var actives; 8045 var activesData; 8046 if (this._parent) { 8047 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function(elem) { 8048 if (typeof _this._config.parent === "string") { 8049 return elem.getAttribute("data-parent") === _this._config.parent; 8050 } 8051 return elem.classList.contains(ClassName$3.COLLAPSE); 8052 }); 8053 if (actives.length === 0) { 8054 actives = null; 8055 } 8056 } 8057 if (actives) { 8058 activesData = $2(actives).not(this._selector).data(DATA_KEY$3); 8059 if (activesData && activesData._isTransitioning) { 8060 return; 8061 } 8062 } 8063 var startEvent = $2.Event(Event$3.SHOW); 8064 $2(this._element).trigger(startEvent); 8065 if (startEvent.isDefaultPrevented()) { 8066 return; 8067 } 8068 if (actives) { 8069 Collapse._jQueryInterface.call($2(actives).not(this._selector), "hide"); 8070 if (!activesData) { 8071 $2(actives).data(DATA_KEY$3, null); 8072 } 8073 } 8074 var dimension = this._getDimension(); 8075 $2(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 8076 this._element.style[dimension] = 0; 8077 if (this._triggerArray.length) { 8078 $2(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr("aria-expanded", true); 8079 } 8080 this.setTransitioning(true); 8081 var complete = function complete() { 8082 $2(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 8083 _this._element.style[dimension] = ""; 8084 _this.setTransitioning(false); 8085 $2(_this._element).trigger(Event$3.SHOWN); 8086 }; 8087 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 8088 var scrollSize = "scroll" + capitalizedDimension; 8089 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 8090 $2(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 8091 this._element.style[dimension] = this._element[scrollSize] + "px"; 8092 }; 8093 _proto.hide = function hide() { 8094 var _this2 = this; 8095 if (this._isTransitioning || !$2(this._element).hasClass(ClassName$3.SHOW)) { 8096 return; 8097 } 8098 var startEvent = $2.Event(Event$3.HIDE); 8099 $2(this._element).trigger(startEvent); 8100 if (startEvent.isDefaultPrevented()) { 8101 return; 8102 } 8103 var dimension = this._getDimension(); 8104 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 8105 Util.reflow(this._element); 8106 $2(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 8107 var triggerArrayLength = this._triggerArray.length; 8108 if (triggerArrayLength > 0) { 8109 for (var i = 0;i < triggerArrayLength; i++) { 8110 var trigger = this._triggerArray[i]; 8111 var selector = Util.getSelectorFromElement(trigger); 8112 if (selector !== null) { 8113 var $elem = $2([].slice.call(document.querySelectorAll(selector))); 8114 if (!$elem.hasClass(ClassName$3.SHOW)) { 8115 $2(trigger).addClass(ClassName$3.COLLAPSED).attr("aria-expanded", false); 8116 } 8117 } 8118 } 8119 } 8120 this.setTransitioning(true); 8121 var complete = function complete() { 8122 _this2.setTransitioning(false); 8123 $2(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 8124 }; 8125 this._element.style[dimension] = ""; 8126 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 8127 $2(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 8128 }; 8129 _proto.setTransitioning = function setTransitioning(isTransitioning) { 8130 this._isTransitioning = isTransitioning; 8131 }; 8132 _proto.dispose = function dispose() { 8133 $2.removeData(this._element, DATA_KEY$3); 8134 this._config = null; 8135 this._parent = null; 8136 this._element = null; 8137 this._triggerArray = null; 8138 this._isTransitioning = null; 8139 }; 8140 _proto._getConfig = function _getConfig(config) { 8141 config = _objectSpread({}, Default$1, config); 8142 config.toggle = Boolean(config.toggle); 8143 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 8144 return config; 8145 }; 8146 _proto._getDimension = function _getDimension() { 8147 var hasWidth = $2(this._element).hasClass(Dimension.WIDTH); 8148 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 8149 }; 8150 _proto._getParent = function _getParent() { 8151 var _this3 = this; 8152 var parent; 8153 if (Util.isElement(this._config.parent)) { 8154 parent = this._config.parent; 8155 if (typeof this._config.parent.jquery !== "undefined") { 8156 parent = this._config.parent[0]; 8157 } 8158 } else { 8159 parent = document.querySelector(this._config.parent); 8160 } 8161 var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]'; 8162 var children = [].slice.call(parent.querySelectorAll(selector)); 8163 $2(children).each(function(i, element) { 8164 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 8165 }); 8166 return parent; 8167 }; 8168 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 8169 var isOpen = $2(element).hasClass(ClassName$3.SHOW); 8170 if (triggerArray.length) { 8171 $2(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr("aria-expanded", isOpen); 8172 } 8173 }; 8174 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 8175 var selector = Util.getSelectorFromElement(element); 8176 return selector ? document.querySelector(selector) : null; 8177 }; 8178 Collapse._jQueryInterface = function _jQueryInterface(config) { 8179 return this.each(function() { 8180 var $this = $2(this); 8181 var data = $this.data(DATA_KEY$3); 8182 var _config = _objectSpread({}, Default$1, $this.data(), typeof config === "object" && config ? config : {}); 8183 if (!data && _config.toggle && /show|hide/.test(config)) { 8184 _config.toggle = false; 8185 } 8186 if (!data) { 8187 data = new Collapse(this, _config); 8188 $this.data(DATA_KEY$3, data); 8189 } 8190 if (typeof config === "string") { 8191 if (typeof data[config] === "undefined") { 8192 throw new TypeError('No method named "' + config + '"'); 8193 } 8194 data[config](); 8195 } 8196 }); 8197 }; 8198 _createClass(Collapse, null, [{ 8199 key: "VERSION", 8200 get: function get() { 8201 return VERSION$3; 8202 } 8203 }, { 8204 key: "Default", 8205 get: function get() { 8206 return Default$1; 8207 } 8208 }]); 8209 return Collapse; 8210 }(); 8211 $2(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function(event) { 8212 if (event.currentTarget.tagName === "A") { 8213 event.preventDefault(); 8214 } 8215 var $trigger = $2(this); 8216 var selector = Util.getSelectorFromElement(this); 8217 var selectors = [].slice.call(document.querySelectorAll(selector)); 8218 $2(selectors).each(function() { 8219 var $target = $2(this); 8220 var data = $target.data(DATA_KEY$3); 8221 var config = data ? "toggle" : $trigger.data(); 8222 Collapse._jQueryInterface.call($target, config); 8223 }); 8224 }); 8225 $2.fn[NAME$3] = Collapse._jQueryInterface; 8226 $2.fn[NAME$3].Constructor = Collapse; 8227 $2.fn[NAME$3].noConflict = function() { 8228 $2.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 8229 return Collapse._jQueryInterface; 8230 }; 8231 var NAME$4 = "dropdown"; 8232 var VERSION$4 = "4.3.1"; 8233 var DATA_KEY$4 = "bs.dropdown"; 8234 var EVENT_KEY$4 = "." + DATA_KEY$4; 8235 var DATA_API_KEY$4 = ".data-api"; 8236 var JQUERY_NO_CONFLICT$4 = $2.fn[NAME$4]; 8237 var ESCAPE_KEYCODE = 27; 8238 var SPACE_KEYCODE = 32; 8239 var TAB_KEYCODE = 9; 8240 var ARROW_UP_KEYCODE = 38; 8241 var ARROW_DOWN_KEYCODE = 40; 8242 var RIGHT_MOUSE_BUTTON_WHICH = 3; 8243 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 8244 var Event$4 = { 8245 HIDE: "hide" + EVENT_KEY$4, 8246 HIDDEN: "hidden" + EVENT_KEY$4, 8247 SHOW: "show" + EVENT_KEY$4, 8248 SHOWN: "shown" + EVENT_KEY$4, 8249 CLICK: "click" + EVENT_KEY$4, 8250 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 8251 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 8252 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 8253 }; 8254 var ClassName$4 = { 8255 DISABLED: "disabled", 8256 SHOW: "show", 8257 DROPUP: "dropup", 8258 DROPRIGHT: "dropright", 8259 DROPLEFT: "dropleft", 8260 MENURIGHT: "dropdown-menu-right", 8261 MENULEFT: "dropdown-menu-left", 8262 POSITION_STATIC: "position-static" 8263 }; 8264 var Selector$4 = { 8265 DATA_TOGGLE: '[data-toggle="dropdown"]', 8266 FORM_CHILD: ".dropdown form", 8267 MENU: ".dropdown-menu", 8268 NAVBAR_NAV: ".navbar-nav", 8269 VISIBLE_ITEMS: ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)" 8270 }; 8271 var AttachmentMap = { 8272 TOP: "top-start", 8273 TOPEND: "top-end", 8274 BOTTOM: "bottom-start", 8275 BOTTOMEND: "bottom-end", 8276 RIGHT: "right-start", 8277 RIGHTEND: "right-end", 8278 LEFT: "left-start", 8279 LEFTEND: "left-end" 8280 }; 8281 var Default$2 = { 8282 offset: 0, 8283 flip: true, 8284 boundary: "scrollParent", 8285 reference: "toggle", 8286 display: "dynamic" 8287 }; 8288 var DefaultType$2 = { 8289 offset: "(number|string|function)", 8290 flip: "boolean", 8291 boundary: "(string|element)", 8292 reference: "(string|element)", 8293 display: "string" 8294 }; 8295 var Dropdown = /* @__PURE__ */ function() { 8296 function Dropdown(element, config) { 8297 this._element = element; 8298 this._popper = null; 8299 this._config = this._getConfig(config); 8300 this._menu = this._getMenuElement(); 8301 this._inNavbar = this._detectNavbar(); 8302 this._addEventListeners(); 8303 } 8304 var _proto = Dropdown.prototype; 8305 _proto.toggle = function toggle() { 8306 if (this._element.disabled || $2(this._element).hasClass(ClassName$4.DISABLED)) { 8307 return; 8308 } 8309 var parent = Dropdown._getParentFromElement(this._element); 8310 var isActive = $2(this._menu).hasClass(ClassName$4.SHOW); 8311 Dropdown._clearMenus(); 8312 if (isActive) { 8313 return; 8314 } 8315 var relatedTarget = { 8316 relatedTarget: this._element 8317 }; 8318 var showEvent = $2.Event(Event$4.SHOW, relatedTarget); 8319 $2(parent).trigger(showEvent); 8320 if (showEvent.isDefaultPrevented()) { 8321 return; 8322 } 8323 if (!this._inNavbar) { 8324 if (typeof Popper === "undefined") { 8325 throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org/)"); 8326 } 8327 var referenceElement = this._element; 8328 if (this._config.reference === "parent") { 8329 referenceElement = parent; 8330 } else if (Util.isElement(this._config.reference)) { 8331 referenceElement = this._config.reference; 8332 if (typeof this._config.reference.jquery !== "undefined") { 8333 referenceElement = this._config.reference[0]; 8334 } 8335 } 8336 if (this._config.boundary !== "scrollParent") { 8337 $2(parent).addClass(ClassName$4.POSITION_STATIC); 8338 } 8339 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 8340 } 8341 if ("ontouchstart" in document.documentElement && $2(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 8342 $2(document.body).children().on("mouseover", null, $2.noop); 8343 } 8344 this._element.focus(); 8345 this._element.setAttribute("aria-expanded", true); 8346 $2(this._menu).toggleClass(ClassName$4.SHOW); 8347 $2(parent).toggleClass(ClassName$4.SHOW).trigger($2.Event(Event$4.SHOWN, relatedTarget)); 8348 }; 8349 _proto.show = function show() { 8350 if (this._element.disabled || $2(this._element).hasClass(ClassName$4.DISABLED) || $2(this._menu).hasClass(ClassName$4.SHOW)) { 8351 return; 8352 } 8353 var relatedTarget = { 8354 relatedTarget: this._element 8355 }; 8356 var showEvent = $2.Event(Event$4.SHOW, relatedTarget); 8357 var parent = Dropdown._getParentFromElement(this._element); 8358 $2(parent).trigger(showEvent); 8359 if (showEvent.isDefaultPrevented()) { 8360 return; 8361 } 8362 $2(this._menu).toggleClass(ClassName$4.SHOW); 8363 $2(parent).toggleClass(ClassName$4.SHOW).trigger($2.Event(Event$4.SHOWN, relatedTarget)); 8364 }; 8365 _proto.hide = function hide() { 8366 if (this._element.disabled || $2(this._element).hasClass(ClassName$4.DISABLED) || !$2(this._menu).hasClass(ClassName$4.SHOW)) { 8367 return; 8368 } 8369 var relatedTarget = { 8370 relatedTarget: this._element 8371 }; 8372 var hideEvent = $2.Event(Event$4.HIDE, relatedTarget); 8373 var parent = Dropdown._getParentFromElement(this._element); 8374 $2(parent).trigger(hideEvent); 8375 if (hideEvent.isDefaultPrevented()) { 8376 return; 8377 } 8378 $2(this._menu).toggleClass(ClassName$4.SHOW); 8379 $2(parent).toggleClass(ClassName$4.SHOW).trigger($2.Event(Event$4.HIDDEN, relatedTarget)); 8380 }; 8381 _proto.dispose = function dispose() { 8382 $2.removeData(this._element, DATA_KEY$4); 8383 $2(this._element).off(EVENT_KEY$4); 8384 this._element = null; 8385 this._menu = null; 8386 if (this._popper !== null) { 8387 this._popper.destroy(); 8388 this._popper = null; 8389 } 8390 }; 8391 _proto.update = function update() { 8392 this._inNavbar = this._detectNavbar(); 8393 if (this._popper !== null) { 8394 this._popper.scheduleUpdate(); 8395 } 8396 }; 8397 _proto._addEventListeners = function _addEventListeners() { 8398 var _this = this; 8399 $2(this._element).on(Event$4.CLICK, function(event) { 8400 event.preventDefault(); 8401 event.stopPropagation(); 8402 _this.toggle(); 8403 }); 8404 }; 8405 _proto._getConfig = function _getConfig(config) { 8406 config = _objectSpread({}, this.constructor.Default, $2(this._element).data(), config); 8407 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 8408 return config; 8409 }; 8410 _proto._getMenuElement = function _getMenuElement() { 8411 if (!this._menu) { 8412 var parent = Dropdown._getParentFromElement(this._element); 8413 if (parent) { 8414 this._menu = parent.querySelector(Selector$4.MENU); 8415 } 8416 } 8417 return this._menu; 8418 }; 8419 _proto._getPlacement = function _getPlacement() { 8420 var $parentDropdown = $2(this._element.parentNode); 8421 var placement = AttachmentMap.BOTTOM; 8422 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 8423 placement = AttachmentMap.TOP; 8424 if ($2(this._menu).hasClass(ClassName$4.MENURIGHT)) { 8425 placement = AttachmentMap.TOPEND; 8426 } 8427 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 8428 placement = AttachmentMap.RIGHT; 8429 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 8430 placement = AttachmentMap.LEFT; 8431 } else if ($2(this._menu).hasClass(ClassName$4.MENURIGHT)) { 8432 placement = AttachmentMap.BOTTOMEND; 8433 } 8434 return placement; 8435 }; 8436 _proto._detectNavbar = function _detectNavbar() { 8437 return $2(this._element).closest(".navbar").length > 0; 8438 }; 8439 _proto._getOffset = function _getOffset() { 8440 var _this2 = this; 8441 var offset = {}; 8442 if (typeof this._config.offset === "function") { 8443 offset.fn = function(data) { 8444 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 8445 return data; 8446 }; 8447 } else { 8448 offset.offset = this._config.offset; 8449 } 8450 return offset; 8451 }; 8452 _proto._getPopperConfig = function _getPopperConfig() { 8453 var popperConfig = { 8454 placement: this._getPlacement(), 8455 modifiers: { 8456 offset: this._getOffset(), 8457 flip: { 8458 enabled: this._config.flip 8459 }, 8460 preventOverflow: { 8461 boundariesElement: this._config.boundary 8462 } 8463 } 8464 }; 8465 if (this._config.display === "static") { 8466 popperConfig.modifiers.applyStyle = { 8467 enabled: false 8468 }; 8469 } 8470 return popperConfig; 8471 }; 8472 Dropdown._jQueryInterface = function _jQueryInterface(config) { 8473 return this.each(function() { 8474 var data = $2(this).data(DATA_KEY$4); 8475 var _config = typeof config === "object" ? config : null; 8476 if (!data) { 8477 data = new Dropdown(this, _config); 8478 $2(this).data(DATA_KEY$4, data); 8479 } 8480 if (typeof config === "string") { 8481 if (typeof data[config] === "undefined") { 8482 throw new TypeError('No method named "' + config + '"'); 8483 } 8484 data[config](); 8485 } 8486 }); 8487 }; 8488 Dropdown._clearMenus = function _clearMenus(event) { 8489 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === "keyup" && event.which !== TAB_KEYCODE)) { 8490 return; 8491 } 8492 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 8493 for (var i = 0, len = toggles.length;i < len; i++) { 8494 var parent = Dropdown._getParentFromElement(toggles[i]); 8495 var context = $2(toggles[i]).data(DATA_KEY$4); 8496 var relatedTarget = { 8497 relatedTarget: toggles[i] 8498 }; 8499 if (event && event.type === "click") { 8500 relatedTarget.clickEvent = event; 8501 } 8502 if (!context) { 8503 continue; 8504 } 8505 var dropdownMenu = context._menu; 8506 if (!$2(parent).hasClass(ClassName$4.SHOW)) { 8507 continue; 8508 } 8509 if (event && (event.type === "click" && /input|textarea/i.test(event.target.tagName) || event.type === "keyup" && event.which === TAB_KEYCODE) && $2.contains(parent, event.target)) { 8510 continue; 8511 } 8512 var hideEvent = $2.Event(Event$4.HIDE, relatedTarget); 8513 $2(parent).trigger(hideEvent); 8514 if (hideEvent.isDefaultPrevented()) { 8515 continue; 8516 } 8517 if ("ontouchstart" in document.documentElement) { 8518 $2(document.body).children().off("mouseover", null, $2.noop); 8519 } 8520 toggles[i].setAttribute("aria-expanded", "false"); 8521 $2(dropdownMenu).removeClass(ClassName$4.SHOW); 8522 $2(parent).removeClass(ClassName$4.SHOW).trigger($2.Event(Event$4.HIDDEN, relatedTarget)); 8523 } 8524 }; 8525 Dropdown._getParentFromElement = function _getParentFromElement(element) { 8526 var parent; 8527 var selector = Util.getSelectorFromElement(element); 8528 if (selector) { 8529 parent = document.querySelector(selector); 8530 } 8531 return parent || element.parentNode; 8532 }; 8533 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 8534 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $2(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 8535 return; 8536 } 8537 event.preventDefault(); 8538 event.stopPropagation(); 8539 if (this.disabled || $2(this).hasClass(ClassName$4.DISABLED)) { 8540 return; 8541 } 8542 var parent = Dropdown._getParentFromElement(this); 8543 var isActive = $2(parent).hasClass(ClassName$4.SHOW); 8544 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 8545 if (event.which === ESCAPE_KEYCODE) { 8546 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 8547 $2(toggle).trigger("focus"); 8548 } 8549 $2(this).trigger("click"); 8550 return; 8551 } 8552 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); 8553 if (items.length === 0) { 8554 return; 8555 } 8556 var index = items.indexOf(event.target); 8557 if (event.which === ARROW_UP_KEYCODE && index > 0) { 8558 index--; 8559 } 8560 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 8561 index++; 8562 } 8563 if (index < 0) { 8564 index = 0; 8565 } 8566 items[index].focus(); 8567 }; 8568 _createClass(Dropdown, null, [{ 8569 key: "VERSION", 8570 get: function get() { 8571 return VERSION$4; 8572 } 8573 }, { 8574 key: "Default", 8575 get: function get() { 8576 return Default$2; 8577 } 8578 }, { 8579 key: "DefaultType", 8580 get: function get() { 8581 return DefaultType$2; 8582 } 8583 }]); 8584 return Dropdown; 8585 }(); 8586 $2(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function(event) { 8587 event.preventDefault(); 8588 event.stopPropagation(); 8589 Dropdown._jQueryInterface.call($2(this), "toggle"); 8590 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function(e) { 8591 e.stopPropagation(); 8592 }); 8593 $2.fn[NAME$4] = Dropdown._jQueryInterface; 8594 $2.fn[NAME$4].Constructor = Dropdown; 8595 $2.fn[NAME$4].noConflict = function() { 8596 $2.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 8597 return Dropdown._jQueryInterface; 8598 }; 8599 var NAME$5 = "modal"; 8600 var VERSION$5 = "4.3.1"; 8601 var DATA_KEY$5 = "bs.modal"; 8602 var EVENT_KEY$5 = "." + DATA_KEY$5; 8603 var DATA_API_KEY$5 = ".data-api"; 8604 var JQUERY_NO_CONFLICT$5 = $2.fn[NAME$5]; 8605 var ESCAPE_KEYCODE$1 = 27; 8606 var Default$3 = { 8607 backdrop: true, 8608 keyboard: true, 8609 focus: true, 8610 show: true 8611 }; 8612 var DefaultType$3 = { 8613 backdrop: "(boolean|string)", 8614 keyboard: "boolean", 8615 focus: "boolean", 8616 show: "boolean" 8617 }; 8618 var Event$5 = { 8619 HIDE: "hide" + EVENT_KEY$5, 8620 HIDDEN: "hidden" + EVENT_KEY$5, 8621 SHOW: "show" + EVENT_KEY$5, 8622 SHOWN: "shown" + EVENT_KEY$5, 8623 FOCUSIN: "focusin" + EVENT_KEY$5, 8624 RESIZE: "resize" + EVENT_KEY$5, 8625 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 8626 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 8627 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 8628 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 8629 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 8630 }; 8631 var ClassName$5 = { 8632 SCROLLABLE: "modal-dialog-scrollable", 8633 SCROLLBAR_MEASURER: "modal-scrollbar-measure", 8634 BACKDROP: "modal-backdrop", 8635 OPEN: "modal-open", 8636 FADE: "fade", 8637 SHOW: "show" 8638 }; 8639 var Selector$5 = { 8640 DIALOG: ".modal-dialog", 8641 MODAL_BODY: ".modal-body", 8642 DATA_TOGGLE: '[data-toggle="modal"]', 8643 DATA_DISMISS: '[data-dismiss="modal"]', 8644 FIXED_CONTENT: ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top", 8645 STICKY_CONTENT: ".sticky-top" 8646 }; 8647 var Modal = /* @__PURE__ */ function() { 8648 function Modal(element, config) { 8649 this._config = this._getConfig(config); 8650 this._element = element; 8651 this._dialog = element.querySelector(Selector$5.DIALOG); 8652 this._backdrop = null; 8653 this._isShown = false; 8654 this._isBodyOverflowing = false; 8655 this._ignoreBackdropClick = false; 8656 this._isTransitioning = false; 8657 this._scrollbarWidth = 0; 8658 } 8659 var _proto = Modal.prototype; 8660 _proto.toggle = function toggle(relatedTarget) { 8661 return this._isShown ? this.hide() : this.show(relatedTarget); 8662 }; 8663 _proto.show = function show(relatedTarget) { 8664 var _this = this; 8665 if (this._isShown || this._isTransitioning) { 8666 return; 8667 } 8668 if ($2(this._element).hasClass(ClassName$5.FADE)) { 8669 this._isTransitioning = true; 8670 } 8671 var showEvent = $2.Event(Event$5.SHOW, { 8672 relatedTarget 8673 }); 8674 $2(this._element).trigger(showEvent); 8675 if (this._isShown || showEvent.isDefaultPrevented()) { 8676 return; 8677 } 8678 this._isShown = true; 8679 this._checkScrollbar(); 8680 this._setScrollbar(); 8681 this._adjustDialog(); 8682 this._setEscapeEvent(); 8683 this._setResizeEvent(); 8684 $2(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function(event) { 8685 return _this.hide(event); 8686 }); 8687 $2(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function() { 8688 $2(_this._element).one(Event$5.MOUSEUP_DISMISS, function(event) { 8689 if ($2(event.target).is(_this._element)) { 8690 _this._ignoreBackdropClick = true; 8691 } 8692 }); 8693 }); 8694 this._showBackdrop(function() { 8695 return _this._showElement(relatedTarget); 8696 }); 8697 }; 8698 _proto.hide = function hide(event) { 8699 var _this2 = this; 8700 if (event) { 8701 event.preventDefault(); 8702 } 8703 if (!this._isShown || this._isTransitioning) { 8704 return; 8705 } 8706 var hideEvent = $2.Event(Event$5.HIDE); 8707 $2(this._element).trigger(hideEvent); 8708 if (!this._isShown || hideEvent.isDefaultPrevented()) { 8709 return; 8710 } 8711 this._isShown = false; 8712 var transition = $2(this._element).hasClass(ClassName$5.FADE); 8713 if (transition) { 8714 this._isTransitioning = true; 8715 } 8716 this._setEscapeEvent(); 8717 this._setResizeEvent(); 8718 $2(document).off(Event$5.FOCUSIN); 8719 $2(this._element).removeClass(ClassName$5.SHOW); 8720 $2(this._element).off(Event$5.CLICK_DISMISS); 8721 $2(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 8722 if (transition) { 8723 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 8724 $2(this._element).one(Util.TRANSITION_END, function(event) { 8725 return _this2._hideModal(event); 8726 }).emulateTransitionEnd(transitionDuration); 8727 } else { 8728 this._hideModal(); 8729 } 8730 }; 8731 _proto.dispose = function dispose() { 8732 [window, this._element, this._dialog].forEach(function(htmlElement) { 8733 return $2(htmlElement).off(EVENT_KEY$5); 8734 }); 8735 $2(document).off(Event$5.FOCUSIN); 8736 $2.removeData(this._element, DATA_KEY$5); 8737 this._config = null; 8738 this._element = null; 8739 this._dialog = null; 8740 this._backdrop = null; 8741 this._isShown = null; 8742 this._isBodyOverflowing = null; 8743 this._ignoreBackdropClick = null; 8744 this._isTransitioning = null; 8745 this._scrollbarWidth = null; 8746 }; 8747 _proto.handleUpdate = function handleUpdate() { 8748 this._adjustDialog(); 8749 }; 8750 _proto._getConfig = function _getConfig(config) { 8751 config = _objectSpread({}, Default$3, config); 8752 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 8753 return config; 8754 }; 8755 _proto._showElement = function _showElement(relatedTarget) { 8756 var _this3 = this; 8757 var transition = $2(this._element).hasClass(ClassName$5.FADE); 8758 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 8759 document.body.appendChild(this._element); 8760 } 8761 this._element.style.display = "block"; 8762 this._element.removeAttribute("aria-hidden"); 8763 this._element.setAttribute("aria-modal", true); 8764 if ($2(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { 8765 this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; 8766 } else { 8767 this._element.scrollTop = 0; 8768 } 8769 if (transition) { 8770 Util.reflow(this._element); 8771 } 8772 $2(this._element).addClass(ClassName$5.SHOW); 8773 if (this._config.focus) { 8774 this._enforceFocus(); 8775 } 8776 var shownEvent = $2.Event(Event$5.SHOWN, { 8777 relatedTarget 8778 }); 8779 var transitionComplete = function transitionComplete() { 8780 if (_this3._config.focus) { 8781 _this3._element.focus(); 8782 } 8783 _this3._isTransitioning = false; 8784 $2(_this3._element).trigger(shownEvent); 8785 }; 8786 if (transition) { 8787 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 8788 $2(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 8789 } else { 8790 transitionComplete(); 8791 } 8792 }; 8793 _proto._enforceFocus = function _enforceFocus() { 8794 var _this4 = this; 8795 $2(document).off(Event$5.FOCUSIN).on(Event$5.FOCUSIN, function(event) { 8796 if (document !== event.target && _this4._element !== event.target && $2(_this4._element).has(event.target).length === 0) { 8797 _this4._element.focus(); 8798 } 8799 }); 8800 }; 8801 _proto._setEscapeEvent = function _setEscapeEvent() { 8802 var _this5 = this; 8803 if (this._isShown && this._config.keyboard) { 8804 $2(this._element).on(Event$5.KEYDOWN_DISMISS, function(event) { 8805 if (event.which === ESCAPE_KEYCODE$1) { 8806 event.preventDefault(); 8807 _this5.hide(); 8808 } 8809 }); 8810 } else if (!this._isShown) { 8811 $2(this._element).off(Event$5.KEYDOWN_DISMISS); 8812 } 8813 }; 8814 _proto._setResizeEvent = function _setResizeEvent() { 8815 var _this6 = this; 8816 if (this._isShown) { 8817 $2(window).on(Event$5.RESIZE, function(event) { 8818 return _this6.handleUpdate(event); 8819 }); 8820 } else { 8821 $2(window).off(Event$5.RESIZE); 8822 } 8823 }; 8824 _proto._hideModal = function _hideModal() { 8825 var _this7 = this; 8826 this._element.style.display = "none"; 8827 this._element.setAttribute("aria-hidden", true); 8828 this._element.removeAttribute("aria-modal"); 8829 this._isTransitioning = false; 8830 this._showBackdrop(function() { 8831 $2(document.body).removeClass(ClassName$5.OPEN); 8832 _this7._resetAdjustments(); 8833 _this7._resetScrollbar(); 8834 $2(_this7._element).trigger(Event$5.HIDDEN); 8835 }); 8836 }; 8837 _proto._removeBackdrop = function _removeBackdrop() { 8838 if (this._backdrop) { 8839 $2(this._backdrop).remove(); 8840 this._backdrop = null; 8841 } 8842 }; 8843 _proto._showBackdrop = function _showBackdrop(callback) { 8844 var _this8 = this; 8845 var animate = $2(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ""; 8846 if (this._isShown && this._config.backdrop) { 8847 this._backdrop = document.createElement("div"); 8848 this._backdrop.className = ClassName$5.BACKDROP; 8849 if (animate) { 8850 this._backdrop.classList.add(animate); 8851 } 8852 $2(this._backdrop).appendTo(document.body); 8853 $2(this._element).on(Event$5.CLICK_DISMISS, function(event) { 8854 if (_this8._ignoreBackdropClick) { 8855 _this8._ignoreBackdropClick = false; 8856 return; 8857 } 8858 if (event.target !== event.currentTarget) { 8859 return; 8860 } 8861 if (_this8._config.backdrop === "static") { 8862 _this8._element.focus(); 8863 } else { 8864 _this8.hide(); 8865 } 8866 }); 8867 if (animate) { 8868 Util.reflow(this._backdrop); 8869 } 8870 $2(this._backdrop).addClass(ClassName$5.SHOW); 8871 if (!callback) { 8872 return; 8873 } 8874 if (!animate) { 8875 callback(); 8876 return; 8877 } 8878 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 8879 $2(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 8880 } else if (!this._isShown && this._backdrop) { 8881 $2(this._backdrop).removeClass(ClassName$5.SHOW); 8882 var callbackRemove = function callbackRemove() { 8883 _this8._removeBackdrop(); 8884 if (callback) { 8885 callback(); 8886 } 8887 }; 8888 if ($2(this._element).hasClass(ClassName$5.FADE)) { 8889 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 8890 $2(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 8891 } else { 8892 callbackRemove(); 8893 } 8894 } else if (callback) { 8895 callback(); 8896 } 8897 }; 8898 _proto._adjustDialog = function _adjustDialog() { 8899 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 8900 if (!this._isBodyOverflowing && isModalOverflowing) { 8901 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 8902 } 8903 if (this._isBodyOverflowing && !isModalOverflowing) { 8904 this._element.style.paddingRight = this._scrollbarWidth + "px"; 8905 } 8906 }; 8907 _proto._resetAdjustments = function _resetAdjustments() { 8908 this._element.style.paddingLeft = ""; 8909 this._element.style.paddingRight = ""; 8910 }; 8911 _proto._checkScrollbar = function _checkScrollbar() { 8912 var rect = document.body.getBoundingClientRect(); 8913 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 8914 this._scrollbarWidth = this._getScrollbarWidth(); 8915 }; 8916 _proto._setScrollbar = function _setScrollbar() { 8917 var _this9 = this; 8918 if (this._isBodyOverflowing) { 8919 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 8920 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); 8921 $2(fixedContent).each(function(index, element) { 8922 var actualPadding = element.style.paddingRight; 8923 var calculatedPadding = $2(element).css("padding-right"); 8924 $2(element).data("padding-right", actualPadding).css("padding-right", parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 8925 }); 8926 $2(stickyContent).each(function(index, element) { 8927 var actualMargin = element.style.marginRight; 8928 var calculatedMargin = $2(element).css("margin-right"); 8929 $2(element).data("margin-right", actualMargin).css("margin-right", parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 8930 }); 8931 var actualPadding = document.body.style.paddingRight; 8932 var calculatedPadding = $2(document.body).css("padding-right"); 8933 $2(document.body).data("padding-right", actualPadding).css("padding-right", parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 8934 } 8935 $2(document.body).addClass(ClassName$5.OPEN); 8936 }; 8937 _proto._resetScrollbar = function _resetScrollbar() { 8938 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 8939 $2(fixedContent).each(function(index, element) { 8940 var padding = $2(element).data("padding-right"); 8941 $2(element).removeData("padding-right"); 8942 element.style.paddingRight = padding ? padding : ""; 8943 }); 8944 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 8945 $2(elements).each(function(index, element) { 8946 var margin = $2(element).data("margin-right"); 8947 if (typeof margin !== "undefined") { 8948 $2(element).css("margin-right", margin).removeData("margin-right"); 8949 } 8950 }); 8951 var padding = $2(document.body).data("padding-right"); 8952 $2(document.body).removeData("padding-right"); 8953 document.body.style.paddingRight = padding ? padding : ""; 8954 }; 8955 _proto._getScrollbarWidth = function _getScrollbarWidth() { 8956 var scrollDiv = document.createElement("div"); 8957 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 8958 document.body.appendChild(scrollDiv); 8959 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 8960 document.body.removeChild(scrollDiv); 8961 return scrollbarWidth; 8962 }; 8963 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 8964 return this.each(function() { 8965 var data = $2(this).data(DATA_KEY$5); 8966 var _config = _objectSpread({}, Default$3, $2(this).data(), typeof config === "object" && config ? config : {}); 8967 if (!data) { 8968 data = new Modal(this, _config); 8969 $2(this).data(DATA_KEY$5, data); 8970 } 8971 if (typeof config === "string") { 8972 if (typeof data[config] === "undefined") { 8973 throw new TypeError('No method named "' + config + '"'); 8974 } 8975 data[config](relatedTarget); 8976 } else if (_config.show) { 8977 data.show(relatedTarget); 8978 } 8979 }); 8980 }; 8981 _createClass(Modal, null, [{ 8982 key: "VERSION", 8983 get: function get() { 8984 return VERSION$5; 8985 } 8986 }, { 8987 key: "Default", 8988 get: function get() { 8989 return Default$3; 8990 } 8991 }]); 8992 return Modal; 8993 }(); 8994 $2(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function(event) { 8995 var _this10 = this; 8996 var target; 8997 var selector = Util.getSelectorFromElement(this); 8998 if (selector) { 8999 target = document.querySelector(selector); 9000 } 9001 var config = $2(target).data(DATA_KEY$5) ? "toggle" : _objectSpread({}, $2(target).data(), $2(this).data()); 9002 if (this.tagName === "A" || this.tagName === "AREA") { 9003 event.preventDefault(); 9004 } 9005 var $target = $2(target).one(Event$5.SHOW, function(showEvent) { 9006 if (showEvent.isDefaultPrevented()) { 9007 return; 9008 } 9009 $target.one(Event$5.HIDDEN, function() { 9010 if ($2(_this10).is(":visible")) { 9011 _this10.focus(); 9012 } 9013 }); 9014 }); 9015 Modal._jQueryInterface.call($2(target), config, this); 9016 }); 9017 $2.fn[NAME$5] = Modal._jQueryInterface; 9018 $2.fn[NAME$5].Constructor = Modal; 9019 $2.fn[NAME$5].noConflict = function() { 9020 $2.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 9021 return Modal._jQueryInterface; 9022 }; 9023 var uriAttrs = ["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]; 9024 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 9025 var DefaultWhitelist = { 9026 "*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN], 9027 a: ["target", "href", "title", "rel"], 9028 area: [], 9029 b: [], 9030 br: [], 9031 col: [], 9032 code: [], 9033 div: [], 9034 em: [], 9035 hr: [], 9036 h1: [], 9037 h2: [], 9038 h3: [], 9039 h4: [], 9040 h5: [], 9041 h6: [], 9042 i: [], 9043 img: ["src", "alt", "title", "width", "height"], 9044 li: [], 9045 ol: [], 9046 p: [], 9047 pre: [], 9048 s: [], 9049 small: [], 9050 span: [], 9051 sub: [], 9052 sup: [], 9053 strong: [], 9054 u: [], 9055 ul: [] 9056 }; 9057 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 9058 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; 9059 function allowedAttribute(attr, allowedAttributeList) { 9060 var attrName = attr.nodeName.toLowerCase(); 9061 if (allowedAttributeList.indexOf(attrName) !== -1) { 9062 if (uriAttrs.indexOf(attrName) !== -1) { 9063 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 9064 } 9065 return true; 9066 } 9067 var regExp = allowedAttributeList.filter(function(attrRegex) { 9068 return attrRegex instanceof RegExp; 9069 }); 9070 for (var i = 0, l = regExp.length;i < l; i++) { 9071 if (attrName.match(regExp[i])) { 9072 return true; 9073 } 9074 } 9075 return false; 9076 } 9077 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 9078 if (unsafeHtml.length === 0) { 9079 return unsafeHtml; 9080 } 9081 if (sanitizeFn && typeof sanitizeFn === "function") { 9082 return sanitizeFn(unsafeHtml); 9083 } 9084 var domParser = new window.DOMParser; 9085 var createdDocument = domParser.parseFromString(unsafeHtml, "text/html"); 9086 var whitelistKeys = Object.keys(whiteList); 9087 var elements = [].slice.call(createdDocument.body.querySelectorAll("*")); 9088 var _loop = function _loop(i, len) { 9089 var el = elements[i]; 9090 var elName = el.nodeName.toLowerCase(); 9091 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 9092 el.parentNode.removeChild(el); 9093 return "continue"; 9094 } 9095 var attributeList = [].slice.call(el.attributes); 9096 var whitelistedAttributes = [].concat(whiteList["*"] || [], whiteList[elName] || []); 9097 attributeList.forEach(function(attr) { 9098 if (!allowedAttribute(attr, whitelistedAttributes)) { 9099 el.removeAttribute(attr.nodeName); 9100 } 9101 }); 9102 }; 9103 for (var i = 0, len = elements.length;i < len; i++) { 9104 var _ret = _loop(i, len); 9105 if (_ret === "continue") 9106 continue; 9107 } 9108 return createdDocument.body.innerHTML; 9109 } 9110 var NAME$6 = "tooltip"; 9111 var VERSION$6 = "4.3.1"; 9112 var DATA_KEY$6 = "bs.tooltip"; 9113 var EVENT_KEY$6 = "." + DATA_KEY$6; 9114 var JQUERY_NO_CONFLICT$6 = $2.fn[NAME$6]; 9115 var CLASS_PREFIX = "bs-tooltip"; 9116 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", "g"); 9117 var DISALLOWED_ATTRIBUTES = ["sanitize", "whiteList", "sanitizeFn"]; 9118 var DefaultType$4 = { 9119 animation: "boolean", 9120 template: "string", 9121 title: "(string|element|function)", 9122 trigger: "string", 9123 delay: "(number|object)", 9124 html: "boolean", 9125 selector: "(string|boolean)", 9126 placement: "(string|function)", 9127 offset: "(number|string|function)", 9128 container: "(string|element|boolean)", 9129 fallbackPlacement: "(string|array)", 9130 boundary: "(string|element)", 9131 sanitize: "boolean", 9132 sanitizeFn: "(null|function)", 9133 whiteList: "object" 9134 }; 9135 var AttachmentMap$1 = { 9136 AUTO: "auto", 9137 TOP: "top", 9138 RIGHT: "right", 9139 BOTTOM: "bottom", 9140 LEFT: "left" 9141 }; 9142 var Default$4 = { 9143 animation: true, 9144 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 9145 trigger: "hover focus", 9146 title: "", 9147 delay: 0, 9148 html: false, 9149 selector: false, 9150 placement: "top", 9151 offset: 0, 9152 container: false, 9153 fallbackPlacement: "flip", 9154 boundary: "scrollParent", 9155 sanitize: true, 9156 sanitizeFn: null, 9157 whiteList: DefaultWhitelist 9158 }; 9159 var HoverState = { 9160 SHOW: "show", 9161 OUT: "out" 9162 }; 9163 var Event$6 = { 9164 HIDE: "hide" + EVENT_KEY$6, 9165 HIDDEN: "hidden" + EVENT_KEY$6, 9166 SHOW: "show" + EVENT_KEY$6, 9167 SHOWN: "shown" + EVENT_KEY$6, 9168 INSERTED: "inserted" + EVENT_KEY$6, 9169 CLICK: "click" + EVENT_KEY$6, 9170 FOCUSIN: "focusin" + EVENT_KEY$6, 9171 FOCUSOUT: "focusout" + EVENT_KEY$6, 9172 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 9173 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 9174 }; 9175 var ClassName$6 = { 9176 FADE: "fade", 9177 SHOW: "show" 9178 }; 9179 var Selector$6 = { 9180 TOOLTIP: ".tooltip", 9181 TOOLTIP_INNER: ".tooltip-inner", 9182 ARROW: ".arrow" 9183 }; 9184 var Trigger = { 9185 HOVER: "hover", 9186 FOCUS: "focus", 9187 CLICK: "click", 9188 MANUAL: "manual" 9189 }; 9190 var Tooltip = /* @__PURE__ */ function() { 9191 function Tooltip(element, config) { 9192 if (typeof Popper === "undefined") { 9193 throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)"); 9194 } 9195 this._isEnabled = true; 9196 this._timeout = 0; 9197 this._hoverState = ""; 9198 this._activeTrigger = {}; 9199 this._popper = null; 9200 this.element = element; 9201 this.config = this._getConfig(config); 9202 this.tip = null; 9203 this._setListeners(); 9204 } 9205 var _proto = Tooltip.prototype; 9206 _proto.enable = function enable() { 9207 this._isEnabled = true; 9208 }; 9209 _proto.disable = function disable() { 9210 this._isEnabled = false; 9211 }; 9212 _proto.toggleEnabled = function toggleEnabled() { 9213 this._isEnabled = !this._isEnabled; 9214 }; 9215 _proto.toggle = function toggle(event) { 9216 if (!this._isEnabled) { 9217 return; 9218 } 9219 if (event) { 9220 var dataKey = this.constructor.DATA_KEY; 9221 var context = $2(event.currentTarget).data(dataKey); 9222 if (!context) { 9223 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 9224 $2(event.currentTarget).data(dataKey, context); 9225 } 9226 context._activeTrigger.click = !context._activeTrigger.click; 9227 if (context._isWithActiveTrigger()) { 9228 context._enter(null, context); 9229 } else { 9230 context._leave(null, context); 9231 } 9232 } else { 9233 if ($2(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 9234 this._leave(null, this); 9235 return; 9236 } 9237 this._enter(null, this); 9238 } 9239 }; 9240 _proto.dispose = function dispose() { 9241 clearTimeout(this._timeout); 9242 $2.removeData(this.element, this.constructor.DATA_KEY); 9243 $2(this.element).off(this.constructor.EVENT_KEY); 9244 $2(this.element).closest(".modal").off("hide.bs.modal"); 9245 if (this.tip) { 9246 $2(this.tip).remove(); 9247 } 9248 this._isEnabled = null; 9249 this._timeout = null; 9250 this._hoverState = null; 9251 this._activeTrigger = null; 9252 if (this._popper !== null) { 9253 this._popper.destroy(); 9254 } 9255 this._popper = null; 9256 this.element = null; 9257 this.config = null; 9258 this.tip = null; 9259 }; 9260 _proto.show = function show() { 9261 var _this = this; 9262 if ($2(this.element).css("display") === "none") { 9263 throw new Error("Please use show on visible elements"); 9264 } 9265 var showEvent = $2.Event(this.constructor.Event.SHOW); 9266 if (this.isWithContent() && this._isEnabled) { 9267 $2(this.element).trigger(showEvent); 9268 var shadowRoot = Util.findShadowRoot(this.element); 9269 var isInTheDom = $2.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 9270 if (showEvent.isDefaultPrevented() || !isInTheDom) { 9271 return; 9272 } 9273 var tip = this.getTipElement(); 9274 var tipId = Util.getUID(this.constructor.NAME); 9275 tip.setAttribute("id", tipId); 9276 this.element.setAttribute("aria-describedby", tipId); 9277 this.setContent(); 9278 if (this.config.animation) { 9279 $2(tip).addClass(ClassName$6.FADE); 9280 } 9281 var placement = typeof this.config.placement === "function" ? this.config.placement.call(this, tip, this.element) : this.config.placement; 9282 var attachment = this._getAttachment(placement); 9283 this.addAttachmentClass(attachment); 9284 var container = this._getContainer(); 9285 $2(tip).data(this.constructor.DATA_KEY, this); 9286 if (!$2.contains(this.element.ownerDocument.documentElement, this.tip)) { 9287 $2(tip).appendTo(container); 9288 } 9289 $2(this.element).trigger(this.constructor.Event.INSERTED); 9290 this._popper = new Popper(this.element, tip, { 9291 placement: attachment, 9292 modifiers: { 9293 offset: this._getOffset(), 9294 flip: { 9295 behavior: this.config.fallbackPlacement 9296 }, 9297 arrow: { 9298 element: Selector$6.ARROW 9299 }, 9300 preventOverflow: { 9301 boundariesElement: this.config.boundary 9302 } 9303 }, 9304 onCreate: function onCreate(data) { 9305 if (data.originalPlacement !== data.placement) { 9306 _this._handlePopperPlacementChange(data); 9307 } 9308 }, 9309 onUpdate: function onUpdate(data) { 9310 return _this._handlePopperPlacementChange(data); 9311 } 9312 }); 9313 $2(tip).addClass(ClassName$6.SHOW); 9314 if ("ontouchstart" in document.documentElement) { 9315 $2(document.body).children().on("mouseover", null, $2.noop); 9316 } 9317 var complete = function complete() { 9318 if (_this.config.animation) { 9319 _this._fixTransition(); 9320 } 9321 var prevHoverState = _this._hoverState; 9322 _this._hoverState = null; 9323 $2(_this.element).trigger(_this.constructor.Event.SHOWN); 9324 if (prevHoverState === HoverState.OUT) { 9325 _this._leave(null, _this); 9326 } 9327 }; 9328 if ($2(this.tip).hasClass(ClassName$6.FADE)) { 9329 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 9330 $2(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 9331 } else { 9332 complete(); 9333 } 9334 } 9335 }; 9336 _proto.hide = function hide(callback) { 9337 var _this2 = this; 9338 var tip = this.getTipElement(); 9339 var hideEvent = $2.Event(this.constructor.Event.HIDE); 9340 var complete = function complete() { 9341 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 9342 tip.parentNode.removeChild(tip); 9343 } 9344 _this2._cleanTipClass(); 9345 _this2.element.removeAttribute("aria-describedby"); 9346 $2(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 9347 if (_this2._popper !== null) { 9348 _this2._popper.destroy(); 9349 } 9350 if (callback) { 9351 callback(); 9352 } 9353 }; 9354 $2(this.element).trigger(hideEvent); 9355 if (hideEvent.isDefaultPrevented()) { 9356 return; 9357 } 9358 $2(tip).removeClass(ClassName$6.SHOW); 9359 if ("ontouchstart" in document.documentElement) { 9360 $2(document.body).children().off("mouseover", null, $2.noop); 9361 } 9362 this._activeTrigger[Trigger.CLICK] = false; 9363 this._activeTrigger[Trigger.FOCUS] = false; 9364 this._activeTrigger[Trigger.HOVER] = false; 9365 if ($2(this.tip).hasClass(ClassName$6.FADE)) { 9366 var transitionDuration = Util.getTransitionDurationFromElement(tip); 9367 $2(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 9368 } else { 9369 complete(); 9370 } 9371 this._hoverState = ""; 9372 }; 9373 _proto.update = function update() { 9374 if (this._popper !== null) { 9375 this._popper.scheduleUpdate(); 9376 } 9377 }; 9378 _proto.isWithContent = function isWithContent() { 9379 return Boolean(this.getTitle()); 9380 }; 9381 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 9382 $2(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 9383 }; 9384 _proto.getTipElement = function getTipElement() { 9385 this.tip = this.tip || $2(this.config.template)[0]; 9386 return this.tip; 9387 }; 9388 _proto.setContent = function setContent() { 9389 var tip = this.getTipElement(); 9390 this.setElementContent($2(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 9391 $2(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 9392 }; 9393 _proto.setElementContent = function setElementContent($element, content) { 9394 if (typeof content === "object" && (content.nodeType || content.jquery)) { 9395 if (this.config.html) { 9396 if (!$2(content).parent().is($element)) { 9397 $element.empty().append(content); 9398 } 9399 } else { 9400 $element.text($2(content).text()); 9401 } 9402 return; 9403 } 9404 if (this.config.html) { 9405 if (this.config.sanitize) { 9406 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 9407 } 9408 $element.html(content); 9409 } else { 9410 $element.text(content); 9411 } 9412 }; 9413 _proto.getTitle = function getTitle() { 9414 var title = this.element.getAttribute("data-original-title"); 9415 if (!title) { 9416 title = typeof this.config.title === "function" ? this.config.title.call(this.element) : this.config.title; 9417 } 9418 return title; 9419 }; 9420 _proto._getOffset = function _getOffset() { 9421 var _this3 = this; 9422 var offset = {}; 9423 if (typeof this.config.offset === "function") { 9424 offset.fn = function(data) { 9425 data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); 9426 return data; 9427 }; 9428 } else { 9429 offset.offset = this.config.offset; 9430 } 9431 return offset; 9432 }; 9433 _proto._getContainer = function _getContainer() { 9434 if (this.config.container === false) { 9435 return document.body; 9436 } 9437 if (Util.isElement(this.config.container)) { 9438 return $2(this.config.container); 9439 } 9440 return $2(document).find(this.config.container); 9441 }; 9442 _proto._getAttachment = function _getAttachment(placement) { 9443 return AttachmentMap$1[placement.toUpperCase()]; 9444 }; 9445 _proto._setListeners = function _setListeners() { 9446 var _this4 = this; 9447 var triggers = this.config.trigger.split(" "); 9448 triggers.forEach(function(trigger) { 9449 if (trigger === "click") { 9450 $2(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function(event) { 9451 return _this4.toggle(event); 9452 }); 9453 } else if (trigger !== Trigger.MANUAL) { 9454 var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; 9455 var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; 9456 $2(_this4.element).on(eventIn, _this4.config.selector, function(event) { 9457 return _this4._enter(event); 9458 }).on(eventOut, _this4.config.selector, function(event) { 9459 return _this4._leave(event); 9460 }); 9461 } 9462 }); 9463 $2(this.element).closest(".modal").on("hide.bs.modal", function() { 9464 if (_this4.element) { 9465 _this4.hide(); 9466 } 9467 }); 9468 if (this.config.selector) { 9469 this.config = _objectSpread({}, this.config, { 9470 trigger: "manual", 9471 selector: "" 9472 }); 9473 } else { 9474 this._fixTitle(); 9475 } 9476 }; 9477 _proto._fixTitle = function _fixTitle() { 9478 var titleType = typeof this.element.getAttribute("data-original-title"); 9479 if (this.element.getAttribute("title") || titleType !== "string") { 9480 this.element.setAttribute("data-original-title", this.element.getAttribute("title") || ""); 9481 this.element.setAttribute("title", ""); 9482 } 9483 }; 9484 _proto._enter = function _enter(event, context) { 9485 var dataKey = this.constructor.DATA_KEY; 9486 context = context || $2(event.currentTarget).data(dataKey); 9487 if (!context) { 9488 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 9489 $2(event.currentTarget).data(dataKey, context); 9490 } 9491 if (event) { 9492 context._activeTrigger[event.type === "focusin" ? Trigger.FOCUS : Trigger.HOVER] = true; 9493 } 9494 if ($2(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 9495 context._hoverState = HoverState.SHOW; 9496 return; 9497 } 9498 clearTimeout(context._timeout); 9499 context._hoverState = HoverState.SHOW; 9500 if (!context.config.delay || !context.config.delay.show) { 9501 context.show(); 9502 return; 9503 } 9504 context._timeout = setTimeout(function() { 9505 if (context._hoverState === HoverState.SHOW) { 9506 context.show(); 9507 } 9508 }, context.config.delay.show); 9509 }; 9510 _proto._leave = function _leave(event, context) { 9511 var dataKey = this.constructor.DATA_KEY; 9512 context = context || $2(event.currentTarget).data(dataKey); 9513 if (!context) { 9514 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 9515 $2(event.currentTarget).data(dataKey, context); 9516 } 9517 if (event) { 9518 context._activeTrigger[event.type === "focusout" ? Trigger.FOCUS : Trigger.HOVER] = false; 9519 } 9520 if (context._isWithActiveTrigger()) { 9521 return; 9522 } 9523 clearTimeout(context._timeout); 9524 context._hoverState = HoverState.OUT; 9525 if (!context.config.delay || !context.config.delay.hide) { 9526 context.hide(); 9527 return; 9528 } 9529 context._timeout = setTimeout(function() { 9530 if (context._hoverState === HoverState.OUT) { 9531 context.hide(); 9532 } 9533 }, context.config.delay.hide); 9534 }; 9535 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 9536 for (var trigger in this._activeTrigger) { 9537 if (this._activeTrigger[trigger]) { 9538 return true; 9539 } 9540 } 9541 return false; 9542 }; 9543 _proto._getConfig = function _getConfig(config) { 9544 var dataAttributes = $2(this.element).data(); 9545 Object.keys(dataAttributes).forEach(function(dataAttr) { 9546 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 9547 delete dataAttributes[dataAttr]; 9548 } 9549 }); 9550 config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === "object" && config ? config : {}); 9551 if (typeof config.delay === "number") { 9552 config.delay = { 9553 show: config.delay, 9554 hide: config.delay 9555 }; 9556 } 9557 if (typeof config.title === "number") { 9558 config.title = config.title.toString(); 9559 } 9560 if (typeof config.content === "number") { 9561 config.content = config.content.toString(); 9562 } 9563 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 9564 if (config.sanitize) { 9565 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 9566 } 9567 return config; 9568 }; 9569 _proto._getDelegateConfig = function _getDelegateConfig() { 9570 var config = {}; 9571 if (this.config) { 9572 for (var key in this.config) { 9573 if (this.constructor.Default[key] !== this.config[key]) { 9574 config[key] = this.config[key]; 9575 } 9576 } 9577 } 9578 return config; 9579 }; 9580 _proto._cleanTipClass = function _cleanTipClass() { 9581 var $tip = $2(this.getTipElement()); 9582 var tabClass = $tip.attr("class").match(BSCLS_PREFIX_REGEX); 9583 if (tabClass !== null && tabClass.length) { 9584 $tip.removeClass(tabClass.join("")); 9585 } 9586 }; 9587 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 9588 var popperInstance = popperData.instance; 9589 this.tip = popperInstance.popper; 9590 this._cleanTipClass(); 9591 this.addAttachmentClass(this._getAttachment(popperData.placement)); 9592 }; 9593 _proto._fixTransition = function _fixTransition() { 9594 var tip = this.getTipElement(); 9595 var initConfigAnimation = this.config.animation; 9596 if (tip.getAttribute("x-placement") !== null) { 9597 return; 9598 } 9599 $2(tip).removeClass(ClassName$6.FADE); 9600 this.config.animation = false; 9601 this.hide(); 9602 this.show(); 9603 this.config.animation = initConfigAnimation; 9604 }; 9605 Tooltip._jQueryInterface = function _jQueryInterface(config) { 9606 return this.each(function() { 9607 var data = $2(this).data(DATA_KEY$6); 9608 var _config = typeof config === "object" && config; 9609 if (!data && /dispose|hide/.test(config)) { 9610 return; 9611 } 9612 if (!data) { 9613 data = new Tooltip(this, _config); 9614 $2(this).data(DATA_KEY$6, data); 9615 } 9616 if (typeof config === "string") { 9617 if (typeof data[config] === "undefined") { 9618 throw new TypeError('No method named "' + config + '"'); 9619 } 9620 data[config](); 9621 } 9622 }); 9623 }; 9624 _createClass(Tooltip, null, [{ 9625 key: "VERSION", 9626 get: function get() { 9627 return VERSION$6; 9628 } 9629 }, { 9630 key: "Default", 9631 get: function get() { 9632 return Default$4; 9633 } 9634 }, { 9635 key: "NAME", 9636 get: function get() { 9637 return NAME$6; 9638 } 9639 }, { 9640 key: "DATA_KEY", 9641 get: function get() { 9642 return DATA_KEY$6; 9643 } 9644 }, { 9645 key: "Event", 9646 get: function get() { 9647 return Event$6; 9648 } 9649 }, { 9650 key: "EVENT_KEY", 9651 get: function get() { 9652 return EVENT_KEY$6; 9653 } 9654 }, { 9655 key: "DefaultType", 9656 get: function get() { 9657 return DefaultType$4; 9658 } 9659 }]); 9660 return Tooltip; 9661 }(); 9662 $2.fn[NAME$6] = Tooltip._jQueryInterface; 9663 $2.fn[NAME$6].Constructor = Tooltip; 9664 $2.fn[NAME$6].noConflict = function() { 9665 $2.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 9666 return Tooltip._jQueryInterface; 9667 }; 9668 var NAME$7 = "popover"; 9669 var VERSION$7 = "4.3.1"; 9670 var DATA_KEY$7 = "bs.popover"; 9671 var EVENT_KEY$7 = "." + DATA_KEY$7; 9672 var JQUERY_NO_CONFLICT$7 = $2.fn[NAME$7]; 9673 var CLASS_PREFIX$1 = "bs-popover"; 9674 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", "g"); 9675 var Default$5 = _objectSpread({}, Tooltip.Default, { 9676 placement: "right", 9677 trigger: "click", 9678 content: "", 9679 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 9680 }); 9681 var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { 9682 content: "(string|element|function)" 9683 }); 9684 var ClassName$7 = { 9685 FADE: "fade", 9686 SHOW: "show" 9687 }; 9688 var Selector$7 = { 9689 TITLE: ".popover-header", 9690 CONTENT: ".popover-body" 9691 }; 9692 var Event$7 = { 9693 HIDE: "hide" + EVENT_KEY$7, 9694 HIDDEN: "hidden" + EVENT_KEY$7, 9695 SHOW: "show" + EVENT_KEY$7, 9696 SHOWN: "shown" + EVENT_KEY$7, 9697 INSERTED: "inserted" + EVENT_KEY$7, 9698 CLICK: "click" + EVENT_KEY$7, 9699 FOCUSIN: "focusin" + EVENT_KEY$7, 9700 FOCUSOUT: "focusout" + EVENT_KEY$7, 9701 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 9702 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 9703 }; 9704 var Popover = /* @__PURE__ */ function(_Tooltip) { 9705 _inheritsLoose(Popover, _Tooltip); 9706 function Popover() { 9707 return _Tooltip.apply(this, arguments) || this; 9708 } 9709 var _proto = Popover.prototype; 9710 _proto.isWithContent = function isWithContent() { 9711 return this.getTitle() || this._getContent(); 9712 }; 9713 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 9714 $2(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 9715 }; 9716 _proto.getTipElement = function getTipElement() { 9717 this.tip = this.tip || $2(this.config.template)[0]; 9718 return this.tip; 9719 }; 9720 _proto.setContent = function setContent() { 9721 var $tip = $2(this.getTipElement()); 9722 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 9723 var content = this._getContent(); 9724 if (typeof content === "function") { 9725 content = content.call(this.element); 9726 } 9727 this.setElementContent($tip.find(Selector$7.CONTENT), content); 9728 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 9729 }; 9730 _proto._getContent = function _getContent() { 9731 return this.element.getAttribute("data-content") || this.config.content; 9732 }; 9733 _proto._cleanTipClass = function _cleanTipClass() { 9734 var $tip = $2(this.getTipElement()); 9735 var tabClass = $tip.attr("class").match(BSCLS_PREFIX_REGEX$1); 9736 if (tabClass !== null && tabClass.length > 0) { 9737 $tip.removeClass(tabClass.join("")); 9738 } 9739 }; 9740 Popover._jQueryInterface = function _jQueryInterface(config) { 9741 return this.each(function() { 9742 var data = $2(this).data(DATA_KEY$7); 9743 var _config = typeof config === "object" ? config : null; 9744 if (!data && /dispose|hide/.test(config)) { 9745 return; 9746 } 9747 if (!data) { 9748 data = new Popover(this, _config); 9749 $2(this).data(DATA_KEY$7, data); 9750 } 9751 if (typeof config === "string") { 9752 if (typeof data[config] === "undefined") { 9753 throw new TypeError('No method named "' + config + '"'); 9754 } 9755 data[config](); 9756 } 9757 }); 9758 }; 9759 _createClass(Popover, null, [{ 9760 key: "VERSION", 9761 get: function get() { 9762 return VERSION$7; 9763 } 9764 }, { 9765 key: "Default", 9766 get: function get() { 9767 return Default$5; 9768 } 9769 }, { 9770 key: "NAME", 9771 get: function get() { 9772 return NAME$7; 9773 } 9774 }, { 9775 key: "DATA_KEY", 9776 get: function get() { 9777 return DATA_KEY$7; 9778 } 9779 }, { 9780 key: "Event", 9781 get: function get() { 9782 return Event$7; 9783 } 9784 }, { 9785 key: "EVENT_KEY", 9786 get: function get() { 9787 return EVENT_KEY$7; 9788 } 9789 }, { 9790 key: "DefaultType", 9791 get: function get() { 9792 return DefaultType$5; 9793 } 9794 }]); 9795 return Popover; 9796 }(Tooltip); 9797 $2.fn[NAME$7] = Popover._jQueryInterface; 9798 $2.fn[NAME$7].Constructor = Popover; 9799 $2.fn[NAME$7].noConflict = function() { 9800 $2.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 9801 return Popover._jQueryInterface; 9802 }; 9803 var NAME$8 = "scrollspy"; 9804 var VERSION$8 = "4.3.1"; 9805 var DATA_KEY$8 = "bs.scrollspy"; 9806 var EVENT_KEY$8 = "." + DATA_KEY$8; 9807 var DATA_API_KEY$6 = ".data-api"; 9808 var JQUERY_NO_CONFLICT$8 = $2.fn[NAME$8]; 9809 var Default$6 = { 9810 offset: 10, 9811 method: "auto", 9812 target: "" 9813 }; 9814 var DefaultType$6 = { 9815 offset: "number", 9816 method: "string", 9817 target: "(string|element)" 9818 }; 9819 var Event$8 = { 9820 ACTIVATE: "activate" + EVENT_KEY$8, 9821 SCROLL: "scroll" + EVENT_KEY$8, 9822 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 9823 }; 9824 var ClassName$8 = { 9825 DROPDOWN_ITEM: "dropdown-item", 9826 DROPDOWN_MENU: "dropdown-menu", 9827 ACTIVE: "active" 9828 }; 9829 var Selector$8 = { 9830 DATA_SPY: '[data-spy="scroll"]', 9831 ACTIVE: ".active", 9832 NAV_LIST_GROUP: ".nav, .list-group", 9833 NAV_LINKS: ".nav-link", 9834 NAV_ITEMS: ".nav-item", 9835 LIST_ITEMS: ".list-group-item", 9836 DROPDOWN: ".dropdown", 9837 DROPDOWN_ITEMS: ".dropdown-item", 9838 DROPDOWN_TOGGLE: ".dropdown-toggle" 9839 }; 9840 var OffsetMethod = { 9841 OFFSET: "offset", 9842 POSITION: "position" 9843 }; 9844 var ScrollSpy = /* @__PURE__ */ function() { 9845 function ScrollSpy(element, config) { 9846 var _this = this; 9847 this._element = element; 9848 this._scrollElement = element.tagName === "BODY" ? window : element; 9849 this._config = this._getConfig(config); 9850 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 9851 this._offsets = []; 9852 this._targets = []; 9853 this._activeTarget = null; 9854 this._scrollHeight = 0; 9855 $2(this._scrollElement).on(Event$8.SCROLL, function(event) { 9856 return _this._process(event); 9857 }); 9858 this.refresh(); 9859 this._process(); 9860 } 9861 var _proto = ScrollSpy.prototype; 9862 _proto.refresh = function refresh() { 9863 var _this2 = this; 9864 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 9865 var offsetMethod = this._config.method === "auto" ? autoMethod : this._config.method; 9866 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 9867 this._offsets = []; 9868 this._targets = []; 9869 this._scrollHeight = this._getScrollHeight(); 9870 var targets = [].slice.call(document.querySelectorAll(this._selector)); 9871 targets.map(function(element) { 9872 var target; 9873 var targetSelector = Util.getSelectorFromElement(element); 9874 if (targetSelector) { 9875 target = document.querySelector(targetSelector); 9876 } 9877 if (target) { 9878 var targetBCR = target.getBoundingClientRect(); 9879 if (targetBCR.width || targetBCR.height) { 9880 return [$2(target)[offsetMethod]().top + offsetBase, targetSelector]; 9881 } 9882 } 9883 return null; 9884 }).filter(function(item) { 9885 return item; 9886 }).sort(function(a, b) { 9887 return a[0] - b[0]; 9888 }).forEach(function(item) { 9889 _this2._offsets.push(item[0]); 9890 _this2._targets.push(item[1]); 9891 }); 9892 }; 9893 _proto.dispose = function dispose() { 9894 $2.removeData(this._element, DATA_KEY$8); 9895 $2(this._scrollElement).off(EVENT_KEY$8); 9896 this._element = null; 9897 this._scrollElement = null; 9898 this._config = null; 9899 this._selector = null; 9900 this._offsets = null; 9901 this._targets = null; 9902 this._activeTarget = null; 9903 this._scrollHeight = null; 9904 }; 9905 _proto._getConfig = function _getConfig(config) { 9906 config = _objectSpread({}, Default$6, typeof config === "object" && config ? config : {}); 9907 if (typeof config.target !== "string") { 9908 var id = $2(config.target).attr("id"); 9909 if (!id) { 9910 id = Util.getUID(NAME$8); 9911 $2(config.target).attr("id", id); 9912 } 9913 config.target = "#" + id; 9914 } 9915 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 9916 return config; 9917 }; 9918 _proto._getScrollTop = function _getScrollTop() { 9919 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 9920 }; 9921 _proto._getScrollHeight = function _getScrollHeight() { 9922 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 9923 }; 9924 _proto._getOffsetHeight = function _getOffsetHeight() { 9925 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 9926 }; 9927 _proto._process = function _process() { 9928 var scrollTop = this._getScrollTop() + this._config.offset; 9929 var scrollHeight = this._getScrollHeight(); 9930 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 9931 if (this._scrollHeight !== scrollHeight) { 9932 this.refresh(); 9933 } 9934 if (scrollTop >= maxScroll) { 9935 var target = this._targets[this._targets.length - 1]; 9936 if (this._activeTarget !== target) { 9937 this._activate(target); 9938 } 9939 return; 9940 } 9941 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 9942 this._activeTarget = null; 9943 this._clear(); 9944 return; 9945 } 9946 var offsetLength = this._offsets.length; 9947 for (var i = offsetLength;i--; ) { 9948 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === "undefined" || scrollTop < this._offsets[i + 1]); 9949 if (isActiveTarget) { 9950 this._activate(this._targets[i]); 9951 } 9952 } 9953 }; 9954 _proto._activate = function _activate(target) { 9955 this._activeTarget = target; 9956 this._clear(); 9957 var queries = this._selector.split(",").map(function(selector) { 9958 return selector + '[data-target="' + target + '"],' + selector + '[href="' + target + '"]'; 9959 }); 9960 var $link = $2([].slice.call(document.querySelectorAll(queries.join(",")))); 9961 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 9962 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 9963 $link.addClass(ClassName$8.ACTIVE); 9964 } else { 9965 $link.addClass(ClassName$8.ACTIVE); 9966 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); 9967 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 9968 } 9969 $2(this._scrollElement).trigger(Event$8.ACTIVATE, { 9970 relatedTarget: target 9971 }); 9972 }; 9973 _proto._clear = function _clear() { 9974 [].slice.call(document.querySelectorAll(this._selector)).filter(function(node) { 9975 return node.classList.contains(ClassName$8.ACTIVE); 9976 }).forEach(function(node) { 9977 return node.classList.remove(ClassName$8.ACTIVE); 9978 }); 9979 }; 9980 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 9981 return this.each(function() { 9982 var data = $2(this).data(DATA_KEY$8); 9983 var _config = typeof config === "object" && config; 9984 if (!data) { 9985 data = new ScrollSpy(this, _config); 9986 $2(this).data(DATA_KEY$8, data); 9987 } 9988 if (typeof config === "string") { 9989 if (typeof data[config] === "undefined") { 9990 throw new TypeError('No method named "' + config + '"'); 9991 } 9992 data[config](); 9993 } 9994 }); 9995 }; 9996 _createClass(ScrollSpy, null, [{ 9997 key: "VERSION", 9998 get: function get() { 9999 return VERSION$8; 10000 } 10001 }, { 10002 key: "Default", 10003 get: function get() { 10004 return Default$6; 10005 } 10006 }]); 10007 return ScrollSpy; 10008 }(); 10009 $2(window).on(Event$8.LOAD_DATA_API, function() { 10010 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 10011 var scrollSpysLength = scrollSpys.length; 10012 for (var i = scrollSpysLength;i--; ) { 10013 var $spy = $2(scrollSpys[i]); 10014 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 10015 } 10016 }); 10017 $2.fn[NAME$8] = ScrollSpy._jQueryInterface; 10018 $2.fn[NAME$8].Constructor = ScrollSpy; 10019 $2.fn[NAME$8].noConflict = function() { 10020 $2.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 10021 return ScrollSpy._jQueryInterface; 10022 }; 10023 var NAME$9 = "tab"; 10024 var VERSION$9 = "4.3.1"; 10025 var DATA_KEY$9 = "bs.tab"; 10026 var EVENT_KEY$9 = "." + DATA_KEY$9; 10027 var DATA_API_KEY$7 = ".data-api"; 10028 var JQUERY_NO_CONFLICT$9 = $2.fn[NAME$9]; 10029 var Event$9 = { 10030 HIDE: "hide" + EVENT_KEY$9, 10031 HIDDEN: "hidden" + EVENT_KEY$9, 10032 SHOW: "show" + EVENT_KEY$9, 10033 SHOWN: "shown" + EVENT_KEY$9, 10034 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 10035 }; 10036 var ClassName$9 = { 10037 DROPDOWN_MENU: "dropdown-menu", 10038 ACTIVE: "active", 10039 DISABLED: "disabled", 10040 FADE: "fade", 10041 SHOW: "show" 10042 }; 10043 var Selector$9 = { 10044 DROPDOWN: ".dropdown", 10045 NAV_LIST_GROUP: ".nav, .list-group", 10046 ACTIVE: ".active", 10047 ACTIVE_UL: "> li > .active", 10048 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 10049 DROPDOWN_TOGGLE: ".dropdown-toggle", 10050 DROPDOWN_ACTIVE_CHILD: "> .dropdown-menu .active" 10051 }; 10052 var Tab = /* @__PURE__ */ function() { 10053 function Tab(element) { 10054 this._element = element; 10055 } 10056 var _proto = Tab.prototype; 10057 _proto.show = function show() { 10058 var _this = this; 10059 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $2(this._element).hasClass(ClassName$9.ACTIVE) || $2(this._element).hasClass(ClassName$9.DISABLED)) { 10060 return; 10061 } 10062 var target; 10063 var previous; 10064 var listElement = $2(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 10065 var selector = Util.getSelectorFromElement(this._element); 10066 if (listElement) { 10067 var itemSelector = listElement.nodeName === "UL" || listElement.nodeName === "OL" ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 10068 previous = $2.makeArray($2(listElement).find(itemSelector)); 10069 previous = previous[previous.length - 1]; 10070 } 10071 var hideEvent = $2.Event(Event$9.HIDE, { 10072 relatedTarget: this._element 10073 }); 10074 var showEvent = $2.Event(Event$9.SHOW, { 10075 relatedTarget: previous 10076 }); 10077 if (previous) { 10078 $2(previous).trigger(hideEvent); 10079 } 10080 $2(this._element).trigger(showEvent); 10081 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 10082 return; 10083 } 10084 if (selector) { 10085 target = document.querySelector(selector); 10086 } 10087 this._activate(this._element, listElement); 10088 var complete = function complete() { 10089 var hiddenEvent = $2.Event(Event$9.HIDDEN, { 10090 relatedTarget: _this._element 10091 }); 10092 var shownEvent = $2.Event(Event$9.SHOWN, { 10093 relatedTarget: previous 10094 }); 10095 $2(previous).trigger(hiddenEvent); 10096 $2(_this._element).trigger(shownEvent); 10097 }; 10098 if (target) { 10099 this._activate(target, target.parentNode, complete); 10100 } else { 10101 complete(); 10102 } 10103 }; 10104 _proto.dispose = function dispose() { 10105 $2.removeData(this._element, DATA_KEY$9); 10106 this._element = null; 10107 }; 10108 _proto._activate = function _activate(element, container, callback) { 10109 var _this2 = this; 10110 var activeElements = container && (container.nodeName === "UL" || container.nodeName === "OL") ? $2(container).find(Selector$9.ACTIVE_UL) : $2(container).children(Selector$9.ACTIVE); 10111 var active = activeElements[0]; 10112 var isTransitioning = callback && active && $2(active).hasClass(ClassName$9.FADE); 10113 var complete = function complete() { 10114 return _this2._transitionComplete(element, active, callback); 10115 }; 10116 if (active && isTransitioning) { 10117 var transitionDuration = Util.getTransitionDurationFromElement(active); 10118 $2(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 10119 } else { 10120 complete(); 10121 } 10122 }; 10123 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 10124 if (active) { 10125 $2(active).removeClass(ClassName$9.ACTIVE); 10126 var dropdownChild = $2(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 10127 if (dropdownChild) { 10128 $2(dropdownChild).removeClass(ClassName$9.ACTIVE); 10129 } 10130 if (active.getAttribute("role") === "tab") { 10131 active.setAttribute("aria-selected", false); 10132 } 10133 } 10134 $2(element).addClass(ClassName$9.ACTIVE); 10135 if (element.getAttribute("role") === "tab") { 10136 element.setAttribute("aria-selected", true); 10137 } 10138 Util.reflow(element); 10139 if (element.classList.contains(ClassName$9.FADE)) { 10140 element.classList.add(ClassName$9.SHOW); 10141 } 10142 if (element.parentNode && $2(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 10143 var dropdownElement = $2(element).closest(Selector$9.DROPDOWN)[0]; 10144 if (dropdownElement) { 10145 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 10146 $2(dropdownToggleList).addClass(ClassName$9.ACTIVE); 10147 } 10148 element.setAttribute("aria-expanded", true); 10149 } 10150 if (callback) { 10151 callback(); 10152 } 10153 }; 10154 Tab._jQueryInterface = function _jQueryInterface(config) { 10155 return this.each(function() { 10156 var $this = $2(this); 10157 var data = $this.data(DATA_KEY$9); 10158 if (!data) { 10159 data = new Tab(this); 10160 $this.data(DATA_KEY$9, data); 10161 } 10162 if (typeof config === "string") { 10163 if (typeof data[config] === "undefined") { 10164 throw new TypeError('No method named "' + config + '"'); 10165 } 10166 data[config](); 10167 } 10168 }); 10169 }; 10170 _createClass(Tab, null, [{ 10171 key: "VERSION", 10172 get: function get() { 10173 return VERSION$9; 10174 } 10175 }]); 10176 return Tab; 10177 }(); 10178 $2(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function(event) { 10179 event.preventDefault(); 10180 Tab._jQueryInterface.call($2(this), "show"); 10181 }); 10182 $2.fn[NAME$9] = Tab._jQueryInterface; 10183 $2.fn[NAME$9].Constructor = Tab; 10184 $2.fn[NAME$9].noConflict = function() { 10185 $2.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 10186 return Tab._jQueryInterface; 10187 }; 10188 var NAME$a = "toast"; 10189 var VERSION$a = "4.3.1"; 10190 var DATA_KEY$a = "bs.toast"; 10191 var EVENT_KEY$a = "." + DATA_KEY$a; 10192 var JQUERY_NO_CONFLICT$a = $2.fn[NAME$a]; 10193 var Event$a = { 10194 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 10195 HIDE: "hide" + EVENT_KEY$a, 10196 HIDDEN: "hidden" + EVENT_KEY$a, 10197 SHOW: "show" + EVENT_KEY$a, 10198 SHOWN: "shown" + EVENT_KEY$a 10199 }; 10200 var ClassName$a = { 10201 FADE: "fade", 10202 HIDE: "hide", 10203 SHOW: "show", 10204 SHOWING: "showing" 10205 }; 10206 var DefaultType$7 = { 10207 animation: "boolean", 10208 autohide: "boolean", 10209 delay: "number" 10210 }; 10211 var Default$7 = { 10212 animation: true, 10213 autohide: true, 10214 delay: 500 10215 }; 10216 var Selector$a = { 10217 DATA_DISMISS: '[data-dismiss="toast"]' 10218 }; 10219 var Toast = /* @__PURE__ */ function() { 10220 function Toast(element, config) { 10221 this._element = element; 10222 this._config = this._getConfig(config); 10223 this._timeout = null; 10224 this._setListeners(); 10225 } 10226 var _proto = Toast.prototype; 10227 _proto.show = function show() { 10228 var _this = this; 10229 $2(this._element).trigger(Event$a.SHOW); 10230 if (this._config.animation) { 10231 this._element.classList.add(ClassName$a.FADE); 10232 } 10233 var complete = function complete() { 10234 _this._element.classList.remove(ClassName$a.SHOWING); 10235 _this._element.classList.add(ClassName$a.SHOW); 10236 $2(_this._element).trigger(Event$a.SHOWN); 10237 if (_this._config.autohide) { 10238 _this.hide(); 10239 } 10240 }; 10241 this._element.classList.remove(ClassName$a.HIDE); 10242 this._element.classList.add(ClassName$a.SHOWING); 10243 if (this._config.animation) { 10244 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 10245 $2(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 10246 } else { 10247 complete(); 10248 } 10249 }; 10250 _proto.hide = function hide(withoutTimeout) { 10251 var _this2 = this; 10252 if (!this._element.classList.contains(ClassName$a.SHOW)) { 10253 return; 10254 } 10255 $2(this._element).trigger(Event$a.HIDE); 10256 if (withoutTimeout) { 10257 this._close(); 10258 } else { 10259 this._timeout = setTimeout(function() { 10260 _this2._close(); 10261 }, this._config.delay); 10262 } 10263 }; 10264 _proto.dispose = function dispose() { 10265 clearTimeout(this._timeout); 10266 this._timeout = null; 10267 if (this._element.classList.contains(ClassName$a.SHOW)) { 10268 this._element.classList.remove(ClassName$a.SHOW); 10269 } 10270 $2(this._element).off(Event$a.CLICK_DISMISS); 10271 $2.removeData(this._element, DATA_KEY$a); 10272 this._element = null; 10273 this._config = null; 10274 }; 10275 _proto._getConfig = function _getConfig(config) { 10276 config = _objectSpread({}, Default$7, $2(this._element).data(), typeof config === "object" && config ? config : {}); 10277 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 10278 return config; 10279 }; 10280 _proto._setListeners = function _setListeners() { 10281 var _this3 = this; 10282 $2(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function() { 10283 return _this3.hide(true); 10284 }); 10285 }; 10286 _proto._close = function _close() { 10287 var _this4 = this; 10288 var complete = function complete() { 10289 _this4._element.classList.add(ClassName$a.HIDE); 10290 $2(_this4._element).trigger(Event$a.HIDDEN); 10291 }; 10292 this._element.classList.remove(ClassName$a.SHOW); 10293 if (this._config.animation) { 10294 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 10295 $2(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 10296 } else { 10297 complete(); 10298 } 10299 }; 10300 Toast._jQueryInterface = function _jQueryInterface(config) { 10301 return this.each(function() { 10302 var $element = $2(this); 10303 var data = $element.data(DATA_KEY$a); 10304 var _config = typeof config === "object" && config; 10305 if (!data) { 10306 data = new Toast(this, _config); 10307 $element.data(DATA_KEY$a, data); 10308 } 10309 if (typeof config === "string") { 10310 if (typeof data[config] === "undefined") { 10311 throw new TypeError('No method named "' + config + '"'); 10312 } 10313 data[config](this); 10314 } 10315 }); 10316 }; 10317 _createClass(Toast, null, [{ 10318 key: "VERSION", 10319 get: function get() { 10320 return VERSION$a; 10321 } 10322 }, { 10323 key: "DefaultType", 10324 get: function get() { 10325 return DefaultType$7; 10326 } 10327 }, { 10328 key: "Default", 10329 get: function get() { 10330 return Default$7; 10331 } 10332 }]); 10333 return Toast; 10334 }(); 10335 $2.fn[NAME$a] = Toast._jQueryInterface; 10336 $2.fn[NAME$a].Constructor = Toast; 10337 $2.fn[NAME$a].noConflict = function() { 10338 $2.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 10339 return Toast._jQueryInterface; 10340 }; 10341 (function() { 10342 if (typeof $2 === "undefined") { 10343 throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript."); 10344 } 10345 var version = $2.fn.jquery.split(" ")[0].split("."); 10346 var minMajor = 1; 10347 var ltMajor = 2; 10348 var minMinor = 9; 10349 var minPatch = 1; 10350 var maxMajor = 4; 10351 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 10352 throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0"); 10353 } 10354 })(); 10355 exports3.Util = Util; 10356 exports3.Alert = Alert; 10357 exports3.Button = Button; 10358 exports3.Carousel = Carousel; 10359 exports3.Collapse = Collapse; 10360 exports3.Dropdown = Dropdown; 10361 exports3.Modal = Modal; 10362 exports3.Popover = Popover; 10363 exports3.Scrollspy = ScrollSpy; 10364 exports3.Tab = Tab; 10365 exports3.Toast = Toast; 10366 exports3.Tooltip = Tooltip; 10367 Object.defineProperty(exports3, "__esModule", { value: true }); 10368 }); 10369}); 10370
vendor: 8,283 bytes, lines 10371-10555
10371// node_modules/vanilla-lazyload/dist/lazyload.min.js 10372var require_lazyload_min = __commonJS(function(exports2, module2) { 10373 function _extends() { 10374 return (_extends = Object.assign || function(t) { 10375 for (var e = 1;e < arguments.length; e++) { 10376 var n = arguments[e]; 10377 for (var o in n) 10378 Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]); 10379 } 10380 return t; 10381 }).apply(this, arguments); 10382 } 10383 function _typeof(t) { 10384 return (_typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) { 10385 return typeof t; 10386 } : function(t) { 10387 return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; 10388 })(t); 10389 } 10390 (function(t, e) { 10391 (typeof exports2 == "undefined" ? "undefined" : _typeof(exports2)) === "object" && typeof module2 != "undefined" ? module2.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = t || self).LazyLoad = e(); 10392 })(exports2, function() { 10393 var t = typeof window != "undefined", e = t && !("onscroll" in window) || typeof navigator != "undefined" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), n = t && "IntersectionObserver" in window, o = t && "classList" in document.createElement("p"), r = { elements_selector: "img", container: e || t ? document : null, threshold: 300, thresholds: null, data_src: "src", data_srcset: "srcset", data_sizes: "sizes", data_bg: "bg", data_poster: "poster", class_loading: "loading", class_loaded: "loaded", class_error: "error", load_delay: 0, auto_unobserve: true, callback_enter: null, callback_exit: null, callback_reveal: null, callback_loaded: null, callback_error: null, callback_finish: null, use_native: false }, a = function(t, e) { 10394 var n, o = new t(e); 10395 try { 10396 n = new CustomEvent("LazyLoad::Initialized", { detail: { instance: o } }); 10397 } catch (t) { 10398 (n = document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized", false, false, { instance: o }); 10399 } 10400 window.dispatchEvent(n); 10401 }; 10402 var s = function(t, e) { 10403 return t.getAttribute("data-" + e); 10404 }, i = function(t, e, n) { 10405 var o = "data-" + e; 10406 n !== null ? t.setAttribute(o, n) : t.removeAttribute(o); 10407 }, c = function(t) { 10408 return s(t, "was-processed") === "true"; 10409 }, l = function(t, e) { 10410 return i(t, "ll-timeout", e); 10411 }, u = function(t) { 10412 return s(t, "ll-timeout"); 10413 }, d = function(t, e, n, o) { 10414 t && (o === undefined ? n === undefined ? t(e) : t(e, n) : t(e, n, o)); 10415 }, f = function(t, e) { 10416 t.loadingCount += e, t._elements.length === 0 && t.loadingCount === 0 && d(t._settings.callback_finish, t); 10417 }, _ = function(t) { 10418 for (var e, n = [], o = 0;e = t.children[o]; o += 1) 10419 e.tagName === "SOURCE" && n.push(e); 10420 return n; 10421 }, v = function(t, e, n) { 10422 n && t.setAttribute(e, n); 10423 }, g = function(t, e) { 10424 v(t, "sizes", s(t, e.data_sizes)), v(t, "srcset", s(t, e.data_srcset)), v(t, "src", s(t, e.data_src)); 10425 }, m2 = { IMG: function(t, e) { 10426 var n = t.parentNode; 10427 n && n.tagName === "PICTURE" && _(n).forEach(function(t) { 10428 g(t, e); 10429 }); 10430 g(t, e); 10431 }, IFRAME: function(t, e) { 10432 v(t, "src", s(t, e.data_src)); 10433 }, VIDEO: function(t, e) { 10434 _(t).forEach(function(t) { 10435 v(t, "src", s(t, e.data_src)); 10436 }), v(t, "poster", s(t, e.data_poster)), v(t, "src", s(t, e.data_src)), t.load(); 10437 } }, h = function(t, e) { 10438 var n, o, r = e._settings, a = t.tagName, i = m2[a]; 10439 if (i) 10440 return i(t, r), f(e, 1), void (e._elements = (n = e._elements, o = t, n.filter(function(t) { 10441 return t !== o; 10442 }))); 10443 (function(t, e) { 10444 var n = s(t, e.data_src), o = s(t, e.data_bg); 10445 n && (t.style.backgroundImage = 'url("'.concat(n, '")')), o && (t.style.backgroundImage = o); 10446 })(t, r); 10447 }, p = function(t, e) { 10448 o ? t.classList.add(e) : t.className += (t.className ? " " : "") + e; 10449 }, b = function(t, e) { 10450 o ? t.classList.remove(e) : t.className = t.className.replace(new RegExp("(^|\\s+)" + e + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, ""); 10451 }, y = function(t, e, n) { 10452 t.addEventListener(e, n); 10453 }, E = function(t, e, n) { 10454 t.removeEventListener(e, n); 10455 }, w = function(t, e, n) { 10456 E(t, "load", e), E(t, "loadeddata", e), E(t, "error", n); 10457 }, I = function(t, e, n) { 10458 var o = n._settings, r = e ? o.class_loaded : o.class_error, a = e ? o.callback_loaded : o.callback_error, s = t.target; 10459 b(s, o.class_loading), p(s, r), d(a, s, n), f(n, -1); 10460 }, k = function(t, e) { 10461 var n = function n(r) { 10462 I(r, true, e), w(t, n, o); 10463 }, o = function o(r) { 10464 I(r, false, e), w(t, n, o); 10465 }; 10466 (function(t, e, n) { 10467 y(t, "load", e), y(t, "loadeddata", e), y(t, "error", n); 10468 })(t, n, o); 10469 }, A = ["IMG", "IFRAME", "VIDEO"], L = function(t, e) { 10470 var n = e._observer; 10471 O(t, e), n && e._settings.auto_unobserve && n.unobserve(t); 10472 }, x = function(t) { 10473 var e = u(t); 10474 e && (clearTimeout(e), l(t, null)); 10475 }, z = function(t, e) { 10476 var n = e._settings.load_delay, o = u(t); 10477 o || (o = setTimeout(function() { 10478 L(t, e), x(t); 10479 }, n), l(t, o)); 10480 }, O = function(t, e, n) { 10481 var o = e._settings; 10482 !n && c(t) || (A.indexOf(t.tagName) > -1 && (k(t, e), p(t, o.class_loading)), h(t, e), function(t) { 10483 i(t, "was-processed", "true"); 10484 }(t), d(o.callback_reveal, t, e), d(o.callback_set, t, e)); 10485 }, N = function(t) { 10486 return !!n && (t._observer = new IntersectionObserver(function(e) { 10487 e.forEach(function(e) { 10488 return function(t) { 10489 return t.isIntersecting || t.intersectionRatio > 0; 10490 }(e) ? function(t, e, n) { 10491 var o = n._settings; 10492 d(o.callback_enter, t, e, n), o.load_delay ? z(t, n) : L(t, n); 10493 }(e.target, e, t) : function(t, e, n) { 10494 var o = n._settings; 10495 d(o.callback_exit, t, e, n), o.load_delay && x(t); 10496 }(e.target, e, t); 10497 }); 10498 }, { root: (e = t._settings).container === document ? null : e.container, rootMargin: e.thresholds || e.threshold + "px" }), true); 10499 var e; 10500 }, C = ["IMG", "IFRAME"], M = function(t, e) { 10501 return function(t) { 10502 return t.filter(function(t) { 10503 return !c(t); 10504 }); 10505 }((n = t || function(t) { 10506 return t.container.querySelectorAll(t.elements_selector); 10507 }(e), Array.prototype.slice.call(n))); 10508 var n; 10509 }, S = function(t) { 10510 var e = t._settings; 10511 e.container.querySelectorAll("." + e.class_error).forEach(function(t) { 10512 b(t, e.class_error), function(t) { 10513 i(t, "was-processed", null); 10514 }(t); 10515 }), t.update(); 10516 }, R = function(e, n) { 10517 var o; 10518 this._settings = function(t) { 10519 return _extends({}, r, t); 10520 }(e), this.loadingCount = 0, N(this), this.update(n), o = this, t && window.addEventListener("online", function(t) { 10521 S(o); 10522 }); 10523 }; 10524 return R.prototype = { update: function(t) { 10525 var n, o = this, r = this._settings; 10526 (this._elements = M(t, r), !e && this._observer) ? (function(t) { 10527 return t.use_native && "loading" in HTMLImageElement.prototype; 10528 }(r) && ((n = this)._elements.forEach(function(t) { 10529 C.indexOf(t.tagName) !== -1 && (t.setAttribute("loading", "lazy"), O(t, n)); 10530 }), this._elements = M(t, r)), this._elements.forEach(function(t) { 10531 o._observer.observe(t); 10532 })) : this.loadAll(); 10533 }, destroy: function() { 10534 var t = this; 10535 this._observer && (this._elements.forEach(function(e) { 10536 t._observer.unobserve(e); 10537 }), this._observer = null), this._elements = null, this._settings = null; 10538 }, load: function(t, e) { 10539 O(t, this, e); 10540 }, loadAll: function() { 10541 var t = this; 10542 this._elements.forEach(function(e) { 10543 L(e, t); 10544 }); 10545 } }, t && function(t, e) { 10546 if (e) 10547 if (e.length) 10548 for (var n, o = 0;n = e[o]; o += 1) 10549 a(t, n); 10550 else 10551 a(t, e); 10552 }(R, window.lazyLoadOptions), R; 10553 }); 10554}); 10555
vendor: 278 bytes, lines 10556-10564
10556// node_modules/@rails/actioncable/src/adapters.js 10557var adapters_default; 10558var init_adapters = __esm(() => { 10559 adapters_default = { 10560 logger: typeof console !== "undefined" ? console : undefined, 10561 WebSocket: typeof WebSocket !== "undefined" ? WebSocket : undefined 10562 }; 10563}); 10564
vendor: 316 bytes, lines 10565-10578
10565// node_modules/@rails/actioncable/src/logger.js 10566var logger_default; 10567var init_logger = __esm(() => { 10568 init_adapters(); 10569 logger_default = { 10570 log(...messages) { 10571 if (this.enabled) { 10572 messages.push(Date.now()); 10573 adapters_default.logger.log("[ActionCable]", ...messages); 10574 } 10575 } 10576 }; 10577}); 10578
vendor: 3,505 bytes, lines 10579-10677
10579// node_modules/@rails/actioncable/src/connection_monitor.js 10580class ConnectionMonitor { 10581 constructor(connection) { 10582 this.visibilityDidChange = this.visibilityDidChange.bind(this); 10583 this.connection = connection; 10584 this.reconnectAttempts = 0; 10585 } 10586 start() { 10587 if (!this.isRunning()) { 10588 this.startedAt = now(); 10589 delete this.stoppedAt; 10590 this.startPolling(); 10591 addEventListener("visibilitychange", this.visibilityDidChange); 10592 logger_default.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`); 10593 } 10594 } 10595 stop() { 10596 if (this.isRunning()) { 10597 this.stoppedAt = now(); 10598 this.stopPolling(); 10599 removeEventListener("visibilitychange", this.visibilityDidChange); 10600 logger_default.log("ConnectionMonitor stopped"); 10601 } 10602 } 10603 isRunning() { 10604 return this.startedAt && !this.stoppedAt; 10605 } 10606 recordMessage() { 10607 this.pingedAt = now(); 10608 } 10609 recordConnect() { 10610 this.reconnectAttempts = 0; 10611 delete this.disconnectedAt; 10612 logger_default.log("ConnectionMonitor recorded connect"); 10613 } 10614 recordDisconnect() { 10615 this.disconnectedAt = now(); 10616 logger_default.log("ConnectionMonitor recorded disconnect"); 10617 } 10618 startPolling() { 10619 this.stopPolling(); 10620 this.poll(); 10621 } 10622 stopPolling() { 10623 clearTimeout(this.pollTimeout); 10624 } 10625 poll() { 10626 this.pollTimeout = setTimeout(() => { 10627 this.reconnectIfStale(); 10628 this.poll(); 10629 }, this.getPollInterval()); 10630 } 10631 getPollInterval() { 10632 const { staleThreshold, reconnectionBackoffRate } = this.constructor; 10633 const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10)); 10634 const jitterMax = this.reconnectAttempts === 0 ? 1 : reconnectionBackoffRate; 10635 const jitter = jitterMax * Math.random(); 10636 return staleThreshold * 1000 * backoff * (1 + jitter); 10637 } 10638 reconnectIfStale() { 10639 if (this.connectionIsStale()) { 10640 logger_default.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`); 10641 this.reconnectAttempts++; 10642 if (this.disconnectedRecently()) { 10643 logger_default.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`); 10644 } else { 10645 logger_default.log("ConnectionMonitor reopening"); 10646 this.connection.reopen(); 10647 } 10648 } 10649 } 10650 get refreshedAt() { 10651 return this.pingedAt ? this.pingedAt : this.startedAt; 10652 } 10653 connectionIsStale() { 10654 return secondsSince(this.refreshedAt) > this.constructor.staleThreshold; 10655 } 10656 disconnectedRecently() { 10657 return this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold; 10658 } 10659 visibilityDidChange() { 10660 if (document.visibilityState === "visible") { 10661 setTimeout(() => { 10662 if (this.connectionIsStale() || !this.connection.isOpen()) { 10663 logger_default.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`); 10664 this.connection.reopen(); 10665 } 10666 }, 200); 10667 } 10668 } 10669} 10670var now = () => new Date().getTime(), secondsSince = (time) => (now() - time) / 1000, connection_monitor_default; 10671var init_connection_monitor = __esm(() => { 10672 init_logger(); 10673 ConnectionMonitor.staleThreshold = 6; 10674 ConnectionMonitor.reconnectionBackoffRate = 0.15; 10675 connection_monitor_default = ConnectionMonitor; 10676}); 10677
vendor: 621 bytes, lines 10678-10702
10678// node_modules/@rails/actioncable/src/internal.js 10679var internal_default; 10680var init_internal = __esm(() => { 10681 internal_default = { 10682 message_types: { 10683 welcome: "welcome", 10684 disconnect: "disconnect", 10685 ping: "ping", 10686 confirmation: "confirm_subscription", 10687 rejection: "reject_subscription" 10688 }, 10689 disconnect_reasons: { 10690 unauthorized: "unauthorized", 10691 invalid_request: "invalid_request", 10692 server_restart: "server_restart", 10693 remote: "remote" 10694 }, 10695 default_mount_path: "/cable", 10696 protocols: [ 10697 "actioncable-v1-json", 10698 "actioncable-unsupported" 10699 ] 10700 }; 10701}); 10702
vendor: 5,270 bytes, lines 10703-10867
10703// node_modules/@rails/actioncable/src/connection.js 10704class Connection { 10705 constructor(consumer) { 10706 this.open = this.open.bind(this); 10707 this.consumer = consumer; 10708 this.subscriptions = this.consumer.subscriptions; 10709 this.monitor = new connection_monitor_default(this); 10710 this.disconnected = true; 10711 } 10712 send(data) { 10713 if (this.isOpen()) { 10714 this.webSocket.send(JSON.stringify(data)); 10715 return true; 10716 } else { 10717 return false; 10718 } 10719 } 10720 open() { 10721 if (this.isActive()) { 10722 logger_default.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`); 10723 return false; 10724 } else { 10725 const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]; 10726 logger_default.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`); 10727 if (this.webSocket) { 10728 this.uninstallEventHandlers(); 10729 } 10730 this.webSocket = new adapters_default.WebSocket(this.consumer.url, socketProtocols); 10731 this.installEventHandlers(); 10732 this.monitor.start(); 10733 return true; 10734 } 10735 } 10736 close({ allowReconnect } = { allowReconnect: true }) { 10737 if (!allowReconnect) { 10738 this.monitor.stop(); 10739 } 10740 if (this.isOpen()) { 10741 return this.webSocket.close(); 10742 } 10743 } 10744 reopen() { 10745 logger_default.log(`Reopening WebSocket, current state is ${this.getState()}`); 10746 if (this.isActive()) { 10747 try { 10748 return this.close(); 10749 } catch (error) { 10750 logger_default.log("Failed to reopen WebSocket", error); 10751 } finally { 10752 logger_default.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`); 10753 setTimeout(this.open, this.constructor.reopenDelay); 10754 } 10755 } else { 10756 return this.open(); 10757 } 10758 } 10759 getProtocol() { 10760 if (this.webSocket) { 10761 return this.webSocket.protocol; 10762 } 10763 } 10764 isOpen() { 10765 return this.isState("open"); 10766 } 10767 isActive() { 10768 return this.isState("open", "connecting"); 10769 } 10770 triedToReconnect() { 10771 return this.monitor.reconnectAttempts > 0; 10772 } 10773 isProtocolSupported() { 10774 return indexOf.call(supportedProtocols, this.getProtocol()) >= 0; 10775 } 10776 isState(...states) { 10777 return indexOf.call(states, this.getState()) >= 0; 10778 } 10779 getState() { 10780 if (this.webSocket) { 10781 for (let state in adapters_default.WebSocket) { 10782 if (adapters_default.WebSocket[state] === this.webSocket.readyState) { 10783 return state.toLowerCase(); 10784 } 10785 } 10786 } 10787 return null; 10788 } 10789 installEventHandlers() { 10790 for (let eventName in this.events) { 10791 const handler = this.events[eventName].bind(this); 10792 this.webSocket[`on${eventName}`] = handler; 10793 } 10794 } 10795 uninstallEventHandlers() { 10796 for (let eventName in this.events) { 10797 this.webSocket[`on${eventName}`] = function() {}; 10798 } 10799 } 10800} 10801var message_types, protocols, supportedProtocols, indexOf, connection_default; 10802var init_connection = __esm(() => { 10803 init_adapters(); 10804 init_connection_monitor(); 10805 init_internal(); 10806 init_logger(); 10807 ({ message_types, protocols } = internal_default); 10808 supportedProtocols = protocols.slice(0, protocols.length - 1); 10809 indexOf = [].indexOf; 10810 Connection.reopenDelay = 500; 10811 Connection.prototype.events = { 10812 message(event) { 10813 if (!this.isProtocolSupported()) { 10814 return; 10815 } 10816 const { identifier, message, reason, reconnect, type } = JSON.parse(event.data); 10817 this.monitor.recordMessage(); 10818 switch (type) { 10819 case message_types.welcome: 10820 if (this.triedToReconnect()) { 10821 this.reconnectAttempted = true; 10822 } 10823 this.monitor.recordConnect(); 10824 return this.subscriptions.reload(); 10825 case message_types.disconnect: 10826 logger_default.log(`Disconnecting. Reason: ${reason}`); 10827 return this.close({ allowReconnect: reconnect }); 10828 case message_types.ping: 10829 return null; 10830 case message_types.confirmation: 10831 this.subscriptions.confirmSubscription(identifier); 10832 if (this.reconnectAttempted) { 10833 this.reconnectAttempted = false; 10834 return this.subscriptions.notify(identifier, "connected", { reconnected: true }); 10835 } else { 10836 return this.subscriptions.notify(identifier, "connected", { reconnected: false }); 10837 } 10838 case message_types.rejection: 10839 return this.subscriptions.reject(identifier); 10840 default: 10841 return this.subscriptions.notify(identifier, "received", message); 10842 } 10843 }, 10844 open() { 10845 logger_default.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`); 10846 this.disconnected = false; 10847 if (!this.isProtocolSupported()) { 10848 logger_default.log("Protocol is unsupported. Stopping monitor and disconnecting."); 10849 return this.close({ allowReconnect: false }); 10850 } 10851 }, 10852 close(event) { 10853 logger_default.log("WebSocket onclose event"); 10854 if (this.disconnected) { 10855 return; 10856 } 10857 this.disconnected = true; 10858 this.monitor.recordDisconnect(); 10859 return this.subscriptions.notifyAll("disconnected", { willAttemptReconnect: this.monitor.isRunning() }); 10860 }, 10861 error() { 10862 logger_default.log("WebSocket onerror event"); 10863 } 10864 }; 10865 connection_default = Connection; 10866}); 10867
vendor: 725 bytes, lines 10868-10895
10868// node_modules/@rails/actioncable/src/subscription.js 10869class Subscription { 10870 constructor(consumer, params = {}, mixin) { 10871 this.consumer = consumer; 10872 this.identifier = JSON.stringify(params); 10873 extend(this, mixin); 10874 } 10875 perform(action, data = {}) { 10876 data.action = action; 10877 return this.send(data); 10878 } 10879 send(data) { 10880 return this.consumer.send({ command: "message", identifier: this.identifier, data: JSON.stringify(data) }); 10881 } 10882 unsubscribe() { 10883 return this.consumer.subscriptions.remove(this); 10884 } 10885} 10886var extend = function(object, properties) { 10887 if (properties != null) { 10888 for (let key in properties) { 10889 const value = properties[key]; 10890 object[key] = value; 10891 } 10892 } 10893 return object; 10894}; 10895
vendor: 1,516 bytes, lines 10896-10938
10896// node_modules/@rails/actioncable/src/subscription_guarantor.js 10897class SubscriptionGuarantor { 10898 constructor(subscriptions) { 10899 this.subscriptions = subscriptions; 10900 this.pendingSubscriptions = []; 10901 } 10902 guarantee(subscription) { 10903 if (this.pendingSubscriptions.indexOf(subscription) == -1) { 10904 logger_default.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`); 10905 this.pendingSubscriptions.push(subscription); 10906 } else { 10907 logger_default.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`); 10908 } 10909 this.startGuaranteeing(); 10910 } 10911 forget(subscription) { 10912 logger_default.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`); 10913 this.pendingSubscriptions = this.pendingSubscriptions.filter((s) => s !== subscription); 10914 } 10915 startGuaranteeing() { 10916 this.stopGuaranteeing(); 10917 this.retrySubscribing(); 10918 } 10919 stopGuaranteeing() { 10920 clearTimeout(this.retryTimeout); 10921 } 10922 retrySubscribing() { 10923 this.retryTimeout = setTimeout(() => { 10924 if (this.subscriptions && typeof this.subscriptions.subscribe === "function") { 10925 this.pendingSubscriptions.map((subscription) => { 10926 logger_default.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`); 10927 this.subscriptions.subscribe(subscription); 10928 }); 10929 } 10930 }, 500); 10931 } 10932} 10933var subscription_guarantor_default; 10934var init_subscription_guarantor = __esm(() => { 10935 init_logger(); 10936 subscription_guarantor_default = SubscriptionGuarantor; 10937}); 10938
vendor: 2,563 bytes, lines 10939-11014
10939// node_modules/@rails/actioncable/src/subscriptions.js 10940class Subscriptions { 10941 constructor(consumer) { 10942 this.consumer = consumer; 10943 this.guarantor = new subscription_guarantor_default(this); 10944 this.subscriptions = []; 10945 } 10946 create(channelName, mixin) { 10947 const channel = channelName; 10948 const params = typeof channel === "object" ? channel : { channel }; 10949 const subscription = new Subscription(this.consumer, params, mixin); 10950 return this.add(subscription); 10951 } 10952 add(subscription) { 10953 this.subscriptions.push(subscription); 10954 this.consumer.ensureActiveConnection(); 10955 this.notify(subscription, "initialized"); 10956 this.subscribe(subscription); 10957 return subscription; 10958 } 10959 remove(subscription) { 10960 this.forget(subscription); 10961 if (!this.findAll(subscription.identifier).length) { 10962 this.sendCommand(subscription, "unsubscribe"); 10963 } 10964 return subscription; 10965 } 10966 reject(identifier) { 10967 return this.findAll(identifier).map((subscription) => { 10968 this.forget(subscription); 10969 this.notify(subscription, "rejected"); 10970 return subscription; 10971 }); 10972 } 10973 forget(subscription) { 10974 this.guarantor.forget(subscription); 10975 this.subscriptions = this.subscriptions.filter((s) => s !== subscription); 10976 return subscription; 10977 } 10978 findAll(identifier) { 10979 return this.subscriptions.filter((s) => s.identifier === identifier); 10980 } 10981 reload() { 10982 return this.subscriptions.map((subscription) => this.subscribe(subscription)); 10983 } 10984 notifyAll(callbackName, ...args2) { 10985 return this.subscriptions.map((subscription) => this.notify(subscription, callbackName, ...args2)); 10986 } 10987 notify(subscription, callbackName, ...args2) { 10988 let subscriptions; 10989 if (typeof subscription === "string") { 10990 subscriptions = this.findAll(subscription); 10991 } else { 10992 subscriptions = [subscription]; 10993 } 10994 return subscriptions.map((subscription) => typeof subscription[callbackName] === "function" ? subscription[callbackName](...args2) : undefined); 10995 } 10996 subscribe(subscription) { 10997 if (this.sendCommand(subscription, "subscribe")) { 10998 this.guarantor.guarantee(subscription); 10999 } 11000 } 11001 confirmSubscription(identifier) { 11002 logger_default.log(`Subscription confirmed ${identifier}`); 11003 this.findAll(identifier).map((subscription) => this.guarantor.forget(subscription)); 11004 } 11005 sendCommand(subscription, command) { 11006 const { identifier } = subscription; 11007 return this.consumer.send({ command, identifier }); 11008 } 11009} 11010var init_subscriptions = __esm(() => { 11011 init_logger(); 11012 init_subscription_guarantor(); 11013}); 11014
vendor: 1,108 bytes, lines 11015-11062
11015// node_modules/@rails/actioncable/src/consumer.js 11016class Consumer { 11017 constructor(url) { 11018 this._url = url; 11019 this.subscriptions = new Subscriptions(this); 11020 this.connection = new connection_default(this); 11021 this.subprotocols = []; 11022 } 11023 get url() { 11024 return createWebSocketURL(this._url); 11025 } 11026 send(data) { 11027 return this.connection.send(data); 11028 } 11029 connect() { 11030 return this.connection.open(); 11031 } 11032 disconnect() { 11033 return this.connection.close({ allowReconnect: false }); 11034 } 11035 ensureActiveConnection() { 11036 if (!this.connection.isActive()) { 11037 return this.connection.open(); 11038 } 11039 } 11040 addSubProtocol(subprotocol) { 11041 this.subprotocols = [...this.subprotocols, subprotocol]; 11042 } 11043} 11044function createWebSocketURL(url) { 11045 if (typeof url === "function") { 11046 url = url(); 11047 } 11048 if (url && !/^wss?:/i.test(url)) { 11049 const a = document.createElement("a"); 11050 a.href = url; 11051 a.href = a.href; 11052 a.protocol = a.protocol.replace("http", "ws"); 11053 return a.href; 11054 } else { 11055 return url; 11056 } 11057} 11058var init_consumer = __esm(() => { 11059 init_connection(); 11060 init_subscriptions(); 11061}); 11062
vendor: 560 bytes, lines 11063-11083
11063// node_modules/@rails/actioncable/src/index.js 11064function createConsumer(url = getConfig("url") || internal_default.default_mount_path) { 11065 return new Consumer(url); 11066} 11067function getConfig(name) { 11068 const element = document.head.querySelector(`meta[name='action-cable-${name}']`); 11069 if (element) { 11070 return element.getAttribute("content"); 11071 } 11072} 11073var init_src = __esm(() => { 11074 init_adapters(); 11075 init_connection(); 11076 init_connection_monitor(); 11077 init_consumer(); 11078 init_internal(); 11079 init_logger(); 11080 init_subscription_guarantor(); 11081 init_subscriptions(); 11082}); 11083
vendor: 7,914 bytes, lines 11084-11270
11084// node_modules/smoothscroll-polyfill/dist/smoothscroll.js 11085var require_smoothscroll = __commonJS(function(exports2, module2) { 11086 (function() { 11087 function polyfill() { 11088 var w = window; 11089 var d = document; 11090 if ("scrollBehavior" in d.documentElement.style && w.__forceSmoothScrollPolyfill__ !== true) { 11091 return; 11092 } 11093 var Element2 = w.HTMLElement || w.Element; 11094 var SCROLL_TIME = 468; 11095 var original = { 11096 scroll: w.scroll || w.scrollTo, 11097 scrollBy: w.scrollBy, 11098 elementScroll: Element2.prototype.scroll || scrollElement, 11099 scrollIntoView: Element2.prototype.scrollIntoView 11100 }; 11101 var now = w.performance && w.performance.now ? w.performance.now.bind(w.performance) : Date.now; 11102 function isMicrosoftBrowser(userAgent) { 11103 var userAgentPatterns = ["MSIE ", "Trident/", "Edge/"]; 11104 return new RegExp(userAgentPatterns.join("|")).test(userAgent); 11105 } 11106 var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0; 11107 function scrollElement(x, y) { 11108 this.scrollLeft = x; 11109 this.scrollTop = y; 11110 } 11111 function ease(k) { 11112 return 0.5 * (1 - Math.cos(Math.PI * k)); 11113 } 11114 function shouldBailOut(firstArg) { 11115 if (firstArg === null || typeof firstArg !== "object" || firstArg.behavior === undefined || firstArg.behavior === "auto" || firstArg.behavior === "instant") { 11116 return true; 11117 } 11118 if (typeof firstArg === "object" && firstArg.behavior === "smooth") { 11119 return false; 11120 } 11121 throw new TypeError("behavior member of ScrollOptions " + firstArg.behavior + " is not a valid value for enumeration ScrollBehavior."); 11122 } 11123 function hasScrollableSpace(el, axis) { 11124 if (axis === "Y") { 11125 return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight; 11126 } 11127 if (axis === "X") { 11128 return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth; 11129 } 11130 } 11131 function canOverflow(el, axis) { 11132 var overflowValue = w.getComputedStyle(el, null)["overflow" + axis]; 11133 return overflowValue === "auto" || overflowValue === "scroll"; 11134 } 11135 function isScrollable(el) { 11136 var isScrollableY = hasScrollableSpace(el, "Y") && canOverflow(el, "Y"); 11137 var isScrollableX = hasScrollableSpace(el, "X") && canOverflow(el, "X"); 11138 return isScrollableY || isScrollableX; 11139 } 11140 function findScrollableParent(el) { 11141 while (el !== d.body && isScrollable(el) === false) { 11142 el = el.parentNode || el.host; 11143 } 11144 return el; 11145 } 11146 function step(context) { 11147 var time = now(); 11148 var value; 11149 var currentX; 11150 var currentY; 11151 var elapsed = (time - context.startTime) / SCROLL_TIME; 11152 elapsed = elapsed > 1 ? 1 : elapsed; 11153 value = ease(elapsed); 11154 currentX = context.startX + (context.x - context.startX) * value; 11155 currentY = context.startY + (context.y - context.startY) * value; 11156 context.method.call(context.scrollable, currentX, currentY); 11157 if (currentX !== context.x || currentY !== context.y) { 11158 w.requestAnimationFrame(step.bind(w, context)); 11159 } 11160 } 11161 function smoothScroll(el, x, y) { 11162 var scrollable; 11163 var startX; 11164 var startY; 11165 var method; 11166 var startTime = now(); 11167 if (el === d.body) { 11168 scrollable = w; 11169 startX = w.scrollX || w.pageXOffset; 11170 startY = w.scrollY || w.pageYOffset; 11171 method = original.scroll; 11172 } else { 11173 scrollable = el; 11174 startX = el.scrollLeft; 11175 startY = el.scrollTop; 11176 method = scrollElement; 11177 } 11178 step({ 11179 scrollable, 11180 method, 11181 startTime, 11182 startX, 11183 startY, 11184 x, 11185 y 11186 }); 11187 } 11188 w.scroll = w.scrollTo = function() { 11189 if (arguments[0] === undefined) { 11190 return; 11191 } 11192 if (shouldBailOut(arguments[0]) === true) { 11193 original.scroll.call(w, arguments[0].left !== undefined ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : w.scrollX || w.pageXOffset, arguments[0].top !== undefined ? arguments[0].top : arguments[1] !== undefined ? arguments[1] : w.scrollY || w.pageYOffset); 11194 return; 11195 } 11196 smoothScroll.call(w, d.body, arguments[0].left !== undefined ? ~~arguments[0].left : w.scrollX || w.pageXOffset, arguments[0].top !== undefined ? ~~arguments[0].top : w.scrollY || w.pageYOffset); 11197 }; 11198 w.scrollBy = function() { 11199 if (arguments[0] === undefined) { 11200 return; 11201 } 11202 if (shouldBailOut(arguments[0])) { 11203 original.scrollBy.call(w, arguments[0].left !== undefined ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : 0, arguments[0].top !== undefined ? arguments[0].top : arguments[1] !== undefined ? arguments[1] : 0); 11204 return; 11205 } 11206 smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset)); 11207 }; 11208 Element2.prototype.scroll = Element2.prototype.scrollTo = function() { 11209 if (arguments[0] === undefined) { 11210 return; 11211 } 11212 if (shouldBailOut(arguments[0]) === true) { 11213 if (typeof arguments[0] === "number" && arguments[1] === undefined) { 11214 throw new SyntaxError("Value could not be converted"); 11215 } 11216 original.elementScroll.call(this, arguments[0].left !== undefined ? ~~arguments[0].left : typeof arguments[0] !== "object" ? ~~arguments[0] : this.scrollLeft, arguments[0].top !== undefined ? ~~arguments[0].top : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop); 11217 return; 11218 } 11219 var left = arguments[0].left; 11220 var top = arguments[0].top; 11221 smoothScroll.call(this, this, typeof left === "undefined" ? this.scrollLeft : ~~left, typeof top === "undefined" ? this.scrollTop : ~~top); 11222 }; 11223 Element2.prototype.scrollBy = function() { 11224 if (arguments[0] === undefined) { 11225 return; 11226 } 11227 if (shouldBailOut(arguments[0]) === true) { 11228 original.elementScroll.call(this, arguments[0].left !== undefined ? ~~arguments[0].left + this.scrollLeft : ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined ? ~~arguments[0].top + this.scrollTop : ~~arguments[1] + this.scrollTop); 11229 return; 11230 } 11231 this.scroll({ 11232 left: ~~arguments[0].left + this.scrollLeft, 11233 top: ~~arguments[0].top + this.scrollTop, 11234 behavior: arguments[0].behavior 11235 }); 11236 }; 11237 Element2.prototype.scrollIntoView = function() { 11238 if (shouldBailOut(arguments[0]) === true) { 11239 original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]); 11240 return; 11241 } 11242 var scrollableParent = findScrollableParent(this); 11243 var parentRects = scrollableParent.getBoundingClientRect(); 11244 var clientRects = this.getBoundingClientRect(); 11245 if (scrollableParent !== d.body) { 11246 smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top); 11247 if (w.getComputedStyle(scrollableParent).position !== "fixed") { 11248 w.scrollBy({ 11249 left: parentRects.left, 11250 top: parentRects.top, 11251 behavior: "smooth" 11252 }); 11253 } 11254 } else { 11255 w.scrollBy({ 11256 left: clientRects.left, 11257 top: clientRects.top, 11258 behavior: "smooth" 11259 }); 11260 } 11261 }; 11262 } 11263 if (typeof exports2 === "object" && typeof module2 !== "undefined") { 11264 module2.exports = { polyfill }; 11265 } else { 11266 polyfill(); 11267 } 11268 })(); 11269}); 11270
vendor: 52,863 bytes, lines 11271-12584
11271// node_modules/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js 11272var require_ScrollMagic = __commonJS(function(exports2, module2) { 11273 /*! 11274 * ScrollMagic v2.0.8 (2020-08-14) 11275 * The javascript library for magical scroll interactions. 11276 * (c) 2020 Jan Paepke (@janpaepke) 11277 * Project Website: http://scrollmagic.io 11278 * 11279 * @version 2.0.8 11280 * @license Dual licensed under MIT license and GPL. 11281 * @author Jan Paepke - [email protected] 11282 * 11283 * @file ScrollMagic main library. 11284 */ 11285 (function(root2, factory) { 11286 if (typeof define === "function" && define.amd) { 11287 define(factory); 11288 } else if (typeof exports2 === "object") { 11289 module2.exports = factory(); 11290 } else { 11291 root2.ScrollMagic = factory(); 11292 } 11293 })(exports2, function() { 11294 var ScrollMagic = function() { 11295 _util.log(2, "(COMPATIBILITY NOTICE) -> As of ScrollMagic 2.0.0 you need to use 'new ScrollMagic.Controller()' to create a new controller instance. Use 'new ScrollMagic.Scene()' to instance a scene."); 11296 }; 11297 ScrollMagic.version = "2.0.8"; 11298 if (typeof window !== "undefined") { 11299 window.addEventListener("mousewheel", undefined); 11300 } 11301 var PIN_SPACER_ATTRIBUTE = "data-scrollmagic-pin-spacer"; 11302 ScrollMagic.Controller = function(options2) { 11303 var NAMESPACE = "ScrollMagic.Controller", SCROLL_DIRECTION_FORWARD = "FORWARD", SCROLL_DIRECTION_REVERSE = "REVERSE", SCROLL_DIRECTION_PAUSED = "PAUSED", DEFAULT_OPTIONS = CONTROLLER_OPTIONS.defaults; 11304 var Controller = this, _options = _util.extend({}, DEFAULT_OPTIONS, options2), _sceneObjects = [], _updateScenesOnNextCycle = false, _scrollPos = 0, _scrollDirection = SCROLL_DIRECTION_PAUSED, _isDocument = true, _viewPortSize = 0, _enabled = true, _updateTimeout, _refreshTimeout; 11305 var construct = function() { 11306 for (var key in _options) { 11307 if (!DEFAULT_OPTIONS.hasOwnProperty(key)) { 11308 log(2, 'WARNING: Unknown option "' + key + '"'); 11309 delete _options[key]; 11310 } 11311 } 11312 _options.container = _util.get.elements(_options.container)[0]; 11313 if (!_options.container) { 11314 log(1, "ERROR creating object " + NAMESPACE + ": No valid scroll container supplied"); 11315 throw NAMESPACE + " init failed."; 11316 } 11317 _isDocument = _options.container === window || _options.container === document.body || !document.body.contains(_options.container); 11318 if (_isDocument) { 11319 _options.container = window; 11320 } 11321 _viewPortSize = getViewportSize(); 11322 _options.container.addEventListener("resize", onChange); 11323 _options.container.addEventListener("scroll", onChange); 11324 var ri = parseInt(_options.refreshInterval, 10); 11325 _options.refreshInterval = _util.type.Number(ri) ? ri : DEFAULT_OPTIONS.refreshInterval; 11326 scheduleRefresh(); 11327 log(3, "added new " + NAMESPACE + " controller (v" + ScrollMagic.version + ")"); 11328 }; 11329 var scheduleRefresh = function() { 11330 if (_options.refreshInterval > 0) { 11331 _refreshTimeout = window.setTimeout(refresh, _options.refreshInterval); 11332 } 11333 }; 11334 var getScrollPos = function() { 11335 return _options.vertical ? _util.get.scrollTop(_options.container) : _util.get.scrollLeft(_options.container); 11336 }; 11337 var getViewportSize = function() { 11338 return _options.vertical ? _util.get.height(_options.container) : _util.get.width(_options.container); 11339 }; 11340 var setScrollPos = this._setScrollPos = function(pos) { 11341 if (_options.vertical) { 11342 if (_isDocument) { 11343 window.scrollTo(_util.get.scrollLeft(), pos); 11344 } else { 11345 _options.container.scrollTop = pos; 11346 } 11347 } else { 11348 if (_isDocument) { 11349 window.scrollTo(pos, _util.get.scrollTop()); 11350 } else { 11351 _options.container.scrollLeft = pos; 11352 } 11353 } 11354 }; 11355 var updateScenes = function() { 11356 if (_enabled && _updateScenesOnNextCycle) { 11357 var scenesToUpdate = _util.type.Array(_updateScenesOnNextCycle) ? _updateScenesOnNextCycle : _sceneObjects.slice(0); 11358 _updateScenesOnNextCycle = false; 11359 var oldScrollPos = _scrollPos; 11360 _scrollPos = Controller.scrollPos(); 11361 var deltaScroll = _scrollPos - oldScrollPos; 11362 if (deltaScroll !== 0) { 11363 _scrollDirection = deltaScroll > 0 ? SCROLL_DIRECTION_FORWARD : SCROLL_DIRECTION_REVERSE; 11364 } 11365 if (_scrollDirection === SCROLL_DIRECTION_REVERSE) { 11366 scenesToUpdate.reverse(); 11367 } 11368 scenesToUpdate.forEach(function(scene, index) { 11369 log(3, "updating Scene " + (index + 1) + "/" + scenesToUpdate.length + " (" + _sceneObjects.length + " total)"); 11370 scene.update(true); 11371 }); 11372 if (scenesToUpdate.length === 0 && _options.loglevel >= 3) { 11373 log(3, "updating 0 Scenes (nothing added to controller)"); 11374 } 11375 } 11376 }; 11377 var debounceUpdate = function() { 11378 _updateTimeout = _util.rAF(updateScenes); 11379 }; 11380 var onChange = function(e) { 11381 log(3, "event fired causing an update:", e.type); 11382 if (e.type == "resize") { 11383 _viewPortSize = getViewportSize(); 11384 _scrollDirection = SCROLL_DIRECTION_PAUSED; 11385 } 11386 if (_updateScenesOnNextCycle !== true) { 11387 _updateScenesOnNextCycle = true; 11388 debounceUpdate(); 11389 } 11390 }; 11391 var refresh = function() { 11392 if (!_isDocument) { 11393 if (_viewPortSize != getViewportSize()) { 11394 var resizeEvent; 11395 try { 11396 resizeEvent = new Event("resize", { 11397 bubbles: false, 11398 cancelable: false 11399 }); 11400 } catch (e) { 11401 resizeEvent = document.createEvent("Event"); 11402 resizeEvent.initEvent("resize", false, false); 11403 } 11404 _options.container.dispatchEvent(resizeEvent); 11405 } 11406 } 11407 _sceneObjects.forEach(function(scene, index) { 11408 scene.refresh(); 11409 }); 11410 scheduleRefresh(); 11411 }; 11412 var log = this._log = function(loglevel, output) { 11413 if (_options.loglevel >= loglevel) { 11414 Array.prototype.splice.call(arguments, 1, 0, "(" + NAMESPACE + ") ->"); 11415 _util.log.apply(window, arguments); 11416 } 11417 }; 11418 this._options = _options; 11419 var sortScenes = function(ScenesArray) { 11420 if (ScenesArray.length <= 1) { 11421 return ScenesArray; 11422 } else { 11423 var scenes = ScenesArray.slice(0); 11424 scenes.sort(function(a, b) { 11425 return a.scrollOffset() > b.scrollOffset() ? 1 : -1; 11426 }); 11427 return scenes; 11428 } 11429 }; 11430 this.addScene = function(newScene) { 11431 if (_util.type.Array(newScene)) { 11432 newScene.forEach(function(scene, index) { 11433 Controller.addScene(scene); 11434 }); 11435 } else if (newScene instanceof ScrollMagic.Scene) { 11436 if (newScene.controller() !== Controller) { 11437 newScene.addTo(Controller); 11438 } else if (_sceneObjects.indexOf(newScene) < 0) { 11439 _sceneObjects.push(newScene); 11440 _sceneObjects = sortScenes(_sceneObjects); 11441 newScene.on("shift.controller_sort", function() { 11442 _sceneObjects = sortScenes(_sceneObjects); 11443 }); 11444 for (var key in _options.globalSceneOptions) { 11445 if (newScene[key]) { 11446 newScene[key].call(newScene, _options.globalSceneOptions[key]); 11447 } 11448 } 11449 log(3, "adding Scene (now " + _sceneObjects.length + " total)"); 11450 } 11451 } else { 11452 log(1, "ERROR: invalid argument supplied for '.addScene()'"); 11453 } 11454 return Controller; 11455 }; 11456 this.removeScene = function(Scene) { 11457 if (_util.type.Array(Scene)) { 11458 Scene.forEach(function(scene, index) { 11459 Controller.removeScene(scene); 11460 }); 11461 } else { 11462 var index = _sceneObjects.indexOf(Scene); 11463 if (index > -1) { 11464 Scene.off("shift.controller_sort"); 11465 _sceneObjects.splice(index, 1); 11466 log(3, "removing Scene (now " + _sceneObjects.length + " left)"); 11467 Scene.remove(); 11468 } 11469 } 11470 return Controller; 11471 }; 11472 this.updateScene = function(Scene, immediately) { 11473 if (_util.type.Array(Scene)) { 11474 Scene.forEach(function(scene, index) { 11475 Controller.updateScene(scene, immediately); 11476 }); 11477 } else { 11478 if (immediately) { 11479 Scene.update(true); 11480 } else if (_updateScenesOnNextCycle !== true && Scene instanceof ScrollMagic.Scene) { 11481 _updateScenesOnNextCycle = _updateScenesOnNextCycle || []; 11482 if (_updateScenesOnNextCycle.indexOf(Scene) == -1) { 11483 _updateScenesOnNextCycle.push(Scene); 11484 } 11485 _updateScenesOnNextCycle = sortScenes(_updateScenesOnNextCycle); 11486 debounceUpdate(); 11487 } 11488 } 11489 return Controller; 11490 }; 11491 this.update = function(immediately) { 11492 onChange({ 11493 type: "resize" 11494 }); 11495 if (immediately) { 11496 updateScenes(); 11497 } 11498 return Controller; 11499 }; 11500 this.scrollTo = function(scrollTarget, additionalParameter) { 11501 if (_util.type.Number(scrollTarget)) { 11502 setScrollPos.call(_options.container, scrollTarget, additionalParameter); 11503 } else if (scrollTarget instanceof ScrollMagic.Scene) { 11504 if (scrollTarget.controller() === Controller) { 11505 Controller.scrollTo(scrollTarget.scrollOffset(), additionalParameter); 11506 } else { 11507 log(2, "scrollTo(): The supplied scene does not belong to this controller. Scroll cancelled.", scrollTarget); 11508 } 11509 } else if (_util.type.Function(scrollTarget)) { 11510 setScrollPos = scrollTarget; 11511 } else { 11512 var elem = _util.get.elements(scrollTarget)[0]; 11513 if (elem) { 11514 while (elem.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) { 11515 elem = elem.parentNode; 11516 } 11517 var param = _options.vertical ? "top" : "left", containerOffset = _util.get.offset(_options.container), elementOffset = _util.get.offset(elem); 11518 if (!_isDocument) { 11519 containerOffset[param] -= Controller.scrollPos(); 11520 } 11521 Controller.scrollTo(elementOffset[param] - containerOffset[param], additionalParameter); 11522 } else { 11523 log(2, "scrollTo(): The supplied argument is invalid. Scroll cancelled.", scrollTarget); 11524 } 11525 } 11526 return Controller; 11527 }; 11528 this.scrollPos = function(scrollPosMethod) { 11529 if (!arguments.length) { 11530 return getScrollPos.call(Controller); 11531 } else { 11532 if (_util.type.Function(scrollPosMethod)) { 11533 getScrollPos = scrollPosMethod; 11534 } else { 11535 log(2, "Provided value for method 'scrollPos' is not a function. To change the current scroll position use 'scrollTo()'."); 11536 } 11537 } 11538 return Controller; 11539 }; 11540 this.info = function(about) { 11541 var values = { 11542 size: _viewPortSize, 11543 vertical: _options.vertical, 11544 scrollPos: _scrollPos, 11545 scrollDirection: _scrollDirection, 11546 container: _options.container, 11547 isDocument: _isDocument 11548 }; 11549 if (!arguments.length) { 11550 return values; 11551 } else if (values[about] !== undefined) { 11552 return values[about]; 11553 } else { 11554 log(1, 'ERROR: option "' + about + '" is not available'); 11555 return; 11556 } 11557 }; 11558 this.loglevel = function(newLoglevel) { 11559 if (!arguments.length) { 11560 return _options.loglevel; 11561 } else if (_options.loglevel != newLoglevel) { 11562 _options.loglevel = newLoglevel; 11563 } 11564 return Controller; 11565 }; 11566 this.enabled = function(newState) { 11567 if (!arguments.length) { 11568 return _enabled; 11569 } else if (_enabled != newState) { 11570 _enabled = !!newState; 11571 Controller.updateScene(_sceneObjects, true); 11572 } 11573 return Controller; 11574 }; 11575 this.destroy = function(resetScenes) { 11576 window.clearTimeout(_refreshTimeout); 11577 var i = _sceneObjects.length; 11578 while (i--) { 11579 _sceneObjects[i].destroy(resetScenes); 11580 } 11581 _options.container.removeEventListener("resize", onChange); 11582 _options.container.removeEventListener("scroll", onChange); 11583 _util.cAF(_updateTimeout); 11584 log(3, "destroyed " + NAMESPACE + " (reset: " + (resetScenes ? "true" : "false") + ")"); 11585 return null; 11586 }; 11587 construct(); 11588 return Controller; 11589 }; 11590 var CONTROLLER_OPTIONS = { 11591 defaults: { 11592 container: window, 11593 vertical: true, 11594 globalSceneOptions: {}, 11595 loglevel: 2, 11596 refreshInterval: 100 11597 } 11598 }; 11599 ScrollMagic.Controller.addOption = function(name, defaultValue) { 11600 CONTROLLER_OPTIONS.defaults[name] = defaultValue; 11601 }; 11602 ScrollMagic.Controller.extend = function(extension) { 11603 var oldClass = this; 11604 ScrollMagic.Controller = function() { 11605 oldClass.apply(this, arguments); 11606 this.$super = _util.extend({}, this); 11607 return extension.apply(this, arguments) || this; 11608 }; 11609 _util.extend(ScrollMagic.Controller, oldClass); 11610 ScrollMagic.Controller.prototype = oldClass.prototype; 11611 ScrollMagic.Controller.prototype.constructor = ScrollMagic.Controller; 11612 }; 11613 ScrollMagic.Scene = function(options2) { 11614 var NAMESPACE = "ScrollMagic.Scene", SCENE_STATE_BEFORE = "BEFORE", SCENE_STATE_DURING = "DURING", SCENE_STATE_AFTER = "AFTER", DEFAULT_OPTIONS = SCENE_OPTIONS.defaults; 11615 var Scene = this, _options = _util.extend({}, DEFAULT_OPTIONS, options2), _state = SCENE_STATE_BEFORE, _progress = 0, _scrollOffset = { 11616 start: 0, 11617 end: 0 11618 }, _triggerPos = 0, _enabled = true, _durationUpdateMethod, _controller; 11619 var construct = function() { 11620 for (var key in _options) { 11621 if (!DEFAULT_OPTIONS.hasOwnProperty(key)) { 11622 log(2, 'WARNING: Unknown option "' + key + '"'); 11623 delete _options[key]; 11624 } 11625 } 11626 for (var optionName in DEFAULT_OPTIONS) { 11627 addSceneOption(optionName); 11628 } 11629 validateOption(); 11630 }; 11631 var _listeners = {}; 11632 this.on = function(names, callback) { 11633 if (_util.type.Function(callback)) { 11634 names = names.trim().split(" "); 11635 names.forEach(function(fullname) { 11636 var nameparts = fullname.split("."), eventname = nameparts[0], namespace = nameparts[1]; 11637 if (eventname != "*") { 11638 if (!_listeners[eventname]) { 11639 _listeners[eventname] = []; 11640 } 11641 _listeners[eventname].push({ 11642 namespace: namespace || "", 11643 callback 11644 }); 11645 } 11646 }); 11647 } else { 11648 log(1, "ERROR when calling '.on()': Supplied callback for '" + names + "' is not a valid function!"); 11649 } 11650 return Scene; 11651 }; 11652 this.off = function(names, callback) { 11653 if (!names) { 11654 log(1, "ERROR: Invalid event name supplied."); 11655 return Scene; 11656 } 11657 names = names.trim().split(" "); 11658 names.forEach(function(fullname, key) { 11659 var nameparts = fullname.split("."), eventname = nameparts[0], namespace = nameparts[1] || "", removeList = eventname === "*" ? Object.keys(_listeners) : [eventname]; 11660 removeList.forEach(function(remove2) { 11661 var list = _listeners[remove2] || [], i = list.length; 11662 while (i--) { 11663 var listener = list[i]; 11664 if (listener && (namespace === listener.namespace || namespace === "*") && (!callback || callback == listener.callback)) { 11665 list.splice(i, 1); 11666 } 11667 } 11668 if (!list.length) { 11669 delete _listeners[remove2]; 11670 } 11671 }); 11672 }); 11673 return Scene; 11674 }; 11675 this.trigger = function(name, vars) { 11676 if (name) { 11677 var nameparts = name.trim().split("."), eventname = nameparts[0], namespace = nameparts[1], listeners = _listeners[eventname]; 11678 log(3, "event fired:", eventname, vars ? "->" : "", vars || ""); 11679 if (listeners) { 11680 listeners.forEach(function(listener, key) { 11681 if (!namespace || namespace === listener.namespace) { 11682 listener.callback.call(Scene, new ScrollMagic.Event(eventname, listener.namespace, Scene, vars)); 11683 } 11684 }); 11685 } 11686 } else { 11687 log(1, "ERROR: Invalid event name supplied."); 11688 } 11689 return Scene; 11690 }; 11691 Scene.on("change.internal", function(e) { 11692 if (e.what !== "loglevel" && e.what !== "tweenChanges") { 11693 if (e.what === "triggerElement") { 11694 updateTriggerElementPosition(); 11695 } else if (e.what === "reverse") { 11696 Scene.update(); 11697 } 11698 } 11699 }).on("shift.internal", function(e) { 11700 updateScrollOffset(); 11701 Scene.update(); 11702 }); 11703 var log = this._log = function(loglevel, output) { 11704 if (_options.loglevel >= loglevel) { 11705 Array.prototype.splice.call(arguments, 1, 0, "(" + NAMESPACE + ") ->"); 11706 _util.log.apply(window, arguments); 11707 } 11708 }; 11709 this.addTo = function(controller) { 11710 if (!(controller instanceof ScrollMagic.Controller)) { 11711 log(1, "ERROR: supplied argument of 'addTo()' is not a valid ScrollMagic Controller"); 11712 } else if (_controller != controller) { 11713 if (_controller) { 11714 _controller.removeScene(Scene); 11715 } 11716 _controller = controller; 11717 validateOption(); 11718 updateDuration(true); 11719 updateTriggerElementPosition(true); 11720 updateScrollOffset(); 11721 _controller.info("container").addEventListener("resize", onContainerResize); 11722 controller.addScene(Scene); 11723 Scene.trigger("add", { 11724 controller: _controller 11725 }); 11726 log(3, "added " + NAMESPACE + " to controller"); 11727 Scene.update(); 11728 } 11729 return Scene; 11730 }; 11731 this.enabled = function(newState) { 11732 if (!arguments.length) { 11733 return _enabled; 11734 } else if (_enabled != newState) { 11735 _enabled = !!newState; 11736 Scene.update(true); 11737 } 11738 return Scene; 11739 }; 11740 this.remove = function() { 11741 if (_controller) { 11742 _controller.info("container").removeEventListener("resize", onContainerResize); 11743 var tmpParent = _controller; 11744 _controller = undefined; 11745 tmpParent.removeScene(Scene); 11746 Scene.trigger("remove"); 11747 log(3, "removed " + NAMESPACE + " from controller"); 11748 } 11749 return Scene; 11750 }; 11751 this.destroy = function(reset) { 11752 Scene.trigger("destroy", { 11753 reset 11754 }); 11755 Scene.remove(); 11756 Scene.off("*.*"); 11757 log(3, "destroyed " + NAMESPACE + " (reset: " + (reset ? "true" : "false") + ")"); 11758 return null; 11759 }; 11760 this.update = function(immediately) { 11761 if (_controller) { 11762 if (immediately) { 11763 if (_controller.enabled() && _enabled) { 11764 var scrollPos = _controller.info("scrollPos"), newProgress; 11765 if (_options.duration > 0) { 11766 newProgress = (scrollPos - _scrollOffset.start) / (_scrollOffset.end - _scrollOffset.start); 11767 } else { 11768 newProgress = scrollPos >= _scrollOffset.start ? 1 : 0; 11769 } 11770 Scene.trigger("update", { 11771 startPos: _scrollOffset.start, 11772 endPos: _scrollOffset.end, 11773 scrollPos 11774 }); 11775 Scene.progress(newProgress); 11776 } else if (_pin && _state === SCENE_STATE_DURING) { 11777 updatePinState(true); 11778 } 11779 } else { 11780 _controller.updateScene(Scene, false); 11781 } 11782 } 11783 return Scene; 11784 }; 11785 this.refresh = function() { 11786 updateDuration(); 11787 updateTriggerElementPosition(); 11788 return Scene; 11789 }; 11790 this.progress = function(progress) { 11791 if (!arguments.length) { 11792 return _progress; 11793 } else { 11794 var doUpdate = false, oldState = _state, scrollDirection = _controller ? _controller.info("scrollDirection") : "PAUSED", reverseOrForward = _options.reverse || progress >= _progress; 11795 if (_options.duration === 0) { 11796 doUpdate = _progress != progress; 11797 _progress = progress < 1 && reverseOrForward ? 0 : 1; 11798 _state = _progress === 0 ? SCENE_STATE_BEFORE : SCENE_STATE_DURING; 11799 } else { 11800 if (progress < 0 && _state !== SCENE_STATE_BEFORE && reverseOrForward) { 11801 _progress = 0; 11802 _state = SCENE_STATE_BEFORE; 11803 doUpdate = true; 11804 } else if (progress >= 0 && progress < 1 && reverseOrForward) { 11805 _progress = progress; 11806 _state = SCENE_STATE_DURING; 11807 doUpdate = true; 11808 } else if (progress >= 1 && _state !== SCENE_STATE_AFTER) { 11809 _progress = 1; 11810 _state = SCENE_STATE_AFTER; 11811 doUpdate = true; 11812 } else if (_state === SCENE_STATE_DURING && !reverseOrForward) { 11813 updatePinState(); 11814 } 11815 } 11816 if (doUpdate) { 11817 var eventVars = { 11818 progress: _progress, 11819 state: _state, 11820 scrollDirection 11821 }, stateChanged = _state != oldState; 11822 var trigger = function(eventName) { 11823 Scene.trigger(eventName, eventVars); 11824 }; 11825 if (stateChanged) { 11826 if (oldState !== SCENE_STATE_DURING) { 11827 trigger("enter"); 11828 trigger(oldState === SCENE_STATE_BEFORE ? "start" : "end"); 11829 } 11830 } 11831 trigger("progress"); 11832 if (stateChanged) { 11833 if (_state !== SCENE_STATE_DURING) { 11834 trigger(_state === SCENE_STATE_BEFORE ? "start" : "end"); 11835 trigger("leave"); 11836 } 11837 } 11838 } 11839 return Scene; 11840 } 11841 }; 11842 var updateScrollOffset = function() { 11843 _scrollOffset = { 11844 start: _triggerPos + _options.offset 11845 }; 11846 if (_controller && _options.triggerElement) { 11847 _scrollOffset.start -= _controller.info("size") * _options.triggerHook; 11848 } 11849 _scrollOffset.end = _scrollOffset.start + _options.duration; 11850 }; 11851 var updateDuration = function(suppressEvents) { 11852 if (_durationUpdateMethod) { 11853 var varname = "duration"; 11854 if (changeOption(varname, _durationUpdateMethod.call(Scene)) && !suppressEvents) { 11855 Scene.trigger("change", { 11856 what: varname, 11857 newval: _options[varname] 11858 }); 11859 Scene.trigger("shift", { 11860 reason: varname 11861 }); 11862 } 11863 } 11864 }; 11865 var updateTriggerElementPosition = function(suppressEvents) { 11866 var elementPos = 0, telem = _options.triggerElement; 11867 if (_controller && (telem || _triggerPos > 0)) { 11868 if (telem) { 11869 if (telem.parentNode) { 11870 var controllerInfo = _controller.info(), containerOffset = _util.get.offset(controllerInfo.container), param = controllerInfo.vertical ? "top" : "left"; 11871 while (telem.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) { 11872 telem = telem.parentNode; 11873 } 11874 var elementOffset = _util.get.offset(telem); 11875 if (!controllerInfo.isDocument) { 11876 containerOffset[param] -= _controller.scrollPos(); 11877 } 11878 elementPos = elementOffset[param] - containerOffset[param]; 11879 } else { 11880 log(2, "WARNING: triggerElement was removed from DOM and will be reset to", undefined); 11881 Scene.triggerElement(undefined); 11882 } 11883 } 11884 var changed = elementPos != _triggerPos; 11885 _triggerPos = elementPos; 11886 if (changed && !suppressEvents) { 11887 Scene.trigger("shift", { 11888 reason: "triggerElementPosition" 11889 }); 11890 } 11891 } 11892 }; 11893 var onContainerResize = function(e) { 11894 if (_options.triggerHook > 0) { 11895 Scene.trigger("shift", { 11896 reason: "containerResize" 11897 }); 11898 } 11899 }; 11900 var _validate = _util.extend(SCENE_OPTIONS.validate, { 11901 duration: function(val) { 11902 if (_util.type.String(val) && val.match(/^(\.|\d)*\d+%$/)) { 11903 var perc = parseFloat(val) / 100; 11904 val = function() { 11905 return _controller ? _controller.info("size") * perc : 0; 11906 }; 11907 } 11908 if (_util.type.Function(val)) { 11909 _durationUpdateMethod = val; 11910 try { 11911 val = parseFloat(_durationUpdateMethod.call(Scene)); 11912 } catch (e) { 11913 val = -1; 11914 } 11915 } 11916 val = parseFloat(val); 11917 if (!_util.type.Number(val) || val < 0) { 11918 if (_durationUpdateMethod) { 11919 _durationUpdateMethod = undefined; 11920 throw ['Invalid return value of supplied function for option "duration":', val]; 11921 } else { 11922 throw ['Invalid value for option "duration":', val]; 11923 } 11924 } 11925 return val; 11926 } 11927 }); 11928 var validateOption = function(check) { 11929 check = arguments.length ? [check] : Object.keys(_validate); 11930 check.forEach(function(optionName, key) { 11931 var value; 11932 if (_validate[optionName]) { 11933 try { 11934 value = _validate[optionName](_options[optionName]); 11935 } catch (e) { 11936 value = DEFAULT_OPTIONS[optionName]; 11937 var logMSG = _util.type.String(e) ? [e] : e; 11938 if (_util.type.Array(logMSG)) { 11939 logMSG[0] = "ERROR: " + logMSG[0]; 11940 logMSG.unshift(1); 11941 log.apply(this, logMSG); 11942 } else { 11943 log(1, "ERROR: Problem executing validation callback for option '" + optionName + "':", e.message); 11944 } 11945 } finally { 11946 _options[optionName] = value; 11947 } 11948 } 11949 }); 11950 }; 11951 var changeOption = function(varname, newval) { 11952 var changed = false, oldval = _options[varname]; 11953 if (_options[varname] != newval) { 11954 _options[varname] = newval; 11955 validateOption(varname); 11956 changed = oldval != _options[varname]; 11957 } 11958 return changed; 11959 }; 11960 var addSceneOption = function(optionName) { 11961 if (!Scene[optionName]) { 11962 Scene[optionName] = function(newVal) { 11963 if (!arguments.length) { 11964 return _options[optionName]; 11965 } else { 11966 if (optionName === "duration") { 11967 _durationUpdateMethod = undefined; 11968 } 11969 if (changeOption(optionName, newVal)) { 11970 Scene.trigger("change", { 11971 what: optionName, 11972 newval: _options[optionName] 11973 }); 11974 if (SCENE_OPTIONS.shifts.indexOf(optionName) > -1) { 11975 Scene.trigger("shift", { 11976 reason: optionName 11977 }); 11978 } 11979 } 11980 } 11981 return Scene; 11982 }; 11983 } 11984 }; 11985 this.controller = function() { 11986 return _controller; 11987 }; 11988 this.state = function() { 11989 return _state; 11990 }; 11991 this.scrollOffset = function() { 11992 return _scrollOffset.start; 11993 }; 11994 this.triggerPosition = function() { 11995 var pos = _options.offset; 11996 if (_controller) { 11997 if (_options.triggerElement) { 11998 pos += _triggerPos; 11999 } else { 12000 pos += _controller.info("size") * Scene.triggerHook(); 12001 } 12002 } 12003 return pos; 12004 }; 12005 var _pin, _pinOptions; 12006 Scene.on("shift.internal", function(e) { 12007 var durationChanged = e.reason === "duration"; 12008 if (_state === SCENE_STATE_AFTER && durationChanged || _state === SCENE_STATE_DURING && _options.duration === 0) { 12009 updatePinState(); 12010 } 12011 if (durationChanged) { 12012 updatePinDimensions(); 12013 } 12014 }).on("progress.internal", function(e) { 12015 updatePinState(); 12016 }).on("add.internal", function(e) { 12017 updatePinDimensions(); 12018 }).on("destroy.internal", function(e) { 12019 Scene.removePin(e.reset); 12020 }); 12021 var updatePinState = function(forceUnpin) { 12022 if (_pin && _controller) { 12023 var containerInfo = _controller.info(), pinTarget = _pinOptions.spacer.firstChild; 12024 if (!forceUnpin && _state === SCENE_STATE_DURING) { 12025 if (_util.css(pinTarget, "position") != "fixed") { 12026 _util.css(pinTarget, { 12027 position: "fixed" 12028 }); 12029 updatePinDimensions(); 12030 } 12031 var fixedPos = _util.get.offset(_pinOptions.spacer, true), scrollDistance = _options.reverse || _options.duration === 0 ? containerInfo.scrollPos - _scrollOffset.start : Math.round(_progress * _options.duration * 10) / 10; 12032 fixedPos[containerInfo.vertical ? "top" : "left"] += scrollDistance; 12033 _util.css(_pinOptions.spacer.firstChild, { 12034 top: fixedPos.top, 12035 left: fixedPos.left 12036 }); 12037 } else { 12038 var newCSS = { 12039 position: _pinOptions.inFlow ? "relative" : "absolute", 12040 top: 0, 12041 left: 0 12042 }, change = _util.css(pinTarget, "position") != newCSS.position; 12043 if (!_pinOptions.pushFollowers) { 12044 newCSS[containerInfo.vertical ? "top" : "left"] = _options.duration * _progress; 12045 } else if (_options.duration > 0) { 12046 if (_state === SCENE_STATE_AFTER && parseFloat(_util.css(_pinOptions.spacer, "padding-top")) === 0) { 12047 change = true; 12048 } else if (_state === SCENE_STATE_BEFORE && parseFloat(_util.css(_pinOptions.spacer, "padding-bottom")) === 0) { 12049 change = true; 12050 } 12051 } 12052 _util.css(pinTarget, newCSS); 12053 if (change) { 12054 updatePinDimensions(); 12055 } 12056 } 12057 } 12058 }; 12059 var updatePinDimensions = function() { 12060 if (_pin && _controller && _pinOptions.inFlow) { 12061 var after = _state === SCENE_STATE_AFTER, before = _state === SCENE_STATE_BEFORE, during = _state === SCENE_STATE_DURING, vertical = _controller.info("vertical"), pinTarget = _pinOptions.spacer.firstChild, marginCollapse = _util.isMarginCollapseType(_util.css(_pinOptions.spacer, "display")), css2 = {}; 12062 if (_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) { 12063 if (during) { 12064 _util.css(_pin, { 12065 width: _util.get.width(_pinOptions.spacer) 12066 }); 12067 } else { 12068 _util.css(_pin, { 12069 width: "100%" 12070 }); 12071 } 12072 } else { 12073 css2["min-width"] = _util.get.width(vertical ? _pin : pinTarget, true, true); 12074 css2.width = during ? css2["min-width"] : "auto"; 12075 } 12076 if (_pinOptions.relSize.height) { 12077 if (during) { 12078 _util.css(_pin, { 12079 height: _util.get.height(_pinOptions.spacer) - (_pinOptions.pushFollowers ? _options.duration : 0) 12080 }); 12081 } else { 12082 _util.css(_pin, { 12083 height: "100%" 12084 }); 12085 } 12086 } else { 12087 css2["min-height"] = _util.get.height(vertical ? pinTarget : _pin, true, !marginCollapse); 12088 css2.height = during ? css2["min-height"] : "auto"; 12089 } 12090 if (_pinOptions.pushFollowers) { 12091 css2["padding" + (vertical ? "Top" : "Left")] = _options.duration * _progress; 12092 css2["padding" + (vertical ? "Bottom" : "Right")] = _options.duration * (1 - _progress); 12093 } 12094 _util.css(_pinOptions.spacer, css2); 12095 } 12096 }; 12097 var updatePinInContainer = function() { 12098 if (_controller && _pin && _state === SCENE_STATE_DURING && !_controller.info("isDocument")) { 12099 updatePinState(); 12100 } 12101 }; 12102 var updateRelativePinSpacer = function() { 12103 if (_controller && _pin && _state === SCENE_STATE_DURING && ((_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) && _util.get.width(window) != _util.get.width(_pinOptions.spacer.parentNode) || _pinOptions.relSize.height && _util.get.height(window) != _util.get.height(_pinOptions.spacer.parentNode))) { 12104 updatePinDimensions(); 12105 } 12106 }; 12107 var onMousewheelOverPin = function(e) { 12108 if (_controller && _pin && _state === SCENE_STATE_DURING && !_controller.info("isDocument")) { 12109 e.preventDefault(); 12110 _controller._setScrollPos(_controller.info("scrollPos") - ((e.wheelDelta || e[_controller.info("vertical") ? "wheelDeltaY" : "wheelDeltaX"]) / 3 || -e.detail * 30)); 12111 } 12112 }; 12113 this.setPin = function(element, settings2) { 12114 var defaultSettings = { 12115 pushFollowers: true, 12116 spacerClass: "scrollmagic-pin-spacer" 12117 }; 12118 var pushFollowersActivelySet = settings2 && settings2.hasOwnProperty("pushFollowers"); 12119 settings2 = _util.extend({}, defaultSettings, settings2); 12120 element = _util.get.elements(element)[0]; 12121 if (!element) { 12122 log(1, "ERROR calling method 'setPin()': Invalid pin element supplied."); 12123 return Scene; 12124 } else if (_util.css(element, "position") === "fixed") { 12125 log(1, "ERROR calling method 'setPin()': Pin does not work with elements that are positioned 'fixed'."); 12126 return Scene; 12127 } 12128 if (_pin) { 12129 if (_pin === element) { 12130 return Scene; 12131 } else { 12132 Scene.removePin(); 12133 } 12134 } 12135 _pin = element; 12136 var parentDisplay = _pin.parentNode.style.display, boundsParams = ["top", "left", "bottom", "right", "margin", "marginLeft", "marginRight", "marginTop", "marginBottom"]; 12137 _pin.parentNode.style.display = "none"; 12138 var inFlow = _util.css(_pin, "position") != "absolute", pinCSS = _util.css(_pin, boundsParams.concat(["display"])), sizeCSS = _util.css(_pin, ["width", "height"]); 12139 _pin.parentNode.style.display = parentDisplay; 12140 if (!inFlow && settings2.pushFollowers) { 12141 log(2, "WARNING: If the pinned element is positioned absolutely pushFollowers will be disabled."); 12142 settings2.pushFollowers = false; 12143 } 12144 window.setTimeout(function() { 12145 if (_pin && _options.duration === 0 && pushFollowersActivelySet && settings2.pushFollowers) { 12146 log(2, "WARNING: pushFollowers =", true, "has no effect, when scene duration is 0."); 12147 } 12148 }, 0); 12149 var spacer = _pin.parentNode.insertBefore(document.createElement("div"), _pin), spacerCSS = _util.extend(pinCSS, { 12150 position: inFlow ? "relative" : "absolute", 12151 boxSizing: "content-box", 12152 mozBoxSizing: "content-box", 12153 webkitBoxSizing: "content-box" 12154 }); 12155 if (!inFlow) { 12156 _util.extend(spacerCSS, _util.css(_pin, ["width", "height"])); 12157 } 12158 _util.css(spacer, spacerCSS); 12159 spacer.setAttribute(PIN_SPACER_ATTRIBUTE, ""); 12160 _util.addClass(spacer, settings2.spacerClass); 12161 _pinOptions = { 12162 spacer, 12163 relSize: { 12164 width: sizeCSS.width.slice(-1) === "%", 12165 height: sizeCSS.height.slice(-1) === "%", 12166 autoFullWidth: sizeCSS.width === "auto" && inFlow && _util.isMarginCollapseType(pinCSS.display) 12167 }, 12168 pushFollowers: settings2.pushFollowers, 12169 inFlow 12170 }; 12171 if (!_pin.___origStyle) { 12172 _pin.___origStyle = {}; 12173 var pinInlineCSS = _pin.style, copyStyles = boundsParams.concat(["width", "height", "position", "boxSizing", "mozBoxSizing", "webkitBoxSizing"]); 12174 copyStyles.forEach(function(val) { 12175 _pin.___origStyle[val] = pinInlineCSS[val] || ""; 12176 }); 12177 } 12178 if (_pinOptions.relSize.width) { 12179 _util.css(spacer, { 12180 width: sizeCSS.width 12181 }); 12182 } 12183 if (_pinOptions.relSize.height) { 12184 _util.css(spacer, { 12185 height: sizeCSS.height 12186 }); 12187 } 12188 spacer.appendChild(_pin); 12189 _util.css(_pin, { 12190 position: inFlow ? "relative" : "absolute", 12191 margin: "auto", 12192 top: "auto", 12193 left: "auto", 12194 bottom: "auto", 12195 right: "auto" 12196 }); 12197 if (_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) { 12198 _util.css(_pin, { 12199 boxSizing: "border-box", 12200 mozBoxSizing: "border-box", 12201 webkitBoxSizing: "border-box" 12202 }); 12203 } 12204 window.addEventListener("scroll", updatePinInContainer); 12205 window.addEventListener("resize", updatePinInContainer); 12206 window.addEventListener("resize", updateRelativePinSpacer); 12207 _pin.addEventListener("mousewheel", onMousewheelOverPin); 12208 _pin.addEventListener("DOMMouseScroll", onMousewheelOverPin); 12209 log(3, "added pin"); 12210 updatePinState(); 12211 return Scene; 12212 }; 12213 this.removePin = function(reset) { 12214 if (_pin) { 12215 if (_state === SCENE_STATE_DURING) { 12216 updatePinState(true); 12217 } 12218 if (reset || !_controller) { 12219 var pinTarget = _pinOptions.spacer.firstChild; 12220 if (pinTarget.hasAttribute(PIN_SPACER_ATTRIBUTE)) { 12221 var style = _pinOptions.spacer.style, values = ["margin", "marginLeft", "marginRight", "marginTop", "marginBottom"], margins = {}; 12222 values.forEach(function(val) { 12223 margins[val] = style[val] || ""; 12224 }); 12225 _util.css(pinTarget, margins); 12226 } 12227 _pinOptions.spacer.parentNode.insertBefore(pinTarget, _pinOptions.spacer); 12228 _pinOptions.spacer.parentNode.removeChild(_pinOptions.spacer); 12229 if (!_pin.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) { 12230 _util.css(_pin, _pin.___origStyle); 12231 delete _pin.___origStyle; 12232 } 12233 } 12234 window.removeEventListener("scroll", updatePinInContainer); 12235 window.removeEventListener("resize", updatePinInContainer); 12236 window.removeEventListener("resize", updateRelativePinSpacer); 12237 _pin.removeEventListener("mousewheel", onMousewheelOverPin); 12238 _pin.removeEventListener("DOMMouseScroll", onMousewheelOverPin); 12239 _pin = undefined; 12240 log(3, "removed pin (reset: " + (reset ? "true" : "false") + ")"); 12241 } 12242 return Scene; 12243 }; 12244 var _cssClasses, _cssClassElems = []; 12245 Scene.on("destroy.internal", function(e) { 12246 Scene.removeClassToggle(e.reset); 12247 }); 12248 this.setClassToggle = function(element, classes) { 12249 var elems = _util.get.elements(element); 12250 if (elems.length === 0 || !_util.type.String(classes)) { 12251 log(1, "ERROR calling method 'setClassToggle()': Invalid " + (elems.length === 0 ? "element" : "classes") + " supplied."); 12252 return Scene; 12253 } 12254 if (_cssClassElems.length > 0) { 12255 Scene.removeClassToggle(); 12256 } 12257 _cssClasses = classes; 12258 _cssClassElems = elems; 12259 Scene.on("enter.internal_class leave.internal_class", function(e) { 12260 var toggle = e.type === "enter" ? _util.addClass : _util.removeClass; 12261 _cssClassElems.forEach(function(elem, key) { 12262 toggle(elem, _cssClasses); 12263 }); 12264 }); 12265 return Scene; 12266 }; 12267 this.removeClassToggle = function(reset) { 12268 if (reset) { 12269 _cssClassElems.forEach(function(elem, key) { 12270 _util.removeClass(elem, _cssClasses); 12271 }); 12272 } 12273 Scene.off("start.internal_class end.internal_class"); 12274 _cssClasses = undefined; 12275 _cssClassElems = []; 12276 return Scene; 12277 }; 12278 construct(); 12279 return Scene; 12280 }; 12281 var SCENE_OPTIONS = { 12282 defaults: { 12283 duration: 0, 12284 offset: 0, 12285 triggerElement: undefined, 12286 triggerHook: 0.5, 12287 reverse: true, 12288 loglevel: 2 12289 }, 12290 validate: { 12291 offset: function(val) { 12292 val = parseFloat(val); 12293 if (!_util.type.Number(val)) { 12294 throw ['Invalid value for option "offset":', val]; 12295 } 12296 return val; 12297 }, 12298 triggerElement: function(val) { 12299 val = val || undefined; 12300 if (val) { 12301 var elem = _util.get.elements(val)[0]; 12302 if (elem && elem.parentNode) { 12303 val = elem; 12304 } else { 12305 throw ['Element defined in option "triggerElement" was not found:', val]; 12306 } 12307 } 12308 return val; 12309 }, 12310 triggerHook: function(val) { 12311 var translate = { 12312 onCenter: 0.5, 12313 onEnter: 1, 12314 onLeave: 0 12315 }; 12316 if (_util.type.Number(val)) { 12317 val = Math.max(0, Math.min(parseFloat(val), 1)); 12318 } else if (val in translate) { 12319 val = translate[val]; 12320 } else { 12321 throw ['Invalid value for option "triggerHook": ', val]; 12322 } 12323 return val; 12324 }, 12325 reverse: function(val) { 12326 return !!val; 12327 }, 12328 loglevel: function(val) { 12329 val = parseInt(val); 12330 if (!_util.type.Number(val) || val < 0 || val > 3) { 12331 throw ['Invalid value for option "loglevel":', val]; 12332 } 12333 return val; 12334 } 12335 }, 12336 shifts: ["duration", "offset", "triggerHook"] 12337 }; 12338 ScrollMagic.Scene.addOption = function(name, defaultValue, validationCallback, shifts) { 12339 if (!(name in SCENE_OPTIONS.defaults)) { 12340 SCENE_OPTIONS.defaults[name] = defaultValue; 12341 SCENE_OPTIONS.validate[name] = validationCallback; 12342 if (shifts) { 12343 SCENE_OPTIONS.shifts.push(name); 12344 } 12345 } else { 12346 ScrollMagic._util.log(1, "[static] ScrollMagic.Scene -> Cannot add Scene option '" + name + "', because it already exists."); 12347 } 12348 }; 12349 ScrollMagic.Scene.extend = function(extension) { 12350 var oldClass = this; 12351 ScrollMagic.Scene = function() { 12352 oldClass.apply(this, arguments); 12353 this.$super = _util.extend({}, this); 12354 return extension.apply(this, arguments) || this; 12355 }; 12356 _util.extend(ScrollMagic.Scene, oldClass); 12357 ScrollMagic.Scene.prototype = oldClass.prototype; 12358 ScrollMagic.Scene.prototype.constructor = ScrollMagic.Scene; 12359 }; 12360 ScrollMagic.Event = function(type, namespace, target, vars) { 12361 vars = vars || {}; 12362 for (var key in vars) { 12363 this[key] = vars[key]; 12364 } 12365 this.type = type; 12366 this.target = this.currentTarget = target; 12367 this.namespace = namespace || ""; 12368 this.timeStamp = this.timestamp = Date.now(); 12369 return this; 12370 }; 12371 var _util = ScrollMagic._util = function(window2) { 12372 var U = {}, i; 12373 var floatval = function(number) { 12374 return parseFloat(number) || 0; 12375 }; 12376 var _getComputedStyle = function(elem) { 12377 return elem.currentStyle ? elem.currentStyle : window2.getComputedStyle(elem); 12378 }; 12379 var _dimension = function(which, elem, outer, includeMargin) { 12380 elem = elem === document ? window2 : elem; 12381 if (elem === window2) { 12382 includeMargin = false; 12383 } else if (!_type.DomElement(elem)) { 12384 return 0; 12385 } 12386 which = which.charAt(0).toUpperCase() + which.substr(1).toLowerCase(); 12387 var dimension = (outer ? elem["offset" + which] || elem["outer" + which] : elem["client" + which] || elem["inner" + which]) || 0; 12388 if (outer && includeMargin) { 12389 var style = _getComputedStyle(elem); 12390 dimension += which === "Height" ? floatval(style.marginTop) + floatval(style.marginBottom) : floatval(style.marginLeft) + floatval(style.marginRight); 12391 } 12392 return dimension; 12393 }; 12394 var _camelCase = function(str) { 12395 return str.replace(/^[^a-z]+([a-z])/g, "$1").replace(/-([a-z])/g, function(g) { 12396 return g[1].toUpperCase(); 12397 }); 12398 }; 12399 U.extend = function(obj2) { 12400 obj2 = obj2 || {}; 12401 for (i = 1;i < arguments.length; i++) { 12402 if (!arguments[i]) { 12403 continue; 12404 } 12405 for (var key in arguments[i]) { 12406 if (arguments[i].hasOwnProperty(key)) { 12407 obj2[key] = arguments[i][key]; 12408 } 12409 } 12410 } 12411 return obj2; 12412 }; 12413 U.isMarginCollapseType = function(str) { 12414 return ["block", "flex", "list-item", "table", "-webkit-box"].indexOf(str) > -1; 12415 }; 12416 var lastTime = 0, vendors = ["ms", "moz", "webkit", "o"]; 12417 var _requestAnimationFrame = window2.requestAnimationFrame; 12418 var _cancelAnimationFrame = window2.cancelAnimationFrame; 12419 for (i = 0;!_requestAnimationFrame && i < vendors.length; ++i) { 12420 _requestAnimationFrame = window2[vendors[i] + "RequestAnimationFrame"]; 12421 _cancelAnimationFrame = window2[vendors[i] + "CancelAnimationFrame"] || window2[vendors[i] + "CancelRequestAnimationFrame"]; 12422 } 12423 if (!_requestAnimationFrame) { 12424 _requestAnimationFrame = function(callback) { 12425 var currTime = new Date().getTime(), timeToCall = Math.max(0, 16 - (currTime - lastTime)), id = window2.setTimeout(function() { 12426 callback(currTime + timeToCall); 12427 }, timeToCall); 12428 lastTime = currTime + timeToCall; 12429 return id; 12430 }; 12431 } 12432 if (!_cancelAnimationFrame) { 12433 _cancelAnimationFrame = function(id) { 12434 window2.clearTimeout(id); 12435 }; 12436 } 12437 U.rAF = _requestAnimationFrame.bind(window2); 12438 U.cAF = _cancelAnimationFrame.bind(window2); 12439 var loglevels = ["error", "warn", "log"], console2 = window2.console || {}; 12440 console2.log = console2.log || function() {}; 12441 for (i = 0;i < loglevels.length; i++) { 12442 var method = loglevels[i]; 12443 if (!console2[method]) { 12444 console2[method] = console2.log; 12445 } 12446 } 12447 U.log = function(loglevel) { 12448 if (loglevel > loglevels.length || loglevel <= 0) 12449 loglevel = loglevels.length; 12450 var now = new Date, time = ("0" + now.getHours()).slice(-2) + ":" + ("0" + now.getMinutes()).slice(-2) + ":" + ("0" + now.getSeconds()).slice(-2) + ":" + ("00" + now.getMilliseconds()).slice(-3), method = loglevels[loglevel - 1], args2 = Array.prototype.splice.call(arguments, 1), func = Function.prototype.bind.call(console2[method], console2); 12451 args2.unshift(time); 12452 func.apply(console2, args2); 12453 }; 12454 var _type = U.type = function(v) { 12455 return Object.prototype.toString.call(v).replace(/^\[object (.+)\]$/, "$1").toLowerCase(); 12456 }; 12457 _type.String = function(v) { 12458 return _type(v) === "string"; 12459 }; 12460 _type.Function = function(v) { 12461 return _type(v) === "function"; 12462 }; 12463 _type.Array = function(v) { 12464 return Array.isArray(v); 12465 }; 12466 _type.Number = function(v) { 12467 return !_type.Array(v) && v - parseFloat(v) + 1 >= 0; 12468 }; 12469 _type.DomElement = function(o) { 12470 return typeof HTMLElement === "object" || typeof HTMLElement === "function" ? o instanceof HTMLElement || o instanceof SVGElement : o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"; 12471 }; 12472 var _get = U.get = {}; 12473 _get.elements = function(selector) { 12474 var arr = []; 12475 if (_type.String(selector)) { 12476 try { 12477 selector = document.querySelectorAll(selector); 12478 } catch (e) { 12479 return arr; 12480 } 12481 } 12482 if (_type(selector) === "nodelist" || _type.Array(selector) || selector instanceof NodeList) { 12483 for (var i = 0, ref = arr.length = selector.length;i < ref; i++) { 12484 var elem = selector[i]; 12485 arr[i] = _type.DomElement(elem) ? elem : _get.elements(elem); 12486 } 12487 } else if (_type.DomElement(selector) || selector === document || selector === window2) { 12488 arr = [selector]; 12489 } 12490 return arr; 12491 }; 12492 _get.scrollTop = function(elem) { 12493 return elem && typeof elem.scrollTop === "number" ? elem.scrollTop : window2.pageYOffset || 0; 12494 }; 12495 _get.scrollLeft = function(elem) { 12496 return elem && typeof elem.scrollLeft === "number" ? elem.scrollLeft : window2.pageXOffset || 0; 12497 }; 12498 _get.width = function(elem, outer, includeMargin) { 12499 return _dimension("width", elem, outer, includeMargin); 12500 }; 12501 _get.height = function(elem, outer, includeMargin) { 12502 return _dimension("height", elem, outer, includeMargin); 12503 }; 12504 _get.offset = function(elem, relativeToViewport) { 12505 var offset = { 12506 top: 0, 12507 left: 0 12508 }; 12509 if (elem && elem.getBoundingClientRect) { 12510 var rect = elem.getBoundingClientRect(); 12511 offset.top = rect.top; 12512 offset.left = rect.left; 12513 if (!relativeToViewport) { 12514 offset.top += _get.scrollTop(); 12515 offset.left += _get.scrollLeft(); 12516 } 12517 } 12518 return offset; 12519 }; 12520 U.addClass = function(elem, classname) { 12521 if (classname) { 12522 if (elem.classList) 12523 elem.classList.add(classname); 12524 else 12525 elem.className += " " + classname; 12526 } 12527 }; 12528 U.removeClass = function(elem, classname) { 12529 if (classname) { 12530 if (elem.classList) 12531 elem.classList.remove(classname); 12532 else 12533 elem.className = elem.className.replace(new RegExp("(^|\\b)" + classname.split(" ").join("|") + "(\\b|$)", "gi"), " "); 12534 } 12535 }; 12536 U.css = function(elem, options2) { 12537 if (_type.String(options2)) { 12538 return _getComputedStyle(elem)[_camelCase(options2)]; 12539 } else if (_type.Array(options2)) { 12540 var obj2 = {}, style = _getComputedStyle(elem); 12541 options2.forEach(function(option, key) { 12542 obj2[option] = style[_camelCase(option)]; 12543 }); 12544 return obj2; 12545 } else { 12546 for (var option in options2) { 12547 var val = options2[option]; 12548 if (val == parseFloat(val)) { 12549 val += "px"; 12550 } 12551 elem.style[_camelCase(option)] = val; 12552 } 12553 } 12554 }; 12555 return U; 12556 }(window || {}); 12557 ScrollMagic.Scene.prototype.addIndicators = function() { 12558 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling addIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"); 12559 return this; 12560 }; 12561 ScrollMagic.Scene.prototype.removeIndicators = function() { 12562 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling removeIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"); 12563 return this; 12564 }; 12565 ScrollMagic.Scene.prototype.setTween = function() { 12566 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"); 12567 return this; 12568 }; 12569 ScrollMagic.Scene.prototype.removeTween = function() { 12570 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling removeTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"); 12571 return this; 12572 }; 12573 ScrollMagic.Scene.prototype.setVelocity = function() { 12574 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling setVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"); 12575 return this; 12576 }; 12577 ScrollMagic.Scene.prototype.removeVelocity = function() { 12578 ScrollMagic._util.log(1, "(ScrollMagic.Scene) -> ERROR calling removeVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"); 12579 return this; 12580 }; 12581 return ScrollMagic; 12582 }); 12583}); 12584
vendor: 3,519 bytes, lines 12585-12700
12585// node_modules/clone/clone.js 12586var require_clone = __commonJS(function(exports2, module2) { 12587 var clone2 = function() { 12588 function clone2(parent, circular, depth, prototype) { 12589 var filter; 12590 if (typeof circular === "object") { 12591 depth = circular.depth; 12592 prototype = circular.prototype; 12593 filter = circular.filter; 12594 circular = circular.circular; 12595 } 12596 var allParents = []; 12597 var allChildren = []; 12598 var useBuffer = typeof Buffer != "undefined"; 12599 if (typeof circular == "undefined") 12600 circular = true; 12601 if (typeof depth == "undefined") 12602 depth = Infinity; 12603 function _clone(parent, depth) { 12604 if (parent === null) 12605 return null; 12606 if (depth == 0) 12607 return parent; 12608 var child; 12609 var proto; 12610 if (typeof parent != "object") { 12611 return parent; 12612 } 12613 if (clone2.__isArray(parent)) { 12614 child = []; 12615 } else if (clone2.__isRegExp(parent)) { 12616 child = new RegExp(parent.source, __getRegExpFlags(parent)); 12617 if (parent.lastIndex) 12618 child.lastIndex = parent.lastIndex; 12619 } else if (clone2.__isDate(parent)) { 12620 child = new Date(parent.getTime()); 12621 } else if (useBuffer && Buffer.isBuffer(parent)) { 12622 if (Buffer.allocUnsafe) { 12623 child = Buffer.allocUnsafe(parent.length); 12624 } else { 12625 child = new Buffer(parent.length); 12626 } 12627 parent.copy(child); 12628 return child; 12629 } else { 12630 if (typeof prototype == "undefined") { 12631 proto = Object.getPrototypeOf(parent); 12632 child = Object.create(proto); 12633 } else { 12634 child = Object.create(prototype); 12635 proto = prototype; 12636 } 12637 } 12638 if (circular) { 12639 var index = allParents.indexOf(parent); 12640 if (index != -1) { 12641 return allChildren[index]; 12642 } 12643 allParents.push(parent); 12644 allChildren.push(child); 12645 } 12646 for (var i in parent) { 12647 var attrs; 12648 if (proto) { 12649 attrs = Object.getOwnPropertyDescriptor(proto, i); 12650 } 12651 if (attrs && attrs.set == null) { 12652 continue; 12653 } 12654 child[i] = _clone(parent[i], depth - 1); 12655 } 12656 return child; 12657 } 12658 return _clone(parent, depth); 12659 } 12660 clone2.clonePrototype = function clonePrototype(parent) { 12661 if (parent === null) 12662 return null; 12663 var c = function() {}; 12664 c.prototype = parent; 12665 return new c; 12666 }; 12667 function __objToStr(o) { 12668 return Object.prototype.toString.call(o); 12669 } 12670 clone2.__objToStr = __objToStr; 12671 function __isDate(o) { 12672 return typeof o === "object" && __objToStr(o) === "[object Date]"; 12673 } 12674 clone2.__isDate = __isDate; 12675 function __isArray(o) { 12676 return typeof o === "object" && __objToStr(o) === "[object Array]"; 12677 } 12678 clone2.__isArray = __isArray; 12679 function __isRegExp(o) { 12680 return typeof o === "object" && __objToStr(o) === "[object RegExp]"; 12681 } 12682 clone2.__isRegExp = __isRegExp; 12683 function __getRegExpFlags(re) { 12684 var flags = ""; 12685 if (re.global) 12686 flags += "g"; 12687 if (re.ignoreCase) 12688 flags += "i"; 12689 if (re.multiline) 12690 flags += "m"; 12691 return flags; 12692 } 12693 clone2.__getRegExpFlags = __getRegExpFlags; 12694 return clone2; 12695 }(); 12696 if (typeof module2 === "object" && module2.exports) { 12697 module2.exports = clone2; 12698 } 12699}); 12700
vendor: 406 bytes, lines 12701-12714
12701// node_modules/defaults/index.js 12702var require_defaults = __commonJS(function(exports2, module2) { 12703 var clone2 = require_clone(); 12704 module2.exports = function(options2, defaults) { 12705 options2 = options2 || {}; 12706 Object.keys(defaults).forEach(function(key) { 12707 if (typeof options2[key] === "undefined") { 12708 options2[key] = clone2(defaults[key]); 12709 } 12710 }); 12711 return options2; 12712 }; 12713}); 12714
vendor: 2,749 bytes, lines 12715-12862
12715// node_modules/wcwidth/combining.js 12716var require_combining = __commonJS(function(exports2, module2) { 12717 module2.exports = [ 12718 [768, 879], 12719 [1155, 1158], 12720 [1160, 1161], 12721 [1425, 1469], 12722 [1471, 1471], 12723 [1473, 1474], 12724 [1476, 1477], 12725 [1479, 1479], 12726 [1536, 1539], 12727 [1552, 1557], 12728 [1611, 1630], 12729 [1648, 1648], 12730 [1750, 1764], 12731 [1767, 1768], 12732 [1770, 1773], 12733 [1807, 1807], 12734 [1809, 1809], 12735 [1840, 1866], 12736 [1958, 1968], 12737 [2027, 2035], 12738 [2305, 2306], 12739 [2364, 2364], 12740 [2369, 2376], 12741 [2381, 2381], 12742 [2385, 2388], 12743 [2402, 2403], 12744 [2433, 2433], 12745 [2492, 2492], 12746 [2497, 2500], 12747 [2509, 2509], 12748 [2530, 2531], 12749 [2561, 2562], 12750 [2620, 2620], 12751 [2625, 2626], 12752 [2631, 2632], 12753 [2635, 2637], 12754 [2672, 2673], 12755 [2689, 2690], 12756 [2748, 2748], 12757 [2753, 2757], 12758 [2759, 2760], 12759 [2765, 2765], 12760 [2786, 2787], 12761 [2817, 2817], 12762 [2876, 2876], 12763 [2879, 2879], 12764 [2881, 2883], 12765 [2893, 2893], 12766 [2902, 2902], 12767 [2946, 2946], 12768 [3008, 3008], 12769 [3021, 3021], 12770 [3134, 3136], 12771 [3142, 3144], 12772 [3146, 3149], 12773 [3157, 3158], 12774 [3260, 3260], 12775 [3263, 3263], 12776 [3270, 3270], 12777 [3276, 3277], 12778 [3298, 3299], 12779 [3393, 3395], 12780 [3405, 3405], 12781 [3530, 3530], 12782 [3538, 3540], 12783 [3542, 3542], 12784 [3633, 3633], 12785 [3636, 3642], 12786 [3655, 3662], 12787 [3761, 3761], 12788 [3764, 3769], 12789 [3771, 3772], 12790 [3784, 3789], 12791 [3864, 3865], 12792 [3893, 3893], 12793 [3895, 3895], 12794 [3897, 3897], 12795 [3953, 3966], 12796 [3968, 3972], 12797 [3974, 3975], 12798 [3984, 3991], 12799 [3993, 4028], 12800 [4038, 4038], 12801 [4141, 4144], 12802 [4146, 4146], 12803 [4150, 4151], 12804 [4153, 4153], 12805 [4184, 4185], 12806 [4448, 4607], 12807 [4959, 4959], 12808 [5906, 5908], 12809 [5938, 5940], 12810 [5970, 5971], 12811 [6002, 6003], 12812 [6068, 6069], 12813 [6071, 6077], 12814 [6086, 6086], 12815 [6089, 6099], 12816 [6109, 6109], 12817 [6155, 6157], 12818 [6313, 6313], 12819 [6432, 6434], 12820 [6439, 6440], 12821 [6450, 6450], 12822 [6457, 6459], 12823 [6679, 6680], 12824 [6912, 6915], 12825 [6964, 6964], 12826 [6966, 6970], 12827 [6972, 6972], 12828 [6978, 6978], 12829 [7019, 7027], 12830 [7616, 7626], 12831 [7678, 7679], 12832 [8203, 8207], 12833 [8234, 8238], 12834 [8288, 8291], 12835 [8298, 8303], 12836 [8400, 8431], 12837 [12330, 12335], 12838 [12441, 12442], 12839 [43014, 43014], 12840 [43019, 43019], 12841 [43045, 43046], 12842 [64286, 64286], 12843 [65024, 65039], 12844 [65056, 65059], 12845 [65279, 65279], 12846 [65529, 65531], 12847 [68097, 68099], 12848 [68101, 68102], 12849 [68108, 68111], 12850 [68152, 68154], 12851 [68159, 68159], 12852 [119143, 119145], 12853 [119155, 119170], 12854 [119173, 119179], 12855 [119210, 119213], 12856 [119362, 119364], 12857 [917505, 917505], 12858 [917536, 917631], 12859 [917760, 917999] 12860 ]; 12861}); 12862
vendor: 1,756 bytes, lines 12863-12919
12863// node_modules/wcwidth/index.js 12864var require_wcwidth = __commonJS(function(exports2, module2) { 12865 var defaults = require_defaults(); 12866 var combining = require_combining(); 12867 var DEFAULTS = { 12868 nul: 0, 12869 control: 0 12870 }; 12871 module2.exports = function wcwidth2(str) { 12872 return wcswidth(str, DEFAULTS); 12873 }; 12874 module2.exports.config = function(opts) { 12875 opts = defaults(opts || {}, DEFAULTS); 12876 return function wcwidth2(str) { 12877 return wcswidth(str, opts); 12878 }; 12879 }; 12880 function wcswidth(str, opts) { 12881 if (typeof str !== "string") 12882 return wcwidth2(str, opts); 12883 var s = 0; 12884 for (var i = 0;i < str.length; i++) { 12885 var n = wcwidth2(str.charCodeAt(i), opts); 12886 if (n < 0) 12887 return -1; 12888 s += n; 12889 } 12890 return s; 12891 } 12892 function wcwidth2(ucs, opts) { 12893 if (ucs === 0) 12894 return opts.nul; 12895 if (ucs < 32 || ucs >= 127 && ucs < 160) 12896 return opts.control; 12897 if (bisearch(ucs)) 12898 return 0; 12899 return 1 + (ucs >= 4352 && (ucs <= 4447 || ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || ucs >= 44032 && ucs <= 55203 || ucs >= 63744 && ucs <= 64255 || ucs >= 65040 && ucs <= 65049 || ucs >= 65072 && ucs <= 65135 || ucs >= 65280 && ucs <= 65376 || ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141)); 12900 } 12901 function bisearch(ucs) { 12902 var min = 0; 12903 var max = combining.length - 1; 12904 var mid; 12905 if (ucs < combining[0][0] || ucs > combining[max][1]) 12906 return false; 12907 while (max >= min) { 12908 mid = Math.floor((min + max) / 2); 12909 if (ucs > combining[mid][1]) 12910 min = mid + 1; 12911 else if (ucs < combining[mid][0]) 12912 max = mid - 1; 12913 else 12914 return true; 12915 } 12916 return false; 12917 } 12918}); 12919
vendor: 388,716 bytes, lines 12920-24089
12920// node_modules/jquery.terminal/js/jquery.terminal.js 12921var require_jquery_terminal = __commonJS(function(exports, module) { 12922 (function(ctx) { 12923 var sprintf2 = function() { 12924 if (!sprintf2.cache.hasOwnProperty(arguments[0])) { 12925 sprintf2.cache[arguments[0]] = sprintf2.parse(arguments[0]); 12926 } 12927 return sprintf2.format.call(null, sprintf2.cache[arguments[0]], arguments); 12928 }; 12929 sprintf2.format = function(parse_tree, argv) { 12930 var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length; 12931 for (i = 0;i < tree_length; i++) { 12932 node_type = get_type2(parse_tree[i]); 12933 if (node_type === "string") { 12934 output.push(parse_tree[i]); 12935 } else if (node_type === "array") { 12936 match = parse_tree[i]; 12937 if (match[2]) { 12938 arg = argv[cursor]; 12939 for (k = 0;k < match[2].length; k++) { 12940 if (!arg.hasOwnProperty(match[2][k])) { 12941 throw sprintf2('[sprintf] property "%s" does not exist', match[2][k]); 12942 } 12943 arg = arg[match[2][k]]; 12944 } 12945 } else if (match[1]) { 12946 arg = argv[match[1]]; 12947 } else { 12948 arg = argv[cursor++]; 12949 } 12950 if (/[^s]/.test(match[8]) && get_type2(arg) !== "number") { 12951 throw sprintf2("[sprintf] expecting number but found %s", get_type2(arg)); 12952 } 12953 switch (match[8]) { 12954 case "b": 12955 arg = arg.toString(2); 12956 break; 12957 case "c": 12958 arg = String.fromCharCode(arg); 12959 break; 12960 case "d": 12961 arg = parseInt(arg, 10); 12962 break; 12963 case "e": 12964 arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); 12965 break; 12966 case "f": 12967 arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); 12968 break; 12969 case "o": 12970 arg = arg.toString(8); 12971 break; 12972 case "s": 12973 arg = (arg = String(arg)) && match[7] ? arg.slice(0, match[7]) : arg; 12974 break; 12975 case "u": 12976 arg = arg >>> 0; 12977 break; 12978 case "x": 12979 arg = arg.toString(16); 12980 break; 12981 case "X": 12982 arg = arg.toString(16).toUpperCase(); 12983 break; 12984 } 12985 arg = /[def]/.test(match[8]) && match[3] && arg >= 0 ? " +" + arg : arg; 12986 pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " "; 12987 pad_length = match[6] - String(arg).length; 12988 pad = match[6] ? str_repeat(pad_character, pad_length) : ""; 12989 output.push(match[5] ? arg + pad : pad + arg); 12990 } 12991 } 12992 return output.join(""); 12993 }; 12994 sprintf2.cache = {}; 12995 sprintf2.parse = function(fmt) { 12996 var _fmt = fmt, match = [], parse_tree = [], arg_names = 0; 12997 while (_fmt) { 12998 if ((match = /^[^\x25]+/.exec(_fmt)) !== null) { 12999 parse_tree.push(match[0]); 13000 } else if ((match = /^\x25{2}/.exec(_fmt)) !== null) { 13001 parse_tree.push("%"); 13002 } else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) { 13003 if (match[2]) { 13004 arg_names |= 1; 13005 var field_list = [], replacement_field = match[2], field_match = []; 13006 if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { 13007 field_list.push(field_match[1]); 13008 while ((replacement_field = replacement_field.slice(field_match[0].length)) !== "") { 13009 if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { 13010 field_list.push(field_match[1]); 13011 } else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) { 13012 field_list.push(field_match[1]); 13013 } else { 13014 throw "[sprintf] huh?"; 13015 } 13016 } 13017 } else { 13018 throw "[sprintf] huh?"; 13019 } 13020 match[2] = field_list; 13021 } else { 13022 arg_names |= 2; 13023 } 13024 if (arg_names === 3) { 13025 throw "[sprintf] mixing positional and named placeholders is not (yet) supported"; 13026 } 13027 parse_tree.push(match); 13028 } else { 13029 throw "[sprintf] huh?"; 13030 } 13031 _fmt = _fmt.slice(match[0].length); 13032 } 13033 return parse_tree; 13034 }; 13035 var vsprintf = function(fmt, argv, _argv) { 13036 _argv = argv.slice(0); 13037 _argv.splice(0, 0, fmt); 13038 return sprintf2.apply(null, _argv); 13039 }; 13040 function get_type2(variable) { 13041 return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); 13042 } 13043 function str_repeat(input, multiplier) { 13044 for (var output = [];multiplier > 0; output[--multiplier] = input) {} 13045 return output.join(""); 13046 } 13047 ctx.sprintf = sprintf2; 13048 ctx.vsprintf = vsprintf; 13049 })(typeof global !== "undefined" ? global : self || window); 13050 (function(factory, undefined2) { 13051 var root2; 13052 if (typeof window !== "undefined") { 13053 root2 = window; 13054 } else if (typeof self !== "undefined") { 13055 root2 = self; 13056 } else if (typeof global !== "undefined") { 13057 root2 = global; 13058 } else { 13059 throw new Error("Unknow context"); 13060 } 13061 if (typeof define === "function" && define.amd) { 13062 define(["jquery", "wcwidth"], function(jquery, wcwidth2) { 13063 factory(jquery, wcwidth2, root2); 13064 return jquery; 13065 }); 13066 } else if (typeof module === "object" && module.exports) { 13067 module.exports = function(root2, jQuery2, wcwidth2) { 13068 if (jQuery2 === undefined2) { 13069 if (typeof window !== "undefined") { 13070 jQuery2 = require_jquery(); 13071 } else { 13072 jQuery2 = require_jquery()(root2); 13073 } 13074 } 13075 if (wcwidth2 === undefined2) { 13076 wcwidth2 = require_wcwidth(); 13077 } 13078 factory(jQuery2, wcwidth2, root2); 13079 return jQuery2; 13080 }; 13081 } else { 13082 if (!root2.jQuery) { 13083 root2.$ = root2.cash; 13084 } 13085 factory(root2.jQuery || root2.cash, root2.wcwidth, root2); 13086 } 13087 })(function($, wcwidth, root, undefined) { 13088 function debug(str) { 13089 if (false) {} 13090 } 13091 function DelayQueue() { 13092 var callbacks = $.Callbacks(); 13093 var resolved = false; 13094 var self2 = this; 13095 this.resolve = function() { 13096 callbacks.fire(); 13097 self2.resolved = resolved = true; 13098 }; 13099 this.add = function(fn2) { 13100 if (resolved) { 13101 fn2(); 13102 } else { 13103 callbacks.add(fn2); 13104 } 13105 }; 13106 } 13107 function EventEmitter() { 13108 this._events = {}; 13109 } 13110 EventEmitter.prototype.on = function(event, listener) { 13111 if (!this._events[event]) { 13112 this._events[event] = []; 13113 } 13114 this._events[event].push(listener); 13115 }; 13116 EventEmitter.prototype.emit = function(event) { 13117 if (this._events[event]) { 13118 var args2 = Array.prototype.slice.call(arguments, 1); 13119 this._events[event].forEach(function(listener) { 13120 listener.apply(null, args2); 13121 }); 13122 } 13123 }; 13124 EventEmitter.prototype.off = function(event, listener) { 13125 if (!this._events[event]) { 13126 return; 13127 } 13128 if (!listener) { 13129 delete this._events[event]; 13130 } else { 13131 this._events[event] = this._events[event].filter(function(l) { 13132 return l !== listener; 13133 }); 13134 } 13135 }; 13136 EventEmitter.prototype.once = function(event, listener) { 13137 var self2 = this; 13138 function wrapper() { 13139 self2.off(event, wrapper); 13140 listener.apply(null, arguments); 13141 } 13142 this.on(event, wrapper); 13143 }; 13144 EventEmitter.prototype.wait_for = function(event) { 13145 var deferred2 = new $.Deferred; 13146 this.once(event, function() { 13147 deferred2.resolve(); 13148 }); 13149 return deferred2.promise(); 13150 }; 13151 $.omap = function(o, fn2) { 13152 var result = {}; 13153 $.each(o, function(k, v) { 13154 result[k] = fn2.call(o, k, v); 13155 }); 13156 return result; 13157 }; 13158 $.fn.text_length = function() { 13159 return this.map(function() { 13160 return $(this).text().length; 13161 }).get().reduce(function(a, b) { 13162 return a + b; 13163 }, 0); 13164 }; 13165 var Clone = { 13166 clone_object: function(object) { 13167 var tmp = {}; 13168 if (typeof object === "object") { 13169 if (Array.isArray(object)) { 13170 return this.clone_array(object); 13171 } else if (object === null) { 13172 return object; 13173 } else { 13174 for (var key in object) { 13175 if (!object.hasOwnProperty(key)) { 13176 continue; 13177 } 13178 if (Array.isArray(object[key])) { 13179 tmp[key] = this.clone_array(object[key]); 13180 } else if (typeof object[key] === "object") { 13181 tmp[key] = this.clone_object(object[key]); 13182 } else { 13183 tmp[key] = object[key]; 13184 } 13185 } 13186 } 13187 } 13188 return tmp; 13189 }, 13190 clone_array: function(array) { 13191 if (!is_function(Array.prototype.map)) { 13192 throw new Error("Your browser don't support ES5 array map " + "use es5-shim"); 13193 } 13194 return array.slice(0).map(function(item) { 13195 if (typeof item === "object") { 13196 return this.clone_object(item); 13197 } else { 13198 return item; 13199 } 13200 }.bind(this)); 13201 } 13202 }; 13203 var clone = function(object) { 13204 return Clone.clone_object(object); 13205 }; 13206 if ("Map" in root && !("clear" in Map.prototype)) { 13207 Map.prototype.clear = function() { 13208 this.forEach(function(value, key, map) { 13209 map.delete(key); 13210 }); 13211 }; 13212 } 13213 var localStorage; 13214 (function() { 13215 var hasLS = function() { 13216 try { 13217 var testKey = "test", storage = window.localStorage; 13218 storage.setItem(testKey, "1"); 13219 storage.removeItem(testKey); 13220 return true; 13221 } catch (error) { 13222 return false; 13223 } 13224 }; 13225 var hasCookies = function() { 13226 try { 13227 document.cookie.split(";"); 13228 return true; 13229 } catch (e) { 13230 return false; 13231 } 13232 }; 13233 var isLS = hasLS(); 13234 function wls(n, v) { 13235 var c; 13236 if (typeof n === "string" && typeof v === "string") { 13237 localStorage[n] = v; 13238 return true; 13239 } else if (typeof n === "object" && typeof v === "undefined") { 13240 for (c in n) { 13241 if (n.hasOwnProperty(c)) { 13242 localStorage[c] = n[c]; 13243 } 13244 } 13245 return true; 13246 } 13247 return false; 13248 } 13249 function wc(n, v) { 13250 var dt, e, c; 13251 dt = new Date; 13252 dt.setTime(dt.getTime() + 31536000000); 13253 e = "; expires=" + dt.toGMTString(); 13254 if (typeof n === "string" && typeof v === "string") { 13255 document.cookie = n + "=" + v + e + "; path=/"; 13256 return true; 13257 } else if (typeof n === "object" && typeof v === "undefined") { 13258 for (c in n) { 13259 if (n.hasOwnProperty(c)) { 13260 document.cookie = c + "=" + n[c] + e + "; path=/"; 13261 } 13262 } 13263 return true; 13264 } 13265 return false; 13266 } 13267 function rls(n) { 13268 return localStorage[n]; 13269 } 13270 function rc(n) { 13271 var nn, ca, i, c; 13272 nn = n + "="; 13273 ca = document.cookie.split(";"); 13274 for (i = 0;i < ca.length; i++) { 13275 c = ca[i]; 13276 while (c.charAt(0) === " ") { 13277 c = c.slice(1, c.length); 13278 } 13279 if (c.indexOf(nn) === 0) { 13280 return c.slice(nn.length, c.length); 13281 } 13282 } 13283 return null; 13284 } 13285 function dls(n) { 13286 return delete localStorage[n]; 13287 } 13288 function dc(n) { 13289 return wc(n, "", -1); 13290 } 13291 if (!hasCookies() && !isLS) { 13292 localStorage = {}; 13293 $.extend({ 13294 Storage: { 13295 set: wls, 13296 get: rls, 13297 remove: dls 13298 } 13299 }); 13300 } else { 13301 if (isLS) { 13302 localStorage = window.localStorage; 13303 } 13304 $.extend({ 13305 Storage: { 13306 set: isLS ? wls : wc, 13307 get: isLS ? rls : rc, 13308 remove: isLS ? dls : dc 13309 } 13310 }); 13311 } 13312 })(); 13313 var debounce = function() { 13314 var FUNC_ERROR_TEXT = "Expected a function"; 13315 function isObject(value) { 13316 var type = typeof value; 13317 return value != null && (type == "object" || type == "function"); 13318 } 13319 function now() { 13320 return Date.now(); 13321 } 13322 return function debounce2(func, wait, options2) { 13323 var { max: nativeMax, min: nativeMin } = Math; 13324 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; 13325 if (typeof func != "function") { 13326 throw new TypeError(FUNC_ERROR_TEXT); 13327 } 13328 wait = wait || 0; 13329 if (isObject(options2)) { 13330 leading = !!options2.leading; 13331 maxing = "maxWait" in options2; 13332 maxWait = maxing ? nativeMax(options2.maxWait || 0, wait) : maxWait; 13333 trailing = "trailing" in options2 ? !!options2.trailing : trailing; 13334 } 13335 function invokeFunc(time) { 13336 var args2 = lastArgs, thisArg = lastThis; 13337 lastArgs = lastThis = undefined; 13338 lastInvokeTime = time; 13339 result = func.apply(thisArg, args2); 13340 return result; 13341 } 13342 function leadingEdge(time) { 13343 lastInvokeTime = time; 13344 timerId = setTimeout(timerExpired, wait); 13345 return leading ? invokeFunc(time) : result; 13346 } 13347 function remainingWait(time) { 13348 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; 13349 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; 13350 } 13351 function shouldInvoke(time) { 13352 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; 13353 return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; 13354 } 13355 function timerExpired() { 13356 var time = now(); 13357 if (shouldInvoke(time)) { 13358 return trailingEdge(time); 13359 } 13360 timerId = setTimeout(timerExpired, remainingWait(time)); 13361 } 13362 function trailingEdge(time) { 13363 timerId = undefined; 13364 if (trailing && lastArgs) { 13365 return invokeFunc(time); 13366 } 13367 lastArgs = lastThis = undefined; 13368 return result; 13369 } 13370 function cancel() { 13371 if (timerId !== undefined) { 13372 clearTimeout(timerId); 13373 } 13374 lastInvokeTime = 0; 13375 lastArgs = lastCallTime = lastThis = timerId = undefined; 13376 } 13377 function flush() { 13378 return timerId === undefined ? result : trailingEdge(now()); 13379 } 13380 function debounced() { 13381 var time = now(), isInvoking = shouldInvoke(time); 13382 lastArgs = arguments; 13383 lastThis = this; 13384 lastCallTime = time; 13385 if (isInvoking) { 13386 if (timerId === undefined) { 13387 return leadingEdge(lastCallTime); 13388 } 13389 if (maxing) { 13390 timerId = setTimeout(timerExpired, wait); 13391 return invokeFunc(lastCallTime); 13392 } 13393 } 13394 if (timerId === undefined) { 13395 timerId = setTimeout(timerExpired, wait); 13396 } 13397 return result; 13398 } 13399 debounced.cancel = cancel; 13400 debounced.flush = flush; 13401 return debounced; 13402 }; 13403 }(); 13404 var jQuery = $; 13405 (function($2) { 13406 jQuery.fn.extend({ 13407 everyTime: function(interval, label, fn2, times, belay) { 13408 return this.each(function() { 13409 jQuery.timer.add(this, interval, label, fn2, times, belay); 13410 }); 13411 }, 13412 oneTime: function(interval, label, fn2) { 13413 return this.each(function() { 13414 jQuery.timer.add(this, interval, label, fn2, 1); 13415 }); 13416 }, 13417 stopTime: function(label, fn2) { 13418 return this.each(function() { 13419 jQuery.timer.remove(this, label, fn2); 13420 }); 13421 } 13422 }); 13423 jQuery.extend({ 13424 timer: { 13425 guid: 1, 13426 global: {}, 13427 regex: /^([0-9]+)\s*(.*s)?$/, 13428 powers: { 13429 ms: 1, 13430 cs: 10, 13431 ds: 100, 13432 s: 1000, 13433 das: 1e4, 13434 hs: 1e5, 13435 ks: 1e6 13436 }, 13437 timeParse: function(value) { 13438 if (value === undefined || value === null) { 13439 return null; 13440 } 13441 var result = this.regex.exec(value.toString().trim()); 13442 if (result[2]) { 13443 var num = parseInt(result[1], 10); 13444 var mult = this.powers[result[2]] || 1; 13445 return num * mult; 13446 } else { 13447 return value; 13448 } 13449 }, 13450 add: function(element, interval, label, fn2, times, belay) { 13451 var counter = 0; 13452 if (typeof label === "function") { 13453 if (!times) { 13454 times = fn2; 13455 } 13456 fn2 = label; 13457 label = interval; 13458 } 13459 interval = jQuery.timer.timeParse(interval); 13460 if (typeof interval !== "number" || isNaN(interval) || interval <= 0) { 13461 return; 13462 } 13463 if (times && times.constructor !== Number) { 13464 belay = !!times; 13465 times = 0; 13466 } 13467 times = times || 0; 13468 belay = belay || false; 13469 if (!element.$timers) { 13470 element.$timers = {}; 13471 } 13472 if (!element.$timers[label]) { 13473 element.$timers[label] = {}; 13474 } 13475 fn2.$timerID = fn2.$timerID || this.guid++; 13476 var handler = function() { 13477 if (belay && handler.inProgress) { 13478 return; 13479 } 13480 handler.inProgress = true; 13481 if (++counter > times && times !== 0 || fn2.call(element, counter) === false) { 13482 jQuery.timer.remove(element, label, fn2); 13483 } 13484 handler.inProgress = false; 13485 }; 13486 handler.$timerID = fn2.$timerID; 13487 if (!element.$timers[label][fn2.$timerID]) { 13488 element.$timers[label][fn2.$timerID] = setInterval(handler, interval); 13489 } 13490 if (!this.global[label]) { 13491 this.global[label] = []; 13492 } 13493 this.global[label].push(element); 13494 }, 13495 remove: function(element, label, fn2) { 13496 var timers = element.$timers, ret2; 13497 if (timers) { 13498 if (!label) { 13499 for (var lab in timers) { 13500 if (timers.hasOwnProperty(lab)) { 13501 this.remove(element, lab, fn2); 13502 } 13503 } 13504 } else if (timers[label]) { 13505 if (fn2) { 13506 if (fn2.$timerID) { 13507 clearInterval(timers[label][fn2.$timerID]); 13508 delete timers[label][fn2.$timerID]; 13509 } 13510 } else { 13511 for (var _fn in timers[label]) { 13512 if (timers[label].hasOwnProperty(_fn)) { 13513 clearInterval(timers[label][_fn]); 13514 delete timers[label][_fn]; 13515 } 13516 } 13517 } 13518 for (ret2 in timers[label]) { 13519 if (timers[label].hasOwnProperty(ret2)) { 13520 break; 13521 } 13522 } 13523 if (!ret2) { 13524 ret2 = null; 13525 delete timers[label]; 13526 } 13527 } 13528 for (ret2 in timers) { 13529 if (timers.hasOwnProperty(ret2)) { 13530 break; 13531 } 13532 } 13533 if (!ret2) { 13534 element.$timers = null; 13535 } 13536 } 13537 } 13538 } 13539 }); 13540 if (/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())) { 13541 $2(window).one("unload", function() { 13542 var global2 = jQuery.timer.global; 13543 for (var label in global2) { 13544 if (global2.hasOwnProperty(label)) { 13545 var els = global2[label], i = els.length; 13546 while (--i) { 13547 jQuery.timer.remove(els[i], label); 13548 } 13549 } 13550 } 13551 }); 13552 } 13553 })(jQuery); 13554 (function(undef) { 13555 if (!String.prototype.split.toString().match(/\[native/)) { 13556 return; 13557 } 13558 var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, self2; 13559 self2 = function(str, separator, limit) { 13560 if (Object.prototype.toString.call(separator) !== "[object RegExp]") { 13561 return nativeSplit.call(str, separator, limit); 13562 } 13563 var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + (separator.sticky ? "y" : ""), lastLastIndex = 0, separator2, match, lastIndex, lastLength; 13564 separator = new RegExp(separator.source, flags + "g"); 13565 str += ""; 13566 if (!compliantExecNpcg) { 13567 separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); 13568 } 13569 limit = limit === undef ? -1 >>> 0 : limit >>> 0; 13570 while (match = separator.exec(str)) { 13571 lastIndex = match.index + match[0].length; 13572 if (lastIndex > lastLastIndex) { 13573 output.push(str.slice(lastLastIndex, match.index)); 13574 if (!compliantExecNpcg && match.length > 1) { 13575 match[0].replace(separator2, function() { 13576 for (var i = 1;i < arguments.length - 2; i++) { 13577 if (arguments[i] === undef) { 13578 match[i] = undef; 13579 } 13580 } 13581 }); 13582 } 13583 if (match.length > 1 && match.index < str.length) { 13584 Array.prototype.push.apply(output, match.slice(1)); 13585 } 13586 lastLength = match[0].length; 13587 lastLastIndex = lastIndex; 13588 if (output.length >= limit) { 13589 break; 13590 } 13591 } 13592 if (separator.lastIndex === match.index) { 13593 separator.lastIndex++; 13594 } 13595 } 13596 if (lastLastIndex === str.length) { 13597 if (lastLength || !separator.test("")) { 13598 output.push(""); 13599 } 13600 } else { 13601 output.push(str.slice(lastLastIndex)); 13602 } 13603 return output.length > limit ? output.slice(0, limit) : output; 13604 }; 13605 String.prototype.split = function(separator, limit) { 13606 return self2(this, separator, limit); 13607 }; 13608 return self2; 13609 })(); 13610 $.fn.caret = function(pos) { 13611 var target = this[0]; 13612 var isContentEditable = target.contentEditable === "true"; 13613 if (arguments.length === 0) { 13614 if (window.getSelection) { 13615 if (isContentEditable) { 13616 if (!this.is(":focus")) { 13617 target.focus(); 13618 } 13619 var range1 = window.getSelection().getRangeAt(0), range2 = range1.cloneRange(); 13620 range2.selectNodeContents(target); 13621 range2.setEnd(range1.endContainer, range1.endOffset); 13622 return range2.toString().length; 13623 } 13624 return target.selectionStart; 13625 } 13626 if (document.selection) { 13627 target.focus(); 13628 if (isContentEditable) { 13629 var range1 = document.selection.createRange(), range2 = document.body.createTextRange(); 13630 range2.moveToElementText(target); 13631 range2.setEndPoint("EndToEnd", range1); 13632 return range2.text.length; 13633 } 13634 var pos = 0, range = target.createTextRange(), range2 = document.selection.createRange().duplicate(), bookmark = range2.getBookmark(); 13635 range.moveToBookmark(bookmark); 13636 while (range.moveStart("character", -1) !== 0) 13637 pos++; 13638 return pos; 13639 } 13640 return 0; 13641 } 13642 if (pos === -1) 13643 pos = this[isContentEditable ? "text" : "val"]().length; 13644 if (window.getSelection) { 13645 if (isContentEditable) { 13646 if (!this.is(":focus")) { 13647 target.focus(); 13648 } 13649 var selection = window.getSelection(); 13650 selection.collapse(selection.focusNode, pos); 13651 } else 13652 target.setSelectionRange(pos, pos); 13653 } else if (document.body.createTextRange) { 13654 var range = document.body.createTextRange(); 13655 range.moveToElementText(target); 13656 range.moveStart("character", pos); 13657 range.collapse(true); 13658 range.select(); 13659 } 13660 if (!isContentEditable && !this.is(":focus")) { 13661 target.focus(); 13662 } 13663 return pos; 13664 }; 13665 function make_callback_plugin(options2) { 13666 var factory_settings = $.extend({ 13667 init: $.noop, 13668 destroy: $.noop, 13669 name: "event" 13670 }, options2); 13671 return function(callback, options2) { 13672 var trigger = arguments.length === 0; 13673 var unbind = arguments[0] === "unbind"; 13674 if (!trigger && !unbind && !is_function(callback)) { 13675 throw new Error("Invalid argument, it need to a function or string " + '"unbind" or no arguments.'); 13676 } 13677 if (unbind) { 13678 callback = is_function(arguments[1]) ? arguments[1] : null; 13679 } 13680 var data_name = "callbacks_" + factory_settings.name; 13681 return this.each(function() { 13682 var $this = $(this); 13683 var callbacks; 13684 function handler(arg) { 13685 callbacks.fireWith($this, [arg]); 13686 } 13687 if (trigger || unbind) { 13688 callbacks = $this.data(data_name); 13689 if (trigger) { 13690 callbacks && callbacks.fire(); 13691 } else { 13692 if (callback && callbacks) { 13693 callbacks.remove(callback); 13694 if (!callbacks.has()) { 13695 callbacks = null; 13696 } 13697 } else { 13698 callbacks = null; 13699 } 13700 if (!callbacks) { 13701 $this.removeData(data_name); 13702 factory_settings.destroy.call(this, handler, options2); 13703 } 13704 } 13705 } else if ($this.data(data_name)) { 13706 $(this).data(data_name).add(callback); 13707 } else { 13708 callbacks = $.Callbacks(); 13709 callbacks.add(callback); 13710 $this.data(data_name, callbacks); 13711 factory_settings.init.call(this, handler, options2); 13712 } 13713 }); 13714 }; 13715 } 13716 $.fn.resizer = make_callback_plugin({ 13717 name: "resize", 13718 init: function(handler, options2) { 13719 var settings2 = $.extend({ 13720 prefix: "" 13721 }, options2); 13722 var $this = $(this); 13723 var resizer; 13724 var first = true; 13725 if ($this.is("body")) { 13726 $(window).on("resize.resizer", handler); 13727 } else if (window.ResizeObserver) { 13728 resizer = new ResizeObserver(function() { 13729 if (!first) { 13730 setTimeout(handler, 0); 13731 } 13732 first = false; 13733 }); 13734 resizer.observe(this); 13735 $this.data("observer", resizer); 13736 } else { 13737 var iframe = $("<iframe/>").addClass(settings2.prefix + "resizer").appendTo(this)[0]; 13738 $(iframe.contentWindow).on("resize", handler); 13739 } 13740 }, 13741 destroy: function() { 13742 var $this = $(this); 13743 if (window.ResizeObserver) { 13744 var observer = $this.data("observer"); 13745 if (observer) { 13746 observer.unobserve(this); 13747 $this.removeData("observer"); 13748 } 13749 } else { 13750 var iframe = $this.find('> iframe[class$="resizer"]'); 13751 if (iframe.length) { 13752 $(iframe[0].contentWindow).off("resize").remove(); 13753 iframe.remove(); 13754 } else if ($this.is("body")) { 13755 $(window).off("resize.resizer"); 13756 } 13757 } 13758 } 13759 }); 13760 $.fn.touch_scroll = make_callback_plugin({ 13761 name: "touch", 13762 init: function(handler) { 13763 var origin; 13764 var previous; 13765 $(this).on("touchstart.scroll", function(e) { 13766 e = e.originalEvent; 13767 if (e.target.tagName.toLowerCase() !== "a" && e.touches.length === 1) { 13768 previous = origin = e.touches[0]; 13769 } 13770 }).on("touchmove.scroll", function(e) { 13771 e = e.originalEvent; 13772 if (origin && e.touches.length === 1) { 13773 var current = e.touches[0]; 13774 var ret2 = handler({ 13775 origin, 13776 previous, 13777 current 13778 }); 13779 if (ret2 === false) { 13780 e.preventDefault(); 13781 } 13782 previous = current; 13783 } 13784 }).on("touchend.scroll", function() { 13785 if (origin || previous) { 13786 origin = previous = null; 13787 } 13788 }); 13789 }, 13790 destroy: function() { 13791 $(this).off("touchstart.scroll touchmove.scroll touchend.scroll"); 13792 } 13793 }); 13794 $.fn.on_load = function(options2) { 13795 var settings2 = $.extend({ 13796 error: $.noop, 13797 load: $.noop, 13798 done: $.noop 13799 }, options2); 13800 var defers = []; 13801 this.find("img,iframe").each(function() { 13802 var self2 = $(this); 13803 var defer = new $.Deferred; 13804 self2.on("load", defer.resolve).on("error", function() { 13805 settings2.error(self2); 13806 defer.reject(); 13807 }); 13808 defers.push(defer); 13809 }); 13810 settings2.load(!!defers.length); 13811 if (defers.length) { 13812 $.when.apply($, defers).then(function() { 13813 settings2.done(true); 13814 }); 13815 } else { 13816 settings2.done(false); 13817 } 13818 return this; 13819 }; 13820 function jquery_resolve(value) { 13821 var defer = jQuery.Deferred(); 13822 defer.resolve(value); 13823 return defer.promise(); 13824 } 13825 function always(value, callback) { 13826 if (is_function(value.finally)) { 13827 return value.finally(callback); 13828 } 13829 if (is_function(value.always)) { 13830 return value.always(callback); 13831 } 13832 return value; 13833 } 13834 function unpromise(value, callback, error) { 13835 if (value !== undefined) { 13836 if (is_promise(value)) { 13837 if (is_function(value.done)) { 13838 value = value.done(callback); 13839 } else if (is_function(value.then)) { 13840 value = value.then(callback); 13841 } 13842 if (is_function(value.catch) && is_function(error)) { 13843 value.catch(error); 13844 } 13845 return value; 13846 } else if (value instanceof Array) { 13847 var promises = value.filter(function(value) { 13848 return value && (is_function(value.done) || is_function(value.then)); 13849 }); 13850 if (promises.length) { 13851 var result = $.when.apply($, value).then(function() { 13852 return callback([].slice.call(arguments)); 13853 }); 13854 if (is_function(result.catch)) { 13855 result = result.catch(error); 13856 } 13857 return result; 13858 } 13859 } 13860 try { 13861 return callback(value); 13862 } catch (e) { 13863 if (is_function(error)) { 13864 error(e); 13865 } else { 13866 throw e; 13867 } 13868 } 13869 } 13870 } 13871 function defined(value) { 13872 return value === undefined ? true : value; 13873 } 13874 $.fn.is_fully_in_viewport = function() { 13875 function is_visible(node, container) { 13876 var box = node.getBoundingClientRect(); 13877 var viewport = container[0].getBoundingClientRect(); 13878 var top = box.top - viewport.top; 13879 var bottom = box.bottom - viewport.top; 13880 var height = container.height(); 13881 return bottom > 0 && top <= height; 13882 } 13883 if (root.IntersectionObserver) { 13884 return function(container) { 13885 var node = this[0]; 13886 var defer = jQuery.Deferred(); 13887 var item_observer = new root.IntersectionObserver(function(entries) { 13888 defer.resolve(entries[0].isIntersecting && entries[0].ratio === 1); 13889 item_observer.unobserve(node); 13890 }, { 13891 root: container[0] 13892 }); 13893 item_observer.observe(node); 13894 return defer.promise(); 13895 }; 13896 } else { 13897 return function(container) { 13898 return jquery_resolve(is_visible(this[0], container)); 13899 }; 13900 } 13901 }(); 13902 var entity_re = /(&(?:[a-z\d]+|#\d+|#x[a-f\d]+);)/i; 13903 var space_re = /\s/; 13904 var combine_chr_re = /(.(?:[\u0300-\u036F]|[\u1AB0-\u1abE]|[\u1DC0-\u1DF9]|[\u1DFB-\u1DFF]|[\u20D0-\u20F0]|[\uFE20-\uFE2F])+)/; 13905 var astral_symbols_re = /([\uD800-\uDBFF][\uDC00-\uDFFF])/; 13906 var emoji_re = /(\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\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFE])|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC3B\u200D\u2744|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDF])\u200D[\u2640\u2642])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\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])|[#\*0-9]\uFE0F\u20E3|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\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\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\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\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD]))/; 13907 var mobile_re = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i; 13908 var tablet_re = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i; 13909 var format_split_re = /(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\](?:[^\]\\]*(?:\\\\)*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?)/i; 13910 var format_parts_re = /\[\[((?:-?[@!gbiusor])*);([^;]*);([^;\]]*);?([^;\]]*);?([^\]]*)\]([^\]\\]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]+)\]?/gi; 13911 var format_re = /\[\[((?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi; 13912 var format_exist_re = /\[\[((?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]/gi; 13913 var format_full_re = /^(\[\[(?:(?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\])([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)(\])$/i; 13914 var format_begin_re = /(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\])/i; 13915 var format_start_re = /^(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\])/i; 13916 var format_end_re = /\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\]?$/i; 13917 var self_closing_re = /^(?:\[\[)?[^;]*@[^;]*;/; 13918 var color_re = /^(?:#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i; 13919 var url_re = /(\b(?:file|ftp|https?|blog:https?):\/\/(?:[^/\s]+\.[^/\s.]+)(?:\/[^\s]*)?(?:#[^\s]*)?)/gi; 13920 var url_nf_re = /\b(?![^"\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'\\<>\][)])+)/gi; 13921 var email_re = /((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g; 13922 var url_full_re = /^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\\\][)])+)$/gi; 13923 var email_full_re = /^((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g; 13924 var command_re = /((?:"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi; 13925 var extended_command_re = /^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/; 13926 var format_exec_split_re = /(\[\[(?:-?[@!gbiusor])*;[^\]]+\](?:\\[[\]]|[^\]])*\]|\[\[[\s\S]+?\]\])/; 13927 var format_exec_re = /(\[\[[\s\S]+?\]\])/; 13928 var float_re = /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/; 13929 var re_re = /^\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimsuy]*)$/; 13930 var string_re = /("(?:[^"\\]|\\(?:\\\\)*"|\\\\)*"|'(?:[^'\\]|\\(?:\\\\)*'|\\\\)*'|`(?:[^`\\]|\\(?:\\\\)*`|\\\\)*`)/; 13931 var unclosed_strings_re = /^(?=((?:[^"']+|"[^"\\]*(?:\\[^][^"\\]*)*"|'[^'\\]*(?:\\[^][^'\\]*)*')*))\1./; 13932 var broken_image = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14"><title id="title2">rounded</title><path id="terminal-broken-image" d="m 14,10 h 2 v 1 a 3,3 0 0 1 -3,3 H 3 A 3,3 0 0 1 0,11 H 4.5 A 1.00012,1.00012 0 0 0 5.207,10.707 L 6.5,9.414 7.793,10.707 a 0.99963,0.99963 0 0 0 1.41406,0 l 2.36719,-2.36719 1.80127,1.44092 A 0.99807,0.99807 0 0 0 14,10 Z M 16,3 V 8 H 14.35059 L 12.12451,6.21924 A 0.99846,0.99846 0 0 0 10.793,6.293 L 8.5,8.586 7.207,7.293 a 0.99962,0.99962 0 0 0 -1.41406,0 L 4.08594,9 H 0 V 3 A 3,3 0 0 1 3,0 h 10 a 3,3 0 0 1 3,3 z M 6,4.5 A 1.5,1.5 0 1 0 4.5,6 1.5,1.5 0 0 0 6,4.5 Z" /></svg>'; 13933 var use_broken_image = '<svg class="terminal-broken-image" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14" xmlns:xlink="http://www.w3.org/1999/xlink"><use xlink:href="#terminal-broken-image"/></svg>'; 13934 var animation_supported = function() { 13935 if (typeof document === "undefined") { 13936 return false; 13937 } 13938 var animation = false, domPrefixes = "Webkit Moz O ms Khtml".split(" "), elm = document.createElement("div"); 13939 if (elm.style.animationName) { 13940 animation = true; 13941 } 13942 if (animation === false) { 13943 for (var i = 0;i < domPrefixes.length; i++) { 13944 var name = domPrefixes[i] + "AnimationName"; 13945 if (elm.style[name] !== undefined) { 13946 animation = true; 13947 break; 13948 } 13949 } 13950 } 13951 elm = null; 13952 return animation; 13953 }(); 13954 var agent = (root.navigator || window.navigator).userAgent; 13955 var is_IE = /MSIE|Trident/.test(agent) || /rv:11.0/i.test(agent); 13956 var is_IEMobile = /IEMobile/.test(agent); 13957 var is_ch_unit_supported = function() { 13958 if (is_IE && !is_IEMobile) { 13959 return false; 13960 } 13961 if (typeof document === "undefined") { 13962 return true; 13963 } 13964 var div = document.createElement("div"); 13965 div.style.width = "1ch"; 13966 return div.style.width === "1ch"; 13967 }(); 13968 var is_css_variables_supported = root.CSS && root.CSS.supports && root.CSS.supports("(--fake-var: 0)"); 13969 var is_android = navigator.userAgent.toLowerCase().indexOf("android") !== -1; 13970 var is_key_native = function is_key_native2() { 13971 if (!(("KeyboardEvent" in root) && ("key" in root.KeyboardEvent.prototype))) { 13972 return false; 13973 } 13974 var proto = root.KeyboardEvent.prototype; 13975 var get = Object.getOwnPropertyDescriptor(proto, "key").get; 13976 return !!get.toString().match(/\[native code\]/); 13977 }(); 13978 var is_browser = function() { 13979 try { 13980 return this === window; 13981 } catch (e) { 13982 return false; 13983 } 13984 }(); 13985 var is_mobile = function(a) { 13986 var check = false; 13987 if (mobile_re.test(a) || tablet_re.test(a.substr(0, 4))) { 13988 check = true; 13989 } 13990 if (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) { 13991 return true; 13992 } 13993 return check; 13994 }(navigator.userAgent || navigator.vendor || root.opera); 13995 var ch_unit_bug = false; 13996 if (is_browser) { 13997 $(function() { 13998 function width(e) { 13999 return e[0].getBoundingClientRect().width; 14000 } 14001 var base = '<span style="font-family: monospace;visibility:hidden;'; 14002 var ch = $(base + 'width:1ch;overflow: hidden"> </span>'); 14003 ch.appendTo("body"); 14004 var space = $(base + '"> </span>').appendTo("body"); 14005 ch_unit_bug = Math.abs(width(ch) - width(space)) > 0.0001; 14006 ch.remove(); 14007 space.remove(); 14008 }); 14009 } 14010 function css(node, obj2, value) { 14011 if (node instanceof $.fn.init) { 14012 node.each(function() { 14013 css(this, obj2, value); 14014 }); 14015 } else if ($.isPlainObject(obj2)) { 14016 Object.keys(obj2).forEach(function(key) { 14017 node.style.setProperty(key, obj2[key]); 14018 }); 14019 } else if (typeof value === "undefined") { 14020 return node.style.getPropertyValue(obj2); 14021 } else { 14022 node.style.setProperty(obj2, value); 14023 } 14024 } 14025 function style_prop(name, value, important) { 14026 var props = [ 14027 name + ":" + value + "px", 14028 name + ":" + "calc(" + value + "px / var(--pixel-density, 1))" 14029 ]; 14030 if (important) { 14031 props = props.map(function(prop) { 14032 return prop + " !important"; 14033 }); 14034 } 14035 return props.join(";"); 14036 } 14037 function a11y_hide(element) { 14038 element.attr({ 14039 role: "presentation", 14040 "aria-hidden": "true" 14041 }); 14042 } 14043 var excepctions = []; 14044 function alert_exception(label, e) { 14045 if (arguments[0] instanceof $.terminal.Exception) { 14046 label = arguments[0].type; 14047 e = arguments[0]; 14048 } 14049 var message = (label ? label + ": " : "") + exception_message(e); 14050 if (excepctions.indexOf(message) === -1) { 14051 excepctions.push(message); 14052 setTimeout(function() { 14053 throw e; 14054 }, 0); 14055 } 14056 } 14057 function generate_id() { 14058 var firstPart = Math.random() * 46656 | 0; 14059 var secondPart = Math.random() * 46656 | 0; 14060 firstPart = ("000" + firstPart.toString(36)).slice(-3); 14061 secondPart = ("000" + secondPart.toString(36)).slice(-3); 14062 return firstPart + secondPart; 14063 } 14064 function remove(array, callback) { 14065 for (var index in array) { 14066 if (callback(array[index], index)) { 14067 array.splice(index, 1); 14068 } 14069 } 14070 } 14071 function scrollbar_event(e, node, pixel_density) { 14072 pixel_density = pixel_density || 1; 14073 var left = node.offset().left; 14074 var max_width = node.outerWidth() * pixel_density; 14075 return max_width <= e.clientX - left; 14076 } 14077 function exception_message(e) { 14078 if (typeof e === "string") { 14079 return e; 14080 } else if (typeof e.fileName === "string") { 14081 return e.fileName + ": " + e.message; 14082 } else { 14083 return e.message; 14084 } 14085 } 14086 function Cycle() { 14087 var data = [].slice.call(arguments); 14088 var pos = 0; 14089 $.extend(this, { 14090 get: function() { 14091 return data; 14092 }, 14093 index: function() { 14094 return pos; 14095 }, 14096 rotate: function(skip, init) { 14097 if (init === undefined) { 14098 init = pos; 14099 } else if (init === pos) { 14100 return; 14101 } 14102 if (!skip) { 14103 var defined2 = data.filter(function(item) { 14104 return typeof item !== "undefined"; 14105 }); 14106 if (!defined2.length) { 14107 return; 14108 } 14109 } 14110 if (!data.length) { 14111 return; 14112 } 14113 if (data.length === 1) { 14114 return data[0]; 14115 } else { 14116 if (pos === data.length - 1) { 14117 pos = 0; 14118 } else { 14119 ++pos; 14120 } 14121 if (typeof data[pos] !== "undefined") { 14122 return data[pos]; 14123 } else { 14124 return this.rotate(true, init); 14125 } 14126 } 14127 }, 14128 length: function() { 14129 return data.length; 14130 }, 14131 remove: function(index) { 14132 delete data[index]; 14133 }, 14134 active: function(item) { 14135 for (var i = data.length;i--; ) { 14136 if (data[i] === item) { 14137 pos = i; 14138 return; 14139 } 14140 } 14141 this.append(item); 14142 pos = data.length - 1; 14143 }, 14144 front: function() { 14145 if (data.length) { 14146 var index = pos; 14147 var restart = false; 14148 while (!data[index]) { 14149 index++; 14150 if (index > data.length) { 14151 if (restart) { 14152 break; 14153 } 14154 index = 0; 14155 restart = true; 14156 } 14157 } 14158 return data[index]; 14159 } 14160 }, 14161 map: function(fn2) { 14162 return data.map(function(item, i) { 14163 if (typeof item !== "undefined") { 14164 return fn2(item, i); 14165 } 14166 return null; 14167 }).filter(Boolean); 14168 }, 14169 forEach: function(fn2) { 14170 return data.forEach(function(item, i) { 14171 if (typeof item !== "undefined") { 14172 fn2(item, i); 14173 } 14174 }); 14175 }, 14176 set: function(index, value) { 14177 if (!data[index]) { 14178 data[index] = value; 14179 return true; 14180 } 14181 return false; 14182 }, 14183 append: function(item) { 14184 data.push(item); 14185 } 14186 }); 14187 } 14188 function Stack(init) { 14189 var data = is_array(init) ? init : init ? [init] : []; 14190 $.extend(this, { 14191 data: function() { 14192 return data; 14193 }, 14194 map: function(fn2) { 14195 return $.map(data, fn2); 14196 }, 14197 size: function() { 14198 return data.length; 14199 }, 14200 pop: function() { 14201 if (data.length === 0) { 14202 return null; 14203 } else { 14204 var value = data[data.length - 1]; 14205 data = data.slice(0, data.length - 1); 14206 return value; 14207 } 14208 }, 14209 push: function(value) { 14210 data = data.concat([value]); 14211 return value; 14212 }, 14213 top: function() { 14214 return data.length > 0 ? data[data.length - 1] : null; 14215 }, 14216 clone: function() { 14217 return new Stack(data.slice(0)); 14218 } 14219 }); 14220 } 14221 function WorkerCache(options2) { 14222 var settings2 = $.extend({ 14223 validation: $.noop, 14224 action: $.noop, 14225 onCache: $.noop 14226 }, options2); 14227 this._onCache = settings2.onCache.bind(this); 14228 this._action = settings2.action.bind(this); 14229 this._validation = settings2.validation.bind(this); 14230 if ("Map" in root) { 14231 this._cache = new Map; 14232 } 14233 } 14234 WorkerCache.prototype.validate = function(key) { 14235 var valid = this._validation(key); 14236 var test = valid === undefined || valid === true; 14237 if (!test) { 14238 this._cache.clear(); 14239 } 14240 return test; 14241 }; 14242 WorkerCache.prototype.clear = function() { 14243 this._cache.clear(); 14244 }; 14245 WorkerCache.prototype.get = function(key) { 14246 if (!this._cache) { 14247 return this._action(key); 14248 } 14249 var value; 14250 if (this.validate(key) && this._cache.has(key)) { 14251 value = this._cache.get(key); 14252 this._onCache({ cache: value }); 14253 return value; 14254 } 14255 value = this._action(key); 14256 this._cache.set(key, value); 14257 return value; 14258 }; 14259 function History(name, size, memory) { 14260 var enabled = true; 14261 var storage_key = ""; 14262 if (typeof name === "string" && name !== "") { 14263 storage_key = name + "_"; 14264 } 14265 storage_key += "commands"; 14266 var data; 14267 if (memory) { 14268 data = []; 14269 } else { 14270 data = $.Storage.get(storage_key); 14271 data = data ? JSON.parse(data) : []; 14272 } 14273 var pos = data.length - 1; 14274 $.extend(this, { 14275 append: function(item) { 14276 if (enabled) { 14277 if (data[data.length - 1] !== item) { 14278 data.push(item); 14279 if (size && data.length > size) { 14280 data = data.slice(-size); 14281 } 14282 pos = data.length - 1; 14283 if (!memory) { 14284 $.Storage.set(storage_key, JSON.stringify(data)); 14285 } 14286 } 14287 } 14288 }, 14289 set: function(new_data) { 14290 if (is_array(new_data)) { 14291 data = new_data; 14292 if (!memory) { 14293 $.Storage.set(storage_key, JSON.stringify(data)); 14294 } 14295 } 14296 }, 14297 data: function() { 14298 return data; 14299 }, 14300 reset: function() { 14301 pos = data.length - 1; 14302 }, 14303 last: function() { 14304 return data[data.length - 1]; 14305 }, 14306 end: function() { 14307 return pos === data.length - 1; 14308 }, 14309 position: function() { 14310 return pos; 14311 }, 14312 current: function() { 14313 return data[pos]; 14314 }, 14315 next: function() { 14316 var old = pos; 14317 if (pos < data.length - 1) { 14318 ++pos; 14319 } 14320 if (old !== pos) { 14321 return data[pos]; 14322 } 14323 }, 14324 previous: function() { 14325 var old = pos; 14326 if (pos > 0) { 14327 --pos; 14328 } 14329 if (old !== pos) { 14330 return data[pos]; 14331 } 14332 }, 14333 clear: function() { 14334 data = []; 14335 this.purge(); 14336 }, 14337 enabled: function() { 14338 return enabled; 14339 }, 14340 enable: function() { 14341 enabled = true; 14342 }, 14343 purge: function() { 14344 if (!memory) { 14345 $.Storage.remove(storage_key); 14346 } 14347 }, 14348 disable: function() { 14349 enabled = false; 14350 }, 14351 toggle: function(value) { 14352 if (typeof value === "undefined") { 14353 enabled = !enabled; 14354 } else { 14355 enabled = value; 14356 } 14357 } 14358 }); 14359 } 14360 function OutputLines(settings2) { 14361 this._settings = settings2; 14362 this._lines = []; 14363 this._snapshot = []; 14364 } 14365 OutputLines.prototype.make_snapshot = function(snapshot) { 14366 this._snapshot.push(snapshot); 14367 }; 14368 OutputLines.prototype.get_partial = function() { 14369 if (!this._snapshot.length) { 14370 return []; 14371 } 14372 var last = this._snapshot[this._snapshot.length - 1]; 14373 return last; 14374 }; 14375 OutputLines.prototype.update_snapshot = function(index, snapshot) { 14376 this._snapshot[index] = snapshot; 14377 }; 14378 OutputLines.prototype.limit_snapshot = function(limit) { 14379 this._snapshot = this._snapshot.slice(limit); 14380 }; 14381 OutputLines.prototype.clear_snapshot = function() { 14382 this._snapshot = []; 14383 }; 14384 OutputLines.prototype.get_snapshot = function() { 14385 return this._snapshot.reduce(function(acc, arr) { 14386 if (!arr) { 14387 return acc; 14388 } 14389 return acc.concat(arr); 14390 }, []).join(` 14391`); 14392 }; 14393 OutputLines.prototype.join = function() { 14394 var args2 = [].slice.call(arguments); 14395 if (args2.some(is_function)) { 14396 return function() { 14397 return args2.reduce(function(acc, arg) { 14398 if (is_function(acc)) { 14399 acc = acc(); 14400 } 14401 if (is_function(arg)) { 14402 arg = arg(); 14403 } 14404 if (is_promise(acc) || is_promise(arg)) { 14405 return $.when(acc, arg).then(function(acc, arg) { 14406 return acc + arg; 14407 }); 14408 } 14409 return arg; 14410 }); 14411 }; 14412 } else if (args2.some(is_promise)) { 14413 return args2.reduce(function(acc, arg) { 14414 return $.when(acc, arg).then(function(acc, arg) { 14415 return acc + arg; 14416 }); 14417 }); 14418 } 14419 return args2.join(""); 14420 }; 14421 OutputLines.prototype.import = function(data) { 14422 this._lines = data; 14423 }; 14424 OutputLines.prototype.push = function(data) { 14425 var value = data[0]; 14426 var options2 = data[1]; 14427 if (this.has_newline()) { 14428 this._lines.push(data); 14429 } else { 14430 var last_line = this.last_line(); 14431 last_line[0] = this.join(last_line[0], value); 14432 last_line[1].newline = options2.newline; 14433 } 14434 }; 14435 OutputLines.prototype.clear = function(fn2) { 14436 this._lines.forEach(function(line, i) { 14437 var options2 = line[1]; 14438 if (is_function(options2.onClear)) { 14439 options2.onClear.call(self, fn2(i)); 14440 } 14441 }); 14442 this._lines = []; 14443 this._snapshot = []; 14444 }; 14445 OutputLines.prototype.data = function() { 14446 return this._lines.filter(Boolean); 14447 }; 14448 OutputLines.prototype.has_newline = function() { 14449 var line = this.last_line(); 14450 if (!line) { 14451 return true; 14452 } 14453 return line[1].newline; 14454 }; 14455 OutputLines.prototype.unmount = function(node) { 14456 var index = node.data("index"); 14457 var line = this._lines[index]; 14458 if (line) { 14459 var options2 = line[1]; 14460 if (is_function(options2.unmount)) { 14461 options2.unmount.call(self, node); 14462 } 14463 } 14464 }; 14465 OutputLines.prototype.last_line = function() { 14466 var lines = this.data(); 14467 var len = lines.length; 14468 return lines[len - 1]; 14469 }; 14470 OutputLines.prototype.update = function(index, value, options2) { 14471 if (value === null) { 14472 delete this._lines[index]; 14473 delete this._snapshot[index]; 14474 } else { 14475 this._lines[index][0] = value; 14476 if (options2) { 14477 this._lines[index][1] = $.extend(this._lines[index][1], options2); 14478 } 14479 return this._lines[index][1]; 14480 } 14481 }; 14482 OutputLines.prototype.length = function() { 14483 return this._lines.length; 14484 }; 14485 OutputLines.prototype.valid_index = function(index) { 14486 return !!this._lines[index]; 14487 }; 14488 OutputLines.prototype.render = function(cols, fn2) { 14489 var settings2 = this._settings(); 14490 var lines_to_show = []; 14491 this._snapshot = []; 14492 if (settings2.outputLimit >= 0) { 14493 var limit; 14494 if (settings2.outputLimit === 0) { 14495 limit = cols; 14496 } else { 14497 limit = settings2.outputLimit; 14498 } 14499 this._lines.forEach(function(line, index) { 14500 var value = line[0]; 14501 var options2 = line[1]; 14502 lines_to_show.push({ 14503 value, 14504 index, 14505 options: options2 14506 }); 14507 }); 14508 var pivot = lines_to_show.length - limit - 1; 14509 lines_to_show = lines_to_show.slice(pivot); 14510 } else { 14511 lines_to_show = this._lines.map(function(line, index) { 14512 return { 14513 value: line[0], 14514 index, 14515 options: line[1] 14516 }; 14517 }); 14518 } 14519 return fn2(lines_to_show); 14520 }; 14521 function FormatBuffer(options2) { 14522 this._options = options2; 14523 if ("Map" in root) { 14524 this._format_cache = new Map; 14525 } 14526 this._output_buffer = []; 14527 } 14528 FormatBuffer.NEW_LINE = 1; 14529 FormatBuffer.prototype.format = function format(arg, newline, raw) { 14530 var use_cache = this._format_cache && this._settings.useCache; 14531 if (use_cache) { 14532 var args2 = JSON.stringify([arg, this._settings]); 14533 if (this._format_cache.has(args2)) { 14534 return this._format_cache.get(args2); 14535 } 14536 } 14537 var data = { 14538 line: $.terminal.format(arg, this._settings), 14539 raw, 14540 newline 14541 }; 14542 if (use_cache) { 14543 this._format_cache.set(args2, data); 14544 } 14545 return data; 14546 }; 14547 FormatBuffer.prototype.empty = function() { 14548 return !this._output_buffer.length; 14549 }; 14550 FormatBuffer.prototype.append = function(arg, index, options2, raw) { 14551 this._settings = $.extend({ 14552 useCache: true 14553 }, this._options(options2)); 14554 this._output_buffer.push(FormatBuffer.NEW_LINE); 14555 if (arg instanceof Array) { 14556 for (var i = 0, len = arg.length;i < len; ++i) { 14557 if (arg[i] === "" || arg[i] === "\r") { 14558 this._output_buffer.push({ line: "", raw: "" }); 14559 } else { 14560 var formatted = this.format(arg[i], i === len - 1, raw[i]); 14561 this._output_buffer.push(formatted); 14562 } 14563 } 14564 } else if (options2.raw) { 14565 this._output_buffer.push({ line: arg, raw }); 14566 } else { 14567 this._output_buffer.push(this.format(arg, false, raw)); 14568 } 14569 this._output_buffer.push({ 14570 finalize: options2.finalize, 14571 index, 14572 raw: options2.raw, 14573 newline: options2.newline 14574 }); 14575 }; 14576 FormatBuffer.prototype.clear_cache = function() { 14577 if (this._format_cache) { 14578 this._format_cache.clear(); 14579 } 14580 }; 14581 FormatBuffer.prototype.output = function() { 14582 return this._output_buffer.slice(); 14583 }; 14584 FormatBuffer.prototype.is_empty = function() { 14585 return !this._output_buffer.length; 14586 }; 14587 FormatBuffer.prototype.clear = function() { 14588 this._output_buffer = []; 14589 }; 14590 FormatBuffer.prototype.sort = function() { 14591 var chunk = []; 14592 var chunks = []; 14593 for (var i = 0;i < this._output_buffer.length; i++) { 14594 var item = this._output_buffer[i]; 14595 chunk.push(item); 14596 if (item !== FormatBuffer.NEW_LINE && "index" in item) { 14597 chunks.push(chunk); 14598 chunk = []; 14599 } 14600 } 14601 if (chunks.length === 1) { 14602 return; 14603 } 14604 chunks.sort(function(a, b) { 14605 return a[2].index - b[2].index; 14606 }); 14607 this._output_buffer = []; 14608 chunks.forEach(function(chunk) { 14609 this._output_buffer = this._output_buffer.concat(chunk); 14610 }, this); 14611 }; 14612 FormatBuffer.prototype.forEach = function(fn2) { 14613 var i = 0; 14614 while (i < this._output_buffer.length) { 14615 var data = this._output_buffer[i++]; 14616 if (data === FormatBuffer.NEW_LINE) { 14617 fn2(); 14618 } else { 14619 fn2(data); 14620 } 14621 } 14622 }; 14623 FormatBuffer.prototype.flush = function(render) { 14624 this.forEach(render); 14625 this.clear(); 14626 }; 14627 function with_prompt(prompt, set, context) { 14628 function error(e) { 14629 var prompt = $.terminal.escape_brackets("[ERR]> "); 14630 set("[[;red;]" + prompt + "]"); 14631 alert_exception("Prompt", e); 14632 } 14633 function done(prompt) { 14634 set(prompt); 14635 deferred2.resolve(); 14636 } 14637 var deferred2 = new $.Deferred; 14638 switch (typeof prompt) { 14639 case "string": 14640 done(prompt); 14641 break; 14642 case "function": 14643 try { 14644 var ret2 = prompt.call(context, function(string2) { 14645 done(string2); 14646 }); 14647 if (typeof ret2 === "string") { 14648 done(ret2); 14649 } 14650 if (ret2 && ret2.then) { 14651 ret2.then(done).catch(error); 14652 } 14653 } catch (e) { 14654 error(e); 14655 } 14656 break; 14657 } 14658 return deferred2.promise(); 14659 } 14660 var cmd_index = 0; 14661 $.cmd = { 14662 defaults: { 14663 mask: false, 14664 caseSensitiveSearch: true, 14665 historySize: 60, 14666 prompt: "> ", 14667 enabled: true, 14668 history: true, 14669 onPositionChange: $.noop, 14670 onCommandChange: $.noop, 14671 inputStyle: "textarea", 14672 mobileDelete: is_mobile, 14673 onPaste: $.noop, 14674 clickTimeout: 200, 14675 holdTimeout: 400, 14676 holdRepeatTimeout: 200, 14677 mobileIgnoreAutoSpace: [",", ".", ")"], 14678 repeatTimeoutKeys: [], 14679 tabindex: 1, 14680 tabs: 4 14681 } 14682 }; 14683 $.fn.cmd = function(options2) { 14684 var settings2 = $.extend({}, $.cmd.defaults, options2); 14685 function mobile_ignore_key(key) { 14686 return settings2.mobileIgnoreAutoSpace.length && settings2.mobileIgnoreAutoSpace.indexOf(key) !== -1 && is_android; 14687 } 14688 var self2 = this; 14689 var maybe_data = self2.data("cmd"); 14690 if (maybe_data) { 14691 return maybe_data; 14692 } 14693 var id = cmd_index++; 14694 self2.addClass("cmd"); 14695 var wrapper = $('<div class="cmd-wrapper"/>').appendTo(self2); 14696 wrapper.append('<span class="cmd-prompt"></span>'); 14697 wrapper.append('<div class="cmd-cursor-line">' + "<span></span>" + '<span class="cmd-cursor">' + '<span data-text class="end"><span> </span></span>' + "</span>" + "<span></span>" + "</div>"); 14698 var cursor_line = wrapper.find(".cmd-cursor-line"); 14699 a11y_hide(cursor_line); 14700 var clip; 14701 if (is_mobile) { 14702 clip = function() { 14703 var $node = $('<div class="cmd-editable" contenteditable/>').attr({ 14704 autocapitalize: "off", 14705 autocorrect: "off", 14706 autocomplete: "new-password", 14707 spellcheck: "false", 14708 tabindex: settings2.tabindex 14709 }).insertAfter(self2); 14710 $node.on("focus", function() { 14711 self2.enable(); 14712 }).on("blur", function() { 14713 self2.disable(); 14714 }); 14715 var timer; 14716 var clip = { 14717 $node, 14718 val: function(value) { 14719 if (typeof value === "undefined") { 14720 return $node.text(); 14721 } else { 14722 $node.html(value); 14723 } 14724 }, 14725 reset: function() { 14726 clearTimeout(timer); 14727 timer = setTimeout(function() { 14728 $node.css({ 14729 top: "", 14730 bottom: "" 14731 }); 14732 }, 100); 14733 }, 14734 focus: function() { 14735 css($node[0], { 14736 top: "calc(var(--terminal-scroll, 0) * 1px)" 14737 }); 14738 clip.reset(); 14739 }, 14740 blur: function() { 14741 $node.css({ 14742 top: "100%", 14743 bottom: 0 14744 }).blur(); 14745 window.getSelection().removeAllRanges(); 14746 clip.reset(); 14747 } 14748 }; 14749 return clip; 14750 }(); 14751 self2.addClass("cmd-mobile"); 14752 } else { 14753 clip = function() { 14754 var id = generate_id(); 14755 var $node = $("<textarea>").attr({ 14756 autocapitalize: "off", 14757 spellcheck: "false", 14758 id, 14759 tabindex: settings2.tabindex 14760 }).addClass("cmd-clipboard").appendTo(self2); 14761 $node.before('<label class="visually-hidden" for="' + id + '">' + "Clipboard textarea for jQuery Terminal</label>"); 14762 return { 14763 $node, 14764 val: function(value) { 14765 if (typeof value === "undefined") { 14766 return $node.val(); 14767 } else { 14768 return $node.val(value); 14769 } 14770 } 14771 }; 14772 }(); 14773 clip.val(" "); 14774 } 14775 if (settings2.width) { 14776 self2.width(settings2.width); 14777 } 14778 var num_chars; 14779 var char_width; 14780 var last_rendered_prompt; 14781 var prompt_last_line; 14782 var just_prompt_len; 14783 var prompt_offset = 0; 14784 var prompt_len; 14785 var prompt_node = self2.find(".cmd-prompt"); 14786 var reverse_search = false; 14787 var rev_search_str = ""; 14788 var reverse_search_position = null; 14789 var backup_prompt; 14790 var command = ""; 14791 var last_command; 14792 var kill_text = ""; 14793 var position = 0; 14794 var prompt; 14795 var enabled; 14796 var formatted_position = 0; 14797 var name, history2; 14798 var cursor = self2.find(".cmd-cursor"); 14799 var animation; 14800 var restart_animation; 14801 var paste_count = 0; 14802 var line_marker = "ï¿¿"; 14803 var line_marker_re = /\uFFFF$/; 14804 var empty_marker_re = /^\uFFFF$/; 14805 function get_char_pos(e) { 14806 var node = $(e.target); 14807 if (node.is("span,img,a")) { 14808 node = node.closest("[data-text]"); 14809 return node.index() + node.parent("span").prevAll().find("[data-text]").length + node.closest('[role="presentation"]').prevUntil(".cmd-prompt").find("[data-text]").length; 14810 } else if (node.is('div[role="presentation"]')) { 14811 var last = !node.next().length; 14812 return node.find("[data-text]").length + node.prevUntil(".cmd-prompt").find("[data-text]").length - (last ? 0 : 1); 14813 } 14814 } 14815 var key_mapping = { 14816 SPACEBAR: " ", 14817 UP: "ArrowUP", 14818 DOWN: "ArrowDown", 14819 LEFT: "ArrowLeft", 14820 RIGHT: "ArrowRight", 14821 DEL: "Delete", 14822 MULTIPLY: "*", 14823 DIVIDE: "/", 14824 SUBTRACT: "-", 14825 ADD: "+" 14826 }; 14827 function ie_key_fix(e) { 14828 var key = e.key.toUpperCase(); 14829 if (key_mapping[key]) { 14830 return key_mapping[key]; 14831 } 14832 return key; 14833 } 14834 function get_key(e) { 14835 if (e.key) { 14836 var key = ie_key_fix(e).toUpperCase(); 14837 if (key === "CONTROL") { 14838 return "CTRL"; 14839 } else { 14840 var combo = []; 14841 if (e.ctrlKey) { 14842 combo.push("CTRL"); 14843 } 14844 if (e.metaKey && key !== "META") { 14845 combo.push("META"); 14846 } 14847 if (e.shiftKey && key !== "SHIFT") { 14848 combo.push("SHIFT"); 14849 } 14850 if (e.altKey && key !== "ALT") { 14851 combo.push("ALT"); 14852 } 14853 if (combo.length && key === " ") { 14854 key = "SPACEBAR"; 14855 } 14856 if (e.key) { 14857 combo.push(key); 14858 } 14859 return combo.join("+"); 14860 } 14861 } 14862 } 14863 var keycodes = { 14864 3: "Cancel", 14865 6: "Help", 14866 8: "Backspace", 14867 9: "Tab", 14868 12: "Clear", 14869 13: "Enter", 14870 16: "Shift", 14871 17: "Control", 14872 18: "Alt", 14873 19: "Pause", 14874 20: "CapsLock", 14875 27: "Escape", 14876 28: "Convert", 14877 29: "NonConvert", 14878 30: "Accept", 14879 31: "ModeChange", 14880 32: " ", 14881 33: "PageUp", 14882 34: "PageDown", 14883 35: "End", 14884 36: "Home", 14885 37: "ArrowLeft", 14886 38: "ArrowUp", 14887 39: "ArrowRight", 14888 40: "ArrowDown", 14889 41: "Select", 14890 42: "Print", 14891 43: "Execute", 14892 44: "PrintScreen", 14893 45: "Insert", 14894 46: "Delete", 14895 48: ["0", ")"], 14896 49: ["1", "!"], 14897 50: ["2", "@"], 14898 51: ["3", "#"], 14899 52: ["4", "$"], 14900 53: ["5", "%"], 14901 54: ["6", "^"], 14902 55: ["7", "&"], 14903 56: ["8", "*"], 14904 57: ["9", "("], 14905 91: "OS", 14906 93: "ContextMenu", 14907 144: "NumLock", 14908 145: "ScrollLock", 14909 181: "VolumeMute", 14910 182: "VolumeDown", 14911 183: "VolumeUp", 14912 186: [";", ":"], 14913 187: ["=", "+"], 14914 188: [",", "<"], 14915 189: ["-", "_"], 14916 190: [".", ">"], 14917 191: ["/", "?"], 14918 192: ["`", "~"], 14919 219: ["[", "{"], 14920 220: ["\\", "|"], 14921 221: ["]", "}"], 14922 222: ["'", '"'], 14923 224: "Meta", 14924 225: "AltGraph", 14925 246: "Attn", 14926 247: "CrSel", 14927 248: "ExSel", 14928 249: "EraseEof", 14929 250: "Play", 14930 251: "ZoomOut" 14931 }; 14932 var i; 14933 for (i = 1;i < 25; i++) { 14934 keycodes[111 + i] = "F" + i; 14935 } 14936 var letter = ""; 14937 for (i = 65;i < 91; i++) { 14938 letter = String.fromCharCode(i); 14939 keycodes[i] = [letter.toLowerCase(), letter.toUpperCase()]; 14940 } 14941 var reversed_keycodes = {}; 14942 Object.keys(keycodes).forEach(function(which) { 14943 if (is_array(keycodes[which])) { 14944 keycodes[which].forEach(function(key) { 14945 reversed_keycodes[key.toUpperCase()] = which; 14946 }); 14947 } else { 14948 reversed_keycodes[keycodes[which].toUpperCase()] = which; 14949 } 14950 }); 14951 var keymap; 14952 var default_keymap = { 14953 "ALT+D": delete_forward({ clipboard: true }), 14954 "HOLD+ALT+D": delete_forward({ clipboard: true, hold: true }), 14955 "HOLD+DELETE": delete_forward({ clipboard: false, hold: true }), 14956 "HOLD+SHIFT+DELETE": delete_forward({ clipboard: false, hold: true }), 14957 ENTER: function() { 14958 if (history2 && command && !settings2.mask && (is_function(settings2.historyFilter) && settings2.historyFilter(command) || settings2.historyFilter instanceof RegExp && command.match(settings2.historyFilter) || !settings2.historyFilter)) { 14959 history2.append(command); 14960 } 14961 var tmp = command; 14962 if (!is_mobile) { 14963 clip.$node.blur(); 14964 } 14965 history2.reset(); 14966 self2.set(""); 14967 clip.val(""); 14968 prev_command = ""; 14969 no_keydown = true; 14970 var promise; 14971 if (settings2.commands) { 14972 promise = settings2.commands.call(self2, tmp); 14973 } 14974 if (is_function(prompt)) { 14975 if (promise && is_function(promise.then)) { 14976 promise.then(function() { 14977 draw_prompt(); 14978 }); 14979 } else { 14980 draw_prompt(); 14981 } 14982 } 14983 if (!is_mobile) { 14984 clip.$node.focus(); 14985 } 14986 return false; 14987 }, 14988 "SHIFT+ENTER": function() { 14989 self2.insert(` 14990`); 14991 return true; 14992 }, 14993 BACKSPACE: backspace_key, 14994 "SHIFT+BACKSPACE": backspace_key, 14995 TAB: function() { 14996 self2.insert("\t"); 14997 }, 14998 "CTRL+D": function() { 14999 self2["delete"](1); 15000 return false; 15001 }, 15002 DELETE: function() { 15003 self2["delete"](1); 15004 return true; 15005 }, 15006 "HOLD+ARROWUP": up_arrow, 15007 ARROWUP: up_arrow, 15008 "CTRL+ARROWUP": prev_history, 15009 "CTRL+P": prev_history, 15010 ARROWDOWN: down_arrow, 15011 "HOLD+ARROWDOWN": down_arrow, 15012 "CTRL+N": next_history, 15013 "CTRL+ARROWDOWN": next_history, 15014 ARROWLEFT: left, 15015 "HOLD+ARROWLEFT": debounce(left, 10), 15016 "CTRL+B": left, 15017 "CTRL+ARROWLEFT": function() { 15018 var len = position - 1; 15019 var pos = 0; 15020 if (command[len] === " ") { 15021 --len; 15022 } 15023 for (var i = len;i > 0; --i) { 15024 if (command[i] === " " && command[i + 1] !== " ") { 15025 pos = i + 1; 15026 break; 15027 } else if (command[i] === ` 15028` && command[i + 1] !== ` 15029`) { 15030 pos = i; 15031 break; 15032 } 15033 } 15034 self2.position(pos); 15035 }, 15036 "CTRL+R": function() { 15037 if (reverse_search) { 15038 reverse_history_search(true); 15039 } else { 15040 backup_prompt = prompt; 15041 draw_reverse_prompt(); 15042 last_command = command; 15043 self2.set(""); 15044 redraw(); 15045 reverse_search = true; 15046 } 15047 return false; 15048 }, 15049 "CTRL+G": function() { 15050 if (reverse_search) { 15051 prompt = backup_prompt; 15052 draw_prompt(); 15053 self2.set(last_command); 15054 redraw(); 15055 reverse_search = false; 15056 rev_search_str = ""; 15057 return false; 15058 } 15059 }, 15060 ARROWRIGHT: right, 15061 "HOLD+ARROWRIGHT": debounce(right, 10), 15062 "CTRL+F": right, 15063 "CTRL+ARROWRIGHT": function() { 15064 if (command[position] === " ") { 15065 ++position; 15066 } 15067 var re = /\S[\n\s]{2,}|[\n\s]+\S?/; 15068 var match = command.slice(position).match(re); 15069 if (!match || match[0].match(/^\s+$/)) { 15070 self2.position(bare_text(command).length); 15071 } else if (match[0][0] !== " ") { 15072 position += match.index + 1; 15073 } else { 15074 position += match.index + match[0].length - 1; 15075 if (match[0][match[0].length - 1] !== " ") { 15076 --position; 15077 } 15078 } 15079 redraw(); 15080 }, 15081 F12: return_true, 15082 END: end(true), 15083 "CTRL+END": end(), 15084 "CTRL+E": end(), 15085 HOME: home(true), 15086 "CTRL+HOME": home(), 15087 "CTRL+A": home(), 15088 "SHIFT+INSERT": paste_event, 15089 "CTRL+SHIFT+T": return_true, 15090 "CTRL+W": delete_backward({ clipboard: true, hold: false }), 15091 "CTRL+BACKSPACE": delete_backward({ clipboard: true, hold: false }), 15092 "HOLD+BACKSPACE": delete_backward({ clipboard: false, hold: true }), 15093 "HOLD+SHIFT+BACKSPACE": delete_backward({ clipboard: false, hold: true }), 15094 "CTRL+H": function() { 15095 if (command !== "" && position > 0) { 15096 self2["delete"](-1); 15097 } 15098 return false; 15099 }, 15100 "CTRL+X": return_true, 15101 "CTRL+C": function() { 15102 return get_selected_html() === ""; 15103 }, 15104 "CTRL+T": return_true, 15105 "CTRL+Y": function() { 15106 if (kill_text !== "") { 15107 self2.insert(kill_text); 15108 } 15109 }, 15110 "CTRL+V": paste_event, 15111 "META+V": paste_event, 15112 "CTRL+K": function() { 15113 var len = text(command).length; 15114 if (len > position) { 15115 kill_text = self2["delete"](len - position); 15116 text_to_clipboard(clip.$node, kill_text); 15117 } 15118 return false; 15119 }, 15120 "CTRL+U": function() { 15121 if (command !== "" && position !== 0) { 15122 kill_text = self2["delete"](-position); 15123 text_to_clipboard(clip.$node, kill_text); 15124 } 15125 return false; 15126 }, 15127 "CTRL+TAB": function() { 15128 return false; 15129 }, 15130 "META+`": return_true, 15131 "META+R": return_true, 15132 "META+L": return_true 15133 }; 15134 function delete_forward(options2) { 15135 options2 = options2 || {}; 15136 if (options2.hold && !settings2.mobileDelete) { 15137 return function delete_character_forward() { 15138 self2["delete"](1); 15139 return false; 15140 }; 15141 } 15142 return function delete_word_forward() { 15143 var re = / *[^ ]+ *(?= )|[^ ]+$/; 15144 var substring = command.slice(position); 15145 var m2 = substring.match(re); 15146 if (m2) { 15147 kill_text = m2[0]; 15148 if (options2.clipboard) { 15149 text_to_clipboard(clip.$node, kill_text); 15150 } 15151 } 15152 self2.set(command.slice(0, position) + command.slice(position).replace(re, ""), true); 15153 return false; 15154 }; 15155 } 15156 function delete_backward(options2) { 15157 options2 = options2 || {}; 15158 if (options2.hold && !settings2.mobileDelete) { 15159 return function delete_character_backward() { 15160 self2["delete"](-1); 15161 }; 15162 } 15163 return function delete_word_backward() { 15164 if (command !== "" && position !== 0) { 15165 var m2 = command.slice(0, position).match(/([^ ]* *$)/); 15166 if (m2[0].length) { 15167 kill_text = self2["delete"](-m2[0].length); 15168 if (options2.clipboard) { 15169 text_to_clipboard(clip.$node, kill_text); 15170 } 15171 } 15172 } 15173 return false; 15174 }; 15175 } 15176 function return_true() { 15177 return true; 15178 } 15179 function paste_event() { 15180 clip.val(""); 15181 paste_count = 0; 15182 if (self2.isenabled() && !clip.$node.is(":focus")) { 15183 clip.$node.trigger("focus", [true]); 15184 } 15185 clip.$node.one("input", paste); 15186 return true; 15187 } 15188 function paste() { 15189 if (paste_count++ > 0) { 15190 return; 15191 } 15192 function set() { 15193 clip.val(command); 15194 fix_editable(); 15195 } 15196 function insert(text2) { 15197 self2.insert(text2); 15198 set(); 15199 } 15200 if (self2.isenabled()) { 15201 self2.oneTime(100, function() { 15202 var value = clip.val().replace(/\r/g, ""); 15203 if (is_function(settings2.onPaste)) { 15204 var ret2 = settings2.onPaste.call(self2, { 15205 target: self2, 15206 text: value 15207 }); 15208 if (ret2 !== undefined) { 15209 if (ret2 && is_function(ret2.then || ret2.done)) { 15210 (ret2.then || ret2.done).call(ret2, insert); 15211 } else if (typeof ret2 === "string") { 15212 insert(ret2); 15213 } else if (ret2 === false) { 15214 set(); 15215 } 15216 return; 15217 } 15218 } 15219 insert(value); 15220 }); 15221 } 15222 } 15223 function prev_history() { 15224 if (first_up_history) { 15225 last_command = command; 15226 self2.set(history2.current()); 15227 } else { 15228 self2.set(history2.previous()); 15229 } 15230 first_up_history = false; 15231 return false; 15232 } 15233 function next_history() { 15234 if (history2.end()) { 15235 first_up_history = true; 15236 self2.set(last_command); 15237 } else { 15238 self2.set(history2.next()); 15239 } 15240 return false; 15241 } 15242 function have_newlines(string2) { 15243 return string2.match(/\n/); 15244 } 15245 function have_wrapping(string2, prompt_len) { 15246 var lengths = string2.split(` 15247`).map(function(line) { 15248 return $.terminal.length(line); 15249 }); 15250 if (prompt_len) { 15251 lengths[0] += prompt_len; 15252 } 15253 var wrap = lengths.filter(function(len) { 15254 return len >= num_chars; 15255 }); 15256 return !!wrap.length; 15257 } 15258 function simple_split_command_line(formatted) { 15259 var prompt = last_rendered_prompt; 15260 var lines = $.terminal.split_equal(prompt + formatted, num_chars); 15261 var re = new RegExp("^" + $.terminal.escape_regex(prompt)); 15262 lines = lines.map($.terminal.unescape_brackets); 15263 lines[0] = lines[0].replace(re, ""); 15264 return lines; 15265 } 15266 function up_arrow() { 15267 var before = $.terminal.substring(command, 0, position); 15268 var col = self2.column(); 15269 var cursor_line = self2.find(".cmd-cursor-line"); 15270 var line = cursor_line.prevUntil("span").length; 15271 if (line === 1 && col <= prompt_len) { 15272 self2.position(0); 15273 return false; 15274 } 15275 if (line === 0) { 15276 return prev_history(); 15277 } 15278 if (have_newlines(before) || have_wrapping(before, prompt_len)) { 15279 var prev = cursor_line.prev(); 15280 var is_splitted = prev.is(".cmd-end-line"); 15281 var lines = simple_split_command_line(command); 15282 prev = lines[line - 1]; 15283 var left_over = lines[line].substring(col).length; 15284 var diff; 15285 if (left_over > 0) { 15286 diff = col; 15287 if (line - 1 === 0) { 15288 diff -= prompt_len; 15289 } 15290 diff = col + prev.substring(diff).length; 15291 if (is_splitted) { 15292 ++diff; 15293 } 15294 } else { 15295 diff = col + 1; 15296 } 15297 self2.position(-diff, true); 15298 return false; 15299 } else { 15300 return prev_history(); 15301 } 15302 } 15303 function down_arrow() { 15304 var after = $.terminal.substring(command, position); 15305 if (have_newlines(after) || have_wrapping(after)) { 15306 var lines = simple_split_command_line(command); 15307 var col = self2.column(); 15308 var cursor_line = self2.find(".cmd-cursor-line"); 15309 var $line = cursor_line.prevUntil("span"); 15310 var line = $line.length; 15311 var is_ending = cursor_line.is(".cmd-end-line"); 15312 var is_next_broken = cursor_line.next().is(".cmd-end-line"); 15313 var next = lines[line + 1]; 15314 if (!next) { 15315 return next_history(); 15316 } 15317 var left_over = lines[line].substring(col).length; 15318 var diff; 15319 if (left_over === 0) { 15320 diff = next.length; 15321 if (is_next_broken) { 15322 diff++; 15323 } 15324 } else { 15325 diff = Math.min(col, next.length) + left_over; 15326 if (line === 0) { 15327 diff += prompt_len; 15328 } 15329 if (is_ending) { 15330 diff += 1; 15331 } 15332 } 15333 self2.position(diff, true); 15334 return false; 15335 } else { 15336 return next_history(); 15337 } 15338 } 15339 function backspace_key() { 15340 if (reverse_search) { 15341 rev_search_str = rev_search_str.slice(0, -1); 15342 draw_reverse_prompt(); 15343 } else if (command !== "" && position > 0) { 15344 self2["delete"](-1); 15345 } 15346 self2.oneTime(1, function() { 15347 no_keydown = true; 15348 }); 15349 } 15350 function left() { 15351 if (position > 0) { 15352 self2.position(-1, true); 15353 } 15354 } 15355 function right() { 15356 if (position < bare_text(command).length) { 15357 self2.position(1, true); 15358 } 15359 return false; 15360 } 15361 function home(line) { 15362 function home() { 15363 self2.position(0); 15364 } 15365 if (line) { 15366 return function() { 15367 if (command.match(/\n/)) { 15368 var string2 = command.substring(0, self2.position()); 15369 self2.position(string2.lastIndexOf(` 15370`) + 1); 15371 } else { 15372 home(); 15373 } 15374 }; 15375 } else { 15376 return home; 15377 } 15378 } 15379 function end(line) { 15380 function end() { 15381 self2.position(text(command).length); 15382 } 15383 if (line) { 15384 return function() { 15385 if (command.match(/\n/)) { 15386 var lines = command.split(` 15387`); 15388 var pos = self2.position(); 15389 var sum = 0; 15390 for (var i = 0;i < lines.length; ++i) { 15391 sum += lines[i].length; 15392 if (sum > pos) { 15393 self2.position(sum + i); 15394 return; 15395 } 15396 } 15397 } 15398 end(); 15399 }; 15400 } else { 15401 return end; 15402 } 15403 } 15404 function mobile_focus() { 15405 var $clip = clip.$node; 15406 var focus = $clip.is(":focus"); 15407 if (enabled) { 15408 if (!focus) {} 15409 self2.oneTime(10, function() { 15410 if (!$clip.is(":focus") && enabled) { 15411 $clip.trigger("focus", [true]); 15412 } 15413 }); 15414 } else if (focus && !enabled) { 15415 $clip.trigger("blur", [true]); 15416 } 15417 } 15418 function fix_cursor() { 15419 if (animation_supported) { 15420 var style = window.getComputedStyle(cursor[0]); 15421 var animationName = style.getPropertyValue("--animation"); 15422 animationName = animationName.replace(/^\s*|\s*$/g, ""); 15423 var _class = self2.attr("class"); 15424 if (_class.match(/-animation/)) { 15425 _class = _class.replace(/[a-z]+-animation/g, ""); 15426 } 15427 if (animationName && !animationName.match(/blink/)) { 15428 var className = animationName.replace(/terminal-/, "") + "-animation"; 15429 if (!_class.match(className)) { 15430 _class += " " + className; 15431 } 15432 } 15433 _class = _class.replace(/\s+/g, " "); 15434 if (_class !== self2.attr("class").replace(/\s+/g, " ")) { 15435 self2.attr("class", _class); 15436 } 15437 } 15438 } 15439 function fix_editable(position_only) { 15440 if (!self2.isenabled()) { 15441 return; 15442 } 15443 self2.oneTime(10, function() { 15444 if (!is_mobile && clip.val() !== command && !position_only) { 15445 clip.val(" " + command); 15446 } 15447 if (enabled) { 15448 self2.oneTime(10, function() { 15449 try { 15450 var pos = !is_mobile ? position + 1 : position; 15451 if (clip.$node.caret() !== pos) { 15452 clip.$node.caret(pos); 15453 } 15454 } catch (e) {} 15455 }); 15456 } 15457 }); 15458 } 15459 if (animation_supported && !is_android) { 15460 animation = function(toggle) { 15461 if (toggle) { 15462 cursor.addClass("cmd-blink"); 15463 } else { 15464 cursor.removeClass("cmd-blink"); 15465 } 15466 }; 15467 restart_animation = function() { 15468 var new_cursor = cursor.clone(); 15469 new_cursor.insertBefore(cursor); 15470 cursor.remove(); 15471 cursor = new_cursor; 15472 }; 15473 } else { 15474 var animating = false; 15475 animation = function(toggle) { 15476 if (toggle && !animating) { 15477 animating = true; 15478 cursor.addClass("cmd-inverted cmd-blink"); 15479 self2.everyTime(500, "blink", blink); 15480 } else if (animating && !toggle) { 15481 animating = false; 15482 self2.stopTime("blink", blink); 15483 cursor.removeClass("cmd-inverted cmd-blink"); 15484 } 15485 }; 15486 restart_animation = function() { 15487 animation(false); 15488 animation(true); 15489 }; 15490 } 15491 function blink() { 15492 cursor.toggleClass("cmd-inverted"); 15493 } 15494 function draw_reverse_prompt() { 15495 prompt = "(reverse-i-search)`" + rev_search_str + "': "; 15496 draw_prompt(); 15497 } 15498 function clear_reverse_state() { 15499 prompt = backup_prompt; 15500 reverse_search = false; 15501 reverse_search_position = null; 15502 rev_search_str = ""; 15503 } 15504 function reverse_history_search(next) { 15505 var history_data = history2.data(); 15506 var regex, save_string; 15507 var len = history_data.length; 15508 if (next && reverse_search_position > 0) { 15509 len -= reverse_search_position; 15510 } 15511 if (rev_search_str.length > 0) { 15512 for (var j = rev_search_str.length;j > 0; j--) { 15513 save_string = $.terminal.escape_regex(rev_search_str.slice(0, j)); 15514 if (settings2.caseSensitiveSearch) { 15515 regex = new RegExp(save_string); 15516 } else { 15517 regex = new RegExp(save_string, "i"); 15518 } 15519 for (var i = len;i--; ) { 15520 if (regex.test(history_data[i])) { 15521 reverse_search_position = history_data.length - i; 15522 self2.position(history_data[i].indexOf(save_string)); 15523 self2.set(history_data[i], true); 15524 redraw(); 15525 if (rev_search_str.length !== j) { 15526 rev_search_str = rev_search_str.slice(0, j); 15527 draw_reverse_prompt(); 15528 } 15529 return; 15530 } 15531 } 15532 } 15533 } 15534 rev_search_str = ""; 15535 } 15536 function fix_brave_prompt(html) { 15537 var attr_re = /data-text="([^"]*[<>][^"]*)"/g; 15538 if (html.match(attr_re)) { 15539 return html.replace(attr_re, function(_, group) { 15540 return 'data-text="' + escape(group) + '"'; 15541 }); 15542 } 15543 return html; 15544 } 15545 function get_char_width() { 15546 var $prompt = self2.find(".cmd-prompt"); 15547 var html = $prompt.html(); 15548 $prompt.html("<span> </span>"); 15549 var width = $prompt.find("span").get(0).getBoundingClientRect().width; 15550 $prompt.html(fix_brave_prompt(html)); 15551 return width; 15552 } 15553 function get_num_chars2(char_width) { 15554 var width = self2.width(); 15555 return Math.floor(width / char_width); 15556 } 15557 function process_cmd_line(string2) { 15558 function split(string2) { 15559 return $.terminal.split_equal(string2, num_chars); 15560 } 15561 function skip_empty(array) { 15562 var result = []; 15563 array.forEach(function(line, i) { 15564 if ($.terminal.strip(line).match(empty_marker_re)) { 15565 result[i] = false; 15566 if (i > 0) { 15567 result[i - 1] += line_marker; 15568 } 15569 } else { 15570 result[i] = array[i]; 15571 } 15572 }); 15573 return result.filter(function(line) { 15574 return line !== false; 15575 }); 15576 } 15577 var line = prompt_node.find(".cmd-line"); 15578 var prompt; 15579 if (line.length) { 15580 prompt = line.nextUntil(".cmd-line").text(); 15581 } else { 15582 prompt = prompt_node.text(); 15583 } 15584 prompt = prompt.replace("â", ""); 15585 prompt = $.terminal.escape_brackets(prompt); 15586 var prompt_marker = get_prompt_marker(); 15587 var re = new RegExp("^" + prompt_marker + $.terminal.escape_regex(prompt)); 15588 var array; 15589 if (string2.match(/\n/)) { 15590 var tmp = string2.split(` 15591`); 15592 var first_len = num_chars - prompt_len - 1; 15593 for (var i = 0;i < tmp.length - 1; ++i) { 15594 tmp[i] += line_marker; 15595 } 15596 if (strlen(tmp[0]) > first_len) { 15597 array = split(prompt + tmp[0]); 15598 array[0] = array[0].replace(re, ""); 15599 array = skip_empty(array); 15600 } else { 15601 array = [tmp[0]]; 15602 } 15603 for (i = 1;i < tmp.length; ++i) { 15604 if (strlen(tmp[i]) > num_chars) { 15605 var splitted = split(tmp[i]); 15606 if (i < tmp.length - 1) { 15607 splitted = skip_empty(splitted); 15608 } 15609 array = array.concat(splitted); 15610 } else { 15611 array.push(tmp[i]); 15612 } 15613 } 15614 } else { 15615 array = split(prompt_marker + prompt + string2); 15616 array[0] = array[0].replace(re, ""); 15617 } 15618 if (array.length > 1) { 15619 var len = $.terminal.length(array[array.length - 1]); 15620 if (len === num_chars) { 15621 array.push(""); 15622 } 15623 } 15624 return array; 15625 } 15626 var cmd_line_worker = new WorkerCache({ 15627 validation: function(key) { 15628 var result = false; 15629 if ((!this._previous_value || this._previous_value === key) && (!this._cols || this._cols === num_chars)) { 15630 result = true; 15631 } 15632 this._previous_value = key; 15633 this._cols = num_chars; 15634 return result; 15635 }, 15636 action: process_cmd_line 15637 }); 15638 function split_command_line(string2) { 15639 return cmd_line_worker.get(string2); 15640 } 15641 function formatting(string2, skip_formatted_position) { 15642 try { 15643 string2 = $.terminal.escape_formatting(string2); 15644 var format_options = $.extend({}, settings2, { 15645 unixFormattingEscapeBrackets: true, 15646 position, 15647 command: true 15648 }); 15649 var formatted = $.terminal.apply_formatters(string2, format_options); 15650 var output = $.terminal.normalize(formatted[0]); 15651 var max = $.terminal.length(output); 15652 if (!skip_formatted_position) { 15653 formatted_position = formatted[1]; 15654 if (formatted_position > max) { 15655 formatted_position = max; 15656 } 15657 } 15658 return output; 15659 } catch (e) { 15660 alert_exception("[Formatting]", e.stack); 15661 return string2; 15662 } 15663 } 15664 function format(string2, before) { 15665 var encoded = $.terminal.encode(wrap(string2), { 15666 tabs: settings2.tabs, 15667 before 15668 }); 15669 return $.terminal.format(encoded, { 15670 charWidth: settings2.charWidth, 15671 allowedAttributes: settings2.allowedAttributes || [] 15672 }); 15673 } 15674 function wrap(string2) { 15675 return $.terminal.partition(string2).join(""); 15676 } 15677 function length(str, raw) { 15678 return $.terminal.length(str, raw); 15679 } 15680 function is_multiline(str) { 15681 var len = strlen(text(str)); 15682 return len > 0 && len > num_chars - prompt_len - 1 || str.match(/\n/); 15683 } 15684 function substring(str, start, end) { 15685 return $.terminal.substring(str, start, end); 15686 } 15687 function is_emoji_formatting(str) { 15688 if ($.terminal.is_formatting(str)) { 15689 return str.replace(format_parts_re, "$4").match(/^emoji /); 15690 } 15691 return false; 15692 } 15693 var redraw = function() { 15694 var before = cursor.prev(); 15695 var after = cursor.next(); 15696 var cursor_line = cursor.parent(); 15697 function draw_cursor_line(string2, options2) { 15698 var end_line = string2.match(line_marker_re); 15699 if (end_line) { 15700 string2 = string2.replace(line_marker_re, " "); 15701 } 15702 cursor_line.toggleClass("cmd-end-line", !!end_line); 15703 var cursor_end_line = false; 15704 var settings2 = $.extend({ 15705 prompt: "", 15706 last: false 15707 }, options2); 15708 var position = settings2.position; 15709 var len = length(string2); 15710 var prompt = settings2.prompt; 15711 var c; 15712 if (position === len) { 15713 before.html(format(string2)); 15714 c = " "; 15715 empty_cursor(); 15716 after.html(""); 15717 } else if (position === 0) { 15718 before.html(""); 15719 c = substring(string2, 0, 1); 15720 cursor.html(format(c)); 15721 after.html(format(substring(string2, 1), prompt + c)); 15722 } else { 15723 var before_str = $.terminal.substring(string2, 0, position); 15724 before.html(format(before_str, prompt)); 15725 c = substring(string2, position, position + 1); 15726 var c_before = (prompt + before_str).replace(/^.*\t/, ""); 15727 cursor.html(format(c, c_before)); 15728 if (position === len - 1) { 15729 cursor_end_line = true; 15730 after.html(""); 15731 } else { 15732 if (c.match(/\t/)) { 15733 c_before = ""; 15734 } else { 15735 c_before += c; 15736 } 15737 after.html(format(substring(string2, position + 1), c_before)); 15738 } 15739 } 15740 if (ch_unit_bug) { 15741 if (typeof wcwidth !== "undefined") { 15742 var size = strlen(text(c)); 15743 if (size === 1 && is_emoji_formatting(c)) { 15744 size = 2; 15745 } 15746 cursor.width(char_width * size); 15747 } else { 15748 cursor.width(char_width); 15749 } 15750 } 15751 cursor.toggleClass("cmd-end-line", cursor_end_line); 15752 fix_cursor(); 15753 var cursor_len = $.terminal.length(cursor.text()); 15754 if (cursor_len > 1) { 15755 var node = cursor.find("[data-text]")[0]; 15756 node.style.setProperty("--length", cursor_len); 15757 } 15758 restart_animation(); 15759 } 15760 function div(string2, before) { 15761 var end_line = string2.match(line_marker_re); 15762 var result = '<div role="presentation" aria-hidden="true"'; 15763 if (end_line) { 15764 string2 = string2.replace(line_marker_re, " "); 15765 result += ' class="cmd-end-line"'; 15766 } 15767 result += ">" + format(string2, before || "") + "</div>"; 15768 return result; 15769 } 15770 function empty_cursor() { 15771 cursor.html('<span data-text class="end"><span> <span></span>'); 15772 } 15773 function lines_after(lines) { 15774 var last_ins = cursor_line; 15775 $.each(lines, function(i, line) { 15776 last_ins = $(div(line)).insertAfter(last_ins); 15777 }); 15778 } 15779 function lines_before(lines) { 15780 $.each(lines, function(i, line) { 15781 cursor_line.before(div(line, i === 0 ? prompt_last_line : "")); 15782 }); 15783 } 15784 return function() { 15785 var string2; 15786 switch (typeof settings2.mask) { 15787 case "boolean": 15788 string2 = settings2.mask ? command.replace(/./g, "*") : command; 15789 break; 15790 case "string": 15791 string2 = command.replace(/./g, settings2.mask); 15792 break; 15793 } 15794 var formatted = formatting(string2); 15795 var pos; 15796 if (length(formatted) === text(string2).length) { 15797 pos = position; 15798 } else { 15799 pos = formatted_position; 15800 } 15801 var i; 15802 wrapper.css({ 15803 display: "none" 15804 }); 15805 wrapper.find("div:not(.cmd-cursor-line)").remove(); 15806 before.html(""); 15807 if (is_multiline(formatted)) { 15808 var tabs = formatted.match(/\t/g); 15809 var original_string = formatted; 15810 if (tabs) { 15811 formatted = formatted.replace(/\t/g, "\x00\x00\x00\x00"); 15812 } 15813 var array = split_command_line(formatted); 15814 if (tabs) { 15815 array = $.map(array, function(line) { 15816 return line.replace(/\x00\x00\x00\x00/g, "\t"); 15817 }); 15818 } 15819 var first_len = length(array[0]); 15820 if (first_len === 0 && array.length === 1) {} else if (pos < first_len) { 15821 draw_cursor_line(array[0], { 15822 length: array.length, 15823 position: pos, 15824 prompt: prompt_last_line 15825 }); 15826 lines_after(array.slice(1)); 15827 } else if (pos === first_len) { 15828 cursor_line.before(div(array[0], prompt_last_line)); 15829 draw_cursor_line(array[1] || "", { 15830 length: array.length, 15831 position: 0, 15832 last: array.length <= 2 15833 }); 15834 if (array.length > 2) { 15835 lines_after(array.slice(2)); 15836 } 15837 } else { 15838 var last = array.slice(-1)[0]; 15839 var len = length(original_string); 15840 var from_last = len - pos; 15841 var last_len = length(last); 15842 var new_pos = 0; 15843 if (from_last === -1) { 15844 from_last = 0; 15845 } 15846 if (from_last <= last_len) { 15847 lines_before(array.slice(0, -1)); 15848 if (last_len === from_last) { 15849 new_pos = 0; 15850 } else { 15851 new_pos = last_len - from_last; 15852 } 15853 draw_cursor_line(last, { 15854 length: array.length, 15855 position: new_pos, 15856 last: true 15857 }); 15858 } else { 15859 var line_index; 15860 var current; 15861 new_pos = pos; 15862 for (i = 0;i < array.length; ++i) { 15863 var current_len = $.terminal.length(array[i]); 15864 if (new_pos > current_len) { 15865 new_pos -= current_len; 15866 } else { 15867 break; 15868 } 15869 } 15870 current = array[i]; 15871 line_index = i; 15872 if (new_pos === length(current)) { 15873 new_pos = 0; 15874 current = array[++line_index]; 15875 if (current === undefined) { 15876 var msg = $.terminal.defaults.strings.redrawError; 15877 throw new Error(msg); 15878 } 15879 } 15880 draw_cursor_line(current, { 15881 length: array.length, 15882 position: new_pos 15883 }); 15884 lines_before(array.slice(0, line_index)); 15885 lines_after(array.slice(line_index + 1)); 15886 } 15887 } 15888 self2.find(".cmd-cursor-line ~ div:last-of-type").append("<span></span>"); 15889 } else if (formatted === "") { 15890 before.html(""); 15891 empty_cursor(); 15892 after.html(""); 15893 } else { 15894 draw_cursor_line(formatted, { 15895 length: 1, 15896 position: pos 15897 }); 15898 } 15899 var in_line = cursor_line.prevUntil(".cmd-prompt").length; 15900 if (is_css_variables_supported) { 15901 self2[0].style.setProperty("--cursor-line", in_line); 15902 } else { 15903 clip.$node.css("top", in_line * 14 + "px"); 15904 } 15905 wrapper.css({ 15906 display: "" 15907 }); 15908 }; 15909 }(); 15910 var find_position = function() { 15911 function make_guess(string2, position) { 15912 var opts = $.extend({}, settings2, { 15913 position, 15914 command: true 15915 }); 15916 return $.terminal.apply_formatters(string2, opts)[1]; 15917 } 15918 function cmp(search_pos, pos, string2) { 15919 var guess = make_guess(string2, pos); 15920 if (guess === search_pos) { 15921 var next_guess = make_guess(string2, pos + 1); 15922 if (next_guess > search_pos) { 15923 return 0; 15924 } 15925 return 1; 15926 } else if (guess < search_pos) { 15927 return 1; 15928 } else { 15929 return -1; 15930 } 15931 } 15932 return function(string2, formatted_position) { 15933 if (formatted_position === 0) { 15934 return 0; 15935 } 15936 string2 = bare_text(string2); 15937 var codepoint_len = string2.length; 15938 var str = $.terminal.escape_brackets(command); 15939 var pos = binary_search(0, codepoint_len, formatted_position, cmp, [str]); 15940 var chars = $.terminal.split_characters(string2); 15941 if (codepoint_len > chars.length) { 15942 var len = 0; 15943 for (var i = 0;i < chars.length; ++i) { 15944 len += chars[i].length; 15945 if (len >= pos) { 15946 return len; 15947 } 15948 } 15949 } 15950 return pos; 15951 }; 15952 }(); 15953 function get_prompt_marker() { 15954 if (prompt_offset) { 15955 return new Array(prompt_offset + 1).join("ï¿¿"); 15956 } 15957 return ""; 15958 } 15959 var prev_prompt_data; 15960 var draw_prompt = function() { 15961 function format_prompt(prompt) { 15962 if (!prompt) { 15963 just_prompt_len = 0; 15964 prompt_len = prompt_offset; 15965 return prompt; 15966 } 15967 var prompt_marker = get_prompt_marker(); 15968 var tmp_prompt = prompt_marker + prompt; 15969 var lines = $.terminal.split_equal(tmp_prompt, num_chars); 15970 lines = lines.map(function(line) { 15971 return line.replace(/^\uFFFF+/, ""); 15972 }); 15973 lines = lines.map(function(line) { 15974 if (!$.terminal.have_formatting(line)) { 15975 return "[[;;]" + $.terminal.escape_brackets(line) + "]"; 15976 } 15977 return $.terminal.format_split(line).map(function(str) { 15978 if ($.terminal.is_formatting(str)) { 15979 return str; 15980 } 15981 return "[[;;]" + $.terminal.escape_brackets(str) + "]"; 15982 }).join(""); 15983 }); 15984 var options2 = { 15985 charWidth: settings2.charWidth 15986 }; 15987 prompt_last_line = lines[lines.length - 1]; 15988 var encoded_last_line = $.terminal.encode(lines[lines.length - 1], { 15989 tabs: settings2.tabs 15990 }); 15991 var last_line = $.terminal.format(encoded_last_line, options2); 15992 just_prompt_len = strlen(text(encoded_last_line)); 15993 prompt_len = just_prompt_len + prompt_offset; 15994 return lines.slice(0, -1).map(function(line) { 15995 line = $.terminal.encode(line, { 15996 tabs: settings2.tabs 15997 }); 15998 return '<span class="cmd-line">' + $.terminal.format(line, options2) + "</span>"; 15999 }).concat([last_line]).join(` 16000`); 16001 } 16002 function set(prompt, options2) { 16003 if (prompt) { 16004 if (options2 && options2.formatters || !options2) { 16005 prompt = $.terminal.apply_formatters(prompt, { prompt: true }); 16006 prompt = $.terminal.normalize(prompt); 16007 } 16008 prompt = crlf(prompt); 16009 } 16010 var formatted = format_prompt(prompt); 16011 last_rendered_prompt = prompt; 16012 formatted = formatted || $.terminal.format("[[;;]â]"); 16013 if (prompt_node.html() !== formatted) { 16014 prompt_node.html(formatted); 16015 var spans = prompt_node.find("> span span"); 16016 clip.$node.attr("data-cmd-prompt", prompt_node.text()); 16017 if (is_ch_unit_supported) { 16018 prompt_node.hide(); 16019 spans.each(function() { 16020 var self2 = $(this); 16021 var len = strlen(self2.text()); 16022 if (len === 0) { 16023 self2.css("width", 1); 16024 } else { 16025 self2.css("width", len + "ch"); 16026 } 16027 }); 16028 prompt_node.show(); 16029 } 16030 } 16031 } 16032 return function(options2) { 16033 if (prev_prompt_data && prev_prompt_data.set) { 16034 prev_prompt_data.set = $.noop; 16035 prev_prompt_data = null; 16036 } 16037 var data = prev_prompt_data = { 16038 set 16039 }; 16040 with_prompt(prompt, function(prompt) { 16041 data.set(prompt, options2); 16042 }, self2); 16043 }; 16044 }(); 16045 function fire_change_command() { 16046 if (is_function(settings2.onCommandChange)) { 16047 settings2.onCommandChange.call(self2, command); 16048 } 16049 } 16050 function column(command, position, include_prompt) { 16051 var before = command.substring(0, position); 16052 if (position === 0 || !command.length) { 16053 return 0; 16054 } 16055 var re = /\n?([^\n]*)$/; 16056 var match = before.match(re); 16057 var col = match[1].length; 16058 if (!have_newlines(before) && (include_prompt || have_wrapping(before, prompt_len))) { 16059 col += prompt_len; 16060 } 16061 if (col === 0) { 16062 return col; 16063 } 16064 col %= num_chars; 16065 if (col === 0) { 16066 return num_chars; 16067 } 16068 return col; 16069 } 16070 $.extend(self2, { 16071 option: function(name, value) { 16072 if (typeof value === "undefined") { 16073 return settings2[name]; 16074 } else { 16075 settings2[name] = value; 16076 } 16077 return self2; 16078 }, 16079 name: function(string2) { 16080 if (string2 !== undefined) { 16081 name = string2; 16082 var enabled = history2 && history2.enabled() || !history2; 16083 history2 = new History(name, settings2.historySize, settings2.history === "memory"); 16084 if (!enabled) { 16085 history2.disable(); 16086 } 16087 return self2; 16088 } else { 16089 return name; 16090 } 16091 }, 16092 purge: function() { 16093 history2.clear(); 16094 return self2; 16095 }, 16096 history: function() { 16097 return history2; 16098 }, 16099 delete: function(n, stay) { 16100 var removed, string2; 16101 if (n === 0) { 16102 return ""; 16103 } else if (n < 0) { 16104 if (position > 0) { 16105 removed = command.slice(0, position).slice(n); 16106 string2 = bare_text(command); 16107 string2 = string2.slice(0, position + n) + string2.slice(position, string2.length); 16108 if (!stay) { 16109 self2.position(position + n); 16110 } 16111 } 16112 } else if (command !== "") { 16113 string2 = text(command); 16114 if (position < string2.length) { 16115 removed = string2.slice(position).slice(0, n); 16116 string2 = string2.slice(0, position) + string2.slice(position + n, string2.length); 16117 } 16118 } 16119 if (removed) { 16120 command = string2; 16121 } 16122 redraw(); 16123 fix_editable(); 16124 fire_change_command(); 16125 return removed; 16126 }, 16127 set: function(string2, stay, silent) { 16128 if (string2 !== undefined) { 16129 var command_changed = string2 !== command; 16130 command = string2; 16131 if (!stay) { 16132 self2.position(bare_text(command).length); 16133 } 16134 redraw(); 16135 fix_editable(); 16136 if (!silent && command_changed) { 16137 fire_change_command(); 16138 } 16139 } 16140 return self2; 16141 }, 16142 keymap: function(new_keymap, value) { 16143 function wrap(key, fn2) { 16144 var original = default_keymap[key]; 16145 if (is_function(original)) { 16146 original = original.bind(self2); 16147 } 16148 return function(e) { 16149 return fn2.call(self2, e, original); 16150 }; 16151 } 16152 if (new_keymap === null) { 16153 keymap = default_keymap; 16154 return self2; 16155 } else if (typeof new_keymap === "undefined") { 16156 return keymap; 16157 } else if (typeof new_keymap === "string") { 16158 if (typeof value === "undefined") { 16159 if (keymap[new_keymap]) { 16160 return keymap[new_keymap]; 16161 } else if (default_keymap[new_keymap]) { 16162 return default_keymap[new_keymap]; 16163 } 16164 } else { 16165 keymap[new_keymap] = wrap(new_keymap, value); 16166 } 16167 } else { 16168 keymap = $.extend({}, keymap ? keymap : default_keymap, $.omap(new_keymap || {}, wrap)); 16169 return self2; 16170 } 16171 }, 16172 insert: function(string2, stay) { 16173 var bare_command = bare_text(command); 16174 var len = bare_text(string2).length; 16175 if (position === bare_command.length) { 16176 string2 = bare_command + string2; 16177 } else if (position === 0) { 16178 string2 = string2 + bare_command; 16179 } else { 16180 string2 = bare_command.slice(0, position) + string2 + bare_command.slice(position); 16181 } 16182 command = string2; 16183 if (!stay) { 16184 self2.position(len, true, true); 16185 } 16186 fix_editable(); 16187 redraw(); 16188 fire_change_command(); 16189 return self2; 16190 }, 16191 get: function() { 16192 return command; 16193 }, 16194 commands: function(commands) { 16195 if (commands) { 16196 settings2.commands = commands; 16197 return self2; 16198 } else { 16199 return commands; 16200 } 16201 }, 16202 destroy: function() { 16203 doc.unbind("keypress.cmd", keypress_event); 16204 doc.unbind("keydown.cmd", keydown_event); 16205 doc.unbind("input.cmd", input_event); 16206 self2.stopTime("blink", blink); 16207 self2.find(".cmd-wrapper").remove(); 16208 self2.find(".cmd-prompt, .cmd-clipboard, .cmd-editable").remove(); 16209 self2.removeClass("cmd").removeData("cmd").off(".cmd"); 16210 return self2; 16211 }, 16212 display_column: function(include_prompt) { 16213 var formatted = formatting(command); 16214 formatted = $.terminal.strip(formatted); 16215 return column(formatted, formatted_position, include_prompt); 16216 }, 16217 column: function(include_prompt) { 16218 return column(command, position, include_prompt); 16219 }, 16220 line: function() { 16221 var before = command.substring(0, position); 16222 if (position === 0 || !command.length) { 16223 return 0; 16224 } 16225 return before.split(/\n/).length - 1; 16226 }, 16227 __set_prompt_margin: function(len) { 16228 prompt_offset = len; 16229 prompt_len = just_prompt_len + prompt_offset; 16230 }, 16231 prompt: function(user_prompt, options2) { 16232 if (user_prompt === true) { 16233 return last_rendered_prompt; 16234 } else if (user_prompt === undefined) { 16235 return prompt; 16236 } else { 16237 var should_redraw = user_prompt !== prompt; 16238 if (typeof user_prompt === "string" || typeof user_prompt === "function") { 16239 prompt = user_prompt; 16240 } else { 16241 throw new Error("prompt must be a function or string"); 16242 } 16243 if (should_redraw) { 16244 draw_prompt(options2); 16245 redraw(); 16246 } 16247 return self2; 16248 } 16249 }, 16250 kill_text: function() { 16251 return kill_text; 16252 }, 16253 position: function(n, relative, silent) { 16254 if (typeof n === "number") { 16255 var pos = position; 16256 var len = bare_text(command).length; 16257 if (relative) { 16258 position += n; 16259 } else if (n < 0) { 16260 position = 0; 16261 } else if (n > len) { 16262 position = len; 16263 } else { 16264 position = n; 16265 } 16266 if (pos !== position) { 16267 redraw(); 16268 if (!silent && is_function(settings2.onPositionChange)) { 16269 settings2.onPositionChange(position, formatted_position); 16270 } 16271 fix_editable(true); 16272 } 16273 return self2; 16274 } else { 16275 return position; 16276 } 16277 }, 16278 refresh: function() { 16279 draw_prompt(); 16280 redraw(); 16281 fix_editable(true); 16282 return self2; 16283 }, 16284 display_position: function(n, relative) { 16285 if (n === undefined) { 16286 return formatted_position; 16287 } else { 16288 var string2 = formatting($.terminal.escape_formatting(command), true); 16289 var len = length(string2); 16290 var command_len = bare_text(command).length; 16291 var new_formatted_pos; 16292 if (relative) { 16293 new_formatted_pos = formatted_position + n; 16294 } else if (n > len) { 16295 new_formatted_pos = len; 16296 } else { 16297 new_formatted_pos = n; 16298 } 16299 if (len === command_len) { 16300 formatted_position = new_formatted_pos; 16301 return self2.position(new_formatted_pos); 16302 } 16303 if (len === new_formatted_pos) { 16304 formatted_position = new_formatted_pos; 16305 return self2.position(command_len); 16306 } 16307 var pos = find_position(command, new_formatted_pos); 16308 if (pos !== -1) { 16309 formatted_position = new_formatted_pos; 16310 self2.position(pos); 16311 } 16312 return self2; 16313 } 16314 }, 16315 visible: function() { 16316 var visible = self2.visible; 16317 return function() { 16318 visible.apply(self2, []); 16319 redraw(); 16320 draw_prompt(); 16321 return self2; 16322 }; 16323 }(), 16324 show: function() { 16325 var show = self2.show; 16326 return function() { 16327 show.apply(self2, []); 16328 redraw(); 16329 draw_prompt(); 16330 return self2; 16331 }; 16332 }(), 16333 resize: function(num) { 16334 char_width = get_char_width(); 16335 var new_num_chars; 16336 if (typeof num === "number") { 16337 new_num_chars = num; 16338 } else { 16339 new_num_chars = get_num_chars2(char_width); 16340 } 16341 if (num_chars !== new_num_chars || arguments[0] === true) { 16342 num_chars = new_num_chars; 16343 draw_prompt(); 16344 redraw(); 16345 } 16346 return self2; 16347 }, 16348 clear_cache: "Map" in root ? function() { 16349 cmd_line_worker.clear(); 16350 } : function() { 16351 return self2; 16352 }, 16353 invoke_key: function(shortcut) { 16354 if (!enabled) { 16355 warn('invoke_key("' + shortcut + '") called on disabled terminal'); 16356 } 16357 var keys = shortcut.toUpperCase().split("+"); 16358 var key = keys.pop(); 16359 var ctrl = keys.indexOf("CTRL") !== -1; 16360 var shift = keys.indexOf("SHIFT") !== -1; 16361 var alt = keys.indexOf("ALT") !== -1; 16362 var meta = keys.indexOf("META") !== -1; 16363 var e = $.Event("keydown", { 16364 ctrlKey: ctrl, 16365 shiftKey: shift, 16366 altKey: alt, 16367 metaKey: meta, 16368 which: reversed_keycodes[key], 16369 key 16370 }); 16371 var doc = $(document.documentElement || window); 16372 doc.trigger(e); 16373 e = $.Event("keypress"); 16374 e.key = key; 16375 e.which = e.keyCode = 0; 16376 doc.trigger(e); 16377 return self2; 16378 }, 16379 clip: function() { 16380 return clip; 16381 }, 16382 enable: function(silent) { 16383 if (!enabled) { 16384 enabled = true; 16385 self2.addClass("enabled"); 16386 try { 16387 if (!clip.$node.is(":focus")) { 16388 clip.$node.focus(); 16389 } 16390 clip.$node.caret(position); 16391 } catch (e) {} 16392 animation(true); 16393 if (!silent && is_function(prompt)) { 16394 draw_prompt(); 16395 } 16396 fix_cursor(); 16397 fix_editable(); 16398 } 16399 mobile_focus(); 16400 return self2; 16401 }, 16402 isenabled: function() { 16403 return enabled; 16404 }, 16405 disable: function(focus) { 16406 enabled = false; 16407 self2.removeClass("enabled"); 16408 animation(false); 16409 if (!focus) { 16410 mobile_focus(); 16411 } 16412 return self2; 16413 }, 16414 mask: function(new_mask) { 16415 if (typeof new_mask === "undefined") { 16416 return settings2.mask; 16417 } else { 16418 settings2.mask = new_mask; 16419 redraw(); 16420 return self2; 16421 } 16422 } 16423 }); 16424 self2.name(settings2.name || settings2.prompt || ""); 16425 char_width = get_char_width(); 16426 num_chars = get_num_chars2(char_width); 16427 if (settings2.prompt !== false) { 16428 prompt = settings2.prompt; 16429 draw_prompt(); 16430 } 16431 if (settings2.enabled === true) { 16432 self2.enable(); 16433 } 16434 if (!settings2.history) { 16435 history2.disable(); 16436 } 16437 var first_up_history = true; 16438 var skip_keypress = false; 16439 var dead_key = false; 16440 var single_key = false; 16441 var no_keypress = false; 16442 var no_key = false; 16443 var no_keydown = true; 16444 var backspace = false; 16445 var process = false; 16446 var hold = false; 16447 var hold_pause = false; 16448 var skip_insert; 16449 var prev_command = ""; 16450 var prev_shortcut; 16451 function is_backspace(e) { 16452 return e.key.toUpperCase() === "BACKSPACE" || e.which === 8; 16453 } 16454 function is_single(e) { 16455 return e.key && e.key.length === 1 && !e.ctrlKey; 16456 } 16457 function is_delay_key(key) { 16458 var specials = ["HOLD+SHIFT+BACKSPACE", "HOLD+BACKSPACE"]; 16459 return specials.indexOf(key) !== -1 && settings2.mobileDelete || settings2.repeatTimeoutKeys.indexOf(key) !== -1; 16460 } 16461 function clear_reverse_search_key(e) { 16462 return e.which === 35 || e.which === 36 || e.which === 37 || e.which === 38 || e.which === 39 || e.which === 40 || e.which === 13 || e.which === 27; 16463 } 16464 var skip_keydown = false; 16465 function keydown_event(e) { 16466 debug('keydown "' + e.key + '" ' + e.fake + " " + e.which); 16467 var result; 16468 process = (e.key || "").toLowerCase() === "process" || e.which === 0; 16469 dead_key = no_keypress && single_key && !is_backspace(e); 16470 var have_key = typeof e.key !== "undefined"; 16471 var key = String(e.key).toLowerCase(); 16472 var unidentified_key = key === "unidentified"; 16473 var skip_keymap; 16474 try { 16475 if (!e.fake) { 16476 single_key = is_single(e); 16477 no_key = !unidentified_key; 16478 backspace = have_key && is_backspace(e); 16479 } 16480 } catch (exception) {} 16481 if (unidentified_key) { 16482 no_keydown = true; 16483 return; 16484 } 16485 if (!e.fake && have_key && ["meta", "os"].indexOf(key) === -1) { 16486 no_keydown = false; 16487 } 16488 no_keypress = true; 16489 clip.$node.off("input", paste); 16490 var shortcut = get_key(e); 16491 if (is_function(settings2.keydown)) { 16492 if (have_key) { 16493 e.key = ie_key_fix(e); 16494 } 16495 result = settings2.keydown.call(self2, e); 16496 if (result !== undefined) { 16497 if (!result) { 16498 skip_insert = true; 16499 } 16500 if (result === true) { 16501 skip_keymap = true; 16502 } else { 16503 return result; 16504 } 16505 } 16506 } 16507 if (shortcut !== prev_shortcut) { 16508 clear_hold(); 16509 } 16510 if (enabled || shortcut === "CTRL+C" && is_terminal_selected(self2)) { 16511 if (hold) { 16512 prev_shortcut = shortcut; 16513 shortcut = "HOLD+" + shortcut; 16514 if (hold_pause) { 16515 return; 16516 } 16517 if (settings2.holdRepeatTimeout > 0 && is_delay_key(shortcut)) { 16518 hold_pause = true; 16519 self2.oneTime(settings2.holdRepeatTimeout, "delay", function() { 16520 hold_pause = false; 16521 }); 16522 } 16523 } else { 16524 self2.oneTime(settings2.holdTimeout, "hold", function() { 16525 hold = true; 16526 }); 16527 prev_shortcut = shortcut; 16528 } 16529 if (!e.fake && is_android) { 16530 if (skip_keydown) { 16531 clear_hold(); 16532 skip_keydown = false; 16533 return false; 16534 } 16535 if (mobile_ignore_key(shortcut)) { 16536 skip_keydown = true; 16537 } else if (mobile_ignore_key(prev_shortcut)) { 16538 skip_keydown = false; 16539 } 16540 } 16541 restart_animation(); 16542 skip_insert = ["CTRL+V", "META+V"].indexOf(shortcut) !== -1; 16543 if (shortcut === "ENTER") { 16544 first_up_history = true; 16545 } 16546 if (reverse_search && clear_reverse_search_key(e)) { 16547 clear_reverse_state(); 16548 draw_prompt(); 16549 if (e.which === 27) { 16550 self2.set(""); 16551 } 16552 redraw(); 16553 if (e.which === 13) { 16554 keydown_event.call(this, e); 16555 } 16556 } else if (is_function(keymap[shortcut])) { 16557 result = keymap[shortcut](e); 16558 if (result === true) { 16559 return; 16560 } 16561 if (result !== undefined) { 16562 return result; 16563 } 16564 } else if (e.altKey) { 16565 return; 16566 } else { 16567 skip_keypress = false; 16568 return; 16569 } 16570 } else if (skip_keymap && is_function(keymap[shortcut])) { 16571 return false; 16572 } 16573 } 16574 function clear_hold() { 16575 self2.stopTime("hold"); 16576 self2.stopTime("delay"); 16577 hold_pause = hold = false; 16578 } 16579 var doc = $(document.documentElement || window); 16580 self2.keymap(settings2.keymap || {}); 16581 function keypress_event(e) { 16582 debug('keypress "' + e.key + '" ' + e.fake); 16583 clear_hold(); 16584 var result; 16585 if (!e.fake) { 16586 no_keypress = false; 16587 } 16588 if ((e.ctrlKey || e.metaKey) && !e.altKey) { 16589 return; 16590 } 16591 if (skip_keypress) { 16592 return; 16593 } 16594 if (is_function(settings2.keypress)) { 16595 result = settings2.keypress.call(self2, e); 16596 if (result !== undefined) { 16597 if (!result) { 16598 skip_insert = true; 16599 } 16600 return result; 16601 } 16602 } 16603 if (enabled) { 16604 if (e.fake) { 16605 return; 16606 } 16607 var key; 16608 if (is_key_native) { 16609 key = e.key; 16610 var normalized = key.toUpperCase(); 16611 if (key_mapping[normalized]) { 16612 key = key_mapping[normalized]; 16613 } 16614 } 16615 if (!key || no_key) { 16616 key = String.fromCharCode(e.which); 16617 } 16618 if ($.inArray(e.which, [13, 0, 8]) > -1) { 16619 if (e.keyCode === 123) { 16620 return; 16621 } 16622 return false; 16623 } else if (key && (!e.ctrlKey || e.ctrlKey && e.ctrlKey) && (!(e.altKey && e.which === 100) || e.altKey) && !dead_key) { 16624 if (reverse_search) { 16625 rev_search_str += key; 16626 reverse_history_search(); 16627 draw_reverse_prompt(); 16628 } else if (key.length === 1) { 16629 self2.insert(key); 16630 } 16631 } 16632 } 16633 } 16634 function event(type, chr, which) { 16635 var event = $.Event(type); 16636 event.which = which; 16637 event.key = chr; 16638 event.fake = true; 16639 doc.trigger(event); 16640 } 16641 var skip_input = false; 16642 function finalize_input_event() { 16643 prev_command = command; 16644 skip_insert = false; 16645 no_keydown = true; 16646 } 16647 function input_event() { 16648 debug("input " + no_keydown + " || " + process + " ((" + no_keypress + " || " + dead_key + ") && !" + skip_insert + " && (" + single_key + " || " + no_key + ") && !" + backspace + ")"); 16649 var val = clip.val(); 16650 if (!is_mobile) { 16651 val = val.replace(/^ /, ""); 16652 } 16653 if (no_keydown || process || (no_keypress || dead_key) && !skip_insert && (single_key || no_key) && !backspace) { 16654 if (val && val === command) { 16655 finalize_input_event(); 16656 return; 16657 } 16658 var pos = position; 16659 if (no_keydown) { 16660 var cmd = prev_command; 16661 backspace = cmd.slice(0, cmd.length - 1).length === val.length; 16662 } 16663 if (skip_input) { 16664 skip_input = false; 16665 clip.val(command); 16666 return; 16667 } 16668 if (reverse_search) { 16669 rev_search_str = val; 16670 reverse_history_search(); 16671 draw_reverse_prompt(); 16672 } else { 16673 var str = val.slice(position); 16674 if (str.length === 1 || backspace) { 16675 var chr = get_next_character(str); 16676 if (mobile_ignore_key(chr)) { 16677 skip_input = true; 16678 } 16679 if (no_keydown) { 16680 var keycode; 16681 if (backspace) { 16682 keycode = 8; 16683 } else { 16684 keycode = str.toUpperCase().charCodeAt(0); 16685 } 16686 event("keydown", backspace ? "Backspace" : str, keycode); 16687 } 16688 if (no_keypress && !backspace) { 16689 event("keypress", chr, str.charCodeAt(0)); 16690 } 16691 } 16692 if (backspace) { 16693 prev_command = command; 16694 return; 16695 } 16696 if (skip_insert) { 16697 skip_insert = false; 16698 return; 16699 } 16700 self2.set(val); 16701 } 16702 if (backspace) { 16703 self2.position(pos - 1); 16704 } else { 16705 self2.position(pos + Math.abs(val.length - prev_command.length)); 16706 } 16707 } 16708 finalize_input_event(); 16709 } 16710 doc.bind("keypress.cmd", keypress_event); 16711 doc.bind("keydown.cmd", keydown_event); 16712 doc.bind("keyup.cmd", clear_hold); 16713 doc.bind("input.cmd", input_event); 16714 (function() { 16715 if (is_mobile) { 16716 $(self2[0]).add(clip.$node).on("touchstart.cmd", function() { 16717 if (!self2.isenabled()) { 16718 clip.focus(); 16719 } else { 16720 clip.blur(); 16721 } 16722 }); 16723 self2.disable(); 16724 return; 16725 } 16726 var was_down = false; 16727 var count = 0; 16728 self2.on("mousedown.cmd", function() { 16729 was_down = true; 16730 }).on("mouseup.cmd", function(e) { 16731 function trigger() { 16732 var $target = $(e.target); 16733 var is_prompt = $target.is(".cmd-prompt"); 16734 if (!is_prompt && down && get_selected_html() === "") { 16735 if (enabled) { 16736 if ($target.is(".cmd")) { 16737 self2.position(text(command).length); 16738 } else { 16739 self2.display_position(get_char_pos(e)); 16740 } 16741 } 16742 } 16743 count = 0; 16744 } 16745 var button; 16746 if (e.originalEvent === undefined) { 16747 button = e.button; 16748 } else { 16749 button = e.originalEvent.button; 16750 } 16751 if (button === 0 && get_selected_html() === "") { 16752 var name = "click_" + id; 16753 if (++count === 1) { 16754 var down = was_down; 16755 if (enabled) { 16756 if (settings2.clickTimeout === 0) { 16757 trigger(); 16758 } else { 16759 self2.oneTime(settings2.clickTimeout, name, trigger); 16760 } 16761 } else { 16762 count = 0; 16763 } 16764 } else { 16765 self2.stopTime(name); 16766 count = 0; 16767 } 16768 } 16769 was_down = false; 16770 }); 16771 })(); 16772 self2.data("cmd", self2); 16773 if (!(("KeyboardEvent" in window) && ("key" in window.KeyboardEvent.prototype))) { 16774 setTimeout(function() { 16775 throw new Error("key event property not supported try https://github." + "com/inexorabletash/polyfill/blob/master/keyboard.js"); 16776 }, 0); 16777 } 16778 return self2; 16779 }; 16780 var strlen = function() { 16781 if (typeof wcwidth === "undefined") { 16782 return function(string2) { 16783 string2 = string2.replace(/\u200B/g, ""); 16784 return $.terminal.length(string2); 16785 }; 16786 } else { 16787 return wcwidth; 16788 } 16789 }(); 16790 function count_selfclosing_formatting(string2) { 16791 var count = 0; 16792 if ($.terminal.have_formatting(string2)) { 16793 var re = new RegExp(format_parts_re.source, "i"); 16794 $.terminal.format_split(string2).forEach(function(str) { 16795 if ($.terminal.is_formatting(str)) { 16796 var m2 = str.match(re); 16797 if (m2 && m2[1].match(/@/) && m2[6] === "") { 16798 count++; 16799 } 16800 } 16801 }); 16802 } 16803 return count; 16804 } 16805 var entities = { 16806 "&": "&", 16807 "<": "<", 16808 ">": ">", 16809 "À": "Ã", 16810 "Á": "Ã", 16811 "Â": "Ã", 16812 "Ã": "Ã", 16813 "Ä": "Ã", 16814 "Å": "à ", 16815 "Æ": "Ã", 16816 "Ç": "Ã", 16817 "È": "Ã", 16818 "É": "Ã", 16819 "Ê": "Ã", 16820 "Ë": "Ã", 16821 "Ì": "Ã", 16822 "Í": "Ã", 16823 "Î": "Ã", 16824 "Ï": "Ã", 16825 "Ð": "Ã", 16826 "Ñ": "Ã", 16827 "Ò": "Ã", 16828 "Ó": "Ã", 16829 "Ô": "Ã", 16830 "Õ": "Ã", 16831 "Ö": "Ã", 16832 "Ø": "Ã", 16833 "Ù": "Ã", 16834 "Ú": "Ã", 16835 "Û": "Ã", 16836 "Ü": "Ã", 16837 "Ý": "Ã", 16838 "Þ": "Ã", 16839 "ß": "Ã", 16840 "à": "à ", 16841 "á": "á", 16842 "â": "â", 16843 "ã": "ã", 16844 "ä": "ä", 16845 "å": "Ã¥", 16846 "æ": "æ", 16847 "ç": "ç", 16848 "è": "è", 16849 "é": "é", 16850 "ê": "ê", 16851 "ë": "ë", 16852 "ì": "ì", 16853 "í": "Ã", 16854 "î": "î", 16855 "ï": "ï", 16856 "ð": "ð", 16857 "ñ": "ñ", 16858 "ò": "ò", 16859 "ó": "ó", 16860 "ô": "ô", 16861 "õ": "õ", 16862 "ö": "ö", 16863 "ø": "ø", 16864 "ù": "ù", 16865 "ú": "ú", 16866 "û": "û", 16867 "ü": "ü", 16868 "ý": "ý", 16869 "þ": "þ", 16870 "ÿ": "ÿ", 16871 " ": " ", 16872 "¡": "¡", 16873 "¢": "¢", 16874 "£": "£", 16875 "¤": "¤", 16876 "¥": "Â¥", 16877 "¦": "¦", 16878 "§": "§", 16879 "¨": "¨", 16880 "©": "©", 16881 "ª": "ª", 16882 "«": "«", 16883 "¬": "¬", 16884 "­": "Â", 16885 "®": "®", 16886 "¯": "¯", 16887 "°": "°", 16888 "±": "±", 16889 "²": "²", 16890 "³": "³", 16891 "´": "´", 16892 "µ": "µ", 16893 "¶": "¶", 16894 "¸": "¸", 16895 "¹": "¹", 16896 "º": "º", 16897 "»": "»", 16898 "¼": "¼", 16899 "½": "½", 16900 "¾": "¾", 16901 "¿": "¿", 16902 "×": "Ã", 16903 "÷": "÷", 16904 "∀": "â", 16905 "∂": "â", 16906 "∃": "â", 16907 "∅": "â ", 16908 "∇": "â", 16909 "∈": "â", 16910 "∉": "â", 16911 "∋": "â", 16912 "∏": "â", 16913 "∑": "â", 16914 "−": "â", 16915 "∗": "â", 16916 "√": "â", 16917 "∝": "â", 16918 "∞": "â", 16919 "∠": "â ", 16920 "∧": "â§", 16921 "∨": "â¨", 16922 "∩": "â©", 16923 "∪": "âª", 16924 "∫": "â«", 16925 "∴": "â´", 16926 "∼": "â¼", 16927 "≅": "â ", 16928 "≈": "â", 16929 "≠": "â ", 16930 "≡": "â¡", 16931 "≤": "â¤", 16932 "≥": "â¥", 16933 "⊂": "â", 16934 "⊃": "â", 16935 "⊄": "â", 16936 "⊆": "â", 16937 "⊇": "â", 16938 "⊕": "â", 16939 "⊗": "â", 16940 "⊥": "â¥", 16941 "⋅": "â ", 16942 "Α": "Î", 16943 "Β": "Î", 16944 "Γ": "Î", 16945 "Δ": "Î", 16946 "Ε": "Î", 16947 "Ζ": "Î", 16948 "Η": "Î", 16949 "Θ": "Î", 16950 "Ι": "Î", 16951 "Κ": "Î", 16952 "Λ": "Î", 16953 "Μ": "Î", 16954 "Ν": "Î", 16955 "Ξ": "Î", 16956 "Ο": "Î", 16957 "Π": "Î ", 16958 "Ρ": "Ρ", 16959 "Σ": "Σ", 16960 "Τ": "Τ", 16961 "Υ": "Î¥", 16962 "Φ": "Φ", 16963 "Χ": "Χ", 16964 "Ψ": "Ψ", 16965 "Ω": "Ω", 16966 "α": "α", 16967 "β": "β", 16968 "γ": "γ", 16969 "δ": "δ", 16970 "ε": "ε", 16971 "ζ": "ζ", 16972 "η": "η", 16973 "θ": "θ", 16974 "ι": "ι", 16975 "κ": "κ", 16976 "λ": "λ", 16977 "μ": "μ", 16978 "ν": "ν", 16979 "ξ": "ξ", 16980 "ο": "ο", 16981 "π": "Ï", 16982 "ρ": "Ï", 16983 "ς": "Ï", 16984 "σ": "Ï", 16985 "τ": "Ï", 16986 "υ": "Ï ", 16987 "φ": "Ï", 16988 "χ": "Ï", 16989 "ψ": "Ï", 16990 "ω": "Ï", 16991 "ϑ": "Ï", 16992 "ϒ": "Ï", 16993 "ϖ": "Ï", 16994 "Œ": "Å", 16995 "œ": "Å", 16996 "Š": "Å ", 16997 "š": "Å¡", 16998 "Ÿ": "Ÿ", 16999 "ƒ": "Æ", 17000 "ˆ": "Ë", 17001 "˜": "Ë", 17002 " ": "â", 17003 " ": "â", 17004 " ": "â", 17005 "‌": "â", 17006 "‍": "â", 17007 "‎": "â", 17008 "‏": "â", 17009 "–": "â", 17010 "—": "â", 17011 "‘": "â", 17012 "’": "â", 17013 "‚": "â", 17014 "“": "â", 17015 "”": "â", 17016 "„": "â", 17017 "†": "â ", 17018 "‡": "â¡", 17019 "•": "â¢", 17020 "…": "â¦", 17021 "‰": "â°", 17022 "′": "â²", 17023 "″": "â³", 17024 "‹": "â¹", 17025 "›": "âº", 17026 "‾": "â¾", 17027 "€": "â¬", 17028 "™": "â¢", 17029 "←": "â", 17030 "↑": "â", 17031 "→": "â", 17032 "↓": "â", 17033 "↔": "â", 17034 "↵": "âµ", 17035 "⌈": "â", 17036 "⌉": "â", 17037 "⌊": "â", 17038 "⌋": "â", 17039 "◊": "â", 17040 "♠": "â ", 17041 "♣": "â£", 17042 "♥": "â¥", 17043 "♦": "â¦" 17044 }; 17045 function render_entities(str) { 17046 return str.replace(/&#(?:x([0-9a-f]+)|([0-9]+));/gi, function(_, hex, dec) { 17047 var code; 17048 if (hex) { 17049 code = parseInt(hex, 16); 17050 } else { 17051 code = parseInt(dec, 10); 17052 } 17053 return String.fromCharCode(code); 17054 }).replace(/(&[^;]+;)/g, function(_, entity) { 17055 return entities[entity] || entity; 17056 }); 17057 } 17058 function bare_text(str) { 17059 if (!str.match(/&/)) { 17060 return str; 17061 } 17062 return render_entities(safe(str)); 17063 } 17064 function text(str) { 17065 return bare_text($.terminal.strip(str)); 17066 } 17067 function amp(str) { 17068 return str.replace(/&(?!#[0-9]+;|#x[0-9a-f]+;|[a-z]+;)/gi, "&"); 17069 } 17070 function safe(str) { 17071 if (!str.match(/[<>&]/)) { 17072 return str; 17073 } 17074 return amp(str).replace(/</g, "<").replace(/>/g, ">"); 17075 } 17076 function crlf(str) { 17077 return str.replace(/\r/g, ""); 17078 } 17079 function char_len(chr) { 17080 return entity_re.test(chr) ? 1 : chr.length; 17081 } 17082 function make_re_fn(re) { 17083 return function test_re(str) { 17084 var m2 = str.match(re); 17085 if (starts_with(m2)) { 17086 return m2[1]; 17087 } 17088 }; 17089 } 17090 function starts_with(match) { 17091 return match && match.index === 0; 17092 } 17093 function is_simple_text(str) { 17094 var re = [ 17095 entity_re, 17096 emoji_re, 17097 combine_chr_re, 17098 astral_symbols_re 17099 ]; 17100 for (var i = 0;i < re.length; ++i) { 17101 if (re[i].test(str)) { 17102 return false; 17103 } 17104 } 17105 return true; 17106 } 17107 function make_next_char_fun(string2) { 17108 var tests = []; 17109 [ 17110 entity_re, 17111 emoji_re, 17112 combine_chr_re 17113 ].forEach(function(re) { 17114 if (re.test(string2)) { 17115 tests.push(make_re_fn(re)); 17116 } 17117 }); 17118 if (astral_symbols_re.test(string2)) { 17119 tests.push(function test_astral(string2) { 17120 var m1 = string2.match(astral_symbols_re); 17121 if (starts_with(m1)) { 17122 var m2 = string2.match(combine_chr_re); 17123 if (m2 && m2.index === 1) { 17124 return string2.slice(0, 3); 17125 } 17126 return m1[1]; 17127 } 17128 }); 17129 } 17130 return function next_char(string2) { 17131 for (var i = 0;i < tests.length; ++i) { 17132 var test = tests[i]; 17133 var ret2 = test(string2); 17134 if (ret2) { 17135 return ret2; 17136 } 17137 } 17138 return string2[0]; 17139 }; 17140 } 17141 function get_next_character(string2) { 17142 var match_entity = string2.match(entity_re); 17143 if (starts_with(match_entity)) { 17144 return match_entity[1]; 17145 } 17146 var match_combo = string2.match(combine_chr_re); 17147 if (starts_with(match_combo)) { 17148 return match_combo[1]; 17149 } 17150 var match_emoji = string2.match(emoji_re); 17151 if (starts_with(match_emoji)) { 17152 return match_emoji[1]; 17153 } else if (string2.charCodeAt(0) < 255) { 17154 return string2[0]; 17155 } else { 17156 var astral_match = string2.match(astral_symbols_re); 17157 if (starts_with(astral_match)) { 17158 match_combo = string2.match(combine_chr_re); 17159 if (match_combo && match_combo.index === 1) { 17160 return string2.slice(0, 3); 17161 } 17162 return string2.slice(0, 2); 17163 } else { 17164 return string2[0]; 17165 } 17166 } 17167 } 17168 function normalize_position(string2, position) { 17169 if (position === 0) { 17170 return position; 17171 } 17172 string2 = $.terminal.strip(string2); 17173 var result = $.terminal.split_characters(string2).reduce(function(acc, chr) { 17174 if (typeof acc === "number") { 17175 return acc; 17176 } 17177 var length = acc.length + char_len(chr); 17178 if (length >= position) { 17179 return acc.position + 1; 17180 } 17181 return { 17182 position: acc.position + 1, 17183 length 17184 }; 17185 }, { position: 0, length: 0 }); 17186 if (typeof result === "number") { 17187 return result; 17188 } else { 17189 return result.position; 17190 } 17191 } 17192 function style_to_string(styles) { 17193 return Object.keys(styles).map(function(prop) { 17194 return prop + ":" + styles[prop]; 17195 }).join(";"); 17196 } 17197 function escape_html_attr(value) { 17198 return value.replace(/"/g, """); 17199 } 17200 function char_width_object(len, options2) { 17201 var result = {}; 17202 if (len === 0) { 17203 result["width"] = "1px"; 17204 } else if (is_ch_unit_supported) { 17205 result["width"] = len + "ch"; 17206 } else if (!is_css_variables_supported) { 17207 if (options2.charWidth) { 17208 result["width"] = options2.charWidth * len + "px"; 17209 } 17210 } else { 17211 result["--length"] = len; 17212 } 17213 return result; 17214 } 17215 function char_width_prop(len, options2) { 17216 return style_to_string(char_width_object(len, options2)); 17217 } 17218 function extra_css(text2, options2) { 17219 if (typeof wcwidth !== "undefined") { 17220 var bare = bare_text(text2); 17221 var len = strlen(bare); 17222 if (len > 1 && len !== $.terminal.length(bare)) { 17223 return char_width_object(len, options2); 17224 } 17225 } 17226 } 17227 function wide_characters(text2, options2) { 17228 if (typeof wcwidth !== "undefined") { 17229 var bare = bare_text(text2); 17230 var chars = $.terminal.split_characters(bare); 17231 if (chars.length === 1) { 17232 return text2; 17233 } 17234 var specs = chars.map(function(chr) { 17235 return { 17236 len: strlen(chr), 17237 chr 17238 }; 17239 }).reduce(function(arr, spec) { 17240 var last = arr[arr.length - 1]; 17241 if (last) { 17242 if (last.len !== spec.len) { 17243 return arr.concat([{ 17244 sum: spec.len, 17245 len: spec.len, 17246 specs: [spec] 17247 }]); 17248 } else { 17249 arr.pop(); 17250 return arr.concat([{ 17251 sum: last.sum + spec.len, 17252 len: last.len, 17253 specs: last.specs.concat(spec) 17254 }]); 17255 } 17256 } 17257 return [{ 17258 sum: spec.len, 17259 specs: [spec], 17260 len: spec.len 17261 }]; 17262 }, []); 17263 return specs.map(function(spec) { 17264 if (spec.len === 1) { 17265 return make_string(spec); 17266 } 17267 var style = char_width_prop(spec.sum, options2); 17268 if (spec.sum === chars.length || !style.length) { 17269 return "<span>" + make_string(spec) + "</span>"; 17270 } else if (spec.specs.length > 1) { 17271 return wrap(style, spec.specs.map(function(spec) { 17272 return wrap(char_width_prop(spec.len), spec.chr); 17273 }).join("")); 17274 } else { 17275 return wrap(style, make_string(spec)); 17276 } 17277 }).join(""); 17278 } 17279 function make_string(spec) { 17280 return spec.specs.map(function(spec) { 17281 return spec.chr; 17282 }).join(""); 17283 } 17284 function wrap(style, str) { 17285 return '<span style="' + style + '">' + str + "</span>"; 17286 } 17287 return text2; 17288 } 17289 function binary_search(start, end, search_pos, compare_fn, more_args) { 17290 var len = end - start; 17291 var mid = start + Math.floor(len / 2); 17292 var args2 = [search_pos, mid].concat(more_args); 17293 var cmp = compare_fn.apply(null, args2); 17294 if (cmp === 0) { 17295 return mid; 17296 } else if (cmp > 0 && len > 1) { 17297 return binary_search(mid, end, search_pos, compare_fn, more_args); 17298 } else if (cmp < 0 && len > 1) { 17299 return binary_search(start, mid, search_pos, compare_fn, more_args); 17300 } else { 17301 return -1; 17302 } 17303 } 17304 function is_terminal_selected(cmd) { 17305 if (is_function(window.getSelection)) { 17306 var selection = window.getSelection(); 17307 if (selection.toString()) { 17308 var node = selection.getRangeAt(0).startContainer.parentNode; 17309 var term2 = $(node).closest(".terminal"); 17310 return term2.length && (cmd && term2.find(".cmd").is(cmd) || !cmd); 17311 } 17312 } 17313 } 17314 function get_selected_html() { 17315 var html = ""; 17316 if (is_function(window.getSelection)) { 17317 var sel = window.getSelection(); 17318 if (sel.rangeCount) { 17319 var container = document.createElement("div"); 17320 for (var i = 0, len = sel.rangeCount;i < len; ++i) { 17321 container.appendChild(sel.getRangeAt(i).cloneContents()); 17322 } 17323 html = container.innerHTML; 17324 } 17325 } 17326 return html; 17327 } 17328 function with_selection(fn2) { 17329 var html = ""; 17330 var ranges = []; 17331 if (is_function(window.getSelection)) { 17332 var selection = window.getSelection(); 17333 if (selection.rangeCount) { 17334 var container = document.createElement("div"); 17335 for (var i = 0, len = selection.rangeCount;i < len; ++i) { 17336 var range = selection.getRangeAt(i).cloneRange(); 17337 ranges.push(range); 17338 container.appendChild(range.cloneContents()); 17339 } 17340 html = container.innerHTML; 17341 } 17342 } 17343 fn2(html); 17344 if (ranges.length) { 17345 selection.removeAllRanges(); 17346 ranges.forEach(function(range) { 17347 selection.addRange(range); 17348 }); 17349 } 17350 return html !== ""; 17351 } 17352 function process_selected_line() { 17353 var $self = $(this); 17354 var result = $self.text(); 17355 if ($self.hasClass("cmd-end-line")) { 17356 result += ` 17357`; 17358 } 17359 return result; 17360 } 17361 function process_div(element) { 17362 return $(element).find("> div, > span").map(process_selected_line).get().join(` 17363`).replace(/\n$/, ""); 17364 } 17365 function process_selected_html(html) { 17366 var stdout; 17367 var text2 = ""; 17368 var $html = $("<div>" + html + "</div>"); 17369 if (html.match(/<\/div>/)) { 17370 stdout = $html.find("div[data-index]").map(function() { 17371 return process_div(this); 17372 }).get().join(` 17373`); 17374 if (!stdout && html.match(/style="width: 100%;?"/)) { 17375 stdout = process_div($html); 17376 } 17377 text2 = stdout; 17378 } 17379 var $prompt = $html.find(".cmd-prompt"); 17380 if ($prompt.length) { 17381 if (text2.length) { 17382 text2 += ` 17383`; 17384 } 17385 text2 += $prompt.text(); 17386 } 17387 var $cmd_lines = $html.find('[role="presentation"]'); 17388 if ($cmd_lines.length) { 17389 text2 += $cmd_lines.map(process_selected_line).get().join(""); 17390 } 17391 if (!text2.length && html) { 17392 text2 = $html.text(); 17393 } 17394 return text2.replace(/\xA0/g, " "); 17395 } 17396 var support_copy = function() { 17397 if (typeof document === "undefined") { 17398 return false; 17399 } 17400 if (!is_function(document.queryCommandSupported)) { 17401 return false; 17402 } 17403 return document.queryCommandSupported("copy"); 17404 }(); 17405 var text_to_clipboard; 17406 if (support_copy) { 17407 text_to_clipboard = function text_to_clipboard2($textarea, text2) { 17408 var val = $textarea.val(); 17409 var had_focus = $textarea.is(":focus"); 17410 var pos = $textarea.caret(); 17411 if (window.navigator && window.navigator.clipboard) { 17412 navigator.clipboard.writeText(text2); 17413 } else if (had_focus) { 17414 $textarea.val(text2).focus(); 17415 $textarea[0].select(); 17416 document.execCommand("copy"); 17417 $textarea.val(val); 17418 $textarea.caret(pos); 17419 } else { 17420 var $text = $("<textarea/>").css({ 17421 position: "fixed", 17422 top: 0, 17423 left: 0 17424 }).appendTo("body"); 17425 $text.val(text2).focus(); 17426 $text[0].select(); 17427 document.execCommand("copy"); 17428 $text.blur(); 17429 $text.remove(); 17430 } 17431 return true; 17432 }; 17433 } else { 17434 text_to_clipboard = $.noop; 17435 } 17436 var get_textarea_selection = function() { 17437 function noop() { 17438 return ""; 17439 } 17440 if (typeof document === "undefined") { 17441 return noop; 17442 } 17443 var textarea = document.createElement("textarea"); 17444 var selectionStart = "selectionStart" in textarea; 17445 textarea = null; 17446 if (selectionStart) { 17447 return function(textarea) { 17448 var length = textarea.selectionEnd - textarea.selectionStart; 17449 return textarea.value.substr(textarea.selectionStart, length); 17450 }; 17451 } else if (document.selection) { 17452 return function() { 17453 var range = document.selection.createRange(); 17454 return range.text(); 17455 }; 17456 } else { 17457 return noop; 17458 } 17459 }(); 17460 function clear_textarea_selection(textarea) { 17461 textarea.selectionStart = textarea.selectionEnd = 0; 17462 } 17463 function common_string(string2, array, matchCase) { 17464 if (!array.length) { 17465 return ""; 17466 } 17467 var type = string_case(string2); 17468 var result = []; 17469 for (var j = string2.length;j < array[0].length; ++j) { 17470 var push = false; 17471 var candidate = array[0].charAt(j), candidateLower = candidate.toLowerCase(); 17472 for (var i = 1;i < array.length; ++i) { 17473 push = true; 17474 var current = array[i].charAt(j), currentLower = current.toLowerCase(); 17475 if (candidate !== current) { 17476 if (matchCase || type === "mixed") { 17477 push = false; 17478 break; 17479 } else if (candidateLower === currentLower) { 17480 if (type === "lower") { 17481 candidate = candidate.toLowerCase(); 17482 } else if (type === "upper") { 17483 candidate = candidate.toUpperCase(); 17484 } else { 17485 push = false; 17486 break; 17487 } 17488 } else { 17489 push = false; 17490 break; 17491 } 17492 } 17493 } 17494 if (push) { 17495 result.push(candidate); 17496 } else { 17497 break; 17498 } 17499 } 17500 return string2 + result.join(""); 17501 } 17502 function trigger_terminal_change(next) { 17503 terminals.forEach(function(term2) { 17504 term2.settings().onTerminalChange.call(term2, next); 17505 }); 17506 } 17507 var select = function() { 17508 if (root.getSelection) { 17509 var selection = root.getSelection(); 17510 if (selection.setBaseAndExtent) { 17511 return function(start, end) { 17512 var selection = root.getSelection(); 17513 selection.setBaseAndExtent(start, 0, end, 1); 17514 }; 17515 } else { 17516 return function(start, end) { 17517 var selection = root.getSelection(); 17518 var range = document.createRange(); 17519 range.setStart(start, 0); 17520 range.setEnd(end, end.childNodes.length); 17521 selection.removeAllRanges(); 17522 selection.addRange(range); 17523 }; 17524 } 17525 } else { 17526 return $.noop; 17527 } 17528 }(); 17529 function process_command(original, fn2) { 17530 var string2 = original.trim(); 17531 var array = string2.match(command_re) || []; 17532 if (array.length) { 17533 var name = array.shift(); 17534 var args2 = $.map(array, function(arg) { 17535 if (arg.match(/^["']/)) { 17536 arg = arg.replace(/\n/g, "\\u0000\\u0000\\u0000\\u0000"); 17537 arg = fn2(arg); 17538 return arg.replace(/\x00\x00\x00\x00/g, ` 17539`); 17540 } 17541 return fn2(arg); 17542 }); 17543 var quotes = $.map(array, function(arg) { 17544 var m2 = arg.match(/^(['"`]).*\1$/); 17545 return m2 && m2[1] || ""; 17546 }); 17547 var rest = string2.slice(name.length).trim(); 17548 return { 17549 command: original, 17550 name, 17551 args: args2, 17552 args_quotes: quotes, 17553 rest 17554 }; 17555 } else { 17556 return { 17557 command: original, 17558 name: "", 17559 args: [], 17560 args_quotes: [], 17561 rest: "" 17562 }; 17563 } 17564 } 17565 function on_height_change(callback) { 17566 var scale = window.visualViewport.scale; 17567 var height = Math.round(window.visualViewport.height * scale); 17568 callback(height); 17569 window.visualViewport.addEventListener("resize", function() { 17570 var new_scale = window.visualViewport.scale; 17571 var new_height = Math.round(window.visualViewport.height * new_scale); 17572 if (height !== new_height) { 17573 height = new_height; 17574 callback(height); 17575 } 17576 }); 17577 } 17578 $.terminal = { 17579 version: "2.45.2", 17580 date: "Mon, 21 Jul 2025 22:45:43 +0000", 17581 color_names: [ 17582 "transparent", 17583 "currentcolor", 17584 "black", 17585 "silver", 17586 "gray", 17587 "white", 17588 "maroon", 17589 "red", 17590 "purple", 17591 "fuchsia", 17592 "green", 17593 "lime", 17594 "olive", 17595 "yellow", 17596 "navy", 17597 "blue", 17598 "teal", 17599 "aqua", 17600 "aliceblue", 17601 "antiquewhite", 17602 "aqua", 17603 "aquamarine", 17604 "azure", 17605 "beige", 17606 "bisque", 17607 "black", 17608 "blanchedalmond", 17609 "blue", 17610 "blueviolet", 17611 "brown", 17612 "burlywood", 17613 "cadetblue", 17614 "chartreuse", 17615 "chocolate", 17616 "coral", 17617 "cornflowerblue", 17618 "cornsilk", 17619 "crimson", 17620 "cyan", 17621 "darkblue", 17622 "darkcyan", 17623 "darkgoldenrod", 17624 "darkgray", 17625 "darkgreen", 17626 "darkgrey", 17627 "darkkhaki", 17628 "darkmagenta", 17629 "darkolivegreen", 17630 "darkorange", 17631 "darkorchid", 17632 "darkred", 17633 "darksalmon", 17634 "darkseagreen", 17635 "darkslateblue", 17636 "darkslategray", 17637 "darkslategrey", 17638 "darkturquoise", 17639 "darkviolet", 17640 "deeppink", 17641 "deepskyblue", 17642 "dimgray", 17643 "dimgrey", 17644 "dodgerblue", 17645 "firebrick", 17646 "floralwhite", 17647 "forestgreen", 17648 "fuchsia", 17649 "gainsboro", 17650 "ghostwhite", 17651 "gold", 17652 "goldenrod", 17653 "gray", 17654 "green", 17655 "greenyellow", 17656 "grey", 17657 "honeydew", 17658 "hotpink", 17659 "indianred", 17660 "indigo", 17661 "ivory", 17662 "khaki", 17663 "lavender", 17664 "lavenderblush", 17665 "lawngreen", 17666 "lemonchiffon", 17667 "lightblue", 17668 "lightcoral", 17669 "lightcyan", 17670 "lightgoldenrodyellow", 17671 "lightgray", 17672 "lightgreen", 17673 "lightgrey", 17674 "lightpink", 17675 "lightsalmon", 17676 "lightseagreen", 17677 "lightskyblue", 17678 "lightslategray", 17679 "lightslategrey", 17680 "lightsteelblue", 17681 "lightyellow", 17682 "lime", 17683 "limegreen", 17684 "linen", 17685 "magenta", 17686 "maroon", 17687 "mediumaquamarine", 17688 "mediumblue", 17689 "mediumorchid", 17690 "mediumpurple", 17691 "mediumseagreen", 17692 "mediumslateblue", 17693 "mediumspringgreen", 17694 "mediumturquoise", 17695 "mediumvioletred", 17696 "midnightblue", 17697 "mintcream", 17698 "mistyrose", 17699 "moccasin", 17700 "navajowhite", 17701 "navy", 17702 "oldlace", 17703 "olive", 17704 "olivedrab", 17705 "orange", 17706 "orangered", 17707 "orchid", 17708 "palegoldenrod", 17709 "palegreen", 17710 "paleturquoise", 17711 "palevioletred", 17712 "papayawhip", 17713 "peachpuff", 17714 "peru", 17715 "pink", 17716 "plum", 17717 "powderblue", 17718 "purple", 17719 "red", 17720 "rosybrown", 17721 "royalblue", 17722 "saddlebrown", 17723 "salmon", 17724 "sandybrown", 17725 "seagreen", 17726 "seashell", 17727 "sienna", 17728 "silver", 17729 "skyblue", 17730 "slateblue", 17731 "slategray", 17732 "slategrey", 17733 "snow", 17734 "springgreen", 17735 "steelblue", 17736 "tan", 17737 "teal", 17738 "thistle", 17739 "tomato", 17740 "turquoise", 17741 "violet", 17742 "wheat", 17743 "white", 17744 "whitesmoke", 17745 "yellow", 17746 "yellowgreen", 17747 "rebeccapurple" 17748 ], 17749 Cycle, 17750 History, 17751 Stack, 17752 EventEmitter, 17753 valid_color: function valid_color(color) { 17754 if (color.match(color_re)) { 17755 return true; 17756 } else { 17757 return $.inArray(color.toLowerCase(), $.terminal.color_names) !== -1; 17758 } 17759 }, 17760 unclosed_strings: function unclosed_strings(string2) { 17761 return !!string2.match(unclosed_strings_re); 17762 }, 17763 escape_regex: function escape_regex(str) { 17764 if (typeof str === "string") { 17765 var special = /([-\\^$[\]()+{}?*.|])/g; 17766 return str.replace(special, "\\$1"); 17767 } 17768 }, 17769 have_formatting: function have_formatting(str) { 17770 return typeof str === "string" && !!str.match(format_exist_re); 17771 }, 17772 is_formatting: function is_formatting(str) { 17773 return typeof str === "string" && !!str.match(format_full_re); 17774 }, 17775 is_extended_command: function is_extended_command(str) { 17776 return typeof str === "string" && str.match(format_exec_re) && !$.terminal.is_formatting(str); 17777 }, 17778 each_extended_command: function(string2, fn2) { 17779 var parts = string2.split(format_exec_split_re); 17780 return $.map(parts, function(string2) { 17781 if ($.terminal.is_extended_command(string2)) { 17782 var command = string2.replace(/^\[\[|\]\]$/g, ""); 17783 return fn2(command) || ""; 17784 } 17785 return string2; 17786 }).join(""); 17787 }, 17788 format_split: function format_split(str) { 17789 return str.split(format_split_re).filter(Boolean); 17790 }, 17791 tracking_replace: function tracking_replace(string2, rex, replacement, position) { 17792 if (!(rex instanceof RegExp)) { 17793 throw new Error("tracking_replace: Second argument need to be RegExp"); 17794 } 17795 function substring(string2, start, end) { 17796 return string2.slice(start, end); 17797 } 17798 function length(string2) { 17799 return $.terminal.strip(string2).length; 17800 } 17801 var new_string = ""; 17802 var match; 17803 var index = 0; 17804 var rep_string; 17805 var new_position = position; 17806 var start; 17807 rex.lastIndex = 0; 17808 while (match = rex.exec(string2)) { 17809 if (rex.global) { 17810 var last_index = length(substring(string2, 0, rex.lastIndex)); 17811 start = last_index - length(match[0]); 17812 } else { 17813 start = match.index; 17814 last_index = start + length(match[0]); 17815 } 17816 if (index < start) { 17817 new_string += substring(string2, index, start); 17818 } 17819 index = last_index; 17820 if (typeof replacement === "function") { 17821 rep_string = replacement.apply(null, match); 17822 } else { 17823 rep_string = replacement.replace(/\$(\$|\d)/g, function(m2, c0) { 17824 if (c0 === "$") { 17825 return "$"; 17826 } 17827 return match[c0]; 17828 }); 17829 } 17830 new_string += rep_string; 17831 if (start < position) { 17832 var rep_len = length(rep_string); 17833 rep_len += count_selfclosing_formatting(rep_string); 17834 if (last_index < position) { 17835 new_position = Math.max(0, new_position + rep_len - length(match[0])); 17836 } else { 17837 new_position += rep_len - (position - start); 17838 } 17839 } 17840 if (!rex.global) { 17841 break; 17842 } 17843 } 17844 if (index < length(string2)) { 17845 new_string += substring(string2, index); 17846 } 17847 if (string2 === new_string) { 17848 return [string2, position]; 17849 } 17850 return [new_string, new_position]; 17851 }, 17852 iterate_formatting: function iterate_formatting(string2, callback) { 17853 function is_any_space(str) { 17854 return str === " " || str === "\t" || str === ` 17855`; 17856 } 17857 function is_space(i) { 17858 if (!have_entities) { 17859 return is_any_space(string2[i - 1]); 17860 } 17861 return string2.slice(i - 6, i) === " " || is_any_space(string2[i - 1]); 17862 } 17863 function match_entity(index) { 17864 if (!have_entities) { 17865 return null; 17866 } 17867 return string2.slice(index).match(entity_re); 17868 } 17869 function is_open_formatting(i) { 17870 return string2[i] === "[" && string2[i + 1] === "["; 17871 } 17872 function is_escape_bracket(i) { 17873 return string2[i - 1] !== "\\" && string2[i] === "\\" && string2[i + 1] === "]"; 17874 } 17875 function is_bracket(i) { 17876 return string2[i] === "]" || string2[i] === "["; 17877 } 17878 function is_text(i) { 17879 return not_formatting && !opening && (string2[i] !== "]" && !closing_formatting || !have_formatting) || in_text && !formatting; 17880 } 17881 var get_next_character2 = make_next_char_fun(string2); 17882 function next_iteration() { 17883 var char = get_next_character2(substring); 17884 if (char.length > 1 && $.terminal.length(substring) > 1) { 17885 return char.length - 1; 17886 } 17887 return 0; 17888 } 17889 function is_next_space() { 17890 return is_space(i) && (not_formatting || opening) && (space === -1 && prev_space !== i || space !== -1); 17891 } 17892 var last = false; 17893 function is_last() { 17894 if (i === string2.length - 1 && !last) { 17895 last = true; 17896 } else { 17897 last = formatting && !!substring.match(/^.]$/); 17898 } 17899 return last; 17900 } 17901 var have_formatting = $.terminal.have_formatting(string2); 17902 var have_entities = entity_re.test(string2); 17903 var formatting = ""; 17904 var in_text = false; 17905 var count = 0; 17906 var match; 17907 var space = -1; 17908 var space_count = -1; 17909 var prev_space; 17910 var length = 0; 17911 var offset = 0; 17912 var re_ent = /(&[^;]+);$/; 17913 for (var i = 0;i < string2.length; i++) { 17914 var substring = string2.slice(i); 17915 var closing_formatting = false; 17916 match = substring.match(format_start_re); 17917 if (match) { 17918 formatting = match[1]; 17919 in_text = false; 17920 } else if (formatting) { 17921 if (string2[i] === "]") { 17922 closing_formatting = in_text; 17923 if (in_text) { 17924 formatting = ""; 17925 in_text = false; 17926 } else { 17927 in_text = true; 17928 } 17929 } 17930 } else { 17931 in_text = true; 17932 } 17933 var not_formatting = formatting && in_text || !formatting; 17934 var opening = is_open_formatting(i); 17935 if (is_next_space()) { 17936 space = i; 17937 space_count = count; 17938 } 17939 var braket = is_bracket(i); 17940 offset = 0; 17941 if (not_formatting) { 17942 if (string2[i] === "&") { 17943 match = match_entity(i); 17944 if (match) { 17945 i += match[1].length - 2; 17946 continue; 17947 } 17948 ++count; 17949 ++length; 17950 } else if (is_escape_bracket(i)) { 17951 ++count; 17952 ++length; 17953 offset = 1; 17954 i += 1; 17955 } else if (!braket || !have_formatting || in_text && !formatting) { 17956 ++count; 17957 ++length; 17958 } 17959 } 17960 if (is_text(i)) { 17961 if (strlen(string2[i]) === 2) { 17962 length++; 17963 } 17964 var char = get_next_character2(substring); 17965 var size = char.length; 17966 if (char === ";") { 17967 match = string2.slice(0, i + 1).match(re_ent); 17968 if (match) { 17969 offset = match[1].length; 17970 size = offset + 1; 17971 } 17972 } 17973 var data = { 17974 last: is_last(), 17975 count, 17976 index: i - offset, 17977 formatting, 17978 length, 17979 text: in_text, 17980 size, 17981 space, 17982 space_count 17983 }; 17984 var ret2 = callback(data); 17985 if (ret2 === false) { 17986 break; 17987 } else if (ret2) { 17988 if (ret2.count !== undefined) { 17989 count = ret2.count; 17990 } 17991 if (ret2.length !== undefined) { 17992 length = ret2.length; 17993 } 17994 if (ret2.space !== undefined) { 17995 prev_space = space; 17996 space = ret2.space; 17997 } 17998 if (ret2.index !== undefined) { 17999 i = ret2.index; 18000 continue; 18001 } 18002 } 18003 } else if (i === string2.length - 1 && !last) { 18004 callback({ 18005 last: true, 18006 count: count + 1, 18007 index: i, 18008 formatting, 18009 length: 0, 18010 text: in_text, 18011 space 18012 }); 18013 } 18014 if (in_text) { 18015 i += next_iteration(); 18016 } 18017 } 18018 }, 18019 partition: function partition(string2, options2) { 18020 var settings2 = $.extend({ 18021 wrap: true 18022 }, options2); 18023 if (!$.terminal.have_formatting(string2)) { 18024 var chars = $.terminal.split_characters(string2); 18025 return chars.map(wrap); 18026 } 18027 var result = []; 18028 function wrap(string2) { 18029 if (string2.match(/\\$/)) { 18030 string2 += "\\"; 18031 } 18032 return "[[;;]" + string2 + "]"; 18033 } 18034 function formatting(string2) { 18035 if ($.terminal.is_formatting(string2)) { 18036 if (string2.match(/\\]$/)) { 18037 string2 = string2.replace(/\\]/g, "\\\\]"); 18038 } 18039 } else if (settings2.wrap) { 18040 string2 = wrap(string2); 18041 } 18042 return string2; 18043 } 18044 $.terminal.iterate_formatting(string2, function callback(data) { 18045 if (data.text) { 18046 var text2 = []; 18047 if (data.formatting) { 18048 text2.push(data.formatting); 18049 } 18050 text2.push(string2.substring(data.index, data.index + data.size)); 18051 if (data.formatting) { 18052 text2.push("]"); 18053 } 18054 result.push(formatting(text2.join(""))); 18055 } 18056 }); 18057 return result; 18058 }, 18059 substring: function substring(string2, start_index, end_index) { 18060 var chars = $.terminal.split_characters(string2); 18061 if (!chars.slice(start_index, end_index).length) { 18062 return ""; 18063 } 18064 if (!$.terminal.have_formatting(string2)) { 18065 return chars.slice(start_index, end_index).join(""); 18066 } 18067 var start = 0; 18068 var end; 18069 var start_formatting = ""; 18070 var end_formatting = ""; 18071 var prev_index; 18072 var offset = 1; 18073 $.terminal.iterate_formatting(string2, function callback(data) { 18074 if (start_index && data.count === start_index + 1) { 18075 start = data.index; 18076 if (data.formatting) { 18077 start_formatting = data.formatting; 18078 } 18079 } 18080 if (end_index && data.count === end_index) { 18081 end_formatting = data.formatting; 18082 prev_index = data.index; 18083 offset = data.size; 18084 } 18085 if (data.count === end_index + 1) { 18086 end = data.index; 18087 if (data.formatting) { 18088 end = prev_index + offset; 18089 } 18090 } 18091 }); 18092 if (start_index && !start) { 18093 return ""; 18094 } 18095 if (end === undefined) { 18096 end = string2.length; 18097 } 18098 string2 = start_formatting + string2.slice(start, end); 18099 if (end_formatting) { 18100 string2 = string2.replace(/(\[\[[^\]]+)?\]$/, ""); 18101 string2 += "]"; 18102 } 18103 return string2; 18104 }, 18105 normalize: function normalize(str) { 18106 str = str.replace(format_re, function callback(_, format, text2) { 18107 if (format.match(self_closing_re) && text2 === "") { 18108 return "[[" + format + "] ]"; 18109 } 18110 if (text2 === "") { 18111 return ""; 18112 } 18113 function safe2(str) { 18114 return str.replace(/\\\]/g, "]").replace(/\n/g, "\\n").replace(/ /g, " "); 18115 } 18116 format = safe2(format); 18117 var semicolons = format.match(/;/g).length; 18118 if (semicolons >= 4) { 18119 var args2 = format.split(/;/); 18120 var start = args2.slice(0, 4).join(";"); 18121 var arg = args2.slice(4).join(";"); 18122 return "[[" + start + ";" + (arg || text2) + "]" + text2 + "]"; 18123 } else if (semicolons === 2) { 18124 semicolons = ";;"; 18125 } else if (semicolons === 3) { 18126 semicolons = ";"; 18127 } 18128 format += semicolons + safe2(text2); 18129 return "[[" + format + "]" + text2 + "]"; 18130 }); 18131 return $.terminal.amp(str); 18132 }, 18133 split_equal: function split_equal(str, length, options2) { 18134 if (typeof options2 === "boolean") { 18135 options2 = { 18136 keepWords: options2 18137 }; 18138 } 18139 var settings2 = $.extend({ 18140 trim: false, 18141 keepWords: false 18142 }, options2); 18143 var prev_format = ""; 18144 var result = []; 18145 var array = $.terminal.normalize(str).split(/\n/g); 18146 var have_formatting = $.terminal.have_formatting(str); 18147 for (var i = 0, len = array.length;i < len; ++i) { 18148 if (array[i] === "") { 18149 result.push(""); 18150 continue; 18151 } 18152 var line = array[i]; 18153 var get_next_character2 = make_next_char_fun(line); 18154 var first_index = 0; 18155 var output; 18156 var line_length = line.length; 18157 var last_bracket = /\[\[[^\]]+\](?:[^\][]|\\\])+\]$/.test(line); 18158 var leading_spaces = /^( |\s)/.test(line); 18159 if (!have_formatting && line_length < length) { 18160 result.push(line); 18161 continue; 18162 } 18163 $.terminal.iterate_formatting(line, function callback(data) { 18164 var chr, substring; 18165 if (data.length >= length || data.last || data.length === length - 1 && strlen(line[data.index + 1]) === 2) { 18166 var can_break = false; 18167 if (settings2.keepWords && data.space !== -1) { 18168 var stripped = text(line).substring(data.space_count); 18169 stripped = stripped.slice(0, length).replace(/\s+$/, ""); 18170 var text_len = strlen(stripped); 18171 if (space_re.test(stripped) || text_len < length) { 18172 can_break = true; 18173 } 18174 } 18175 var after_index = data.index + data.size; 18176 if (last_bracket) { 18177 after_index += 1; 18178 } 18179 var new_index; 18180 if (settings2.keepWords && data.space !== -1 && after_index !== line_length && can_break) { 18181 output = line.slice(first_index, data.space); 18182 new_index = data.space - 1; 18183 } else { 18184 substring = line.slice(data.index); 18185 chr = get_next_character2(substring); 18186 output = line.slice(first_index, data.index) + chr; 18187 if (data.last && last_bracket && chr !== "]") { 18188 output += "]"; 18189 } 18190 new_index = data.index + chr.length - 1; 18191 } 18192 if (settings2.trim || settings2.keepWords) { 18193 output = output.replace(/( |\s)+$/g, ""); 18194 } 18195 if (!leading_spaces && !prev_format) { 18196 output = output.replace(/^( |\s)+/g, ""); 18197 } 18198 first_index = (new_index || data.index) + 1; 18199 if (prev_format) { 18200 var closed_formatting = /^[^\]]*\]/.test(output); 18201 output = prev_format + output; 18202 if (closed_formatting) { 18203 prev_format = ""; 18204 } 18205 } 18206 var matched = output.match(format_re); 18207 if (matched) { 18208 var last = matched[matched.length - 1]; 18209 if (last[last.length - 1] !== "]") { 18210 prev_format = last.match(format_begin_re)[1]; 18211 output += "]"; 18212 } else if (format_end_re.test(output)) { 18213 output = output.replace(format_end_re, ""); 18214 prev_format = last.match(format_begin_re)[1]; 18215 } 18216 } 18217 result.push(output); 18218 return { index: new_index, length: 0, space: -1 }; 18219 } 18220 }); 18221 } 18222 return result; 18223 }, 18224 amp, 18225 encode: function encode(str, options2) { 18226 var settings2 = $.extend({ 18227 tabs: 4, 18228 before: "" 18229 }, options2); 18230 return safe(str).replace(/ /g, " ").split(` 18231`).map(function(line) { 18232 var splitted = line.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/); 18233 splitted = splitted.filter(Boolean); 18234 return splitted.map(function(str, i) { 18235 if (str.match(/\t/)) { 18236 return str.replace(/\t([^\t]*)$/, function(_, end) { 18237 if (i !== 0 && splitted[i - 1].match(/\t\]?$/)) { 18238 var sp = new Array(settings2.tabs + 1).join(" "); 18239 return sp + end; 18240 } else { 18241 var before = splitted.slice(i - 1, i).join(""); 18242 if (settings2.before && i <= 1) { 18243 before = settings2.before + before; 18244 } 18245 var len = $.terminal.length(before); 18246 var chars = settings2.tabs - len % settings2.tabs; 18247 if (chars === 0) { 18248 chars = 4; 18249 } 18250 return new Array(chars + 1).join(" ") + end; 18251 } 18252 }); 18253 } 18254 return str; 18255 }).join(""); 18256 }).join(` 18257`); 18258 }, 18259 nested_formatting: function nested_formatting(string2) { 18260 if (!$.terminal.have_formatting(string2)) { 18261 return string2; 18262 } 18263 var stack = []; 18264 var re = /((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/; 18265 var format_re2 = /\[\[([^\][]+)\][\s\S]*/; 18266 var format_split_re2 = /^\[\[([^;]*);([^;]*);([^\]]*)\]/; 18267 var class_i = 3; 18268 var attrs_i = 5; 18269 function unique(value, index, self2) { 18270 return self2.indexOf(value) === index; 18271 } 18272 function update_style(new_style, old_style) { 18273 new_style = parse_style(new_style); 18274 if (!old_style) { 18275 return new_style; 18276 } 18277 return $.extend(old_style, new_style); 18278 } 18279 function parse_style(string2) { 18280 var style = {}; 18281 string2.split(/\s*;\s*/).forEach(function(string2) { 18282 var parts = string2.split(":").map(function(string2) { 18283 return string2.trim(); 18284 }); 18285 var prop = parts[0]; 18286 var value = parts[1]; 18287 style[prop] = value; 18288 }); 18289 return style; 18290 } 18291 function stringify_formatting(input) { 18292 var result = input.slice(); 18293 if (input[attrs_i]) { 18294 result[attrs_i] = stringify_attrs(input[attrs_i]); 18295 } 18296 if (input[class_i]) { 18297 result[class_i] = stringify_class(input[class_i]); 18298 } 18299 result[0] = stringify_styles(input[0]); 18300 return result.join(";"); 18301 } 18302 function stringify_styles(input) { 18303 var ignore = input.filter(function(s) { 18304 return s[0] === "-"; 18305 }).map(function(s) { 18306 return s[1]; 18307 }); 18308 return input.filter(function(s) { 18309 return ignore.indexOf(s) === -1 && ignore.indexOf(s[1]) === -1; 18310 }).join(""); 18311 } 18312 function stringify_attrs(attrs) { 18313 return JSON.stringify(attrs, function(key, value) { 18314 if (key === "style") { 18315 return stringify_style(value); 18316 } 18317 return value; 18318 }); 18319 } 18320 function stringify_class(klass) { 18321 return klass.filter(unique).join(" "); 18322 } 18323 function stringify_style(style) { 18324 return Object.keys(style).map(function(prop) { 18325 return prop + ":" + style[prop]; 18326 }).join(";"); 18327 } 18328 function get_inherit_style(stack) { 18329 function update_attrs(value) { 18330 if (!output[attrs_i]) { 18331 output[attrs_i] = {}; 18332 } 18333 try { 18334 var new_attrs = JSON.parse(value); 18335 if (new_attrs.style) { 18336 var new_style = new_attrs.style; 18337 var old_style = output[attrs_i].style; 18338 new_attrs.style = update_style(new_style, old_style); 18339 output[attrs_i] = $.extend(new_attrs, output[attrs_i], { 18340 style: update_style(new_style, old_style) 18341 }); 18342 } else { 18343 output[attrs_i] = $.extend(new_attrs, output[attrs_i]); 18344 } 18345 } catch (e) { 18346 warn("Invalid JSON " + value); 18347 } 18348 } 18349 var output = [[], "", ""]; 18350 if (!stack.length) { 18351 return output; 18352 } 18353 for (var i = stack.length;i--; ) { 18354 var formatting = $.terminal.parse_formatting(stack[i]); 18355 if (formatting.length > 5) { 18356 var last = formatting.slice(5).join(";"); 18357 formatting = formatting.slice(0, 5).concat(last); 18358 } 18359 var style = formatting[0].split(/(-?[@!gbiusor])/g).filter(Boolean); 18360 style.forEach(function(s) { 18361 if (output[0].indexOf(s) === -1) { 18362 output[0].push(s); 18363 } 18364 }); 18365 for (var j = 1;j < formatting.length; ++j) { 18366 var value = formatting[j].trim(); 18367 if (value) { 18368 if (j === class_i) { 18369 if (!output[class_i]) { 18370 output[class_i] = []; 18371 } 18372 var classes = value.split(/\s+/); 18373 output[class_i] = output[class_i].concat(classes); 18374 } else if (j === attrs_i) { 18375 update_attrs(value); 18376 } else if (!output[j]) { 18377 output[j] = value; 18378 } 18379 } 18380 } 18381 } 18382 return stringify_formatting(output); 18383 } 18384 return string2.split(re).filter(Boolean).map(function(string2) { 18385 var style; 18386 if (string2.match(/^\[\[/) && !$.terminal.is_extended_command(string2)) { 18387 var formatting = string2.replace(format_re2, "$1"); 18388 var is_formatting = $.terminal.is_formatting(string2); 18389 string2 = string2.replace(format_split_re2, ""); 18390 stack.push(formatting); 18391 if ($.terminal.nested_formatting.__inherit__) { 18392 style = get_inherit_style(stack); 18393 } else { 18394 style = formatting; 18395 } 18396 if (!is_formatting) { 18397 string2 += "]"; 18398 } else { 18399 stack.pop(); 18400 } 18401 string2 = "[[" + style + "]" + string2; 18402 } else { 18403 var pop = false; 18404 if (string2.match(/\]/)) { 18405 pop = true; 18406 } 18407 if (stack.length) { 18408 if ($.terminal.nested_formatting.__inherit__) { 18409 style = get_inherit_style(stack); 18410 } else { 18411 style = stack[stack.length - 1]; 18412 } 18413 string2 = "[[" + style + "]" + string2; 18414 } 18415 if (pop) { 18416 stack.pop(); 18417 } else if (stack.length) { 18418 string2 += "]"; 18419 } 18420 } 18421 return string2; 18422 }).join(""); 18423 }, 18424 using_xml_formatter: function using_xml_formatter() { 18425 if (!("xml_formatter" in $.terminal)) { 18426 return false; 18427 } 18428 var formatters = $.terminal.defaults.formatters; 18429 return formatters.includes($.terminal.xml_formatter); 18430 }, 18431 escape_formatting: function escape_formatting(string2) { 18432 var result = $.terminal.escape_brackets(string2); 18433 if ($.terminal.using_xml_formatter()) { 18434 result = safe(result); 18435 } 18436 return result; 18437 }, 18438 apply_formatters: function apply_formatters(string2, settings2) { 18439 if (string2 === "") { 18440 if (settings2 && typeof settings2.position === "number") { 18441 return ["", settings2.position]; 18442 } else { 18443 return ""; 18444 } 18445 } 18446 function test_lengths(formatter, index, ret2, string2) { 18447 if (!formatter.__no_warn__ && $.terminal.length(ret2) !== $.terminal.length(string2)) { 18448 warn("Your formatter[" + index + "] change length of the string, " + "you should use [regex, replacement] formatter or function " + " that return [replacement, position] instead"); 18449 } 18450 } 18451 function should_format(options2) { 18452 if (!settings2 || !options2) { 18453 return true; 18454 } 18455 var props = ["echo", "command", "prompt"]; 18456 var have_any = props.some(function(name) { 18457 return options2[name] === true; 18458 }); 18459 if (!have_any) { 18460 return true; 18461 } 18462 for (var i = props.length;i--; ) { 18463 var prop = props[i]; 18464 if (options2[prop] === true && settings2[prop] === true) { 18465 return true; 18466 } 18467 } 18468 return false; 18469 } 18470 settings2 = settings2 || {}; 18471 var formatters = settings2.formatters || $.terminal.defaults.formatters; 18472 var i = 0; 18473 function apply_function_formatter(formatter, input) { 18474 var options2 = $.extend({}, settings2, { 18475 position: input[1] 18476 }); 18477 var ret2 = formatter(input[0], options2); 18478 if (typeof ret2 === "string") { 18479 test_lengths(formatter, i - 1, ret2, input[0]); 18480 return [ret2, options2.position]; 18481 } else if (is_array(ret2) && ret2.length === 2) { 18482 return ret2; 18483 } else { 18484 return input; 18485 } 18486 } 18487 var input; 18488 if (typeof settings2.position === "number") { 18489 input = [string2, settings2.position]; 18490 } else { 18491 input = [string2, 0]; 18492 } 18493 try { 18494 var result = formatters.reduce(function(input, formatter) { 18495 i++; 18496 if (typeof formatter === "function" && formatter.__meta__) { 18497 return apply_function_formatter(formatter, input); 18498 } else { 18499 var length = 0; 18500 var found_position = false; 18501 var splitted = $.terminal.format_split(input[0]); 18502 var partials = splitted.map(function(string2) { 18503 var position; 18504 var this_len = text(string2).length; 18505 if (input[1] < length + this_len && !found_position) { 18506 position = input[1] - length; 18507 found_position = true; 18508 } else if (found_position) { 18509 position = -1; 18510 } else { 18511 position = input[1]; 18512 } 18513 var length_before = length; 18514 var result; 18515 length += this_len; 18516 if ($.terminal.is_formatting(string2)) { 18517 if (found_position) { 18518 return [string2, position]; 18519 } 18520 return [string2, -1]; 18521 } else { 18522 if (is_array(formatter)) { 18523 var options2 = formatter[2] || {}; 18524 result = [string2, position < 0 ? 0 : position]; 18525 if (result[0].match(formatter[0]) && should_format(formatter[2])) { 18526 if (options2.loop) { 18527 while (result[0].match(formatter[0])) { 18528 result = $.terminal.tracking_replace(result[0], formatter[0], formatter[1], result[1]); 18529 } 18530 } else { 18531 result = $.terminal.tracking_replace(result[0], formatter[0], formatter[1], result[1]); 18532 } 18533 } 18534 if (position < 0) { 18535 return [result[0], -1]; 18536 } 18537 } else if (typeof formatter === "function") { 18538 result = apply_function_formatter(formatter, [ 18539 string2, 18540 position 18541 ]); 18542 } 18543 if (typeof result !== "undefined") { 18544 if (result[1] !== -1) { 18545 result[1] += length_before; 18546 } 18547 var after_len = text(result[0]).length; 18548 if (after_len !== this_len) {} 18549 return result; 18550 } 18551 return [string2, -1]; 18552 } 18553 }); 18554 var position_partial = partials.filter(function(partial) { 18555 return partial[1] !== -1; 18556 })[0]; 18557 var string2 = partials.map(function(partial) { 18558 return partial[0]; 18559 }).join(""); 18560 var position; 18561 if (typeof position_partial === "undefined") { 18562 position = input[1]; 18563 } else { 18564 position = position_partial[1]; 18565 } 18566 var max = text(string2).length; 18567 max += count_selfclosing_formatting(string2); 18568 if (position > max) { 18569 position = max; 18570 } 18571 if (string2 === input[0]) { 18572 return input; 18573 } 18574 var before = $.terminal.strip(input[0]); 18575 var after = $.terminal.strip(string2); 18576 if (before === after) { 18577 return [string2, input[1]]; 18578 } 18579 return [string2, position]; 18580 } 18581 }, input); 18582 if (typeof settings2.position === "number") { 18583 var codepoint_len = $.terminal.strip(result[0]).length; 18584 if ($.terminal.length(result[0]) < codepoint_len) { 18585 var position = result[1]; 18586 position = normalize_position(result[0], position); 18587 var max = $.terminal.length(result[0]); 18588 if (position > max) { 18589 position = max; 18590 } 18591 result[1] = position; 18592 } 18593 return result; 18594 } else { 18595 return result[0]; 18596 } 18597 } catch (e) { 18598 var msg = "Error in formatter [" + (i - 1) + "]"; 18599 formatters.splice(i - 1); 18600 throw new $.terminal.Exception("formatting", msg, e.stack); 18601 } 18602 }, 18603 escape_brackets: function escape_brackets(string2) { 18604 return string2.replace(/\[/g, "[").replace(/\]/g, "]").replace(/\\/g, "\"); 18605 }, 18606 unescape_brackets: function unescape_brackets(string2) { 18607 return string2.replace(/[/g, "[").replace(/]/g, "]").replace(/\/g, "\\"); 18608 }, 18609 length: function length(string2, raw) { 18610 if (!string2) { 18611 return 0; 18612 } 18613 return $.terminal.split_characters(raw ? string2 : text(string2)).length; 18614 }, 18615 split_characters: function split_characters(string2) { 18616 if (is_simple_text(string2)) { 18617 return string2.split(""); 18618 } 18619 var result = []; 18620 var get_next_character2 = make_next_char_fun(string2); 18621 while (string2.length) { 18622 var chr = get_next_character2(string2); 18623 string2 = string2.slice(chr.length); 18624 result.push(chr); 18625 } 18626 return result; 18627 }, 18628 columns: function columns(array, cols, space) { 18629 array = array.map(function(value) { 18630 if (typeof value !== "string") { 18631 return String(value); 18632 } 18633 return value; 18634 }); 18635 var no_formatting = array.map(function(value) { 18636 return $.terminal.strip(value); 18637 }); 18638 var lengths = no_formatting.map(function(string2) { 18639 return strlen(string2); 18640 }); 18641 if (typeof space === "undefined") { 18642 space = 4; 18643 } 18644 var length = Math.max.apply(null, lengths) + space; 18645 var column_limit = Math.floor(cols / length) - 1; 18646 if (column_limit < 1) { 18647 return array.join(` 18648`); 18649 } 18650 var lines = []; 18651 for (var i = 0, len = array.length;i < len; i += column_limit) { 18652 var line = array.slice(i, i + column_limit); 18653 var last = line.pop(); 18654 lines.push(line.reduce(function(acc, string2) { 18655 var stripped = $.terminal.strip(string2); 18656 var pad = new Array(length - stripped.length + 1).join(" "); 18657 acc.push(string2 + pad); 18658 return acc; 18659 }, []).join("") + last); 18660 } 18661 return lines.join(` 18662`); 18663 }, 18664 strip: function strip(str) { 18665 if (!$.terminal.have_formatting(str)) { 18666 return str; 18667 } 18668 return $.terminal.format_split(str).map(function(str) { 18669 if ($.terminal.is_formatting(str)) { 18670 str = str.replace(format_parts_re, "$6"); 18671 return str.replace(/\\([[\]])/g, function(whole, bracket) { 18672 return bracket; 18673 }); 18674 } 18675 return str; 18676 }).join(""); 18677 }, 18678 active: function active() { 18679 return terminals.front(); 18680 }, 18681 last_id: function last_id() { 18682 var len = terminals.length(); 18683 return len - 1; 18684 }, 18685 parse_argument: function parse_argument(arg, strict) { 18686 function parse_string(string2) { 18687 return string2.split(string_re).map(function(string2) { 18688 if (string2.match(/^['"`]/)) { 18689 if (string2 === '""' || string2 === "''" || string2 === "``") { 18690 return ""; 18691 } 18692 var quote = string2[0]; 18693 var re = new RegExp("(\\\\\\\\(?:\\\\\\\\)*)" + quote, "g"); 18694 string2 = string2.replace(re, "$1").replace(/^[`'"]|[`'"]$/g, ""); 18695 if (quote === "'") { 18696 string2 = string2.replace(/"/g, "\\\""); 18697 } 18698 } 18699 string2 = '"' + string2 + '"'; 18700 return JSON.parse(string2); 18701 }).join(""); 18702 } 18703 if (strict === false) { 18704 if (arg[0] === "'" && arg[arg.length - 1] === "'") { 18705 return arg.replace(/^'|'$/g, ""); 18706 } else if (arg[0] === "`" && arg[arg.length - 1] === "`") { 18707 return arg.replace(/^`|`$/g, ""); 18708 } else if (arg[0] === '"' && arg[arg.length - 1] === '"') { 18709 return arg.replace(/^"|"$/g, "").replace(/\\([" ])/g, "$1"); 18710 } else if (arg.match(/\/.*\/[gimy]*$/)) { 18711 return arg; 18712 } else if (arg.match(/['"`]]/)) { 18713 return parse_string(arg); 18714 } else { 18715 return arg.replace(/\\ /g, " "); 18716 } 18717 } 18718 if (arg === "true") { 18719 return true; 18720 } else if (arg === "false") { 18721 return false; 18722 } 18723 var regex = arg.match(re_re); 18724 if (regex) { 18725 return new RegExp(regex[1], regex[2]); 18726 } else if (arg.match(/['"`]/)) { 18727 return parse_string(arg); 18728 } else if (arg.match(/^-?[0-9]+n?$/)) { 18729 if (arg.match(/n$/)) { 18730 return BigInt(arg.replace(/n$/, "")); 18731 } 18732 return parseInt(arg, 10); 18733 } else if (arg.match(float_re)) { 18734 return parseFloat(arg); 18735 } else { 18736 return arg.replace(/\\(['"() ])/g, "$1"); 18737 } 18738 }, 18739 parse_arguments: function parse_arguments(string2) { 18740 return $.map(string2.match(command_re) || [], $.terminal.parse_argument); 18741 }, 18742 split_arguments: function split_arguments(string2) { 18743 return $.map(string2.match(command_re) || [], function(arg) { 18744 return $.terminal.parse_argument(arg, false); 18745 }); 18746 }, 18747 parse_command: function parse_command(string2) { 18748 return process_command(string2, $.terminal.parse_argument); 18749 }, 18750 split_command: function split_command(string2) { 18751 return process_command(string2, function(arg) { 18752 return $.terminal.parse_argument(arg, false); 18753 }); 18754 }, 18755 parse_options: function parse_options(arg, options2) { 18756 var settings2 = $.extend({}, { 18757 boolean: [] 18758 }, options2); 18759 if (typeof arg === "string") { 18760 return parse_options($.terminal.split_arguments(arg), options2); 18761 } 18762 var result = { 18763 _: [] 18764 }; 18765 function token(value) { 18766 this.value = value; 18767 } 18768 var rest = arg.reduce(function(acc, arg) { 18769 var str = typeof arg === "string" ? arg : ""; 18770 if (str.match(/^--?[^-]/) && acc instanceof token) { 18771 result[acc.value] = true; 18772 } 18773 if (str.match(/^--[^-]/)) { 18774 var name = str.replace(/^--/, ""); 18775 if (settings2.boolean.indexOf(name) === -1) { 18776 return new token(name); 18777 } else { 18778 result[name] = true; 18779 } 18780 } else if (str.match(/^-[^-]/)) { 18781 var single = str.replace(/^-/, "").split(""); 18782 if (settings2.boolean.indexOf(single.slice(-1)[0]) === -1) { 18783 var last = single.pop(); 18784 } 18785 single.forEach(function(single) { 18786 result[single] = true; 18787 }); 18788 if (last) { 18789 return new token(last); 18790 } 18791 } else if (acc instanceof token) { 18792 result[acc.value] = arg; 18793 } else if (arg) { 18794 result._.push(arg); 18795 } 18796 return null; 18797 }, null); 18798 if (rest instanceof token) { 18799 result[rest.value] = true; 18800 } 18801 return result; 18802 }, 18803 parse_formatting: function(string2) { 18804 var formatting = $.terminal.unescape_brackets(string2).split(";"); 18805 var text_part = 4; 18806 if (formatting.length >= 5) { 18807 var escaped = $.terminal.escape_brackets(formatting[text_part]); 18808 formatting[text_part] = escaped; 18809 } 18810 return formatting; 18811 }, 18812 extended_command: function extended_command(term, string, options) { 18813 var settings = $.extend({ 18814 invokeMethods: false 18815 }, options); 18816 var deferred = new $.Deferred; 18817 try { 18818 change_hash = false; 18819 var m = string.match(extended_command_re); 18820 if (m) { 18821 if (!settings.invokeMethods) { 18822 warn("To invoke terminal or cmd methods you need to enable " + "invokeMethods option"); 18823 deferred.reject(); 18824 } else { 18825 string = m[1]; 18826 var obj = m[2] === "terminal" ? term : term.cmd(); 18827 var fn = m[3]; 18828 try { 18829 var args = eval("[" + m[4] + "]"); 18830 if (!obj[fn]) { 18831 term.error("Unknow function " + fn); 18832 } else { 18833 var ret = obj[fn].apply(term, args); 18834 if (ret && ret.then) { 18835 return ret; 18836 } 18837 } 18838 deferred.resolve(); 18839 } catch (e) { 18840 term.error("Invalid invocation in " + $.terminal.escape_brackets(string)); 18841 deferred.reject(); 18842 } 18843 } 18844 } else { 18845 return term.exec(string, true).done(function() { 18846 change_hash = true; 18847 }); 18848 } 18849 } catch (e) { 18850 deferred.reject(); 18851 } 18852 return deferred.promise(); 18853 }, 18854 iterator: function(string2) { 18855 function formatting(string2) { 18856 if ($.terminal.is_formatting(string2)) { 18857 if (string2.match(/\]\\\]/)) { 18858 string2 = string2.replace(/\]\\\]/g, "]\\\\]"); 18859 } 18860 } 18861 return string2; 18862 } 18863 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 18864 var len = $.terminal.length(string2); 18865 var i = 0; 18866 var obj2 = {}; 18867 obj2[Symbol.iterator] = function() { 18868 return { 18869 next: function() { 18870 if (i < len) { 18871 var text2 = $.terminal.substring(string2, i, i + 1); 18872 i++; 18873 return { 18874 value: formatting(text2) 18875 }; 18876 } else { 18877 return { 18878 done: true 18879 }; 18880 } 18881 } 18882 }; 18883 }; 18884 return obj2; 18885 } 18886 }, 18887 formatter: new function() { 18888 try { 18889 this[Symbol.split] = function(string2) { 18890 return $.terminal.format_split(string2); 18891 }; 18892 this[Symbol.match] = function(string2) { 18893 return string2.match(format_re); 18894 }; 18895 this[Symbol.replace] = function(string2, replacer) { 18896 return string2.replace(format_parts_re, replacer); 18897 }; 18898 this[Symbol.search] = function(string2) { 18899 return string2.search(format_re); 18900 }; 18901 } catch (e) {} 18902 }, 18903 process_formatting: function(string2) { 18904 return $.terminal.format_split(string2).map(function(string2) { 18905 if ($.terminal.is_formatting(string2)) { 18906 var parts = string2.match(new RegExp(format_parts_re, "i")); 18907 var text2 = parts.pop(); 18908 for (var i = 1;i <= 2; ++i) { 18909 if (!$.terminal.valid_color(parts[i])) { 18910 parts[i] = ""; 18911 } 18912 } 18913 return parts.slice(1, 4).concat(text2); 18914 } else { 18915 return ["", "", "", string2]; 18916 } 18917 }); 18918 }, 18919 new_formatter: function(formatter) { 18920 $.terminal.defaults.formatters.unshift(formatter); 18921 }, 18922 remove_formatter: function(formatter) { 18923 remove($.terminal.defaults.formatters, function(item) { 18924 return item === formatter; 18925 }); 18926 } 18927 }; 18928 (function() { 18929 function clean_data(data, text2) { 18930 if (data === "") { 18931 return text2; 18932 } else { 18933 return data.replace(/]/g, "]").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """); 18934 } 18935 } 18936 function is_path(url) { 18937 return url.match(/^\.{1,2}\//) || url.match(/^\//) || !(url.match(/\//) || url.match(/^[^:]+:/)); 18938 } 18939 function with_url_validation(fn2, settings2) { 18940 return function(url) { 18941 if (settings2.anyLinks) { 18942 return true; 18943 } 18944 var test = fn2(url); 18945 if (!test) { 18946 warn("Invalid URL " + url + " only http(s), blob, ftp, and " + "paths are allowed!"); 18947 } 18948 return test; 18949 }; 18950 } 18951 var href_re = /^(((?:blob:)?https?|file|ftp):\/\/|\.{0,2}\/)/; 18952 var src_re = /^(https?:|file:|blob:|data:)/; 18953 $.terminal.format = function format(str, options2) { 18954 var settings2 = $.extend({}, { 18955 linksNoReferrer: false, 18956 linksNoFollow: false, 18957 allowedAttributes: [], 18958 charWidth: undefined, 18959 escape: true, 18960 anyLinks: false 18961 }, options2 || {}); 18962 var valid_href = with_url_validation(function(url) { 18963 return url.match(href_re) || is_path(url); 18964 }, settings2); 18965 var valid_src = with_url_validation(function(url) { 18966 return url.match(src_re) || is_path(url); 18967 }, settings2); 18968 function filter_attr_names(names) { 18969 if (names.length && settings2.allowedAttributes.length) { 18970 return names.filter(function(name) { 18971 if (name === "data-text") { 18972 return false; 18973 } 18974 var allowed = false; 18975 var filters = settings2.allowedAttributes; 18976 for (var i = 0;i < filters.length; ++i) { 18977 if (filters[i] instanceof RegExp) { 18978 if (filters[i].test(name)) { 18979 allowed = true; 18980 break; 18981 } 18982 } else if (filters[i] === name) { 18983 allowed = true; 18984 break; 18985 } 18986 } 18987 return allowed; 18988 }); 18989 } 18990 return []; 18991 } 18992 function attrs_to_string(style, attrs, valid_attrs) { 18993 if (attrs) { 18994 if (valid_attrs.length) { 18995 var style_attrs; 18996 var result = valid_attrs.map(function(name) { 18997 if (attrs[name] === null) { 18998 return ""; 18999 } 19000 if (attrs[name] === true) { 19001 return name; 19002 } 19003 var value = escape_html_attr(attrs[name]); 19004 if (name === "style") { 19005 if (style) { 19006 value = value ? style + ";" + value : style; 19007 } 19008 style_attrs = true; 19009 } 19010 return name + '="' + value + '"'; 19011 }).filter(Boolean); 19012 if (!result.length) { 19013 return ""; 19014 } 19015 if (!style_attrs && style) { 19016 result.push('style="' + style + '"'); 19017 } 19018 return result.join(" "); 19019 } 19020 } 19021 if (!style) { 19022 return ""; 19023 } 19024 return 'style="' + style + '"'; 19025 } 19026 function rel_attr() { 19027 var rel = ["noopener"]; 19028 if (settings2.linksNoReferrer) { 19029 rel.unshift("noreferrer"); 19030 } 19031 if (settings2.linksNoFollow) { 19032 rel.unshift("nofollow"); 19033 } 19034 return rel; 19035 } 19036 var default_rel = rel_attr().join(" "); 19037 function pre_process_link(data, attrs, valid_attrs) { 19038 if (data.match(email_re)) { 19039 return '<a href="mailto:' + data + '"'; 19040 } else { 19041 var result = ["<a"]; 19042 if (data && valid_href(data)) { 19043 result.push('href="' + data + '"'); 19044 } 19045 if (attrs) { 19046 if (valid_attrs.includes("target") && attrs.target === undefined) { 19047 attrs.target = "_blank"; 19048 } 19049 if (valid_attrs.includes("rel") && attrs.rel === undefined) { 19050 attrs.rel = default_rel; 19051 } 19052 } else { 19053 result.push('rel="' + default_rel + '"'); 19054 result.push('target="_blank"'); 19055 } 19056 return result.join(" "); 19057 } 19058 } 19059 function pre_process_image(data, text2) { 19060 var result = "<img"; 19061 if (valid_src(data)) { 19062 result += ' src="' + data + '"'; 19063 if (text2) { 19064 result += ' alt="' + text2 + '"'; 19065 } 19066 } 19067 return result; 19068 } 19069 function find_semicolon(text2) { 19070 var index = 0; 19071 var inside_entity = false; 19072 while (index < text2.length) { 19073 if (text2[index] === "&") { 19074 inside_entity = true; 19075 } else if (text2[index] === ";" && !inside_entity) { 19076 return index; 19077 } else if (text2[index] === ";") { 19078 inside_entity = false; 19079 } 19080 index++; 19081 } 19082 return -1; 19083 } 19084 function format(s, style, color, background, _class, data_text, text2) { 19085 var attrs; 19086 var valid_attrs = []; 19087 if (data_text.match(/;/)) { 19088 try { 19089 var semicolon = find_semicolon(data_text); 19090 if (semicolon !== -1) { 19091 var json = data_text.substring(semicolon + 1); 19092 json = json.replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">"); 19093 if (json.match(/^\s*\{[^}]*\}\s*$/)) { 19094 attrs = JSON.parse(json); 19095 valid_attrs = filter_attr_names(Object.keys(attrs)); 19096 data_text = data_text.substring(0, semicolon); 19097 } 19098 } 19099 } catch (e) {} 19100 } 19101 if (text2 === "" && !style.match(/@/)) { 19102 return ""; 19103 } 19104 text2 = safe(text2); 19105 text2 = text2.replace(/\\\]/g, "]"); 19106 if (settings2.escape) { 19107 text2 = text2.replace(/\\\\/g, "\\"); 19108 } 19109 var styles = {}; 19110 if (style.indexOf("b") !== -1) { 19111 styles["font-weight"] = "bold"; 19112 } 19113 var text_decoration = []; 19114 if (style.indexOf("u") !== -1) { 19115 text_decoration.push("underline"); 19116 } 19117 if (style.indexOf("s") !== -1) { 19118 text_decoration.push("line-through"); 19119 } 19120 if (style.indexOf("o") !== -1) { 19121 text_decoration.push("overline"); 19122 } 19123 if (text_decoration.length) { 19124 styles["text-decoration"] = text_decoration.join(" "); 19125 } 19126 if (style.indexOf("i") !== -1) { 19127 styles["font-style"] = "italic"; 19128 } 19129 if (style.indexOf("r") !== -1) { 19130 if (_class.trim()) { 19131 _class += " " + "terminal-inverted"; 19132 } else { 19133 _class = "terminal-inverted"; 19134 } 19135 } 19136 if ($.terminal.valid_color(color)) { 19137 $.extend(styles, { 19138 color, 19139 "--color": color, 19140 "--original-color": color 19141 }); 19142 if (style.indexOf("!") !== -1) { 19143 styles["--link-color"] = color; 19144 } 19145 if (style.indexOf("g") !== -1) { 19146 styles["text-shadow"] = "0 0 5px " + color; 19147 } 19148 } 19149 if ($.terminal.valid_color(background)) { 19150 $.extend(styles, { 19151 "background-color": background, 19152 "--background": background 19153 }); 19154 } 19155 var data = clean_data(data_text, text2); 19156 var extra = extra_css(text2, settings2); 19157 if (extra) { 19158 text2 = wide_characters(text2, settings2); 19159 $.extend(styles, extra); 19160 } 19161 var result; 19162 var style_str = style_to_string(styles); 19163 if (style.indexOf("!") !== -1) { 19164 result = pre_process_link(data, attrs, valid_attrs); 19165 } else if (style.indexOf("@") !== -1) { 19166 result = pre_process_image(data, text2); 19167 } else { 19168 result = "<span"; 19169 } 19170 var output_attrs = attrs_to_string(style_str, attrs, valid_attrs); 19171 if (output_attrs) { 19172 result += " " + output_attrs; 19173 } 19174 if (_class !== "") { 19175 result += ' class="' + _class + '"'; 19176 } 19177 if (style.indexOf("!") !== -1) { 19178 result += " data-text>" + text2 + "</a>"; 19179 } else if (style.indexOf("@") !== -1) { 19180 result += " data-text/>"; 19181 } else { 19182 result += ' data-text="' + data + '">' + "<span>" + text2 + "</span></span>"; 19183 } 19184 return result; 19185 } 19186 if (typeof str === "string") { 19187 var splitted = $.terminal.format_split(str); 19188 str = $.map(splitted, function(text2) { 19189 if (text2 === "") { 19190 return text2; 19191 } else if ($.terminal.is_formatting(text2)) { 19192 text2 = text2.replace(/\[\[[^\]]+\]/, function(text2) { 19193 return text2.replace(/ /g, " "); 19194 }); 19195 return text2.replace(format_parts_re, format); 19196 } else { 19197 text2 = safe(text2); 19198 text2 = text2.replace(/\\\]/, "]"); 19199 var data = clean_data(text2); 19200 var extra = extra_css(text2, settings2); 19201 var prefix; 19202 if (extra) { 19203 text2 = wide_characters(text2, settings2); 19204 prefix = '<span style="' + style_to_string(extra) + '"'; 19205 } else { 19206 prefix = "<span"; 19207 } 19208 return prefix + ' data-text="' + data + '">' + text2 + "</span>"; 19209 } 19210 }).join(""); 19211 return str.replace(/<span><br\s*\/?><\/span>/gi, "<br/>"); 19212 } else { 19213 return ""; 19214 } 19215 }; 19216 })(); 19217 $.terminal.Exception = function Terminal_Exception(type, message, stack) { 19218 if (arguments.length === 1) { 19219 this.message = arguments[0]; 19220 this.type = "TERMINAL"; 19221 } else { 19222 this.type = type; 19223 this.message = message; 19224 if (stack) { 19225 this.stack = stack; 19226 } 19227 } 19228 }; 19229 $.terminal.Exception.prototype = new Error; 19230 $.terminal.Exception.prototype.toString = function() { 19231 return this.message + ` 19232` + this.stack; 19233 }; 19234 $.fn.visible = function() { 19235 return this.css("visibility", "visible"); 19236 }; 19237 $.fn.hidden = function() { 19238 return this.css("visibility", "hidden"); 19239 }; 19240 var warnings = []; 19241 function warn(msg) { 19242 msg = "[jQuery Terminal] " + msg; 19243 if (warnings.indexOf(msg) === -1) { 19244 warnings.push(msg); 19245 if (console) { 19246 if (console.warn) { 19247 console.warn(msg); 19248 } else if (console.log) { 19249 console.log(msg); 19250 } 19251 } else { 19252 setTimeout(function() { 19253 throw new Error("WARN: " + msg); 19254 }, 0); 19255 } 19256 } 19257 } 19258 var ids = {}; 19259 $.jrpc = function(url, method, params, success, error) { 19260 var deferred2 = new $.Deferred; 19261 var options2; 19262 if ($.isPlainObject(url)) { 19263 options2 = url; 19264 } else { 19265 options2 = { 19266 url, 19267 method, 19268 params, 19269 success, 19270 error 19271 }; 19272 } 19273 function validJSONRPC(response) { 19274 return typeof response.id === "number" && (typeof response.result !== "undefined" || typeof response.error !== "undefined"); 19275 } 19276 ids[options2.url] = ids[options2.url] || 0; 19277 var request = { 19278 jsonrpc: "2.0", 19279 method: options2.method, 19280 params: options2.params, 19281 id: ++ids[options2.url] 19282 }; 19283 function finalize(json, response, status, jqXHR) { 19284 if (validJSONRPC(json) || options2.method === "system.describe") { 19285 if (options2.success) { 19286 options2.success(json, status, jqXHR); 19287 } 19288 deferred2.resolve(json); 19289 } else { 19290 if (options2.error) { 19291 options2.error(jqXHR, "Invalid JSON-RPC"); 19292 } 19293 deferred2.reject({ message: "Invalid JSON-RPC", response }); 19294 } 19295 } 19296 $.ajax({ 19297 url: options2.url, 19298 beforeSend: function beforeSend(jxhr, settings2) { 19299 if (is_function(options2.request)) { 19300 options2.request(jxhr, request); 19301 } 19302 settings2.data = JSON.stringify(request); 19303 }, 19304 success: function success(response, status, jqXHR) { 19305 var content_type = jqXHR.getResponseHeader("Content-Type"); 19306 if (!content_type.match(/(application|text)\/json/)) { 19307 warn("Response Content-Type is neither application/json" + " nor text/json"); 19308 } 19309 var json; 19310 try { 19311 json = JSON.parse(response); 19312 } catch (e) { 19313 if (options2.error) { 19314 options2.error(jqXHR, "Invalid JSON", e); 19315 } else { 19316 throw new $.terminal.Exception("JSON", "Invalid JSON", e.stack); 19317 } 19318 deferred2.reject({ message: "Invalid JSON", response }); 19319 return; 19320 } 19321 if (is_function(options2.response)) { 19322 options2.response(jqXHR, json); 19323 } 19324 if (is_function(options2.intercept)) { 19325 var ret2 = options2.intercept(request, json); 19326 if (ret2) { 19327 return unpromise(ret2, function(json) { 19328 var response = JSON.stringify(json); 19329 finalize(json, response, status, jqXHR); 19330 }); 19331 } 19332 } 19333 finalize(json, response, status, jqXHR); 19334 }, 19335 error: options2.error, 19336 contentType: "application/json", 19337 dataType: "text", 19338 async: true, 19339 cache: false, 19340 type: "POST" 19341 }); 19342 return deferred2.promise(); 19343 }; 19344 $.rpc = function(url, method, params) { 19345 var deferred2 = new $.Deferred; 19346 function success(res) { 19347 if (res.error) { 19348 deferred2.reject(res.error); 19349 } else { 19350 deferred2.resolve(res.result); 19351 } 19352 } 19353 function error(jqXHR, status, message) { 19354 deferred2.reject({ message }); 19355 } 19356 $.jrpc(url, method, params, success, error); 19357 return deferred2.promise(); 19358 }; 19359 function terminal_ready(term2) { 19360 return !!(term2.closest("body").length && term2.is(":visible") && term2.find(".cmd-prompt").length); 19361 } 19362 function format_stack_trace(stack) { 19363 stack = $.terminal.escape_brackets(stack); 19364 return stack.split(/\n/g).map(function(trace) { 19365 return "[[;;;terminal-error]" + trace.replace(url_re, function(url) { 19366 return "]" + url + "[[;;;terminal-error]"; 19367 }) + "]"; 19368 }).join(` 19369`); 19370 } 19371 function get_char_size(term2) { 19372 var result; 19373 if (terminal_ready(term2)) { 19374 var $prompt = term2.find(".cmd-prompt").clone().css({ 19375 visiblity: "hidden", 19376 position: "absolute" 19377 }); 19378 $prompt.appendTo(term2.find(".cmd")).html(" ").wrap('<div class="cmd-wrapper"/>'); 19379 result = { 19380 width: $prompt.width(), 19381 height: $prompt.height() 19382 }; 19383 $prompt.parent().remove(); 19384 } else { 19385 var temp = $('<div class="terminal terminal-temp"><div class="terminal-' + 'wrapper"><div class="terminal-output"><div><div class="te' + 'rminal-line" style="float: left"><span> </span></div' + '></div></div><div class="terminal-pixel"></div></div>').appendTo("body"); 19386 temp.addClass(term2.attr("class")).attr("id", term2.attr("id")); 19387 var style = term2.attr("style"); 19388 if (style) { 19389 style = style.split(/\s*;\s*/).filter(function(s) { 19390 return !s.match(/display\s*:\s*none/i); 19391 }).join(";"); 19392 temp.attr("style", style); 19393 } 19394 var node = temp.find(".terminal-line"); 19395 result = { 19396 width: node.width(), 19397 height: node.height() 19398 }; 19399 temp.remove(); 19400 } 19401 return result; 19402 } 19403 function aproximation(number) { 19404 if (number - Math.floor(number) > 0.9) { 19405 return Math.ceil(number); 19406 } 19407 return Math.floor(number); 19408 } 19409 function get_num_chars(terminal, char_size) { 19410 var width = terminal.find(".terminal-fill").width(); 19411 var result = Math.floor(width / char_size.width); 19412 return result || 1000; 19413 } 19414 function get_num_rows(terminal, char_size) { 19415 var filler = terminal.find(".terminal-fill"); 19416 var height = filler.height(); 19417 return aproximation(height / char_size.height); 19418 } 19419 function all(array, fn2) { 19420 var same = array.filter(function(item) { 19421 return item[fn2]() === item; 19422 }); 19423 return same.length === array.length; 19424 } 19425 function string_case(string2) { 19426 var array = string2.split(""); 19427 if (all(array, "toLowerCase")) { 19428 return "lower"; 19429 } else if (all(array, "toUpperCase")) { 19430 return "upper"; 19431 } else { 19432 return "mixed"; 19433 } 19434 } 19435 function same_case(string2) { 19436 return string_case(string2) !== "mixed"; 19437 } 19438 function is_function(object) { 19439 return get_type(object) === "function"; 19440 } 19441 function is_string(object) { 19442 return get_type(object) === "string"; 19443 } 19444 function is_object(object) { 19445 return object && typeof object === "object"; 19446 } 19447 function is_promise(object) { 19448 return is_object(object) && is_function(object.then || object.done); 19449 } 19450 function is_big_int(object) { 19451 return typeof object === "bigint"; 19452 } 19453 function is_deferred(object) { 19454 return is_promise(object) && is_function(object.promise); 19455 } 19456 if (!Array.isArray) { 19457 Array.isArray = function(arg) { 19458 return Object.prototype.toString.call(arg) === "[object Array]"; 19459 }; 19460 } 19461 function is_array(object) { 19462 return Array.isArray(object); 19463 } 19464 function have_custom_font(term2) { 19465 var custom_font = $(term2).css("--font"); 19466 if (!custom_font) { 19467 return false; 19468 } 19469 var fonts = Array.from(document.fonts.keys()); 19470 var font = fonts.find(function(face) { 19471 return face.family === custom_font; 19472 }); 19473 return !!font; 19474 } 19475 function get_type(object) { 19476 if (typeof object === "function") { 19477 return "function"; 19478 } 19479 if (object === null) { 19480 return object + ""; 19481 } 19482 if (Array.isArray(object)) { 19483 return "array"; 19484 } 19485 if (object instanceof String) { 19486 return "string"; 19487 } 19488 if (typeof object === "object") { 19489 return "object"; 19490 } 19491 return typeof object; 19492 } 19493 var version_set = !$.terminal.version.match(/^\{\{/); 19494 var copyright = "Copyright (c) 2010-2025 Jakub T. Jankiewicz " + "<https://jcubic.pl/me>"; 19495 var version_string = version_set ? " v. " + $.terminal.version : " "; 19496 var reg = new RegExp(" {" + version_string.length + "}$"); 19497 function small_string(name) { 19498 return "(c) 2010-2025 [[!;;;;https://jcubic.pl/me]" + name + "]"; 19499 } 19500 var signatures = [ 19501 ["jQuery Terminal", small_string("jcubic")], 19502 [ 19503 " __ ____ ________", 19504 " / // _ /__ ___/__ ___ ______", 19505 " __ / // // / / // _ // _// /", 19506 "/ / // // / / // ___// / / / / /", 19507 "\\___//____ \\ /_//____//_/ /_/ /_/", 19508 " \\/ ".replace(reg, " ") + version_string, 19509 small_string("Jakub T. Jankiewicz") 19510 ], 19511 [ 19512 " _______ ________ __", 19513 " / / _ /_ ____________ _/__ ___/______________ _____ / /", 19514 " __ / / // / // / _ / _/ // / / / _ / _/ / / \\/ / _ \\/ /", 19515 "/ / / // / // / ___/ // // / / / ___/ // / / / / /\\ / // / /__", 19516 "\\___/____ \\\\__/____/_/ \\__ / /_/____/_//_/_/_/_/_/ \\/\\__\\_\\___/", 19517 " \\/ /____/ ".replace(reg, " ") + version_string, 19518 copyright 19519 ], 19520 [ 19521 " __ _____ ________ " + " __", 19522 " / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ " + " / /", 19523 " __ / // // // // // _ // _// // / / // _ // _// // // \\/ // _ " + "\\/ /", 19524 "/ / // // // // // ___// / / // / / // ___// / / / / // // /\\ // // " + "/ /__", 19525 "\\___//____ \\\\___//____//_/ _\\_ / /_//____//_/ /_/ /_//_//_/ /_/ \\" + "__\\_\\___/", 19526 (" \\/ /____/ " + " ").replace(reg, "") + version_string, 19527 copyright 19528 ] 19529 ]; 19530 $.terminal.nested_formatting.__meta__ = true; 19531 $.terminal.nested_formatting.__inherit__ = true; 19532 $.terminal.nested_formatting.__no_warn__ = true; 19533 $.terminal.defaults = { 19534 prompt: "> ", 19535 history: true, 19536 exit: true, 19537 clear: true, 19538 enabled: true, 19539 maskChar: "*", 19540 wrap: true, 19541 checkArity: true, 19542 raw: false, 19543 tabindex: 1, 19544 invokeMethods: false, 19545 exceptionHandler: null, 19546 pauseEvents: true, 19547 softPause: false, 19548 mousewheel: null, 19549 touchscroll: null, 19550 memory: false, 19551 cancelableAjax: true, 19552 processArguments: true, 19553 execAnimation: false, 19554 execAnimationDelay: 100, 19555 execHistory: false, 19556 linksNoReferrer: false, 19557 externalPause: true, 19558 useCache: true, 19559 anyLinks: false, 19560 linksNoFollow: false, 19561 processRPCResponse: null, 19562 completionEscape: true, 19563 mobileDelete: is_mobile, 19564 convertLinks: true, 19565 errorOnAbort: true, 19566 extra: {}, 19567 tabs: 4, 19568 historySize: 60, 19569 scrollObject: null, 19570 historyState: false, 19571 importHistory: false, 19572 historyFilter: null, 19573 echoCommand: true, 19574 scrollOnEcho: true, 19575 login: null, 19576 outputLimit: -1, 19577 formatters: [$.terminal.nested_formatting], 19578 unixFormatting: { 19579 escapeBrackets: false, 19580 ansiParser: {}, 19581 ansiArt: false 19582 }, 19583 onAjaxError: null, 19584 pasteImage: true, 19585 scrollBottomOffset: 20, 19586 wordAutocomplete: true, 19587 caseSensitiveAutocomplete: true, 19588 caseSensitiveSearch: true, 19589 clickTimeout: 200, 19590 holdTimeout: 400, 19591 holdRepeatTimeout: 200, 19592 repeatTimeoutKeys: [], 19593 mobileIgnoreAutoSpace: [",", ".", ")"], 19594 request: $.noop, 19595 response: $.noop, 19596 describe: "procs", 19597 onRPCError: null, 19598 keymap: null, 19599 doubleTab: null, 19600 doubleTabEchoCommand: false, 19601 completion: false, 19602 onInit: $.noop, 19603 onClear: $.noop, 19604 onBlur: $.noop, 19605 onFocus: $.noop, 19606 onTerminalChange: $.noop, 19607 onExit: $.noop, 19608 onPush: $.noop, 19609 onPop: $.noop, 19610 keypress: $.noop, 19611 keydown: $.noop, 19612 renderHandler: null, 19613 onAfterRedraw: $.noop, 19614 onEchoCommand: $.noop, 19615 onPaste: $.noop, 19616 onFlush: $.noop, 19617 onBeforeCommand: null, 19618 onAfterCommand: null, 19619 onBeforeEcho: null, 19620 onAfterEcho: null, 19621 onBeforeLogin: null, 19622 onAfterLogout: null, 19623 onBeforeLogout: null, 19624 onCommandChange: null, 19625 onPositionChange: null, 19626 allowedAttributes: ["title", "target", "rel", /^aria-/, "id", /^data-/], 19627 strings: { 19628 comletionParameters: "From version 1.0.0 completion function need to" + " have two arguments", 19629 wrongPasswordTryAgain: "Wrong username or password try again!", 19630 wrongPassword: "Wrong username or password!", 19631 ajaxAbortError: "Error while aborting ajax call!", 19632 wrongArity: "Wrong number of arguments. Function '%s' expects %s got" + " %s!", 19633 commandNotFound: "Command '%s' Not Found!", 19634 oneRPCWithIgnore: "You can use only one rpc with describe == false " + "or rpc without system.describe", 19635 oneInterpreterFunction: "You can't use more than one function (rpc " + "without system.describe or with option describe == false count" + "s as one)", 19636 loginFunctionMissing: "You didn't specify a login function", 19637 noTokenError: "Access denied (no token)", 19638 serverResponse: "Server responded", 19639 wrongGreetings: "Wrong value of greetings parameter", 19640 notWhileLogin: "You can't call `%s' function while in login", 19641 loginIsNotAFunction: "Authenticate must be a function", 19642 canExitError: "You can't exit from main interpreter", 19643 invalidCompletion: "Invalid completion", 19644 invalidSelector: "Sorry, but terminal said that you use invalid " + "selector!", 19645 invalidTerminalId: "Invalid Terminal ID", 19646 login: "login", 19647 password: "password", 19648 recursiveLoop: "Recursive loop in echo detected, skip", 19649 notAString: "%s function: argument is not a string", 19650 redrawError: "Internal error, wrong position in cmd redraw", 19651 invalidStrings: "Command %s have unclosed strings", 19652 invalidMask: "Invalid mask used only string or boolean allowed", 19653 defunctTerminal: "You can't call method '%s' on terminal that was destroyed", 19654 abortError: "Abort with CTRL+D", 19655 timeoutError: "Signal timed out", 19656 invalidId: "terminal with this `id` aready exists! You need to destr" + "oy old terminal before you can create terminal with the same `id`" 19657 } 19658 }; 19659 var requests = []; 19660 var abort_controllers = []; 19661 var terminals = new Cycle; 19662 var save_state = []; 19663 var hash_commands; 19664 var change_hash = false; 19665 var fire_hash_change = true; 19666 var first_instance = true; 19667 $.fn.terminal = function(init_interpreter, options2) { 19668 function StorageHelper(memory) { 19669 if (memory) { 19670 this.storage = {}; 19671 } 19672 this.set = function(key, value) { 19673 if (memory) { 19674 this.storage[key] = value; 19675 } else { 19676 $.Storage.set(key, value); 19677 } 19678 }; 19679 this.get = function(key) { 19680 if (memory) { 19681 return this.storage[key]; 19682 } else { 19683 return $.Storage.get(key); 19684 } 19685 }; 19686 this.remove = function(key) { 19687 if (memory) { 19688 delete this.storage[key]; 19689 } else { 19690 $.Storage.remove(key); 19691 } 19692 }; 19693 } 19694 function get_processed_command(command) { 19695 if ($.terminal.unclosed_strings(command)) { 19696 var string2 = $.terminal.escape_brackets(command); 19697 var message = sprintf(strings().invalidStrings, "`" + string2 + "`"); 19698 throw new $.terminal.Exception(message); 19699 } else if (is_function(settings2.processArguments)) { 19700 return process_command(command, settings2.processArguments); 19701 } else if (settings2.processArguments) { 19702 return $.terminal.parse_command(command); 19703 } else { 19704 return $.terminal.split_command(command); 19705 } 19706 } 19707 var recursive_render = false; 19708 function preprocess_value(value, options2) { 19709 options2 = options2 || {}; 19710 if ($.terminal.Animation && value instanceof $.terminal.Animation) { 19711 value.start(self2); 19712 return false; 19713 } 19714 if (is_function(settings2.renderHandler)) { 19715 if (recursive_render) { 19716 return value; 19717 } 19718 return unpromise(value, function(value) { 19719 try { 19720 recursive_render = true; 19721 var ret2 = settings2.renderHandler.call(self2, value, options2, self2); 19722 if (ret2 === false) { 19723 return false; 19724 } 19725 var was_promise = is_promise(ret2); 19726 if (was_promise) { 19727 return always(ret2, function() { 19728 recursive_render = false; 19729 }); 19730 } 19731 if (typeof ret2 === "string" || is_node(ret2)) { 19732 return ret2; 19733 } else { 19734 return value; 19735 } 19736 } catch (e) { 19737 return [ 19738 "[[;red;]" + e.message + "]", 19739 format_stack_trace(e.stack) 19740 ].join(` 19741`); 19742 } finally { 19743 if (!was_promise) { 19744 recursive_render = false; 19745 } 19746 } 19747 }); 19748 } 19749 return value; 19750 } 19751 function prepare_render(value, options2) { 19752 if (is_node(value)) { 19753 var settings2 = $.extend({}, options2, { 19754 raw: true, 19755 finalize: function(div) { 19756 div.find(".terminal-render-item").replaceWith(value); 19757 if (options2 && is_function(options2.finalize)) { 19758 options2.finalize(div, self2); 19759 } 19760 } 19761 }); 19762 return ['<div class="terminal-render-item"/>', settings2]; 19763 } 19764 } 19765 function render(value, options2) { 19766 var ret2 = prepare_render(value, options2); 19767 if (ret2) { 19768 self2.echo.apply(self2, ret2); 19769 return true; 19770 } 19771 } 19772 function get_node(index) { 19773 return output.find("[data-index=" + index + "]"); 19774 } 19775 function is_node(object) { 19776 return object instanceof $.fn.init || object instanceof Element; 19777 } 19778 function display_object(object) { 19779 object = preprocess_value(object); 19780 if (object === false) { 19781 return; 19782 } 19783 if (render(object)) { 19784 return; 19785 } 19786 if (is_string(object)) { 19787 self2.echo(object); 19788 } else if (is_array(object)) { 19789 self2.echo($.map(object, function(object) { 19790 return JSON.stringify(object); 19791 }).join(" ")); 19792 } else if (typeof object === "object") { 19793 self2.echo(JSON.stringify(object)); 19794 } else { 19795 self2.echo(object); 19796 } 19797 } 19798 function print_line(url_spec, cols) { 19799 var re = /(.*):([0-9]+):([0-9]+)$/; 19800 var m2 = url_spec.match(re); 19801 if (m2) { 19802 self2.pause(settings2.softPause); 19803 $.get(m2[1], function(response) { 19804 var file = m2[1]; 19805 var code = response.split(` 19806`); 19807 var n = +m2[2] - 1; 19808 var start = n > 2 ? n - 2 : 0; 19809 var lines = code.slice(start, n + 3).map(function(line, i) { 19810 var prefix = "[" + (n + i - 1) + "]: "; 19811 var limit = cols - prefix.length - 4; 19812 if (line.length > limit) { 19813 line = line.substring(0, limit) + "..."; 19814 } 19815 if (n > 2 ? i === 2 : i === n) { 19816 line = "[[;#f00;]" + $.terminal.escape_brackets(line) + "]"; 19817 } 19818 return prefix + line; 19819 }).filter(Boolean).join(` 19820`); 19821 if (lines.length) { 19822 self2.echo("[[b;white;]" + file + "]"); 19823 self2.echo(lines).resume(); 19824 } 19825 }, "text"); 19826 } 19827 } 19828 function display_json_rpc_error(error) { 19829 if (is_function(settings2.onRPCError)) { 19830 settings2.onRPCError.call(self2, error); 19831 } else { 19832 self2.error("[RPC] " + error.message); 19833 if (error.error && error.error.message) { 19834 error = error.error; 19835 var msg = "\t" + error.message; 19836 if (error.file) { 19837 msg += ' in file "' + error.file.replace(/.*\//, "") + '"'; 19838 } 19839 if (error.at) { 19840 msg += " at line " + error.at; 19841 } 19842 self2.error(msg); 19843 } 19844 } 19845 } 19846 function make_basic_json_rpc(url, auth) { 19847 var rpc_interceptor; 19848 if (settings2.rpc) { 19849 rpc_interceptor = function() { 19850 return settings2.rpc.apply(self2, arguments); 19851 }; 19852 } 19853 var interpreter = function(method, params) { 19854 self2.pause(settings2.softPause); 19855 $.jrpc({ 19856 url, 19857 method, 19858 params, 19859 request: function(jxhr, request) { 19860 try { 19861 settings2.request.call(self2, jxhr, request, self2); 19862 } catch (e) { 19863 display_exception(e, "USER"); 19864 } 19865 }, 19866 intercept: rpc_interceptor, 19867 response: function(jxhr, response) { 19868 try { 19869 settings2.response.call(self2, jxhr, response, self2); 19870 } catch (e) { 19871 display_exception(e, "USER"); 19872 } 19873 }, 19874 success: function success(json) { 19875 if (json.error) { 19876 display_json_rpc_error(json.error); 19877 } else if (is_function(settings2.processRPCResponse)) { 19878 settings2.processRPCResponse.call(self2, json.result, self2); 19879 } else if (json.result !== null) { 19880 display_object(json.result); 19881 } 19882 self2.resume(); 19883 }, 19884 error: ajax_error 19885 }); 19886 }; 19887 return function(command, terminal) { 19888 if (command === "") { 19889 return; 19890 } 19891 try { 19892 command = get_processed_command(command); 19893 } catch (e) { 19894 display_exception(e, "TERMINAL (get_processed_command)"); 19895 return; 19896 } 19897 if (!auth || command.name === "help") { 19898 interpreter(command.name, command.args); 19899 } else { 19900 var token = terminal.token(true); 19901 if (token) { 19902 interpreter(command.name, [token].concat(command.args)); 19903 } else { 19904 terminal.error("[AUTH] " + strings().noTokenError); 19905 } 19906 } 19907 }; 19908 } 19909 function make_object_interpreter(object, arity, login, fallback) { 19910 return function(user_command, terminal) { 19911 if (user_command === "") { 19912 return; 19913 } 19914 var command; 19915 try { 19916 command = get_processed_command(user_command); 19917 } catch (e) { 19918 if (is_function(settings2.exception)) { 19919 settings2.exception(e, self2); 19920 } else { 19921 self2.error("Error: " + (e.message || e)); 19922 } 19923 return; 19924 } 19925 var val = object[command.name]; 19926 var type = get_type(val); 19927 if (type === "function") { 19928 if (arity && val.length !== command.args.length) { 19929 self2.error("[Arity] " + sprintf(strings().wrongArity, command.name, val.length, command.args.length)); 19930 } else { 19931 return val.apply(self2, command.args); 19932 } 19933 } else if (type === "object" || type === "string") { 19934 var commands = []; 19935 if (type === "object") { 19936 commands = Object.keys(val); 19937 val = make_object_interpreter(val, arity, login); 19938 } 19939 terminal.push(val, { 19940 prompt: command.name + "> ", 19941 name: command.name, 19942 completion: type === "object" ? commands : undefined 19943 }); 19944 } else if (is_function(fallback)) { 19945 return fallback(user_command, self2); 19946 } else if (is_function(settings2.onCommandNotFound)) { 19947 settings2.onCommandNotFound.call(self2, user_command, self2); 19948 } else { 19949 terminal.error(sprintf(strings().commandNotFound, command.name)); 19950 } 19951 }; 19952 } 19953 function ajax_error(xhr, status, error) { 19954 self2.resume(); 19955 if (is_function(settings2.onAjaxError)) { 19956 settings2.onAjaxError.call(self2, xhr, status, error); 19957 } else if (status !== "abort") { 19958 self2.error("[AJAX] " + status + " - " + strings().serverResponse + `: 19959` + $.terminal.escape_brackets(xhr.responseText)); 19960 } 19961 } 19962 function make_json_rpc_object(url, auth, success) { 19963 function jrpc_success(json) { 19964 if (json.error) { 19965 display_json_rpc_error(json.error); 19966 } else if (is_function(settings2.processRPCResponse)) { 19967 settings2.processRPCResponse.call(self2, json.result, self2); 19968 } else { 19969 display_object(json.result); 19970 } 19971 self2.resume(); 19972 } 19973 function jrpc_request(jxhr, request) { 19974 try { 19975 settings2.request.call(self2, jxhr, request, self2); 19976 } catch (e) { 19977 display_exception(e, "USER"); 19978 } 19979 } 19980 function jrpc_response(jxhr, response) { 19981 try { 19982 settings2.response.call(self2, jxhr, response, self2); 19983 } catch (e) { 19984 display_exception(e, "USER"); 19985 } 19986 } 19987 function response(response) { 19988 var procs = response; 19989 if (settings2.describe !== false && settings2.describe !== "") { 19990 settings2.describe.split(".").forEach(function(field) { 19991 procs = procs[field]; 19992 }); 19993 } 19994 if (procs && procs.length) { 19995 var interpreter_object = {}; 19996 $.each(procs, function(_, proc) { 19997 if ($.isPlainObject(proc) && typeof proc.name === "string") { 19998 interpreter_object[proc.name] = function() { 19999 var append = auth && proc.name !== "help"; 20000 var args2 = Array.prototype.slice.call(arguments); 20001 var args_len = args2.length + (append ? 1 : 0); 20002 if (settings2.checkArity && proc.params && proc.params.length !== args_len) { 20003 self2.error("[Arity] " + sprintf(strings().wrongArity, proc.name, proc.params.length, args_len)); 20004 } else { 20005 self2.pause(settings2.softPause); 20006 if (append) { 20007 var token = self2.token(true); 20008 if (token) { 20009 args2 = [token].concat(args2); 20010 } else { 20011 self2.error("[AUTH] " + strings().noTokenError); 20012 } 20013 } 20014 $.jrpc({ 20015 url, 20016 method: proc.name, 20017 params: args2, 20018 request: jrpc_request, 20019 response: jrpc_response, 20020 success: jrpc_success, 20021 error: ajax_error 20022 }); 20023 } 20024 }; 20025 } 20026 }); 20027 var login = typeof auth === "string" ? auth : "login"; 20028 interpreter_object.help = interpreter_object.help || function(fn2) { 20029 if (typeof fn2 === "undefined") { 20030 var names = procs.map(function(proc) { 20031 return proc.name; 20032 }).join(", ") + ", help"; 20033 self2.echo("Available commands: " + names); 20034 } else { 20035 var found = false; 20036 $.each(procs, function(_, proc) { 20037 if (proc.name === fn2) { 20038 found = true; 20039 var msg = ""; 20040 msg += "[[bu;;]" + proc.name + "]"; 20041 if (proc.params) { 20042 var params = proc.params; 20043 if (auth && proc.name !== login) { 20044 params = params.slice(1); 20045 } 20046 msg += " " + params.join(" "); 20047 } 20048 if (proc.help) { 20049 msg += ` 20050` + proc.help; 20051 } 20052 self2.echo(msg); 20053 return false; 20054 } 20055 }); 20056 if (!found) { 20057 if (fn2 === "help") { 20058 self2.echo(`[[bu;;]help] [method] 20059display help ` + "for the method or list of methods if not" + " specified"); 20060 } else { 20061 var msg = "Method `" + fn2 + "' not found "; 20062 self2.error(msg); 20063 } 20064 } 20065 } 20066 }; 20067 success(interpreter_object); 20068 } else { 20069 success(null); 20070 } 20071 } 20072 return $.jrpc({ 20073 url, 20074 method: "system.describe", 20075 params: [], 20076 success: response, 20077 request: jrpc_request, 20078 response: jrpc_response, 20079 error: function error() { 20080 success(null); 20081 } 20082 }); 20083 } 20084 function make_interpreter(user_intrp, login, finalize) { 20085 finalize = finalize || $.noop; 20086 var type = get_type(user_intrp); 20087 var object; 20088 var result = {}; 20089 var rpc_count = 0; 20090 var fn_interpreter; 20091 if (type === "array") { 20092 object = {}; 20093 (function recur(interpreters, success) { 20094 if (interpreters.length) { 20095 var first = interpreters[0]; 20096 var rest = interpreters.slice(1); 20097 var type = get_type(first); 20098 if (type === "string") { 20099 if (settings2.describe === false) { 20100 if (++rpc_count === 1) { 20101 fn_interpreter = make_basic_json_rpc(first, login); 20102 } else { 20103 self2.error(strings().oneRPCWithIgnore); 20104 } 20105 recur(rest, success); 20106 } else { 20107 self2.pause(settings2.softPause); 20108 make_json_rpc_object(first, login, function(new_obj) { 20109 if (new_obj) { 20110 $.extend(object, new_obj); 20111 } else if (++rpc_count === 1) { 20112 fn_interpreter = make_basic_json_rpc(first, login); 20113 } else { 20114 self2.error(strings().oneRPCWithIgnore); 20115 } 20116 self2.resume(); 20117 recur(rest, success); 20118 }); 20119 } 20120 } else if (type === "function") { 20121 if (fn_interpreter) { 20122 self2.error(strings().oneInterpreterFunction); 20123 } else { 20124 fn_interpreter = first; 20125 } 20126 recur(rest, success); 20127 } else if (type === "object") { 20128 $.extend(object, first); 20129 recur(rest, success); 20130 } 20131 } else { 20132 success(); 20133 } 20134 })(user_intrp, function() { 20135 finalize({ 20136 interpreter: make_object_interpreter(object, false, login, fn_interpreter && fn_interpreter.bind(self2)), 20137 completion: Object.keys(object) 20138 }); 20139 }); 20140 } else if (type === "string") { 20141 if (settings2.describe === false) { 20142 object = { 20143 interpreter: make_basic_json_rpc(user_intrp, login) 20144 }; 20145 if (Array.isArray(settings2.completion)) { 20146 object.completion = settings2.completion; 20147 } 20148 finalize(object); 20149 } else { 20150 self2.pause(settings2.softPause); 20151 make_json_rpc_object(user_intrp, login, function(object) { 20152 if (object) { 20153 result.interpreter = make_object_interpreter(object, false, login); 20154 result.completion = Object.keys(object); 20155 } else { 20156 result.interpreter = make_basic_json_rpc(user_intrp, login); 20157 } 20158 finalize(result); 20159 self2.resume(); 20160 }); 20161 } 20162 } else if (type === "object") { 20163 finalize({ 20164 interpreter: make_object_interpreter(user_intrp, settings2.checkArity, login), 20165 completion: Object.keys(user_intrp) 20166 }); 20167 } else { 20168 if (type === "undefined") { 20169 user_intrp = $.noop; 20170 } else if (type !== "function") { 20171 var msg = type + " is invalid interpreter value"; 20172 throw new $.terminal.Exception(msg); 20173 } 20174 finalize({ 20175 interpreter: user_intrp, 20176 completion: settings2.completion 20177 }); 20178 } 20179 } 20180 function make_json_rpc_login(url, login) { 20181 var method = get_type(login) === "boolean" ? "login" : login; 20182 return function(user, passwd, callback) { 20183 self2.pause(settings2.softPause); 20184 $.jrpc({ 20185 url, 20186 method, 20187 params: [user, passwd], 20188 request: function(jxhr, request) { 20189 try { 20190 settings2.request.call(self2, jxhr, request, self2); 20191 } catch (e) { 20192 display_exception(e, "USER"); 20193 } 20194 }, 20195 response: function(jxhr, response) { 20196 try { 20197 settings2.response.call(self2, jxhr, response, self2); 20198 } catch (e) { 20199 display_exception(e, "USER"); 20200 } 20201 }, 20202 success: function success(response) { 20203 if (!response.error && response.result) { 20204 callback(response.result); 20205 } else { 20206 callback(null); 20207 } 20208 self2.resume(); 20209 }, 20210 error: ajax_error 20211 }); 20212 }; 20213 } 20214 function display_exception(e, label, silent) { 20215 if (is_function(settings2.exceptionHandler)) { 20216 settings2.exceptionHandler.call(self2, e, label); 20217 } else { 20218 self2.exception(e, label); 20219 if (!silent) { 20220 setTimeout(function() { 20221 throw e; 20222 }, 0); 20223 } 20224 } 20225 } 20226 function links(string2) { 20227 function format(_, style, color, background, _class, data, text2) { 20228 function formatting(s, text2) { 20229 return "[[" + [ 20230 style + (s || ""), 20231 color, 20232 background, 20233 _class, 20234 text2 || data 20235 ].join(";") + "]"; 20236 } 20237 function escaped(_) { 20238 return "]" + formatting("!", _) + _ + "]" + formatting(); 20239 } 20240 if (!style.match(/!/)) { 20241 var m2 = text2.match(email_full_re) || text2.match(url_full_re); 20242 if (m2) { 20243 return formatting("!", m2[1]) + text2 + "]"; 20244 } else if (text2.match(email_re) || text2.match(url_nf_re)) { 20245 var output = text2.replace(email_re, escaped).replace(url_nf_re, escaped); 20246 return formatting("", data) + output + "]"; 20247 } 20248 } 20249 return _; 20250 } 20251 function linkify(string2) { 20252 return string2.replace(email_re, "[[!;;]$1]").replace(url_nf_re, "[[!;;]$1]"); 20253 } 20254 if (!$.terminal.have_formatting(string2)) { 20255 return linkify(string2); 20256 } 20257 return $.terminal.format_split(string2).map(function(str) { 20258 if ($.terminal.is_formatting(str)) { 20259 return str.replace(format_parts_re, format); 20260 } else { 20261 return linkify(str); 20262 } 20263 }).join(""); 20264 } 20265 function should_wrap(string2, options2) { 20266 return (strlen(text(string2)) > options2.cols || string2.match(/\n/)) && (settings2.wrap === true && options2.wrap === undefined || settings2.wrap === false && options2.wrap === true); 20267 } 20268 var line_cache; 20269 if ("Map" in root) { 20270 line_cache = new Map; 20271 } 20272 function process_extended_commands(string2, line, line_settings) { 20273 if (line_settings.exec || line.options.clear_exec) { 20274 return $.terminal.each_extended_command(string2, function(command) { 20275 if (line_settings.exec) { 20276 line.options.exec = false; 20277 line.options.clear_exec = true; 20278 var trim = command.trim(); 20279 if (prev_exec_cmd && prev_exec_cmd === trim) { 20280 prev_exec_cmd = ""; 20281 self2.error(strings().recursiveLoop); 20282 } else { 20283 prev_exec_cmd = trim; 20284 $.terminal.extended_command(self2, command, { 20285 invokeMethods: line_settings.invokeMethods 20286 }).then(function() { 20287 prev_exec_cmd = ""; 20288 }); 20289 } 20290 } 20291 }); 20292 } 20293 return string2; 20294 } 20295 function process_line(line, safe_throw) { 20296 try { 20297 var use_cache = !is_function(line.value); 20298 var line_settings = $.extend({ 20299 exec: true, 20300 raw: false, 20301 finalize: $.noop, 20302 useCache: use_cache, 20303 invokeMethods: false, 20304 formatters: true, 20305 convertLinks: settings2.convertLinks 20306 }, line.options || {}); 20307 var string2 = stringify_value(line.value); 20308 if (string2 && is_function(string2.then)) { 20309 return string2.then(function(string2) { 20310 process_line($.extend(line, { 20311 value: string2, 20312 options: line_settings 20313 })); 20314 }); 20315 } 20316 if (string2 !== "") { 20317 if (!line_settings.raw) { 20318 if (settings2.useCache && line_settings.useCache) { 20319 var key = string2; 20320 if (line_cache && line_cache.has(key)) { 20321 var data = line_cache.get(key); 20322 buffer.append(data.input, line.index, line_settings, data.raw); 20323 return true; 20324 } 20325 } 20326 if (line_settings.formatters) { 20327 try { 20328 string2 = $.terminal.apply_formatters(string2, $.extend(settings2, { echo: true })); 20329 } catch (e) { 20330 display_exception(e, "FORMATTING"); 20331 } 20332 } 20333 string2 = process_extended_commands(string2, line, line_settings); 20334 if (string2 === "") { 20335 return; 20336 } 20337 if (line_settings.convertLinks) { 20338 string2 = links(string2); 20339 } 20340 var raw_string = string2; 20341 string2 = crlf($.terminal.normalize(string2)); 20342 string2 = $.terminal.encode(string2, { 20343 tabs: settings2.tabs 20344 }); 20345 var array; 20346 var raw_array; 20347 var cols = line_settings.cols = self2.cols(); 20348 if (should_wrap(string2, line_settings)) { 20349 array = $.terminal.split_equal(string2, cols, { 20350 keepWords: line_settings.keepWords, 20351 trim: true 20352 }); 20353 raw_array = $.terminal.split_equal(raw_string, cols, { 20354 keepWords: line_settings.keepWords, 20355 trim: true 20356 }); 20357 } else if (string2.match(/\n/)) { 20358 array = string2.split(/\n/); 20359 raw_array = string2.split(/\n/); 20360 } 20361 } 20362 } else { 20363 raw_string = ""; 20364 } 20365 var arg = array || string2; 20366 var raw = raw_array || raw_string; 20367 if (line_cache && key && use_cache) { 20368 line_cache.set(key, { input: arg, raw }); 20369 } 20370 buffer.append(arg, line.index, line_settings, raw); 20371 } catch (e) { 20372 if (safe_throw) { 20373 throw e; 20374 } 20375 buffer.clear(); 20376 if (is_function(settings2.exceptionHandler)) { 20377 settings2.exceptionHandler.call(self2, e, "TERMINAL"); 20378 } else { 20379 alert_exception("[Internal Exception(process_line)]", e); 20380 } 20381 } 20382 return true; 20383 } 20384 function redraw(options2) { 20385 options2 = $.extend({}, { 20386 update: false, 20387 scroll: true 20388 }, options2 || {}); 20389 if (!options2.update) { 20390 command_line.resize(num_chars); 20391 var detached_output = output.empty().detach(); 20392 } 20393 try { 20394 buffer.clear(); 20395 unpromise(lines.render(self2.rows(), function(lines_to_show) { 20396 return lines_to_show.map(process_line); 20397 }), function() { 20398 self2.flush(options2); 20399 if (!options2.update) { 20400 command_line.before(detached_output); 20401 } 20402 fire_event("onAfterRedraw"); 20403 }); 20404 } catch (e) { 20405 if (is_function(settings2.exceptionHandler)) { 20406 settings2.exceptionHandler.call(self2, e, "TERMINAL (redraw)"); 20407 } else { 20408 alert_exception("[redraw]", e); 20409 } 20410 } 20411 } 20412 function limit_lines() { 20413 var $lines = output.find("> div > div"); 20414 if (settings2.outputLimit >= 0) { 20415 var limit; 20416 if (settings2.outputLimit === 0) { 20417 limit = self2.rows(); 20418 } else { 20419 limit = settings2.outputLimit; 20420 } 20421 if ($lines.length + 1 > limit) { 20422 var max = $lines.length - limit + 1; 20423 var for_remove = $lines.slice(0, max); 20424 var parents = for_remove.parent(); 20425 for_remove.remove(); 20426 parents.each(function() { 20427 var $self = $(this); 20428 if ($self.is(":empty")) { 20429 lines.unmount($self); 20430 $self.remove(); 20431 } 20432 }); 20433 lines.limit_snapshot(max); 20434 return max; 20435 } 20436 } 20437 return $lines.length; 20438 } 20439 function show_greetings() { 20440 if (settings2.greetings === undefined) { 20441 self2.echo(self2.signature, { finalize: a11y_hide, formatters: false }); 20442 } else if (settings2.greetings) { 20443 if (is_string(settings2.greetings)) { 20444 self2.echo(settings2.greetings); 20445 } else if (is_function(settings2.greetings)) { 20446 self2.echo(function() { 20447 try { 20448 var defer = new $.Deferred; 20449 var ret2 = settings2.greetings.call(self2, defer.resolve); 20450 if (ret2) { 20451 defer.resolve(ret2); 20452 } 20453 return defer.promise(); 20454 } catch (e) { 20455 settings2.greetings = null; 20456 display_exception(e, "greetings"); 20457 } 20458 }); 20459 } else { 20460 self2.error(strings().wrongGreetings); 20461 } 20462 } 20463 } 20464 function mask_command(command) { 20465 var mask = command_line.mask(); 20466 switch (typeof mask) { 20467 case "string": 20468 return command.replace(/./g, mask); 20469 case "boolean": 20470 if (mask) { 20471 return command.replace(/./g, settings2.maskChar); 20472 } else { 20473 return $.terminal.escape_formatting(command); 20474 } 20475 } 20476 throw new $.terminal.Exception(strings().invalidMask); 20477 } 20478 function echo_command(command) { 20479 if (typeof command === "undefined") { 20480 command = self2.get_command(); 20481 } 20482 var prompt = command_line.prompt(true); 20483 command = mask_command(command); 20484 var options2 = { 20485 exec: false, 20486 formatters: false, 20487 convertLinks: false, 20488 finalize: function finalize(div) { 20489 a11y_hide(div.addClass("terminal-command")); 20490 fire_event("onEchoCommand", [div, command]); 20491 } 20492 }; 20493 command = $.terminal.apply_formatters(command, { command: true }); 20494 self2.echo(prompt + command, options2); 20495 } 20496 function have_scrollbar() { 20497 return filler.outerWidth() !== self2.outerWidth(); 20498 } 20499 function restore_state(spec) { 20500 var terminal = terminals.get()[spec[0]]; 20501 if (!terminal) { 20502 throw new $.terminal.Exception(strings().invalidTerminalId); 20503 } 20504 var command_idx = spec[1]; 20505 if (save_state[command_idx]) { 20506 terminal.import_view(save_state[command_idx]); 20507 } else { 20508 change_hash = false; 20509 var command = spec[2]; 20510 if (command) { 20511 terminal.exec(command).done(function() { 20512 change_hash = true; 20513 save_state[command_idx] = terminal.export_view(); 20514 }); 20515 } 20516 } 20517 } 20518 var signals = ["AbortError", "TimeoutError"]; 20519 function make_label_error(label) { 20520 return function(err) { 20521 if (signals.includes(err.name) && !settings2.errorOnAbort) { 20522 return; 20523 } 20524 self2.error("[" + label + "] " + (err.message || err)).resume(); 20525 }; 20526 } 20527 function maybe_update_hash() { 20528 if (change_hash) { 20529 fire_hash_change = false; 20530 location.hash = "#" + JSON.stringify(hash_commands); 20531 setTimeout(function() { 20532 fire_hash_change = true; 20533 }, 100); 20534 } 20535 } 20536 var first_command = true; 20537 var resume_callbacks = []; 20538 function commands(command, silent, exec) { 20539 function init_state() { 20540 if (settings2.historyState || settings2.execHash && exec) { 20541 if (!save_state.length) { 20542 self2.save_state(); 20543 } else { 20544 self2.save_state(null); 20545 } 20546 } 20547 } 20548 function before_async_exec() { 20549 if (!exec) { 20550 change_hash = true; 20551 if (settings2.historyState) { 20552 self2.save_state(command, false); 20553 } 20554 change_hash = saved_change_hash; 20555 } 20556 } 20557 function after_exec() { 20558 deferred2.resolve(); 20559 fire_event("onAfterCommand", [command]); 20560 } 20561 function show(result, promise) { 20562 if (typeof result !== "undefined" && result !== self2) { 20563 display_object(result); 20564 } 20565 after_exec(); 20566 if (promise) { 20567 self2.resume(); 20568 } 20569 } 20570 function is_animation_promise(ret2) { 20571 return is_function(ret2.done || ret2.then) && animating; 20572 } 20573 var command_error = make_label_error("Command"); 20574 function invoke_error(err) { 20575 command_error(err); 20576 abort_controllers = []; 20577 } 20578 function invoke() { 20579 var result = interpreter.interpreter.call(self2, command, self2); 20580 before_async_exec(); 20581 if (result) { 20582 if (!force_awake) { 20583 if (is_animation_promise(result)) { 20584 paused = true; 20585 } else if (is_promise(result)) { 20586 self2.pause(settings2.softPause); 20587 } 20588 } 20589 force_awake = false; 20590 if (is_function(result.done || result.then)) { 20591 return unpromise(result, function(value) { 20592 show(value, true); 20593 abort_controllers = []; 20594 }, invoke_error); 20595 } else { 20596 return $.when(result).done(show).catch(invoke_error); 20597 } 20598 } else { 20599 if (exec) { 20600 command_line.refresh(); 20601 } 20602 if (paused) { 20603 resume_callbacks.push(function() { 20604 after_exec(); 20605 }); 20606 } else { 20607 after_exec(); 20608 } 20609 if (exec) { 20610 return deferred2.promise(); 20611 } 20612 } 20613 } 20614 if (first_command) { 20615 first_command = false; 20616 init_state(); 20617 } 20618 try { 20619 if (fire_event("onBeforeCommand", [command]) === false) { 20620 return; 20621 } 20622 if (exec) { 20623 prev_exec_cmd = command.trim(); 20624 prev_command = $.terminal.split_command(prev_exec_cmd); 20625 } else { 20626 prev_command = $.terminal.split_command(command); 20627 } 20628 if (!ghost()) { 20629 if (exec && (is_function(settings2.historyFilter) && settings2.historyFilter(command) || command.match(settings2.historyFilter))) { 20630 command_line.history().append(command); 20631 } 20632 } 20633 var interpreter = interpreters.top(); 20634 if (!silent && settings2.echoCommand) { 20635 echo_command(command); 20636 } 20637 var deferred2 = new $.Deferred; 20638 var saved_change_hash = change_hash; 20639 if (command.match(/^\s*login\s*$/) && self2.token(true)) { 20640 before_async_exec(); 20641 if (self2.level() > 1) { 20642 self2.logout(true); 20643 } else { 20644 self2.logout(); 20645 } 20646 after_exec(); 20647 } else if (settings2.exit && command.match(/^\s*exit\s*$/) && !in_login) { 20648 before_async_exec(); 20649 var level = self2.level(); 20650 if (level === 1 && self2.get_token() || level > 1) { 20651 if (self2.get_token(true)) { 20652 self2.set_token(undefined, true); 20653 } 20654 self2.pop(); 20655 } 20656 after_exec(); 20657 } else if (settings2.clear && command.match(/^\s*clear\s*$/) && !in_login) { 20658 before_async_exec(); 20659 self2.clear(); 20660 after_exec(); 20661 } else { 20662 return invoke(); 20663 } 20664 return deferred2.promise(); 20665 } catch (e) { 20666 display_exception(e, "USER", exec); 20667 self2.resume(); 20668 if (exec) { 20669 throw e; 20670 } 20671 } 20672 } 20673 function global_logout() { 20674 if (fire_event("onBeforeLogout", [], true) === false) { 20675 return; 20676 } 20677 clear_loging_storage(); 20678 fire_event("onAfterlogout", [], true); 20679 self2.login(global_login_fn, true, start); 20680 } 20681 function clear_loging_storage() { 20682 var name = self2.prefix_name(true) + "_"; 20683 storage.remove(name + "token"); 20684 storage.remove(name + "login"); 20685 } 20686 function maybe_append_name(interpreter_name) { 20687 var storage_key = self2.prefix_name() + "_interpreters"; 20688 var names = storage.get(storage_key); 20689 if (names) { 20690 names = JSON.parse(names); 20691 } else { 20692 names = []; 20693 } 20694 if ($.inArray(interpreter_name, names) === -1) { 20695 names.push(interpreter_name); 20696 storage.set(storage_key, JSON.stringify(names)); 20697 } 20698 } 20699 function prepare_top_interpreter(silent) { 20700 var interpreter = interpreters.top(); 20701 var name = self2.prefix_name(true); 20702 if (!ghost()) { 20703 maybe_append_name(name); 20704 } 20705 var login = self2.login_name(true); 20706 command_line.name(name + (login ? "_" + login : "")); 20707 var prompt = interpreter.prompt; 20708 if (is_function(prompt)) { 20709 prompt = context_callback_proxy(prompt); 20710 } 20711 var is_dynamic_prompt = is_function(interpreter.prompt); 20712 if (is_dynamic_prompt || prompt !== command_line.prompt()) { 20713 if (is_dynamic_prompt) { 20714 command_line.prompt(""); 20715 } 20716 command_line.prompt(interpreter.prompt); 20717 } 20718 if (typeof interpreter.history !== "undefined") { 20719 self2.history().toggle(interpreter.history); 20720 } 20721 if ($.isPlainObject(interpreter.keymap)) { 20722 command_line.keymap(null).keymap($.extend({}, terminal_init_keymap, $.omap(interpreter.keymap, function(name, fun) { 20723 return function() { 20724 var args2 = [].slice.call(arguments); 20725 try { 20726 return fun.apply(self2, args2); 20727 } catch (e) { 20728 display_exception(e, "USER KEYMAP"); 20729 } 20730 }; 20731 }))); 20732 } 20733 command_line.set(""); 20734 if (!silent && is_function(interpreter.onStart)) { 20735 interpreter.onStart.call(self2, self2); 20736 } 20737 } 20738 function fire_event(name, args2, skip_local) { 20739 args2 = (args2 || []).concat([self2]); 20740 var top = interpreters && interpreters.top(); 20741 if (top && is_function(top[name]) && !skip_local) { 20742 try { 20743 return top[name].apply(self2, args2); 20744 } catch (e) { 20745 delete top[name]; 20746 display_exception(e, name); 20747 } 20748 } else if (is_function(settings2[name])) { 20749 try { 20750 return settings2[name].apply(self2, args2); 20751 } catch (e) { 20752 settings2[name] = null; 20753 display_exception(e, name); 20754 } 20755 } 20756 } 20757 var scroll_to_view = function() { 20758 function scroll_to_view(visible) { 20759 if (!visible) { 20760 try { 20761 self2.scroll_to(self2.find(".cmd-cursor-line")); 20762 return true; 20763 } catch (e) { 20764 return true; 20765 } 20766 } 20767 } 20768 if (typeof global !== "undefined" && typeof global.it === "function") { 20769 return scroll_to_view; 20770 } 20771 return debounce(scroll_to_view, 100, { 20772 leading: true, 20773 trailing: false 20774 }); 20775 }(); 20776 function make_cursor_visible() { 20777 var cursor = self2.find(".cmd-cursor-line"); 20778 return cursor.is_fully_in_viewport(self2).then(scroll_to_view); 20779 } 20780 function replace_hash(state) { 20781 if (typeof history !== "undefined" && history.replaceState) { 20782 var new_hash = "#" + JSON.stringify(state); 20783 var url = location.href.replace(/#.*$/, new_hash); 20784 history.replaceState(null, "", url); 20785 } 20786 } 20787 function hashchange() { 20788 if (fire_hash_change && settings2.execHash) { 20789 try { 20790 if (location.hash) { 20791 var hash = location.hash.replace(/^#/, ""); 20792 hash_commands = JSON.parse(decodeURIComponent(hash)); 20793 } else { 20794 hash_commands = []; 20795 } 20796 if (hash_commands.length) { 20797 restore_state(hash_commands[hash_commands.length - 1]); 20798 } else if (save_state[0]) { 20799 self2.import_view(save_state[0]); 20800 } 20801 } catch (e) { 20802 display_exception(e, "TERMINAL"); 20803 } 20804 } 20805 } 20806 function start() { 20807 prepare_top_interpreter(); 20808 init_queue.resolve(); 20809 show_greetings(); 20810 } 20811 function initialize() { 20812 if (lines.length) { 20813 if (echo_delay.length) { 20814 $.when.apply($, echo_delay); 20815 } 20816 } 20817 function next() { 20818 onPause = $.noop; 20819 if (!was_paused && self2.enabled()) { 20820 self2.resume(true); 20821 } 20822 } 20823 var was_paused = false; 20824 if (is_function(settings2.onInit)) { 20825 onPause = function() { 20826 was_paused = true; 20827 }; 20828 var ret2; 20829 try { 20830 ret2 = settings2.onInit.call(self2, self2); 20831 } catch (e) { 20832 display_exception(e, "OnInit"); 20833 } finally { 20834 if (!is_promise(ret2)) { 20835 next(); 20836 } else { 20837 ret2.then(next).catch(function(e) { 20838 display_exception(e, "OnInit"); 20839 next(); 20840 }); 20841 } 20842 } 20843 } 20844 if (first_instance) { 20845 first_instance = false; 20846 $(window).on("hashchange", hashchange); 20847 } 20848 } 20849 function ghost() { 20850 return in_login || command_line.mask() !== false; 20851 } 20852 function user_key_down(e) { 20853 var result, top = interpreters.top(); 20854 if (is_function(top.keydown)) { 20855 result = top.keydown.call(self2, e, self2); 20856 if (result !== undefined) { 20857 return result; 20858 } 20859 } else if (is_function(settings2.keydown)) { 20860 result = settings2.keydown.call(self2, e, self2); 20861 if (result !== undefined) { 20862 return result; 20863 } 20864 } 20865 } 20866 var keymap = { 20867 "CTRL+D": function(e, original) { 20868 if (!in_login) { 20869 if (command_line.get() === "") { 20870 if (interpreters.size() > 1 || is_function(global_login_fn)) { 20871 self2.pop(""); 20872 } else { 20873 self2.resume(); 20874 } 20875 } else { 20876 original(); 20877 } 20878 } 20879 return false; 20880 }, 20881 "CTRL+C": function() { 20882 with_selection(function(html) { 20883 if (html === "") { 20884 var command = self2.get_command(); 20885 var position = self2.get_position(); 20886 command = command.slice(0, position) + "^C" + command.slice(position + 2); 20887 echo_command(command); 20888 self2.set_command(""); 20889 } else { 20890 var clip = self2.find("textarea"); 20891 text_to_clipboard(clip, process_selected_html(html)); 20892 } 20893 }); 20894 return false; 20895 }, 20896 "CTRL+L": function() { 20897 self2.clear(); 20898 return false; 20899 }, 20900 TAB: function(e, orignal) { 20901 var top = interpreters.top(), completion, caseSensitive; 20902 if (typeof top.caseSensitiveAutocomplete !== "undefined") { 20903 caseSensitive = top.caseSensitiveAutocomplete; 20904 } else { 20905 caseSensitive = settings2.caseSensitiveAutocomplete; 20906 } 20907 if (settings2.completion && get_type(settings2.completion) !== "boolean" && top.completion === undefined) { 20908 completion = settings2.completion; 20909 } else { 20910 completion = top.completion; 20911 } 20912 if (completion === "settings") { 20913 completion = settings2.completion; 20914 } 20915 function resolve(commands) { 20916 commands = commands.slice(); 20917 if (!self2.before_cursor(false).match(/\s/)) { 20918 if (settings2.clear && $.inArray("clear", commands) === -1) { 20919 commands.push("clear"); 20920 } 20921 if (settings2.exit && $.inArray("exit", commands) === -1) { 20922 commands.push("exit"); 20923 } 20924 } 20925 self2.complete(commands, { 20926 echo: true, 20927 word: settings2.wordAutocomplete, 20928 escape: settings2.completionEscape, 20929 caseSensitive, 20930 echoCommand: settings2.doubleTabEchoCommand, 20931 doubleTab: settings2.doubleTab 20932 }); 20933 } 20934 if (completion) { 20935 switch (get_type(completion)) { 20936 case "function": 20937 var string2 = self2.before_cursor(settings2.wordAutocomplete); 20938 if (completion.length === 3) { 20939 var error = new Error(strings().comletionParameters); 20940 display_exception(error, "USER"); 20941 return false; 20942 } 20943 var result = completion.call(self2, string2, resolve); 20944 unpromise(result, resolve, make_label_error("Completion")); 20945 break; 20946 case "array": 20947 resolve(completion); 20948 break; 20949 default: 20950 throw new $.terminal.Exception(strings().invalidCompletion); 20951 } 20952 } else { 20953 orignal(); 20954 } 20955 return false; 20956 }, 20957 "CTRL+V": function(e, original) { 20958 original(e); 20959 self2.oneTime(200, function() { 20960 self2.scroll_to_bottom(); 20961 }); 20962 return true; 20963 }, 20964 "CTRL+TAB": function() { 20965 if (terminals.length() > 1) { 20966 self2.focus(false); 20967 return false; 20968 } 20969 }, 20970 PAGEDOWN: function() { 20971 self2.scroll(self2.height()); 20972 }, 20973 PAGEUP: function() { 20974 self2.scroll(-self2.height()); 20975 } 20976 }; 20977 function key_down(e) { 20978 var result, i; 20979 if (animating) { 20980 return false; 20981 } 20982 if (self2.enabled()) { 20983 if (!self2.paused()) { 20984 result = user_key_down(e); 20985 if (result !== undefined) { 20986 return result; 20987 } 20988 if (e.which !== 9) { 20989 tab_count = 0; 20990 } 20991 } else { 20992 if (!settings2.pauseEvents) { 20993 result = user_key_down(e); 20994 if (result !== undefined) { 20995 return result; 20996 } 20997 } 20998 if (e.which === 68 && e.ctrlKey) { 20999 if (settings2.pauseEvents) { 21000 result = user_key_down(e); 21001 if (result !== undefined) { 21002 return result; 21003 } 21004 } 21005 self2.abort(); 21006 if (requests.length) { 21007 for (i = requests.length;i--; ) { 21008 var r = requests[i]; 21009 if (r.readyState !== 4) { 21010 try { 21011 r.abort(); 21012 } catch (error) { 21013 if (is_function(settings2.exceptionHandler)) { 21014 settings2.exceptionHandler.call(self2, e, "AJAX ABORT"); 21015 } else { 21016 self2.error(strings().ajaxAbortError); 21017 } 21018 } 21019 } 21020 } 21021 requests = []; 21022 } 21023 self2.resume(); 21024 } 21025 return true; 21026 } 21027 } 21028 } 21029 function key_press(e) { 21030 var top = interpreters.top(); 21031 if (enabled && (!paused || !settings2.pauseEvents)) { 21032 if (is_function(top.keypress)) { 21033 return top.keypress.call(self2, e, self2); 21034 } else if (is_function(settings2.keypress)) { 21035 return settings2.keypress.call(self2, e, self2); 21036 } 21037 } 21038 } 21039 function typed(finish_typing_fn, optimized) { 21040 return function typing_animation(message, options2) { 21041 var formatted = $.terminal.apply_formatters(message, { 21042 animation: true 21043 }); 21044 formatted = $.terminal.normalize(formatted); 21045 var keepWords = false; 21046 if (options2 && typeof options2.keepWords !== "undefined") { 21047 keepWords = options2.keepWords; 21048 } 21049 if (optimized) { 21050 var formatted_lines = $.terminal.split_equal(formatted, self2.cols(), { 21051 keepWords 21052 }); 21053 } 21054 var was_animating = animating; 21055 animating = true; 21056 var prompt = self2.get_prompt(); 21057 var char_i = 0; 21058 var len = $.terminal.length(formatted); 21059 if (len > 0) { 21060 var new_prompt = ""; 21061 if (options2.prompt) { 21062 new_prompt = $.terminal.apply_formatters(options2.prompt, { 21063 prompt: true 21064 }); 21065 } else { 21066 self2.set_prompt(""); 21067 } 21068 var bottom = self2.is_bottom(); 21069 var line = 0; 21070 if (optimized) { 21071 var anim_lines = formatted_lines.map(function(formatted) { 21072 return { 21073 formatted, 21074 chars: $.terminal.partition(formatted, { wrap: false }), 21075 len: $.terminal.length(formatted) 21076 }; 21077 }); 21078 } else { 21079 var chars = $.terminal.partition(formatted, { wrap: false }); 21080 } 21081 var stop; 21082 var interval = setInterval(function() { 21083 var formatted_line, input_chars, input_len; 21084 if (!skip) { 21085 if (optimized) { 21086 formatted_line = anim_lines[line].formatted; 21087 input_chars = anim_lines[line].chars; 21088 input_len = anim_lines[line].len; 21089 } else { 21090 formatted_line = formatted; 21091 input_chars = chars; 21092 input_len = len; 21093 } 21094 if (input_len === 0) { 21095 command_line.prompt(""); 21096 } else { 21097 var chr = input_chars[char_i]; 21098 if (options2.mask) { 21099 var mask = command_line.mask(); 21100 if (typeof mask === "string") { 21101 chr = mask; 21102 } else if (mask) { 21103 chr = settings2.maskChar; 21104 } 21105 } 21106 new_prompt += chr; 21107 command_line.prompt(new_prompt, { formatters: false }); 21108 if (bottom && (chr === ` 21109` || !self2.is_bottom())) { 21110 self2.scroll_to_bottom(); 21111 } 21112 char_i++; 21113 } 21114 if (char_i === input_len && optimized) { 21115 var index = self2.last_index(); 21116 if (line === anim_lines.length - 1) { 21117 self2.set_prompt(prompt); 21118 } else { 21119 self2.set_prompt(""); 21120 } 21121 var is_partial = !!output.find(".partial").length; 21122 self2.echo(formatted_line, $.extend({}, options2, { 21123 formatters: false, 21124 finalize: null, 21125 typing: false 21126 })); 21127 anim_lines[line].index = index + 1; 21128 new_prompt = ""; 21129 ++line; 21130 char_i = 0; 21131 } 21132 } else { 21133 self2.skip_stop(); 21134 var chr_rest = $.terminal.substring(formatted, char_i, len); 21135 new_prompt += chr_rest; 21136 command_line.prompt(new_prompt, { formatters: false }); 21137 stop = true; 21138 } 21139 if (!stop) { 21140 if (optimized) { 21141 stop = line === anim_lines.length; 21142 } else { 21143 stop = char_i === len; 21144 } 21145 } 21146 if (stop) { 21147 clearInterval(interval); 21148 if (is_partial || options2.newline === false) { 21149 var idx = self2.last_index(); 21150 var node = output.find('[data-index="' + idx + '"]'); 21151 options2.finalize(node); 21152 } else { 21153 if (optimized) { 21154 anim_lines.forEach(function(line) { 21155 if (typeof line.index !== "undefined") { 21156 self2.remove_line(line.index); 21157 } 21158 }); 21159 } 21160 finish_typing_fn(message, prompt, options2); 21161 } 21162 if (!was_animating) { 21163 animating = false; 21164 } 21165 } 21166 }, options2.delay); 21167 } 21168 }; 21169 } 21170 var typed_prompt = typed(function(message, _, options2) { 21171 self2.set_prompt(message); 21172 options2.finalize(); 21173 }, true); 21174 var typed_insert = function() { 21175 var helper = typed(function(message, prompt, options2) { 21176 self2.set_prompt(prompt); 21177 self2.insert(message); 21178 options2.finalize(); 21179 }); 21180 return function(prompt, command, options2) { 21181 return helper(command, $.extend({}, options2, { 21182 prompt: prompt + self2.get_command() 21183 })); 21184 }; 21185 }(); 21186 var typed_message = typed(function(message, prompt, options2) { 21187 self2.set_prompt(prompt); 21188 self2.echo(message, $.extend({}, options2, { typing: false })); 21189 }, true); 21190 var typed_enter = function() { 21191 var helper = typed(function(message, prompt, options2) { 21192 self2.set_prompt(prompt); 21193 with_prompt(prompt, function(prompt) { 21194 var command = mask_command(message); 21195 prompt = $.terminal.apply_formatters(prompt, { prompt: true }); 21196 command = $.terminal.apply_formatters(command, { command: true }); 21197 var output = prompt + command; 21198 options2 = $.extend({}, options2, { 21199 typing: false, 21200 formatters: false, 21201 convertLinks: false 21202 }); 21203 self2.echo(output, options2); 21204 }, self2); 21205 }); 21206 return function(prompt, message, options2) { 21207 return helper(message, $.extend({}, options2, { 21208 prompt, 21209 mask: true 21210 })); 21211 }; 21212 }(); 21213 function with_typing(kind, else_fn, finalize_fn) { 21214 return function with_typing_fn(string2, options2) { 21215 var d = new $.Deferred; 21216 when_ready(function ready() { 21217 var locals = $.extend({ 21218 typing: false, 21219 delay: settings2.execAnimationDelay 21220 }, options2); 21221 if (locals.typing) { 21222 if (typeof string2 !== "string") { 21223 return d.reject(kind + ": Typing animation require string"); 21224 } 21225 if (typeof locals.delay !== "number" || isNaN(locals.delay)) { 21226 return d.reject(kind + ": Invalid argument, delay need to" + " be a number"); 21227 } 21228 var p = self2.typing(kind, locals.delay, string2, locals); 21229 p.then(function() { 21230 d.resolve(); 21231 }); 21232 } else { 21233 else_fn(string2, locals); 21234 } 21235 if (is_function(finalize_fn)) { 21236 finalize_fn(string2, locals); 21237 } 21238 }); 21239 if (options2 && options2.typing) { 21240 return d.promise(); 21241 } 21242 return self2; 21243 }; 21244 } 21245 function validate_login(user, token_or_password, callback) { 21246 var ret2 = fire_event("onBeforeLogin", [user, token_or_password]); 21247 return unpromise(defined(ret2), callback, "validate_login"); 21248 } 21249 function authentication(auth_callback, infinite, success, error) { 21250 if (settings2.history) { 21251 command_line.history().disable(); 21252 } 21253 var level = self2.level(); 21254 clear_token(); 21255 function pop_user_pass() { 21256 while (self2.level() > level) { 21257 self2.pop(undefined, true); 21258 } 21259 if (settings2.history) { 21260 command_line.history().enable(); 21261 } 21262 } 21263 function set_token(user, token) { 21264 var name = self2.prefix_name(true) + "_"; 21265 storage.set(name + "token", token); 21266 storage.set(name + "login", user); 21267 } 21268 function clear_token() { 21269 var name = self2.prefix_name(true) + "_"; 21270 storage.remove(name + "token"); 21271 storage.remove(name + "login"); 21272 } 21273 function login_callback(user, token, silent) { 21274 cmd_ready(function ready() { 21275 var next; 21276 if (token) { 21277 pop_user_pass(); 21278 set_token(user, token); 21279 in_login = false; 21280 fire_event("onAfterLogin", [user, token]); 21281 next = success; 21282 } else { 21283 if (infinite) { 21284 if (!silent) { 21285 self2.error(strings().wrongPasswordTryAgain); 21286 } 21287 self2.pop(undefined, true).set_mask(false); 21288 } else { 21289 in_login = false; 21290 if (!silent) { 21291 self2.error(strings().wrongPassword); 21292 } 21293 self2.pop(undefined, true).pop(undefined, true); 21294 } 21295 next = error; 21296 } 21297 if (self2.paused()) { 21298 self2.resume(); 21299 } 21300 if (is_function(next)) { 21301 next(); 21302 } 21303 self2.off("terminal.autologin"); 21304 }); 21305 } 21306 self2.on("terminal.autologin", function(event, user, token, silent) { 21307 validate_login(user, token, function(valid) { 21308 if (valid !== false) { 21309 login_callback(user, token, silent); 21310 } 21311 }); 21312 }); 21313 self2.push(function(user) { 21314 self2.set_mask(settings2.maskChar).push(function(pass) { 21315 try { 21316 validate_login(user, pass, function(valid) { 21317 if (valid === false) { 21318 pop_user_pass(); 21319 return; 21320 } 21321 self2.pause(); 21322 try { 21323 var args2 = [user, pass, function(token, silent) { 21324 login_callback(user, token, silent); 21325 }]; 21326 var ret2 = auth_callback.apply(self2, args2); 21327 unpromise(ret2, function(token) { 21328 login_callback(user, token); 21329 }, function(err) { 21330 self2.pop(undefined, true).pop(undefined, true); 21331 self2.error(err.message); 21332 if (is_function(error)) { 21333 error(); 21334 } 21335 if (self2.paused()) { 21336 self2.resume(); 21337 } 21338 self2.off("terminal.autologin"); 21339 }); 21340 } catch (e) { 21341 display_exception(e, "AUTH"); 21342 } 21343 }); 21344 } catch (e) { 21345 display_exception(e, "AUTH"); 21346 } 21347 }, { 21348 prompt: strings().password + ": ", 21349 name: "password" 21350 }); 21351 }, { 21352 prompt: strings().login + ": ", 21353 name: "login" 21354 }); 21355 } 21356 function ready(queue) { 21357 return function(fun) { 21358 queue.add(fun); 21359 }; 21360 } 21361 function strings() { 21362 return $.extend({}, $.terminal.defaults.strings, settings2 && settings2.strings || {}); 21363 } 21364 function get_prop_number(style, prop) { 21365 return parseInt(style.getPropertyValue(prop), 10) || 0; 21366 } 21367 function get_scrollbar_width() { 21368 var width = filler.outerWidth(); 21369 return container_width - width; 21370 } 21371 function get_padding() { 21372 var style = window.getComputedStyle(filler[0]); 21373 function padding(name) { 21374 return get_prop_number(style, "padding-" + name); 21375 } 21376 var left = padding("left"); 21377 var right = padding("right"); 21378 var top = padding("top"); 21379 var bottom = padding("bottom"); 21380 return { 21381 top, 21382 left, 21383 right, 21384 bottom 21385 }; 21386 } 21387 var self2 = this; 21388 if (this.length > 1) { 21389 return this.each(function() { 21390 $.fn.terminal.call($(this), init_interpreter, $.extend({ name: self2.selector }, options2)); 21391 }); 21392 } 21393 var body_terminal; 21394 if (self2.is("body,html")) { 21395 if (self2.hasClass("full-screen-terminal")) { 21396 var data = self2.find("> .terminal").data("terminal"); 21397 if (data) { 21398 return data; 21399 } 21400 } 21401 body_terminal = self2; 21402 self2 = $("<div/>").appendTo("body"); 21403 $("body").addClass("full-screen-terminal"); 21404 } else if (self2.data("terminal")) { 21405 return self2.data("terminal"); 21406 } 21407 var public_api = $.omap({ 21408 id: function() { 21409 return terminal_id; 21410 }, 21411 clear: function() { 21412 if (fire_event("onClear") !== false) { 21413 buffer.clear(); 21414 lines.clear(function(i) { 21415 return get_node(i); 21416 }); 21417 output[0].innerHTML = ""; 21418 self2.prop({ scrollTop: 0 }); 21419 } 21420 return self2; 21421 }, 21422 output_ready: function() { 21423 return event_hub.wait_for("async_echo_ready"); 21424 }, 21425 export_view: function() { 21426 var user_export = fire_event("onExport"); 21427 user_export = user_export || {}; 21428 return $.extend({}, { 21429 focus: enabled, 21430 mask: command_line.mask(), 21431 prompt: self2.get_prompt(), 21432 command: self2.get_command(), 21433 position: command_line.position(), 21434 lines: clone(lines.data()), 21435 interpreters: interpreters.clone(), 21436 history: command_line.history().data 21437 }, user_export); 21438 }, 21439 import_view: function(view) { 21440 if (in_login) { 21441 throw new Error(sprintf(strings().notWhileLogin, "import_view")); 21442 } 21443 fire_event("onImport", [view]); 21444 when_ready(function ready() { 21445 var bottom = self2.is_bottom(); 21446 self2.set_prompt(view.prompt); 21447 self2.set_command(view.command); 21448 command_line.position(view.position); 21449 command_line.mask(view.mask); 21450 if (view.focus) { 21451 self2.focus(); 21452 } 21453 lines.import(clone(view.lines)); 21454 if (view.interpreters instanceof Stack) { 21455 interpreters = view.interpreters; 21456 } 21457 if (settings2.importHistory) { 21458 command_line.history().set(view.history); 21459 } 21460 redraw(); 21461 if (bottom) { 21462 self2.scroll_to_bottom(); 21463 } 21464 }); 21465 return self2; 21466 }, 21467 save_state: function(command, ignore_hash, index) { 21468 if (typeof index !== "undefined") { 21469 save_state[index] = self2.export_view(); 21470 } else { 21471 save_state.push(self2.export_view()); 21472 } 21473 if (!Array.isArray(hash_commands)) { 21474 hash_commands = []; 21475 } 21476 if (command !== undefined && !ignore_hash) { 21477 var state = [ 21478 terminal_id, 21479 save_state.length - 1, 21480 command 21481 ]; 21482 hash_commands.push(state); 21483 maybe_update_hash(); 21484 } 21485 return self2; 21486 }, 21487 exec: function(command, silent, options2) { 21488 function invoke(silent) { 21489 if (exec_settings.history) { 21490 command_line.history().append(command); 21491 } 21492 var ret2 = commands(command, silent, true); 21493 unpromise(ret2, function() { 21494 prev_command = null; 21495 d.resolve(); 21496 }, function() { 21497 prev_command = null; 21498 d.reject(); 21499 }); 21500 } 21501 if (silent && typeof silent === "object") { 21502 options2 = silent; 21503 silent = null; 21504 } 21505 var exec_settings = $.extend({ 21506 deferred: null, 21507 silent: false, 21508 history: false, 21509 typing: false, 21510 delay: settings2.execAnimationDelay 21511 }, options2); 21512 if (silent === null) { 21513 silent = exec_settings.silent; 21514 } 21515 if (!is_deferred(exec_settings.deferred)) { 21516 exec_settings.deferred = new $.Deferred; 21517 } 21518 var d = exec_settings.deferred; 21519 cmd_ready(function ready() { 21520 if (Array.isArray(command)) { 21521 (function recur() { 21522 var cmd = command.shift(); 21523 if (cmd) { 21524 self2.exec(cmd, silent, options2).done(recur); 21525 } else { 21526 d.resolve(); 21527 } 21528 })(); 21529 } else if (paused) { 21530 delayed_commands.push([command, silent, exec_settings]); 21531 } else if (exec_settings.typing && !silent) { 21532 var delay = exec_settings.delay; 21533 paused = true; 21534 var ret2 = self2.typing("enter", delay, command, { 21535 delay 21536 }); 21537 ret2.then(function() { 21538 paused = false; 21539 invoke(true); 21540 }); 21541 d.then(function() { 21542 paused = false; 21543 }); 21544 } else { 21545 invoke(silent); 21546 } 21547 }); 21548 return d.promise(); 21549 }, 21550 autologin: function(user, token, silent) { 21551 self2.trigger("terminal.autologin", [user, token, silent]); 21552 return self2; 21553 }, 21554 login: function(auth_callback, infinite, success, error) { 21555 logins.push([].slice.call(arguments)); 21556 if (in_login) { 21557 throw new Error(sprintf(strings().notWhileLogin, "login")); 21558 } 21559 if (!is_function(auth_callback)) { 21560 throw new Error(strings().loginIsNotAFunction); 21561 } 21562 in_login = true; 21563 if (self2.token() && self2.level() === 1 && !autologin) { 21564 in_login = false; 21565 self2.logout(true); 21566 } else { 21567 var token = self2.token(true); 21568 var login = self2.login_name(true); 21569 if (token && login) { 21570 in_login = false; 21571 self2.pause(); 21572 validate_login(login, token, function(valid) { 21573 if (valid !== false) { 21574 if (is_function(success)) { 21575 success(); 21576 } else { 21577 self2.resume(); 21578 } 21579 } else { 21580 self2.resume(); 21581 authentication(auth_callback, infinite, success, error); 21582 } 21583 }); 21584 } else { 21585 authentication(auth_callback, infinite, success, error); 21586 } 21587 } 21588 return self2; 21589 }, 21590 settings: function() { 21591 return settings2; 21592 }, 21593 before_cursor: function(word) { 21594 var pos = command_line.position(); 21595 var command = command_line.get().slice(0, pos); 21596 var cmd_strings = command.split(/\s/); 21597 var string2; 21598 if (word) { 21599 if (cmd_strings.length === 1) { 21600 string2 = cmd_strings[0]; 21601 } else { 21602 var m2 = command.match(/(\\?")/g); 21603 var double_quotes = m2 ? m2.filter(function(chr) { 21604 return !chr.match(/^\\/); 21605 }).length : 0; 21606 m2 = command.match(/'/g); 21607 var single_quote = m2 ? m2.length : 0; 21608 if (single_quote % 2 === 1) { 21609 string2 = command.match(/('[^']*)$/)[0]; 21610 } else if (double_quotes % 2 === 1) { 21611 string2 = command.match(/("(?:[^"]|\\")*)$/)[0]; 21612 } else { 21613 string2 = cmd_strings[cmd_strings.length - 1]; 21614 for (i = cmd_strings.length - 1;i > 0; i--) { 21615 var prev_string = cmd_strings[i - 1]; 21616 if (prev_string[prev_string.length - 1] === "\\") { 21617 string2 = cmd_strings[i - 1] + " " + string2; 21618 } else { 21619 break; 21620 } 21621 } 21622 } 21623 } 21624 } else { 21625 string2 = command; 21626 } 21627 return string2; 21628 }, 21629 complete: function(commands, options2) { 21630 options2 = $.extend({ 21631 word: true, 21632 echo: false, 21633 escape: true, 21634 echoCommand: false, 21635 caseSensitive: true, 21636 doubleTab: null 21637 }, options2 || {}); 21638 var sensitive = options2.caseSensitive; 21639 var string2 = self2.before_cursor(options2.word).replace(/\\"/g, '"'); 21640 var quote = false; 21641 if (options2.word) { 21642 if (string2.match(/^"/)) { 21643 quote = '"'; 21644 } else if (string2.match(/^'/)) { 21645 quote = "'"; 21646 } 21647 if (quote) { 21648 string2 = string2.replace(/^["']/, ""); 21649 } 21650 } 21651 if (tab_count % 2 === 0) { 21652 command = self2.before_cursor(options2.word); 21653 } else { 21654 var test = self2.before_cursor(options2.word); 21655 if (test !== command) { 21656 return; 21657 } 21658 } 21659 var safe2 = $.terminal.escape_regex(string2); 21660 if (options2.escape) { 21661 safe2 = safe2.replace(/(\\+)(["'() ])/g, function(_, slash, chr) { 21662 if (chr.match(/[()]/)) { 21663 return slash + "\\?\\" + chr; 21664 } else { 21665 return slash + "?" + chr; 21666 } 21667 }); 21668 } 21669 function escape2(string2) { 21670 if (quote === '"') { 21671 string2 = string2.replace(/"/g, "\\\""); 21672 } 21673 if (!quote && options2.escape) { 21674 string2 = string2.replace(/(["'() ])/g, "\\$1"); 21675 } 21676 return string2; 21677 } 21678 function matched_strings() { 21679 var matched = []; 21680 for (var i = commands.length;i--; ) { 21681 if (commands[i].match(/\n/) && options2.word) { 21682 warn("If you use commands with newlines you " + "should use word option for complete or" + " wordAutocomplete terminal option"); 21683 } 21684 if (regex.test(commands[i])) { 21685 var match = escape2(commands[i]); 21686 if (!sensitive && same_case(match)) { 21687 if (string2.toLowerCase() === string2) { 21688 match = match.toLowerCase(); 21689 } else if (string2.toUpperCase() === string2) { 21690 match = match.toUpperCase(); 21691 } 21692 } 21693 matched.push(match); 21694 } 21695 } 21696 return matched; 21697 } 21698 var flags = sensitive ? "" : "i"; 21699 var regex = new RegExp("^" + safe2, flags); 21700 var matched = matched_strings(); 21701 function replace(input, replacement) { 21702 var text2 = self2.get_command(); 21703 var pos = self2.get_position(); 21704 var re = new RegExp("^" + input, "i"); 21705 var pre = text2.slice(0, pos); 21706 var post = text2.slice(pos); 21707 var to_insert = replacement.replace(re, "") + (quote || ""); 21708 self2.set_command(pre + to_insert + post); 21709 self2.set_position((pre + to_insert).length); 21710 } 21711 if (matched.length === 1) { 21712 if (options2.escape) { 21713 replace(safe2, matched[0]); 21714 } else { 21715 self2.insert(matched[0].replace(regex, "") + (quote || "")); 21716 } 21717 command = self2.before_cursor(options2.word); 21718 return true; 21719 } else if (matched.length > 1) { 21720 if (++tab_count >= 2) { 21721 tab_count = 0; 21722 if (options2.echo) { 21723 if (is_function(options2.doubleTab)) { 21724 if (options2.echoCommand) { 21725 echo_command(); 21726 } 21727 var ret2 = options2.doubleTab.call(self2, string2, matched, echo_command); 21728 if (typeof ret2 === "undefined") { 21729 return true; 21730 } else { 21731 return ret2; 21732 } 21733 } else if (options2.doubleTab !== false) { 21734 echo_command(); 21735 var text2 = matched.slice().reverse().join("\t\t"); 21736 self2.echo($.terminal.escape_brackets(text2), { 21737 keepWords: true, 21738 formatters: false 21739 }); 21740 } 21741 return true; 21742 } 21743 } else { 21744 var common = common_string(escape2(string2), matched, sensitive); 21745 if (common) { 21746 replace(safe2, common); 21747 command = self2.before_cursor(options2.word); 21748 return true; 21749 } 21750 } 21751 } 21752 }, 21753 commands: function() { 21754 return interpreters.top().interpreter; 21755 }, 21756 set_interpreter: function(user_intrp, login) { 21757 var defer = $.Deferred(); 21758 function overwrite_interpreter() { 21759 self2.pause(settings2.softPause); 21760 make_interpreter(user_intrp, login, function(result) { 21761 self2.resume(); 21762 var top = interpreters.top(); 21763 $.extend(top, result); 21764 prepare_top_interpreter(true); 21765 defer.resolve(); 21766 }); 21767 } 21768 if (is_function(login)) { 21769 self2.login(login, true, overwrite_interpreter); 21770 } else if (get_type(user_intrp) === "string" && login) { 21771 self2.login(make_json_rpc_login(user_intrp, login), true, overwrite_interpreter); 21772 } else { 21773 overwrite_interpreter(); 21774 } 21775 return defer.promise(); 21776 }, 21777 greetings: function() { 21778 show_greetings(); 21779 return self2; 21780 }, 21781 paused: function() { 21782 return paused; 21783 }, 21784 pause: function(visible) { 21785 cmd_ready(function ready() { 21786 onPause(); 21787 paused = true; 21788 command_line.disable(visible || is_android); 21789 if (!visible) { 21790 command_line.find(".cmd-prompt").hidden(); 21791 } 21792 fire_event("onPause"); 21793 }); 21794 return self2; 21795 }, 21796 resume: function(silent) { 21797 cmd_ready(function ready() { 21798 paused = false; 21799 if (enabled && terminals.front() === self2) { 21800 command_line.enable(silent); 21801 } 21802 command_line.find(".cmd-prompt").visible(); 21803 var original = delayed_commands; 21804 delayed_commands = []; 21805 for (var i = 0;i < original.length; ++i) { 21806 self2.exec.apply(self2, original[i]); 21807 } 21808 self2.trigger("resume"); 21809 var fn2 = resume_callbacks.shift(); 21810 if (fn2) { 21811 fn2(); 21812 } 21813 if (fire_event("onResume") !== false) { 21814 self2.scroll_to_bottom(); 21815 } 21816 }); 21817 return self2; 21818 }, 21819 signal: function() { 21820 var controller = new AbortController; 21821 abort_controllers.push(controller); 21822 return controller.signal; 21823 }, 21824 timeout: function(time) { 21825 var controller = new AbortController; 21826 var err = new Error(strings().timeoutError); 21827 err.name = "TimeoutError"; 21828 abort_controllers.push(controller); 21829 var signal = controller.signal; 21830 setTimeout(function() { 21831 if (!signal.aborted) { 21832 controller.abort(err); 21833 } 21834 }, time); 21835 return signal; 21836 }, 21837 abort: function(message) { 21838 if (abort_controllers.length) { 21839 var err = new Error(message || strings().abortError); 21840 err.name = "AbortError"; 21841 for (var i = abort_controllers.length;i--; ) { 21842 var controller = abort_controllers[i]; 21843 if (!controller.signal.aborted) { 21844 controller.abort(err); 21845 } 21846 } 21847 abort_controllers = []; 21848 } 21849 return self2; 21850 }, 21851 skip: function() { 21852 skip = true; 21853 return self2; 21854 }, 21855 skip_stop: function() { 21856 skip = false; 21857 return self2; 21858 }, 21859 animating: function() { 21860 return animating; 21861 }, 21862 cols: function() { 21863 if (settings2.numChars) { 21864 return settings2.numChars; 21865 } 21866 if (!num_chars || num_chars === 1000) { 21867 num_chars = get_num_chars(self2, char_size); 21868 } 21869 return num_chars; 21870 }, 21871 rows: function() { 21872 if (settings2.numRows) { 21873 return settings2.numRows; 21874 } 21875 if (!num_rows) { 21876 num_rows = get_num_rows(self2, char_size); 21877 } 21878 return num_rows; 21879 }, 21880 history: function() { 21881 return command_line.history(); 21882 }, 21883 geometry: function() { 21884 var padding = get_padding(); 21885 var height = old_height + padding.top + padding.bottom; 21886 return { 21887 terminal: { 21888 padding: { 21889 left: padding.left, 21890 right: padding.right, 21891 top: padding.top, 21892 bottom: padding.bottom 21893 }, 21894 content: { 21895 width: old_width + padding.left + padding.right, 21896 height 21897 }, 21898 width: container_width, 21899 height 21900 }, 21901 density: pixel_density, 21902 char: char_size, 21903 cols: this.cols(), 21904 rows: this.rows() 21905 }; 21906 }, 21907 history_state: function(toggle) { 21908 function run() { 21909 settings2.historyState = true; 21910 if (!save_state.length) { 21911 self2.save_state(); 21912 } else if (terminals.length() > 1) { 21913 self2.save_state(null); 21914 } 21915 } 21916 if (toggle) { 21917 if (typeof window.setImmediate === "undefined") { 21918 setTimeout(run, 0); 21919 } else { 21920 setImmediate(run); 21921 } 21922 } else { 21923 settings2.historyState = false; 21924 } 21925 return self2; 21926 }, 21927 clear_history_state: function() { 21928 hash_commands = []; 21929 save_state = []; 21930 return self2; 21931 }, 21932 next: function() { 21933 if (terminals.length() === 1) { 21934 return self2; 21935 } else { 21936 terminals.front().disable(); 21937 var next = terminals.rotate().enable(); 21938 var x = next.offset().top - 50; 21939 $("html,body").animate({ scrollTop: x }, 500); 21940 try { 21941 trigger_terminal_change(next); 21942 } catch (e) { 21943 display_exception(e, "onTerminalChange"); 21944 } 21945 return next; 21946 } 21947 }, 21948 focus: function(toggle, silent) { 21949 cmd_ready(function ready() { 21950 if (terminals.length() === 1) { 21951 if (toggle === false) { 21952 self2.disable(silent); 21953 } else { 21954 self2.enable(silent); 21955 } 21956 } else if (toggle === false) { 21957 self2.next(); 21958 } else { 21959 var front = terminals.front(); 21960 if (front !== self2) { 21961 terminals.forEach(function(terminal) { 21962 if (terminal !== self2 && terminal.enabled()) { 21963 terminal.disable(silent); 21964 } 21965 }); 21966 if (!silent) { 21967 try { 21968 trigger_terminal_change(self2); 21969 } catch (e) { 21970 display_exception(e, "onTerminalChange"); 21971 } 21972 } 21973 } 21974 terminals.active(self2); 21975 self2.enable(silent); 21976 } 21977 }); 21978 return self2; 21979 }, 21980 blur: function(silent) { 21981 return this.focus(false, silent); 21982 }, 21983 freeze: function(freeze) { 21984 when_ready(function ready() { 21985 if (freeze) { 21986 self2.disable(); 21987 frozen = true; 21988 } else { 21989 frozen = false; 21990 self2.enable(); 21991 } 21992 }); 21993 return self2; 21994 }, 21995 frozen: function() { 21996 return frozen; 21997 }, 21998 enable: function(silent) { 21999 if (!enabled && !frozen) { 22000 if (num_chars === undefined) { 22001 self2.resize(); 22002 } 22003 cmd_ready(function ready() { 22004 var ret2; 22005 if (!silent && !enabled) { 22006 fire_event("onFocus"); 22007 } 22008 if (!silent && ret2 === undefined || silent) { 22009 enabled = true; 22010 if (!self2.paused()) { 22011 command_line.enable(true); 22012 } 22013 } 22014 }); 22015 } 22016 return self2; 22017 }, 22018 clear_cache: "Map" in root ? function() { 22019 buffer.clear_cache(); 22020 line_cache.clear(); 22021 command_line.clear_cache(); 22022 return self2; 22023 } : function() { 22024 return self2; 22025 }, 22026 disable: function(silent) { 22027 cmd_ready(function ready() { 22028 var ret2; 22029 if (!silent && enabled) { 22030 ret2 = fire_event("onBlur"); 22031 } 22032 if (!silent && ret2 === undefined || silent) { 22033 enabled = false; 22034 command_line.disable(); 22035 } 22036 }); 22037 return self2; 22038 }, 22039 enabled: function() { 22040 return enabled; 22041 }, 22042 signature: function() { 22043 var cols = self2.cols(); 22044 for (var i = signatures.length;i--; ) { 22045 var lengths = signatures[i].map(function(line) { 22046 return $.terminal.length(line); 22047 }); 22048 if (Math.max.apply(null, lengths) <= cols) { 22049 return signatures[i].join(` 22050`).replace(/\s+$/m, "") + ` 22051`; 22052 } 22053 } 22054 return ""; 22055 }, 22056 lines: function() { 22057 return output_line_count; 22058 }, 22059 version: function() { 22060 return $.terminal.version; 22061 }, 22062 cmd: function() { 22063 return command_line; 22064 }, 22065 get_command: function() { 22066 return command_line.get(); 22067 }, 22068 enter: with_typing("enter", echo_command), 22069 set_command: function(command, silent) { 22070 when_ready(function ready() { 22071 if (typeof command !== "string") { 22072 command = JSON.stringify(command); 22073 } 22074 command_line.set(command, undefined, silent); 22075 }); 22076 return self2; 22077 }, 22078 set_position: function(position, relative) { 22079 when_ready(function ready() { 22080 command_line.position(position, relative); 22081 }); 22082 return self2; 22083 }, 22084 get_position: function() { 22085 return command_line.position(); 22086 }, 22087 insert: function(string2, options2) { 22088 if (typeof string2 === "string") { 22089 var locals; 22090 var defaults = { 22091 stay: false, 22092 typing: false, 22093 delay: 100 22094 }; 22095 if (!is_object(options2)) { 22096 options2 = { 22097 stay: options2 22098 }; 22099 } 22100 locals = $.extend(defaults, options2); 22101 var d = new $.Deferred; 22102 when_ready(function ready() { 22103 function done() { 22104 if (settings2.scrollOnEcho || bottom) { 22105 self2.scroll_to_bottom(); 22106 } 22107 } 22108 var bottom = self2.is_bottom(); 22109 if (locals.typing) { 22110 var delay = locals.delay; 22111 var p = self2.typing("insert", delay, string2, settings2); 22112 p.then(function() { 22113 done(); 22114 d.resolve(); 22115 }); 22116 } else { 22117 command_line.insert(string2, settings2.stay); 22118 done(); 22119 } 22120 }); 22121 if (locals.typing) { 22122 return d.promise(); 22123 } 22124 return self2; 22125 } else { 22126 throw new Error(sprintf(strings().notAString, "insert")); 22127 } 22128 }, 22129 set_prompt: with_typing("prompt", function(prompt) { 22130 if (is_function(prompt)) { 22131 command_line.prompt(function(callback) { 22132 return prompt.call(self2, callback, self2); 22133 }); 22134 } else { 22135 command_line.prompt(prompt); 22136 } 22137 }, function(prompt) { 22138 interpreters.top().prompt = prompt; 22139 }), 22140 get_prompt: function() { 22141 return interpreters.top().prompt; 22142 }, 22143 set_mask: function(mask) { 22144 when_ready(function ready() { 22145 command_line.mask(mask === true ? settings2.maskChar : mask); 22146 }); 22147 return self2; 22148 }, 22149 get_mask: function() { 22150 return command_line.mask(); 22151 }, 22152 get_output: function(raw) { 22153 if (raw) { 22154 return lines.data(); 22155 } else { 22156 return lines.get_snapshot(); 22157 } 22158 }, 22159 resize: function(width, height) { 22160 if (!self2.is(":visible")) { 22161 self2.stopTime("resize"); 22162 self2.oneTime(500, "resize", function() { 22163 self2.resize(width, height); 22164 }); 22165 } else { 22166 if (width && height) { 22167 self2.width(width); 22168 self2.height(height); 22169 } 22170 width = self2.width(); 22171 height = self2.height(); 22172 if (typeof settings2.numChars !== "undefined" || typeof settings2.numRows !== "undefined") { 22173 if (typeof settings2.numChars !== "undefined") { 22174 command_line.resize(settings2.numChars); 22175 self2.refresh(); 22176 } 22177 fire_event("onResize"); 22178 return; 22179 } 22180 var new_num_chars = get_num_chars(self2, char_size); 22181 var new_num_rows = get_num_rows(self2, char_size); 22182 if (new_num_chars !== num_chars || new_num_rows !== num_rows) { 22183 self2.clear_cache(); 22184 var changed = new_num_chars !== num_chars; 22185 num_chars = new_num_chars; 22186 num_rows = new_num_rows; 22187 if (changed) { 22188 command_line.resize(num_chars); 22189 self2.refresh(); 22190 } 22191 fire_event("onResize"); 22192 } 22193 } 22194 return self2; 22195 }, 22196 refresh: function() { 22197 if (char_size.width !== 0) { 22198 css(self2[0], { 22199 "--char-width": char_size.width, 22200 "--pixel-density": pixel_density 22201 }); 22202 } 22203 self2.clear_cache(); 22204 if (command) { 22205 command_line.resize(); 22206 } 22207 redraw({ 22208 scroll: false, 22209 update: true 22210 }); 22211 return self2; 22212 }, 22213 flush: function(options2) { 22214 options2 = $.extend({}, { 22215 update: false, 22216 scroll: true 22217 }, options2 || {}); 22218 when_ready(function ready() { 22219 try { 22220 if (buffer.is_empty()) { 22221 return self2; 22222 } 22223 var bottom = self2.is_bottom(); 22224 var scroll = settings2.scrollOnEcho && options2.scroll || bottom; 22225 var wrapper; 22226 var first = true; 22227 var appending_to_partial = false; 22228 var partial = $(); 22229 var snapshot; 22230 var finalizations = []; 22231 if (!options2.update) { 22232 partial = self2.find(".partial"); 22233 snapshot = lines.get_partial(); 22234 buffer.sort(); 22235 } 22236 buffer.flush(function(data) { 22237 if (!data) { 22238 if (!partial.length) { 22239 wrapper = $("<div/>"); 22240 snapshot = []; 22241 } else if (first) { 22242 first = false; 22243 appending_to_partial = true; 22244 wrapper = partial; 22245 } 22246 } else if (is_function(data.finalize)) { 22247 if (options2.update && data.raw === true && data.newline) { 22248 return; 22249 } 22250 if (scroll) { 22251 wrapper.find("img").on("load", function() { 22252 self2.scroll_to_bottom(); 22253 }); 22254 } 22255 if (options2.update) { 22256 lines.update_snapshot(data.index, snapshot); 22257 var node = get_node(data.index); 22258 if (node.html() !== wrapper.html()) { 22259 node.replaceWith(wrapper); 22260 } 22261 } else { 22262 wrapper.appendTo(output); 22263 if (!partial.length) { 22264 lines.make_snapshot(snapshot); 22265 } 22266 } 22267 wrapper.attr("data-index", data.index); 22268 appending_to_partial = !data.newline; 22269 wrapper.toggleClass("partial", appending_to_partial); 22270 finalizations.push({ 22271 node: wrapper, 22272 finalize: data.finalize 22273 }); 22274 if (appending_to_partial) { 22275 partial = wrapper; 22276 } else if (data.newline && partial.length) { 22277 wrapper = $("<div/>"); 22278 partial = $(); 22279 } 22280 } else { 22281 var line = data.line; 22282 var div; 22283 if (typeof data.raw === "string") { 22284 if (appending_to_partial) { 22285 snapshot[snapshot.length - 1] += data.raw; 22286 } else { 22287 snapshot.push(data.raw); 22288 } 22289 } 22290 if (appending_to_partial) { 22291 div = wrapper.children().last().append(line); 22292 appending_to_partial = false; 22293 } else { 22294 div = $("<div/>").html(line); 22295 if (data.newline) { 22296 div.addClass("cmd-end-line"); 22297 } 22298 wrapper.append(div); 22299 } 22300 div.css("width", "100%"); 22301 } 22302 }); 22303 partial = self2.find(".partial"); 22304 var len = $.terminal.length(snapshot[snapshot.length - 1]); 22305 len %= self2.cols(); 22306 finalizations.forEach(function(data) { 22307 data.finalize(data.node); 22308 }); 22309 var last_row; 22310 if (partial.length === 0) { 22311 css(command_line[0], { 22312 "--prompt-offset": "", 22313 top: "" 22314 }); 22315 command_line.__set_prompt_margin(0); 22316 last_row = self2.find(".terminal-output div:last-child" + " div:last-child"); 22317 if (last_row.css("display") === "inline-block") { 22318 last_row.css({ 22319 width: "100%", 22320 display: "" 22321 }); 22322 } 22323 } else if (snapshot.length) { 22324 last_row = partial.children().last(); 22325 var last_row_rect = last_row[0].getBoundingClientRect(); 22326 var size = is_ch_unit_supported ? len + "ch" : len + "px"; 22327 css(command_line[0], { 22328 top: -last_row_rect.height / pixel_density + "px", 22329 "--prompt-offset": size 22330 }); 22331 command_line.__set_prompt_margin(len); 22332 } 22333 output_line_count = limit_lines(); 22334 fire_event("onFlush"); 22335 self2.stopTime("flush").oneTime(10, "flush", function() { 22336 var cmd_cursor = self2.find(".cmd-cursor"); 22337 var offset = self2.find(".cmd").offset(); 22338 var self_offset = self2.offset(); 22339 var top = output.height(); 22340 var height = command_line.height(); 22341 css(self2[0], { 22342 "--terminal-height": self2.height(), 22343 "--terminal-x": offset.left - self_offset.left, 22344 "--terminal-y": offset.top - self_offset.top, 22345 "--terminal-scroll": scroller.prop("scrollTop"), 22346 "--cmd-top": top, 22347 "--cmd-height": height 22348 }); 22349 if (enabled && !is_mobile && !options2.update) { 22350 cmd_cursor.hide(); 22351 setTimeout(function() { 22352 cmd_cursor.show(); 22353 }); 22354 } 22355 }); 22356 wrapper.on_load({ 22357 done: function() { 22358 if (scroll) { 22359 self2.scroll_to_bottom(); 22360 } 22361 } 22362 }); 22363 } catch (e1) { 22364 if (is_function(settings2.exceptionHandler)) { 22365 try { 22366 settings2.exceptionHandler.call(self2, e1, "TERMINAL (Flush)"); 22367 } catch (e2) { 22368 settings2.exceptionHandler = $.noop; 22369 alert_exception("[exceptionHandler]", e2); 22370 } 22371 } else { 22372 alert_exception("[Flush]", e1); 22373 } 22374 } finally { 22375 buffer.clear(); 22376 } 22377 }); 22378 return self2; 22379 }, 22380 update: function(line, value, options2) { 22381 when_ready(function ready() { 22382 if (line < 0) { 22383 line = lines.length() + line; 22384 } 22385 if (!lines.valid_index(line)) { 22386 self2.error("Invalid line number " + line); 22387 } else if (value === null) { 22388 lines.update(line, null); 22389 get_node(line).remove(); 22390 } else { 22391 value = preprocess_value(value, { 22392 update: true, 22393 line 22394 }); 22395 if (value === false) { 22396 return self2; 22397 } 22398 unpromise(value, function(value) { 22399 var ret2 = prepare_render(value, options2); 22400 if (ret2) { 22401 value = ret2[0]; 22402 options2 = ret2[1]; 22403 } 22404 options2 = lines.update(line, value, options2); 22405 var next = process_line({ 22406 value, 22407 index: line, 22408 options: options2 22409 }); 22410 unpromise(next, function() { 22411 self2.flush({ 22412 scroll: false, 22413 update: true 22414 }); 22415 }); 22416 }); 22417 } 22418 }); 22419 return self2; 22420 }, 22421 remove_line: function(line) { 22422 return self2.update(line, null); 22423 }, 22424 last_index: function() { 22425 return lines.length() - 1; 22426 }, 22427 echo: function(arg, options2, deferred2) { 22428 var arg_defined = arguments.length > 0; 22429 var d = deferred2 || new $.Deferred; 22430 function cont(value) { 22431 echo_promise = false; 22432 var original = echo_delay; 22433 echo_delay = []; 22434 for (var i = 0;i < original.length; ++i) { 22435 self2.echo.apply(self2, original[i]); 22436 } 22437 if (value) { 22438 async_echo = async_echo.filter(function(promise) { 22439 return promise !== value; 22440 }); 22441 if (!async_echo.length) { 22442 event_hub.emit("async_echo_ready"); 22443 } 22444 } 22445 } 22446 function error(e, value) { 22447 cont(value); 22448 display_exception(e, "ECHO", true); 22449 } 22450 function echo(arg) { 22451 try { 22452 var locals = $.extend({ 22453 flush: true, 22454 exec: true, 22455 raw: settings2.raw, 22456 finalize: $.noop, 22457 unmount: $.noop, 22458 delay: settings2.execAnimationDelay, 22459 ansi: false, 22460 typing: false, 22461 externalPause: true, 22462 keepWords: false, 22463 invokeMethods: settings2.invokeMethods, 22464 onClear: null, 22465 formatters: true, 22466 allowedAttributes: settings2.allowedAttributes, 22467 newline: true 22468 }, options2 || {}); 22469 var should_pause = settings2.externalPause && locals.externalPause; 22470 (function(finalize) { 22471 if (is_node(arg)) { 22472 return; 22473 } 22474 locals.finalize = function(node) { 22475 if (locals.raw) { 22476 node.addClass("raw"); 22477 } 22478 if (locals.ansi) { 22479 node.addClass("ansi"); 22480 } 22481 try { 22482 if (is_function(finalize)) { 22483 finalize.call(self2, node); 22484 } 22485 node.on_load({ 22486 error: function(element) { 22487 element.replaceWith(use_broken_image); 22488 if (should_pause) { 22489 self2.resume(); 22490 } 22491 }, 22492 done: function(has_elements) { 22493 if (has_elements && should_pause) { 22494 self2.resume(); 22495 } 22496 }, 22497 load: function(has_elements) { 22498 if (has_elements && should_pause) { 22499 self2.pause(); 22500 } 22501 } 22502 }); 22503 } catch (e) { 22504 display_exception(e, "USER:echo(finalize)"); 22505 finalize = null; 22506 } 22507 }; 22508 })(locals.finalize); 22509 if (locals.flush) { 22510 if (!buffer.empty()) { 22511 self2.flush(); 22512 } 22513 } 22514 if (fire_event("onBeforeEcho", [arg]) === false) { 22515 return; 22516 } 22517 if (locals.typing) { 22518 if (typeof arg !== "string") { 22519 return d.reject("echo: Typing animation require string" + " or promise that resolve to string"); 22520 } 22521 if (typeof locals.delay !== "number" || isNaN(locals.delay)) { 22522 return d.reject("echo: Invalid argument, delay need to" + " be a number"); 22523 } 22524 var p = self2.typing("echo", locals.delay, arg, locals); 22525 p.then(function() { 22526 d.resolve(); 22527 }); 22528 return; 22529 } 22530 var value; 22531 if (typeof arg === "function") { 22532 value = arg.bind(self2); 22533 } else if (typeof arg === "undefined") { 22534 if (arg_defined) { 22535 return self2; 22536 } else { 22537 value = ""; 22538 } 22539 } else { 22540 var ret2 = preprocess_value(arg); 22541 if (ret2 === false) { 22542 return self2; 22543 } 22544 value = ret2; 22545 } 22546 if (is_promise(value)) { 22547 echo_promise = true; 22548 } 22549 unpromise(value, function(value) { 22550 if (typeof value === "undefined" || is_promise(ret2) && value === false) { 22551 return; 22552 } 22553 if (render(value, locals)) { 22554 return; 22555 } 22556 var index = lines.length(); 22557 var last_newline = lines.has_newline(); 22558 if (!last_newline) { 22559 index--; 22560 } 22561 if (!locals.newline && value[value.length - 1] === ` 22562`) { 22563 value = value.slice(0, -1); 22564 locals.newline = true; 22565 } 22566 var next = process_line({ 22567 value, 22568 options: locals, 22569 index 22570 }, true); 22571 if (is_promise(next)) { 22572 echo_promise = true; 22573 async_echo.push(next); 22574 } 22575 unpromise(next, function() { 22576 lines.push([value, locals]); 22577 var have_partial = self2.find(".partial").length; 22578 var contination_run = locals.flush && have_partial; 22579 if (locals.flush) { 22580 self2.flush(); 22581 if (have_partial) { 22582 self2.oneTime(1, "echo", function() { 22583 var line = lines.last_line(); 22584 if (line) { 22585 self2.update(-1, line[0], line[1]); 22586 } 22587 cont(next); 22588 }); 22589 } 22590 fire_event("onAfterEcho", [arg]); 22591 } 22592 if (!contination_run) { 22593 cont(next); 22594 } 22595 }, function(e) { 22596 error(e, next); 22597 }); 22598 }, error); 22599 } catch (e) { 22600 if (is_function(settings2.exceptionHandler)) { 22601 settings2.exceptionHandler.call(self2, e, "TERMINAL (echo)"); 22602 } else { 22603 alert_exception("[Terminal.echo]", e); 22604 } 22605 } 22606 } 22607 var is_animation = options2 && options2.typing; 22608 if (echo_promise && !recursive_render) { 22609 var args2 = [arg, options2]; 22610 if (is_animation) { 22611 args2.push(d); 22612 } 22613 echo_delay.push(args2); 22614 } else { 22615 echo(arg); 22616 } 22617 if (is_animation) { 22618 return d.promise(); 22619 } 22620 return self2; 22621 }, 22622 animation: function(callback) { 22623 if (is_function(callback)) { 22624 animating = true; 22625 var prompt = self2.get_prompt(); 22626 self2.set_prompt(""); 22627 return unpromise(callback(), function() { 22628 self2.set_prompt(prompt); 22629 animating = false; 22630 }); 22631 } 22632 return $.when(); 22633 }, 22634 delay: function(time) { 22635 var d = new $.Deferred; 22636 setTimeout(function() { 22637 d.resolve(); 22638 }, time); 22639 return d.promise(); 22640 }, 22641 typing: function(type, delay, string2, options2) { 22642 var d = new $.Deferred; 22643 var settings2; 22644 var finish2; 22645 if (typeof options2 === "object") { 22646 finish2 = options2.finalize || $.noop; 22647 settings2 = $.extend({}, options2, { 22648 delay, 22649 finalize: done 22650 }); 22651 } else { 22652 finish2 = options2 || $.noop; 22653 settings2 = { 22654 delay, 22655 finalize: done 22656 }; 22657 } 22658 function done() { 22659 d.resolve(); 22660 if (is_function(finish2)) { 22661 finish2.apply(self2, arguments); 22662 } 22663 } 22664 var animations = ["prompt", "echo", "enter", "insert"]; 22665 function valid_animation() { 22666 return animations.indexOf(type) >= 0; 22667 } 22668 when_ready(function ready() { 22669 if (valid_animation()) { 22670 if (type === "prompt") { 22671 typed_prompt(string2, settings2); 22672 } else if (type === "echo") { 22673 typed_message(string2, settings2); 22674 } else if (type === "enter") { 22675 with_prompt(self2.get_prompt(), function(prompt) { 22676 typed_enter(prompt, string2, settings2); 22677 }, self2); 22678 } else if (type === "insert") { 22679 with_prompt(self2.get_prompt(), function(prompt) { 22680 typed_insert(prompt, string2, settings2); 22681 }, self2); 22682 } 22683 } else { 22684 d.reject("Invalid type only `echo` and `prompt` are supported"); 22685 } 22686 }); 22687 return d.promise(); 22688 }, 22689 error: function(message, options2) { 22690 options2 = $.extend({}, options2, { raw: false, formatters: false }); 22691 function format(string2) { 22692 if (typeof string2 !== "string") { 22693 string2 = String(string2); 22694 } 22695 var str = $.terminal.escape_brackets(string2).replace(/\\$/, "\").replace(url_re, "]$1[[;;;terminal-error]"); 22696 return "[[;;;terminal-error]" + str + "]"; 22697 } 22698 if (typeof message === "function") { 22699 return self2.echo(function() { 22700 return format(message.call(self2)); 22701 }, options2); 22702 } 22703 if (message && message.then) { 22704 message.then(function(string2) { 22705 self2.echo(format(string2)); 22706 }).catch(make_label_error("Echo Error")); 22707 return self2; 22708 } 22709 return self2.echo(format(message), options2); 22710 }, 22711 exception: function(e, label) { 22712 var message = exception_message(e); 22713 if (label) { 22714 message = "[" + label + "]: " + message; 22715 } 22716 if (message) { 22717 self2.error(message, { 22718 finalize: function(div) { 22719 div.addClass("terminal-exception terminal-message"); 22720 }, 22721 keepWords: true 22722 }); 22723 } 22724 if (typeof e.fileName === "string") { 22725 var was_pased = self2.paused(); 22726 if (!was_pased) { 22727 self2.pause(settings2.softPause); 22728 } 22729 $.get(e.fileName, function(file) { 22730 var num = e.lineNumber - 1; 22731 var line = file.split(` 22732`)[num]; 22733 if (line) { 22734 self2.error("[" + e.lineNumber + "]: " + line); 22735 } 22736 if (!was_pased) { 22737 self2.resume(); 22738 } 22739 }, "text"); 22740 } 22741 if (e.stack) { 22742 self2.echo(format_stack_trace(e.stack), { 22743 finalize: function(div) { 22744 div.addClass("terminal-exception terminal-stack-trace"); 22745 }, 22746 formatters: false 22747 }); 22748 } 22749 return self2; 22750 }, 22751 scroll: function(amount) { 22752 var pos; 22753 amount = Math.round(amount); 22754 if (self2.prop) { 22755 if (amount > scroller.prop("scrollTop") && amount > 0) { 22756 scroller.prop("scrollTop", 0); 22757 } 22758 pos = scroller.prop("scrollTop"); 22759 scroller.scrollTop(pos + amount); 22760 } else { 22761 if (amount > scroller.attr("scrollTop") && amount > 0) { 22762 scroller.attr("scrollTop", 0); 22763 } 22764 pos = scroller.attr("scrollTop"); 22765 scroller.scrollTop(pos + amount); 22766 } 22767 return self2; 22768 }, 22769 logout: function(local) { 22770 if (in_login) { 22771 throw new Error(sprintf(strings().notWhileLogin, "logout")); 22772 } 22773 when_ready(function ready() { 22774 if (local) { 22775 var login = logins.pop(); 22776 self2.set_token(undefined, true); 22777 self2.login.apply(self2, login); 22778 } else if (interpreters.size() === 1 && self2.token()) { 22779 self2.logout(true); 22780 } else { 22781 while (interpreters.size() > 1) { 22782 if (self2.token()) { 22783 self2.logout(true).pop().pop(); 22784 } else { 22785 self2.pop(); 22786 } 22787 } 22788 } 22789 }); 22790 return self2; 22791 }, 22792 token: function(local) { 22793 return storage.get(self2.prefix_name(local) + "_token"); 22794 }, 22795 set_token: function(token, local) { 22796 var name = self2.prefix_name(local) + "_token"; 22797 if (typeof token === "undefined") { 22798 storage.remove(name); 22799 } else { 22800 storage.set(name, token); 22801 } 22802 return self2; 22803 }, 22804 get_token: function(local) { 22805 return self2.token(local); 22806 }, 22807 login_name: function(local) { 22808 return storage.get(self2.prefix_name(local) + "_login"); 22809 }, 22810 name: function() { 22811 return interpreters.top().name; 22812 }, 22813 prefix_name: function(local, max_size) { 22814 var name = (settings2.name ? settings2.name + "_" : "") + terminal_id; 22815 if (local && interpreters.size() > 1) { 22816 var local_name = interpreters.map(function(intrp) { 22817 return intrp.name || ""; 22818 }).slice(1, max_size).join("_"); 22819 if (local_name) { 22820 name += "_" + local_name; 22821 } 22822 } 22823 return name; 22824 }, 22825 read: function(message, success, cancel) { 22826 var options2; 22827 if (typeof arguments[1] === "object") { 22828 options2 = $.extend({ 22829 typing: false, 22830 delay: settings2.execAnimationDelay, 22831 success: $.noop, 22832 cancel: $.noop 22833 }, arguments[1]); 22834 } else { 22835 options2 = { 22836 typing: false, 22837 success: success || $.noop, 22838 cancel: cancel || $.noop 22839 }; 22840 } 22841 if (!options2.signal) { 22842 options2.signal = self2.signal(); 22843 } 22844 if (options2.typing) { 22845 var prompt = self2.get_prompt(); 22846 options2.typing = false; 22847 return self2.typing("prompt", options2.delay, message).then(function() { 22848 return self2.set_prompt(prompt).read(message, options2); 22849 }); 22850 } 22851 force_awake = true; 22852 var defer = jQuery.Deferred(); 22853 if (options2.signal.aborted) { 22854 defer.reject(); 22855 return defer.promise(); 22856 } 22857 self2.push(function(string2) { 22858 defer.resolve(string2); 22859 if (is_function(options2.success)) { 22860 options2.success(string2); 22861 } 22862 exit(); 22863 }, { 22864 name: "read", 22865 history: false, 22866 prompt: message || "", 22867 onStart: function() { 22868 options2.signal.addEventListener("abort", abort_handler); 22869 }, 22870 keymap: { 22871 "CTRL+D": function() { 22872 self2.abort(); 22873 return false; 22874 } 22875 } 22876 }); 22877 function reject(value) { 22878 defer.reject(value); 22879 if (is_function(options2.cancel)) { 22880 options2.cancel(); 22881 } 22882 } 22883 function exit() { 22884 self2.pop(); 22885 if (settings2.history) { 22886 command_line.history().enable(); 22887 } 22888 } 22889 function abort_handler() { 22890 exit(); 22891 reject(options2.signal.reason); 22892 } 22893 if (settings2.history) { 22894 command_line.history().disable(); 22895 } 22896 if (is_function(options2.onReady)) { 22897 options2.onReady.call(self2); 22898 } 22899 return defer.promise(); 22900 }, 22901 push: function(interpreter, options2) { 22902 cmd_ready(function ready() { 22903 options2 = options2 || {}; 22904 var defaults = { 22905 infiniteLogin: false 22906 }; 22907 var push_settings = $.extend({}, defaults, options2); 22908 if (!push_settings.name && prev_command) { 22909 push_settings.name = prev_command.name; 22910 } 22911 if (push_settings.prompt === undefined) { 22912 push_settings.prompt = (push_settings.name || ">") + " "; 22913 } 22914 var top = interpreters.top(); 22915 if (top) { 22916 top.mask = command_line.mask(); 22917 } 22918 var was_paused = paused; 22919 function init() { 22920 fire_event("onPush", [top, interpreters.top()]); 22921 prepare_top_interpreter(); 22922 } 22923 make_interpreter(interpreter, options2.login, function(ret2) { 22924 interpreters.push($.extend({}, ret2, push_settings)); 22925 if (push_settings.completion === true) { 22926 if (Array.isArray(ret2.completion)) { 22927 interpreters.top().completion = ret2.completion; 22928 } else if (!ret2.completion) { 22929 interpreters.top().completion = false; 22930 } 22931 } 22932 if (push_settings.login) { 22933 var error; 22934 var type = get_type(push_settings.login); 22935 if (type === "function") { 22936 error = push_settings.infiniteLogin ? $.noop : self2.pop; 22937 self2.login(push_settings.login, push_settings.infiniteLogin, init, error); 22938 } else if (get_type(interpreter) === "string" && type === "string" || type === "boolean") { 22939 error = push_settings.infiniteLogin ? $.noop : self2.pop; 22940 self2.login(make_json_rpc_login(interpreter, push_settings.login), push_settings.infiniteLogin, init, error); 22941 } 22942 } else { 22943 init(); 22944 } 22945 if (!was_paused && self2.enabled()) { 22946 self2.resume(); 22947 } 22948 }); 22949 }); 22950 return self2; 22951 }, 22952 pop: function(string2, silent) { 22953 if (string2 !== undefined) { 22954 echo_command(string2); 22955 } 22956 var token = self2.token(true); 22957 var top; 22958 if (interpreters.size() === 1) { 22959 top = interpreters.top(); 22960 if (settings2.login) { 22961 if (!silent) { 22962 fire_event("onPop", [top, null]); 22963 } 22964 global_logout(); 22965 fire_event("onExit"); 22966 } else { 22967 self2.error(strings().canExitError); 22968 } 22969 } else { 22970 if (token) { 22971 clear_loging_storage(); 22972 } 22973 var current = interpreters.pop(); 22974 top = interpreters.top(); 22975 prepare_top_interpreter(); 22976 self2.set_mask(top.mask); 22977 if (!silent) { 22978 fire_event("onPop", [current, top]); 22979 } 22980 if (in_login && self2.get_prompt() !== strings().login + ": ") { 22981 in_login = false; 22982 } 22983 if (is_function(current.onExit)) { 22984 try { 22985 current.onExit.call(self2, self2); 22986 } catch (e) { 22987 current.onExit = $.noop; 22988 display_exception(e, "onExit"); 22989 } 22990 } 22991 } 22992 return self2; 22993 }, 22994 option: function(object_or_name, value) { 22995 if (typeof value === "undefined") { 22996 if (typeof object_or_name === "string") { 22997 return settings2[object_or_name]; 22998 } else if (typeof object_or_name === "object") { 22999 $.each(object_or_name, function(key, value) { 23000 settings2[key] = value; 23001 }); 23002 } 23003 } else { 23004 settings2[object_or_name] = value; 23005 if (object_or_name.match(/^num(Chars|Rows)$/)) { 23006 redraw(); 23007 } 23008 } 23009 return self2; 23010 }, 23011 invoke_key: function(shortcut) { 23012 command_line.invoke_key(shortcut); 23013 return self2; 23014 }, 23015 keymap: function(keymap, fn2) { 23016 if (arguments.length === 0) { 23017 return command_line.keymap(); 23018 } 23019 if (typeof fn2 === "undefined") { 23020 if (typeof keymap === "string") { 23021 return command_line.keymap(keymap); 23022 } else if ($.isPlainObject(keymap)) { 23023 keymap = $.extend({}, terminal_init_keymap, $.omap(keymap || {}, function(key, fn2) { 23024 if (!terminal_init_keymap[key]) { 23025 return fn2.bind(self2); 23026 } 23027 return function(e, original) { 23028 return fn2.call(self2, e, function() { 23029 return terminal_init_keymap[key](e, original); 23030 }); 23031 }; 23032 })); 23033 command_line.keymap(null).keymap(keymap); 23034 } 23035 } else if (typeof fn2 === "function") { 23036 var key = keymap; 23037 if (!terminal_init_keymap[key]) { 23038 command_line.keymap(key, fn2.bind(self2)); 23039 } else { 23040 command_line.keymap(key, function(e, original) { 23041 return fn2.call(self2, e, function() { 23042 return terminal_init_keymap[key](e, original); 23043 }); 23044 }); 23045 } 23046 } 23047 }, 23048 level: function() { 23049 return interpreters.size(); 23050 }, 23051 reset: function() { 23052 when_ready(function ready() { 23053 self2.clear(); 23054 while (interpreters.size() > 1) { 23055 interpreters.pop(); 23056 } 23057 prepare_top_interpreter(); 23058 show_greetings(); 23059 initialize(); 23060 }); 23061 return self2; 23062 }, 23063 purge: function() { 23064 when_ready(function ready() { 23065 var prefix = self2.prefix_name() + "_"; 23066 var names = storage.get(prefix + "interpreters"); 23067 if (names) { 23068 $.each(JSON.parse(names), function(_, name) { 23069 storage.remove(name + "_commands"); 23070 storage.remove(name + "_token"); 23071 storage.remove(name + "_login"); 23072 }); 23073 } 23074 command_line.purge(); 23075 storage.remove(prefix + "interpreters"); 23076 }); 23077 return self2; 23078 }, 23079 destroy: function() { 23080 when_ready(function ready() { 23081 command_line.destroy().remove(); 23082 self2.resizer("unbind"); 23083 self2.touch_scroll("unbind"); 23084 font_resizer.resizer("unbind").remove(); 23085 pixel_resizer.resizer("unbind").remove(); 23086 $(document).unbind(".terminal_" + self2.id()); 23087 $(window).unbind(".terminal_" + self2.id()); 23088 self2.unbind("click mousedown mouseup"); 23089 self2.removeData("terminal").removeClass("terminal").unbind(".terminal"); 23090 if (settings2.width) { 23091 self2.css("width", ""); 23092 } 23093 if (settings2.height) { 23094 self2.css("height", ""); 23095 } 23096 $(window).off("blur", blur_terminal).off("focus", focus_terminal); 23097 self2.find(".terminal-fill, .terminal-font, .terminal-font-forcer").remove(); 23098 self2.stopTime(); 23099 terminals.remove(terminal_id); 23100 if (visibility_observer) { 23101 if (visibility_observer.unobserve) { 23102 visibility_observer.unobserve(self2[0]); 23103 } else { 23104 clearInterval(visibility_observer); 23105 } 23106 } 23107 var scroll_marker = self2.find(".terminal-scroll-marker"); 23108 if (is_bottom_observer) { 23109 is_bottom_observer.unobserve(scroll_marker[0]); 23110 } 23111 scroll_marker.remove(); 23112 if (mutation_observer) { 23113 mutation_observer.disconnect(); 23114 } 23115 if (!terminals.length()) { 23116 $(window).off("hashchange"); 23117 } 23118 if (is_mobile) { 23119 self2.off([ 23120 "touchstart.terminal", 23121 "touchmove.terminal", 23122 "touchend.terminal" 23123 ].join(" ")); 23124 } 23125 output.remove(); 23126 scroller.remove(); 23127 if (body_terminal) { 23128 var $body = $(body_terminal); 23129 if ($body.attr("class") === "full-screen-terminal") { 23130 $body.removeAttr("class"); 23131 } else { 23132 $body.removeClass("full-screen-terminal"); 23133 } 23134 self2.remove(); 23135 } 23136 defunct = true; 23137 }); 23138 return self2; 23139 }, 23140 scroll_to: function(elem) { 23141 var scroll = scroller.scrollTop() - self2.offset().top + $(elem).offset().top; 23142 scroller.scrollTop(scroll); 23143 return self2; 23144 }, 23145 scroll_to_bottom: function() { 23146 var scrollHeight; 23147 if (self2.prop) { 23148 scrollHeight = scroller.prop("scrollHeight"); 23149 } else { 23150 scrollHeight = scroller.attr("scrollHeight"); 23151 } 23152 scroller.scrollTop(scrollHeight); 23153 return self2; 23154 }, 23155 is_bottom: function() { 23156 if (settings2.scrollBottomOffset === -1) { 23157 return false; 23158 } else if (typeof is_bottom_detected === "boolean") { 23159 return is_bottom_detected; 23160 } else { 23161 var scroll_height, scroll_top, height; 23162 scroll_height = scroller[0].scrollHeight; 23163 scroll_top = scroller[0].scrollTop; 23164 height = scroller[0].offsetHeight; 23165 var limit = scroll_height - settings2.scrollBottomOffset; 23166 return scroll_top + height > limit; 23167 } 23168 }, 23169 duplicate: function() { 23170 var copy = $(self2); 23171 return $.extend(copy, public_api); 23172 }, 23173 get_output_buffer: function(options2) { 23174 var settings2 = $.extend({ 23175 html: false 23176 }, options2); 23177 var result = []; 23178 var append = false; 23179 buffer.forEach(function(data) { 23180 if (data) { 23181 if (is_function(data.finalize)) { 23182 append = !data.newline; 23183 } else { 23184 var output; 23185 if (settings2.html) { 23186 output = data.line; 23187 } else { 23188 output = data.raw; 23189 } 23190 if (append) { 23191 var last = result.length - 1; 23192 result[last] += output; 23193 } else { 23194 result.push(output); 23195 } 23196 } 23197 } 23198 }); 23199 if (settings2.html) { 23200 return result.map(function(line) { 23201 return "<div>" + line + "</div>"; 23202 }).join(` 23203`); 23204 } 23205 return result.join(` 23206`); 23207 }, 23208 clear_buffer: function() { 23209 buffer.clear(); 23210 return self2; 23211 } 23212 }, function(name, fun) { 23213 return function() { 23214 if (defunct) { 23215 if (!settings2.exceptionHandler) { 23216 throw new $.terminal.Exception(strings().defunctTerminal); 23217 } 23218 } 23219 try { 23220 return fun.apply(self2, [].slice.apply(arguments)); 23221 } catch (e) { 23222 if (name !== "exec" && name !== "resume") { 23223 display_exception(e, e.type || "TERMINAL", true); 23224 } 23225 if (!settings2.exceptionHandler) { 23226 throw e; 23227 } 23228 } 23229 }; 23230 }); 23231 $.extend(self2, public_api); 23232 if (self2.length === 0) { 23233 var msg = sprintf(strings().invalidSelector); 23234 throw new $.terminal.Exception(msg); 23235 } 23236 self2.data("terminal", self2); 23237 var echo_delay = []; 23238 var echo_promise = false; 23239 var prev_command; 23240 var prev_exec_cmd; 23241 var tab_count = 0; 23242 var output; 23243 var have_custom_id = !!(options2 && typeof options2.id === "number"); 23244 var terminal_id = have_custom_id ? options2.id : terminals.length(); 23245 var force_awake = false; 23246 var num_chars; 23247 var output_line_count = 0; 23248 var num_rows; 23249 var command; 23250 var logins = new Stack; 23251 var command_queue = new DelayQueue; 23252 var animating = false; 23253 var skip = false; 23254 var init_queue = new DelayQueue; 23255 var when_ready = ready(init_queue); 23256 var cmd_ready = ready(command_queue); 23257 var async_echo = []; 23258 var event_hub = new EventEmitter; 23259 var is_bottom_detected; 23260 var is_bottom_observer; 23261 var in_login = false; 23262 var onPause = $.noop; 23263 var old_width, old_height, old_pixel_density, container_width; 23264 var delayed_commands = []; 23265 var settings2 = $.extend({}, $.terminal.defaults, { 23266 name: self2.selector, 23267 exit: !!(options2 && options2.login || !options2) 23268 }, options2 || {}); 23269 if (typeof settings2.width === "number") { 23270 self2.width(settings2.width); 23271 } 23272 if (typeof settings2.height === "number") { 23273 self2.height(settings2.height); 23274 } 23275 delete settings2.formatters; 23276 var defunct = false; 23277 var buffer = new FormatBuffer(function(options2) { 23278 return { 23279 linksNoReferrer: settings2.linksNoReferrer, 23280 linksNoFollow: settings2.linksNoFollow, 23281 anyLinks: settings2.anyLinks, 23282 charWidth: char_size.width, 23283 useCache: settings2.useCache, 23284 escape: false, 23285 allowedAttributes: options2.allowedAttributes || [] 23286 }; 23287 }); 23288 var lines = new OutputLines(function() { 23289 return settings2; 23290 }); 23291 var storage = new StorageHelper(settings2.memory); 23292 var enabled = settings2.enabled; 23293 var frozen = false; 23294 var paused = false; 23295 var autologin = true; 23296 var interpreters; 23297 var command_line; 23298 var old_enabled; 23299 var visibility_observer; 23300 var mutation_observer; 23301 if (settings2.ignoreSystemDescribe === true) { 23302 settings2.describe = false; 23303 } 23304 $(document).bind("ajaxSend.terminal_" + self2.id(), function(e, xhr) { 23305 requests.push(xhr); 23306 }); 23307 var scroller = $('<div class="terminal-scroller"/>').appendTo(self2); 23308 var wrapper = $('<div class="terminal-wrapper"/>').appendTo(scroller); 23309 $(broken_image).hide().appendTo(wrapper); 23310 var font_resizer = $('<div class="terminal-font"> </div>').appendTo(self2); 23311 var pixel_resizer = $('<div class="terminal-pixel"/>').appendTo(self2); 23312 var filler = $('<div class="terminal-fill"/>').appendTo(scroller); 23313 output = $("<div>").addClass("terminal-output").attr("role", "log").appendTo(wrapper); 23314 self2.addClass("terminal"); 23315 var pixel_density = get_pixel_size(); 23316 var char_size = get_char_size(self2); 23317 css(self2[0], { 23318 "--char-width": char_size.width, 23319 "--char-height": char_size.height, 23320 "--terminal-scrollbar": get_scrollbar_width() 23321 }); 23322 var need_char_size_recalculate = !terminal_ready(self2); 23323 if (settings2.login && fire_event("onBeforeLogin") === false) { 23324 autologin = false; 23325 } 23326 var base_interpreter; 23327 if (typeof init_interpreter === "string") { 23328 base_interpreter = init_interpreter; 23329 } else if (is_array(init_interpreter)) { 23330 for (var i = 0, len = init_interpreter.length;i < len; ++i) { 23331 if (typeof init_interpreter[i] === "string") { 23332 base_interpreter = init_interpreter[i]; 23333 break; 23334 } 23335 } 23336 } 23337 var global_login_fn; 23338 if (is_function(settings2.login)) { 23339 global_login_fn = settings2.login; 23340 } else if (base_interpreter && (typeof settings2.login === "string" || settings2.login === true)) { 23341 global_login_fn = make_json_rpc_login(base_interpreter, settings2.login); 23342 } 23343 if (have_custom_id) { 23344 if (!terminals.set(settings2.id, self2)) { 23345 warn(strings().invalidId); 23346 } 23347 } else { 23348 terminals.append(self2); 23349 } 23350 function focus_terminal() { 23351 if (old_enabled) { 23352 self2.focus(); 23353 self2.scroll_to_bottom(); 23354 } 23355 } 23356 function get_pixel_size() { 23357 var rect = pixel_resizer[0].getBoundingClientRect(); 23358 return rect.width || 1; 23359 } 23360 function blur_terminal() { 23361 old_enabled = enabled; 23362 self2.disable().find(".cmd textarea").trigger("blur", [true]); 23363 } 23364 function stringify_value(value) { 23365 if (is_function(value)) { 23366 value = value(); 23367 } 23368 if (value && is_function(value.then)) { 23369 return value.then(stringify_value); 23370 } 23371 if (get_type(value) !== "string") { 23372 if (is_function(settings2.parseObject)) { 23373 var ret2 = settings2.parseObject(value); 23374 if (get_type(ret2) === "string") { 23375 value = ret2; 23376 } 23377 } else if (is_array(value)) { 23378 value = $.terminal.columns(value, self2.cols(), settings2.tabs); 23379 } else { 23380 var need_suffix = is_big_int(value); 23381 value = String(value); 23382 if (need_suffix) { 23383 value += "n"; 23384 } 23385 } 23386 } 23387 return value; 23388 } 23389 function context_callback_proxy(fn2) { 23390 if (fn2.proxy) { 23391 return fn2; 23392 } 23393 var wrapper = function(callback) { 23394 return fn2.call(self2, callback, self2); 23395 }; 23396 wrapper.proxy = true; 23397 return wrapper; 23398 } 23399 function paste_event(e) { 23400 e = e.originalEvent; 23401 function is_type(item, type) { 23402 return item.type.indexOf(type) !== -1; 23403 } 23404 function echo_image(image) { 23405 self2.echo('<img src="' + image + '"/>', { raw: true }); 23406 } 23407 function data_uri(blob) { 23408 var URL2 = window.URL || window.webkitURL; 23409 return URL2.createObjectURL(blob); 23410 } 23411 function echo(object, ignoreEvents) { 23412 if (!ignoreEvents) { 23413 var event = { 23414 target: self2 23415 }; 23416 if (typeof object === "string") { 23417 event.text = object; 23418 } else if (object instanceof Blob) { 23419 event.image = data_uri(object); 23420 } 23421 var ret2 = fire_event("onPaste", [event]); 23422 if (ret2) { 23423 if (is_function(ret2.then || ret2.done)) { 23424 return (ret2.then || ret2.done).call(ret2, function(ret2) { 23425 echo(ret2, true); 23426 }); 23427 } else { 23428 echo(ret2, true); 23429 } 23430 } else if (ret2 !== false) { 23431 echo(event.image || event.text, true); 23432 } 23433 } else if (object instanceof Blob) { 23434 echo_image(data_uri(object)); 23435 } else if (typeof object === "string") { 23436 if (object.match(/^(data:|blob:)/)) { 23437 echo_image(object); 23438 } else { 23439 self2.insert(object); 23440 } 23441 } 23442 } 23443 if (e.clipboardData) { 23444 if (self2.enabled()) { 23445 var items = e.clipboardData.items; 23446 if (items) { 23447 for (var i = 0;i < items.length; i++) { 23448 if (is_type(items[i], "image") && settings2.pasteImage) { 23449 var blob = items[i].getAsFile(); 23450 echo(blob); 23451 } else if (is_type(items[i], "text/plain")) { 23452 items[i].getAsString(function(text2) { 23453 echo(text2.replace(/\r/g, "")); 23454 }); 23455 } 23456 } 23457 } else if (e.clipboardData.getData) { 23458 var text2 = e.clipboardData.getData("text/plain"); 23459 echo(text2.replace(/\r/g, "")); 23460 } 23461 return false; 23462 } 23463 } 23464 } 23465 $(document).on("paste.terminal_" + self2.id(), paste_event); 23466 var terminal_init_keymap = $.extend({}, keymap, $.omap(settings2.keymap || {}, function(key, fn2) { 23467 if (!keymap[key]) { 23468 return fn2.bind(self2); 23469 } 23470 return function(e, original) { 23471 return fn2.call(self2, e, function() { 23472 return keymap[key](e, original); 23473 }); 23474 }; 23475 })); 23476 make_interpreter(init_interpreter, settings2.login, function(interpreter) { 23477 if (settings2.completion && typeof settings2.completion !== "boolean" || !settings2.completion) { 23478 interpreter.completion = "settings"; 23479 } 23480 var prompt = settings2.prompt; 23481 if (is_function(prompt)) { 23482 prompt = context_callback_proxy(prompt); 23483 } 23484 interpreters = new Stack($.extend({}, settings2.extra, { 23485 name: settings2.name, 23486 prompt, 23487 keypress: settings2.keypress, 23488 keydown: settings2.keydown, 23489 resize: settings2.onResize, 23490 greetings: settings2.greetings, 23491 mousewheel: settings2.mousewheel, 23492 history: settings2.history, 23493 keymap: terminal_init_keymap 23494 }, interpreter)); 23495 command_line = $("<div/>").appendTo(wrapper).cmd({ 23496 tabindex: settings2.tabindex, 23497 mobileDelete: settings2.mobileDelete, 23498 mobileIgnoreAutoSpace: settings2.mobileIgnoreAutoSpace, 23499 prompt: global_login_fn ? false : prompt, 23500 history: settings2.memory ? "memory" : settings2.history, 23501 historyFilter: settings2.historyFilter, 23502 historySize: settings2.historySize, 23503 caseSensitiveSearch: settings2.caseSensitiveSearch, 23504 onPaste: settings2.onPaste, 23505 width: "100%", 23506 enabled: false, 23507 charWidth: char_size.width, 23508 keydown: key_down, 23509 keymap: terminal_init_keymap, 23510 clickTimeout: settings2.clickTimeout, 23511 holdTimeout: settings2.holdTimeout, 23512 holdRepeatTimeout: settings2.holdRepeatTimeout, 23513 repeatTimeoutKeys: settings2.repeatTimeoutKeys, 23514 allowedAttributes: settings2.allowedAttributes, 23515 keypress: key_press, 23516 tabs: settings2.tabs, 23517 onPositionChange: function() { 23518 var args2 = [].slice.call(arguments); 23519 make_cursor_visible(); 23520 fire_event("onPositionChange", args2); 23521 }, 23522 onCommandChange: function(command) { 23523 if (old_width !== filler.width()) { 23524 self2.resizer(); 23525 } 23526 fire_event("onCommandChange", [command]); 23527 make_cursor_visible(); 23528 }, 23529 commands 23530 }); 23531 function disable(e) { 23532 if (is_mobile) { 23533 return; 23534 } 23535 e = e.originalEvent; 23536 if (e && e.isTrusted) { 23537 var node = document.elementFromPoint(e.clientX, e.clientY); 23538 if (!$(node).closest(".terminal").length && self2.enabled()) { 23539 self2.disable(); 23540 } 23541 } 23542 } 23543 self2.oneTime(100, function() { 23544 $(document).bind("click.terminal_" + self2.id(), disable).bind("contextmenu.terminal_" + self2.id(), disable); 23545 }); 23546 var $win = $(window); 23547 document.addEventListener("resume", function() { 23548 self2.disable(); 23549 }); 23550 if (is_mobile) { 23551 (function() { 23552 self2.addClass("terminal-mobile"); 23553 var start; 23554 var move; 23555 var enabled; 23556 var SENSITIVITY = 3; 23557 var clip = command_line.clip(); 23558 var HOLD_TIME = 200; 23559 var timer; 23560 clip.$node.off("touchstart.cmd"); 23561 self2.on("touchstart.terminal", function(e) { 23562 e = e.originalEvent; 23563 window.touch_event = e; 23564 if (e.target.tagName.toLowerCase() === "a") { 23565 return; 23566 } 23567 if (!frozen && e.touches.length === 1) { 23568 enabled = self2.enabled(); 23569 var point = e.touches[0]; 23570 start = { 23571 x: point.clientX, 23572 y: point.clientY 23573 }; 23574 timer = setTimeout(function() { 23575 start = null; 23576 }, HOLD_TIME); 23577 } 23578 }).on("touchmove.terminal", function(e) { 23579 if (e.touches.length === 1 && start) { 23580 var point = e.touches[0]; 23581 var diff_x = Math.abs(point.clientX - start.x); 23582 var diff_y = Math.abs(point.clientY - start.y); 23583 if (diff_x > SENSITIVITY || diff_y > SENSITIVITY) { 23584 move = true; 23585 } 23586 } 23587 }).on("touchend.terminal", function() { 23588 if (start) { 23589 clearTimeout(timer); 23590 if (!move) { 23591 if (!enabled) { 23592 clip.focus(); 23593 self2.focus(); 23594 setTimeout(function() { 23595 self2.scroll_to_bottom(); 23596 }, 100); 23597 } else { 23598 clip.blur(); 23599 self2.disable(); 23600 } 23601 } 23602 } 23603 move = false; 23604 start = null; 23605 }); 23606 })(); 23607 if ("visualViewport" in window) { 23608 on_height_change(function(height) { 23609 css(document.documentElement, { 23610 "--terminal-force-height": height + "px" 23611 }); 23612 }); 23613 } 23614 } else { 23615 $win.on("focus.terminal_" + self2.id(), focus_terminal).on("blur.terminal_" + self2.id(), blur_terminal); 23616 var was_ctx_event; 23617 (function() { 23618 var count = 0; 23619 var $target; 23620 var name = "click_" + self2.id(); 23621 var textarea = self2.find(".cmd textarea"); 23622 function click() { 23623 if ($target.is(".terminal") || $target.is(".terminal-scroller") || $target.is(".terminal-wrapper")) { 23624 var len = self2.get_command().length; 23625 self2.set_position(len); 23626 } else if ($target.closest(".cmd-prompt").length) { 23627 self2.set_position(0); 23628 } 23629 if (!textarea.is(":focus")) { 23630 textarea.focus(); 23631 } 23632 reset(); 23633 } 23634 function reset() { 23635 count = 0; 23636 $target = null; 23637 } 23638 var ignore_elements = ".terminal-output textarea," + ".terminal-output input"; 23639 self2.mousedown(function(e) { 23640 if (!scrollbar_event(e, filler, pixel_density)) { 23641 $target = $(e.target); 23642 } 23643 }).mouseup(function() { 23644 if (was_ctx_event) { 23645 was_ctx_event = false; 23646 return; 23647 } 23648 if ($target && $target.closest(ignore_elements).length) { 23649 if (enabled) { 23650 self2.disable(); 23651 } 23652 } else if (get_selected_html() === "" && $target) { 23653 if (++count === 1) { 23654 if (!frozen) { 23655 if (!enabled) { 23656 self2.focus(); 23657 self2.scroll_to_bottom(); 23658 } else { 23659 var timeout = settings2.clickTimeout; 23660 self2.oneTime(timeout, name, click); 23661 return; 23662 } 23663 } 23664 } else { 23665 self2.stopTime(name); 23666 } 23667 } 23668 reset(); 23669 }).dblclick(function() { 23670 reset(); 23671 self2.stopTime(name); 23672 }); 23673 })(); 23674 (function() { 23675 var $clip = command_line.clip().$node; 23676 function is_context_event(e) { 23677 return e.type === "mousedown" && e.buttons === 2 || e.type === "contextmenu"; 23678 } 23679 var event_name; 23680 if ("oncontextmenu" in window) { 23681 event_name = "contextmenu.terminal"; 23682 } else { 23683 event_name = "mousedown.terminal"; 23684 } 23685 self2.on(event_name, function(e) { 23686 was_ctx_event = get_selected_html() === "" && is_context_event(e) && !e.ctrlKey; 23687 if (was_ctx_event) { 23688 var $target = $(e.target); 23689 if ($target.is("img,value,audio,object,canvas,a")) { 23690 return; 23691 } 23692 if (!self2.enabled()) { 23693 self2.enable(); 23694 } 23695 var cmd_offset = command_line.offset(); 23696 var cmd_rect = command_line[0].getBoundingClientRect(); 23697 var self_offset = self2.offset(); 23698 var top_limit = self_offset.top - cmd_offset.top; 23699 var top = Math.max(e.pageY - cmd_offset.top - 20, top_limit); 23700 var left = e.pageX - cmd_offset.left - 20; 23701 var height = 4 * 14; 23702 var width = 5 * 14; 23703 var rect = self2[0].getBoundingClientRect(); 23704 var content_width = filler.outerWidth() * pixel_density; 23705 var diff_h = top + cmd_rect.top + height; 23706 diff_h = diff_h - rect.height - rect.top; 23707 var diff_w = left + cmd_rect.left + width; 23708 diff_w = diff_w - content_width - rect.left; 23709 if (diff_h > 0) { 23710 height -= Math.ceil(diff_h); 23711 } 23712 if (diff_w > 0) { 23713 width -= Math.ceil(diff_w); 23714 } 23715 $clip.attr("style", [ 23716 style_prop("left", left, true), 23717 style_prop("top", top, true), 23718 style_prop("width", width, true), 23719 style_prop("height", height, true) 23720 ].join(";")); 23721 if (!$clip.is(":focus")) { 23722 $clip.focus(); 23723 } 23724 self2.stopTime("textarea"); 23725 self2.oneTime(100, "textarea", function() { 23726 var props = { 23727 left: "", 23728 top: "", 23729 width: "", 23730 height: "" 23731 }; 23732 if (!is_css_variables_supported) { 23733 var in_line = self2.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length; 23734 props.top = in_line * 14 + "px"; 23735 } 23736 $clip.css(props); 23737 }); 23738 self2.stopTime("selection"); 23739 self2.everyTime(20, "selection", function() { 23740 if ($clip[0].selection !== $clip[0].value) { 23741 if (get_textarea_selection($clip[0])) { 23742 clear_textarea_selection($clip[0]); 23743 select(self2.find(".terminal-output")[0], self2.find(".cmd div:last-of-type")[0]); 23744 self2.stopTime("selection"); 23745 } 23746 } 23747 }); 23748 } 23749 }); 23750 })(); 23751 self2.on("scroll", function() { 23752 var $textarea = self2.find("textarea"); 23753 var rect = self2[0].getBoundingClientRect(); 23754 var height = self2[0].scrollHeight; 23755 var scrollTop = scroller.scrollTop(); 23756 var diff = height - (scrollTop + rect.height); 23757 if (diff === 0) { 23758 $textarea.css("top", ""); 23759 } else { 23760 $textarea.css("top", -diff); 23761 } 23762 }); 23763 } 23764 self2.on("click", "a", function(e) { 23765 var $this = $(this); 23766 if ($this.closest(".terminal-exception").length) { 23767 var href = $this.attr("href"); 23768 if (href.match(/:[0-9]+$/)) { 23769 e.preventDefault(); 23770 print_line(href, self2.cols()); 23771 } 23772 } 23773 if (enabled) { 23774 self2.find(".cmd textarea").focus(); 23775 } 23776 }); 23777 function calculate_char_size() { 23778 var width = char_size.width; 23779 var height = char_size.height; 23780 char_size = get_char_size(self2); 23781 var css_vars = {}; 23782 if (width !== char_size.width) { 23783 command_line.option("charWidth", char_size.width).refresh(); 23784 css_vars["--char-width"] = char_size.width; 23785 } 23786 if (height !== char_size.height) { 23787 css_vars["--char-height"] = char_size.height; 23788 } 23789 if (Object.keys(css_vars).length) { 23790 css(self2[0], css_vars); 23791 } 23792 } 23793 resize(); 23794 function resize() { 23795 if (self2.is(":visible")) { 23796 var width = filler.width(); 23797 var height = filler.height(); 23798 pixel_density = get_pixel_size(); 23799 if (old_pixel_density !== pixel_density) { 23800 css(self2[0], { 23801 "--pixel-density": pixel_density 23802 }); 23803 } 23804 if (need_char_size_recalculate) { 23805 need_char_size_recalculate = !terminal_ready(self2); 23806 if (!need_char_size_recalculate) { 23807 char_size = get_char_size(self2); 23808 calculate_char_size(); 23809 } 23810 } 23811 if (old_height !== height || old_width !== width || pixel_density !== old_pixel_density) { 23812 self2.resize(); 23813 } 23814 old_height = height; 23815 old_width = width; 23816 container_width = self2.width(); 23817 old_pixel_density = pixel_density; 23818 } 23819 } 23820 function create_resizers() { 23821 var options2 = { 23822 prefix: "terminal-" 23823 }; 23824 self2.resizer("unbind").resizer(resize, options2); 23825 font_resizer.resizer("unbind").resizer(function() { 23826 calculate_char_size(); 23827 self2.resize(); 23828 }, options2); 23829 pixel_resizer.resizer("unbind").resizer(function() { 23830 pixel_density = get_pixel_size(); 23831 self2.refresh(); 23832 }, options2); 23833 $('<div class="terminal-font-forcer terminal-hidden">x<div>').appendTo(self2); 23834 } 23835 function bottom_detect(intersections) { 23836 is_bottom_detected = intersections[0].intersectionRatio >= 0.9; 23837 } 23838 function create_bottom_detect() { 23839 if (window.IntersectionObserver) { 23840 var top = $('<div class="terminal-scroll-marker"/>').appendTo(scroller); 23841 var marker = top; 23842 if (settings2.scrollBottomOffset !== -1) { 23843 var style = style_prop("height", settings2.scrollBottomOffset); 23844 marker = $('<div style="' + style + '"/>').appendTo(top); 23845 } 23846 is_bottom_observer = new IntersectionObserver(bottom_detect, { 23847 root: scroller[0], 23848 rootMargin: "0px", 23849 threshold: 1 23850 }); 23851 is_bottom_observer.observe(marker[0]); 23852 } 23853 } 23854 create_bottom_detect(); 23855 if (self2.is(":visible")) { 23856 create_resizers(); 23857 } 23858 function observe_visibility() { 23859 if (visibility_observer) { 23860 if (visibility_observer.unobserve) { 23861 visibility_observer.unobserve(self2[0]); 23862 } else { 23863 clearInterval(visibility_observer); 23864 } 23865 } 23866 var was_enabled = self2.enabled(); 23867 var visible = self2.is(":visible"); 23868 if (was_enabled && !visible) { 23869 self2.disable(); 23870 } 23871 if (visible) { 23872 create_resizers(); 23873 } else { 23874 wrapper.css("visibility", "hidden"); 23875 } 23876 function visibility_checker() { 23877 if (self2.is(":visible") && !visible) { 23878 visible = true; 23879 create_resizers(); 23880 calculate_char_size(); 23881 resize(); 23882 if (was_enabled) { 23883 self2.enable(); 23884 } 23885 wrapper.css("visibility", ""); 23886 } else if (visible && !self2.is(":visible")) { 23887 visible = false; 23888 was_enabled = $.terminal.active() === self2 && self2.enabled(); 23889 self2.disable(); 23890 wrapper.css("visibility", "hidden"); 23891 } 23892 } 23893 if (window.IntersectionObserver && self2.css("position") !== "fixed") { 23894 visibility_observer = new IntersectionObserver(visibility_checker, { 23895 root: null 23896 }); 23897 visibility_observer.observe(self2[0]); 23898 } else { 23899 visibility_observer = setInterval(visibility_checker, 100); 23900 } 23901 } 23902 var in_dom = !!self2.closest("body").length; 23903 var MutationObsrv = window.MutationObserver || window.WebKitMutationObserver; 23904 if (MutationObsrv) { 23905 mutation_observer = new MutationObsrv(function() { 23906 if (self2.closest("body").length) { 23907 if (!in_dom) { 23908 self2.scroll_to_bottom(); 23909 observe_visibility(); 23910 resize(); 23911 } 23912 in_dom = true; 23913 } else if (in_dom) { 23914 in_dom = false; 23915 } 23916 }); 23917 mutation_observer.observe(document.body, { childList: true }); 23918 } 23919 if (in_dom) { 23920 observe_visibility(); 23921 } 23922 function fonts_ready() { 23923 if (!defunct) { 23924 if (have_custom_font(self2)) { 23925 calculate_char_size(); 23926 self2.resize(); 23927 } 23928 command_queue.resolve(); 23929 } 23930 } 23931 if (document.fonts && document.fonts.ready) { 23932 if (document.fonts.status === "loaded") { 23933 fonts_ready(); 23934 } else { 23935 document.fonts.ready.then(fonts_ready); 23936 } 23937 } else { 23938 command_queue.resolve(); 23939 } 23940 if (enabled && self2.is(":visible") && !is_mobile) { 23941 self2.focus(undefined, true); 23942 } else { 23943 self2.disable(); 23944 } 23945 if (is_function(global_login_fn)) { 23946 self2.login(global_login_fn, true, start); 23947 init_queue.resolve(); 23948 initialize(); 23949 } else { 23950 start(); 23951 initialize(); 23952 } 23953 function exec_spec(spec, options2) { 23954 var terminal = terminals.get()[spec[0]]; 23955 var defer = $.Deferred(); 23956 if (terminal && terminal_id === terminal.id()) { 23957 if (!spec[2]) { 23958 defer.resolve(); 23959 return defer.promise(); 23960 } else if (paused) { 23961 resume_callbacks.push(function() { 23962 return terminal.exec(spec[2], options2).done(function() { 23963 terminal.save_state(spec[2], true, spec[1]); 23964 defer.resolve(); 23965 }); 23966 }); 23967 return defer.promise(); 23968 } else { 23969 return terminal.exec(spec[2], options2).done(function() { 23970 terminal.save_state(spec[2], true, spec[1]); 23971 }); 23972 } 23973 } 23974 } 23975 if (settings2.execHash) { 23976 if (location.hash) { 23977 setTimeout(function() { 23978 try { 23979 var hash = location.hash.replace(/^#/, ""); 23980 hash_commands = JSON.parse(decodeURIComponent(hash)); 23981 if (!hash.match(/\[/)) { 23982 replace_hash(hash_commands); 23983 } 23984 var i = 0; 23985 var options2 = { 23986 typing: settings2.execAnimation, 23987 history: settings2.execHistory, 23988 delay: settings2.execAnimationDelay 23989 }; 23990 (function recur() { 23991 var spec = hash_commands[i++]; 23992 if (spec) { 23993 exec_spec(spec, options2).done(recur); 23994 } else { 23995 change_hash = true; 23996 } 23997 })(); 23998 } catch (e) {} 23999 }); 24000 } else { 24001 change_hash = true; 24002 } 24003 } else { 24004 change_hash = true; 24005 } 24006 (function() { 24007 var shift = false; 24008 $(document).bind("keydown.terminal_" + self2.id(), function(e) { 24009 if (e.shiftKey) { 24010 shift = true; 24011 } 24012 }).bind("keyup.terminal_" + self2.id(), function(e) { 24013 if (e.shiftKey || e.which === 16) { 24014 shift = false; 24015 } 24016 }); 24017 function mousewheel(event, delta) { 24018 if (!shift) { 24019 var interpreter = interpreters.top(); 24020 var ret2; 24021 if (is_function(interpreter.mousewheel)) { 24022 ret2 = interpreter.mousewheel(event, delta, self2); 24023 } else if (is_function(settings2.mousewheel)) { 24024 ret2 = settings2.mousewheel(event, delta, self2); 24025 } 24026 if (ret2 === true) { 24027 return; 24028 } 24029 if ((have_scrollbar() || ret2 === false) && !event.ctrlKey) { 24030 event.stopPropagation(); 24031 event.preventDefault(); 24032 } 24033 if (ret2 === false) { 24034 return false; 24035 } 24036 if (delta > 0) { 24037 self2.scroll(-40); 24038 } else { 24039 self2.scroll(40); 24040 } 24041 } 24042 } 24043 if ($.event.special.mousewheel) { 24044 scroller.on("mousewheel", mousewheel); 24045 } else { 24046 var event; 24047 var div = document.createElement("div"); 24048 if ("onwheel" in div) { 24049 event = "wheel"; 24050 } else if (document.onmousewheel !== undefined) { 24051 event = "mousewheel"; 24052 } else { 24053 event = "DOMMouseScroll"; 24054 } 24055 div = null; 24056 self2.on(event, function(e) { 24057 var delta; 24058 if (event === "mousewheel") { 24059 delta = -1 / 40 * e.originalEvent.wheelDelta; 24060 } else { 24061 delta = e.originalEvent.deltaY || e.originalEvent.detail; 24062 } 24063 mousewheel(e, -delta); 24064 }); 24065 } 24066 scroller.touch_scroll(function(event) { 24067 var delta = event.current.clientY - event.previous.clientY; 24068 var ret2; 24069 var interpreter = interpreters.top(); 24070 if (is_function(interpreter.touchscroll)) { 24071 ret2 = interpreter.touchscroll(event, delta, self2); 24072 } else if (is_function(settings2.touchscroll)) { 24073 ret2 = settings2.touchscroll(event, delta, self2); 24074 } 24075 css(self2[0], { 24076 "--terminal-scroll": scroller.prop("scrollTop") 24077 }); 24078 if (ret2 === true) { 24079 return; 24080 } 24081 return false; 24082 }); 24083 })(); 24084 }); 24085 return self2; 24086 }; 24087 }); 24088}); 24089
24090// vendor/bundle/ruby/3.4.0/bundler/gems/humantheme-94cd7d067f0d/app/assets/javascripts/jquery-init.js 24091var import_jquery = __toESM(require_jquery()); 24092window.jQuery = import_jquery.default; 24093window.$ = import_jquery.default; 24094
24095// vendor/bundle/ruby/3.4.0/bundler/gems/humantheme-94cd7d067f0d/app/assets/javascripts/humantheme.js 24096var import_bootstrap = __toESM(require_bootstrap()); 24097var import_vanilla_lazyload = __toESM(require_lazyload_min()); 24098
vendor: 12,998 bytes, lines 24099-24463
24099// node_modules/intersection-observer/intersection-observer.js 24100(function() { 24101 if (typeof window !== "object") { 24102 return; 24103 } 24104 if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) { 24105 if (!("isIntersecting" in window.IntersectionObserverEntry.prototype)) { 24106 Object.defineProperty(window.IntersectionObserverEntry.prototype, "isIntersecting", { 24107 get: function() { 24108 return this.intersectionRatio > 0; 24109 } 24110 }); 24111 } 24112 return; 24113 } 24114 var document2 = window.document; 24115 var registry = []; 24116 function IntersectionObserverEntry(entry) { 24117 this.time = entry.time; 24118 this.target = entry.target; 24119 this.rootBounds = entry.rootBounds; 24120 this.boundingClientRect = entry.boundingClientRect; 24121 this.intersectionRect = entry.intersectionRect || getEmptyRect(); 24122 this.isIntersecting = !!entry.intersectionRect; 24123 var targetRect = this.boundingClientRect; 24124 var targetArea = targetRect.width * targetRect.height; 24125 var intersectionRect = this.intersectionRect; 24126 var intersectionArea = intersectionRect.width * intersectionRect.height; 24127 if (targetArea) { 24128 this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4)); 24129 } else { 24130 this.intersectionRatio = this.isIntersecting ? 1 : 0; 24131 } 24132 } 24133 function IntersectionObserver2(callback, opt_options) { 24134 var options2 = opt_options || {}; 24135 if (typeof callback != "function") { 24136 throw new Error("callback must be a function"); 24137 } 24138 if (options2.root && options2.root.nodeType != 1) { 24139 throw new Error("root must be an Element"); 24140 } 24141 this._checkForIntersections = throttle(this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT); 24142 this._callback = callback; 24143 this._observationTargets = []; 24144 this._queuedEntries = []; 24145 this._rootMarginValues = this._parseRootMargin(options2.rootMargin); 24146 this.thresholds = this._initThresholds(options2.threshold); 24147 this.root = options2.root || null; 24148 this.rootMargin = this._rootMarginValues.map(function(margin) { 24149 return margin.value + margin.unit; 24150 }).join(" "); 24151 } 24152 IntersectionObserver2.prototype.THROTTLE_TIMEOUT = 100; 24153 IntersectionObserver2.prototype.POLL_INTERVAL = null; 24154 IntersectionObserver2.prototype.USE_MUTATION_OBSERVER = true; 24155 IntersectionObserver2.prototype.observe = function(target) { 24156 var isTargetAlreadyObserved = this._observationTargets.some(function(item) { 24157 return item.element == target; 24158 }); 24159 if (isTargetAlreadyObserved) { 24160 return; 24161 } 24162 if (!(target && target.nodeType == 1)) { 24163 throw new Error("target must be an Element"); 24164 } 24165 this._registerInstance(); 24166 this._observationTargets.push({ element: target, entry: null }); 24167 this._monitorIntersections(); 24168 this._checkForIntersections(); 24169 }; 24170 IntersectionObserver2.prototype.unobserve = function(target) { 24171 this._observationTargets = this._observationTargets.filter(function(item) { 24172 return item.element != target; 24173 }); 24174 if (!this._observationTargets.length) { 24175 this._unmonitorIntersections(); 24176 this._unregisterInstance(); 24177 } 24178 }; 24179 IntersectionObserver2.prototype.disconnect = function() { 24180 this._observationTargets = []; 24181 this._unmonitorIntersections(); 24182 this._unregisterInstance(); 24183 }; 24184 IntersectionObserver2.prototype.takeRecords = function() { 24185 var records = this._queuedEntries.slice(); 24186 this._queuedEntries = []; 24187 return records; 24188 }; 24189 IntersectionObserver2.prototype._initThresholds = function(opt_threshold) { 24190 var threshold = opt_threshold || [0]; 24191 if (!Array.isArray(threshold)) 24192 threshold = [threshold]; 24193 return threshold.sort().filter(function(t, i, a) { 24194 if (typeof t != "number" || isNaN(t) || t < 0 || t > 1) { 24195 throw new Error("threshold must be a number between 0 and 1 inclusively"); 24196 } 24197 return t !== a[i - 1]; 24198 }); 24199 }; 24200 IntersectionObserver2.prototype._parseRootMargin = function(opt_rootMargin) { 24201 var marginString = opt_rootMargin || "0px"; 24202 var margins = marginString.split(/\s+/).map(function(margin) { 24203 var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin); 24204 if (!parts) { 24205 throw new Error("rootMargin must be specified in pixels or percent"); 24206 } 24207 return { value: parseFloat(parts[1]), unit: parts[2] }; 24208 }); 24209 margins[1] = margins[1] || margins[0]; 24210 margins[2] = margins[2] || margins[0]; 24211 margins[3] = margins[3] || margins[1]; 24212 return margins; 24213 }; 24214 IntersectionObserver2.prototype._monitorIntersections = function() { 24215 if (!this._monitoringIntersections) { 24216 this._monitoringIntersections = true; 24217 if (this.POLL_INTERVAL) { 24218 this._monitoringInterval = setInterval(this._checkForIntersections, this.POLL_INTERVAL); 24219 } else { 24220 addEvent(window, "resize", this._checkForIntersections, true); 24221 addEvent(document2, "scroll", this._checkForIntersections, true); 24222 if (this.USE_MUTATION_OBSERVER && "MutationObserver" in window) { 24223 this._domObserver = new MutationObserver(this._checkForIntersections); 24224 this._domObserver.observe(document2, { 24225 attributes: true, 24226 childList: true, 24227 characterData: true, 24228 subtree: true 24229 }); 24230 } 24231 } 24232 } 24233 }; 24234 IntersectionObserver2.prototype._unmonitorIntersections = function() { 24235 if (this._monitoringIntersections) { 24236 this._monitoringIntersections = false; 24237 clearInterval(this._monitoringInterval); 24238 this._monitoringInterval = null; 24239 removeEvent(window, "resize", this._checkForIntersections, true); 24240 removeEvent(document2, "scroll", this._checkForIntersections, true); 24241 if (this._domObserver) { 24242 this._domObserver.disconnect(); 24243 this._domObserver = null; 24244 } 24245 } 24246 }; 24247 IntersectionObserver2.prototype._checkForIntersections = function() { 24248 var rootIsInDom = this._rootIsInDom(); 24249 var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect(); 24250 this._observationTargets.forEach(function(item) { 24251 var target = item.element; 24252 var targetRect = getBoundingClientRect(target); 24253 var rootContainsTarget = this._rootContainsTarget(target); 24254 var oldEntry = item.entry; 24255 var intersectionRect = rootIsInDom && rootContainsTarget && this._computeTargetAndRootIntersection(target, rootRect); 24256 var newEntry = item.entry = new IntersectionObserverEntry({ 24257 time: now(), 24258 target, 24259 boundingClientRect: targetRect, 24260 rootBounds: rootRect, 24261 intersectionRect 24262 }); 24263 if (!oldEntry) { 24264 this._queuedEntries.push(newEntry); 24265 } else if (rootIsInDom && rootContainsTarget) { 24266 if (this._hasCrossedThreshold(oldEntry, newEntry)) { 24267 this._queuedEntries.push(newEntry); 24268 } 24269 } else { 24270 if (oldEntry && oldEntry.isIntersecting) { 24271 this._queuedEntries.push(newEntry); 24272 } 24273 } 24274 }, this); 24275 if (this._queuedEntries.length) { 24276 this._callback(this.takeRecords(), this); 24277 } 24278 }; 24279 IntersectionObserver2.prototype._computeTargetAndRootIntersection = function(target, rootRect) { 24280 if (window.getComputedStyle(target).display == "none") 24281 return; 24282 var targetRect = getBoundingClientRect(target); 24283 var intersectionRect = targetRect; 24284 var parent = getParentNode(target); 24285 var atRoot = false; 24286 while (!atRoot) { 24287 var parentRect = null; 24288 var parentComputedStyle = parent.nodeType == 1 ? window.getComputedStyle(parent) : {}; 24289 if (parentComputedStyle.display == "none") 24290 return; 24291 if (parent == this.root || parent == document2) { 24292 atRoot = true; 24293 parentRect = rootRect; 24294 } else { 24295 if (parent != document2.body && parent != document2.documentElement && parentComputedStyle.overflow != "visible") { 24296 parentRect = getBoundingClientRect(parent); 24297 } 24298 } 24299 if (parentRect) { 24300 intersectionRect = computeRectIntersection(parentRect, intersectionRect); 24301 if (!intersectionRect) 24302 break; 24303 } 24304 parent = getParentNode(parent); 24305 } 24306 return intersectionRect; 24307 }; 24308 IntersectionObserver2.prototype._getRootRect = function() { 24309 var rootRect; 24310 if (this.root) { 24311 rootRect = getBoundingClientRect(this.root); 24312 } else { 24313 var html = document2.documentElement; 24314 var body = document2.body; 24315 rootRect = { 24316 top: 0, 24317 left: 0, 24318 right: html.clientWidth || body.clientWidth, 24319 width: html.clientWidth || body.clientWidth, 24320 bottom: html.clientHeight || body.clientHeight, 24321 height: html.clientHeight || body.clientHeight 24322 }; 24323 } 24324 return this._expandRectByRootMargin(rootRect); 24325 }; 24326 IntersectionObserver2.prototype._expandRectByRootMargin = function(rect) { 24327 var margins = this._rootMarginValues.map(function(margin, i) { 24328 return margin.unit == "px" ? margin.value : margin.value * (i % 2 ? rect.width : rect.height) / 100; 24329 }); 24330 var newRect = { 24331 top: rect.top - margins[0], 24332 right: rect.right + margins[1], 24333 bottom: rect.bottom + margins[2], 24334 left: rect.left - margins[3] 24335 }; 24336 newRect.width = newRect.right - newRect.left; 24337 newRect.height = newRect.bottom - newRect.top; 24338 return newRect; 24339 }; 24340 IntersectionObserver2.prototype._hasCrossedThreshold = function(oldEntry, newEntry) { 24341 var oldRatio = oldEntry && oldEntry.isIntersecting ? oldEntry.intersectionRatio || 0 : -1; 24342 var newRatio = newEntry.isIntersecting ? newEntry.intersectionRatio || 0 : -1; 24343 if (oldRatio === newRatio) 24344 return; 24345 for (var i = 0;i < this.thresholds.length; i++) { 24346 var threshold = this.thresholds[i]; 24347 if (threshold == oldRatio || threshold == newRatio || threshold < oldRatio !== threshold < newRatio) { 24348 return true; 24349 } 24350 } 24351 }; 24352 IntersectionObserver2.prototype._rootIsInDom = function() { 24353 return !this.root || containsDeep(document2, this.root); 24354 }; 24355 IntersectionObserver2.prototype._rootContainsTarget = function(target) { 24356 return containsDeep(this.root || document2, target); 24357 }; 24358 IntersectionObserver2.prototype._registerInstance = function() { 24359 if (registry.indexOf(this) < 0) { 24360 registry.push(this); 24361 } 24362 }; 24363 IntersectionObserver2.prototype._unregisterInstance = function() { 24364 var index = registry.indexOf(this); 24365 if (index != -1) 24366 registry.splice(index, 1); 24367 }; 24368 function now() { 24369 return window.performance && performance.now && performance.now(); 24370 } 24371 function throttle(fn2, timeout) { 24372 var timer = null; 24373 return function() { 24374 if (!timer) { 24375 timer = setTimeout(function() { 24376 fn2(); 24377 timer = null; 24378 }, timeout); 24379 } 24380 }; 24381 } 24382 function addEvent(node, event, fn2, opt_useCapture) { 24383 if (typeof node.addEventListener == "function") { 24384 node.addEventListener(event, fn2, opt_useCapture || false); 24385 } else if (typeof node.attachEvent == "function") { 24386 node.attachEvent("on" + event, fn2); 24387 } 24388 } 24389 function removeEvent(node, event, fn2, opt_useCapture) { 24390 if (typeof node.removeEventListener == "function") { 24391 node.removeEventListener(event, fn2, opt_useCapture || false); 24392 } else if (typeof node.detatchEvent == "function") { 24393 node.detatchEvent("on" + event, fn2); 24394 } 24395 } 24396 function computeRectIntersection(rect1, rect2) { 24397 var top = Math.max(rect1.top, rect2.top); 24398 var bottom = Math.min(rect1.bottom, rect2.bottom); 24399 var left = Math.max(rect1.left, rect2.left); 24400 var right = Math.min(rect1.right, rect2.right); 24401 var width = right - left; 24402 var height = bottom - top; 24403 return width >= 0 && height >= 0 && { 24404 top, 24405 bottom, 24406 left, 24407 right, 24408 width, 24409 height 24410 }; 24411 } 24412 function getBoundingClientRect(el) { 24413 var rect; 24414 try { 24415 rect = el.getBoundingClientRect(); 24416 } catch (err) {} 24417 if (!rect) 24418 return getEmptyRect(); 24419 if (!(rect.width && rect.height)) { 24420 rect = { 24421 top: rect.top, 24422 right: rect.right, 24423 bottom: rect.bottom, 24424 left: rect.left, 24425 width: rect.right - rect.left, 24426 height: rect.bottom - rect.top 24427 }; 24428 } 24429 return rect; 24430 } 24431 function getEmptyRect() { 24432 return { 24433 top: 0, 24434 bottom: 0, 24435 left: 0, 24436 right: 0, 24437 width: 0, 24438 height: 0 24439 }; 24440 } 24441 function containsDeep(parent, child) { 24442 var node = child; 24443 while (node) { 24444 if (node == parent) 24445 return true; 24446 node = getParentNode(node); 24447 } 24448 return false; 24449 } 24450 function getParentNode(node) { 24451 var parent = node.parentNode; 24452 if (parent && parent.nodeType == 11 && parent.host) { 24453 return parent.host; 24454 } 24455 if (parent && parent.assignedSlot) { 24456 return parent.assignedSlot.parentNode; 24457 } 24458 return parent; 24459 } 24460 window.IntersectionObserver = IntersectionObserver2; 24461 window.IntersectionObserverEntry = IntersectionObserverEntry; 24462})(); 24463
24464// vendor/bundle/ruby/3.4.0/bundler/gems/humantheme-94cd7d067f0d/app/assets/javascripts/humantheme/google_analytics_pageview.js 24465$(document).on("turbo:load", function() { 24466 if (typeof ga === "function") { 24467 ga("set", "location", window.location.href.split("#")[0]); 24468 ga("send", "pageview"); 24469 } 24470}); 24471
24472// vendor/bundle/ruby/3.4.0/bundler/gems/humantheme-94cd7d067f0d/app/assets/javascripts/humantheme/topbar.js 24473var ready = function() { 24474 let toggleMenu = document.getElementsByClassName("toggle-menu")[0]; 24475 toggleMenu.addEventListener("click", function(e) { 24476 e.preventDefault(); 24477 document.getElementsByClassName("main-nav")[0].classList.toggle("show"); 24478 }); 24479}; 24480$(document).on("turbo:load", ready); 24481
24482// vendor/bundle/ruby/3.4.0/bundler/gems/humantheme-94cd7d067f0d/app/assets/javascripts/humantheme.js 24483var lazyLoadInstance = new import_vanilla_lazyload.default({ 24484 elements_selector: ".lazy" 24485}); 24486window.lazyLoadInstance = lazyLoadInstance; 24487document.addEventListener("turbo:load", function() { 24488 lazyLoadInstance.update(); 24489}); 24490
vendor: 167,853 bytes, lines 24491-29711
24491// node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js 24492var exports_turbo_es2017_esm = {}; 24493__export(exports_turbo_es2017_esm, { 24494 FetchEnctype: () => FetchEnctype, 24495 FetchMethod: () => FetchMethod, 24496 FetchRequest: () => FetchRequest, 24497 FetchResponse: () => FetchResponse, 24498 FrameElement: () => FrameElement, 24499 FrameLoadingStyle: () => FrameLoadingStyle, 24500 FrameRenderer: () => FrameRenderer, 24501 PageRenderer: () => PageRenderer, 24502 PageSnapshot: () => PageSnapshot, 24503 StreamActions: () => StreamActions, 24504 StreamElement: () => StreamElement, 24505 StreamSourceElement: () => StreamSourceElement, 24506 cache: () => cache, 24507 config: () => config, 24508 connectStreamSource: () => connectStreamSource, 24509 disconnectStreamSource: () => disconnectStreamSource, 24510 fetch: () => fetchWithTurboHeaders, 24511 fetchEnctypeFromString: () => fetchEnctypeFromString, 24512 fetchMethodFromString: () => fetchMethodFromString, 24513 isSafe: () => isSafe, 24514 morphBodyElements: () => morphBodyElements, 24515 morphChildren: () => morphChildren, 24516 morphElements: () => morphElements, 24517 morphTurboFrameElements: () => morphTurboFrameElements, 24518 navigator: () => navigator2, 24519 registerAdapter: () => registerAdapter, 24520 renderStreamMessage: () => renderStreamMessage, 24521 session: () => session, 24522 setConfirmMethod: () => setConfirmMethod, 24523 setFormMode: () => setFormMode, 24524 setProgressBarDelay: () => setProgressBarDelay, 24525 start: () => start, 24526 visit: () => visit 24527}); 24528/*! 24529Turbo 8.0.21 24530Copyright © 2026 37signals LLC 24531 */ 24532var FrameLoadingStyle = { 24533 eager: "eager", 24534 lazy: "lazy" 24535}; 24536 24537class FrameElement extends HTMLElement { 24538 static delegateConstructor = undefined; 24539 loaded = Promise.resolve(); 24540 static get observedAttributes() { 24541 return ["disabled", "loading", "src"]; 24542 } 24543 constructor() { 24544 super(); 24545 this.delegate = new FrameElement.delegateConstructor(this); 24546 } 24547 connectedCallback() { 24548 this.delegate.connect(); 24549 } 24550 disconnectedCallback() { 24551 this.delegate.disconnect(); 24552 } 24553 reload() { 24554 return this.delegate.sourceURLReloaded(); 24555 } 24556 attributeChangedCallback(name) { 24557 if (name == "loading") { 24558 this.delegate.loadingStyleChanged(); 24559 } else if (name == "src") { 24560 this.delegate.sourceURLChanged(); 24561 } else if (name == "disabled") { 24562 this.delegate.disabledChanged(); 24563 } 24564 } 24565 get src() { 24566 return this.getAttribute("src"); 24567 } 24568 set src(value) { 24569 if (value) { 24570 this.setAttribute("src", value); 24571 } else { 24572 this.removeAttribute("src"); 24573 } 24574 } 24575 get refresh() { 24576 return this.getAttribute("refresh"); 24577 } 24578 set refresh(value) { 24579 if (value) { 24580 this.setAttribute("refresh", value); 24581 } else { 24582 this.removeAttribute("refresh"); 24583 } 24584 } 24585 get shouldReloadWithMorph() { 24586 return this.src && this.refresh === "morph"; 24587 } 24588 get loading() { 24589 return frameLoadingStyleFromString(this.getAttribute("loading") || ""); 24590 } 24591 set loading(value) { 24592 if (value) { 24593 this.setAttribute("loading", value); 24594 } else { 24595 this.removeAttribute("loading"); 24596 } 24597 } 24598 get disabled() { 24599 return this.hasAttribute("disabled"); 24600 } 24601 set disabled(value) { 24602 if (value) { 24603 this.setAttribute("disabled", ""); 24604 } else { 24605 this.removeAttribute("disabled"); 24606 } 24607 } 24608 get autoscroll() { 24609 return this.hasAttribute("autoscroll"); 24610 } 24611 set autoscroll(value) { 24612 if (value) { 24613 this.setAttribute("autoscroll", ""); 24614 } else { 24615 this.removeAttribute("autoscroll"); 24616 } 24617 } 24618 get complete() { 24619 return !this.delegate.isLoading; 24620 } 24621 get isActive() { 24622 return this.ownerDocument === document && !this.isPreview; 24623 } 24624 get isPreview() { 24625 return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview"); 24626 } 24627} 24628function frameLoadingStyleFromString(style) { 24629 switch (style.toLowerCase()) { 24630 case "lazy": 24631 return FrameLoadingStyle.lazy; 24632 default: 24633 return FrameLoadingStyle.eager; 24634 } 24635} 24636var drive = { 24637 enabled: true, 24638 progressBarDelay: 500, 24639 unvisitableExtensions: new Set([ 24640 ".7z", 24641 ".aac", 24642 ".apk", 24643 ".avi", 24644 ".bmp", 24645 ".bz2", 24646 ".css", 24647 ".csv", 24648 ".deb", 24649 ".dmg", 24650 ".doc", 24651 ".docx", 24652 ".exe", 24653 ".gif", 24654 ".gz", 24655 ".heic", 24656 ".heif", 24657 ".ico", 24658 ".iso", 24659 ".jpeg", 24660 ".jpg", 24661 ".js", 24662 ".json", 24663 ".m4a", 24664 ".mkv", 24665 ".mov", 24666 ".mp3", 24667 ".mp4", 24668 ".mpeg", 24669 ".mpg", 24670 ".msi", 24671 ".ogg", 24672 ".ogv", 24673 ".pdf", 24674 ".pkg", 24675 ".png", 24676 ".ppt", 24677 ".pptx", 24678 ".rar", 24679 ".rtf", 24680 ".svg", 24681 ".tar", 24682 ".tif", 24683 ".tiff", 24684 ".txt", 24685 ".wav", 24686 ".webm", 24687 ".webp", 24688 ".wma", 24689 ".wmv", 24690 ".xls", 24691 ".xlsx", 24692 ".xml", 24693 ".zip" 24694 ]) 24695}; 24696function activateScriptElement(element) { 24697 if (element.getAttribute("data-turbo-eval") == "false") { 24698 return element; 24699 } else { 24700 const createdScriptElement = document.createElement("script"); 24701 const cspNonce = getCspNonce(); 24702 if (cspNonce) { 24703 createdScriptElement.nonce = cspNonce; 24704 } 24705 createdScriptElement.textContent = element.textContent; 24706 createdScriptElement.async = false; 24707 copyElementAttributes(createdScriptElement, element); 24708 return createdScriptElement; 24709 } 24710} 24711function copyElementAttributes(destinationElement, sourceElement) { 24712 for (const { name, value } of sourceElement.attributes) { 24713 destinationElement.setAttribute(name, value); 24714 } 24715} 24716function createDocumentFragment(html) { 24717 const template = document.createElement("template"); 24718 template.innerHTML = html; 24719 return template.content; 24720} 24721function dispatch(eventName, { target, cancelable, detail } = {}) { 24722 const event = new CustomEvent(eventName, { 24723 cancelable, 24724 bubbles: true, 24725 composed: true, 24726 detail 24727 }); 24728 if (target && target.isConnected) { 24729 target.dispatchEvent(event); 24730 } else { 24731 document.documentElement.dispatchEvent(event); 24732 } 24733 return event; 24734} 24735function cancelEvent(event) { 24736 event.preventDefault(); 24737 event.stopImmediatePropagation(); 24738} 24739function nextRepaint() { 24740 if (document.visibilityState === "hidden") { 24741 return nextEventLoopTick(); 24742 } else { 24743 return nextAnimationFrame(); 24744 } 24745} 24746function nextAnimationFrame() { 24747 return new Promise((resolve) => requestAnimationFrame(() => resolve())); 24748} 24749function nextEventLoopTick() { 24750 return new Promise((resolve) => setTimeout(() => resolve(), 0)); 24751} 24752function parseHTMLDocument(html = "") { 24753 return new DOMParser().parseFromString(html, "text/html"); 24754} 24755function unindent(strings, ...values) { 24756 const lines = interpolate(strings, values).replace(/^\n/, "").split(` 24757`); 24758 const match = lines[0].match(/^\s+/); 24759 const indent = match ? match[0].length : 0; 24760 return lines.map((line) => line.slice(indent)).join(` 24761`); 24762} 24763function interpolate(strings, values) { 24764 return strings.reduce((result, string2, i) => { 24765 const value = values[i] == undefined ? "" : values[i]; 24766 return result + string2 + value; 24767 }, ""); 24768} 24769function uuid() { 24770 return Array.from({ length: 36 }).map((_, i) => { 24771 if (i == 8 || i == 13 || i == 18 || i == 23) { 24772 return "-"; 24773 } else if (i == 14) { 24774 return "4"; 24775 } else if (i == 19) { 24776 return (Math.floor(Math.random() * 4) + 8).toString(16); 24777 } else { 24778 return Math.floor(Math.random() * 16).toString(16); 24779 } 24780 }).join(""); 24781} 24782function getAttribute(attributeName, ...elements) { 24783 for (const value of elements.map((element) => element?.getAttribute(attributeName))) { 24784 if (typeof value == "string") 24785 return value; 24786 } 24787 return null; 24788} 24789function hasAttribute(attributeName, ...elements) { 24790 return elements.some((element) => element && element.hasAttribute(attributeName)); 24791} 24792function markAsBusy(...elements) { 24793 for (const element of elements) { 24794 if (element.localName == "turbo-frame") { 24795 element.setAttribute("busy", ""); 24796 } 24797 element.setAttribute("aria-busy", "true"); 24798 } 24799} 24800function clearBusyState(...elements) { 24801 for (const element of elements) { 24802 if (element.localName == "turbo-frame") { 24803 element.removeAttribute("busy"); 24804 } 24805 element.removeAttribute("aria-busy"); 24806 } 24807} 24808function waitForLoad(element, timeoutInMilliseconds = 2000) { 24809 return new Promise((resolve) => { 24810 const onComplete = () => { 24811 element.removeEventListener("error", onComplete); 24812 element.removeEventListener("load", onComplete); 24813 resolve(); 24814 }; 24815 element.addEventListener("load", onComplete, { once: true }); 24816 element.addEventListener("error", onComplete, { once: true }); 24817 setTimeout(resolve, timeoutInMilliseconds); 24818 }); 24819} 24820function getHistoryMethodForAction(action) { 24821 switch (action) { 24822 case "replace": 24823 return history.replaceState; 24824 case "advance": 24825 case "restore": 24826 return history.pushState; 24827 } 24828} 24829function isAction(action) { 24830 return action == "advance" || action == "replace" || action == "restore"; 24831} 24832function getVisitAction(...elements) { 24833 const action = getAttribute("data-turbo-action", ...elements); 24834 return isAction(action) ? action : null; 24835} 24836function getMetaElement(name) { 24837 return document.querySelector(`meta[name="${name}"]`); 24838} 24839function getMetaContent(name) { 24840 const element = getMetaElement(name); 24841 return element && element.content; 24842} 24843function getCspNonce() { 24844 const element = getMetaElement("csp-nonce"); 24845 if (element) { 24846 const { nonce, content } = element; 24847 return nonce == "" ? content : nonce; 24848 } 24849} 24850function setMetaContent(name, content) { 24851 let element = getMetaElement(name); 24852 if (!element) { 24853 element = document.createElement("meta"); 24854 element.setAttribute("name", name); 24855 document.head.appendChild(element); 24856 } 24857 element.setAttribute("content", content); 24858 return element; 24859} 24860function findClosestRecursively(element, selector) { 24861 if (element instanceof Element) { 24862 return element.closest(selector) || findClosestRecursively(element.assignedSlot || element.getRootNode()?.host, selector); 24863 } 24864} 24865function elementIsFocusable(element) { 24866 const inertDisabledOrHidden = "[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"; 24867 return !!element && element.closest(inertDisabledOrHidden) == null && typeof element.focus == "function"; 24868} 24869function queryAutofocusableElement(elementOrDocumentFragment) { 24870 return Array.from(elementOrDocumentFragment.querySelectorAll("[autofocus]")).find(elementIsFocusable); 24871} 24872async function around(callback, reader) { 24873 const before = reader(); 24874 callback(); 24875 await nextAnimationFrame(); 24876 const after = reader(); 24877 return [before, after]; 24878} 24879function doesNotTargetIFrame(name) { 24880 if (name === "_blank") { 24881 return false; 24882 } else if (name) { 24883 for (const element of document.getElementsByName(name)) { 24884 if (element instanceof HTMLIFrameElement) 24885 return false; 24886 } 24887 return true; 24888 } else { 24889 return true; 24890 } 24891} 24892function findLinkFromClickTarget(target) { 24893 const link = findClosestRecursively(target, "a[href], a[xlink\\:href]"); 24894 if (!link) 24895 return null; 24896 if (link.href.startsWith("#")) 24897 return null; 24898 if (link.hasAttribute("download")) 24899 return null; 24900 const linkTarget = link.getAttribute("target"); 24901 if (linkTarget && linkTarget !== "_self") 24902 return null; 24903 return link; 24904} 24905function debounce2(fn2, delay) { 24906 let timeoutId = null; 24907 return (...args2) => { 24908 const callback = () => fn2.apply(this, args2); 24909 clearTimeout(timeoutId); 24910 timeoutId = setTimeout(callback, delay); 24911 }; 24912} 24913var submitter = { 24914 "aria-disabled": { 24915 beforeSubmit: (submitter) => { 24916 submitter.setAttribute("aria-disabled", "true"); 24917 submitter.addEventListener("click", cancelEvent); 24918 }, 24919 afterSubmit: (submitter) => { 24920 submitter.removeAttribute("aria-disabled"); 24921 submitter.removeEventListener("click", cancelEvent); 24922 } 24923 }, 24924 disabled: { 24925 beforeSubmit: (submitter) => submitter.disabled = true, 24926 afterSubmit: (submitter) => submitter.disabled = false 24927 } 24928}; 24929 24930class Config { 24931 #submitter = null; 24932 constructor(config2) { 24933 Object.assign(this, config2); 24934 } 24935 get submitter() { 24936 return this.#submitter; 24937 } 24938 set submitter(value) { 24939 this.#submitter = submitter[value] || value; 24940 } 24941} 24942var forms = new Config({ 24943 mode: "on", 24944 submitter: "disabled" 24945}); 24946var config = { 24947 drive, 24948 forms 24949}; 24950function expandURL(locatable) { 24951 return new URL(locatable.toString(), document.baseURI); 24952} 24953function getAnchor(url) { 24954 let anchorMatch; 24955 if (url.hash) { 24956 return url.hash.slice(1); 24957 } else if (anchorMatch = url.href.match(/#(.*)$/)) { 24958 return anchorMatch[1]; 24959 } 24960} 24961function getAction$1(form, submitter) { 24962 const action = submitter?.getAttribute("formaction") || form.getAttribute("action") || form.action; 24963 return expandURL(action); 24964} 24965function getExtension(url) { 24966 return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || ""; 24967} 24968function isPrefixedBy(baseURL, url) { 24969 const prefix = addTrailingSlash(url.origin + url.pathname); 24970 return addTrailingSlash(baseURL.href) === prefix || baseURL.href.startsWith(prefix); 24971} 24972function locationIsVisitable(location2, rootLocation) { 24973 return isPrefixedBy(location2, rootLocation) && !config.drive.unvisitableExtensions.has(getExtension(location2)); 24974} 24975function getLocationForLink(link) { 24976 return expandURL(link.getAttribute("href") || ""); 24977} 24978function getRequestURL(url) { 24979 const anchor = getAnchor(url); 24980 return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href; 24981} 24982function toCacheKey(url) { 24983 return getRequestURL(url); 24984} 24985function urlsAreEqual(left, right) { 24986 return expandURL(left).href == expandURL(right).href; 24987} 24988function getPathComponents(url) { 24989 return url.pathname.split("/").slice(1); 24990} 24991function getLastPathComponent(url) { 24992 return getPathComponents(url).slice(-1)[0]; 24993} 24994function addTrailingSlash(value) { 24995 return value.endsWith("/") ? value : value + "/"; 24996} 24997 24998class FetchResponse { 24999 constructor(response) { 25000 this.response = response; 25001 } 25002 get succeeded() { 25003 return this.response.ok; 25004 } 25005 get failed() { 25006 return !this.succeeded; 25007 } 25008 get clientError() { 25009 return this.statusCode >= 400 && this.statusCode <= 499; 25010 } 25011 get serverError() { 25012 return this.statusCode >= 500 && this.statusCode <= 599; 25013 } 25014 get redirected() { 25015 return this.response.redirected; 25016 } 25017 get location() { 25018 return expandURL(this.response.url); 25019 } 25020 get isHTML() { 25021 return this.contentType && this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/); 25022 } 25023 get statusCode() { 25024 return this.response.status; 25025 } 25026 get contentType() { 25027 return this.header("Content-Type"); 25028 } 25029 get responseText() { 25030 return this.response.clone().text(); 25031 } 25032 get responseHTML() { 25033 if (this.isHTML) { 25034 return this.response.clone().text(); 25035 } else { 25036 return Promise.resolve(undefined); 25037 } 25038 } 25039 header(name) { 25040 return this.response.headers.get(name); 25041 } 25042} 25043 25044class LimitedSet extends Set { 25045 constructor(maxSize) { 25046 super(); 25047 this.maxSize = maxSize; 25048 } 25049 add(value) { 25050 if (this.size >= this.maxSize) { 25051 const iterator = this.values(); 25052 const oldestValue = iterator.next().value; 25053 this.delete(oldestValue); 25054 } 25055 super.add(value); 25056 } 25057} 25058var recentRequests = new LimitedSet(20); 25059function fetchWithTurboHeaders(url, options2 = {}) { 25060 const modifiedHeaders = new Headers(options2.headers || {}); 25061 const requestUID = uuid(); 25062 recentRequests.add(requestUID); 25063 modifiedHeaders.append("X-Turbo-Request-Id", requestUID); 25064 return window.fetch(url, { 25065 ...options2, 25066 headers: modifiedHeaders 25067 }); 25068} 25069function fetchMethodFromString(method) { 25070 switch (method.toLowerCase()) { 25071 case "get": 25072 return FetchMethod.get; 25073 case "post": 25074 return FetchMethod.post; 25075 case "put": 25076 return FetchMethod.put; 25077 case "patch": 25078 return FetchMethod.patch; 25079 case "delete": 25080 return FetchMethod.delete; 25081 } 25082} 25083var FetchMethod = { 25084 get: "get", 25085 post: "post", 25086 put: "put", 25087 patch: "patch", 25088 delete: "delete" 25089}; 25090function fetchEnctypeFromString(encoding) { 25091 switch (encoding.toLowerCase()) { 25092 case FetchEnctype.multipart: 25093 return FetchEnctype.multipart; 25094 case FetchEnctype.plain: 25095 return FetchEnctype.plain; 25096 default: 25097 return FetchEnctype.urlEncoded; 25098 } 25099} 25100var FetchEnctype = { 25101 urlEncoded: "application/x-www-form-urlencoded", 25102 multipart: "multipart/form-data", 25103 plain: "text/plain" 25104}; 25105 25106class FetchRequest { 25107 abortController = new AbortController; 25108 #resolveRequestPromise = (_value) => {}; 25109 constructor(delegate, method, location2, requestBody = new URLSearchParams, target = null, enctype = FetchEnctype.urlEncoded) { 25110 const [url, body] = buildResourceAndBody(expandURL(location2), method, requestBody, enctype); 25111 this.delegate = delegate; 25112 this.url = url; 25113 this.target = target; 25114 this.fetchOptions = { 25115 credentials: "same-origin", 25116 redirect: "follow", 25117 method: method.toUpperCase(), 25118 headers: { ...this.defaultHeaders }, 25119 body, 25120 signal: this.abortSignal, 25121 referrer: this.delegate.referrer?.href 25122 }; 25123 this.enctype = enctype; 25124 } 25125 get method() { 25126 return this.fetchOptions.method; 25127 } 25128 set method(value) { 25129 const fetchBody = this.isSafe ? this.url.searchParams : this.fetchOptions.body || new FormData; 25130 const fetchMethod = fetchMethodFromString(value) || FetchMethod.get; 25131 this.url.search = ""; 25132 const [url, body] = buildResourceAndBody(this.url, fetchMethod, fetchBody, this.enctype); 25133 this.url = url; 25134 this.fetchOptions.body = body; 25135 this.fetchOptions.method = fetchMethod.toUpperCase(); 25136 } 25137 get headers() { 25138 return this.fetchOptions.headers; 25139 } 25140 set headers(value) { 25141 this.fetchOptions.headers = value; 25142 } 25143 get body() { 25144 if (this.isSafe) { 25145 return this.url.searchParams; 25146 } else { 25147 return this.fetchOptions.body; 25148 } 25149 } 25150 set body(value) { 25151 this.fetchOptions.body = value; 25152 } 25153 get location() { 25154 return this.url; 25155 } 25156 get params() { 25157 return this.url.searchParams; 25158 } 25159 get entries() { 25160 return this.body ? Array.from(this.body.entries()) : []; 25161 } 25162 cancel() { 25163 this.abortController.abort(); 25164 } 25165 async perform() { 25166 const { fetchOptions } = this; 25167 this.delegate.prepareRequest(this); 25168 const event = await this.#allowRequestToBeIntercepted(fetchOptions); 25169 try { 25170 this.delegate.requestStarted(this); 25171 if (event.detail.fetchRequest) { 25172 this.response = event.detail.fetchRequest.response; 25173 } else { 25174 this.response = fetchWithTurboHeaders(this.url.href, fetchOptions); 25175 } 25176 const response = await this.response; 25177 return await this.receive(response); 25178 } catch (error) { 25179 if (error.name !== "AbortError") { 25180 if (this.#willDelegateErrorHandling(error)) { 25181 this.delegate.requestErrored(this, error); 25182 } 25183 throw error; 25184 } 25185 } finally { 25186 this.delegate.requestFinished(this); 25187 } 25188 } 25189 async receive(response) { 25190 const fetchResponse = new FetchResponse(response); 25191 const event = dispatch("turbo:before-fetch-response", { 25192 cancelable: true, 25193 detail: { fetchResponse }, 25194 target: this.target 25195 }); 25196 if (event.defaultPrevented) { 25197 this.delegate.requestPreventedHandlingResponse(this, fetchResponse); 25198 } else if (fetchResponse.succeeded) { 25199 this.delegate.requestSucceededWithResponse(this, fetchResponse); 25200 } else { 25201 this.delegate.requestFailedWithResponse(this, fetchResponse); 25202 } 25203 return fetchResponse; 25204 } 25205 get defaultHeaders() { 25206 return { 25207 Accept: "text/html, application/xhtml+xml" 25208 }; 25209 } 25210 get isSafe() { 25211 return isSafe(this.method); 25212 } 25213 get abortSignal() { 25214 return this.abortController.signal; 25215 } 25216 acceptResponseType(mimeType) { 25217 this.headers["Accept"] = [mimeType, this.headers["Accept"]].join(", "); 25218 } 25219 async#allowRequestToBeIntercepted(fetchOptions) { 25220 const requestInterception = new Promise((resolve) => this.#resolveRequestPromise = resolve); 25221 const event = dispatch("turbo:before-fetch-request", { 25222 cancelable: true, 25223 detail: { 25224 fetchOptions, 25225 url: this.url, 25226 resume: this.#resolveRequestPromise 25227 }, 25228 target: this.target 25229 }); 25230 this.url = event.detail.url; 25231 if (event.defaultPrevented) 25232 await requestInterception; 25233 return event; 25234 } 25235 #willDelegateErrorHandling(error) { 25236 const event = dispatch("turbo:fetch-request-error", { 25237 target: this.target, 25238 cancelable: true, 25239 detail: { request: this, error } 25240 }); 25241 return !event.defaultPrevented; 25242 } 25243} 25244function isSafe(fetchMethod) { 25245 return fetchMethodFromString(fetchMethod) == FetchMethod.get; 25246} 25247function buildResourceAndBody(resource, method, requestBody, enctype) { 25248 const searchParams = Array.from(requestBody).length > 0 ? new URLSearchParams(entriesExcludingFiles(requestBody)) : resource.searchParams; 25249 if (isSafe(method)) { 25250 return [mergeIntoURLSearchParams(resource, searchParams), null]; 25251 } else if (enctype == FetchEnctype.urlEncoded) { 25252 return [resource, searchParams]; 25253 } else { 25254 return [resource, requestBody]; 25255 } 25256} 25257function entriesExcludingFiles(requestBody) { 25258 const entries = []; 25259 for (const [name, value] of requestBody) { 25260 if (value instanceof File) 25261 continue; 25262 else 25263 entries.push([name, value]); 25264 } 25265 return entries; 25266} 25267function mergeIntoURLSearchParams(url, requestBody) { 25268 const searchParams = new URLSearchParams(entriesExcludingFiles(requestBody)); 25269 url.search = searchParams.toString(); 25270 return url; 25271} 25272 25273class AppearanceObserver { 25274 started = false; 25275 constructor(delegate, element) { 25276 this.delegate = delegate; 25277 this.element = element; 25278 this.intersectionObserver = new IntersectionObserver(this.intersect); 25279 } 25280 start() { 25281 if (!this.started) { 25282 this.started = true; 25283 this.intersectionObserver.observe(this.element); 25284 } 25285 } 25286 stop() { 25287 if (this.started) { 25288 this.started = false; 25289 this.intersectionObserver.unobserve(this.element); 25290 } 25291 } 25292 intersect = (entries) => { 25293 const lastEntry = entries.slice(-1)[0]; 25294 if (lastEntry?.isIntersecting) { 25295 this.delegate.elementAppearedInViewport(this.element); 25296 } 25297 }; 25298} 25299 25300class StreamMessage { 25301 static contentType = "text/vnd.turbo-stream.html"; 25302 static wrap(message) { 25303 if (typeof message == "string") { 25304 return new this(createDocumentFragment(message)); 25305 } else { 25306 return message; 25307 } 25308 } 25309 constructor(fragment) { 25310 this.fragment = importStreamElements(fragment); 25311 } 25312} 25313function importStreamElements(fragment) { 25314 for (const element of fragment.querySelectorAll("turbo-stream")) { 25315 const streamElement = document.importNode(element, true); 25316 for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll("script")) { 25317 inertScriptElement.replaceWith(activateScriptElement(inertScriptElement)); 25318 } 25319 element.replaceWith(streamElement); 25320 } 25321 return fragment; 25322} 25323var identity = (key) => key; 25324 25325class LRUCache { 25326 keys = []; 25327 entries = {}; 25328 #toCacheKey; 25329 constructor(size, toCacheKey = identity) { 25330 this.size = size; 25331 this.#toCacheKey = toCacheKey; 25332 } 25333 has(key) { 25334 return this.#toCacheKey(key) in this.entries; 25335 } 25336 get(key) { 25337 if (this.has(key)) { 25338 const entry = this.read(key); 25339 this.touch(key); 25340 return entry; 25341 } 25342 } 25343 put(key, entry) { 25344 this.write(key, entry); 25345 this.touch(key); 25346 return entry; 25347 } 25348 clear() { 25349 for (const key of Object.keys(this.entries)) { 25350 this.evict(key); 25351 } 25352 } 25353 read(key) { 25354 return this.entries[this.#toCacheKey(key)]; 25355 } 25356 write(key, entry) { 25357 this.entries[this.#toCacheKey(key)] = entry; 25358 } 25359 touch(key) { 25360 key = this.#toCacheKey(key); 25361 const index = this.keys.indexOf(key); 25362 if (index > -1) 25363 this.keys.splice(index, 1); 25364 this.keys.unshift(key); 25365 this.trim(); 25366 } 25367 trim() { 25368 for (const key of this.keys.splice(this.size)) { 25369 this.evict(key); 25370 } 25371 } 25372 evict(key) { 25373 delete this.entries[key]; 25374 } 25375} 25376var PREFETCH_DELAY = 100; 25377 25378class PrefetchCache extends LRUCache { 25379 #prefetchTimeout = null; 25380 #maxAges = {}; 25381 constructor(size = 1, prefetchDelay = PREFETCH_DELAY) { 25382 super(size, toCacheKey); 25383 this.prefetchDelay = prefetchDelay; 25384 } 25385 putLater(url, request, ttl) { 25386 this.#prefetchTimeout = setTimeout(() => { 25387 request.perform(); 25388 this.put(url, request, ttl); 25389 this.#prefetchTimeout = null; 25390 }, this.prefetchDelay); 25391 } 25392 put(url, request, ttl = cacheTtl) { 25393 super.put(url, request); 25394 this.#maxAges[toCacheKey(url)] = new Date(new Date().getTime() + ttl); 25395 } 25396 clear() { 25397 super.clear(); 25398 if (this.#prefetchTimeout) 25399 clearTimeout(this.#prefetchTimeout); 25400 } 25401 evict(key) { 25402 super.evict(key); 25403 delete this.#maxAges[key]; 25404 } 25405 has(key) { 25406 if (super.has(key)) { 25407 const maxAge = this.#maxAges[toCacheKey(key)]; 25408 return maxAge && maxAge > Date.now(); 25409 } else { 25410 return false; 25411 } 25412 } 25413} 25414var cacheTtl = 10 * 1000; 25415var prefetchCache = new PrefetchCache; 25416var FormSubmissionState = { 25417 initialized: "initialized", 25418 requesting: "requesting", 25419 waiting: "waiting", 25420 receiving: "receiving", 25421 stopping: "stopping", 25422 stopped: "stopped" 25423}; 25424 25425class FormSubmission { 25426 state = FormSubmissionState.initialized; 25427 static confirmMethod(message) { 25428 return Promise.resolve(confirm(message)); 25429 } 25430 constructor(delegate, formElement, submitter, mustRedirect = false) { 25431 const method = getMethod(formElement, submitter); 25432 const action = getAction(getFormAction(formElement, submitter), method); 25433 const body = buildFormData(formElement, submitter); 25434 const enctype = getEnctype(formElement, submitter); 25435 this.delegate = delegate; 25436 this.formElement = formElement; 25437 this.submitter = submitter; 25438 this.fetchRequest = new FetchRequest(this, method, action, body, formElement, enctype); 25439 this.mustRedirect = mustRedirect; 25440 } 25441 get method() { 25442 return this.fetchRequest.method; 25443 } 25444 set method(value) { 25445 this.fetchRequest.method = value; 25446 } 25447 get action() { 25448 return this.fetchRequest.url.toString(); 25449 } 25450 set action(value) { 25451 this.fetchRequest.url = expandURL(value); 25452 } 25453 get body() { 25454 return this.fetchRequest.body; 25455 } 25456 get enctype() { 25457 return this.fetchRequest.enctype; 25458 } 25459 get isSafe() { 25460 return this.fetchRequest.isSafe; 25461 } 25462 get location() { 25463 return this.fetchRequest.url; 25464 } 25465 async start() { 25466 const { initialized, requesting } = FormSubmissionState; 25467 const confirmationMessage = getAttribute("data-turbo-confirm", this.submitter, this.formElement); 25468 if (typeof confirmationMessage === "string") { 25469 const confirmMethod = typeof config.forms.confirm === "function" ? config.forms.confirm : FormSubmission.confirmMethod; 25470 const answer = await confirmMethod(confirmationMessage, this.formElement, this.submitter); 25471 if (!answer) { 25472 return; 25473 } 25474 } 25475 if (this.state == initialized) { 25476 this.state = requesting; 25477 return this.fetchRequest.perform(); 25478 } 25479 } 25480 stop() { 25481 const { stopping, stopped } = FormSubmissionState; 25482 if (this.state != stopping && this.state != stopped) { 25483 this.state = stopping; 25484 this.fetchRequest.cancel(); 25485 return true; 25486 } 25487 } 25488 prepareRequest(request) { 25489 if (!request.isSafe) { 25490 const token = getCookieValue(getMetaContent("csrf-param")) || getMetaContent("csrf-token"); 25491 if (token) { 25492 request.headers["X-CSRF-Token"] = token; 25493 } 25494 } 25495 if (this.requestAcceptsTurboStreamResponse(request)) { 25496 request.acceptResponseType(StreamMessage.contentType); 25497 } 25498 } 25499 requestStarted(_request) { 25500 this.state = FormSubmissionState.waiting; 25501 if (this.submitter) 25502 config.forms.submitter.beforeSubmit(this.submitter); 25503 this.setSubmitsWith(); 25504 markAsBusy(this.formElement); 25505 dispatch("turbo:submit-start", { 25506 target: this.formElement, 25507 detail: { formSubmission: this } 25508 }); 25509 this.delegate.formSubmissionStarted(this); 25510 } 25511 requestPreventedHandlingResponse(request, response) { 25512 prefetchCache.clear(); 25513 this.result = { success: response.succeeded, fetchResponse: response }; 25514 } 25515 requestSucceededWithResponse(request, response) { 25516 if (response.clientError || response.serverError) { 25517 this.delegate.formSubmissionFailedWithResponse(this, response); 25518 return; 25519 } 25520 prefetchCache.clear(); 25521 if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) { 25522 const error = new Error("Form responses must redirect to another location"); 25523 this.delegate.formSubmissionErrored(this, error); 25524 } else { 25525 this.state = FormSubmissionState.receiving; 25526 this.result = { success: true, fetchResponse: response }; 25527 this.delegate.formSubmissionSucceededWithResponse(this, response); 25528 } 25529 } 25530 requestFailedWithResponse(request, response) { 25531 this.result = { success: false, fetchResponse: response }; 25532 this.delegate.formSubmissionFailedWithResponse(this, response); 25533 } 25534 requestErrored(request, error) { 25535 this.result = { success: false, error }; 25536 this.delegate.formSubmissionErrored(this, error); 25537 } 25538 requestFinished(_request) { 25539 this.state = FormSubmissionState.stopped; 25540 if (this.submitter) 25541 config.forms.submitter.afterSubmit(this.submitter); 25542 this.resetSubmitterText(); 25543 clearBusyState(this.formElement); 25544 dispatch("turbo:submit-end", { 25545 target: this.formElement, 25546 detail: { formSubmission: this, ...this.result } 25547 }); 25548 this.delegate.formSubmissionFinished(this); 25549 } 25550 setSubmitsWith() { 25551 if (!this.submitter || !this.submitsWith) 25552 return; 25553 if (this.submitter.matches("button")) { 25554 this.originalSubmitText = this.submitter.innerHTML; 25555 this.submitter.innerHTML = this.submitsWith; 25556 } else if (this.submitter.matches("input")) { 25557 const input = this.submitter; 25558 this.originalSubmitText = input.value; 25559 input.value = this.submitsWith; 25560 } 25561 } 25562 resetSubmitterText() { 25563 if (!this.submitter || !this.originalSubmitText) 25564 return; 25565 if (this.submitter.matches("button")) { 25566 this.submitter.innerHTML = this.originalSubmitText; 25567 } else if (this.submitter.matches("input")) { 25568 const input = this.submitter; 25569 input.value = this.originalSubmitText; 25570 } 25571 } 25572 requestMustRedirect(request) { 25573 return !request.isSafe && this.mustRedirect; 25574 } 25575 requestAcceptsTurboStreamResponse(request) { 25576 return !request.isSafe || hasAttribute("data-turbo-stream", this.submitter, this.formElement); 25577 } 25578 get submitsWith() { 25579 return this.submitter?.getAttribute("data-turbo-submits-with"); 25580 } 25581} 25582function buildFormData(formElement, submitter) { 25583 const formData = new FormData(formElement); 25584 const name = submitter?.getAttribute("name"); 25585 const value = submitter?.getAttribute("value"); 25586 if (name) { 25587 formData.append(name, value || ""); 25588 } 25589 return formData; 25590} 25591function getCookieValue(cookieName) { 25592 if (cookieName != null) { 25593 const cookies = document.cookie ? document.cookie.split("; ") : []; 25594 const cookie = cookies.find((cookie) => cookie.startsWith(cookieName)); 25595 if (cookie) { 25596 const value = cookie.split("=").slice(1).join("="); 25597 return value ? decodeURIComponent(value) : undefined; 25598 } 25599 } 25600} 25601function responseSucceededWithoutRedirect(response) { 25602 return response.statusCode == 200 && !response.redirected; 25603} 25604function getFormAction(formElement, submitter) { 25605 const formElementAction = typeof formElement.action === "string" ? formElement.action : null; 25606 if (submitter?.hasAttribute("formaction")) { 25607 return submitter.getAttribute("formaction") || ""; 25608 } else { 25609 return formElement.getAttribute("action") || formElementAction || ""; 25610 } 25611} 25612function getAction(formAction, fetchMethod) { 25613 const action = expandURL(formAction); 25614 if (isSafe(fetchMethod)) { 25615 action.search = ""; 25616 } 25617 return action; 25618} 25619function getMethod(formElement, submitter) { 25620 const method = submitter?.getAttribute("formmethod") || formElement.getAttribute("method") || ""; 25621 return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get; 25622} 25623function getEnctype(formElement, submitter) { 25624 return fetchEnctypeFromString(submitter?.getAttribute("formenctype") || formElement.enctype); 25625} 25626 25627class Snapshot { 25628 constructor(element) { 25629 this.element = element; 25630 } 25631 get activeElement() { 25632 return this.element.ownerDocument.activeElement; 25633 } 25634 get children() { 25635 return [...this.element.children]; 25636 } 25637 hasAnchor(anchor) { 25638 return this.getElementForAnchor(anchor) != null; 25639 } 25640 getElementForAnchor(anchor) { 25641 return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null; 25642 } 25643 get isConnected() { 25644 return this.element.isConnected; 25645 } 25646 get firstAutofocusableElement() { 25647 return queryAutofocusableElement(this.element); 25648 } 25649 get permanentElements() { 25650 return queryPermanentElementsAll(this.element); 25651 } 25652 getPermanentElementById(id) { 25653 return getPermanentElementById(this.element, id); 25654 } 25655 getPermanentElementMapForSnapshot(snapshot) { 25656 const permanentElementMap = {}; 25657 for (const currentPermanentElement of this.permanentElements) { 25658 const { id } = currentPermanentElement; 25659 const newPermanentElement = snapshot.getPermanentElementById(id); 25660 if (newPermanentElement) { 25661 permanentElementMap[id] = [currentPermanentElement, newPermanentElement]; 25662 } 25663 } 25664 return permanentElementMap; 25665 } 25666} 25667function getPermanentElementById(node, id) { 25668 return node.querySelector(`#${id}[data-turbo-permanent]`); 25669} 25670function queryPermanentElementsAll(node) { 25671 return node.querySelectorAll("[id][data-turbo-permanent]"); 25672} 25673 25674class FormSubmitObserver { 25675 started = false; 25676 constructor(delegate, eventTarget) { 25677 this.delegate = delegate; 25678 this.eventTarget = eventTarget; 25679 } 25680 start() { 25681 if (!this.started) { 25682 this.eventTarget.addEventListener("submit", this.submitCaptured, true); 25683 this.started = true; 25684 } 25685 } 25686 stop() { 25687 if (this.started) { 25688 this.eventTarget.removeEventListener("submit", this.submitCaptured, true); 25689 this.started = false; 25690 } 25691 } 25692 submitCaptured = () => { 25693 this.eventTarget.removeEventListener("submit", this.submitBubbled, false); 25694 this.eventTarget.addEventListener("submit", this.submitBubbled, false); 25695 }; 25696 submitBubbled = (event) => { 25697 if (!event.defaultPrevented) { 25698 const form = event.target instanceof HTMLFormElement ? event.target : undefined; 25699 const submitter = event.submitter || undefined; 25700 if (form && submissionDoesNotDismissDialog(form, submitter) && submissionDoesNotTargetIFrame(form, submitter) && this.delegate.willSubmitForm(form, submitter)) { 25701 event.preventDefault(); 25702 event.stopImmediatePropagation(); 25703 this.delegate.formSubmitted(form, submitter); 25704 } 25705 } 25706 }; 25707} 25708function submissionDoesNotDismissDialog(form, submitter) { 25709 const method = submitter?.getAttribute("formmethod") || form.getAttribute("method"); 25710 return method != "dialog"; 25711} 25712function submissionDoesNotTargetIFrame(form, submitter) { 25713 const target = submitter?.getAttribute("formtarget") || form.getAttribute("target"); 25714 return doesNotTargetIFrame(target); 25715} 25716 25717class View { 25718 #resolveRenderPromise = (_value) => {}; 25719 #resolveInterceptionPromise = (_value) => {}; 25720 constructor(delegate, element) { 25721 this.delegate = delegate; 25722 this.element = element; 25723 } 25724 scrollToAnchor(anchor) { 25725 const element = this.snapshot.getElementForAnchor(anchor); 25726 if (element) { 25727 this.focusElement(element); 25728 this.scrollToElement(element); 25729 } else { 25730 this.scrollToPosition({ x: 0, y: 0 }); 25731 } 25732 } 25733 scrollToAnchorFromLocation(location2) { 25734 this.scrollToAnchor(getAnchor(location2)); 25735 } 25736 scrollToElement(element) { 25737 element.scrollIntoView(); 25738 } 25739 focusElement(element) { 25740 if (element instanceof HTMLElement) { 25741 if (element.hasAttribute("tabindex")) { 25742 element.focus(); 25743 } else { 25744 element.setAttribute("tabindex", "-1"); 25745 element.focus(); 25746 element.removeAttribute("tabindex"); 25747 } 25748 } 25749 } 25750 scrollToPosition({ x, y }) { 25751 this.scrollRoot.scrollTo(x, y); 25752 } 25753 scrollToTop() { 25754 this.scrollToPosition({ x: 0, y: 0 }); 25755 } 25756 get scrollRoot() { 25757 return window; 25758 } 25759 async render(renderer) { 25760 const { isPreview, shouldRender, willRender, newSnapshot: snapshot } = renderer; 25761 const shouldInvalidate = willRender; 25762 if (shouldRender) { 25763 try { 25764 this.renderPromise = new Promise((resolve) => this.#resolveRenderPromise = resolve); 25765 this.renderer = renderer; 25766 await this.prepareToRenderSnapshot(renderer); 25767 const renderInterception = new Promise((resolve) => this.#resolveInterceptionPromise = resolve); 25768 const options2 = { resume: this.#resolveInterceptionPromise, render: this.renderer.renderElement, renderMethod: this.renderer.renderMethod }; 25769 const immediateRender = this.delegate.allowsImmediateRender(snapshot, options2); 25770 if (!immediateRender) 25771 await renderInterception; 25772 await this.renderSnapshot(renderer); 25773 this.delegate.viewRenderedSnapshot(snapshot, isPreview, this.renderer.renderMethod); 25774 this.delegate.preloadOnLoadLinksForView(this.element); 25775 this.finishRenderingSnapshot(renderer); 25776 } finally { 25777 delete this.renderer; 25778 this.#resolveRenderPromise(undefined); 25779 delete this.renderPromise; 25780 } 25781 } else if (shouldInvalidate) { 25782 this.invalidate(renderer.reloadReason); 25783 } 25784 } 25785 invalidate(reason) { 25786 this.delegate.viewInvalidated(reason); 25787 } 25788 async prepareToRenderSnapshot(renderer) { 25789 this.markAsPreview(renderer.isPreview); 25790 await renderer.prepareToRender(); 25791 } 25792 markAsPreview(isPreview) { 25793 if (isPreview) { 25794 this.element.setAttribute("data-turbo-preview", ""); 25795 } else { 25796 this.element.removeAttribute("data-turbo-preview"); 25797 } 25798 } 25799 markVisitDirection(direction) { 25800 this.element.setAttribute("data-turbo-visit-direction", direction); 25801 } 25802 unmarkVisitDirection() { 25803 this.element.removeAttribute("data-turbo-visit-direction"); 25804 } 25805 async renderSnapshot(renderer) { 25806 await renderer.render(); 25807 } 25808 finishRenderingSnapshot(renderer) { 25809 renderer.finishRendering(); 25810 } 25811} 25812 25813class FrameView extends View { 25814 missing() { 25815 this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`; 25816 } 25817 get snapshot() { 25818 return new Snapshot(this.element); 25819 } 25820} 25821 25822class LinkInterceptor { 25823 constructor(delegate, element) { 25824 this.delegate = delegate; 25825 this.element = element; 25826 } 25827 start() { 25828 this.element.addEventListener("click", this.clickBubbled); 25829 document.addEventListener("turbo:click", this.linkClicked); 25830 document.addEventListener("turbo:before-visit", this.willVisit); 25831 } 25832 stop() { 25833 this.element.removeEventListener("click", this.clickBubbled); 25834 document.removeEventListener("turbo:click", this.linkClicked); 25835 document.removeEventListener("turbo:before-visit", this.willVisit); 25836 } 25837 clickBubbled = (event) => { 25838 if (this.clickEventIsSignificant(event)) { 25839 this.clickEvent = event; 25840 } else { 25841 delete this.clickEvent; 25842 } 25843 }; 25844 linkClicked = (event) => { 25845 if (this.clickEvent && this.clickEventIsSignificant(event)) { 25846 if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) { 25847 this.clickEvent.preventDefault(); 25848 event.preventDefault(); 25849 this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent); 25850 } 25851 } 25852 delete this.clickEvent; 25853 }; 25854 willVisit = (_event) => { 25855 delete this.clickEvent; 25856 }; 25857 clickEventIsSignificant(event) { 25858 const target = event.composed ? event.target?.parentElement : event.target; 25859 const element = findLinkFromClickTarget(target) || target; 25860 return element instanceof Element && element.closest("turbo-frame, html") == this.element; 25861 } 25862} 25863 25864class LinkClickObserver { 25865 started = false; 25866 constructor(delegate, eventTarget) { 25867 this.delegate = delegate; 25868 this.eventTarget = eventTarget; 25869 } 25870 start() { 25871 if (!this.started) { 25872 this.eventTarget.addEventListener("click", this.clickCaptured, true); 25873 this.started = true; 25874 } 25875 } 25876 stop() { 25877 if (this.started) { 25878 this.eventTarget.removeEventListener("click", this.clickCaptured, true); 25879 this.started = false; 25880 } 25881 } 25882 clickCaptured = () => { 25883 this.eventTarget.removeEventListener("click", this.clickBubbled, false); 25884 this.eventTarget.addEventListener("click", this.clickBubbled, false); 25885 }; 25886 clickBubbled = (event) => { 25887 if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) { 25888 const target = event.composedPath && event.composedPath()[0] || event.target; 25889 const link = findLinkFromClickTarget(target); 25890 if (link && doesNotTargetIFrame(link.target)) { 25891 const location2 = getLocationForLink(link); 25892 if (this.delegate.willFollowLinkToLocation(link, location2, event)) { 25893 event.preventDefault(); 25894 this.delegate.followedLinkToLocation(link, location2); 25895 } 25896 } 25897 } 25898 }; 25899 clickEventIsSignificant(event) { 25900 return !(event.target && event.target.isContentEditable || event.defaultPrevented || event.which > 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey); 25901 } 25902} 25903 25904class FormLinkClickObserver { 25905 constructor(delegate, element) { 25906 this.delegate = delegate; 25907 this.linkInterceptor = new LinkClickObserver(this, element); 25908 } 25909 start() { 25910 this.linkInterceptor.start(); 25911 } 25912 stop() { 25913 this.linkInterceptor.stop(); 25914 } 25915 canPrefetchRequestToLocation(link, location2) { 25916 return false; 25917 } 25918 prefetchAndCacheRequestToLocation(link, location2) { 25919 return; 25920 } 25921 willFollowLinkToLocation(link, location2, originalEvent) { 25922 return this.delegate.willSubmitFormLinkToLocation(link, location2, originalEvent) && (link.hasAttribute("data-turbo-method") || link.hasAttribute("data-turbo-stream")); 25923 } 25924 followedLinkToLocation(link, location2) { 25925 const form = document.createElement("form"); 25926 const type = "hidden"; 25927 for (const [name, value] of location2.searchParams) { 25928 form.append(Object.assign(document.createElement("input"), { type, name, value })); 25929 } 25930 const action = Object.assign(location2, { search: "" }); 25931 form.setAttribute("data-turbo", "true"); 25932 form.setAttribute("action", action.href); 25933 form.setAttribute("hidden", ""); 25934 const method = link.getAttribute("data-turbo-method"); 25935 if (method) 25936 form.setAttribute("method", method); 25937 const turboFrame = link.getAttribute("data-turbo-frame"); 25938 if (turboFrame) 25939 form.setAttribute("data-turbo-frame", turboFrame); 25940 const turboAction = getVisitAction(link); 25941 if (turboAction) 25942 form.setAttribute("data-turbo-action", turboAction); 25943 const turboConfirm = link.getAttribute("data-turbo-confirm"); 25944 if (turboConfirm) 25945 form.setAttribute("data-turbo-confirm", turboConfirm); 25946 const turboStream = link.hasAttribute("data-turbo-stream"); 25947 if (turboStream) 25948 form.setAttribute("data-turbo-stream", ""); 25949 this.delegate.submittedFormLinkToLocation(link, location2, form); 25950 document.body.appendChild(form); 25951 form.addEventListener("turbo:submit-end", () => form.remove(), { once: true }); 25952 requestAnimationFrame(() => form.requestSubmit()); 25953 } 25954} 25955 25956class Bardo { 25957 static async preservingPermanentElements(delegate, permanentElementMap, callback) { 25958 const bardo = new this(delegate, permanentElementMap); 25959 bardo.enter(); 25960 await callback(); 25961 bardo.leave(); 25962 } 25963 constructor(delegate, permanentElementMap) { 25964 this.delegate = delegate; 25965 this.permanentElementMap = permanentElementMap; 25966 } 25967 enter() { 25968 for (const id in this.permanentElementMap) { 25969 const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id]; 25970 this.delegate.enteringBardo(currentPermanentElement, newPermanentElement); 25971 this.replaceNewPermanentElementWithPlaceholder(newPermanentElement); 25972 } 25973 } 25974 leave() { 25975 for (const id in this.permanentElementMap) { 25976 const [currentPermanentElement] = this.permanentElementMap[id]; 25977 this.replaceCurrentPermanentElementWithClone(currentPermanentElement); 25978 this.replacePlaceholderWithPermanentElement(currentPermanentElement); 25979 this.delegate.leavingBardo(currentPermanentElement); 25980 } 25981 } 25982 replaceNewPermanentElementWithPlaceholder(permanentElement) { 25983 const placeholder = createPlaceholderForPermanentElement(permanentElement); 25984 permanentElement.replaceWith(placeholder); 25985 } 25986 replaceCurrentPermanentElementWithClone(permanentElement) { 25987 const clone2 = permanentElement.cloneNode(true); 25988 permanentElement.replaceWith(clone2); 25989 } 25990 replacePlaceholderWithPermanentElement(permanentElement) { 25991 const placeholder = this.getPlaceholderById(permanentElement.id); 25992 placeholder?.replaceWith(permanentElement); 25993 } 25994 getPlaceholderById(id) { 25995 return this.placeholders.find((element) => element.content == id); 25996 } 25997 get placeholders() { 25998 return [...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]; 25999 } 26000} 26001function createPlaceholderForPermanentElement(permanentElement) { 26002 const element = document.createElement("meta"); 26003 element.setAttribute("name", "turbo-permanent-placeholder"); 26004 element.setAttribute("content", permanentElement.id); 26005 return element; 26006} 26007 26008class Renderer { 26009 #activeElement = null; 26010 static renderElement(currentElement, newElement) {} 26011 constructor(currentSnapshot, newSnapshot, isPreview, willRender = true) { 26012 this.currentSnapshot = currentSnapshot; 26013 this.newSnapshot = newSnapshot; 26014 this.isPreview = isPreview; 26015 this.willRender = willRender; 26016 this.renderElement = this.constructor.renderElement; 26017 this.promise = new Promise((resolve, reject) => this.resolvingFunctions = { resolve, reject }); 26018 } 26019 get shouldRender() { 26020 return true; 26021 } 26022 get shouldAutofocus() { 26023 return true; 26024 } 26025 get reloadReason() { 26026 return; 26027 } 26028 prepareToRender() { 26029 return; 26030 } 26031 render() {} 26032 finishRendering() { 26033 if (this.resolvingFunctions) { 26034 this.resolvingFunctions.resolve(); 26035 delete this.resolvingFunctions; 26036 } 26037 } 26038 async preservingPermanentElements(callback) { 26039 await Bardo.preservingPermanentElements(this, this.permanentElementMap, callback); 26040 } 26041 focusFirstAutofocusableElement() { 26042 if (this.shouldAutofocus) { 26043 const element = this.connectedSnapshot.firstAutofocusableElement; 26044 if (element) { 26045 element.focus(); 26046 } 26047 } 26048 } 26049 enteringBardo(currentPermanentElement) { 26050 if (this.#activeElement) 26051 return; 26052 if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) { 26053 this.#activeElement = this.currentSnapshot.activeElement; 26054 } 26055 } 26056 leavingBardo(currentPermanentElement) { 26057 if (currentPermanentElement.contains(this.#activeElement) && this.#activeElement instanceof HTMLElement) { 26058 this.#activeElement.focus(); 26059 this.#activeElement = null; 26060 } 26061 } 26062 get connectedSnapshot() { 26063 return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot; 26064 } 26065 get currentElement() { 26066 return this.currentSnapshot.element; 26067 } 26068 get newElement() { 26069 return this.newSnapshot.element; 26070 } 26071 get permanentElementMap() { 26072 return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot); 26073 } 26074 get renderMethod() { 26075 return "replace"; 26076 } 26077} 26078 26079class FrameRenderer extends Renderer { 26080 static renderElement(currentElement, newElement) { 26081 const destinationRange = document.createRange(); 26082 destinationRange.selectNodeContents(currentElement); 26083 destinationRange.deleteContents(); 26084 const frameElement = newElement; 26085 const sourceRange = frameElement.ownerDocument?.createRange(); 26086 if (sourceRange) { 26087 sourceRange.selectNodeContents(frameElement); 26088 currentElement.appendChild(sourceRange.extractContents()); 26089 } 26090 } 26091 constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { 26092 super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender); 26093 this.delegate = delegate; 26094 } 26095 get shouldRender() { 26096 return true; 26097 } 26098 async render() { 26099 await nextRepaint(); 26100 this.preservingPermanentElements(() => { 26101 this.loadFrameElement(); 26102 }); 26103 this.scrollFrameIntoView(); 26104 await nextRepaint(); 26105 this.focusFirstAutofocusableElement(); 26106 await nextRepaint(); 26107 this.activateScriptElements(); 26108 } 26109 loadFrameElement() { 26110 this.delegate.willRenderFrame(this.currentElement, this.newElement); 26111 this.renderElement(this.currentElement, this.newElement); 26112 } 26113 scrollFrameIntoView() { 26114 if (this.currentElement.autoscroll || this.newElement.autoscroll) { 26115 const element = this.currentElement.firstElementChild; 26116 const block = readScrollLogicalPosition(this.currentElement.getAttribute("data-autoscroll-block"), "end"); 26117 const behavior = readScrollBehavior(this.currentElement.getAttribute("data-autoscroll-behavior"), "auto"); 26118 if (element) { 26119 element.scrollIntoView({ block, behavior }); 26120 return true; 26121 } 26122 } 26123 return false; 26124 } 26125 activateScriptElements() { 26126 for (const inertScriptElement of this.newScriptElements) { 26127 const activatedScriptElement = activateScriptElement(inertScriptElement); 26128 inertScriptElement.replaceWith(activatedScriptElement); 26129 } 26130 } 26131 get newScriptElements() { 26132 return this.currentElement.querySelectorAll("script"); 26133 } 26134} 26135function readScrollLogicalPosition(value, defaultValue) { 26136 if (value == "end" || value == "start" || value == "center" || value == "nearest") { 26137 return value; 26138 } else { 26139 return defaultValue; 26140 } 26141} 26142function readScrollBehavior(value, defaultValue) { 26143 if (value == "auto" || value == "smooth") { 26144 return value; 26145 } else { 26146 return defaultValue; 26147 } 26148} 26149var Idiomorph = function() { 26150 const noOp = () => {}; 26151 const defaults = { 26152 morphStyle: "outerHTML", 26153 callbacks: { 26154 beforeNodeAdded: noOp, 26155 afterNodeAdded: noOp, 26156 beforeNodeMorphed: noOp, 26157 afterNodeMorphed: noOp, 26158 beforeNodeRemoved: noOp, 26159 afterNodeRemoved: noOp, 26160 beforeAttributeUpdated: noOp 26161 }, 26162 head: { 26163 style: "merge", 26164 shouldPreserve: (elt) => elt.getAttribute("im-preserve") === "true", 26165 shouldReAppend: (elt) => elt.getAttribute("im-re-append") === "true", 26166 shouldRemove: noOp, 26167 afterHeadMorphed: noOp 26168 }, 26169 restoreFocus: true 26170 }; 26171 function morph(oldNode, newContent, config2 = {}) { 26172 oldNode = normalizeElement(oldNode); 26173 const newNode = normalizeParent(newContent); 26174 const ctx = createMorphContext(oldNode, newNode, config2); 26175 const morphedNodes = saveAndRestoreFocus(ctx, () => { 26176 return withHeadBlocking(ctx, oldNode, newNode, (ctx) => { 26177 if (ctx.morphStyle === "innerHTML") { 26178 morphChildren2(ctx, oldNode, newNode); 26179 return Array.from(oldNode.childNodes); 26180 } else { 26181 return morphOuterHTML(ctx, oldNode, newNode); 26182 } 26183 }); 26184 }); 26185 ctx.pantry.remove(); 26186 return morphedNodes; 26187 } 26188 function morphOuterHTML(ctx, oldNode, newNode) { 26189 const oldParent = normalizeParent(oldNode); 26190 morphChildren2(ctx, oldParent, newNode, oldNode, oldNode.nextSibling); 26191 return Array.from(oldParent.childNodes); 26192 } 26193 function saveAndRestoreFocus(ctx, fn2) { 26194 if (!ctx.config.restoreFocus) 26195 return fn2(); 26196 let activeElement = document.activeElement; 26197 if (!(activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement)) { 26198 return fn2(); 26199 } 26200 const { id: activeElementId, selectionStart, selectionEnd } = activeElement; 26201 const results = fn2(); 26202 if (activeElementId && activeElementId !== document.activeElement?.getAttribute("id")) { 26203 activeElement = ctx.target.querySelector(`[id="${activeElementId}"]`); 26204 activeElement?.focus(); 26205 } 26206 if (activeElement && !activeElement.selectionEnd && selectionEnd) { 26207 activeElement.setSelectionRange(selectionStart, selectionEnd); 26208 } 26209 return results; 26210 } 26211 const morphChildren2 = function() { 26212 function morphChildren2(ctx, oldParent, newParent, insertionPoint = null, endPoint = null) { 26213 if (oldParent instanceof HTMLTemplateElement && newParent instanceof HTMLTemplateElement) { 26214 oldParent = oldParent.content; 26215 newParent = newParent.content; 26216 } 26217 insertionPoint ||= oldParent.firstChild; 26218 for (const newChild of newParent.childNodes) { 26219 if (insertionPoint && insertionPoint != endPoint) { 26220 const bestMatch = findBestMatch(ctx, newChild, insertionPoint, endPoint); 26221 if (bestMatch) { 26222 if (bestMatch !== insertionPoint) { 26223 removeNodesBetween(ctx, insertionPoint, bestMatch); 26224 } 26225 morphNode(bestMatch, newChild, ctx); 26226 insertionPoint = bestMatch.nextSibling; 26227 continue; 26228 } 26229 } 26230 if (newChild instanceof Element) { 26231 const newChildId = newChild.getAttribute("id"); 26232 if (ctx.persistentIds.has(newChildId)) { 26233 const movedChild = moveBeforeById(oldParent, newChildId, insertionPoint, ctx); 26234 morphNode(movedChild, newChild, ctx); 26235 insertionPoint = movedChild.nextSibling; 26236 continue; 26237 } 26238 } 26239 const insertedNode = createNode(oldParent, newChild, insertionPoint, ctx); 26240 if (insertedNode) { 26241 insertionPoint = insertedNode.nextSibling; 26242 } 26243 } 26244 while (insertionPoint && insertionPoint != endPoint) { 26245 const tempNode = insertionPoint; 26246 insertionPoint = insertionPoint.nextSibling; 26247 removeNode(ctx, tempNode); 26248 } 26249 } 26250 function createNode(oldParent, newChild, insertionPoint, ctx) { 26251 if (ctx.callbacks.beforeNodeAdded(newChild) === false) 26252 return null; 26253 if (ctx.idMap.has(newChild)) { 26254 const newEmptyChild = document.createElement(newChild.tagName); 26255 oldParent.insertBefore(newEmptyChild, insertionPoint); 26256 morphNode(newEmptyChild, newChild, ctx); 26257 ctx.callbacks.afterNodeAdded(newEmptyChild); 26258 return newEmptyChild; 26259 } else { 26260 const newClonedChild = document.importNode(newChild, true); 26261 oldParent.insertBefore(newClonedChild, insertionPoint); 26262 ctx.callbacks.afterNodeAdded(newClonedChild); 26263 return newClonedChild; 26264 } 26265 } 26266 const findBestMatch = function() { 26267 function findBestMatch(ctx, node, startPoint, endPoint) { 26268 let softMatch = null; 26269 let nextSibling = node.nextSibling; 26270 let siblingSoftMatchCount = 0; 26271 let cursor = startPoint; 26272 while (cursor && cursor != endPoint) { 26273 if (isSoftMatch(cursor, node)) { 26274 if (isIdSetMatch(ctx, cursor, node)) { 26275 return cursor; 26276 } 26277 if (softMatch === null) { 26278 if (!ctx.idMap.has(cursor)) { 26279 softMatch = cursor; 26280 } 26281 } 26282 } 26283 if (softMatch === null && nextSibling && isSoftMatch(cursor, nextSibling)) { 26284 siblingSoftMatchCount++; 26285 nextSibling = nextSibling.nextSibling; 26286 if (siblingSoftMatchCount >= 2) { 26287 softMatch = undefined; 26288 } 26289 } 26290 if (ctx.activeElementAndParents.includes(cursor)) 26291 break; 26292 cursor = cursor.nextSibling; 26293 } 26294 return softMatch || null; 26295 } 26296 function isIdSetMatch(ctx, oldNode, newNode) { 26297 let oldSet = ctx.idMap.get(oldNode); 26298 let newSet = ctx.idMap.get(newNode); 26299 if (!newSet || !oldSet) 26300 return false; 26301 for (const id of oldSet) { 26302 if (newSet.has(id)) { 26303 return true; 26304 } 26305 } 26306 return false; 26307 } 26308 function isSoftMatch(oldNode, newNode) { 26309 const oldElt = oldNode; 26310 const newElt = newNode; 26311 return oldElt.nodeType === newElt.nodeType && oldElt.tagName === newElt.tagName && (!oldElt.getAttribute?.("id") || oldElt.getAttribute?.("id") === newElt.getAttribute?.("id")); 26312 } 26313 return findBestMatch; 26314 }(); 26315 function removeNode(ctx, node) { 26316 if (ctx.idMap.has(node)) { 26317 moveBefore(ctx.pantry, node, null); 26318 } else { 26319 if (ctx.callbacks.beforeNodeRemoved(node) === false) 26320 return; 26321 node.parentNode?.removeChild(node); 26322 ctx.callbacks.afterNodeRemoved(node); 26323 } 26324 } 26325 function removeNodesBetween(ctx, startInclusive, endExclusive) { 26326 let cursor = startInclusive; 26327 while (cursor && cursor !== endExclusive) { 26328 let tempNode = cursor; 26329 cursor = cursor.nextSibling; 26330 removeNode(ctx, tempNode); 26331 } 26332 return cursor; 26333 } 26334 function moveBeforeById(parentNode, id, after, ctx) { 26335 const target = ctx.target.getAttribute?.("id") === id && ctx.target || ctx.target.querySelector(`[id="${id}"]`) || ctx.pantry.querySelector(`[id="${id}"]`); 26336 removeElementFromAncestorsIdMaps(target, ctx); 26337 moveBefore(parentNode, target, after); 26338 return target; 26339 } 26340 function removeElementFromAncestorsIdMaps(element, ctx) { 26341 const id = element.getAttribute("id"); 26342 while (element = element.parentNode) { 26343 let idSet = ctx.idMap.get(element); 26344 if (idSet) { 26345 idSet.delete(id); 26346 if (!idSet.size) { 26347 ctx.idMap.delete(element); 26348 } 26349 } 26350 } 26351 } 26352 function moveBefore(parentNode, element, after) { 26353 if (parentNode.moveBefore) { 26354 try { 26355 parentNode.moveBefore(element, after); 26356 } catch (e) { 26357 parentNode.insertBefore(element, after); 26358 } 26359 } else { 26360 parentNode.insertBefore(element, after); 26361 } 26362 } 26363 return morphChildren2; 26364 }(); 26365 const morphNode = function() { 26366 function morphNode(oldNode, newContent, ctx) { 26367 if (ctx.ignoreActive && oldNode === document.activeElement) { 26368 return null; 26369 } 26370 if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false) { 26371 return oldNode; 26372 } 26373 if (oldNode instanceof HTMLHeadElement && ctx.head.ignore) 26374 ; 26375 else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== "morph") { 26376 handleHeadElement(oldNode, newContent, ctx); 26377 } else { 26378 morphAttributes(oldNode, newContent, ctx); 26379 if (!ignoreValueOfActiveElement(oldNode, ctx)) { 26380 morphChildren2(ctx, oldNode, newContent); 26381 } 26382 } 26383 ctx.callbacks.afterNodeMorphed(oldNode, newContent); 26384 return oldNode; 26385 } 26386 function morphAttributes(oldNode, newNode, ctx) { 26387 let type = newNode.nodeType; 26388 if (type === 1) { 26389 const oldElt = oldNode; 26390 const newElt = newNode; 26391 const oldAttributes = oldElt.attributes; 26392 const newAttributes = newElt.attributes; 26393 for (const newAttribute of newAttributes) { 26394 if (ignoreAttribute(newAttribute.name, oldElt, "update", ctx)) { 26395 continue; 26396 } 26397 if (oldElt.getAttribute(newAttribute.name) !== newAttribute.value) { 26398 oldElt.setAttribute(newAttribute.name, newAttribute.value); 26399 } 26400 } 26401 for (let i = oldAttributes.length - 1;0 <= i; i--) { 26402 const oldAttribute = oldAttributes[i]; 26403 if (!oldAttribute) 26404 continue; 26405 if (!newElt.hasAttribute(oldAttribute.name)) { 26406 if (ignoreAttribute(oldAttribute.name, oldElt, "remove", ctx)) { 26407 continue; 26408 } 26409 oldElt.removeAttribute(oldAttribute.name); 26410 } 26411 } 26412 if (!ignoreValueOfActiveElement(oldElt, ctx)) { 26413 syncInputValue(oldElt, newElt, ctx); 26414 } 26415 } 26416 if (type === 8 || type === 3) { 26417 if (oldNode.nodeValue !== newNode.nodeValue) { 26418 oldNode.nodeValue = newNode.nodeValue; 26419 } 26420 } 26421 } 26422 function syncInputValue(oldElement, newElement, ctx) { 26423 if (oldElement instanceof HTMLInputElement && newElement instanceof HTMLInputElement && newElement.type !== "file") { 26424 let newValue = newElement.value; 26425 let oldValue = oldElement.value; 26426 syncBooleanAttribute(oldElement, newElement, "checked", ctx); 26427 syncBooleanAttribute(oldElement, newElement, "disabled", ctx); 26428 if (!newElement.hasAttribute("value")) { 26429 if (!ignoreAttribute("value", oldElement, "remove", ctx)) { 26430 oldElement.value = ""; 26431 oldElement.removeAttribute("value"); 26432 } 26433 } else if (oldValue !== newValue) { 26434 if (!ignoreAttribute("value", oldElement, "update", ctx)) { 26435 oldElement.setAttribute("value", newValue); 26436 oldElement.value = newValue; 26437 } 26438 } 26439 } else if (oldElement instanceof HTMLOptionElement && newElement instanceof HTMLOptionElement) { 26440 syncBooleanAttribute(oldElement, newElement, "selected", ctx); 26441 } else if (oldElement instanceof HTMLTextAreaElement && newElement instanceof HTMLTextAreaElement) { 26442 let newValue = newElement.value; 26443 let oldValue = oldElement.value; 26444 if (ignoreAttribute("value", oldElement, "update", ctx)) { 26445 return; 26446 } 26447 if (newValue !== oldValue) { 26448 oldElement.value = newValue; 26449 } 26450 if (oldElement.firstChild && oldElement.firstChild.nodeValue !== newValue) { 26451 oldElement.firstChild.nodeValue = newValue; 26452 } 26453 } 26454 } 26455 function syncBooleanAttribute(oldElement, newElement, attributeName, ctx) { 26456 const newLiveValue = newElement[attributeName], oldLiveValue = oldElement[attributeName]; 26457 if (newLiveValue !== oldLiveValue) { 26458 const ignoreUpdate = ignoreAttribute(attributeName, oldElement, "update", ctx); 26459 if (!ignoreUpdate) { 26460 oldElement[attributeName] = newElement[attributeName]; 26461 } 26462 if (newLiveValue) { 26463 if (!ignoreUpdate) { 26464 oldElement.setAttribute(attributeName, ""); 26465 } 26466 } else { 26467 if (!ignoreAttribute(attributeName, oldElement, "remove", ctx)) { 26468 oldElement.removeAttribute(attributeName); 26469 } 26470 } 26471 } 26472 } 26473 function ignoreAttribute(attr, element, updateType, ctx) { 26474 if (attr === "value" && ctx.ignoreActiveValue && element === document.activeElement) { 26475 return true; 26476 } 26477 return ctx.callbacks.beforeAttributeUpdated(attr, element, updateType) === false; 26478 } 26479 function ignoreValueOfActiveElement(possibleActiveElement, ctx) { 26480 return !!ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body; 26481 } 26482 return morphNode; 26483 }(); 26484 function withHeadBlocking(ctx, oldNode, newNode, callback) { 26485 if (ctx.head.block) { 26486 const oldHead = oldNode.querySelector("head"); 26487 const newHead = newNode.querySelector("head"); 26488 if (oldHead && newHead) { 26489 const promises = handleHeadElement(oldHead, newHead, ctx); 26490 return Promise.all(promises).then(() => { 26491 const newCtx = Object.assign(ctx, { 26492 head: { 26493 block: false, 26494 ignore: true 26495 } 26496 }); 26497 return callback(newCtx); 26498 }); 26499 } 26500 } 26501 return callback(ctx); 26502 } 26503 function handleHeadElement(oldHead, newHead, ctx) { 26504 let added = []; 26505 let removed = []; 26506 let preserved = []; 26507 let nodesToAppend = []; 26508 let srcToNewHeadNodes = new Map; 26509 for (const newHeadChild of newHead.children) { 26510 srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild); 26511 } 26512 for (const currentHeadElt of oldHead.children) { 26513 let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML); 26514 let isReAppended = ctx.head.shouldReAppend(currentHeadElt); 26515 let isPreserved = ctx.head.shouldPreserve(currentHeadElt); 26516 if (inNewContent || isPreserved) { 26517 if (isReAppended) { 26518 removed.push(currentHeadElt); 26519 } else { 26520 srcToNewHeadNodes.delete(currentHeadElt.outerHTML); 26521 preserved.push(currentHeadElt); 26522 } 26523 } else { 26524 if (ctx.head.style === "append") { 26525 if (isReAppended) { 26526 removed.push(currentHeadElt); 26527 nodesToAppend.push(currentHeadElt); 26528 } 26529 } else { 26530 if (ctx.head.shouldRemove(currentHeadElt) !== false) { 26531 removed.push(currentHeadElt); 26532 } 26533 } 26534 } 26535 } 26536 nodesToAppend.push(...srcToNewHeadNodes.values()); 26537 let promises = []; 26538 for (const newNode of nodesToAppend) { 26539 let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild; 26540 if (ctx.callbacks.beforeNodeAdded(newElt) !== false) { 26541 if ("href" in newElt && newElt.href || "src" in newElt && newElt.src) { 26542 let resolve; 26543 let promise = new Promise(function(_resolve) { 26544 resolve = _resolve; 26545 }); 26546 newElt.addEventListener("load", function() { 26547 resolve(); 26548 }); 26549 promises.push(promise); 26550 } 26551 oldHead.appendChild(newElt); 26552 ctx.callbacks.afterNodeAdded(newElt); 26553 added.push(newElt); 26554 } 26555 } 26556 for (const removedElement of removed) { 26557 if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) { 26558 oldHead.removeChild(removedElement); 26559 ctx.callbacks.afterNodeRemoved(removedElement); 26560 } 26561 } 26562 ctx.head.afterHeadMorphed(oldHead, { 26563 added, 26564 kept: preserved, 26565 removed 26566 }); 26567 return promises; 26568 } 26569 const createMorphContext = function() { 26570 function createMorphContext(oldNode, newContent, config2) { 26571 const { persistentIds, idMap } = createIdMaps(oldNode, newContent); 26572 const mergedConfig = mergeDefaults(config2); 26573 const morphStyle = mergedConfig.morphStyle || "outerHTML"; 26574 if (!["innerHTML", "outerHTML"].includes(morphStyle)) { 26575 throw `Do not understand how to morph style ${morphStyle}`; 26576 } 26577 return { 26578 target: oldNode, 26579 newContent, 26580 config: mergedConfig, 26581 morphStyle, 26582 ignoreActive: mergedConfig.ignoreActive, 26583 ignoreActiveValue: mergedConfig.ignoreActiveValue, 26584 restoreFocus: mergedConfig.restoreFocus, 26585 idMap, 26586 persistentIds, 26587 pantry: createPantry(), 26588 activeElementAndParents: createActiveElementAndParents(oldNode), 26589 callbacks: mergedConfig.callbacks, 26590 head: mergedConfig.head 26591 }; 26592 } 26593 function mergeDefaults(config2) { 26594 let finalConfig = Object.assign({}, defaults); 26595 Object.assign(finalConfig, config2); 26596 finalConfig.callbacks = Object.assign({}, defaults.callbacks, config2.callbacks); 26597 finalConfig.head = Object.assign({}, defaults.head, config2.head); 26598 return finalConfig; 26599 } 26600 function createPantry() { 26601 const pantry = document.createElement("div"); 26602 pantry.hidden = true; 26603 document.body.insertAdjacentElement("afterend", pantry); 26604 return pantry; 26605 } 26606 function createActiveElementAndParents(oldNode) { 26607 let activeElementAndParents = []; 26608 let elt = document.activeElement; 26609 if (elt?.tagName !== "BODY" && oldNode.contains(elt)) { 26610 while (elt) { 26611 activeElementAndParents.push(elt); 26612 if (elt === oldNode) 26613 break; 26614 elt = elt.parentElement; 26615 } 26616 } 26617 return activeElementAndParents; 26618 } 26619 function findIdElements(root2) { 26620 let elements = Array.from(root2.querySelectorAll("[id]")); 26621 if (root2.getAttribute?.("id")) { 26622 elements.push(root2); 26623 } 26624 return elements; 26625 } 26626 function populateIdMapWithTree(idMap, persistentIds, root2, elements) { 26627 for (const elt of elements) { 26628 const id = elt.getAttribute("id"); 26629 if (persistentIds.has(id)) { 26630 let current = elt; 26631 while (current) { 26632 let idSet = idMap.get(current); 26633 if (idSet == null) { 26634 idSet = new Set; 26635 idMap.set(current, idSet); 26636 } 26637 idSet.add(id); 26638 if (current === root2) 26639 break; 26640 current = current.parentElement; 26641 } 26642 } 26643 } 26644 } 26645 function createIdMaps(oldContent, newContent) { 26646 const oldIdElements = findIdElements(oldContent); 26647 const newIdElements = findIdElements(newContent); 26648 const persistentIds = createPersistentIds(oldIdElements, newIdElements); 26649 let idMap = new Map; 26650 populateIdMapWithTree(idMap, persistentIds, oldContent, oldIdElements); 26651 const newRoot = newContent.__idiomorphRoot || newContent; 26652 populateIdMapWithTree(idMap, persistentIds, newRoot, newIdElements); 26653 return { persistentIds, idMap }; 26654 } 26655 function createPersistentIds(oldIdElements, newIdElements) { 26656 let duplicateIds = new Set; 26657 let oldIdTagNameMap = new Map; 26658 for (const { id, tagName } of oldIdElements) { 26659 if (oldIdTagNameMap.has(id)) { 26660 duplicateIds.add(id); 26661 } else { 26662 oldIdTagNameMap.set(id, tagName); 26663 } 26664 } 26665 let persistentIds = new Set; 26666 for (const { id, tagName } of newIdElements) { 26667 if (persistentIds.has(id)) { 26668 duplicateIds.add(id); 26669 } else if (oldIdTagNameMap.get(id) === tagName) { 26670 persistentIds.add(id); 26671 } 26672 } 26673 for (const id of duplicateIds) { 26674 persistentIds.delete(id); 26675 } 26676 return persistentIds; 26677 } 26678 return createMorphContext; 26679 }(); 26680 const { normalizeElement, normalizeParent } = function() { 26681 const generatedByIdiomorph = new WeakSet; 26682 function normalizeElement(content) { 26683 if (content instanceof Document) { 26684 return content.documentElement; 26685 } else { 26686 return content; 26687 } 26688 } 26689 function normalizeParent(newContent) { 26690 if (newContent == null) { 26691 return document.createElement("div"); 26692 } else if (typeof newContent === "string") { 26693 return normalizeParent(parseContent(newContent)); 26694 } else if (generatedByIdiomorph.has(newContent)) { 26695 return newContent; 26696 } else if (newContent instanceof Node) { 26697 if (newContent.parentNode) { 26698 return new SlicedParentNode(newContent); 26699 } else { 26700 const dummyParent = document.createElement("div"); 26701 dummyParent.append(newContent); 26702 return dummyParent; 26703 } 26704 } else { 26705 const dummyParent = document.createElement("div"); 26706 for (const elt of [...newContent]) { 26707 dummyParent.append(elt); 26708 } 26709 return dummyParent; 26710 } 26711 } 26712 26713 class SlicedParentNode { 26714 constructor(node) { 26715 this.originalNode = node; 26716 this.realParentNode = node.parentNode; 26717 this.previousSibling = node.previousSibling; 26718 this.nextSibling = node.nextSibling; 26719 } 26720 get childNodes() { 26721 const nodes = []; 26722 let cursor = this.previousSibling ? this.previousSibling.nextSibling : this.realParentNode.firstChild; 26723 while (cursor && cursor != this.nextSibling) { 26724 nodes.push(cursor); 26725 cursor = cursor.nextSibling; 26726 } 26727 return nodes; 26728 } 26729 querySelectorAll(selector) { 26730 return this.childNodes.reduce((results, node) => { 26731 if (node instanceof Element) { 26732 if (node.matches(selector)) 26733 results.push(node); 26734 const nodeList = node.querySelectorAll(selector); 26735 for (let i = 0;i < nodeList.length; i++) { 26736 results.push(nodeList[i]); 26737 } 26738 } 26739 return results; 26740 }, []); 26741 } 26742 insertBefore(node, referenceNode) { 26743 return this.realParentNode.insertBefore(node, referenceNode); 26744 } 26745 moveBefore(node, referenceNode) { 26746 return this.realParentNode.moveBefore(node, referenceNode); 26747 } 26748 get __idiomorphRoot() { 26749 return this.originalNode; 26750 } 26751 } 26752 function parseContent(newContent) { 26753 let parser = new DOMParser; 26754 let contentWithSvgsRemoved = newContent.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim, ""); 26755 if (contentWithSvgsRemoved.match(/<\/html>/) || contentWithSvgsRemoved.match(/<\/head>/) || contentWithSvgsRemoved.match(/<\/body>/)) { 26756 let content = parser.parseFromString(newContent, "text/html"); 26757 if (contentWithSvgsRemoved.match(/<\/html>/)) { 26758 generatedByIdiomorph.add(content); 26759 return content; 26760 } else { 26761 let htmlElement = content.firstChild; 26762 if (htmlElement) { 26763 generatedByIdiomorph.add(htmlElement); 26764 } 26765 return htmlElement; 26766 } 26767 } else { 26768 let responseDoc = parser.parseFromString("<body><template>" + newContent + "</template></body>", "text/html"); 26769 let content = responseDoc.body.querySelector("template").content; 26770 generatedByIdiomorph.add(content); 26771 return content; 26772 } 26773 } 26774 return { normalizeElement, normalizeParent }; 26775 }(); 26776 return { 26777 morph, 26778 defaults 26779 }; 26780}(); 26781function morphElements(currentElement, newElement, { callbacks, ...options2 } = {}) { 26782 Idiomorph.morph(currentElement, newElement, { 26783 ...options2, 26784 callbacks: new DefaultIdiomorphCallbacks(callbacks) 26785 }); 26786} 26787function morphChildren(currentElement, newElement, options2 = {}) { 26788 morphElements(currentElement, newElement.childNodes, { 26789 ...options2, 26790 morphStyle: "innerHTML" 26791 }); 26792} 26793function shouldRefreshFrameWithMorphing(currentFrame, newFrame) { 26794 return currentFrame instanceof FrameElement && currentFrame.shouldReloadWithMorph && (!newFrame || areFramesCompatibleForRefreshing(currentFrame, newFrame)) && !currentFrame.closest("[data-turbo-permanent]"); 26795} 26796function areFramesCompatibleForRefreshing(currentFrame, newFrame) { 26797 return newFrame instanceof Element && newFrame.nodeName === "TURBO-FRAME" && currentFrame.id === newFrame.id && (!newFrame.getAttribute("src") || urlsAreEqual(currentFrame.src, newFrame.getAttribute("src"))); 26798} 26799function closestFrameReloadableWithMorphing(node) { 26800 return node.parentElement.closest("turbo-frame[src][refresh=morph]"); 26801} 26802 26803class DefaultIdiomorphCallbacks { 26804 #beforeNodeMorphed; 26805 constructor({ beforeNodeMorphed } = {}) { 26806 this.#beforeNodeMorphed = beforeNodeMorphed || (() => true); 26807 } 26808 beforeNodeAdded = (node) => { 26809 return !(node.id && node.hasAttribute("data-turbo-permanent") && document.getElementById(node.id)); 26810 }; 26811 beforeNodeMorphed = (currentElement, newElement) => { 26812 if (currentElement instanceof Element) { 26813 if (!currentElement.hasAttribute("data-turbo-permanent") && this.#beforeNodeMorphed(currentElement, newElement)) { 26814 const event = dispatch("turbo:before-morph-element", { 26815 cancelable: true, 26816 target: currentElement, 26817 detail: { currentElement, newElement } 26818 }); 26819 return !event.defaultPrevented; 26820 } else { 26821 return false; 26822 } 26823 } 26824 }; 26825 beforeAttributeUpdated = (attributeName, target, mutationType) => { 26826 const event = dispatch("turbo:before-morph-attribute", { 26827 cancelable: true, 26828 target, 26829 detail: { attributeName, mutationType } 26830 }); 26831 return !event.defaultPrevented; 26832 }; 26833 beforeNodeRemoved = (node) => { 26834 return this.beforeNodeMorphed(node); 26835 }; 26836 afterNodeMorphed = (currentElement, newElement) => { 26837 if (currentElement instanceof Element) { 26838 dispatch("turbo:morph-element", { 26839 target: currentElement, 26840 detail: { currentElement, newElement } 26841 }); 26842 } 26843 }; 26844} 26845 26846class MorphingFrameRenderer extends FrameRenderer { 26847 static renderElement(currentElement, newElement) { 26848 dispatch("turbo:before-frame-morph", { 26849 target: currentElement, 26850 detail: { currentElement, newElement } 26851 }); 26852 morphChildren(currentElement, newElement, { 26853 callbacks: { 26854 beforeNodeMorphed: (node, newNode) => { 26855 if (shouldRefreshFrameWithMorphing(node, newNode) && closestFrameReloadableWithMorphing(node) === currentElement) { 26856 node.reload(); 26857 return false; 26858 } 26859 return true; 26860 } 26861 } 26862 }); 26863 } 26864 async preservingPermanentElements(callback) { 26865 return await callback(); 26866 } 26867} 26868 26869class ProgressBar { 26870 static animationDuration = 300; 26871 static get defaultCSS() { 26872 return unindent` 26873 .turbo-progress-bar { 26874 position: fixed; 26875 display: block; 26876 top: 0; 26877 left: 0; 26878 height: 3px; 26879 background: #0076ff; 26880 z-index: 2147483647; 26881 transition: 26882 width ${ProgressBar.animationDuration}ms ease-out, 26883 opacity ${ProgressBar.animationDuration / 2}ms ${ProgressBar.animationDuration / 2}ms ease-in; 26884 transform: translate3d(0, 0, 0); 26885 } 26886 `; 26887 } 26888 hiding = false; 26889 value = 0; 26890 visible = false; 26891 constructor() { 26892 this.stylesheetElement = this.createStylesheetElement(); 26893 this.progressElement = this.createProgressElement(); 26894 this.installStylesheetElement(); 26895 this.setValue(0); 26896 } 26897 show() { 26898 if (!this.visible) { 26899 this.visible = true; 26900 this.installProgressElement(); 26901 this.startTrickling(); 26902 } 26903 } 26904 hide() { 26905 if (this.visible && !this.hiding) { 26906 this.hiding = true; 26907 this.fadeProgressElement(() => { 26908 this.uninstallProgressElement(); 26909 this.stopTrickling(); 26910 this.visible = false; 26911 this.hiding = false; 26912 }); 26913 } 26914 } 26915 setValue(value) { 26916 this.value = value; 26917 this.refresh(); 26918 } 26919 installStylesheetElement() { 26920 document.head.insertBefore(this.stylesheetElement, document.head.firstChild); 26921 } 26922 installProgressElement() { 26923 this.progressElement.style.width = "0"; 26924 this.progressElement.style.opacity = "1"; 26925 document.documentElement.insertBefore(this.progressElement, document.body); 26926 this.refresh(); 26927 } 26928 fadeProgressElement(callback) { 26929 this.progressElement.style.opacity = "0"; 26930 setTimeout(callback, ProgressBar.animationDuration * 1.5); 26931 } 26932 uninstallProgressElement() { 26933 if (this.progressElement.parentNode) { 26934 document.documentElement.removeChild(this.progressElement); 26935 } 26936 } 26937 startTrickling() { 26938 if (!this.trickleInterval) { 26939 this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration); 26940 } 26941 } 26942 stopTrickling() { 26943 window.clearInterval(this.trickleInterval); 26944 delete this.trickleInterval; 26945 } 26946 trickle = () => { 26947 this.setValue(this.value + Math.random() / 100); 26948 }; 26949 refresh() { 26950 requestAnimationFrame(() => { 26951 this.progressElement.style.width = `${10 + this.value * 90}%`; 26952 }); 26953 } 26954 createStylesheetElement() { 26955 const element = document.createElement("style"); 26956 element.type = "text/css"; 26957 element.textContent = ProgressBar.defaultCSS; 26958 const cspNonce = getCspNonce(); 26959 if (cspNonce) { 26960 element.nonce = cspNonce; 26961 } 26962 return element; 26963 } 26964 createProgressElement() { 26965 const element = document.createElement("div"); 26966 element.className = "turbo-progress-bar"; 26967 return element; 26968 } 26969} 26970 26971class HeadSnapshot extends Snapshot { 26972 detailsByOuterHTML = this.children.filter((element) => !elementIsNoscript(element)).map((element) => elementWithoutNonce(element)).reduce((result, element) => { 26973 const { outerHTML } = element; 26974 const details = outerHTML in result ? result[outerHTML] : { 26975 type: elementType(element), 26976 tracked: elementIsTracked(element), 26977 elements: [] 26978 }; 26979 return { 26980 ...result, 26981 [outerHTML]: { 26982 ...details, 26983 elements: [...details.elements, element] 26984 } 26985 }; 26986 }, {}); 26987 get trackedElementSignature() { 26988 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked).join(""); 26989 } 26990 getScriptElementsNotInSnapshot(snapshot) { 26991 return this.getElementsMatchingTypeNotInSnapshot("script", snapshot); 26992 } 26993 getStylesheetElementsNotInSnapshot(snapshot) { 26994 return this.getElementsMatchingTypeNotInSnapshot("stylesheet", snapshot); 26995 } 26996 getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) { 26997 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML)).map((outerHTML) => this.detailsByOuterHTML[outerHTML]).filter(({ type }) => type == matchedType).map(({ elements: [element] }) => element); 26998 } 26999 get provisionalElements() { 27000 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 27001 const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML]; 27002 if (type == null && !tracked) { 27003 return [...result, ...elements]; 27004 } else if (elements.length > 1) { 27005 return [...result, ...elements.slice(1)]; 27006 } else { 27007 return result; 27008 } 27009 }, []); 27010 } 27011 getMetaValue(name) { 27012 const element = this.findMetaElementByName(name); 27013 return element ? element.getAttribute("content") : null; 27014 } 27015 findMetaElementByName(name) { 27016 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 27017 const { 27018 elements: [element] 27019 } = this.detailsByOuterHTML[outerHTML]; 27020 return elementIsMetaElementWithName(element, name) ? element : result; 27021 }, undefined | undefined); 27022 } 27023} 27024function elementType(element) { 27025 if (elementIsScript(element)) { 27026 return "script"; 27027 } else if (elementIsStylesheet(element)) { 27028 return "stylesheet"; 27029 } 27030} 27031function elementIsTracked(element) { 27032 return element.getAttribute("data-turbo-track") == "reload"; 27033} 27034function elementIsScript(element) { 27035 const tagName = element.localName; 27036 return tagName == "script"; 27037} 27038function elementIsNoscript(element) { 27039 const tagName = element.localName; 27040 return tagName == "noscript"; 27041} 27042function elementIsStylesheet(element) { 27043 const tagName = element.localName; 27044 return tagName == "style" || tagName == "link" && element.getAttribute("rel") == "stylesheet"; 27045} 27046function elementIsMetaElementWithName(element, name) { 27047 const tagName = element.localName; 27048 return tagName == "meta" && element.getAttribute("name") == name; 27049} 27050function elementWithoutNonce(element) { 27051 if (element.hasAttribute("nonce")) { 27052 element.setAttribute("nonce", ""); 27053 } 27054 return element; 27055} 27056 27057class PageSnapshot extends Snapshot { 27058 static fromHTMLString(html = "") { 27059 return this.fromDocument(parseHTMLDocument(html)); 27060 } 27061 static fromElement(element) { 27062 return this.fromDocument(element.ownerDocument); 27063 } 27064 static fromDocument({ documentElement, body, head }) { 27065 return new this(documentElement, body, new HeadSnapshot(head)); 27066 } 27067 constructor(documentElement, body, headSnapshot) { 27068 super(body); 27069 this.documentElement = documentElement; 27070 this.headSnapshot = headSnapshot; 27071 } 27072 clone() { 27073 const clonedElement = this.element.cloneNode(true); 27074 const selectElements = this.element.querySelectorAll("select"); 27075 const clonedSelectElements = clonedElement.querySelectorAll("select"); 27076 for (const [index, source] of selectElements.entries()) { 27077 const clone2 = clonedSelectElements[index]; 27078 for (const option of clone2.selectedOptions) 27079 option.selected = false; 27080 for (const option of source.selectedOptions) 27081 clone2.options[option.index].selected = true; 27082 } 27083 for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type="password"]')) { 27084 clonedPasswordInput.value = ""; 27085 } 27086 for (const clonedNoscriptElement of clonedElement.querySelectorAll("noscript")) { 27087 clonedNoscriptElement.remove(); 27088 } 27089 return new PageSnapshot(this.documentElement, clonedElement, this.headSnapshot); 27090 } 27091 get lang() { 27092 return this.documentElement.getAttribute("lang"); 27093 } 27094 get dir() { 27095 return this.documentElement.getAttribute("dir"); 27096 } 27097 get headElement() { 27098 return this.headSnapshot.element; 27099 } 27100 get rootLocation() { 27101 const root2 = this.getSetting("root") ?? "/"; 27102 return expandURL(root2); 27103 } 27104 get cacheControlValue() { 27105 return this.getSetting("cache-control"); 27106 } 27107 get isPreviewable() { 27108 return this.cacheControlValue != "no-preview"; 27109 } 27110 get isCacheable() { 27111 return this.cacheControlValue != "no-cache"; 27112 } 27113 get isVisitable() { 27114 return this.getSetting("visit-control") != "reload"; 27115 } 27116 get prefersViewTransitions() { 27117 const viewTransitionEnabled = this.getSetting("view-transition") === "true" || this.headSnapshot.getMetaValue("view-transition") === "same-origin"; 27118 return viewTransitionEnabled && !window.matchMedia("(prefers-reduced-motion: reduce)").matches; 27119 } 27120 get refreshMethod() { 27121 return this.getSetting("refresh-method"); 27122 } 27123 get refreshScroll() { 27124 return this.getSetting("refresh-scroll"); 27125 } 27126 getSetting(name) { 27127 return this.headSnapshot.getMetaValue(`turbo-${name}`); 27128 } 27129} 27130 27131class ViewTransitioner { 27132 #viewTransitionStarted = false; 27133 #lastOperation = Promise.resolve(); 27134 renderChange(useViewTransition, render) { 27135 if (useViewTransition && this.viewTransitionsAvailable && !this.#viewTransitionStarted) { 27136 this.#viewTransitionStarted = true; 27137 this.#lastOperation = this.#lastOperation.then(async () => { 27138 await document.startViewTransition(render).finished; 27139 }); 27140 } else { 27141 this.#lastOperation = this.#lastOperation.then(render); 27142 } 27143 return this.#lastOperation; 27144 } 27145 get viewTransitionsAvailable() { 27146 return document.startViewTransition; 27147 } 27148} 27149var defaultOptions = { 27150 action: "advance", 27151 historyChanged: false, 27152 visitCachedSnapshot: () => {}, 27153 willRender: true, 27154 updateHistory: true, 27155 shouldCacheSnapshot: true, 27156 acceptsStreamResponse: false, 27157 refresh: {} 27158}; 27159var TimingMetric = { 27160 visitStart: "visitStart", 27161 requestStart: "requestStart", 27162 requestEnd: "requestEnd", 27163 visitEnd: "visitEnd" 27164}; 27165var VisitState = { 27166 initialized: "initialized", 27167 started: "started", 27168 canceled: "canceled", 27169 failed: "failed", 27170 completed: "completed" 27171}; 27172var SystemStatusCode = { 27173 networkFailure: 0, 27174 timeoutFailure: -1, 27175 contentTypeMismatch: -2 27176}; 27177var Direction = { 27178 advance: "forward", 27179 restore: "back", 27180 replace: "none" 27181}; 27182 27183class Visit { 27184 identifier = uuid(); 27185 timingMetrics = {}; 27186 followedRedirect = false; 27187 historyChanged = false; 27188 scrolled = false; 27189 shouldCacheSnapshot = true; 27190 acceptsStreamResponse = false; 27191 snapshotCached = false; 27192 state = VisitState.initialized; 27193 viewTransitioner = new ViewTransitioner; 27194 constructor(delegate, location2, restorationIdentifier, options2 = {}) { 27195 this.delegate = delegate; 27196 this.location = location2; 27197 this.restorationIdentifier = restorationIdentifier || uuid(); 27198 const { 27199 action, 27200 historyChanged, 27201 referrer, 27202 snapshot, 27203 snapshotHTML, 27204 response, 27205 visitCachedSnapshot, 27206 willRender, 27207 updateHistory, 27208 shouldCacheSnapshot, 27209 acceptsStreamResponse, 27210 direction, 27211 refresh 27212 } = { 27213 ...defaultOptions, 27214 ...options2 27215 }; 27216 this.action = action; 27217 this.historyChanged = historyChanged; 27218 this.referrer = referrer; 27219 this.snapshot = snapshot; 27220 this.snapshotHTML = snapshotHTML; 27221 this.response = response; 27222 this.isPageRefresh = this.view.isPageRefresh(this); 27223 this.visitCachedSnapshot = visitCachedSnapshot; 27224 this.willRender = willRender; 27225 this.updateHistory = updateHistory; 27226 this.scrolled = !willRender; 27227 this.shouldCacheSnapshot = shouldCacheSnapshot; 27228 this.acceptsStreamResponse = acceptsStreamResponse; 27229 this.direction = direction || Direction[action]; 27230 this.refresh = refresh; 27231 } 27232 get adapter() { 27233 return this.delegate.adapter; 27234 } 27235 get view() { 27236 return this.delegate.view; 27237 } 27238 get history() { 27239 return this.delegate.history; 27240 } 27241 get restorationData() { 27242 return this.history.getRestorationDataForIdentifier(this.restorationIdentifier); 27243 } 27244 start() { 27245 if (this.state == VisitState.initialized) { 27246 this.recordTimingMetric(TimingMetric.visitStart); 27247 this.state = VisitState.started; 27248 this.adapter.visitStarted(this); 27249 this.delegate.visitStarted(this); 27250 } 27251 } 27252 cancel() { 27253 if (this.state == VisitState.started) { 27254 if (this.request) { 27255 this.request.cancel(); 27256 } 27257 this.cancelRender(); 27258 this.state = VisitState.canceled; 27259 } 27260 } 27261 complete() { 27262 if (this.state == VisitState.started) { 27263 this.recordTimingMetric(TimingMetric.visitEnd); 27264 this.adapter.visitCompleted(this); 27265 this.state = VisitState.completed; 27266 this.followRedirect(); 27267 if (!this.followedRedirect) { 27268 this.delegate.visitCompleted(this); 27269 } 27270 } 27271 } 27272 fail() { 27273 if (this.state == VisitState.started) { 27274 this.state = VisitState.failed; 27275 this.adapter.visitFailed(this); 27276 this.delegate.visitCompleted(this); 27277 } 27278 } 27279 changeHistory() { 27280 if (!this.historyChanged && this.updateHistory) { 27281 const actionForHistory = this.location.href === this.referrer?.href ? "replace" : this.action; 27282 const method = getHistoryMethodForAction(actionForHistory); 27283 this.history.update(method, this.location, this.restorationIdentifier); 27284 this.historyChanged = true; 27285 } 27286 } 27287 issueRequest() { 27288 if (this.hasPreloadedResponse()) { 27289 this.simulateRequest(); 27290 } else if (this.shouldIssueRequest() && !this.request) { 27291 this.request = new FetchRequest(this, FetchMethod.get, this.location); 27292 this.request.perform(); 27293 } 27294 } 27295 simulateRequest() { 27296 if (this.response) { 27297 this.startRequest(); 27298 this.recordResponse(); 27299 this.finishRequest(); 27300 } 27301 } 27302 startRequest() { 27303 this.recordTimingMetric(TimingMetric.requestStart); 27304 this.adapter.visitRequestStarted(this); 27305 } 27306 recordResponse(response = this.response) { 27307 this.response = response; 27308 if (response) { 27309 const { statusCode } = response; 27310 if (isSuccessful(statusCode)) { 27311 this.adapter.visitRequestCompleted(this); 27312 } else { 27313 this.adapter.visitRequestFailedWithStatusCode(this, statusCode); 27314 } 27315 } 27316 } 27317 finishRequest() { 27318 this.recordTimingMetric(TimingMetric.requestEnd); 27319 this.adapter.visitRequestFinished(this); 27320 } 27321 loadResponse() { 27322 if (this.response) { 27323 const { statusCode, responseHTML } = this.response; 27324 this.render(async () => { 27325 if (this.shouldCacheSnapshot) 27326 this.cacheSnapshot(); 27327 if (this.view.renderPromise) 27328 await this.view.renderPromise; 27329 if (isSuccessful(statusCode) && responseHTML != null) { 27330 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 27331 await this.renderPageSnapshot(snapshot, false); 27332 this.adapter.visitRendered(this); 27333 this.complete(); 27334 } else { 27335 await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this); 27336 this.adapter.visitRendered(this); 27337 this.fail(); 27338 } 27339 }); 27340 } 27341 } 27342 getCachedSnapshot() { 27343 const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot(); 27344 if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) { 27345 if (this.action == "restore" || snapshot.isPreviewable) { 27346 return snapshot; 27347 } 27348 } 27349 } 27350 getPreloadedSnapshot() { 27351 if (this.snapshotHTML) { 27352 return PageSnapshot.fromHTMLString(this.snapshotHTML); 27353 } 27354 } 27355 hasCachedSnapshot() { 27356 return this.getCachedSnapshot() != null; 27357 } 27358 loadCachedSnapshot() { 27359 const snapshot = this.getCachedSnapshot(); 27360 if (snapshot) { 27361 const isPreview = this.shouldIssueRequest(); 27362 this.render(async () => { 27363 this.cacheSnapshot(); 27364 if (this.isPageRefresh) { 27365 this.adapter.visitRendered(this); 27366 } else { 27367 if (this.view.renderPromise) 27368 await this.view.renderPromise; 27369 await this.renderPageSnapshot(snapshot, isPreview); 27370 this.adapter.visitRendered(this); 27371 if (!isPreview) { 27372 this.complete(); 27373 } 27374 } 27375 }); 27376 } 27377 } 27378 followRedirect() { 27379 if (this.redirectedToLocation && !this.followedRedirect && this.response?.redirected) { 27380 this.adapter.visitProposedToLocation(this.redirectedToLocation, { 27381 action: "replace", 27382 response: this.response, 27383 shouldCacheSnapshot: false, 27384 willRender: false 27385 }); 27386 this.followedRedirect = true; 27387 } 27388 } 27389 prepareRequest(request) { 27390 if (this.acceptsStreamResponse) { 27391 request.acceptResponseType(StreamMessage.contentType); 27392 } 27393 } 27394 requestStarted() { 27395 this.startRequest(); 27396 } 27397 requestPreventedHandlingResponse(_request, _response) {} 27398 async requestSucceededWithResponse(request, response) { 27399 const responseHTML = await response.responseHTML; 27400 const { redirected, statusCode } = response; 27401 if (responseHTML == undefined) { 27402 this.recordResponse({ 27403 statusCode: SystemStatusCode.contentTypeMismatch, 27404 redirected 27405 }); 27406 } else { 27407 this.redirectedToLocation = response.redirected ? response.location : undefined; 27408 this.recordResponse({ statusCode, responseHTML, redirected }); 27409 } 27410 } 27411 async requestFailedWithResponse(request, response) { 27412 const responseHTML = await response.responseHTML; 27413 const { redirected, statusCode } = response; 27414 if (responseHTML == undefined) { 27415 this.recordResponse({ 27416 statusCode: SystemStatusCode.contentTypeMismatch, 27417 redirected 27418 }); 27419 } else { 27420 this.recordResponse({ statusCode, responseHTML, redirected }); 27421 } 27422 } 27423 requestErrored(_request, _error) { 27424 this.recordResponse({ 27425 statusCode: SystemStatusCode.networkFailure, 27426 redirected: false 27427 }); 27428 } 27429 requestFinished() { 27430 this.finishRequest(); 27431 } 27432 performScroll() { 27433 if (!this.scrolled && !this.view.forceReloaded && !this.view.shouldPreserveScrollPosition(this)) { 27434 if (this.action == "restore") { 27435 this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop(); 27436 } else { 27437 this.scrollToAnchor() || this.view.scrollToTop(); 27438 } 27439 this.scrolled = true; 27440 } 27441 } 27442 scrollToRestoredPosition() { 27443 const { scrollPosition } = this.restorationData; 27444 if (scrollPosition) { 27445 this.view.scrollToPosition(scrollPosition); 27446 return true; 27447 } 27448 } 27449 scrollToAnchor() { 27450 const anchor = getAnchor(this.location); 27451 if (anchor != null) { 27452 this.view.scrollToAnchor(anchor); 27453 return true; 27454 } 27455 } 27456 recordTimingMetric(metric) { 27457 this.timingMetrics[metric] = new Date().getTime(); 27458 } 27459 getTimingMetrics() { 27460 return { ...this.timingMetrics }; 27461 } 27462 hasPreloadedResponse() { 27463 return typeof this.response == "object"; 27464 } 27465 shouldIssueRequest() { 27466 if (this.action == "restore") { 27467 return !this.hasCachedSnapshot(); 27468 } else { 27469 return this.willRender; 27470 } 27471 } 27472 cacheSnapshot() { 27473 if (!this.snapshotCached) { 27474 this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot)); 27475 this.snapshotCached = true; 27476 } 27477 } 27478 async render(callback) { 27479 this.cancelRender(); 27480 await new Promise((resolve) => { 27481 this.frame = document.visibilityState === "hidden" ? setTimeout(() => resolve(), 0) : requestAnimationFrame(() => resolve()); 27482 }); 27483 await callback(); 27484 delete this.frame; 27485 } 27486 async renderPageSnapshot(snapshot, isPreview) { 27487 await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(snapshot), async () => { 27488 await this.view.renderPage(snapshot, isPreview, this.willRender, this); 27489 this.performScroll(); 27490 }); 27491 } 27492 cancelRender() { 27493 if (this.frame) { 27494 cancelAnimationFrame(this.frame); 27495 delete this.frame; 27496 } 27497 } 27498} 27499function isSuccessful(statusCode) { 27500 return statusCode >= 200 && statusCode < 300; 27501} 27502 27503class BrowserAdapter { 27504 progressBar = new ProgressBar; 27505 constructor(session2) { 27506 this.session = session2; 27507 } 27508 visitProposedToLocation(location2, options2) { 27509 if (locationIsVisitable(location2, this.navigator.rootLocation)) { 27510 this.navigator.startVisit(location2, options2?.restorationIdentifier || uuid(), options2); 27511 } else { 27512 window.location.href = location2.toString(); 27513 } 27514 } 27515 visitStarted(visit2) { 27516 this.location = visit2.location; 27517 this.redirectedToLocation = null; 27518 visit2.loadCachedSnapshot(); 27519 visit2.issueRequest(); 27520 } 27521 visitRequestStarted(visit2) { 27522 this.progressBar.setValue(0); 27523 if (visit2.hasCachedSnapshot() || visit2.action != "restore") { 27524 this.showVisitProgressBarAfterDelay(); 27525 } else { 27526 this.showProgressBar(); 27527 } 27528 } 27529 visitRequestCompleted(visit2) { 27530 visit2.loadResponse(); 27531 if (visit2.response.redirected) { 27532 this.redirectedToLocation = visit2.redirectedToLocation; 27533 } 27534 } 27535 visitRequestFailedWithStatusCode(visit2, statusCode) { 27536 switch (statusCode) { 27537 case SystemStatusCode.networkFailure: 27538 case SystemStatusCode.timeoutFailure: 27539 case SystemStatusCode.contentTypeMismatch: 27540 return this.reload({ 27541 reason: "request_failed", 27542 context: { 27543 statusCode 27544 } 27545 }); 27546 default: 27547 return visit2.loadResponse(); 27548 } 27549 } 27550 visitRequestFinished(_visit) {} 27551 visitCompleted(_visit) { 27552 this.progressBar.setValue(1); 27553 this.hideVisitProgressBar(); 27554 } 27555 pageInvalidated(reason) { 27556 this.reload(reason); 27557 } 27558 visitFailed(_visit) { 27559 this.progressBar.setValue(1); 27560 this.hideVisitProgressBar(); 27561 } 27562 visitRendered(_visit) {} 27563 linkPrefetchingIsEnabledForLocation(location2) { 27564 return true; 27565 } 27566 formSubmissionStarted(_formSubmission) { 27567 this.progressBar.setValue(0); 27568 this.showFormProgressBarAfterDelay(); 27569 } 27570 formSubmissionFinished(_formSubmission) { 27571 this.progressBar.setValue(1); 27572 this.hideFormProgressBar(); 27573 } 27574 showVisitProgressBarAfterDelay() { 27575 this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 27576 } 27577 hideVisitProgressBar() { 27578 this.progressBar.hide(); 27579 if (this.visitProgressBarTimeout != null) { 27580 window.clearTimeout(this.visitProgressBarTimeout); 27581 delete this.visitProgressBarTimeout; 27582 } 27583 } 27584 showFormProgressBarAfterDelay() { 27585 if (this.formProgressBarTimeout == null) { 27586 this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 27587 } 27588 } 27589 hideFormProgressBar() { 27590 this.progressBar.hide(); 27591 if (this.formProgressBarTimeout != null) { 27592 window.clearTimeout(this.formProgressBarTimeout); 27593 delete this.formProgressBarTimeout; 27594 } 27595 } 27596 showProgressBar = () => { 27597 this.progressBar.show(); 27598 }; 27599 reload(reason) { 27600 dispatch("turbo:reload", { detail: reason }); 27601 window.location.href = (this.redirectedToLocation || this.location)?.toString() || window.location.href; 27602 } 27603 get navigator() { 27604 return this.session.navigator; 27605 } 27606} 27607 27608class CacheObserver { 27609 selector = "[data-turbo-temporary]"; 27610 started = false; 27611 start() { 27612 if (!this.started) { 27613 this.started = true; 27614 addEventListener("turbo:before-cache", this.removeTemporaryElements, false); 27615 } 27616 } 27617 stop() { 27618 if (this.started) { 27619 this.started = false; 27620 removeEventListener("turbo:before-cache", this.removeTemporaryElements, false); 27621 } 27622 } 27623 removeTemporaryElements = (_event) => { 27624 for (const element of this.temporaryElements) { 27625 element.remove(); 27626 } 27627 }; 27628 get temporaryElements() { 27629 return [...document.querySelectorAll(this.selector)]; 27630 } 27631} 27632 27633class FrameRedirector { 27634 constructor(session2, element) { 27635 this.session = session2; 27636 this.element = element; 27637 this.linkInterceptor = new LinkInterceptor(this, element); 27638 this.formSubmitObserver = new FormSubmitObserver(this, element); 27639 } 27640 start() { 27641 this.linkInterceptor.start(); 27642 this.formSubmitObserver.start(); 27643 } 27644 stop() { 27645 this.linkInterceptor.stop(); 27646 this.formSubmitObserver.stop(); 27647 } 27648 shouldInterceptLinkClick(element, _location, _event) { 27649 return this.#shouldRedirect(element); 27650 } 27651 linkClickIntercepted(element, url, event) { 27652 const frame = this.#findFrameElement(element); 27653 if (frame) { 27654 frame.delegate.linkClickIntercepted(element, url, event); 27655 } 27656 } 27657 willSubmitForm(element, submitter) { 27658 return element.closest("turbo-frame") == null && this.#shouldSubmit(element, submitter) && this.#shouldRedirect(element, submitter); 27659 } 27660 formSubmitted(element, submitter) { 27661 const frame = this.#findFrameElement(element, submitter); 27662 if (frame) { 27663 frame.delegate.formSubmitted(element, submitter); 27664 } 27665 } 27666 #shouldSubmit(form, submitter) { 27667 const action = getAction$1(form, submitter); 27668 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 27669 const rootLocation = expandURL(meta?.content ?? "/"); 27670 return this.#shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation); 27671 } 27672 #shouldRedirect(element, submitter) { 27673 const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter) : this.session.elementIsNavigatable(element); 27674 if (isNavigatable) { 27675 const frame = this.#findFrameElement(element, submitter); 27676 return frame ? frame != element.closest("turbo-frame") : false; 27677 } else { 27678 return false; 27679 } 27680 } 27681 #findFrameElement(element, submitter) { 27682 const id = submitter?.getAttribute("data-turbo-frame") || element.getAttribute("data-turbo-frame"); 27683 if (id && id != "_top") { 27684 const frame = this.element.querySelector(`#${id}:not([disabled])`); 27685 if (frame instanceof FrameElement) { 27686 return frame; 27687 } 27688 } 27689 } 27690} 27691 27692class History2 { 27693 location; 27694 restorationIdentifier = uuid(); 27695 restorationData = {}; 27696 started = false; 27697 currentIndex = 0; 27698 constructor(delegate) { 27699 this.delegate = delegate; 27700 } 27701 start() { 27702 if (!this.started) { 27703 addEventListener("popstate", this.onPopState, false); 27704 this.currentIndex = history.state?.turbo?.restorationIndex || 0; 27705 this.started = true; 27706 this.replace(new URL(window.location.href)); 27707 } 27708 } 27709 stop() { 27710 if (this.started) { 27711 removeEventListener("popstate", this.onPopState, false); 27712 this.started = false; 27713 } 27714 } 27715 push(location2, restorationIdentifier) { 27716 this.update(history.pushState, location2, restorationIdentifier); 27717 } 27718 replace(location2, restorationIdentifier) { 27719 this.update(history.replaceState, location2, restorationIdentifier); 27720 } 27721 update(method, location2, restorationIdentifier = uuid()) { 27722 if (method === history.pushState) 27723 ++this.currentIndex; 27724 const state = { turbo: { restorationIdentifier, restorationIndex: this.currentIndex } }; 27725 method.call(history, state, "", location2.href); 27726 this.location = location2; 27727 this.restorationIdentifier = restorationIdentifier; 27728 } 27729 getRestorationDataForIdentifier(restorationIdentifier) { 27730 return this.restorationData[restorationIdentifier] || {}; 27731 } 27732 updateRestorationData(additionalData) { 27733 const { restorationIdentifier } = this; 27734 const restorationData = this.restorationData[restorationIdentifier]; 27735 this.restorationData[restorationIdentifier] = { 27736 ...restorationData, 27737 ...additionalData 27738 }; 27739 } 27740 assumeControlOfScrollRestoration() { 27741 if (!this.previousScrollRestoration) { 27742 this.previousScrollRestoration = history.scrollRestoration ?? "auto"; 27743 history.scrollRestoration = "manual"; 27744 } 27745 } 27746 relinquishControlOfScrollRestoration() { 27747 if (this.previousScrollRestoration) { 27748 history.scrollRestoration = this.previousScrollRestoration; 27749 delete this.previousScrollRestoration; 27750 } 27751 } 27752 onPopState = (event) => { 27753 const { turbo } = event.state || {}; 27754 this.location = new URL(window.location.href); 27755 if (turbo) { 27756 const { restorationIdentifier, restorationIndex } = turbo; 27757 this.restorationIdentifier = restorationIdentifier; 27758 const direction = restorationIndex > this.currentIndex ? "forward" : "back"; 27759 this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location, restorationIdentifier, direction); 27760 this.currentIndex = restorationIndex; 27761 } else { 27762 this.currentIndex++; 27763 this.delegate.historyPoppedWithEmptyState(this.location); 27764 } 27765 }; 27766} 27767class LinkPrefetchObserver { 27768 started = false; 27769 #prefetchedLink = null; 27770 constructor(delegate, eventTarget) { 27771 this.delegate = delegate; 27772 this.eventTarget = eventTarget; 27773 } 27774 start() { 27775 if (this.started) 27776 return; 27777 if (this.eventTarget.readyState === "loading") { 27778 this.eventTarget.addEventListener("DOMContentLoaded", this.#enable, { once: true }); 27779 } else { 27780 this.#enable(); 27781 } 27782 } 27783 stop() { 27784 if (!this.started) 27785 return; 27786 this.eventTarget.removeEventListener("mouseenter", this.#tryToPrefetchRequest, { 27787 capture: true, 27788 passive: true 27789 }); 27790 this.eventTarget.removeEventListener("mouseleave", this.#cancelRequestIfObsolete, { 27791 capture: true, 27792 passive: true 27793 }); 27794 this.eventTarget.removeEventListener("turbo:before-fetch-request", this.#tryToUsePrefetchedRequest, true); 27795 this.started = false; 27796 } 27797 #enable = () => { 27798 this.eventTarget.addEventListener("mouseenter", this.#tryToPrefetchRequest, { 27799 capture: true, 27800 passive: true 27801 }); 27802 this.eventTarget.addEventListener("mouseleave", this.#cancelRequestIfObsolete, { 27803 capture: true, 27804 passive: true 27805 }); 27806 this.eventTarget.addEventListener("turbo:before-fetch-request", this.#tryToUsePrefetchedRequest, true); 27807 this.started = true; 27808 }; 27809 #tryToPrefetchRequest = (event) => { 27810 if (getMetaContent("turbo-prefetch") === "false") 27811 return; 27812 const target = event.target; 27813 const isLink = target.matches && target.matches("a[href]:not([target^=_]):not([download])"); 27814 if (isLink && this.#isPrefetchable(target)) { 27815 const link = target; 27816 const location2 = getLocationForLink(link); 27817 if (this.delegate.canPrefetchRequestToLocation(link, location2)) { 27818 this.#prefetchedLink = link; 27819 const fetchRequest = new FetchRequest(this, FetchMethod.get, location2, new URLSearchParams, target); 27820 fetchRequest.fetchOptions.priority = "low"; 27821 prefetchCache.putLater(location2, fetchRequest, this.#cacheTtl); 27822 } 27823 } 27824 }; 27825 #cancelRequestIfObsolete = (event) => { 27826 if (event.target === this.#prefetchedLink) 27827 this.#cancelPrefetchRequest(); 27828 }; 27829 #cancelPrefetchRequest = () => { 27830 prefetchCache.clear(); 27831 this.#prefetchedLink = null; 27832 }; 27833 #tryToUsePrefetchedRequest = (event) => { 27834 if (event.target.tagName !== "FORM" && event.detail.fetchOptions.method === "GET") { 27835 const cached = prefetchCache.get(event.detail.url); 27836 if (cached) { 27837 event.detail.fetchRequest = cached; 27838 } 27839 prefetchCache.clear(); 27840 } 27841 }; 27842 prepareRequest(request) { 27843 const link = request.target; 27844 request.headers["X-Sec-Purpose"] = "prefetch"; 27845 const turboFrame = link.closest("turbo-frame"); 27846 const turboFrameTarget = link.getAttribute("data-turbo-frame") || turboFrame?.getAttribute("target") || turboFrame?.id; 27847 if (turboFrameTarget && turboFrameTarget !== "_top") { 27848 request.headers["Turbo-Frame"] = turboFrameTarget; 27849 } 27850 } 27851 requestSucceededWithResponse() {} 27852 requestStarted(fetchRequest) {} 27853 requestErrored(fetchRequest) {} 27854 requestFinished(fetchRequest) {} 27855 requestPreventedHandlingResponse(fetchRequest, fetchResponse) {} 27856 requestFailedWithResponse(fetchRequest, fetchResponse) {} 27857 get #cacheTtl() { 27858 return Number(getMetaContent("turbo-prefetch-cache-time")) || cacheTtl; 27859 } 27860 #isPrefetchable(link) { 27861 const href = link.getAttribute("href"); 27862 if (!href) 27863 return false; 27864 if (unfetchableLink(link)) 27865 return false; 27866 if (linkToTheSamePage(link)) 27867 return false; 27868 if (linkOptsOut(link)) 27869 return false; 27870 if (nonSafeLink(link)) 27871 return false; 27872 if (eventPrevented(link)) 27873 return false; 27874 return true; 27875 } 27876} 27877var unfetchableLink = (link) => { 27878 return link.origin !== document.location.origin || !["http:", "https:"].includes(link.protocol) || link.hasAttribute("target"); 27879}; 27880var linkToTheSamePage = (link) => { 27881 return link.pathname + link.search === document.location.pathname + document.location.search || link.href.startsWith("#"); 27882}; 27883var linkOptsOut = (link) => { 27884 if (link.getAttribute("data-turbo-prefetch") === "false") 27885 return true; 27886 if (link.getAttribute("data-turbo") === "false") 27887 return true; 27888 const turboPrefetchParent = findClosestRecursively(link, "[data-turbo-prefetch]"); 27889 if (turboPrefetchParent && turboPrefetchParent.getAttribute("data-turbo-prefetch") === "false") 27890 return true; 27891 return false; 27892}; 27893var nonSafeLink = (link) => { 27894 const turboMethod = link.getAttribute("data-turbo-method"); 27895 if (turboMethod && turboMethod.toLowerCase() !== "get") 27896 return true; 27897 if (isUJS(link)) 27898 return true; 27899 if (link.hasAttribute("data-turbo-confirm")) 27900 return true; 27901 if (link.hasAttribute("data-turbo-stream")) 27902 return true; 27903 return false; 27904}; 27905var isUJS = (link) => { 27906 return link.hasAttribute("data-remote") || link.hasAttribute("data-behavior") || link.hasAttribute("data-confirm") || link.hasAttribute("data-method"); 27907}; 27908var eventPrevented = (link) => { 27909 const event = dispatch("turbo:before-prefetch", { target: link, cancelable: true }); 27910 return event.defaultPrevented; 27911}; 27912 27913class Navigator { 27914 constructor(delegate) { 27915 this.delegate = delegate; 27916 } 27917 proposeVisit(location2, options2 = {}) { 27918 if (this.delegate.allowsVisitingLocationWithAction(location2, options2.action)) { 27919 this.delegate.visitProposedToLocation(location2, options2); 27920 } 27921 } 27922 startVisit(locatable, restorationIdentifier, options2 = {}) { 27923 this.stop(); 27924 this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, { 27925 referrer: this.location, 27926 ...options2 27927 }); 27928 this.currentVisit.start(); 27929 } 27930 submitForm(form, submitter) { 27931 this.stop(); 27932 this.formSubmission = new FormSubmission(this, form, submitter, true); 27933 this.formSubmission.start(); 27934 } 27935 stop() { 27936 if (this.formSubmission) { 27937 this.formSubmission.stop(); 27938 delete this.formSubmission; 27939 } 27940 if (this.currentVisit) { 27941 this.currentVisit.cancel(); 27942 delete this.currentVisit; 27943 } 27944 } 27945 get adapter() { 27946 return this.delegate.adapter; 27947 } 27948 get view() { 27949 return this.delegate.view; 27950 } 27951 get rootLocation() { 27952 return this.view.snapshot.rootLocation; 27953 } 27954 get history() { 27955 return this.delegate.history; 27956 } 27957 formSubmissionStarted(formSubmission) { 27958 if (typeof this.adapter.formSubmissionStarted === "function") { 27959 this.adapter.formSubmissionStarted(formSubmission); 27960 } 27961 } 27962 async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) { 27963 if (formSubmission == this.formSubmission) { 27964 const responseHTML = await fetchResponse.responseHTML; 27965 if (responseHTML) { 27966 const shouldCacheSnapshot = formSubmission.isSafe; 27967 if (!shouldCacheSnapshot) { 27968 this.view.clearSnapshotCache(); 27969 } 27970 const { statusCode, redirected } = fetchResponse; 27971 const action = this.#getActionForFormSubmission(formSubmission, fetchResponse); 27972 const visitOptions = { 27973 action, 27974 shouldCacheSnapshot, 27975 response: { statusCode, responseHTML, redirected } 27976 }; 27977 this.proposeVisit(fetchResponse.location, visitOptions); 27978 } 27979 } 27980 } 27981 async formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 27982 const responseHTML = await fetchResponse.responseHTML; 27983 if (responseHTML) { 27984 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 27985 if (fetchResponse.serverError) { 27986 await this.view.renderError(snapshot, this.currentVisit); 27987 } else { 27988 await this.view.renderPage(snapshot, false, true, this.currentVisit); 27989 } 27990 if (snapshot.refreshScroll !== "preserve") { 27991 this.view.scrollToTop(); 27992 } 27993 this.view.clearSnapshotCache(); 27994 } 27995 } 27996 formSubmissionErrored(formSubmission, error) { 27997 console.error(error); 27998 } 27999 formSubmissionFinished(formSubmission) { 28000 if (typeof this.adapter.formSubmissionFinished === "function") { 28001 this.adapter.formSubmissionFinished(formSubmission); 28002 } 28003 } 28004 linkPrefetchingIsEnabledForLocation(location2) { 28005 if (typeof this.adapter.linkPrefetchingIsEnabledForLocation === "function") { 28006 return this.adapter.linkPrefetchingIsEnabledForLocation(location2); 28007 } 28008 return true; 28009 } 28010 visitStarted(visit2) { 28011 this.delegate.visitStarted(visit2); 28012 } 28013 visitCompleted(visit2) { 28014 this.delegate.visitCompleted(visit2); 28015 delete this.currentVisit; 28016 } 28017 locationWithActionIsSamePage(location2, action) { 28018 return false; 28019 } 28020 get location() { 28021 return this.history.location; 28022 } 28023 get restorationIdentifier() { 28024 return this.history.restorationIdentifier; 28025 } 28026 #getActionForFormSubmission(formSubmission, fetchResponse) { 28027 const { submitter, formElement } = formSubmission; 28028 return getVisitAction(submitter, formElement) || this.#getDefaultAction(fetchResponse); 28029 } 28030 #getDefaultAction(fetchResponse) { 28031 const sameLocationRedirect = fetchResponse.redirected && fetchResponse.location.href === this.location?.href; 28032 return sameLocationRedirect ? "replace" : "advance"; 28033 } 28034} 28035var PageStage = { 28036 initial: 0, 28037 loading: 1, 28038 interactive: 2, 28039 complete: 3 28040}; 28041 28042class PageObserver { 28043 stage = PageStage.initial; 28044 started = false; 28045 constructor(delegate) { 28046 this.delegate = delegate; 28047 } 28048 start() { 28049 if (!this.started) { 28050 if (this.stage == PageStage.initial) { 28051 this.stage = PageStage.loading; 28052 } 28053 document.addEventListener("readystatechange", this.interpretReadyState, false); 28054 addEventListener("pagehide", this.pageWillUnload, false); 28055 this.started = true; 28056 } 28057 } 28058 stop() { 28059 if (this.started) { 28060 document.removeEventListener("readystatechange", this.interpretReadyState, false); 28061 removeEventListener("pagehide", this.pageWillUnload, false); 28062 this.started = false; 28063 } 28064 } 28065 interpretReadyState = () => { 28066 const { readyState } = this; 28067 if (readyState == "interactive") { 28068 this.pageIsInteractive(); 28069 } else if (readyState == "complete") { 28070 this.pageIsComplete(); 28071 } 28072 }; 28073 pageIsInteractive() { 28074 if (this.stage == PageStage.loading) { 28075 this.stage = PageStage.interactive; 28076 this.delegate.pageBecameInteractive(); 28077 } 28078 } 28079 pageIsComplete() { 28080 this.pageIsInteractive(); 28081 if (this.stage == PageStage.interactive) { 28082 this.stage = PageStage.complete; 28083 this.delegate.pageLoaded(); 28084 } 28085 } 28086 pageWillUnload = () => { 28087 this.delegate.pageWillUnload(); 28088 }; 28089 get readyState() { 28090 return document.readyState; 28091 } 28092} 28093 28094class ScrollObserver { 28095 started = false; 28096 constructor(delegate) { 28097 this.delegate = delegate; 28098 } 28099 start() { 28100 if (!this.started) { 28101 addEventListener("scroll", this.onScroll, false); 28102 this.onScroll(); 28103 this.started = true; 28104 } 28105 } 28106 stop() { 28107 if (this.started) { 28108 removeEventListener("scroll", this.onScroll, false); 28109 this.started = false; 28110 } 28111 } 28112 onScroll = () => { 28113 this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset }); 28114 }; 28115 updatePosition(position) { 28116 this.delegate.scrollPositionChanged(position); 28117 } 28118} 28119 28120class StreamMessageRenderer { 28121 render({ fragment }) { 28122 Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => { 28123 withAutofocusFromFragment(fragment, () => { 28124 withPreservedFocus(() => { 28125 document.documentElement.appendChild(fragment); 28126 }); 28127 }); 28128 }); 28129 } 28130 enteringBardo(currentPermanentElement, newPermanentElement) { 28131 newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true)); 28132 } 28133 leavingBardo() {} 28134} 28135function getPermanentElementMapForFragment(fragment) { 28136 const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement); 28137 const permanentElementMap = {}; 28138 for (const permanentElementInDocument of permanentElementsInDocument) { 28139 const { id } = permanentElementInDocument; 28140 for (const streamElement of fragment.querySelectorAll("turbo-stream")) { 28141 const elementInStream = getPermanentElementById(streamElement.templateElement.content, id); 28142 if (elementInStream) { 28143 permanentElementMap[id] = [permanentElementInDocument, elementInStream]; 28144 } 28145 } 28146 } 28147 return permanentElementMap; 28148} 28149async function withAutofocusFromFragment(fragment, callback) { 28150 const generatedID = `turbo-stream-autofocus-${uuid()}`; 28151 const turboStreams = fragment.querySelectorAll("turbo-stream"); 28152 const elementWithAutofocus = firstAutofocusableElementInStreams(turboStreams); 28153 let willAutofocusId = null; 28154 if (elementWithAutofocus) { 28155 if (elementWithAutofocus.id) { 28156 willAutofocusId = elementWithAutofocus.id; 28157 } else { 28158 willAutofocusId = generatedID; 28159 } 28160 elementWithAutofocus.id = willAutofocusId; 28161 } 28162 callback(); 28163 await nextRepaint(); 28164 const hasNoActiveElement = document.activeElement == null || document.activeElement == document.body; 28165 if (hasNoActiveElement && willAutofocusId) { 28166 const elementToAutofocus = document.getElementById(willAutofocusId); 28167 if (elementIsFocusable(elementToAutofocus)) { 28168 elementToAutofocus.focus(); 28169 } 28170 if (elementToAutofocus && elementToAutofocus.id == generatedID) { 28171 elementToAutofocus.removeAttribute("id"); 28172 } 28173 } 28174} 28175async function withPreservedFocus(callback) { 28176 const [activeElementBeforeRender, activeElementAfterRender] = await around(callback, () => document.activeElement); 28177 const restoreFocusTo = activeElementBeforeRender && activeElementBeforeRender.id; 28178 if (restoreFocusTo) { 28179 const elementToFocus = document.getElementById(restoreFocusTo); 28180 if (elementIsFocusable(elementToFocus) && elementToFocus != activeElementAfterRender) { 28181 elementToFocus.focus(); 28182 } 28183 } 28184} 28185function firstAutofocusableElementInStreams(nodeListOfStreamElements) { 28186 for (const streamElement of nodeListOfStreamElements) { 28187 const elementWithAutofocus = queryAutofocusableElement(streamElement.templateElement.content); 28188 if (elementWithAutofocus) 28189 return elementWithAutofocus; 28190 } 28191 return null; 28192} 28193 28194class StreamObserver { 28195 sources = new Set; 28196 #started = false; 28197 constructor(delegate) { 28198 this.delegate = delegate; 28199 } 28200 start() { 28201 if (!this.#started) { 28202 this.#started = true; 28203 addEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 28204 } 28205 } 28206 stop() { 28207 if (this.#started) { 28208 this.#started = false; 28209 removeEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 28210 } 28211 } 28212 connectStreamSource(source) { 28213 if (!this.streamSourceIsConnected(source)) { 28214 this.sources.add(source); 28215 source.addEventListener("message", this.receiveMessageEvent, false); 28216 } 28217 } 28218 disconnectStreamSource(source) { 28219 if (this.streamSourceIsConnected(source)) { 28220 this.sources.delete(source); 28221 source.removeEventListener("message", this.receiveMessageEvent, false); 28222 } 28223 } 28224 streamSourceIsConnected(source) { 28225 return this.sources.has(source); 28226 } 28227 inspectFetchResponse = (event) => { 28228 const response = fetchResponseFromEvent(event); 28229 if (response && fetchResponseIsStream(response)) { 28230 event.preventDefault(); 28231 this.receiveMessageResponse(response); 28232 } 28233 }; 28234 receiveMessageEvent = (event) => { 28235 if (this.#started && typeof event.data == "string") { 28236 this.receiveMessageHTML(event.data); 28237 } 28238 }; 28239 async receiveMessageResponse(response) { 28240 const html = await response.responseHTML; 28241 if (html) { 28242 this.receiveMessageHTML(html); 28243 } 28244 } 28245 receiveMessageHTML(html) { 28246 this.delegate.receivedMessageFromStream(StreamMessage.wrap(html)); 28247 } 28248} 28249function fetchResponseFromEvent(event) { 28250 const fetchResponse = event.detail?.fetchResponse; 28251 if (fetchResponse instanceof FetchResponse) { 28252 return fetchResponse; 28253 } 28254} 28255function fetchResponseIsStream(response) { 28256 const contentType = response.contentType ?? ""; 28257 return contentType.startsWith(StreamMessage.contentType); 28258} 28259 28260class ErrorRenderer extends Renderer { 28261 static renderElement(currentElement, newElement) { 28262 const { documentElement, body } = document; 28263 documentElement.replaceChild(newElement, body); 28264 } 28265 async render() { 28266 this.replaceHeadAndBody(); 28267 this.activateScriptElements(); 28268 } 28269 replaceHeadAndBody() { 28270 const { documentElement, head } = document; 28271 documentElement.replaceChild(this.newHead, head); 28272 this.renderElement(this.currentElement, this.newElement); 28273 } 28274 activateScriptElements() { 28275 for (const replaceableElement of this.scriptElements) { 28276 const parentNode = replaceableElement.parentNode; 28277 if (parentNode) { 28278 const element = activateScriptElement(replaceableElement); 28279 parentNode.replaceChild(element, replaceableElement); 28280 } 28281 } 28282 } 28283 get newHead() { 28284 return this.newSnapshot.headSnapshot.element; 28285 } 28286 get scriptElements() { 28287 return document.documentElement.querySelectorAll("script"); 28288 } 28289} 28290 28291class PageRenderer extends Renderer { 28292 static renderElement(currentElement, newElement) { 28293 if (document.body && newElement instanceof HTMLBodyElement) { 28294 document.body.replaceWith(newElement); 28295 } else { 28296 document.documentElement.appendChild(newElement); 28297 } 28298 } 28299 get shouldRender() { 28300 return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical; 28301 } 28302 get reloadReason() { 28303 if (!this.newSnapshot.isVisitable) { 28304 return { 28305 reason: "turbo_visit_control_is_reload" 28306 }; 28307 } 28308 if (!this.trackedElementsAreIdentical) { 28309 return { 28310 reason: "tracked_element_mismatch" 28311 }; 28312 } 28313 } 28314 async prepareToRender() { 28315 this.#setLanguage(); 28316 await this.mergeHead(); 28317 } 28318 async render() { 28319 if (this.willRender) { 28320 await this.replaceBody(); 28321 } 28322 } 28323 finishRendering() { 28324 super.finishRendering(); 28325 if (!this.isPreview) { 28326 this.focusFirstAutofocusableElement(); 28327 } 28328 } 28329 get currentHeadSnapshot() { 28330 return this.currentSnapshot.headSnapshot; 28331 } 28332 get newHeadSnapshot() { 28333 return this.newSnapshot.headSnapshot; 28334 } 28335 get newElement() { 28336 return this.newSnapshot.element; 28337 } 28338 #setLanguage() { 28339 const { documentElement } = this.currentSnapshot; 28340 const { dir, lang } = this.newSnapshot; 28341 if (lang) { 28342 documentElement.setAttribute("lang", lang); 28343 } else { 28344 documentElement.removeAttribute("lang"); 28345 } 28346 if (dir) { 28347 documentElement.setAttribute("dir", dir); 28348 } else { 28349 documentElement.removeAttribute("dir"); 28350 } 28351 } 28352 async mergeHead() { 28353 const mergedHeadElements = this.mergeProvisionalElements(); 28354 const newStylesheetElements = this.copyNewHeadStylesheetElements(); 28355 this.copyNewHeadScriptElements(); 28356 await mergedHeadElements; 28357 await newStylesheetElements; 28358 if (this.willRender) { 28359 this.removeUnusedDynamicStylesheetElements(); 28360 } 28361 } 28362 async replaceBody() { 28363 await this.preservingPermanentElements(async () => { 28364 this.activateNewBody(); 28365 await this.assignNewBody(); 28366 }); 28367 } 28368 get trackedElementsAreIdentical() { 28369 return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature; 28370 } 28371 async copyNewHeadStylesheetElements() { 28372 const loadingElements = []; 28373 for (const element of this.newHeadStylesheetElements) { 28374 loadingElements.push(waitForLoad(element)); 28375 document.head.appendChild(element); 28376 } 28377 await Promise.all(loadingElements); 28378 } 28379 copyNewHeadScriptElements() { 28380 for (const element of this.newHeadScriptElements) { 28381 document.head.appendChild(activateScriptElement(element)); 28382 } 28383 } 28384 removeUnusedDynamicStylesheetElements() { 28385 for (const element of this.unusedDynamicStylesheetElements) { 28386 document.head.removeChild(element); 28387 } 28388 } 28389 async mergeProvisionalElements() { 28390 const newHeadElements = [...this.newHeadProvisionalElements]; 28391 for (const element of this.currentHeadProvisionalElements) { 28392 if (!this.isCurrentElementInElementList(element, newHeadElements)) { 28393 document.head.removeChild(element); 28394 } 28395 } 28396 for (const element of newHeadElements) { 28397 document.head.appendChild(element); 28398 } 28399 } 28400 isCurrentElementInElementList(element, elementList) { 28401 for (const [index, newElement] of elementList.entries()) { 28402 if (element.tagName == "TITLE") { 28403 if (newElement.tagName != "TITLE") { 28404 continue; 28405 } 28406 if (element.innerHTML == newElement.innerHTML) { 28407 elementList.splice(index, 1); 28408 return true; 28409 } 28410 } 28411 if (newElement.isEqualNode(element)) { 28412 elementList.splice(index, 1); 28413 return true; 28414 } 28415 } 28416 return false; 28417 } 28418 removeCurrentHeadProvisionalElements() { 28419 for (const element of this.currentHeadProvisionalElements) { 28420 document.head.removeChild(element); 28421 } 28422 } 28423 copyNewHeadProvisionalElements() { 28424 for (const element of this.newHeadProvisionalElements) { 28425 document.head.appendChild(element); 28426 } 28427 } 28428 activateNewBody() { 28429 document.adoptNode(this.newElement); 28430 this.removeNoscriptElements(); 28431 this.activateNewBodyScriptElements(); 28432 } 28433 removeNoscriptElements() { 28434 for (const noscriptElement of this.newElement.querySelectorAll("noscript")) { 28435 noscriptElement.remove(); 28436 } 28437 } 28438 activateNewBodyScriptElements() { 28439 for (const inertScriptElement of this.newBodyScriptElements) { 28440 const activatedScriptElement = activateScriptElement(inertScriptElement); 28441 inertScriptElement.replaceWith(activatedScriptElement); 28442 } 28443 } 28444 async assignNewBody() { 28445 await this.renderElement(this.currentElement, this.newElement); 28446 } 28447 get unusedDynamicStylesheetElements() { 28448 return this.oldHeadStylesheetElements.filter((element) => { 28449 return element.getAttribute("data-turbo-track") === "dynamic"; 28450 }); 28451 } 28452 get oldHeadStylesheetElements() { 28453 return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot); 28454 } 28455 get newHeadStylesheetElements() { 28456 return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot); 28457 } 28458 get newHeadScriptElements() { 28459 return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot); 28460 } 28461 get currentHeadProvisionalElements() { 28462 return this.currentHeadSnapshot.provisionalElements; 28463 } 28464 get newHeadProvisionalElements() { 28465 return this.newHeadSnapshot.provisionalElements; 28466 } 28467 get newBodyScriptElements() { 28468 return this.newElement.querySelectorAll("script"); 28469 } 28470} 28471 28472class MorphingPageRenderer extends PageRenderer { 28473 static renderElement(currentElement, newElement) { 28474 morphElements(currentElement, newElement, { 28475 callbacks: { 28476 beforeNodeMorphed: (node, newNode) => { 28477 if (shouldRefreshFrameWithMorphing(node, newNode) && !closestFrameReloadableWithMorphing(node)) { 28478 node.reload(); 28479 return false; 28480 } 28481 return true; 28482 } 28483 } 28484 }); 28485 dispatch("turbo:morph", { detail: { currentElement, newElement } }); 28486 } 28487 async preservingPermanentElements(callback) { 28488 return await callback(); 28489 } 28490 get renderMethod() { 28491 return "morph"; 28492 } 28493 get shouldAutofocus() { 28494 return false; 28495 } 28496} 28497 28498class SnapshotCache extends LRUCache { 28499 constructor(size) { 28500 super(size, toCacheKey); 28501 } 28502 get snapshots() { 28503 return this.entries; 28504 } 28505} 28506 28507class PageView extends View { 28508 snapshotCache = new SnapshotCache(10); 28509 lastRenderedLocation = new URL(location.href); 28510 forceReloaded = false; 28511 shouldTransitionTo(newSnapshot) { 28512 return this.snapshot.prefersViewTransitions && newSnapshot.prefersViewTransitions; 28513 } 28514 renderPage(snapshot, isPreview = false, willRender = true, visit2) { 28515 const shouldMorphPage = this.isPageRefresh(visit2) && (visit2?.refresh?.method || this.snapshot.refreshMethod) === "morph"; 28516 const rendererClass = shouldMorphPage ? MorphingPageRenderer : PageRenderer; 28517 const renderer = new rendererClass(this.snapshot, snapshot, isPreview, willRender); 28518 if (!renderer.shouldRender) { 28519 this.forceReloaded = true; 28520 } else { 28521 visit2?.changeHistory(); 28522 } 28523 return this.render(renderer); 28524 } 28525 renderError(snapshot, visit2) { 28526 visit2?.changeHistory(); 28527 const renderer = new ErrorRenderer(this.snapshot, snapshot, false); 28528 return this.render(renderer); 28529 } 28530 clearSnapshotCache() { 28531 this.snapshotCache.clear(); 28532 } 28533 async cacheSnapshot(snapshot = this.snapshot) { 28534 if (snapshot.isCacheable) { 28535 this.delegate.viewWillCacheSnapshot(); 28536 const { lastRenderedLocation: location2 } = this; 28537 await nextEventLoopTick(); 28538 const cachedSnapshot = snapshot.clone(); 28539 this.snapshotCache.put(location2, cachedSnapshot); 28540 return cachedSnapshot; 28541 } 28542 } 28543 getCachedSnapshotForLocation(location2) { 28544 return this.snapshotCache.get(location2); 28545 } 28546 isPageRefresh(visit2) { 28547 return !visit2 || this.lastRenderedLocation.pathname === visit2.location.pathname && visit2.action === "replace"; 28548 } 28549 shouldPreserveScrollPosition(visit2) { 28550 return this.isPageRefresh(visit2) && (visit2?.refresh?.scroll || this.snapshot.refreshScroll) === "preserve"; 28551 } 28552 get snapshot() { 28553 return PageSnapshot.fromElement(this.element); 28554 } 28555} 28556 28557class Preloader { 28558 selector = "a[data-turbo-preload]"; 28559 constructor(delegate, snapshotCache) { 28560 this.delegate = delegate; 28561 this.snapshotCache = snapshotCache; 28562 } 28563 start() { 28564 if (document.readyState === "loading") { 28565 document.addEventListener("DOMContentLoaded", this.#preloadAll); 28566 } else { 28567 this.preloadOnLoadLinksForView(document.body); 28568 } 28569 } 28570 stop() { 28571 document.removeEventListener("DOMContentLoaded", this.#preloadAll); 28572 } 28573 preloadOnLoadLinksForView(element) { 28574 for (const link of element.querySelectorAll(this.selector)) { 28575 if (this.delegate.shouldPreloadLink(link)) { 28576 this.preloadURL(link); 28577 } 28578 } 28579 } 28580 async preloadURL(link) { 28581 const location2 = new URL(link.href); 28582 if (this.snapshotCache.has(location2)) { 28583 return; 28584 } 28585 const fetchRequest = new FetchRequest(this, FetchMethod.get, location2, new URLSearchParams, link); 28586 await fetchRequest.perform(); 28587 } 28588 prepareRequest(fetchRequest) { 28589 fetchRequest.headers["X-Sec-Purpose"] = "prefetch"; 28590 } 28591 async requestSucceededWithResponse(fetchRequest, fetchResponse) { 28592 try { 28593 const responseHTML = await fetchResponse.responseHTML; 28594 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 28595 this.snapshotCache.put(fetchRequest.url, snapshot); 28596 } catch (_) {} 28597 } 28598 requestStarted(fetchRequest) {} 28599 requestErrored(fetchRequest) {} 28600 requestFinished(fetchRequest) {} 28601 requestPreventedHandlingResponse(fetchRequest, fetchResponse) {} 28602 requestFailedWithResponse(fetchRequest, fetchResponse) {} 28603 #preloadAll = () => { 28604 this.preloadOnLoadLinksForView(document.body); 28605 }; 28606} 28607 28608class Cache { 28609 constructor(session2) { 28610 this.session = session2; 28611 } 28612 clear() { 28613 this.session.clearCache(); 28614 } 28615 resetCacheControl() { 28616 this.#setCacheControl(""); 28617 } 28618 exemptPageFromCache() { 28619 this.#setCacheControl("no-cache"); 28620 } 28621 exemptPageFromPreview() { 28622 this.#setCacheControl("no-preview"); 28623 } 28624 #setCacheControl(value) { 28625 setMetaContent("turbo-cache-control", value); 28626 } 28627} 28628 28629class Session { 28630 navigator = new Navigator(this); 28631 history = new History2(this); 28632 view = new PageView(this, document.documentElement); 28633 adapter = new BrowserAdapter(this); 28634 pageObserver = new PageObserver(this); 28635 cacheObserver = new CacheObserver; 28636 linkPrefetchObserver = new LinkPrefetchObserver(this, document); 28637 linkClickObserver = new LinkClickObserver(this, window); 28638 formSubmitObserver = new FormSubmitObserver(this, document); 28639 scrollObserver = new ScrollObserver(this); 28640 streamObserver = new StreamObserver(this); 28641 formLinkClickObserver = new FormLinkClickObserver(this, document.documentElement); 28642 frameRedirector = new FrameRedirector(this, document.documentElement); 28643 streamMessageRenderer = new StreamMessageRenderer; 28644 cache = new Cache(this); 28645 enabled = true; 28646 started = false; 28647 #pageRefreshDebouncePeriod = 150; 28648 constructor(recentRequests) { 28649 this.recentRequests = recentRequests; 28650 this.preloader = new Preloader(this, this.view.snapshotCache); 28651 this.debouncedRefresh = this.refresh; 28652 this.pageRefreshDebouncePeriod = this.pageRefreshDebouncePeriod; 28653 } 28654 start() { 28655 if (!this.started) { 28656 this.pageObserver.start(); 28657 this.cacheObserver.start(); 28658 this.linkPrefetchObserver.start(); 28659 this.formLinkClickObserver.start(); 28660 this.linkClickObserver.start(); 28661 this.formSubmitObserver.start(); 28662 this.scrollObserver.start(); 28663 this.streamObserver.start(); 28664 this.frameRedirector.start(); 28665 this.history.start(); 28666 this.preloader.start(); 28667 this.started = true; 28668 this.enabled = true; 28669 } 28670 } 28671 disable() { 28672 this.enabled = false; 28673 } 28674 stop() { 28675 if (this.started) { 28676 this.pageObserver.stop(); 28677 this.cacheObserver.stop(); 28678 this.linkPrefetchObserver.stop(); 28679 this.formLinkClickObserver.stop(); 28680 this.linkClickObserver.stop(); 28681 this.formSubmitObserver.stop(); 28682 this.scrollObserver.stop(); 28683 this.streamObserver.stop(); 28684 this.frameRedirector.stop(); 28685 this.history.stop(); 28686 this.preloader.stop(); 28687 this.started = false; 28688 } 28689 } 28690 registerAdapter(adapter) { 28691 this.adapter = adapter; 28692 } 28693 visit(location2, options2 = {}) { 28694 const frameElement = options2.frame ? document.getElementById(options2.frame) : null; 28695 if (frameElement instanceof FrameElement) { 28696 const action = options2.action || getVisitAction(frameElement); 28697 frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement, action); 28698 frameElement.src = location2.toString(); 28699 } else { 28700 this.navigator.proposeVisit(expandURL(location2), options2); 28701 } 28702 } 28703 refresh(url, options2 = {}) { 28704 options2 = typeof options2 === "string" ? { requestId: options2 } : options2; 28705 const { method, requestId, scroll } = options2; 28706 const isRecentRequest = requestId && this.recentRequests.has(requestId); 28707 const isCurrentUrl = url === document.baseURI; 28708 if (!isRecentRequest && !this.navigator.currentVisit && isCurrentUrl) { 28709 this.visit(url, { action: "replace", shouldCacheSnapshot: false, refresh: { method, scroll } }); 28710 } 28711 } 28712 connectStreamSource(source) { 28713 this.streamObserver.connectStreamSource(source); 28714 } 28715 disconnectStreamSource(source) { 28716 this.streamObserver.disconnectStreamSource(source); 28717 } 28718 renderStreamMessage(message) { 28719 this.streamMessageRenderer.render(StreamMessage.wrap(message)); 28720 } 28721 clearCache() { 28722 this.view.clearSnapshotCache(); 28723 } 28724 setProgressBarDelay(delay) { 28725 console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"); 28726 this.progressBarDelay = delay; 28727 } 28728 set progressBarDelay(delay) { 28729 config.drive.progressBarDelay = delay; 28730 } 28731 get progressBarDelay() { 28732 return config.drive.progressBarDelay; 28733 } 28734 set drive(value) { 28735 config.drive.enabled = value; 28736 } 28737 get drive() { 28738 return config.drive.enabled; 28739 } 28740 set formMode(value) { 28741 config.forms.mode = value; 28742 } 28743 get formMode() { 28744 return config.forms.mode; 28745 } 28746 get location() { 28747 return this.history.location; 28748 } 28749 get restorationIdentifier() { 28750 return this.history.restorationIdentifier; 28751 } 28752 get pageRefreshDebouncePeriod() { 28753 return this.#pageRefreshDebouncePeriod; 28754 } 28755 set pageRefreshDebouncePeriod(value) { 28756 this.refresh = debounce2(this.debouncedRefresh.bind(this), value); 28757 this.#pageRefreshDebouncePeriod = value; 28758 } 28759 shouldPreloadLink(element) { 28760 const isUnsafe = element.hasAttribute("data-turbo-method"); 28761 const isStream = element.hasAttribute("data-turbo-stream"); 28762 const frameTarget = element.getAttribute("data-turbo-frame"); 28763 const frame = frameTarget == "_top" ? null : document.getElementById(frameTarget) || findClosestRecursively(element, "turbo-frame:not([disabled])"); 28764 if (isUnsafe || isStream || frame instanceof FrameElement) { 28765 return false; 28766 } else { 28767 const location2 = new URL(element.href); 28768 return this.elementIsNavigatable(element) && locationIsVisitable(location2, this.snapshot.rootLocation); 28769 } 28770 } 28771 historyPoppedToLocationWithRestorationIdentifierAndDirection(location2, restorationIdentifier, direction) { 28772 if (this.enabled) { 28773 this.navigator.startVisit(location2, restorationIdentifier, { 28774 action: "restore", 28775 historyChanged: true, 28776 direction 28777 }); 28778 } else { 28779 this.adapter.pageInvalidated({ 28780 reason: "turbo_disabled" 28781 }); 28782 } 28783 } 28784 historyPoppedWithEmptyState(location2) { 28785 this.history.replace(location2); 28786 this.view.lastRenderedLocation = location2; 28787 this.view.cacheSnapshot(); 28788 } 28789 scrollPositionChanged(position) { 28790 this.history.updateRestorationData({ scrollPosition: position }); 28791 } 28792 willSubmitFormLinkToLocation(link, location2) { 28793 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation); 28794 } 28795 submittedFormLinkToLocation() {} 28796 canPrefetchRequestToLocation(link, location2) { 28797 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.navigator.linkPrefetchingIsEnabledForLocation(location2); 28798 } 28799 willFollowLinkToLocation(link, location2, event) { 28800 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.applicationAllowsFollowingLinkToLocation(link, location2, event); 28801 } 28802 followedLinkToLocation(link, location2) { 28803 const action = this.getActionForLink(link); 28804 const acceptsStreamResponse = link.hasAttribute("data-turbo-stream"); 28805 this.visit(location2.href, { action, acceptsStreamResponse }); 28806 } 28807 allowsVisitingLocationWithAction(location2, action) { 28808 return this.applicationAllowsVisitingLocation(location2); 28809 } 28810 visitProposedToLocation(location2, options2) { 28811 extendURLWithDeprecatedProperties(location2); 28812 this.adapter.visitProposedToLocation(location2, options2); 28813 } 28814 visitStarted(visit2) { 28815 if (!visit2.acceptsStreamResponse) { 28816 markAsBusy(document.documentElement); 28817 this.view.markVisitDirection(visit2.direction); 28818 } 28819 extendURLWithDeprecatedProperties(visit2.location); 28820 this.notifyApplicationAfterVisitingLocation(visit2.location, visit2.action); 28821 } 28822 visitCompleted(visit2) { 28823 this.view.unmarkVisitDirection(); 28824 clearBusyState(document.documentElement); 28825 this.notifyApplicationAfterPageLoad(visit2.getTimingMetrics()); 28826 } 28827 willSubmitForm(form, submitter) { 28828 const action = getAction$1(form, submitter); 28829 return this.submissionIsNavigatable(form, submitter) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation); 28830 } 28831 formSubmitted(form, submitter) { 28832 this.navigator.submitForm(form, submitter); 28833 } 28834 pageBecameInteractive() { 28835 this.view.lastRenderedLocation = this.location; 28836 this.notifyApplicationAfterPageLoad(); 28837 } 28838 pageLoaded() { 28839 this.history.assumeControlOfScrollRestoration(); 28840 } 28841 pageWillUnload() { 28842 this.history.relinquishControlOfScrollRestoration(); 28843 } 28844 receivedMessageFromStream(message) { 28845 this.renderStreamMessage(message); 28846 } 28847 viewWillCacheSnapshot() { 28848 this.notifyApplicationBeforeCachingSnapshot(); 28849 } 28850 allowsImmediateRender({ element }, options2) { 28851 const event = this.notifyApplicationBeforeRender(element, options2); 28852 const { 28853 defaultPrevented, 28854 detail: { render } 28855 } = event; 28856 if (this.view.renderer && render) { 28857 this.view.renderer.renderElement = render; 28858 } 28859 return !defaultPrevented; 28860 } 28861 viewRenderedSnapshot(_snapshot, _isPreview, renderMethod) { 28862 this.view.lastRenderedLocation = this.history.location; 28863 this.notifyApplicationAfterRender(renderMethod); 28864 } 28865 preloadOnLoadLinksForView(element) { 28866 this.preloader.preloadOnLoadLinksForView(element); 28867 } 28868 viewInvalidated(reason) { 28869 this.adapter.pageInvalidated(reason); 28870 } 28871 frameLoaded(frame) { 28872 this.notifyApplicationAfterFrameLoad(frame); 28873 } 28874 frameRendered(fetchResponse, frame) { 28875 this.notifyApplicationAfterFrameRender(fetchResponse, frame); 28876 } 28877 applicationAllowsFollowingLinkToLocation(link, location2, ev) { 28878 const event = this.notifyApplicationAfterClickingLinkToLocation(link, location2, ev); 28879 return !event.defaultPrevented; 28880 } 28881 applicationAllowsVisitingLocation(location2) { 28882 const event = this.notifyApplicationBeforeVisitingLocation(location2); 28883 return !event.defaultPrevented; 28884 } 28885 notifyApplicationAfterClickingLinkToLocation(link, location2, event) { 28886 return dispatch("turbo:click", { 28887 target: link, 28888 detail: { url: location2.href, originalEvent: event }, 28889 cancelable: true 28890 }); 28891 } 28892 notifyApplicationBeforeVisitingLocation(location2) { 28893 return dispatch("turbo:before-visit", { 28894 detail: { url: location2.href }, 28895 cancelable: true 28896 }); 28897 } 28898 notifyApplicationAfterVisitingLocation(location2, action) { 28899 return dispatch("turbo:visit", { detail: { url: location2.href, action } }); 28900 } 28901 notifyApplicationBeforeCachingSnapshot() { 28902 return dispatch("turbo:before-cache"); 28903 } 28904 notifyApplicationBeforeRender(newBody, options2) { 28905 return dispatch("turbo:before-render", { 28906 detail: { newBody, ...options2 }, 28907 cancelable: true 28908 }); 28909 } 28910 notifyApplicationAfterRender(renderMethod) { 28911 return dispatch("turbo:render", { detail: { renderMethod } }); 28912 } 28913 notifyApplicationAfterPageLoad(timing = {}) { 28914 return dispatch("turbo:load", { 28915 detail: { url: this.location.href, timing } 28916 }); 28917 } 28918 notifyApplicationAfterFrameLoad(frame) { 28919 return dispatch("turbo:frame-load", { target: frame }); 28920 } 28921 notifyApplicationAfterFrameRender(fetchResponse, frame) { 28922 return dispatch("turbo:frame-render", { 28923 detail: { fetchResponse }, 28924 target: frame, 28925 cancelable: true 28926 }); 28927 } 28928 submissionIsNavigatable(form, submitter) { 28929 if (config.forms.mode == "off") { 28930 return false; 28931 } else { 28932 const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true; 28933 if (config.forms.mode == "optin") { 28934 return submitterIsNavigatable && form.closest('[data-turbo="true"]') != null; 28935 } else { 28936 return submitterIsNavigatable && this.elementIsNavigatable(form); 28937 } 28938 } 28939 } 28940 elementIsNavigatable(element) { 28941 const container = findClosestRecursively(element, "[data-turbo]"); 28942 const withinFrame = findClosestRecursively(element, "turbo-frame"); 28943 if (config.drive.enabled || withinFrame) { 28944 if (container) { 28945 return container.getAttribute("data-turbo") != "false"; 28946 } else { 28947 return true; 28948 } 28949 } else { 28950 if (container) { 28951 return container.getAttribute("data-turbo") == "true"; 28952 } else { 28953 return false; 28954 } 28955 } 28956 } 28957 getActionForLink(link) { 28958 return getVisitAction(link) || "advance"; 28959 } 28960 get snapshot() { 28961 return this.view.snapshot; 28962 } 28963} 28964function extendURLWithDeprecatedProperties(url) { 28965 Object.defineProperties(url, deprecatedLocationPropertyDescriptors); 28966} 28967var deprecatedLocationPropertyDescriptors = { 28968 absoluteURL: { 28969 get() { 28970 return this.toString(); 28971 } 28972 } 28973}; 28974var session = new Session(recentRequests); 28975var { cache, navigator: navigator2 } = session; 28976function start() { 28977 session.start(); 28978} 28979function registerAdapter(adapter) { 28980 session.registerAdapter(adapter); 28981} 28982function visit(location2, options2) { 28983 session.visit(location2, options2); 28984} 28985function connectStreamSource(source) { 28986 session.connectStreamSource(source); 28987} 28988function disconnectStreamSource(source) { 28989 session.disconnectStreamSource(source); 28990} 28991function renderStreamMessage(message) { 28992 session.renderStreamMessage(message); 28993} 28994function setProgressBarDelay(delay) { 28995 console.warn("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.`"); 28996 config.drive.progressBarDelay = delay; 28997} 28998function setConfirmMethod(confirmMethod) { 28999 console.warn("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.`"); 29000 config.forms.confirm = confirmMethod; 29001} 29002function setFormMode(mode) { 29003 console.warn("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.`"); 29004 config.forms.mode = mode; 29005} 29006function morphBodyElements(currentBody, newBody) { 29007 MorphingPageRenderer.renderElement(currentBody, newBody); 29008} 29009function morphTurboFrameElements(currentFrame, newFrame) { 29010 MorphingFrameRenderer.renderElement(currentFrame, newFrame); 29011} 29012var Turbo2 = /* @__PURE__ */ Object.freeze({ 29013 __proto__: null, 29014 navigator: navigator2, 29015 session, 29016 cache, 29017 PageRenderer, 29018 PageSnapshot, 29019 FrameRenderer, 29020 fetch: fetchWithTurboHeaders, 29021 config, 29022 start, 29023 registerAdapter, 29024 visit, 29025 connectStreamSource, 29026 disconnectStreamSource, 29027 renderStreamMessage, 29028 setProgressBarDelay, 29029 setConfirmMethod, 29030 setFormMode, 29031 morphBodyElements, 29032 morphTurboFrameElements, 29033 morphChildren, 29034 morphElements 29035}); 29036 29037class TurboFrameMissingError extends Error { 29038} 29039 29040class FrameController { 29041 fetchResponseLoaded = (_fetchResponse) => Promise.resolve(); 29042 #currentFetchRequest = null; 29043 #resolveVisitPromise = () => {}; 29044 #connected = false; 29045 #hasBeenLoaded = false; 29046 #ignoredAttributes = new Set; 29047 #shouldMorphFrame = false; 29048 action = null; 29049 constructor(element) { 29050 this.element = element; 29051 this.view = new FrameView(this, this.element); 29052 this.appearanceObserver = new AppearanceObserver(this, this.element); 29053 this.formLinkClickObserver = new FormLinkClickObserver(this, this.element); 29054 this.linkInterceptor = new LinkInterceptor(this, this.element); 29055 this.restorationIdentifier = uuid(); 29056 this.formSubmitObserver = new FormSubmitObserver(this, this.element); 29057 } 29058 connect() { 29059 if (!this.#connected) { 29060 this.#connected = true; 29061 if (this.loadingStyle == FrameLoadingStyle.lazy) { 29062 this.appearanceObserver.start(); 29063 } else { 29064 this.#loadSourceURL(); 29065 } 29066 this.formLinkClickObserver.start(); 29067 this.linkInterceptor.start(); 29068 this.formSubmitObserver.start(); 29069 } 29070 } 29071 disconnect() { 29072 if (this.#connected) { 29073 this.#connected = false; 29074 this.appearanceObserver.stop(); 29075 this.formLinkClickObserver.stop(); 29076 this.linkInterceptor.stop(); 29077 this.formSubmitObserver.stop(); 29078 if (!this.element.hasAttribute("recurse")) { 29079 this.#currentFetchRequest?.cancel(); 29080 } 29081 } 29082 } 29083 disabledChanged() { 29084 if (this.disabled) { 29085 this.#currentFetchRequest?.cancel(); 29086 } else if (this.loadingStyle == FrameLoadingStyle.eager) { 29087 this.#loadSourceURL(); 29088 } 29089 } 29090 sourceURLChanged() { 29091 if (this.#isIgnoringChangesTo("src")) 29092 return; 29093 if (!this.sourceURL) { 29094 this.#currentFetchRequest?.cancel(); 29095 } 29096 if (this.element.isConnected) { 29097 this.complete = false; 29098 } 29099 if (this.loadingStyle == FrameLoadingStyle.eager || this.#hasBeenLoaded) { 29100 this.#loadSourceURL(); 29101 } 29102 } 29103 sourceURLReloaded() { 29104 const { refresh, src } = this.element; 29105 this.#shouldMorphFrame = src && refresh === "morph"; 29106 this.element.removeAttribute("complete"); 29107 this.element.src = null; 29108 this.element.src = src; 29109 return this.element.loaded; 29110 } 29111 loadingStyleChanged() { 29112 if (this.loadingStyle == FrameLoadingStyle.lazy) { 29113 this.appearanceObserver.start(); 29114 } else { 29115 this.appearanceObserver.stop(); 29116 this.#loadSourceURL(); 29117 } 29118 } 29119 async#loadSourceURL() { 29120 if (this.enabled && this.isActive && !this.complete && this.sourceURL) { 29121 this.element.loaded = this.#visit(expandURL(this.sourceURL)); 29122 this.appearanceObserver.stop(); 29123 await this.element.loaded; 29124 this.#hasBeenLoaded = true; 29125 } 29126 } 29127 async loadResponse(fetchResponse) { 29128 if (fetchResponse.redirected || fetchResponse.succeeded && fetchResponse.isHTML) { 29129 this.sourceURL = fetchResponse.response.url; 29130 } 29131 try { 29132 const html = await fetchResponse.responseHTML; 29133 if (html) { 29134 const document2 = parseHTMLDocument(html); 29135 const pageSnapshot = PageSnapshot.fromDocument(document2); 29136 if (pageSnapshot.isVisitable) { 29137 await this.#loadFrameResponse(fetchResponse, document2); 29138 } else { 29139 await this.#handleUnvisitableFrameResponse(fetchResponse); 29140 } 29141 } 29142 } finally { 29143 this.#shouldMorphFrame = false; 29144 this.fetchResponseLoaded = () => Promise.resolve(); 29145 } 29146 } 29147 elementAppearedInViewport(element) { 29148 this.proposeVisitIfNavigatedWithAction(element, getVisitAction(element)); 29149 this.#loadSourceURL(); 29150 } 29151 willSubmitFormLinkToLocation(link) { 29152 return this.#shouldInterceptNavigation(link); 29153 } 29154 submittedFormLinkToLocation(link, _location, form) { 29155 const frame = this.#findFrameElement(link); 29156 if (frame) 29157 form.setAttribute("data-turbo-frame", frame.id); 29158 } 29159 shouldInterceptLinkClick(element, _location, _event) { 29160 return this.#shouldInterceptNavigation(element); 29161 } 29162 linkClickIntercepted(element, location2) { 29163 this.#navigateFrame(element, location2); 29164 } 29165 willSubmitForm(element, submitter) { 29166 return element.closest("turbo-frame") == this.element && this.#shouldInterceptNavigation(element, submitter); 29167 } 29168 formSubmitted(element, submitter) { 29169 if (this.formSubmission) { 29170 this.formSubmission.stop(); 29171 } 29172 this.formSubmission = new FormSubmission(this, element, submitter); 29173 const { fetchRequest } = this.formSubmission; 29174 const frame = this.#findFrameElement(element, submitter); 29175 this.prepareRequest(fetchRequest, frame); 29176 this.formSubmission.start(); 29177 } 29178 prepareRequest(request, frame = this) { 29179 request.headers["Turbo-Frame"] = frame.id; 29180 if (this.currentNavigationElement?.hasAttribute("data-turbo-stream")) { 29181 request.acceptResponseType(StreamMessage.contentType); 29182 } 29183 } 29184 requestStarted(_request) { 29185 markAsBusy(this.element); 29186 } 29187 requestPreventedHandlingResponse(_request, _response) { 29188 this.#resolveVisitPromise(); 29189 } 29190 async requestSucceededWithResponse(request, response) { 29191 await this.loadResponse(response); 29192 this.#resolveVisitPromise(); 29193 } 29194 async requestFailedWithResponse(request, response) { 29195 await this.loadResponse(response); 29196 this.#resolveVisitPromise(); 29197 } 29198 requestErrored(request, error) { 29199 console.error(error); 29200 this.#resolveVisitPromise(); 29201 } 29202 requestFinished(_request) { 29203 clearBusyState(this.element); 29204 } 29205 formSubmissionStarted({ formElement }) { 29206 markAsBusy(formElement, this.#findFrameElement(formElement)); 29207 } 29208 formSubmissionSucceededWithResponse(formSubmission, response) { 29209 const frame = this.#findFrameElement(formSubmission.formElement, formSubmission.submitter); 29210 frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(formSubmission.submitter, formSubmission.formElement, frame)); 29211 frame.delegate.loadResponse(response); 29212 if (!formSubmission.isSafe) { 29213 session.clearCache(); 29214 } 29215 } 29216 formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 29217 this.element.delegate.loadResponse(fetchResponse); 29218 session.clearCache(); 29219 } 29220 formSubmissionErrored(formSubmission, error) { 29221 console.error(error); 29222 } 29223 formSubmissionFinished({ formElement }) { 29224 clearBusyState(formElement, this.#findFrameElement(formElement)); 29225 } 29226 allowsImmediateRender({ element: newFrame }, options2) { 29227 const event = dispatch("turbo:before-frame-render", { 29228 target: this.element, 29229 detail: { newFrame, ...options2 }, 29230 cancelable: true 29231 }); 29232 const { 29233 defaultPrevented, 29234 detail: { render } 29235 } = event; 29236 if (this.view.renderer && render) { 29237 this.view.renderer.renderElement = render; 29238 } 29239 return !defaultPrevented; 29240 } 29241 viewRenderedSnapshot(_snapshot, _isPreview, _renderMethod) {} 29242 preloadOnLoadLinksForView(element) { 29243 session.preloadOnLoadLinksForView(element); 29244 } 29245 viewInvalidated() {} 29246 willRenderFrame(currentElement, _newElement) { 29247 this.previousFrameElement = currentElement.cloneNode(true); 29248 } 29249 visitCachedSnapshot = ({ element }) => { 29250 const frame = element.querySelector("#" + this.element.id); 29251 if (frame && this.previousFrameElement) { 29252 frame.replaceChildren(...this.previousFrameElement.children); 29253 } 29254 delete this.previousFrameElement; 29255 }; 29256 async#loadFrameResponse(fetchResponse, document2) { 29257 const newFrameElement = await this.extractForeignFrameElement(document2.body); 29258 const rendererClass = this.#shouldMorphFrame ? MorphingFrameRenderer : FrameRenderer; 29259 if (newFrameElement) { 29260 const snapshot = new Snapshot(newFrameElement); 29261 const renderer = new rendererClass(this, this.view.snapshot, snapshot, false, false); 29262 if (this.view.renderPromise) 29263 await this.view.renderPromise; 29264 this.changeHistory(); 29265 await this.view.render(renderer); 29266 this.complete = true; 29267 session.frameRendered(fetchResponse, this.element); 29268 session.frameLoaded(this.element); 29269 await this.fetchResponseLoaded(fetchResponse); 29270 } else if (this.#willHandleFrameMissingFromResponse(fetchResponse)) { 29271 this.#handleFrameMissingFromResponse(fetchResponse); 29272 } 29273 } 29274 async#visit(url) { 29275 const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams, this.element); 29276 this.#currentFetchRequest?.cancel(); 29277 this.#currentFetchRequest = request; 29278 return new Promise((resolve) => { 29279 this.#resolveVisitPromise = () => { 29280 this.#resolveVisitPromise = () => {}; 29281 this.#currentFetchRequest = null; 29282 resolve(); 29283 }; 29284 request.perform(); 29285 }); 29286 } 29287 #navigateFrame(element, url, submitter) { 29288 const frame = this.#findFrameElement(element, submitter); 29289 frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter, element, frame)); 29290 this.#withCurrentNavigationElement(element, () => { 29291 frame.src = url; 29292 }); 29293 } 29294 proposeVisitIfNavigatedWithAction(frame, action = null) { 29295 this.action = action; 29296 if (this.action) { 29297 const pageSnapshot = PageSnapshot.fromElement(frame).clone(); 29298 const { visitCachedSnapshot } = frame.delegate; 29299 frame.delegate.fetchResponseLoaded = async (fetchResponse) => { 29300 if (frame.src) { 29301 const { statusCode, redirected } = fetchResponse; 29302 const responseHTML = await fetchResponse.responseHTML; 29303 const response = { statusCode, redirected, responseHTML }; 29304 const options2 = { 29305 response, 29306 visitCachedSnapshot, 29307 willRender: false, 29308 updateHistory: false, 29309 restorationIdentifier: this.restorationIdentifier, 29310 snapshot: pageSnapshot 29311 }; 29312 if (this.action) 29313 options2.action = this.action; 29314 session.visit(frame.src, options2); 29315 } 29316 }; 29317 } 29318 } 29319 changeHistory() { 29320 if (this.action) { 29321 const method = getHistoryMethodForAction(this.action); 29322 session.history.update(method, expandURL(this.element.src || ""), this.restorationIdentifier); 29323 } 29324 } 29325 async#handleUnvisitableFrameResponse(fetchResponse) { 29326 console.warn(`The response (${fetchResponse.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`); 29327 await this.#visitResponse(fetchResponse.response); 29328 } 29329 #willHandleFrameMissingFromResponse(fetchResponse) { 29330 this.element.setAttribute("complete", ""); 29331 const response = fetchResponse.response; 29332 const visit2 = async (url, options2) => { 29333 if (url instanceof Response) { 29334 this.#visitResponse(url); 29335 } else { 29336 session.visit(url, options2); 29337 } 29338 }; 29339 const event = dispatch("turbo:frame-missing", { 29340 target: this.element, 29341 detail: { response, visit: visit2 }, 29342 cancelable: true 29343 }); 29344 return !event.defaultPrevented; 29345 } 29346 #handleFrameMissingFromResponse(fetchResponse) { 29347 this.view.missing(); 29348 this.#throwFrameMissingError(fetchResponse); 29349 } 29350 #throwFrameMissingError(fetchResponse) { 29351 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.`; 29352 throw new TurboFrameMissingError(message); 29353 } 29354 async#visitResponse(response) { 29355 const wrapped = new FetchResponse(response); 29356 const responseHTML = await wrapped.responseHTML; 29357 const { location: location2, redirected, statusCode } = wrapped; 29358 return session.visit(location2, { response: { redirected, statusCode, responseHTML } }); 29359 } 29360 #findFrameElement(element, submitter) { 29361 const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); 29362 const target = this.#getFrameElementById(id); 29363 return target instanceof FrameElement ? target : this.element; 29364 } 29365 async extractForeignFrameElement(container) { 29366 let element; 29367 const id = CSS.escape(this.id); 29368 try { 29369 element = activateElement(container.querySelector(`turbo-frame#${id}`), this.sourceURL); 29370 if (element) { 29371 return element; 29372 } 29373 element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id}]`), this.sourceURL); 29374 if (element) { 29375 await element.loaded; 29376 return await this.extractForeignFrameElement(element); 29377 } 29378 } catch (error) { 29379 console.error(error); 29380 return new FrameElement; 29381 } 29382 return null; 29383 } 29384 #formActionIsVisitable(form, submitter) { 29385 const action = getAction$1(form, submitter); 29386 return locationIsVisitable(expandURL(action), this.rootLocation); 29387 } 29388 #shouldInterceptNavigation(element, submitter) { 29389 const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); 29390 if (element instanceof HTMLFormElement && !this.#formActionIsVisitable(element, submitter)) { 29391 return false; 29392 } 29393 if (!this.enabled || id == "_top") { 29394 return false; 29395 } 29396 if (id) { 29397 const frameElement = this.#getFrameElementById(id); 29398 if (frameElement) { 29399 return !frameElement.disabled; 29400 } else if (id == "_parent") { 29401 return false; 29402 } 29403 } 29404 if (!session.elementIsNavigatable(element)) { 29405 return false; 29406 } 29407 if (submitter && !session.elementIsNavigatable(submitter)) { 29408 return false; 29409 } 29410 return true; 29411 } 29412 get id() { 29413 return this.element.id; 29414 } 29415 get disabled() { 29416 return this.element.disabled; 29417 } 29418 get enabled() { 29419 return !this.disabled; 29420 } 29421 get sourceURL() { 29422 if (this.element.src) { 29423 return this.element.src; 29424 } 29425 } 29426 set sourceURL(sourceURL) { 29427 this.#ignoringChangesToAttribute("src", () => { 29428 this.element.src = sourceURL ?? null; 29429 }); 29430 } 29431 get loadingStyle() { 29432 return this.element.loading; 29433 } 29434 get isLoading() { 29435 return this.formSubmission !== undefined || this.#resolveVisitPromise() !== undefined; 29436 } 29437 get complete() { 29438 return this.element.hasAttribute("complete"); 29439 } 29440 set complete(value) { 29441 if (value) { 29442 this.element.setAttribute("complete", ""); 29443 } else { 29444 this.element.removeAttribute("complete"); 29445 } 29446 } 29447 get isActive() { 29448 return this.element.isActive && this.#connected; 29449 } 29450 get rootLocation() { 29451 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 29452 const root2 = meta?.content ?? "/"; 29453 return expandURL(root2); 29454 } 29455 #isIgnoringChangesTo(attributeName) { 29456 return this.#ignoredAttributes.has(attributeName); 29457 } 29458 #ignoringChangesToAttribute(attributeName, callback) { 29459 this.#ignoredAttributes.add(attributeName); 29460 callback(); 29461 this.#ignoredAttributes.delete(attributeName); 29462 } 29463 #withCurrentNavigationElement(element, callback) { 29464 this.currentNavigationElement = element; 29465 callback(); 29466 delete this.currentNavigationElement; 29467 } 29468 #getFrameElementById(id) { 29469 if (id != null) { 29470 const element = id === "_parent" ? this.element.parentElement.closest("turbo-frame") : document.getElementById(id); 29471 if (element instanceof FrameElement) { 29472 return element; 29473 } 29474 } 29475 } 29476} 29477function activateElement(element, currentURL) { 29478 if (element) { 29479 const src = element.getAttribute("src"); 29480 if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) { 29481 throw new Error(`Matching <turbo-frame id="${element.id}"> element has a source URL which references itself`); 29482 } 29483 if (element.ownerDocument !== document) { 29484 element = document.importNode(element, true); 29485 } 29486 if (element instanceof FrameElement) { 29487 element.connectedCallback(); 29488 element.disconnectedCallback(); 29489 return element; 29490 } 29491 } 29492} 29493var StreamActions = { 29494 after() { 29495 this.removeDuplicateTargetSiblings(); 29496 this.targetElements.forEach((e) => e.parentElement?.insertBefore(this.templateContent, e.nextSibling)); 29497 }, 29498 append() { 29499 this.removeDuplicateTargetChildren(); 29500 this.targetElements.forEach((e) => e.append(this.templateContent)); 29501 }, 29502 before() { 29503 this.removeDuplicateTargetSiblings(); 29504 this.targetElements.forEach((e) => e.parentElement?.insertBefore(this.templateContent, e)); 29505 }, 29506 prepend() { 29507 this.removeDuplicateTargetChildren(); 29508 this.targetElements.forEach((e) => e.prepend(this.templateContent)); 29509 }, 29510 remove() { 29511 this.targetElements.forEach((e) => e.remove()); 29512 }, 29513 replace() { 29514 const method = this.getAttribute("method"); 29515 this.targetElements.forEach((targetElement) => { 29516 if (method === "morph") { 29517 morphElements(targetElement, this.templateContent); 29518 } else { 29519 targetElement.replaceWith(this.templateContent); 29520 } 29521 }); 29522 }, 29523 update() { 29524 const method = this.getAttribute("method"); 29525 this.targetElements.forEach((targetElement) => { 29526 if (method === "morph") { 29527 morphChildren(targetElement, this.templateContent); 29528 } else { 29529 targetElement.innerHTML = ""; 29530 targetElement.append(this.templateContent); 29531 } 29532 }); 29533 }, 29534 refresh() { 29535 const method = this.getAttribute("method"); 29536 const requestId = this.requestId; 29537 const scroll = this.getAttribute("scroll"); 29538 session.refresh(this.baseURI, { method, requestId, scroll }); 29539 } 29540}; 29541 29542class StreamElement extends HTMLElement { 29543 static async renderElement(newElement) { 29544 await newElement.performAction(); 29545 } 29546 async connectedCallback() { 29547 try { 29548 await this.render(); 29549 } catch (error) { 29550 console.error(error); 29551 } finally { 29552 this.disconnect(); 29553 } 29554 } 29555 async render() { 29556 return this.renderPromise ??= (async () => { 29557 const event = this.beforeRenderEvent; 29558 if (this.dispatchEvent(event)) { 29559 await nextRepaint(); 29560 await event.detail.render(this); 29561 } 29562 })(); 29563 } 29564 disconnect() { 29565 try { 29566 this.remove(); 29567 } catch {} 29568 } 29569 removeDuplicateTargetChildren() { 29570 this.duplicateChildren.forEach((c) => c.remove()); 29571 } 29572 get duplicateChildren() { 29573 const existingChildren = this.targetElements.flatMap((e) => [...e.children]).filter((c) => !!c.getAttribute("id")); 29574 const newChildrenIds = [...this.templateContent?.children || []].filter((c) => !!c.getAttribute("id")).map((c) => c.getAttribute("id")); 29575 return existingChildren.filter((c) => newChildrenIds.includes(c.getAttribute("id"))); 29576 } 29577 removeDuplicateTargetSiblings() { 29578 this.duplicateSiblings.forEach((c) => c.remove()); 29579 } 29580 get duplicateSiblings() { 29581 const existingChildren = this.targetElements.flatMap((e) => [...e.parentElement.children]).filter((c) => !!c.id); 29582 const newChildrenIds = [...this.templateContent?.children || []].filter((c) => !!c.id).map((c) => c.id); 29583 return existingChildren.filter((c) => newChildrenIds.includes(c.id)); 29584 } 29585 get performAction() { 29586 if (this.action) { 29587 const actionFunction = StreamActions[this.action]; 29588 if (actionFunction) { 29589 return actionFunction; 29590 } 29591 this.#raise("unknown action"); 29592 } 29593 this.#raise("action attribute is missing"); 29594 } 29595 get targetElements() { 29596 if (this.target) { 29597 return this.targetElementsById; 29598 } else if (this.targets) { 29599 return this.targetElementsByQuery; 29600 } else { 29601 this.#raise("target or targets attribute is missing"); 29602 } 29603 } 29604 get templateContent() { 29605 return this.templateElement.content.cloneNode(true); 29606 } 29607 get templateElement() { 29608 if (this.firstElementChild === null) { 29609 const template = this.ownerDocument.createElement("template"); 29610 this.appendChild(template); 29611 return template; 29612 } else if (this.firstElementChild instanceof HTMLTemplateElement) { 29613 return this.firstElementChild; 29614 } 29615 this.#raise("first child element must be a <template> element"); 29616 } 29617 get action() { 29618 return this.getAttribute("action"); 29619 } 29620 get target() { 29621 return this.getAttribute("target"); 29622 } 29623 get targets() { 29624 return this.getAttribute("targets"); 29625 } 29626 get requestId() { 29627 return this.getAttribute("request-id"); 29628 } 29629 #raise(message) { 29630 throw new Error(`${this.description}: ${message}`); 29631 } 29632 get description() { 29633 return (this.outerHTML.match(/<[^>]+>/) ?? [])[0] ?? "<turbo-stream>"; 29634 } 29635 get beforeRenderEvent() { 29636 return new CustomEvent("turbo:before-stream-render", { 29637 bubbles: true, 29638 cancelable: true, 29639 detail: { newStream: this, render: StreamElement.renderElement } 29640 }); 29641 } 29642 get targetElementsById() { 29643 const element = this.ownerDocument?.getElementById(this.target); 29644 if (element !== null) { 29645 return [element]; 29646 } else { 29647 return []; 29648 } 29649 } 29650 get targetElementsByQuery() { 29651 const elements = this.ownerDocument?.querySelectorAll(this.targets); 29652 if (elements.length !== 0) { 29653 return Array.prototype.slice.call(elements); 29654 } else { 29655 return []; 29656 } 29657 } 29658} 29659 29660class StreamSourceElement extends HTMLElement { 29661 streamSource = null; 29662 connectedCallback() { 29663 this.streamSource = this.src.match(/^ws{1,2}:/) ? new WebSocket(this.src) : new EventSource(this.src); 29664 connectStreamSource(this.streamSource); 29665 } 29666 disconnectedCallback() { 29667 if (this.streamSource) { 29668 this.streamSource.close(); 29669 disconnectStreamSource(this.streamSource); 29670 } 29671 } 29672 get src() { 29673 return this.getAttribute("src") || ""; 29674 } 29675} 29676FrameElement.delegateConstructor = FrameController; 29677if (customElements.get("turbo-frame") === undefined) { 29678 customElements.define("turbo-frame", FrameElement); 29679} 29680if (customElements.get("turbo-stream") === undefined) { 29681 customElements.define("turbo-stream", StreamElement); 29682} 29683if (customElements.get("turbo-stream-source") === undefined) { 29684 customElements.define("turbo-stream-source", StreamSourceElement); 29685} 29686(() => { 29687 const scriptElement = document.currentScript; 29688 if (!scriptElement) 29689 return; 29690 if (scriptElement.hasAttribute("data-turbo-suppress-warning")) 29691 return; 29692 let element = scriptElement.parentElement; 29693 while (element) { 29694 if (element == document.body) { 29695 return console.warn(unindent` 29696 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 29697 29698 Load your applicationâs JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 29699 29700 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 29701 29702 ââ 29703 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 29704 `, scriptElement.outerHTML); 29705 } 29706 element = element.parentElement; 29707 } 29708})(); 29709window.Turbo = { ...Turbo2, StreamActions }; 29710start(); 29711
vendor: 515 bytes, lines 29712-29728
29712// node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js 29713var consumer; 29714async function getConsumer() { 29715 return consumer || setConsumer(createConsumer2().then(setConsumer)); 29716} 29717function setConsumer(newConsumer) { 29718 return consumer = newConsumer; 29719} 29720async function createConsumer2() { 29721 await Promise.resolve().then(() => init_src()); 29722 return createConsumer(); 29723} 29724async function subscribeTo(channel, mixin) { 29725 const { subscriptions } = await getConsumer(); 29726 return subscriptions.create(channel, mixin); 29727} 29728
vendor: 529 bytes, lines 29729-29745
29729// node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js 29730function walk(obj2) { 29731 if (!obj2 || typeof obj2 !== "object") 29732 return obj2; 29733 if (obj2 instanceof Date || obj2 instanceof RegExp) 29734 return obj2; 29735 if (Array.isArray(obj2)) 29736 return obj2.map(walk); 29737 return Object.keys(obj2).reduce(function(acc, key) { 29738 var camel = key[0].toLowerCase() + key.slice(1).replace(/([A-Z]+)/g, function(m2, x) { 29739 return "_" + x.toLowerCase(); 29740 }); 29741 acc[camel] = walk(obj2[key]); 29742 return acc; 29743 }, {}); 29744} 29745
vendor: 1,473 bytes, lines 29746-29788
29746// node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js 29747class TurboCableStreamSourceElement extends HTMLElement { 29748 static observedAttributes = ["channel", "signed-stream-name"]; 29749 async connectedCallback() { 29750 connectStreamSource(this); 29751 this.subscription = await subscribeTo(this.channel, { 29752 received: this.dispatchMessageEvent.bind(this), 29753 connected: this.subscriptionConnected.bind(this), 29754 disconnected: this.subscriptionDisconnected.bind(this) 29755 }); 29756 } 29757 disconnectedCallback() { 29758 disconnectStreamSource(this); 29759 if (this.subscription) 29760 this.subscription.unsubscribe(); 29761 this.subscriptionDisconnected(); 29762 } 29763 attributeChangedCallback() { 29764 if (this.subscription) { 29765 this.disconnectedCallback(); 29766 this.connectedCallback(); 29767 } 29768 } 29769 dispatchMessageEvent(data) { 29770 const event = new MessageEvent("message", { data }); 29771 return this.dispatchEvent(event); 29772 } 29773 subscriptionConnected() { 29774 this.setAttribute("connected", ""); 29775 } 29776 subscriptionDisconnected() { 29777 this.removeAttribute("connected"); 29778 } 29779 get channel() { 29780 const channel = this.getAttribute("channel"); 29781 const signed_stream_name = this.getAttribute("signed-stream-name"); 29782 return { channel, signed_stream_name, ...walk({ ...this.dataset }) }; 29783 } 29784} 29785if (customElements.get("turbo-cable-stream-source") === undefined) { 29786 customElements.define("turbo-cable-stream-source", TurboCableStreamSourceElement); 29787} 29788
vendor: 1,587 bytes, lines 29789-29835
29789// node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js 29790function encodeMethodIntoRequestBody(event) { 29791 if (event.target instanceof HTMLFormElement) { 29792 const { target: form, detail: { fetchOptions } } = event; 29793 form.addEventListener("turbo:submit-start", ({ detail: { formSubmission: { submitter } } }) => { 29794 const body = isBodyInit(fetchOptions.body) ? fetchOptions.body : new URLSearchParams; 29795 const method = determineFetchMethod(submitter, body, form); 29796 if (!/get/i.test(method)) { 29797 if (/post/i.test(method)) { 29798 body.delete("_method"); 29799 } else { 29800 body.set("_method", method); 29801 } 29802 fetchOptions.method = "post"; 29803 } 29804 }, { once: true }); 29805 } 29806} 29807function determineFetchMethod(submitter, body, form) { 29808 const formMethod = determineFormMethod(submitter); 29809 const overrideMethod = body.get("_method"); 29810 const method = form.getAttribute("method") || "get"; 29811 if (typeof formMethod == "string") { 29812 return formMethod; 29813 } else if (typeof overrideMethod == "string") { 29814 return overrideMethod; 29815 } else { 29816 return method; 29817 } 29818} 29819function determineFormMethod(submitter) { 29820 if (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) { 29821 if (submitter.name === "_method") { 29822 return submitter.value; 29823 } else if (submitter.hasAttribute("formmethod")) { 29824 return submitter.formMethod; 29825 } else { 29826 return null; 29827 } 29828 } else { 29829 return null; 29830 } 29831} 29832function isBodyInit(body) { 29833 return body instanceof FormData || body instanceof URLSearchParams; 29834} 29835
vendor: 187 bytes, lines 29836-29839
29836// node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js 29837window.Turbo = exports_turbo_es2017_esm; 29838addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody); 29839
vendor: 78,789 bytes, lines 29840-32308
29840// node_modules/@hotwired/stimulus/dist/stimulus.js 29841class EventListener { 29842 constructor(eventTarget, eventName, eventOptions) { 29843 this.eventTarget = eventTarget; 29844 this.eventName = eventName; 29845 this.eventOptions = eventOptions; 29846 this.unorderedBindings = new Set; 29847 } 29848 connect() { 29849 this.eventTarget.addEventListener(this.eventName, this, this.eventOptions); 29850 } 29851 disconnect() { 29852 this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions); 29853 } 29854 bindingConnected(binding) { 29855 this.unorderedBindings.add(binding); 29856 } 29857 bindingDisconnected(binding) { 29858 this.unorderedBindings.delete(binding); 29859 } 29860 handleEvent(event) { 29861 const extendedEvent = extendEvent(event); 29862 for (const binding of this.bindings) { 29863 if (extendedEvent.immediatePropagationStopped) { 29864 break; 29865 } else { 29866 binding.handleEvent(extendedEvent); 29867 } 29868 } 29869 } 29870 hasBindings() { 29871 return this.unorderedBindings.size > 0; 29872 } 29873 get bindings() { 29874 return Array.from(this.unorderedBindings).sort((left, right) => { 29875 const leftIndex = left.index, rightIndex = right.index; 29876 return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0; 29877 }); 29878 } 29879} 29880function extendEvent(event) { 29881 if ("immediatePropagationStopped" in event) { 29882 return event; 29883 } else { 29884 const { stopImmediatePropagation } = event; 29885 return Object.assign(event, { 29886 immediatePropagationStopped: false, 29887 stopImmediatePropagation() { 29888 this.immediatePropagationStopped = true; 29889 stopImmediatePropagation.call(this); 29890 } 29891 }); 29892 } 29893} 29894 29895class Dispatcher { 29896 constructor(application) { 29897 this.application = application; 29898 this.eventListenerMaps = new Map; 29899 this.started = false; 29900 } 29901 start() { 29902 if (!this.started) { 29903 this.started = true; 29904 this.eventListeners.forEach((eventListener) => eventListener.connect()); 29905 } 29906 } 29907 stop() { 29908 if (this.started) { 29909 this.started = false; 29910 this.eventListeners.forEach((eventListener) => eventListener.disconnect()); 29911 } 29912 } 29913 get eventListeners() { 29914 return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []); 29915 } 29916 bindingConnected(binding) { 29917 this.fetchEventListenerForBinding(binding).bindingConnected(binding); 29918 } 29919 bindingDisconnected(binding, clearEventListeners = false) { 29920 this.fetchEventListenerForBinding(binding).bindingDisconnected(binding); 29921 if (clearEventListeners) 29922 this.clearEventListenersForBinding(binding); 29923 } 29924 handleError(error, message, detail = {}) { 29925 this.application.handleError(error, `Error ${message}`, detail); 29926 } 29927 clearEventListenersForBinding(binding) { 29928 const eventListener = this.fetchEventListenerForBinding(binding); 29929 if (!eventListener.hasBindings()) { 29930 eventListener.disconnect(); 29931 this.removeMappedEventListenerFor(binding); 29932 } 29933 } 29934 removeMappedEventListenerFor(binding) { 29935 const { eventTarget, eventName, eventOptions } = binding; 29936 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 29937 const cacheKey = this.cacheKey(eventName, eventOptions); 29938 eventListenerMap.delete(cacheKey); 29939 if (eventListenerMap.size == 0) 29940 this.eventListenerMaps.delete(eventTarget); 29941 } 29942 fetchEventListenerForBinding(binding) { 29943 const { eventTarget, eventName, eventOptions } = binding; 29944 return this.fetchEventListener(eventTarget, eventName, eventOptions); 29945 } 29946 fetchEventListener(eventTarget, eventName, eventOptions) { 29947 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 29948 const cacheKey = this.cacheKey(eventName, eventOptions); 29949 let eventListener = eventListenerMap.get(cacheKey); 29950 if (!eventListener) { 29951 eventListener = this.createEventListener(eventTarget, eventName, eventOptions); 29952 eventListenerMap.set(cacheKey, eventListener); 29953 } 29954 return eventListener; 29955 } 29956 createEventListener(eventTarget, eventName, eventOptions) { 29957 const eventListener = new EventListener(eventTarget, eventName, eventOptions); 29958 if (this.started) { 29959 eventListener.connect(); 29960 } 29961 return eventListener; 29962 } 29963 fetchEventListenerMapForEventTarget(eventTarget) { 29964 let eventListenerMap = this.eventListenerMaps.get(eventTarget); 29965 if (!eventListenerMap) { 29966 eventListenerMap = new Map; 29967 this.eventListenerMaps.set(eventTarget, eventListenerMap); 29968 } 29969 return eventListenerMap; 29970 } 29971 cacheKey(eventName, eventOptions) { 29972 const parts = [eventName]; 29973 Object.keys(eventOptions).sort().forEach((key) => { 29974 parts.push(`${eventOptions[key] ? "" : "!"}${key}`); 29975 }); 29976 return parts.join(":"); 29977 } 29978} 29979var defaultActionDescriptorFilters = { 29980 stop({ event, value }) { 29981 if (value) 29982 event.stopPropagation(); 29983 return true; 29984 }, 29985 prevent({ event, value }) { 29986 if (value) 29987 event.preventDefault(); 29988 return true; 29989 }, 29990 self({ event, value, element }) { 29991 if (value) { 29992 return element === event.target; 29993 } else { 29994 return true; 29995 } 29996 } 29997}; 29998var descriptorPattern = /^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/; 29999function parseActionDescriptorString(descriptorString) { 30000 const source = descriptorString.trim(); 30001 const matches = source.match(descriptorPattern) || []; 30002 let eventName = matches[2]; 30003 let keyFilter = matches[3]; 30004 if (keyFilter && !["keydown", "keyup", "keypress"].includes(eventName)) { 30005 eventName += `.${keyFilter}`; 30006 keyFilter = ""; 30007 } 30008 return { 30009 eventTarget: parseEventTarget(matches[4]), 30010 eventName, 30011 eventOptions: matches[7] ? parseEventOptions(matches[7]) : {}, 30012 identifier: matches[5], 30013 methodName: matches[6], 30014 keyFilter: matches[1] || keyFilter 30015 }; 30016} 30017function parseEventTarget(eventTargetName) { 30018 if (eventTargetName == "window") { 30019 return window; 30020 } else if (eventTargetName == "document") { 30021 return document; 30022 } 30023} 30024function parseEventOptions(eventOptions) { 30025 return eventOptions.split(":").reduce((options2, token) => Object.assign(options2, { [token.replace(/^!/, "")]: !/^!/.test(token) }), {}); 30026} 30027function stringifyEventTarget(eventTarget) { 30028 if (eventTarget == window) { 30029 return "window"; 30030 } else if (eventTarget == document) { 30031 return "document"; 30032 } 30033} 30034function camelize(value) { 30035 return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase()); 30036} 30037function namespaceCamelize(value) { 30038 return camelize(value.replace(/--/g, "-").replace(/__/g, "_")); 30039} 30040function capitalize(value) { 30041 return value.charAt(0).toUpperCase() + value.slice(1); 30042} 30043function dasherize(value) { 30044 return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`); 30045} 30046function tokenize(value) { 30047 return value.match(/[^\s]+/g) || []; 30048} 30049function isSomething(object) { 30050 return object !== null && object !== undefined; 30051} 30052function hasProperty(object, property) { 30053 return Object.prototype.hasOwnProperty.call(object, property); 30054} 30055var allModifiers = ["meta", "ctrl", "alt", "shift"]; 30056 30057class Action { 30058 constructor(element, index, descriptor, schema) { 30059 this.element = element; 30060 this.index = index; 30061 this.eventTarget = descriptor.eventTarget || element; 30062 this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error("missing event name"); 30063 this.eventOptions = descriptor.eventOptions || {}; 30064 this.identifier = descriptor.identifier || error("missing identifier"); 30065 this.methodName = descriptor.methodName || error("missing method name"); 30066 this.keyFilter = descriptor.keyFilter || ""; 30067 this.schema = schema; 30068 } 30069 static forToken(token, schema) { 30070 return new this(token.element, token.index, parseActionDescriptorString(token.content), schema); 30071 } 30072 toString() { 30073 const eventFilter = this.keyFilter ? `.${this.keyFilter}` : ""; 30074 const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : ""; 30075 return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`; 30076 } 30077 shouldIgnoreKeyboardEvent(event) { 30078 if (!this.keyFilter) { 30079 return false; 30080 } 30081 const filters = this.keyFilter.split("+"); 30082 if (this.keyFilterDissatisfied(event, filters)) { 30083 return true; 30084 } 30085 const standardFilter = filters.filter((key) => !allModifiers.includes(key))[0]; 30086 if (!standardFilter) { 30087 return false; 30088 } 30089 if (!hasProperty(this.keyMappings, standardFilter)) { 30090 error(`contains unknown key filter: ${this.keyFilter}`); 30091 } 30092 return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase(); 30093 } 30094 shouldIgnoreMouseEvent(event) { 30095 if (!this.keyFilter) { 30096 return false; 30097 } 30098 const filters = [this.keyFilter]; 30099 if (this.keyFilterDissatisfied(event, filters)) { 30100 return true; 30101 } 30102 return false; 30103 } 30104 get params() { 30105 const params = {}; 30106 const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, "i"); 30107 for (const { name, value } of Array.from(this.element.attributes)) { 30108 const match = name.match(pattern); 30109 const key = match && match[1]; 30110 if (key) { 30111 params[camelize(key)] = typecast(value); 30112 } 30113 } 30114 return params; 30115 } 30116 get eventTargetName() { 30117 return stringifyEventTarget(this.eventTarget); 30118 } 30119 get keyMappings() { 30120 return this.schema.keyMappings; 30121 } 30122 keyFilterDissatisfied(event, filters) { 30123 const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier)); 30124 return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift; 30125 } 30126} 30127var defaultEventNames = { 30128 a: () => "click", 30129 button: () => "click", 30130 form: () => "submit", 30131 details: () => "toggle", 30132 input: (e) => e.getAttribute("type") == "submit" ? "click" : "input", 30133 select: () => "change", 30134 textarea: () => "input" 30135}; 30136function getDefaultEventNameForElement(element) { 30137 const tagName = element.tagName.toLowerCase(); 30138 if (tagName in defaultEventNames) { 30139 return defaultEventNames[tagName](element); 30140 } 30141} 30142function error(message) { 30143 throw new Error(message); 30144} 30145function typecast(value) { 30146 try { 30147 return JSON.parse(value); 30148 } catch (o_O) { 30149 return value; 30150 } 30151} 30152 30153class Binding { 30154 constructor(context, action) { 30155 this.context = context; 30156 this.action = action; 30157 } 30158 get index() { 30159 return this.action.index; 30160 } 30161 get eventTarget() { 30162 return this.action.eventTarget; 30163 } 30164 get eventOptions() { 30165 return this.action.eventOptions; 30166 } 30167 get identifier() { 30168 return this.context.identifier; 30169 } 30170 handleEvent(event) { 30171 const actionEvent = this.prepareActionEvent(event); 30172 if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) { 30173 this.invokeWithEvent(actionEvent); 30174 } 30175 } 30176 get eventName() { 30177 return this.action.eventName; 30178 } 30179 get method() { 30180 const method = this.controller[this.methodName]; 30181 if (typeof method == "function") { 30182 return method; 30183 } 30184 throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`); 30185 } 30186 applyEventModifiers(event) { 30187 const { element } = this.action; 30188 const { actionDescriptorFilters } = this.context.application; 30189 const { controller } = this.context; 30190 let passes = true; 30191 for (const [name, value] of Object.entries(this.eventOptions)) { 30192 if (name in actionDescriptorFilters) { 30193 const filter = actionDescriptorFilters[name]; 30194 passes = passes && filter({ name, value, event, element, controller }); 30195 } else { 30196 continue; 30197 } 30198 } 30199 return passes; 30200 } 30201 prepareActionEvent(event) { 30202 return Object.assign(event, { params: this.action.params }); 30203 } 30204 invokeWithEvent(event) { 30205 const { target, currentTarget } = event; 30206 try { 30207 this.method.call(this.controller, event); 30208 this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName }); 30209 } catch (error) { 30210 const { identifier, controller, element, index } = this; 30211 const detail = { identifier, controller, element, index, event }; 30212 this.context.handleError(error, `invoking action "${this.action}"`, detail); 30213 } 30214 } 30215 willBeInvokedByEvent(event) { 30216 const eventTarget = event.target; 30217 if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) { 30218 return false; 30219 } 30220 if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) { 30221 return false; 30222 } 30223 if (this.element === eventTarget) { 30224 return true; 30225 } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) { 30226 return this.scope.containsElement(eventTarget); 30227 } else { 30228 return this.scope.containsElement(this.action.element); 30229 } 30230 } 30231 get controller() { 30232 return this.context.controller; 30233 } 30234 get methodName() { 30235 return this.action.methodName; 30236 } 30237 get element() { 30238 return this.scope.element; 30239 } 30240 get scope() { 30241 return this.context.scope; 30242 } 30243} 30244 30245class ElementObserver { 30246 constructor(element, delegate) { 30247 this.mutationObserverInit = { attributes: true, childList: true, subtree: true }; 30248 this.element = element; 30249 this.started = false; 30250 this.delegate = delegate; 30251 this.elements = new Set; 30252 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 30253 } 30254 start() { 30255 if (!this.started) { 30256 this.started = true; 30257 this.mutationObserver.observe(this.element, this.mutationObserverInit); 30258 this.refresh(); 30259 } 30260 } 30261 pause(callback) { 30262 if (this.started) { 30263 this.mutationObserver.disconnect(); 30264 this.started = false; 30265 } 30266 callback(); 30267 if (!this.started) { 30268 this.mutationObserver.observe(this.element, this.mutationObserverInit); 30269 this.started = true; 30270 } 30271 } 30272 stop() { 30273 if (this.started) { 30274 this.mutationObserver.takeRecords(); 30275 this.mutationObserver.disconnect(); 30276 this.started = false; 30277 } 30278 } 30279 refresh() { 30280 if (this.started) { 30281 const matches = new Set(this.matchElementsInTree()); 30282 for (const element of Array.from(this.elements)) { 30283 if (!matches.has(element)) { 30284 this.removeElement(element); 30285 } 30286 } 30287 for (const element of Array.from(matches)) { 30288 this.addElement(element); 30289 } 30290 } 30291 } 30292 processMutations(mutations) { 30293 if (this.started) { 30294 for (const mutation of mutations) { 30295 this.processMutation(mutation); 30296 } 30297 } 30298 } 30299 processMutation(mutation) { 30300 if (mutation.type == "attributes") { 30301 this.processAttributeChange(mutation.target, mutation.attributeName); 30302 } else if (mutation.type == "childList") { 30303 this.processRemovedNodes(mutation.removedNodes); 30304 this.processAddedNodes(mutation.addedNodes); 30305 } 30306 } 30307 processAttributeChange(element, attributeName) { 30308 if (this.elements.has(element)) { 30309 if (this.delegate.elementAttributeChanged && this.matchElement(element)) { 30310 this.delegate.elementAttributeChanged(element, attributeName); 30311 } else { 30312 this.removeElement(element); 30313 } 30314 } else if (this.matchElement(element)) { 30315 this.addElement(element); 30316 } 30317 } 30318 processRemovedNodes(nodes) { 30319 for (const node of Array.from(nodes)) { 30320 const element = this.elementFromNode(node); 30321 if (element) { 30322 this.processTree(element, this.removeElement); 30323 } 30324 } 30325 } 30326 processAddedNodes(nodes) { 30327 for (const node of Array.from(nodes)) { 30328 const element = this.elementFromNode(node); 30329 if (element && this.elementIsActive(element)) { 30330 this.processTree(element, this.addElement); 30331 } 30332 } 30333 } 30334 matchElement(element) { 30335 return this.delegate.matchElement(element); 30336 } 30337 matchElementsInTree(tree = this.element) { 30338 return this.delegate.matchElementsInTree(tree); 30339 } 30340 processTree(tree, processor) { 30341 for (const element of this.matchElementsInTree(tree)) { 30342 processor.call(this, element); 30343 } 30344 } 30345 elementFromNode(node) { 30346 if (node.nodeType == Node.ELEMENT_NODE) { 30347 return node; 30348 } 30349 } 30350 elementIsActive(element) { 30351 if (element.isConnected != this.element.isConnected) { 30352 return false; 30353 } else { 30354 return this.element.contains(element); 30355 } 30356 } 30357 addElement(element) { 30358 if (!this.elements.has(element)) { 30359 if (this.elementIsActive(element)) { 30360 this.elements.add(element); 30361 if (this.delegate.elementMatched) { 30362 this.delegate.elementMatched(element); 30363 } 30364 } 30365 } 30366 } 30367 removeElement(element) { 30368 if (this.elements.has(element)) { 30369 this.elements.delete(element); 30370 if (this.delegate.elementUnmatched) { 30371 this.delegate.elementUnmatched(element); 30372 } 30373 } 30374 } 30375} 30376 30377class AttributeObserver { 30378 constructor(element, attributeName, delegate) { 30379 this.attributeName = attributeName; 30380 this.delegate = delegate; 30381 this.elementObserver = new ElementObserver(element, this); 30382 } 30383 get element() { 30384 return this.elementObserver.element; 30385 } 30386 get selector() { 30387 return `[${this.attributeName}]`; 30388 } 30389 start() { 30390 this.elementObserver.start(); 30391 } 30392 pause(callback) { 30393 this.elementObserver.pause(callback); 30394 } 30395 stop() { 30396 this.elementObserver.stop(); 30397 } 30398 refresh() { 30399 this.elementObserver.refresh(); 30400 } 30401 get started() { 30402 return this.elementObserver.started; 30403 } 30404 matchElement(element) { 30405 return element.hasAttribute(this.attributeName); 30406 } 30407 matchElementsInTree(tree) { 30408 const match = this.matchElement(tree) ? [tree] : []; 30409 const matches = Array.from(tree.querySelectorAll(this.selector)); 30410 return match.concat(matches); 30411 } 30412 elementMatched(element) { 30413 if (this.delegate.elementMatchedAttribute) { 30414 this.delegate.elementMatchedAttribute(element, this.attributeName); 30415 } 30416 } 30417 elementUnmatched(element) { 30418 if (this.delegate.elementUnmatchedAttribute) { 30419 this.delegate.elementUnmatchedAttribute(element, this.attributeName); 30420 } 30421 } 30422 elementAttributeChanged(element, attributeName) { 30423 if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) { 30424 this.delegate.elementAttributeValueChanged(element, attributeName); 30425 } 30426 } 30427} 30428function add(map, key, value) { 30429 fetch2(map, key).add(value); 30430} 30431function del(map, key, value) { 30432 fetch2(map, key).delete(value); 30433 prune(map, key); 30434} 30435function fetch2(map, key) { 30436 let values = map.get(key); 30437 if (!values) { 30438 values = new Set; 30439 map.set(key, values); 30440 } 30441 return values; 30442} 30443function prune(map, key) { 30444 const values = map.get(key); 30445 if (values != null && values.size == 0) { 30446 map.delete(key); 30447 } 30448} 30449 30450class Multimap { 30451 constructor() { 30452 this.valuesByKey = new Map; 30453 } 30454 get keys() { 30455 return Array.from(this.valuesByKey.keys()); 30456 } 30457 get values() { 30458 const sets = Array.from(this.valuesByKey.values()); 30459 return sets.reduce((values, set) => values.concat(Array.from(set)), []); 30460 } 30461 get size() { 30462 const sets = Array.from(this.valuesByKey.values()); 30463 return sets.reduce((size, set) => size + set.size, 0); 30464 } 30465 add(key, value) { 30466 add(this.valuesByKey, key, value); 30467 } 30468 delete(key, value) { 30469 del(this.valuesByKey, key, value); 30470 } 30471 has(key, value) { 30472 const values = this.valuesByKey.get(key); 30473 return values != null && values.has(value); 30474 } 30475 hasKey(key) { 30476 return this.valuesByKey.has(key); 30477 } 30478 hasValue(value) { 30479 const sets = Array.from(this.valuesByKey.values()); 30480 return sets.some((set) => set.has(value)); 30481 } 30482 getValuesForKey(key) { 30483 const values = this.valuesByKey.get(key); 30484 return values ? Array.from(values) : []; 30485 } 30486 getKeysForValue(value) { 30487 return Array.from(this.valuesByKey).filter(([_key, values]) => values.has(value)).map(([key, _values]) => key); 30488 } 30489} 30490class SelectorObserver { 30491 constructor(element, selector, delegate, details) { 30492 this._selector = selector; 30493 this.details = details; 30494 this.elementObserver = new ElementObserver(element, this); 30495 this.delegate = delegate; 30496 this.matchesByElement = new Multimap; 30497 } 30498 get started() { 30499 return this.elementObserver.started; 30500 } 30501 get selector() { 30502 return this._selector; 30503 } 30504 set selector(selector) { 30505 this._selector = selector; 30506 this.refresh(); 30507 } 30508 start() { 30509 this.elementObserver.start(); 30510 } 30511 pause(callback) { 30512 this.elementObserver.pause(callback); 30513 } 30514 stop() { 30515 this.elementObserver.stop(); 30516 } 30517 refresh() { 30518 this.elementObserver.refresh(); 30519 } 30520 get element() { 30521 return this.elementObserver.element; 30522 } 30523 matchElement(element) { 30524 const { selector } = this; 30525 if (selector) { 30526 const matches = element.matches(selector); 30527 if (this.delegate.selectorMatchElement) { 30528 return matches && this.delegate.selectorMatchElement(element, this.details); 30529 } 30530 return matches; 30531 } else { 30532 return false; 30533 } 30534 } 30535 matchElementsInTree(tree) { 30536 const { selector } = this; 30537 if (selector) { 30538 const match = this.matchElement(tree) ? [tree] : []; 30539 const matches = Array.from(tree.querySelectorAll(selector)).filter((match) => this.matchElement(match)); 30540 return match.concat(matches); 30541 } else { 30542 return []; 30543 } 30544 } 30545 elementMatched(element) { 30546 const { selector } = this; 30547 if (selector) { 30548 this.selectorMatched(element, selector); 30549 } 30550 } 30551 elementUnmatched(element) { 30552 const selectors = this.matchesByElement.getKeysForValue(element); 30553 for (const selector of selectors) { 30554 this.selectorUnmatched(element, selector); 30555 } 30556 } 30557 elementAttributeChanged(element, _attributeName) { 30558 const { selector } = this; 30559 if (selector) { 30560 const matches = this.matchElement(element); 30561 const matchedBefore = this.matchesByElement.has(selector, element); 30562 if (matches && !matchedBefore) { 30563 this.selectorMatched(element, selector); 30564 } else if (!matches && matchedBefore) { 30565 this.selectorUnmatched(element, selector); 30566 } 30567 } 30568 } 30569 selectorMatched(element, selector) { 30570 this.delegate.selectorMatched(element, selector, this.details); 30571 this.matchesByElement.add(selector, element); 30572 } 30573 selectorUnmatched(element, selector) { 30574 this.delegate.selectorUnmatched(element, selector, this.details); 30575 this.matchesByElement.delete(selector, element); 30576 } 30577} 30578 30579class StringMapObserver { 30580 constructor(element, delegate) { 30581 this.element = element; 30582 this.delegate = delegate; 30583 this.started = false; 30584 this.stringMap = new Map; 30585 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 30586 } 30587 start() { 30588 if (!this.started) { 30589 this.started = true; 30590 this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true }); 30591 this.refresh(); 30592 } 30593 } 30594 stop() { 30595 if (this.started) { 30596 this.mutationObserver.takeRecords(); 30597 this.mutationObserver.disconnect(); 30598 this.started = false; 30599 } 30600 } 30601 refresh() { 30602 if (this.started) { 30603 for (const attributeName of this.knownAttributeNames) { 30604 this.refreshAttribute(attributeName, null); 30605 } 30606 } 30607 } 30608 processMutations(mutations) { 30609 if (this.started) { 30610 for (const mutation of mutations) { 30611 this.processMutation(mutation); 30612 } 30613 } 30614 } 30615 processMutation(mutation) { 30616 const attributeName = mutation.attributeName; 30617 if (attributeName) { 30618 this.refreshAttribute(attributeName, mutation.oldValue); 30619 } 30620 } 30621 refreshAttribute(attributeName, oldValue) { 30622 const key = this.delegate.getStringMapKeyForAttribute(attributeName); 30623 if (key != null) { 30624 if (!this.stringMap.has(attributeName)) { 30625 this.stringMapKeyAdded(key, attributeName); 30626 } 30627 const value = this.element.getAttribute(attributeName); 30628 if (this.stringMap.get(attributeName) != value) { 30629 this.stringMapValueChanged(value, key, oldValue); 30630 } 30631 if (value == null) { 30632 const oldValue = this.stringMap.get(attributeName); 30633 this.stringMap.delete(attributeName); 30634 if (oldValue) 30635 this.stringMapKeyRemoved(key, attributeName, oldValue); 30636 } else { 30637 this.stringMap.set(attributeName, value); 30638 } 30639 } 30640 } 30641 stringMapKeyAdded(key, attributeName) { 30642 if (this.delegate.stringMapKeyAdded) { 30643 this.delegate.stringMapKeyAdded(key, attributeName); 30644 } 30645 } 30646 stringMapValueChanged(value, key, oldValue) { 30647 if (this.delegate.stringMapValueChanged) { 30648 this.delegate.stringMapValueChanged(value, key, oldValue); 30649 } 30650 } 30651 stringMapKeyRemoved(key, attributeName, oldValue) { 30652 if (this.delegate.stringMapKeyRemoved) { 30653 this.delegate.stringMapKeyRemoved(key, attributeName, oldValue); 30654 } 30655 } 30656 get knownAttributeNames() { 30657 return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames))); 30658 } 30659 get currentAttributeNames() { 30660 return Array.from(this.element.attributes).map((attribute) => attribute.name); 30661 } 30662 get recordedAttributeNames() { 30663 return Array.from(this.stringMap.keys()); 30664 } 30665} 30666 30667class TokenListObserver { 30668 constructor(element, attributeName, delegate) { 30669 this.attributeObserver = new AttributeObserver(element, attributeName, this); 30670 this.delegate = delegate; 30671 this.tokensByElement = new Multimap; 30672 } 30673 get started() { 30674 return this.attributeObserver.started; 30675 } 30676 start() { 30677 this.attributeObserver.start(); 30678 } 30679 pause(callback) { 30680 this.attributeObserver.pause(callback); 30681 } 30682 stop() { 30683 this.attributeObserver.stop(); 30684 } 30685 refresh() { 30686 this.attributeObserver.refresh(); 30687 } 30688 get element() { 30689 return this.attributeObserver.element; 30690 } 30691 get attributeName() { 30692 return this.attributeObserver.attributeName; 30693 } 30694 elementMatchedAttribute(element) { 30695 this.tokensMatched(this.readTokensForElement(element)); 30696 } 30697 elementAttributeValueChanged(element) { 30698 const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element); 30699 this.tokensUnmatched(unmatchedTokens); 30700 this.tokensMatched(matchedTokens); 30701 } 30702 elementUnmatchedAttribute(element) { 30703 this.tokensUnmatched(this.tokensByElement.getValuesForKey(element)); 30704 } 30705 tokensMatched(tokens) { 30706 tokens.forEach((token) => this.tokenMatched(token)); 30707 } 30708 tokensUnmatched(tokens) { 30709 tokens.forEach((token) => this.tokenUnmatched(token)); 30710 } 30711 tokenMatched(token) { 30712 this.delegate.tokenMatched(token); 30713 this.tokensByElement.add(token.element, token); 30714 } 30715 tokenUnmatched(token) { 30716 this.delegate.tokenUnmatched(token); 30717 this.tokensByElement.delete(token.element, token); 30718 } 30719 refreshTokensForElement(element) { 30720 const previousTokens = this.tokensByElement.getValuesForKey(element); 30721 const currentTokens = this.readTokensForElement(element); 30722 const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken)); 30723 if (firstDifferingIndex == -1) { 30724 return [[], []]; 30725 } else { 30726 return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)]; 30727 } 30728 } 30729 readTokensForElement(element) { 30730 const attributeName = this.attributeName; 30731 const tokenString = element.getAttribute(attributeName) || ""; 30732 return parseTokenString(tokenString, element, attributeName); 30733 } 30734} 30735function parseTokenString(tokenString, element, attributeName) { 30736 return tokenString.trim().split(/\s+/).filter((content) => content.length).map((content, index) => ({ element, attributeName, content, index })); 30737} 30738function zip(left, right) { 30739 const length = Math.max(left.length, right.length); 30740 return Array.from({ length }, (_, index) => [left[index], right[index]]); 30741} 30742function tokensAreEqual(left, right) { 30743 return left && right && left.index == right.index && left.content == right.content; 30744} 30745 30746class ValueListObserver { 30747 constructor(element, attributeName, delegate) { 30748 this.tokenListObserver = new TokenListObserver(element, attributeName, this); 30749 this.delegate = delegate; 30750 this.parseResultsByToken = new WeakMap; 30751 this.valuesByTokenByElement = new WeakMap; 30752 } 30753 get started() { 30754 return this.tokenListObserver.started; 30755 } 30756 start() { 30757 this.tokenListObserver.start(); 30758 } 30759 stop() { 30760 this.tokenListObserver.stop(); 30761 } 30762 refresh() { 30763 this.tokenListObserver.refresh(); 30764 } 30765 get element() { 30766 return this.tokenListObserver.element; 30767 } 30768 get attributeName() { 30769 return this.tokenListObserver.attributeName; 30770 } 30771 tokenMatched(token) { 30772 const { element } = token; 30773 const { value } = this.fetchParseResultForToken(token); 30774 if (value) { 30775 this.fetchValuesByTokenForElement(element).set(token, value); 30776 this.delegate.elementMatchedValue(element, value); 30777 } 30778 } 30779 tokenUnmatched(token) { 30780 const { element } = token; 30781 const { value } = this.fetchParseResultForToken(token); 30782 if (value) { 30783 this.fetchValuesByTokenForElement(element).delete(token); 30784 this.delegate.elementUnmatchedValue(element, value); 30785 } 30786 } 30787 fetchParseResultForToken(token) { 30788 let parseResult = this.parseResultsByToken.get(token); 30789 if (!parseResult) { 30790 parseResult = this.parseToken(token); 30791 this.parseResultsByToken.set(token, parseResult); 30792 } 30793 return parseResult; 30794 } 30795 fetchValuesByTokenForElement(element) { 30796 let valuesByToken = this.valuesByTokenByElement.get(element); 30797 if (!valuesByToken) { 30798 valuesByToken = new Map; 30799 this.valuesByTokenByElement.set(element, valuesByToken); 30800 } 30801 return valuesByToken; 30802 } 30803 parseToken(token) { 30804 try { 30805 const value = this.delegate.parseValueForToken(token); 30806 return { value }; 30807 } catch (error) { 30808 return { error }; 30809 } 30810 } 30811} 30812 30813class BindingObserver { 30814 constructor(context, delegate) { 30815 this.context = context; 30816 this.delegate = delegate; 30817 this.bindingsByAction = new Map; 30818 } 30819 start() { 30820 if (!this.valueListObserver) { 30821 this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this); 30822 this.valueListObserver.start(); 30823 } 30824 } 30825 stop() { 30826 if (this.valueListObserver) { 30827 this.valueListObserver.stop(); 30828 delete this.valueListObserver; 30829 this.disconnectAllActions(); 30830 } 30831 } 30832 get element() { 30833 return this.context.element; 30834 } 30835 get identifier() { 30836 return this.context.identifier; 30837 } 30838 get actionAttribute() { 30839 return this.schema.actionAttribute; 30840 } 30841 get schema() { 30842 return this.context.schema; 30843 } 30844 get bindings() { 30845 return Array.from(this.bindingsByAction.values()); 30846 } 30847 connectAction(action) { 30848 const binding = new Binding(this.context, action); 30849 this.bindingsByAction.set(action, binding); 30850 this.delegate.bindingConnected(binding); 30851 } 30852 disconnectAction(action) { 30853 const binding = this.bindingsByAction.get(action); 30854 if (binding) { 30855 this.bindingsByAction.delete(action); 30856 this.delegate.bindingDisconnected(binding); 30857 } 30858 } 30859 disconnectAllActions() { 30860 this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true)); 30861 this.bindingsByAction.clear(); 30862 } 30863 parseValueForToken(token) { 30864 const action = Action.forToken(token, this.schema); 30865 if (action.identifier == this.identifier) { 30866 return action; 30867 } 30868 } 30869 elementMatchedValue(element, action) { 30870 this.connectAction(action); 30871 } 30872 elementUnmatchedValue(element, action) { 30873 this.disconnectAction(action); 30874 } 30875} 30876 30877class ValueObserver { 30878 constructor(context, receiver) { 30879 this.context = context; 30880 this.receiver = receiver; 30881 this.stringMapObserver = new StringMapObserver(this.element, this); 30882 this.valueDescriptorMap = this.controller.valueDescriptorMap; 30883 } 30884 start() { 30885 this.stringMapObserver.start(); 30886 this.invokeChangedCallbacksForDefaultValues(); 30887 } 30888 stop() { 30889 this.stringMapObserver.stop(); 30890 } 30891 get element() { 30892 return this.context.element; 30893 } 30894 get controller() { 30895 return this.context.controller; 30896 } 30897 getStringMapKeyForAttribute(attributeName) { 30898 if (attributeName in this.valueDescriptorMap) { 30899 return this.valueDescriptorMap[attributeName].name; 30900 } 30901 } 30902 stringMapKeyAdded(key, attributeName) { 30903 const descriptor = this.valueDescriptorMap[attributeName]; 30904 if (!this.hasValue(key)) { 30905 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue)); 30906 } 30907 } 30908 stringMapValueChanged(value, name, oldValue) { 30909 const descriptor = this.valueDescriptorNameMap[name]; 30910 if (value === null) 30911 return; 30912 if (oldValue === null) { 30913 oldValue = descriptor.writer(descriptor.defaultValue); 30914 } 30915 this.invokeChangedCallback(name, value, oldValue); 30916 } 30917 stringMapKeyRemoved(key, attributeName, oldValue) { 30918 const descriptor = this.valueDescriptorNameMap[key]; 30919 if (this.hasValue(key)) { 30920 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue); 30921 } else { 30922 this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue); 30923 } 30924 } 30925 invokeChangedCallbacksForDefaultValues() { 30926 for (const { key, name, defaultValue, writer } of this.valueDescriptors) { 30927 if (defaultValue != null && !this.controller.data.has(key)) { 30928 this.invokeChangedCallback(name, writer(defaultValue), undefined); 30929 } 30930 } 30931 } 30932 invokeChangedCallback(name, rawValue, rawOldValue) { 30933 const changedMethodName = `${name}Changed`; 30934 const changedMethod = this.receiver[changedMethodName]; 30935 if (typeof changedMethod == "function") { 30936 const descriptor = this.valueDescriptorNameMap[name]; 30937 try { 30938 const value = descriptor.reader(rawValue); 30939 let oldValue = rawOldValue; 30940 if (rawOldValue) { 30941 oldValue = descriptor.reader(rawOldValue); 30942 } 30943 changedMethod.call(this.receiver, value, oldValue); 30944 } catch (error) { 30945 if (error instanceof TypeError) { 30946 error.message = `Stimulus Value "${this.context.identifier}.${descriptor.name}" - ${error.message}`; 30947 } 30948 throw error; 30949 } 30950 } 30951 } 30952 get valueDescriptors() { 30953 const { valueDescriptorMap } = this; 30954 return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]); 30955 } 30956 get valueDescriptorNameMap() { 30957 const descriptors = {}; 30958 Object.keys(this.valueDescriptorMap).forEach((key) => { 30959 const descriptor = this.valueDescriptorMap[key]; 30960 descriptors[descriptor.name] = descriptor; 30961 }); 30962 return descriptors; 30963 } 30964 hasValue(attributeName) { 30965 const descriptor = this.valueDescriptorNameMap[attributeName]; 30966 const hasMethodName = `has${capitalize(descriptor.name)}`; 30967 return this.receiver[hasMethodName]; 30968 } 30969} 30970 30971class TargetObserver { 30972 constructor(context, delegate) { 30973 this.context = context; 30974 this.delegate = delegate; 30975 this.targetsByName = new Multimap; 30976 } 30977 start() { 30978 if (!this.tokenListObserver) { 30979 this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this); 30980 this.tokenListObserver.start(); 30981 } 30982 } 30983 stop() { 30984 if (this.tokenListObserver) { 30985 this.disconnectAllTargets(); 30986 this.tokenListObserver.stop(); 30987 delete this.tokenListObserver; 30988 } 30989 } 30990 tokenMatched({ element, content: name }) { 30991 if (this.scope.containsElement(element)) { 30992 this.connectTarget(element, name); 30993 } 30994 } 30995 tokenUnmatched({ element, content: name }) { 30996 this.disconnectTarget(element, name); 30997 } 30998 connectTarget(element, name) { 30999 var _a; 31000 if (!this.targetsByName.has(name, element)) { 31001 this.targetsByName.add(name, element); 31002 (_a = this.tokenListObserver) === null || _a === undefined || _a.pause(() => this.delegate.targetConnected(element, name)); 31003 } 31004 } 31005 disconnectTarget(element, name) { 31006 var _a; 31007 if (this.targetsByName.has(name, element)) { 31008 this.targetsByName.delete(name, element); 31009 (_a = this.tokenListObserver) === null || _a === undefined || _a.pause(() => this.delegate.targetDisconnected(element, name)); 31010 } 31011 } 31012 disconnectAllTargets() { 31013 for (const name of this.targetsByName.keys) { 31014 for (const element of this.targetsByName.getValuesForKey(name)) { 31015 this.disconnectTarget(element, name); 31016 } 31017 } 31018 } 31019 get attributeName() { 31020 return `data-${this.context.identifier}-target`; 31021 } 31022 get element() { 31023 return this.context.element; 31024 } 31025 get scope() { 31026 return this.context.scope; 31027 } 31028} 31029function readInheritableStaticArrayValues(constructor, propertyName) { 31030 const ancestors = getAncestorsForConstructor(constructor); 31031 return Array.from(ancestors.reduce((values, constructor) => { 31032 getOwnStaticArrayValues(constructor, propertyName).forEach((name) => values.add(name)); 31033 return values; 31034 }, new Set)); 31035} 31036function readInheritableStaticObjectPairs(constructor, propertyName) { 31037 const ancestors = getAncestorsForConstructor(constructor); 31038 return ancestors.reduce((pairs, constructor) => { 31039 pairs.push(...getOwnStaticObjectPairs(constructor, propertyName)); 31040 return pairs; 31041 }, []); 31042} 31043function getAncestorsForConstructor(constructor) { 31044 const ancestors = []; 31045 while (constructor) { 31046 ancestors.push(constructor); 31047 constructor = Object.getPrototypeOf(constructor); 31048 } 31049 return ancestors.reverse(); 31050} 31051function getOwnStaticArrayValues(constructor, propertyName) { 31052 const definition = constructor[propertyName]; 31053 return Array.isArray(definition) ? definition : []; 31054} 31055function getOwnStaticObjectPairs(constructor, propertyName) { 31056 const definition = constructor[propertyName]; 31057 return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : []; 31058} 31059 31060class OutletObserver { 31061 constructor(context, delegate) { 31062 this.started = false; 31063 this.context = context; 31064 this.delegate = delegate; 31065 this.outletsByName = new Multimap; 31066 this.outletElementsByName = new Multimap; 31067 this.selectorObserverMap = new Map; 31068 this.attributeObserverMap = new Map; 31069 } 31070 start() { 31071 if (!this.started) { 31072 this.outletDefinitions.forEach((outletName) => { 31073 this.setupSelectorObserverForOutlet(outletName); 31074 this.setupAttributeObserverForOutlet(outletName); 31075 }); 31076 this.started = true; 31077 this.dependentContexts.forEach((context) => context.refresh()); 31078 } 31079 } 31080 refresh() { 31081 this.selectorObserverMap.forEach((observer) => observer.refresh()); 31082 this.attributeObserverMap.forEach((observer) => observer.refresh()); 31083 } 31084 stop() { 31085 if (this.started) { 31086 this.started = false; 31087 this.disconnectAllOutlets(); 31088 this.stopSelectorObservers(); 31089 this.stopAttributeObservers(); 31090 } 31091 } 31092 stopSelectorObservers() { 31093 if (this.selectorObserverMap.size > 0) { 31094 this.selectorObserverMap.forEach((observer) => observer.stop()); 31095 this.selectorObserverMap.clear(); 31096 } 31097 } 31098 stopAttributeObservers() { 31099 if (this.attributeObserverMap.size > 0) { 31100 this.attributeObserverMap.forEach((observer) => observer.stop()); 31101 this.attributeObserverMap.clear(); 31102 } 31103 } 31104 selectorMatched(element, _selector, { outletName }) { 31105 const outlet = this.getOutlet(element, outletName); 31106 if (outlet) { 31107 this.connectOutlet(outlet, element, outletName); 31108 } 31109 } 31110 selectorUnmatched(element, _selector, { outletName }) { 31111 const outlet = this.getOutletFromMap(element, outletName); 31112 if (outlet) { 31113 this.disconnectOutlet(outlet, element, outletName); 31114 } 31115 } 31116 selectorMatchElement(element, { outletName }) { 31117 const selector = this.selector(outletName); 31118 const hasOutlet = this.hasOutlet(element, outletName); 31119 const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`); 31120 if (selector) { 31121 return hasOutlet && hasOutletController && element.matches(selector); 31122 } else { 31123 return false; 31124 } 31125 } 31126 elementMatchedAttribute(_element, attributeName) { 31127 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 31128 if (outletName) { 31129 this.updateSelectorObserverForOutlet(outletName); 31130 } 31131 } 31132 elementAttributeValueChanged(_element, attributeName) { 31133 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 31134 if (outletName) { 31135 this.updateSelectorObserverForOutlet(outletName); 31136 } 31137 } 31138 elementUnmatchedAttribute(_element, attributeName) { 31139 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 31140 if (outletName) { 31141 this.updateSelectorObserverForOutlet(outletName); 31142 } 31143 } 31144 connectOutlet(outlet, element, outletName) { 31145 var _a; 31146 if (!this.outletElementsByName.has(outletName, element)) { 31147 this.outletsByName.add(outletName, outlet); 31148 this.outletElementsByName.add(outletName, element); 31149 (_a = this.selectorObserverMap.get(outletName)) === null || _a === undefined || _a.pause(() => this.delegate.outletConnected(outlet, element, outletName)); 31150 } 31151 } 31152 disconnectOutlet(outlet, element, outletName) { 31153 var _a; 31154 if (this.outletElementsByName.has(outletName, element)) { 31155 this.outletsByName.delete(outletName, outlet); 31156 this.outletElementsByName.delete(outletName, element); 31157 (_a = this.selectorObserverMap.get(outletName)) === null || _a === undefined || _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName)); 31158 } 31159 } 31160 disconnectAllOutlets() { 31161 for (const outletName of this.outletElementsByName.keys) { 31162 for (const element of this.outletElementsByName.getValuesForKey(outletName)) { 31163 for (const outlet of this.outletsByName.getValuesForKey(outletName)) { 31164 this.disconnectOutlet(outlet, element, outletName); 31165 } 31166 } 31167 } 31168 } 31169 updateSelectorObserverForOutlet(outletName) { 31170 const observer = this.selectorObserverMap.get(outletName); 31171 if (observer) { 31172 observer.selector = this.selector(outletName); 31173 } 31174 } 31175 setupSelectorObserverForOutlet(outletName) { 31176 const selector = this.selector(outletName); 31177 const selectorObserver = new SelectorObserver(document.body, selector, this, { outletName }); 31178 this.selectorObserverMap.set(outletName, selectorObserver); 31179 selectorObserver.start(); 31180 } 31181 setupAttributeObserverForOutlet(outletName) { 31182 const attributeName = this.attributeNameForOutletName(outletName); 31183 const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this); 31184 this.attributeObserverMap.set(outletName, attributeObserver); 31185 attributeObserver.start(); 31186 } 31187 selector(outletName) { 31188 return this.scope.outlets.getSelectorForOutletName(outletName); 31189 } 31190 attributeNameForOutletName(outletName) { 31191 return this.scope.schema.outletAttributeForScope(this.identifier, outletName); 31192 } 31193 getOutletNameFromOutletAttributeName(attributeName) { 31194 return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName); 31195 } 31196 get outletDependencies() { 31197 const dependencies = new Multimap; 31198 this.router.modules.forEach((module2) => { 31199 const constructor = module2.definition.controllerConstructor; 31200 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 31201 outlets.forEach((outlet) => dependencies.add(outlet, module2.identifier)); 31202 }); 31203 return dependencies; 31204 } 31205 get outletDefinitions() { 31206 return this.outletDependencies.getKeysForValue(this.identifier); 31207 } 31208 get dependentControllerIdentifiers() { 31209 return this.outletDependencies.getValuesForKey(this.identifier); 31210 } 31211 get dependentContexts() { 31212 const identifiers = this.dependentControllerIdentifiers; 31213 return this.router.contexts.filter((context) => identifiers.includes(context.identifier)); 31214 } 31215 hasOutlet(element, outletName) { 31216 return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName); 31217 } 31218 getOutlet(element, outletName) { 31219 return this.application.getControllerForElementAndIdentifier(element, outletName); 31220 } 31221 getOutletFromMap(element, outletName) { 31222 return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element); 31223 } 31224 get scope() { 31225 return this.context.scope; 31226 } 31227 get schema() { 31228 return this.context.schema; 31229 } 31230 get identifier() { 31231 return this.context.identifier; 31232 } 31233 get application() { 31234 return this.context.application; 31235 } 31236 get router() { 31237 return this.application.router; 31238 } 31239} 31240 31241class Context { 31242 constructor(module2, scope) { 31243 this.logDebugActivity = (functionName, detail = {}) => { 31244 const { identifier, controller, element } = this; 31245 detail = Object.assign({ identifier, controller, element }, detail); 31246 this.application.logDebugActivity(this.identifier, functionName, detail); 31247 }; 31248 this.module = module2; 31249 this.scope = scope; 31250 this.controller = new module2.controllerConstructor(this); 31251 this.bindingObserver = new BindingObserver(this, this.dispatcher); 31252 this.valueObserver = new ValueObserver(this, this.controller); 31253 this.targetObserver = new TargetObserver(this, this); 31254 this.outletObserver = new OutletObserver(this, this); 31255 try { 31256 this.controller.initialize(); 31257 this.logDebugActivity("initialize"); 31258 } catch (error) { 31259 this.handleError(error, "initializing controller"); 31260 } 31261 } 31262 connect() { 31263 this.bindingObserver.start(); 31264 this.valueObserver.start(); 31265 this.targetObserver.start(); 31266 this.outletObserver.start(); 31267 try { 31268 this.controller.connect(); 31269 this.logDebugActivity("connect"); 31270 } catch (error) { 31271 this.handleError(error, "connecting controller"); 31272 } 31273 } 31274 refresh() { 31275 this.outletObserver.refresh(); 31276 } 31277 disconnect() { 31278 try { 31279 this.controller.disconnect(); 31280 this.logDebugActivity("disconnect"); 31281 } catch (error) { 31282 this.handleError(error, "disconnecting controller"); 31283 } 31284 this.outletObserver.stop(); 31285 this.targetObserver.stop(); 31286 this.valueObserver.stop(); 31287 this.bindingObserver.stop(); 31288 } 31289 get application() { 31290 return this.module.application; 31291 } 31292 get identifier() { 31293 return this.module.identifier; 31294 } 31295 get schema() { 31296 return this.application.schema; 31297 } 31298 get dispatcher() { 31299 return this.application.dispatcher; 31300 } 31301 get element() { 31302 return this.scope.element; 31303 } 31304 get parentElement() { 31305 return this.element.parentElement; 31306 } 31307 handleError(error, message, detail = {}) { 31308 const { identifier, controller, element } = this; 31309 detail = Object.assign({ identifier, controller, element }, detail); 31310 this.application.handleError(error, `Error ${message}`, detail); 31311 } 31312 targetConnected(element, name) { 31313 this.invokeControllerMethod(`${name}TargetConnected`, element); 31314 } 31315 targetDisconnected(element, name) { 31316 this.invokeControllerMethod(`${name}TargetDisconnected`, element); 31317 } 31318 outletConnected(outlet, element, name) { 31319 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element); 31320 } 31321 outletDisconnected(outlet, element, name) { 31322 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element); 31323 } 31324 invokeControllerMethod(methodName, ...args2) { 31325 const controller = this.controller; 31326 if (typeof controller[methodName] == "function") { 31327 controller[methodName](...args2); 31328 } 31329 } 31330} 31331function bless(constructor) { 31332 return shadow(constructor, getBlessedProperties(constructor)); 31333} 31334function shadow(constructor, properties) { 31335 const shadowConstructor = extend2(constructor); 31336 const shadowProperties = getShadowProperties(constructor.prototype, properties); 31337 Object.defineProperties(shadowConstructor.prototype, shadowProperties); 31338 return shadowConstructor; 31339} 31340function getBlessedProperties(constructor) { 31341 const blessings = readInheritableStaticArrayValues(constructor, "blessings"); 31342 return blessings.reduce((blessedProperties, blessing) => { 31343 const properties = blessing(constructor); 31344 for (const key in properties) { 31345 const descriptor = blessedProperties[key] || {}; 31346 blessedProperties[key] = Object.assign(descriptor, properties[key]); 31347 } 31348 return blessedProperties; 31349 }, {}); 31350} 31351function getShadowProperties(prototype, properties) { 31352 return getOwnKeys(properties).reduce((shadowProperties, key) => { 31353 const descriptor = getShadowedDescriptor(prototype, properties, key); 31354 if (descriptor) { 31355 Object.assign(shadowProperties, { [key]: descriptor }); 31356 } 31357 return shadowProperties; 31358 }, {}); 31359} 31360function getShadowedDescriptor(prototype, properties, key) { 31361 const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key); 31362 const shadowedByValue = shadowingDescriptor && "value" in shadowingDescriptor; 31363 if (!shadowedByValue) { 31364 const descriptor = Object.getOwnPropertyDescriptor(properties, key).value; 31365 if (shadowingDescriptor) { 31366 descriptor.get = shadowingDescriptor.get || descriptor.get; 31367 descriptor.set = shadowingDescriptor.set || descriptor.set; 31368 } 31369 return descriptor; 31370 } 31371} 31372var getOwnKeys = (() => { 31373 if (typeof Object.getOwnPropertySymbols == "function") { 31374 return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]; 31375 } else { 31376 return Object.getOwnPropertyNames; 31377 } 31378})(); 31379var extend2 = (() => { 31380 function extendWithReflect(constructor) { 31381 function extended() { 31382 return Reflect.construct(constructor, arguments, new.target); 31383 } 31384 extended.prototype = Object.create(constructor.prototype, { 31385 constructor: { value: extended } 31386 }); 31387 Reflect.setPrototypeOf(extended, constructor); 31388 return extended; 31389 } 31390 function testReflectExtension() { 31391 const a = function() { 31392 this.a.call(this); 31393 }; 31394 const b = extendWithReflect(a); 31395 b.prototype.a = function() {}; 31396 return new b; 31397 } 31398 try { 31399 testReflectExtension(); 31400 return extendWithReflect; 31401 } catch (error) { 31402 return (constructor) => class extended extends constructor { 31403 }; 31404 } 31405})(); 31406function blessDefinition(definition) { 31407 return { 31408 identifier: definition.identifier, 31409 controllerConstructor: bless(definition.controllerConstructor) 31410 }; 31411} 31412 31413class Module { 31414 constructor(application, definition) { 31415 this.application = application; 31416 this.definition = blessDefinition(definition); 31417 this.contextsByScope = new WeakMap; 31418 this.connectedContexts = new Set; 31419 } 31420 get identifier() { 31421 return this.definition.identifier; 31422 } 31423 get controllerConstructor() { 31424 return this.definition.controllerConstructor; 31425 } 31426 get contexts() { 31427 return Array.from(this.connectedContexts); 31428 } 31429 connectContextForScope(scope) { 31430 const context = this.fetchContextForScope(scope); 31431 this.connectedContexts.add(context); 31432 context.connect(); 31433 } 31434 disconnectContextForScope(scope) { 31435 const context = this.contextsByScope.get(scope); 31436 if (context) { 31437 this.connectedContexts.delete(context); 31438 context.disconnect(); 31439 } 31440 } 31441 fetchContextForScope(scope) { 31442 let context = this.contextsByScope.get(scope); 31443 if (!context) { 31444 context = new Context(this, scope); 31445 this.contextsByScope.set(scope, context); 31446 } 31447 return context; 31448 } 31449} 31450 31451class ClassMap { 31452 constructor(scope) { 31453 this.scope = scope; 31454 } 31455 has(name) { 31456 return this.data.has(this.getDataKey(name)); 31457 } 31458 get(name) { 31459 return this.getAll(name)[0]; 31460 } 31461 getAll(name) { 31462 const tokenString = this.data.get(this.getDataKey(name)) || ""; 31463 return tokenize(tokenString); 31464 } 31465 getAttributeName(name) { 31466 return this.data.getAttributeNameForKey(this.getDataKey(name)); 31467 } 31468 getDataKey(name) { 31469 return `${name}-class`; 31470 } 31471 get data() { 31472 return this.scope.data; 31473 } 31474} 31475 31476class DataMap { 31477 constructor(scope) { 31478 this.scope = scope; 31479 } 31480 get element() { 31481 return this.scope.element; 31482 } 31483 get identifier() { 31484 return this.scope.identifier; 31485 } 31486 get(key) { 31487 const name = this.getAttributeNameForKey(key); 31488 return this.element.getAttribute(name); 31489 } 31490 set(key, value) { 31491 const name = this.getAttributeNameForKey(key); 31492 this.element.setAttribute(name, value); 31493 return this.get(key); 31494 } 31495 has(key) { 31496 const name = this.getAttributeNameForKey(key); 31497 return this.element.hasAttribute(name); 31498 } 31499 delete(key) { 31500 if (this.has(key)) { 31501 const name = this.getAttributeNameForKey(key); 31502 this.element.removeAttribute(name); 31503 return true; 31504 } else { 31505 return false; 31506 } 31507 } 31508 getAttributeNameForKey(key) { 31509 return `data-${this.identifier}-${dasherize(key)}`; 31510 } 31511} 31512 31513class Guide { 31514 constructor(logger) { 31515 this.warnedKeysByObject = new WeakMap; 31516 this.logger = logger; 31517 } 31518 warn(object, key, message) { 31519 let warnedKeys = this.warnedKeysByObject.get(object); 31520 if (!warnedKeys) { 31521 warnedKeys = new Set; 31522 this.warnedKeysByObject.set(object, warnedKeys); 31523 } 31524 if (!warnedKeys.has(key)) { 31525 warnedKeys.add(key); 31526 this.logger.warn(message, object); 31527 } 31528 } 31529} 31530function attributeValueContainsToken(attributeName, token) { 31531 return `[${attributeName}~="${token}"]`; 31532} 31533 31534class TargetSet { 31535 constructor(scope) { 31536 this.scope = scope; 31537 } 31538 get element() { 31539 return this.scope.element; 31540 } 31541 get identifier() { 31542 return this.scope.identifier; 31543 } 31544 get schema() { 31545 return this.scope.schema; 31546 } 31547 has(targetName) { 31548 return this.find(targetName) != null; 31549 } 31550 find(...targetNames) { 31551 return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined); 31552 } 31553 findAll(...targetNames) { 31554 return targetNames.reduce((targets, targetName) => [ 31555 ...targets, 31556 ...this.findAllTargets(targetName), 31557 ...this.findAllLegacyTargets(targetName) 31558 ], []); 31559 } 31560 findTarget(targetName) { 31561 const selector = this.getSelectorForTargetName(targetName); 31562 return this.scope.findElement(selector); 31563 } 31564 findAllTargets(targetName) { 31565 const selector = this.getSelectorForTargetName(targetName); 31566 return this.scope.findAllElements(selector); 31567 } 31568 getSelectorForTargetName(targetName) { 31569 const attributeName = this.schema.targetAttributeForScope(this.identifier); 31570 return attributeValueContainsToken(attributeName, targetName); 31571 } 31572 findLegacyTarget(targetName) { 31573 const selector = this.getLegacySelectorForTargetName(targetName); 31574 return this.deprecate(this.scope.findElement(selector), targetName); 31575 } 31576 findAllLegacyTargets(targetName) { 31577 const selector = this.getLegacySelectorForTargetName(targetName); 31578 return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName)); 31579 } 31580 getLegacySelectorForTargetName(targetName) { 31581 const targetDescriptor = `${this.identifier}.${targetName}`; 31582 return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor); 31583 } 31584 deprecate(element, targetName) { 31585 if (element) { 31586 const { identifier } = this; 31587 const attributeName = this.schema.targetAttribute; 31588 const revisedAttributeName = this.schema.targetAttributeForScope(identifier); 31589 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.`); 31590 } 31591 return element; 31592 } 31593 get guide() { 31594 return this.scope.guide; 31595 } 31596} 31597 31598class OutletSet { 31599 constructor(scope, controllerElement) { 31600 this.scope = scope; 31601 this.controllerElement = controllerElement; 31602 } 31603 get element() { 31604 return this.scope.element; 31605 } 31606 get identifier() { 31607 return this.scope.identifier; 31608 } 31609 get schema() { 31610 return this.scope.schema; 31611 } 31612 has(outletName) { 31613 return this.find(outletName) != null; 31614 } 31615 find(...outletNames) { 31616 return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined); 31617 } 31618 findAll(...outletNames) { 31619 return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []); 31620 } 31621 getSelectorForOutletName(outletName) { 31622 const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName); 31623 return this.controllerElement.getAttribute(attributeName); 31624 } 31625 findOutlet(outletName) { 31626 const selector = this.getSelectorForOutletName(outletName); 31627 if (selector) 31628 return this.findElement(selector, outletName); 31629 } 31630 findAllOutlets(outletName) { 31631 const selector = this.getSelectorForOutletName(outletName); 31632 return selector ? this.findAllElements(selector, outletName) : []; 31633 } 31634 findElement(selector, outletName) { 31635 const elements = this.scope.queryElements(selector); 31636 return elements.filter((element) => this.matchesElement(element, selector, outletName))[0]; 31637 } 31638 findAllElements(selector, outletName) { 31639 const elements = this.scope.queryElements(selector); 31640 return elements.filter((element) => this.matchesElement(element, selector, outletName)); 31641 } 31642 matchesElement(element, selector, outletName) { 31643 const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || ""; 31644 return element.matches(selector) && controllerAttribute.split(" ").includes(outletName); 31645 } 31646} 31647 31648class Scope { 31649 constructor(schema, element, identifier, logger) { 31650 this.targets = new TargetSet(this); 31651 this.classes = new ClassMap(this); 31652 this.data = new DataMap(this); 31653 this.containsElement = (element) => { 31654 return element.closest(this.controllerSelector) === this.element; 31655 }; 31656 this.schema = schema; 31657 this.element = element; 31658 this.identifier = identifier; 31659 this.guide = new Guide(logger); 31660 this.outlets = new OutletSet(this.documentScope, element); 31661 } 31662 findElement(selector) { 31663 return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement); 31664 } 31665 findAllElements(selector) { 31666 return [ 31667 ...this.element.matches(selector) ? [this.element] : [], 31668 ...this.queryElements(selector).filter(this.containsElement) 31669 ]; 31670 } 31671 queryElements(selector) { 31672 return Array.from(this.element.querySelectorAll(selector)); 31673 } 31674 get controllerSelector() { 31675 return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier); 31676 } 31677 get isDocumentScope() { 31678 return this.element === document.documentElement; 31679 } 31680 get documentScope() { 31681 return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger); 31682 } 31683} 31684 31685class ScopeObserver { 31686 constructor(element, schema, delegate) { 31687 this.element = element; 31688 this.schema = schema; 31689 this.delegate = delegate; 31690 this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this); 31691 this.scopesByIdentifierByElement = new WeakMap; 31692 this.scopeReferenceCounts = new WeakMap; 31693 } 31694 start() { 31695 this.valueListObserver.start(); 31696 } 31697 stop() { 31698 this.valueListObserver.stop(); 31699 } 31700 get controllerAttribute() { 31701 return this.schema.controllerAttribute; 31702 } 31703 parseValueForToken(token) { 31704 const { element, content: identifier } = token; 31705 return this.parseValueForElementAndIdentifier(element, identifier); 31706 } 31707 parseValueForElementAndIdentifier(element, identifier) { 31708 const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element); 31709 let scope = scopesByIdentifier.get(identifier); 31710 if (!scope) { 31711 scope = this.delegate.createScopeForElementAndIdentifier(element, identifier); 31712 scopesByIdentifier.set(identifier, scope); 31713 } 31714 return scope; 31715 } 31716 elementMatchedValue(element, value) { 31717 const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1; 31718 this.scopeReferenceCounts.set(value, referenceCount); 31719 if (referenceCount == 1) { 31720 this.delegate.scopeConnected(value); 31721 } 31722 } 31723 elementUnmatchedValue(element, value) { 31724 const referenceCount = this.scopeReferenceCounts.get(value); 31725 if (referenceCount) { 31726 this.scopeReferenceCounts.set(value, referenceCount - 1); 31727 if (referenceCount == 1) { 31728 this.delegate.scopeDisconnected(value); 31729 } 31730 } 31731 } 31732 fetchScopesByIdentifierForElement(element) { 31733 let scopesByIdentifier = this.scopesByIdentifierByElement.get(element); 31734 if (!scopesByIdentifier) { 31735 scopesByIdentifier = new Map; 31736 this.scopesByIdentifierByElement.set(element, scopesByIdentifier); 31737 } 31738 return scopesByIdentifier; 31739 } 31740} 31741 31742class Router { 31743 constructor(application) { 31744 this.application = application; 31745 this.scopeObserver = new ScopeObserver(this.element, this.schema, this); 31746 this.scopesByIdentifier = new Multimap; 31747 this.modulesByIdentifier = new Map; 31748 } 31749 get element() { 31750 return this.application.element; 31751 } 31752 get schema() { 31753 return this.application.schema; 31754 } 31755 get logger() { 31756 return this.application.logger; 31757 } 31758 get controllerAttribute() { 31759 return this.schema.controllerAttribute; 31760 } 31761 get modules() { 31762 return Array.from(this.modulesByIdentifier.values()); 31763 } 31764 get contexts() { 31765 return this.modules.reduce((contexts, module2) => contexts.concat(module2.contexts), []); 31766 } 31767 start() { 31768 this.scopeObserver.start(); 31769 } 31770 stop() { 31771 this.scopeObserver.stop(); 31772 } 31773 loadDefinition(definition) { 31774 this.unloadIdentifier(definition.identifier); 31775 const module2 = new Module(this.application, definition); 31776 this.connectModule(module2); 31777 const afterLoad = definition.controllerConstructor.afterLoad; 31778 if (afterLoad) { 31779 afterLoad.call(definition.controllerConstructor, definition.identifier, this.application); 31780 } 31781 } 31782 unloadIdentifier(identifier) { 31783 const module2 = this.modulesByIdentifier.get(identifier); 31784 if (module2) { 31785 this.disconnectModule(module2); 31786 } 31787 } 31788 getContextForElementAndIdentifier(element, identifier) { 31789 const module2 = this.modulesByIdentifier.get(identifier); 31790 if (module2) { 31791 return module2.contexts.find((context) => context.element == element); 31792 } 31793 } 31794 proposeToConnectScopeForElementAndIdentifier(element, identifier) { 31795 const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier); 31796 if (scope) { 31797 this.scopeObserver.elementMatchedValue(scope.element, scope); 31798 } else { 31799 console.error(`Couldn't find or create scope for identifier: "${identifier}" and element:`, element); 31800 } 31801 } 31802 handleError(error, message, detail) { 31803 this.application.handleError(error, message, detail); 31804 } 31805 createScopeForElementAndIdentifier(element, identifier) { 31806 return new Scope(this.schema, element, identifier, this.logger); 31807 } 31808 scopeConnected(scope) { 31809 this.scopesByIdentifier.add(scope.identifier, scope); 31810 const module2 = this.modulesByIdentifier.get(scope.identifier); 31811 if (module2) { 31812 module2.connectContextForScope(scope); 31813 } 31814 } 31815 scopeDisconnected(scope) { 31816 this.scopesByIdentifier.delete(scope.identifier, scope); 31817 const module2 = this.modulesByIdentifier.get(scope.identifier); 31818 if (module2) { 31819 module2.disconnectContextForScope(scope); 31820 } 31821 } 31822 connectModule(module2) { 31823 this.modulesByIdentifier.set(module2.identifier, module2); 31824 const scopes = this.scopesByIdentifier.getValuesForKey(module2.identifier); 31825 scopes.forEach((scope) => module2.connectContextForScope(scope)); 31826 } 31827 disconnectModule(module2) { 31828 this.modulesByIdentifier.delete(module2.identifier); 31829 const scopes = this.scopesByIdentifier.getValuesForKey(module2.identifier); 31830 scopes.forEach((scope) => module2.disconnectContextForScope(scope)); 31831 } 31832} 31833var defaultSchema = { 31834 controllerAttribute: "data-controller", 31835 actionAttribute: "data-action", 31836 targetAttribute: "data-target", 31837 targetAttributeForScope: (identifier) => `data-${identifier}-target`, 31838 outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`, 31839 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((c) => [c, c]))), objectFromEntries("0123456789".split("").map((n) => [n, n]))) 31840}; 31841function objectFromEntries(array) { 31842 return array.reduce((memo, [k, v]) => Object.assign(Object.assign({}, memo), { [k]: v }), {}); 31843} 31844 31845class Application { 31846 constructor(element = document.documentElement, schema = defaultSchema) { 31847 this.logger = console; 31848 this.debug = false; 31849 this.logDebugActivity = (identifier, functionName, detail = {}) => { 31850 if (this.debug) { 31851 this.logFormattedMessage(identifier, functionName, detail); 31852 } 31853 }; 31854 this.element = element; 31855 this.schema = schema; 31856 this.dispatcher = new Dispatcher(this); 31857 this.router = new Router(this); 31858 this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters); 31859 } 31860 static start(element, schema) { 31861 const application = new this(element, schema); 31862 application.start(); 31863 return application; 31864 } 31865 async start() { 31866 await domReady(); 31867 this.logDebugActivity("application", "starting"); 31868 this.dispatcher.start(); 31869 this.router.start(); 31870 this.logDebugActivity("application", "start"); 31871 } 31872 stop() { 31873 this.logDebugActivity("application", "stopping"); 31874 this.dispatcher.stop(); 31875 this.router.stop(); 31876 this.logDebugActivity("application", "stop"); 31877 } 31878 register(identifier, controllerConstructor) { 31879 this.load({ identifier, controllerConstructor }); 31880 } 31881 registerActionOption(name, filter) { 31882 this.actionDescriptorFilters[name] = filter; 31883 } 31884 load(head, ...rest) { 31885 const definitions = Array.isArray(head) ? head : [head, ...rest]; 31886 definitions.forEach((definition) => { 31887 if (definition.controllerConstructor.shouldLoad) { 31888 this.router.loadDefinition(definition); 31889 } 31890 }); 31891 } 31892 unload(head, ...rest) { 31893 const identifiers = Array.isArray(head) ? head : [head, ...rest]; 31894 identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier)); 31895 } 31896 get controllers() { 31897 return this.router.contexts.map((context) => context.controller); 31898 } 31899 getControllerForElementAndIdentifier(element, identifier) { 31900 const context = this.router.getContextForElementAndIdentifier(element, identifier); 31901 return context ? context.controller : null; 31902 } 31903 handleError(error, message, detail) { 31904 var _a; 31905 this.logger.error(`%s 31906 31907%o 31908 31909%o`, message, error, detail); 31910 (_a = window.onerror) === null || _a === undefined || _a.call(window, message, "", 0, 0, error); 31911 } 31912 logFormattedMessage(identifier, functionName, detail = {}) { 31913 detail = Object.assign({ application: this }, detail); 31914 this.logger.groupCollapsed(`${identifier} #${functionName}`); 31915 this.logger.log("details:", Object.assign({}, detail)); 31916 this.logger.groupEnd(); 31917 } 31918} 31919function domReady() { 31920 return new Promise((resolve) => { 31921 if (document.readyState == "loading") { 31922 document.addEventListener("DOMContentLoaded", () => resolve()); 31923 } else { 31924 resolve(); 31925 } 31926 }); 31927} 31928function ClassPropertiesBlessing(constructor) { 31929 const classes = readInheritableStaticArrayValues(constructor, "classes"); 31930 return classes.reduce((properties, classDefinition) => { 31931 return Object.assign(properties, propertiesForClassDefinition(classDefinition)); 31932 }, {}); 31933} 31934function propertiesForClassDefinition(key) { 31935 return { 31936 [`${key}Class`]: { 31937 get() { 31938 const { classes } = this; 31939 if (classes.has(key)) { 31940 return classes.get(key); 31941 } else { 31942 const attribute = classes.getAttributeName(key); 31943 throw new Error(`Missing attribute "${attribute}"`); 31944 } 31945 } 31946 }, 31947 [`${key}Classes`]: { 31948 get() { 31949 return this.classes.getAll(key); 31950 } 31951 }, 31952 [`has${capitalize(key)}Class`]: { 31953 get() { 31954 return this.classes.has(key); 31955 } 31956 } 31957 }; 31958} 31959function OutletPropertiesBlessing(constructor) { 31960 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 31961 return outlets.reduce((properties, outletDefinition) => { 31962 return Object.assign(properties, propertiesForOutletDefinition(outletDefinition)); 31963 }, {}); 31964} 31965function getOutletController(controller, element, identifier) { 31966 return controller.application.getControllerForElementAndIdentifier(element, identifier); 31967} 31968function getControllerAndEnsureConnectedScope(controller, element, outletName) { 31969 let outletController = getOutletController(controller, element, outletName); 31970 if (outletController) 31971 return outletController; 31972 controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName); 31973 outletController = getOutletController(controller, element, outletName); 31974 if (outletController) 31975 return outletController; 31976} 31977function propertiesForOutletDefinition(name) { 31978 const camelizedName = namespaceCamelize(name); 31979 return { 31980 [`${camelizedName}Outlet`]: { 31981 get() { 31982 const outletElement = this.outlets.find(name); 31983 const selector = this.outlets.getSelectorForOutletName(name); 31984 if (outletElement) { 31985 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 31986 if (outletController) 31987 return outletController; 31988 throw new Error(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`); 31989 } 31990 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 31991 } 31992 }, 31993 [`${camelizedName}Outlets`]: { 31994 get() { 31995 const outlets = this.outlets.findAll(name); 31996 if (outlets.length > 0) { 31997 return outlets.map((outletElement) => { 31998 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 31999 if (outletController) 32000 return outletController; 32001 console.warn(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`, outletElement); 32002 }).filter((controller) => controller); 32003 } 32004 return []; 32005 } 32006 }, 32007 [`${camelizedName}OutletElement`]: { 32008 get() { 32009 const outletElement = this.outlets.find(name); 32010 const selector = this.outlets.getSelectorForOutletName(name); 32011 if (outletElement) { 32012 return outletElement; 32013 } else { 32014 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 32015 } 32016 } 32017 }, 32018 [`${camelizedName}OutletElements`]: { 32019 get() { 32020 return this.outlets.findAll(name); 32021 } 32022 }, 32023 [`has${capitalize(camelizedName)}Outlet`]: { 32024 get() { 32025 return this.outlets.has(name); 32026 } 32027 } 32028 }; 32029} 32030function TargetPropertiesBlessing(constructor) { 32031 const targets = readInheritableStaticArrayValues(constructor, "targets"); 32032 return targets.reduce((properties, targetDefinition) => { 32033 return Object.assign(properties, propertiesForTargetDefinition(targetDefinition)); 32034 }, {}); 32035} 32036function propertiesForTargetDefinition(name) { 32037 return { 32038 [`${name}Target`]: { 32039 get() { 32040 const target = this.targets.find(name); 32041 if (target) { 32042 return target; 32043 } else { 32044 throw new Error(`Missing target element "${name}" for "${this.identifier}" controller`); 32045 } 32046 } 32047 }, 32048 [`${name}Targets`]: { 32049 get() { 32050 return this.targets.findAll(name); 32051 } 32052 }, 32053 [`has${capitalize(name)}Target`]: { 32054 get() { 32055 return this.targets.has(name); 32056 } 32057 } 32058 }; 32059} 32060function ValuePropertiesBlessing(constructor) { 32061 const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, "values"); 32062 const propertyDescriptorMap = { 32063 valueDescriptorMap: { 32064 get() { 32065 return valueDefinitionPairs.reduce((result, valueDefinitionPair) => { 32066 const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier); 32067 const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key); 32068 return Object.assign(result, { [attributeName]: valueDescriptor }); 32069 }, {}); 32070 } 32071 } 32072 }; 32073 return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => { 32074 return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair)); 32075 }, propertyDescriptorMap); 32076} 32077function propertiesForValueDefinitionPair(valueDefinitionPair, controller) { 32078 const definition = parseValueDefinitionPair(valueDefinitionPair, controller); 32079 const { key, name, reader: read, writer: write } = definition; 32080 return { 32081 [name]: { 32082 get() { 32083 const value = this.data.get(key); 32084 if (value !== null) { 32085 return read(value); 32086 } else { 32087 return definition.defaultValue; 32088 } 32089 }, 32090 set(value) { 32091 if (value === undefined) { 32092 this.data.delete(key); 32093 } else { 32094 this.data.set(key, write(value)); 32095 } 32096 } 32097 }, 32098 [`has${capitalize(name)}`]: { 32099 get() { 32100 return this.data.has(key) || definition.hasCustomDefaultValue; 32101 } 32102 } 32103 }; 32104} 32105function parseValueDefinitionPair([token, typeDefinition], controller) { 32106 return valueDescriptorForTokenAndTypeDefinition({ 32107 controller, 32108 token, 32109 typeDefinition 32110 }); 32111} 32112function parseValueTypeConstant(constant) { 32113 switch (constant) { 32114 case Array: 32115 return "array"; 32116 case Boolean: 32117 return "boolean"; 32118 case Number: 32119 return "number"; 32120 case Object: 32121 return "object"; 32122 case String: 32123 return "string"; 32124 } 32125} 32126function parseValueTypeDefault(defaultValue) { 32127 switch (typeof defaultValue) { 32128 case "boolean": 32129 return "boolean"; 32130 case "number": 32131 return "number"; 32132 case "string": 32133 return "string"; 32134 } 32135 if (Array.isArray(defaultValue)) 32136 return "array"; 32137 if (Object.prototype.toString.call(defaultValue) === "[object Object]") 32138 return "object"; 32139} 32140function parseValueTypeObject(payload) { 32141 const { controller, token, typeObject } = payload; 32142 const hasType = isSomething(typeObject.type); 32143 const hasDefault = isSomething(typeObject.default); 32144 const fullObject = hasType && hasDefault; 32145 const onlyType = hasType && !hasDefault; 32146 const onlyDefault = !hasType && hasDefault; 32147 const typeFromObject = parseValueTypeConstant(typeObject.type); 32148 const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default); 32149 if (onlyType) 32150 return typeFromObject; 32151 if (onlyDefault) 32152 return typeFromDefaultValue; 32153 if (typeFromObject !== typeFromDefaultValue) { 32154 const propertyPath = controller ? `${controller}.${token}` : token; 32155 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}".`); 32156 } 32157 if (fullObject) 32158 return typeFromObject; 32159} 32160function parseValueTypeDefinition(payload) { 32161 const { controller, token, typeDefinition } = payload; 32162 const typeObject = { controller, token, typeObject: typeDefinition }; 32163 const typeFromObject = parseValueTypeObject(typeObject); 32164 const typeFromDefaultValue = parseValueTypeDefault(typeDefinition); 32165 const typeFromConstant = parseValueTypeConstant(typeDefinition); 32166 const type = typeFromObject || typeFromDefaultValue || typeFromConstant; 32167 if (type) 32168 return type; 32169 const propertyPath = controller ? `${controller}.${typeDefinition}` : token; 32170 throw new Error(`Unknown value type "${propertyPath}" for "${token}" value`); 32171} 32172function defaultValueForDefinition(typeDefinition) { 32173 const constant = parseValueTypeConstant(typeDefinition); 32174 if (constant) 32175 return defaultValuesByType[constant]; 32176 const hasDefault = hasProperty(typeDefinition, "default"); 32177 const hasType = hasProperty(typeDefinition, "type"); 32178 const typeObject = typeDefinition; 32179 if (hasDefault) 32180 return typeObject.default; 32181 if (hasType) { 32182 const { type } = typeObject; 32183 const constantFromType = parseValueTypeConstant(type); 32184 if (constantFromType) 32185 return defaultValuesByType[constantFromType]; 32186 } 32187 return typeDefinition; 32188} 32189function valueDescriptorForTokenAndTypeDefinition(payload) { 32190 const { token, typeDefinition } = payload; 32191 const key = `${dasherize(token)}-value`; 32192 const type = parseValueTypeDefinition(payload); 32193 return { 32194 type, 32195 key, 32196 name: camelize(key), 32197 get defaultValue() { 32198 return defaultValueForDefinition(typeDefinition); 32199 }, 32200 get hasCustomDefaultValue() { 32201 return parseValueTypeDefault(typeDefinition) !== undefined; 32202 }, 32203 reader: readers[type], 32204 writer: writers[type] || writers.default 32205 }; 32206} 32207var defaultValuesByType = { 32208 get array() { 32209 return []; 32210 }, 32211 boolean: false, 32212 number: 0, 32213 get object() { 32214 return {}; 32215 }, 32216 string: "" 32217}; 32218var readers = { 32219 array(value) { 32220 const array = JSON.parse(value); 32221 if (!Array.isArray(array)) { 32222 throw new TypeError(`expected value of type "array" but instead got value "${value}" of type "${parseValueTypeDefault(array)}"`); 32223 } 32224 return array; 32225 }, 32226 boolean(value) { 32227 return !(value == "0" || String(value).toLowerCase() == "false"); 32228 }, 32229 number(value) { 32230 return Number(value.replace(/_/g, "")); 32231 }, 32232 object(value) { 32233 const object = JSON.parse(value); 32234 if (object === null || typeof object != "object" || Array.isArray(object)) { 32235 throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseValueTypeDefault(object)}"`); 32236 } 32237 return object; 32238 }, 32239 string(value) { 32240 return value; 32241 } 32242}; 32243var writers = { 32244 default: writeString, 32245 array: writeJSON, 32246 object: writeJSON 32247}; 32248function writeJSON(value) { 32249 return JSON.stringify(value); 32250} 32251function writeString(value) { 32252 return `${value}`; 32253} 32254 32255class Controller { 32256 constructor(context) { 32257 this.context = context; 32258 } 32259 static get shouldLoad() { 32260 return true; 32261 } 32262 static afterLoad(_identifier, _application) { 32263 return; 32264 } 32265 get application() { 32266 return this.context.application; 32267 } 32268 get scope() { 32269 return this.context.scope; 32270 } 32271 get element() { 32272 return this.scope.element; 32273 } 32274 get identifier() { 32275 return this.scope.identifier; 32276 } 32277 get targets() { 32278 return this.scope.targets; 32279 } 32280 get outlets() { 32281 return this.scope.outlets; 32282 } 32283 get classes() { 32284 return this.scope.classes; 32285 } 32286 get data() { 32287 return this.scope.data; 32288 } 32289 initialize() {} 32290 connect() {} 32291 disconnect() {} 32292 dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) { 32293 const type = prefix ? `${prefix}:${eventName}` : eventName; 32294 const event = new CustomEvent(type, { detail, bubbles, cancelable }); 32295 target.dispatchEvent(event); 32296 return event; 32297 } 32298} 32299Controller.blessings = [ 32300 ClassPropertiesBlessing, 32301 TargetPropertiesBlessing, 32302 ValuePropertiesBlessing, 32303 OutletPropertiesBlessing 32304]; 32305Controller.targets = []; 32306Controller.outlets = []; 32307Controller.values = {}; 32308
32309// app/javascript/controllers/search_controller.js 32310class search_controller_default extends Controller { 32311 static targets = ["nextSessionOption"]; 32312 submit() { 32313 this.element.requestSubmit(); 32314 } 32315 toggleNextSession(event) { 32316 const checkbox = event.currentTarget; 32317 if (checkbox.checked) { 32318 this.nextSessionOptionTargets.forEach((label) => { 32319 const input = label.querySelector("input"); 32320 if (input !== checkbox) { 32321 input.checked = false; 32322 label.style.display = "none"; 32323 } 32324 }); 32325 } else { 32326 this.nextSessionOptionTargets.forEach((label) => { 32327 label.style.display = ""; 32328 }); 32329 } 32330 this.submit(); 32331 } 32332} 32333
32334// app/javascript/controllers/filter_toggle_controller.js 32335class filter_toggle_controller_default extends Controller { 32336 static targets = ["panel", "iconFilter", "iconClose", "toggle"]; 32337 toggle() { 32338 const panel = this.panelTarget; 32339 const isHidden = panel.classList.contains("d-none"); 32340 if (isHidden) { 32341 panel.classList.remove("d-none", "d-md-block"); 32342 panel.classList.add("d-block"); 32343 this.iconFilterTarget.classList.add("d-none"); 32344 this.iconCloseTarget.classList.remove("d-none"); 32345 } else { 32346 panel.classList.remove("d-block"); 32347 panel.classList.add("d-none", "d-md-block"); 32348 this.iconFilterTarget.classList.remove("d-none"); 32349 this.iconCloseTarget.classList.add("d-none"); 32350 } 32351 this.toggleTarget.setAttribute("aria-expanded", isHidden ? "true" : "false"); 32352 const hiddenField = panel.querySelector('input[name="filters_open"]'); 32353 if (hiddenField) { 32354 hiddenField.value = isHidden ? "1" : ""; 32355 } 32356 } 32357} 32358
32359// app/javascript/controllers/index.js 32360var application = Application.start(); 32361application.register("search", search_controller_default); 32362application.register("filter-toggle", filter_toggle_controller_default); 32363
32364// app/javascript/application.js 32365var import_smoothscroll_polyfill = __toESM(require_smoothscroll()); 32366
32367// app/javascript/theme/home.js 32368var import_jquery2 = __toESM(require_jquery()); 32369function isHome() { 32370 return import_jquery2.default(".home.show").length === 1; 32371} 32372var ready2 = function() { 32373 if (!isHome()) { 32374 return; 32375 } else { 32376 var head = document.getElementsByTagName("head")[0]; 32377 var script = document.createElement("script"); 32378 script.type = "text/javascript"; 32379 script.src = "/terminal.js"; 32380 script.defer = true; 32381 head.appendChild(script); 32382 script.onload = function() { 32383 animateOnScroll(); 32384 }; 32385 } 32386}; 32387function animateOnScroll() { 32388 import_jquery2.default(window).scroll(function() { 32389 if (!isHome()) { 32390 return; 32391 } 32392 var scroll = import_jquery2.default(window).scrollTop(); 32393 if (scroll >= 300) { 32394 import_jquery2.default(".header").addClass("is-full fix"); 32395 } 32396 if (scroll < 300) { 32397 import_jquery2.default(".header").removeClass("is-full fix"); 32398 } 32399 if (scroll >= 400) { 32400 import_jquery2.default("#home-speaker").addClass("show"); 32401 } 32402 if (scroll >= 700) { 32403 import_jquery2.default(".culture-item").addClass("show"); 32404 } 32405 if (scroll >= 1000) { 32406 import_jquery2.default("#home-terminal").addClass("show"); 32407 if (typeof window.terminalInit === "function") { 32408 window.terminalInit(); 32409 } 32410 } 32411 }); 32412} 32413import_jquery2.default(document).on("turbo:load", ready2); 32414
32415// app/javascript/theme/behavior.js 32416var import_jquery3 = __toESM(require_jquery()); 32417document.addEventListener("turbo:load", function() { 32418 var quoteShowned = false; 32419 import_jquery3.default(document).on("click", "#display-more-quotes", function(e) { 32420 e.preventDefault(); 32421 var $this = import_jquery3.default(this); 32422 if (!quoteShowned) { 32423 import_jquery3.default("#quotes > .row, #quotes-m > .row").addClass("show"); 32424 $this.text("Masquer les témoignages"); 32425 } else { 32426 import_jquery3.default("#quotes > .row, #quotes-m > .row").removeClass("show").first().addClass("show"); 32427 $this.text("Afficher les autres témoignages"); 32428 } 32429 quoteShowned = !quoteShowned; 32430 }); 32431 var trainerShowned = false; 32432 import_jquery3.default(document).on("click", "#display-more-trainers", function(e) { 32433 e.preventDefault(); 32434 var $this = import_jquery3.default(this); 32435 if (!trainerShowned) { 32436 import_jquery3.default("#trainers > .trainer").addClass("show"); 32437 $this.text("Masquer les formateurs"); 32438 } else { 32439 import_jquery3.default("#trainers > .trainer.hide").removeClass("show"); 32440 $this.text("Afficher les autres formateurs"); 32441 } 32442 trainerShowned = !trainerShowned; 32443 }); 32444}); 32445
32446// app/javascript/theme/stickers.js 32447var import_jquery4 = __toESM(require_jquery()); 32448var import_scrollmagic = __toESM(require_ScrollMagic()); 32449
vendor: 118,139 bytes, lines 32450-35616
32450// node_modules/gsap/gsap-core.js 32451function _assertThisInitialized(self2) { 32452 if (self2 === undefined) { 32453 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 32454 } 32455 return self2; 32456} 32457function _inheritsLoose(subClass, superClass) { 32458 subClass.prototype = Object.create(superClass.prototype); 32459 subClass.prototype.constructor = subClass; 32460 subClass.__proto__ = superClass; 32461} 32462/*! 32463 * GSAP 3.14.2 32464 * https://gsap.com 32465 * 32466 * @license Copyright 2008-2025, GreenSock. All rights reserved. 32467 * Subject to the terms at https://gsap.com/standard-license 32468 * @author: Jack Doyle, [email protected] 32469*/ 32470var _config = { 32471 autoSleep: 120, 32472 force3D: "auto", 32473 nullTargetWarn: 1, 32474 units: { 32475 lineHeight: "" 32476 } 32477}; 32478var _defaults = { 32479 duration: 0.5, 32480 overwrite: false, 32481 delay: 0 32482}; 32483var _suppressOverwrites; 32484var _reverting; 32485var _context; 32486var _bigNum = 1e8; 32487var _tinyNum = 1 / _bigNum; 32488var _2PI = Math.PI * 2; 32489var _HALF_PI = _2PI / 4; 32490var _gsID = 0; 32491var _sqrt = Math.sqrt; 32492var _cos = Math.cos; 32493var _sin = Math.sin; 32494var _isString = function _isString(value) { 32495 return typeof value === "string"; 32496}; 32497var _isFunction = function _isFunction(value) { 32498 return typeof value === "function"; 32499}; 32500var _isNumber = function _isNumber(value) { 32501 return typeof value === "number"; 32502}; 32503var _isUndefined = function _isUndefined(value) { 32504 return typeof value === "undefined"; 32505}; 32506var _isObject = function _isObject(value) { 32507 return typeof value === "object"; 32508}; 32509var _isNotFalse = function _isNotFalse(value) { 32510 return value !== false; 32511}; 32512var _windowExists = function _windowExists() { 32513 return typeof window !== "undefined"; 32514}; 32515var _isFuncOrString = function _isFuncOrString(value) { 32516 return _isFunction(value) || _isString(value); 32517}; 32518var _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {}; 32519var _isArray = Array.isArray; 32520var _randomExp = /random\([^)]+\)/g; 32521var _commaDelimExp = /,\s*/g; 32522var _strictNumExp = /(?:-?\.?\d|\.)+/gi; 32523var _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g; 32524var _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g; 32525var _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi; 32526var _relExp = /[+-]=-?[.\d]+/; 32527var _delimitedValueExp = /[^,'"\[\]\s]+/gi; 32528var _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i; 32529var _globalTimeline; 32530var _win; 32531var _coreInitted; 32532var _doc; 32533var _globals = {}; 32534var _installScope = {}; 32535var _coreReady; 32536var _install = function _install(scope) { 32537 return (_installScope = _merge(scope, _globals)) && gsap; 32538}; 32539var _missingPlugin = function _missingPlugin(property, value) { 32540 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 32541}; 32542var _warn = function _warn(message, suppress) { 32543 return !suppress && console.warn(message); 32544}; 32545var _addGlobal = function _addGlobal(name, obj2) { 32546 return name && (_globals[name] = obj2) && _installScope && (_installScope[name] = obj2) || _globals; 32547}; 32548var _emptyFunc = function _emptyFunc() { 32549 return 0; 32550}; 32551var _startAtRevertConfig = { 32552 suppressEvents: true, 32553 isStart: true, 32554 kill: false 32555}; 32556var _revertConfigNoKill = { 32557 suppressEvents: true, 32558 kill: false 32559}; 32560var _revertConfig = { 32561 suppressEvents: true 32562}; 32563var _reservedProps = {}; 32564var _lazyTweens = []; 32565var _lazyLookup = {}; 32566var _lastRenderedFrame; 32567var _plugins = {}; 32568var _effects = {}; 32569var _nextGCFrame = 30; 32570var _harnessPlugins = []; 32571var _callbackNames = ""; 32572var _harness = function _harness(targets) { 32573 var target = targets[0], harnessPlugin, i; 32574 _isObject(target) || _isFunction(target) || (targets = [targets]); 32575 if (!(harnessPlugin = (target._gsap || {}).harness)) { 32576 i = _harnessPlugins.length; 32577 while (i-- && !_harnessPlugins[i].targetTest(target)) {} 32578 harnessPlugin = _harnessPlugins[i]; 32579 } 32580 i = targets.length; 32581 while (i--) { 32582 targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 32583 } 32584 return targets; 32585}; 32586var _getCache = function _getCache(target) { 32587 return target._gsap || _harness(toArray(target))[0]._gsap; 32588}; 32589var _getProperty = function _getProperty(target, property, v) { 32590 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 32591}; 32592var _forEachName = function _forEachName(names, func) { 32593 return (names = names.split(",")).forEach(func) || names; 32594}; 32595var _round = function _round(value) { 32596 return Math.round(value * 1e5) / 1e5 || 0; 32597}; 32598var _roundPrecise = function _roundPrecise(value) { 32599 return Math.round(value * 1e7) / 1e7 || 0; 32600}; 32601var _parseRelative = function _parseRelative(start, value) { 32602 var operator = value.charAt(0), end = parseFloat(value.substr(2)); 32603 start = parseFloat(start); 32604 return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; 32605}; 32606var _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 32607 var l = toFind.length, i = 0; 32608 for (;toSearch.indexOf(toFind[i]) < 0 && ++i < l; ) {} 32609 return i < l; 32610}; 32611var _lazyRender = function _lazyRender() { 32612 var l = _lazyTweens.length, a = _lazyTweens.slice(0), i, tween; 32613 _lazyLookup = {}; 32614 _lazyTweens.length = 0; 32615 for (i = 0;i < l; i++) { 32616 tween = a[i]; 32617 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 32618 } 32619}; 32620var _isRevertWorthy = function _isRevertWorthy(animation) { 32621 return !!(animation._initted || animation._startAt || animation.add); 32622}; 32623var _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 32624 _lazyTweens.length && !_reverting && _lazyRender(); 32625 animation.render(time, suppressEvents, force || !!(_reverting && time < 0 && _isRevertWorthy(animation))); 32626 _lazyTweens.length && !_reverting && _lazyRender(); 32627}; 32628var _numericIfPossible = function _numericIfPossible(value) { 32629 var n = parseFloat(value); 32630 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 32631}; 32632var _passThrough = function _passThrough(p) { 32633 return p; 32634}; 32635var _setDefaults = function _setDefaults(obj2, defaults) { 32636 for (var p in defaults) { 32637 p in obj2 || (obj2[p] = defaults[p]); 32638 } 32639 return obj2; 32640}; 32641var _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { 32642 return function(obj2, defaults) { 32643 for (var p in defaults) { 32644 p in obj2 || p === "duration" && excludeDuration || p === "ease" || (obj2[p] = defaults[p]); 32645 } 32646 }; 32647}; 32648var _merge = function _merge(base, toMerge) { 32649 for (var p in toMerge) { 32650 base[p] = toMerge[p]; 32651 } 32652 return base; 32653}; 32654var _mergeDeep = function _mergeDeep(base, toMerge) { 32655 for (var p in toMerge) { 32656 p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 32657 } 32658 return base; 32659}; 32660var _copyExcluding = function _copyExcluding(obj2, excluding) { 32661 var copy = {}, p; 32662 for (p in obj2) { 32663 p in excluding || (copy[p] = obj2[p]); 32664 } 32665 return copy; 32666}; 32667var _inheritDefaults = function _inheritDefaults(vars) { 32668 var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; 32669 if (_isNotFalse(vars.inherit)) { 32670 while (parent) { 32671 func(vars, parent.vars.defaults); 32672 parent = parent.parent || parent._dp; 32673 } 32674 } 32675 return vars; 32676}; 32677var _arraysMatch = function _arraysMatch(a1, a2) { 32678 var i = a1.length, match = i === a2.length; 32679 while (match && i-- && a1[i] === a2[i]) {} 32680 return i < 0; 32681}; 32682var _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 32683 if (firstProp === undefined) { 32684 firstProp = "_first"; 32685 } 32686 if (lastProp === undefined) { 32687 lastProp = "_last"; 32688 } 32689 var prev = parent[lastProp], t; 32690 if (sortBy) { 32691 t = child[sortBy]; 32692 while (prev && prev[sortBy] > t) { 32693 prev = prev._prev; 32694 } 32695 } 32696 if (prev) { 32697 child._next = prev._next; 32698 prev._next = child; 32699 } else { 32700 child._next = parent[firstProp]; 32701 parent[firstProp] = child; 32702 } 32703 if (child._next) { 32704 child._next._prev = child; 32705 } else { 32706 parent[lastProp] = child; 32707 } 32708 child._prev = prev; 32709 child.parent = child._dp = parent; 32710 return child; 32711}; 32712var _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 32713 if (firstProp === undefined) { 32714 firstProp = "_first"; 32715 } 32716 if (lastProp === undefined) { 32717 lastProp = "_last"; 32718 } 32719 var { _prev: prev, _next: next } = child; 32720 if (prev) { 32721 prev._next = next; 32722 } else if (parent[firstProp] === child) { 32723 parent[firstProp] = next; 32724 } 32725 if (next) { 32726 next._prev = prev; 32727 } else if (parent[lastProp] === child) { 32728 parent[lastProp] = prev; 32729 } 32730 child._next = child._prev = child.parent = null; 32731}; 32732var _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 32733 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child); 32734 child._act = 0; 32735}; 32736var _uncache = function _uncache(animation, child) { 32737 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 32738 var a = animation; 32739 while (a) { 32740 a._dirty = 1; 32741 a = a.parent; 32742 } 32743 } 32744 return animation; 32745}; 32746var _recacheAncestors = function _recacheAncestors(animation) { 32747 var parent = animation.parent; 32748 while (parent && parent.parent) { 32749 parent._dirty = 1; 32750 parent.totalDuration(); 32751 parent = parent.parent; 32752 } 32753 return animation; 32754}; 32755var _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { 32756 return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 32757}; 32758var _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 32759 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 32760}; 32761var _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 32762 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 32763}; 32764var _animationCycle = function _animationCycle(tTime, cycleDuration) { 32765 var whole = Math.floor(tTime = _roundPrecise(tTime / cycleDuration)); 32766 return tTime && whole === tTime ? whole - 1 : whole; 32767}; 32768var _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 32769 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 32770}; 32771var _setEnd = function _setEnd(animation) { 32772 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 32773}; 32774var _alignPlayhead = function _alignPlayhead(animation, totalTime) { 32775 var parent = animation._dp; 32776 if (parent && parent.smoothChildTiming && animation._ts) { 32777 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 32778 _setEnd(animation); 32779 parent._dirty || _uncache(parent, animation); 32780 } 32781 return animation; 32782}; 32783var _postAddChecks = function _postAddChecks(timeline, child) { 32784 var t; 32785 if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) { 32786 t = _parentToChildTotalTime(timeline.rawTime(), child); 32787 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) { 32788 child.render(t, true); 32789 } 32790 } 32791 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 32792 if (timeline._dur < timeline.duration()) { 32793 t = timeline; 32794 while (t._dp) { 32795 t.rawTime() >= 0 && t.totalTime(t._tTime); 32796 t = t._dp; 32797 } 32798 } 32799 timeline._zTime = -_tinyNum; 32800 } 32801}; 32802var _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 32803 child.parent && _removeFromParent(child); 32804 child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 32805 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 32806 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 32807 _isFromOrFromStart(child) || (timeline._recent = child); 32808 skipChecks || _postAddChecks(timeline, child); 32809 timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); 32810 return timeline; 32811}; 32812var _scrollTrigger = function _scrollTrigger(animation, trigger) { 32813 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 32814}; 32815var _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { 32816 _initTween(tween, time, tTime); 32817 if (!tween._initted) { 32818 return 1; 32819 } 32820 if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 32821 _lazyTweens.push(tween); 32822 tween._lazy = [tTime, suppressEvents]; 32823 return 1; 32824 } 32825}; 32826var _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 32827 var parent = _ref.parent; 32828 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 32829}; 32830var _isFromOrFromStart = function _isFromOrFromStart(_ref2) { 32831 var data = _ref2.data; 32832 return data === "isFromStart" || data === "isStart"; 32833}; 32834var _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 32835 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; 32836 if (repeatDelay && tween._repeat) { 32837 tTime = _clamp(0, tween._tDur, totalTime); 32838 iteration = _animationCycle(tTime, repeatDelay); 32839 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 32840 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 32841 prevRatio = 1 - ratio; 32842 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 32843 } 32844 } 32845 if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 32846 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) { 32847 return; 32848 } 32849 prevIteration = tween._zTime; 32850 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); 32851 suppressEvents || (suppressEvents = totalTime && !prevIteration); 32852 tween.ratio = ratio; 32853 tween._from && (ratio = 1 - ratio); 32854 tween._time = 0; 32855 tween._tTime = tTime; 32856 pt = tween._pt; 32857 while (pt) { 32858 pt.r(ratio, pt.d); 32859 pt = pt._next; 32860 } 32861 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 32862 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 32863 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 32864 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 32865 ratio && _removeFromParent(tween, 1); 32866 if (!suppressEvents && !_reverting) { 32867 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 32868 tween._prom && tween._prom(); 32869 } 32870 } 32871 } else if (!tween._zTime) { 32872 tween._zTime = totalTime; 32873 } 32874}; 32875var _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 32876 var child; 32877 if (time > prevTime) { 32878 child = animation._first; 32879 while (child && child._start <= time) { 32880 if (child.data === "isPause" && child._start > prevTime) { 32881 return child; 32882 } 32883 child = child._next; 32884 } 32885 } else { 32886 child = animation._last; 32887 while (child && child._start >= time) { 32888 if (child.data === "isPause" && child._start < prevTime) { 32889 return child; 32890 } 32891 child = child._prev; 32892 } 32893 } 32894}; 32895var _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 32896 var repeat = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur; 32897 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 32898 animation._dur = dur; 32899 animation._tDur = !repeat ? dur : repeat < 0 ? 10000000000 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); 32900 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 32901 animation.parent && _setEnd(animation); 32902 skipUncache || _uncache(animation.parent, animation); 32903 return animation; 32904}; 32905var _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 32906 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 32907}; 32908var _zeroPosition = { 32909 _start: 0, 32910 endTime: _emptyFunc, 32911 totalDuration: _emptyFunc 32912}; 32913var _parsePosition = function _parsePosition(animation, position, percentAnimation) { 32914 var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, i, offset, isPercent; 32915 if (_isString(position) && (isNaN(position) || (position in labels))) { 32916 offset = position.charAt(0); 32917 isPercent = position.substr(-1) === "%"; 32918 i = position.indexOf("="); 32919 if (offset === "<" || offset === ">") { 32920 i >= 0 && (position = position.replace(/=/, "")); 32921 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 32922 } 32923 if (i < 0) { 32924 position in labels || (labels[position] = clippedDuration); 32925 return labels[position]; 32926 } 32927 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 32928 if (isPercent && percentAnimation) { 32929 offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 32930 } 32931 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 32932 } 32933 return position == null ? clippedDuration : +position; 32934}; 32935var _createTweenType = function _createTweenType(type, params, timeline) { 32936 var isLegacy = _isNumber(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent; 32937 isLegacy && (vars.duration = params[1]); 32938 vars.parent = timeline; 32939 if (type) { 32940 irVars = vars; 32941 parent = timeline; 32942 while (parent && !("immediateRender" in irVars)) { 32943 irVars = parent.vars.defaults || {}; 32944 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 32945 } 32946 vars.immediateRender = _isNotFalse(irVars.immediateRender); 32947 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; 32948 } 32949 return new Tween(params[0], vars, params[varsIndex + 1]); 32950}; 32951var _conditionalReturn = function _conditionalReturn(value, func) { 32952 return value || value === 0 ? func(value) : func; 32953}; 32954var _clamp = function _clamp(min, max, value) { 32955 return value < min ? min : value > max ? max : value; 32956}; 32957var getUnit = function getUnit(value, v) { 32958 return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; 32959}; 32960var clamp = function clamp(min, max, value) { 32961 return _conditionalReturn(value, function(v) { 32962 return _clamp(min, max, v); 32963 }); 32964}; 32965var _slice = [].slice; 32966var _isArrayLike = function _isArrayLike(value, nonEmpty) { 32967 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || (value.length - 1 in value) && _isObject(value[0])) && !value.nodeType && value !== _win; 32968}; 32969var _flatten = function _flatten(ar, leaveStrings, accumulator) { 32970 if (accumulator === undefined) { 32971 accumulator = []; 32972 } 32973 return ar.forEach(function(value) { 32974 var _accumulator; 32975 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 32976 }) || accumulator; 32977}; 32978var toArray = function toArray(value, scope, leaveStrings) { 32979 return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : []; 32980}; 32981var selector = function selector(value) { 32982 value = toArray(value)[0] || _warn("Invalid scope") || {}; 32983 return function(v) { 32984 var el = value.current || value.nativeElement || value; 32985 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 32986 }; 32987}; 32988var shuffle = function shuffle(a) { 32989 return a.sort(function() { 32990 return 0.5 - Math.random(); 32991 }); 32992}; 32993var distribute = function distribute(v) { 32994 if (_isFunction(v)) { 32995 return v; 32996 } 32997 var vars = _isObject(v) ? v : { 32998 each: v 32999 }, ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {}, isDecimal = from > 0 && from < 1, ratios = isNaN(from) || isDecimal, axis = vars.axis, ratioX = from, ratioY = from; 33000 if (_isString(from)) { 33001 ratioX = ratioY = { 33002 center: 0.5, 33003 edges: 0.5, 33004 end: 1 33005 }[from] || 0; 33006 } else if (!isDecimal && ratios) { 33007 ratioX = from[0]; 33008 ratioY = from[1]; 33009 } 33010 return function(i, target, a) { 33011 var l = (a || vars).length, distances = cache[l], originX, originY, x, y, d, j, max, min, wrapAt; 33012 if (!distances) { 33013 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1]; 33014 if (!wrapAt) { 33015 max = -_bigNum; 33016 while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {} 33017 wrapAt < l && wrapAt--; 33018 } 33019 distances = cache[l] = []; 33020 originX = ratios ? Math.min(wrapAt, l) * ratioX - 0.5 : from % wrapAt; 33021 originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - 0.5 : from / wrapAt | 0; 33022 max = 0; 33023 min = _bigNum; 33024 for (j = 0;j < l; j++) { 33025 x = j % wrapAt - originX; 33026 y = originY - (j / wrapAt | 0); 33027 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 33028 d > max && (max = d); 33029 d < min && (min = d); 33030 } 33031 from === "random" && shuffle(distances); 33032 distances.max = max - min; 33033 distances.min = min; 33034 distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 33035 distances.b = l < 0 ? base - l : base; 33036 distances.u = getUnit(vars.amount || vars.each) || 0; 33037 ease = ease && l < 0 ? _invertEase(ease) : ease; 33038 } 33039 l = (distances[i] - distances.min) / distances.max || 0; 33040 return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; 33041 }; 33042}; 33043var _roundModifier = function _roundModifier(v) { 33044 var p = Math.pow(10, ((v + "").split(".")[1] || "").length); 33045 return function(raw) { 33046 var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); 33047 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); 33048 }; 33049}; 33050var snap = function snap(snapTo, value) { 33051 var isArray = _isArray(snapTo), radius, is2D; 33052 if (!isArray && _isObject(snapTo)) { 33053 radius = isArray = snapTo.radius || _bigNum; 33054 if (snapTo.values) { 33055 snapTo = toArray(snapTo.values); 33056 if (is2D = !_isNumber(snapTo[0])) { 33057 radius *= radius; 33058 } 33059 } else { 33060 snapTo = _roundModifier(snapTo.increment); 33061 } 33062 } 33063 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function(raw) { 33064 is2D = snapTo(raw); 33065 return Math.abs(is2D - raw) <= radius ? is2D : raw; 33066 } : function(raw) { 33067 var x = parseFloat(is2D ? raw.x : raw), y = parseFloat(is2D ? raw.y : 0), min = _bigNum, closest = 0, i = snapTo.length, dx, dy; 33068 while (i--) { 33069 if (is2D) { 33070 dx = snapTo[i].x - x; 33071 dy = snapTo[i].y - y; 33072 dx = dx * dx + dy * dy; 33073 } else { 33074 dx = Math.abs(snapTo[i] - x); 33075 } 33076 if (dx < min) { 33077 min = dx; 33078 closest = i; 33079 } 33080 } 33081 closest = !radius || min <= radius ? snapTo[closest] : raw; 33082 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 33083 }); 33084}; 33085var random = function random(min, max, roundingIncrement, returnFunction) { 33086 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function() { 33087 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 0.00001) && (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; 33088 }); 33089}; 33090var pipe = function pipe() { 33091 for (var _len = arguments.length, functions = new Array(_len), _key = 0;_key < _len; _key++) { 33092 functions[_key] = arguments[_key]; 33093 } 33094 return function(value) { 33095 return functions.reduce(function(v, f) { 33096 return f(v); 33097 }, value); 33098 }; 33099}; 33100var unitize = function unitize(func, unit) { 33101 return function(value) { 33102 return func(parseFloat(value)) + (unit || getUnit(value)); 33103 }; 33104}; 33105var normalize = function normalize(min, max, value) { 33106 return mapRange(min, max, 0, 1, value); 33107}; 33108var _wrapArray = function _wrapArray(a, wrapper, value) { 33109 return _conditionalReturn(value, function(index) { 33110 return a[~~wrapper(index)]; 33111 }); 33112}; 33113var wrap = function wrap(min, max, value) { 33114 var range = max - min; 33115 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function(value) { 33116 return (range + (value - min) % range) % range + min; 33117 }); 33118}; 33119var wrapYoyo = function wrapYoyo(min, max, value) { 33120 var range = max - min, total = range * 2; 33121 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function(value) { 33122 value = (total + (value - min) % total) % total || 0; 33123 return min + (value > range ? total - value : value); 33124 }); 33125}; 33126var _replaceRandom = function _replaceRandom(s) { 33127 return s.replace(_randomExp, function(match) { 33128 var arIndex = match.indexOf("[") + 1, values = match.substring(arIndex || 7, arIndex ? match.indexOf("]") : match.length - 1).split(_commaDelimExp); 33129 return random(arIndex ? values : +values[0], arIndex ? 0 : +values[1], +values[2] || 0.00001); 33130 }); 33131}; 33132var mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 33133 var inRange = inMax - inMin, outRange = outMax - outMin; 33134 return _conditionalReturn(value, function(value) { 33135 return outMin + ((value - inMin) / inRange * outRange || 0); 33136 }); 33137}; 33138var interpolate2 = function interpolate(start, end, progress, mutate) { 33139 var func = isNaN(start + end) ? 0 : function(p) { 33140 return (1 - p) * start + p * end; 33141 }; 33142 if (!func) { 33143 var isString = _isString(start), master = {}, p, i, interpolators, l, il; 33144 progress === true && (mutate = 1) && (progress = null); 33145 if (isString) { 33146 start = { 33147 p: start 33148 }; 33149 end = { 33150 p: end 33151 }; 33152 } else if (_isArray(start) && !_isArray(end)) { 33153 interpolators = []; 33154 l = start.length; 33155 il = l - 2; 33156 for (i = 1;i < l; i++) { 33157 interpolators.push(interpolate(start[i - 1], start[i])); 33158 } 33159 l--; 33160 func = function func(p) { 33161 p *= l; 33162 var i = Math.min(il, ~~p); 33163 return interpolators[i](p - i); 33164 }; 33165 progress = end; 33166 } else if (!mutate) { 33167 start = _merge(_isArray(start) ? [] : {}, start); 33168 } 33169 if (!interpolators) { 33170 for (p in end) { 33171 _addPropTween.call(master, start, p, "get", end[p]); 33172 } 33173 func = function func(p) { 33174 return _renderPropTweens(p, master) || (isString ? start.p : start); 33175 }; 33176 } 33177 } 33178 return _conditionalReturn(progress, func); 33179}; 33180var _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 33181 var labels = timeline.labels, min = _bigNum, p, distance, label; 33182 for (p in labels) { 33183 distance = labels[p] - fromTime; 33184 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 33185 label = p; 33186 min = distance; 33187 } 33188 } 33189 return label; 33190}; 33191var _callback = function _callback(animation, type, executeLazyFirst) { 33192 var v = animation.vars, callback = v[type], prevContext = _context, context = animation._ctx, params, scope, result; 33193 if (!callback) { 33194 return; 33195 } 33196 params = v[type + "Params"]; 33197 scope = v.callbackScope || animation; 33198 executeLazyFirst && _lazyTweens.length && _lazyRender(); 33199 context && (_context = context); 33200 result = params ? callback.apply(scope, params) : callback.call(scope); 33201 _context = prevContext; 33202 return result; 33203}; 33204var _interrupt = function _interrupt(animation) { 33205 _removeFromParent(animation); 33206 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); 33207 animation.progress() < 1 && _callback(animation, "onInterrupt"); 33208 return animation; 33209}; 33210var _quickTween; 33211var _registerPluginQueue = []; 33212var _createPlugin = function _createPlugin(config) { 33213 if (!config) 33214 return; 33215 config = !config.name && config["default"] || config; 33216 if (_windowExists() || config.headless) { 33217 var name = config.name, isFunc = _isFunction(config), Plugin = name && !isFunc && config.init ? function() { 33218 this._props = []; 33219 } : config, instanceDefaults = { 33220 init: _emptyFunc, 33221 render: _renderPropTweens, 33222 add: _addPropTween, 33223 kill: _killPropTweensOf, 33224 modifier: _addPluginModifier, 33225 rawVars: 0 33226 }, statics = { 33227 targetTest: 0, 33228 get: 0, 33229 getSetter: _getSetter, 33230 aliases: {}, 33231 register: 0 33232 }; 33233 _wake(); 33234 if (config !== Plugin) { 33235 if (_plugins[name]) { 33236 return; 33237 } 33238 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); 33239 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); 33240 _plugins[Plugin.prop = name] = Plugin; 33241 if (config.targetTest) { 33242 _harnessPlugins.push(Plugin); 33243 _reservedProps[name] = 1; 33244 } 33245 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; 33246 } 33247 _addGlobal(name, Plugin); 33248 config.register && config.register(gsap, Plugin, PropTween); 33249 } else { 33250 _registerPluginQueue.push(config); 33251 } 33252}; 33253var _255 = 255; 33254var _colorLookup = { 33255 aqua: [0, _255, _255], 33256 lime: [0, _255, 0], 33257 silver: [192, 192, 192], 33258 black: [0, 0, 0], 33259 maroon: [128, 0, 0], 33260 teal: [0, 128, 128], 33261 blue: [0, 0, _255], 33262 navy: [0, 0, 128], 33263 white: [_255, _255, _255], 33264 olive: [128, 128, 0], 33265 yellow: [_255, _255, 0], 33266 orange: [_255, 165, 0], 33267 gray: [128, 128, 128], 33268 purple: [128, 0, 128], 33269 green: [0, 128, 0], 33270 red: [_255, 0, 0], 33271 pink: [_255, 192, 203], 33272 cyan: [0, _255, _255], 33273 transparent: [_255, _255, _255, 0] 33274}; 33275var _hue = function _hue(h, m1, m2) { 33276 h += h < 0 ? 1 : h > 1 ? -1 : 0; 33277 return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < 0.5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + 0.5 | 0; 33278}; 33279var splitColor = function splitColor(v, toHSL, forceAlpha) { 33280 var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, r, g, b, h, s, l, max, min, d, wasHSL; 33281 if (!a) { 33282 if (v.substr(-1) === ",") { 33283 v = v.substr(0, v.length - 1); 33284 } 33285 if (_colorLookup[v]) { 33286 a = _colorLookup[v]; 33287 } else if (v.charAt(0) === "#") { 33288 if (v.length < 6) { 33289 r = v.charAt(1); 33290 g = v.charAt(2); 33291 b = v.charAt(3); 33292 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 33293 } 33294 if (v.length === 9) { 33295 a = parseInt(v.substr(1, 6), 16); 33296 return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255]; 33297 } 33298 v = parseInt(v.substr(1), 16); 33299 a = [v >> 16, v >> 8 & _255, v & _255]; 33300 } else if (v.substr(0, 3) === "hsl") { 33301 a = wasHSL = v.match(_strictNumExp); 33302 if (!toHSL) { 33303 h = +a[0] % 360 / 360; 33304 s = +a[1] / 100; 33305 l = +a[2] / 100; 33306 g = l <= 0.5 ? l * (s + 1) : l + s - l * s; 33307 r = l * 2 - g; 33308 a.length > 3 && (a[3] *= 1); 33309 a[0] = _hue(h + 1 / 3, r, g); 33310 a[1] = _hue(h, r, g); 33311 a[2] = _hue(h - 1 / 3, r, g); 33312 } else if (~v.indexOf("=")) { 33313 a = v.match(_numExp); 33314 forceAlpha && a.length < 4 && (a[3] = 1); 33315 return a; 33316 } 33317 } else { 33318 a = v.match(_strictNumExp) || _colorLookup.transparent; 33319 } 33320 a = a.map(Number); 33321 } 33322 if (toHSL && !wasHSL) { 33323 r = a[0] / _255; 33324 g = a[1] / _255; 33325 b = a[2] / _255; 33326 max = Math.max(r, g, b); 33327 min = Math.min(r, g, b); 33328 l = (max + min) / 2; 33329 if (max === min) { 33330 h = s = 0; 33331 } else { 33332 d = max - min; 33333 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 33334 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 33335 h *= 60; 33336 } 33337 a[0] = ~~(h + 0.5); 33338 a[1] = ~~(s * 100 + 0.5); 33339 a[2] = ~~(l * 100 + 0.5); 33340 } 33341 forceAlpha && a.length < 4 && (a[3] = 1); 33342 return a; 33343}; 33344var _colorOrderData = function _colorOrderData(v) { 33345 var values = [], c = [], i = -1; 33346 v.split(_colorExp).forEach(function(v) { 33347 var a = v.match(_numWithUnitExp) || []; 33348 values.push.apply(values, a); 33349 c.push(i += a.length + 1); 33350 }); 33351 values.c = c; 33352 return values; 33353}; 33354var _formatColors = function _formatColors(s, toHSL, orderMatchData) { 33355 var result = "", colors = (s + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i = 0, c, shell, d, l; 33356 if (!colors) { 33357 return s; 33358 } 33359 colors = colors.map(function(color) { 33360 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 33361 }); 33362 if (orderMatchData) { 33363 d = _colorOrderData(s); 33364 c = orderMatchData.c; 33365 if (c.join(result) !== d.c.join(result)) { 33366 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 33367 l = shell.length - 1; 33368 for (;i < l; i++) { 33369 result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 33370 } 33371 } 33372 } 33373 if (!shell) { 33374 shell = s.split(_colorExp); 33375 l = shell.length - 1; 33376 for (;i < l; i++) { 33377 result += shell[i] + colors[i]; 33378 } 33379 } 33380 return result + shell[l]; 33381}; 33382var _colorExp = function() { 33383 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", p; 33384 for (p in _colorLookup) { 33385 s += "|" + p + "\\b"; 33386 } 33387 return new RegExp(s + ")", "gi"); 33388}(); 33389var _hslExp = /hsl[a]?\(/; 33390var _colorStringFilter = function _colorStringFilter(a) { 33391 var combined = a.join(" "), toHSL; 33392 _colorExp.lastIndex = 0; 33393 if (_colorExp.test(combined)) { 33394 toHSL = _hslExp.test(combined); 33395 a[1] = _formatColors(a[1], toHSL); 33396 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); 33397 return true; 33398 } 33399}; 33400var _tickerActive; 33401var _ticker = function() { 33402 var _getTime = Date.now, _lagThreshold = 500, _adjustedLag = 33, _startTime = _getTime(), _lastUpdate = _startTime, _gap = 1000 / 240, _nextTime = _gap, _listeners = [], _id, _req, _raf, _self, _delta, _i, _tick = function _tick(v) { 33403 var elapsed = _getTime() - _lastUpdate, manual = v === true, overlap, dispatch, time, frame; 33404 (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag); 33405 _lastUpdate += elapsed; 33406 time = _lastUpdate - _startTime; 33407 overlap = time - _nextTime; 33408 if (overlap > 0 || manual) { 33409 frame = ++_self.frame; 33410 _delta = time - _self.time * 1000; 33411 _self.time = time = time / 1000; 33412 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 33413 dispatch = 1; 33414 } 33415 manual || (_id = _req(_tick)); 33416 if (dispatch) { 33417 for (_i = 0;_i < _listeners.length; _i++) { 33418 _listeners[_i](time, _delta, frame, v); 33419 } 33420 } 33421 }; 33422 _self = { 33423 time: 0, 33424 frame: 0, 33425 tick: function tick() { 33426 _tick(true); 33427 }, 33428 deltaRatio: function deltaRatio(fps) { 33429 return _delta / (1000 / (fps || 60)); 33430 }, 33431 wake: function wake() { 33432 if (_coreReady) { 33433 if (!_coreInitted && _windowExists()) { 33434 _win = _coreInitted = window; 33435 _doc = _win.document || {}; 33436 _globals.gsap = gsap; 33437 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 33438 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 33439 _registerPluginQueue.forEach(_createPlugin); 33440 } 33441 _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame; 33442 _id && _self.sleep(); 33443 _req = _raf || function(f) { 33444 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 33445 }; 33446 _tickerActive = 1; 33447 _tick(2); 33448 } 33449 }, 33450 sleep: function sleep() { 33451 (_raf ? cancelAnimationFrame : clearTimeout)(_id); 33452 _tickerActive = 0; 33453 _req = _emptyFunc; 33454 }, 33455 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 33456 _lagThreshold = threshold || Infinity; 33457 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 33458 }, 33459 fps: function fps(_fps) { 33460 _gap = 1000 / (_fps || 240); 33461 _nextTime = _self.time * 1000 + _gap; 33462 }, 33463 add: function add(callback, once, prioritize) { 33464 var func = once ? function(t, d, f, v) { 33465 callback(t, d, f, v); 33466 _self.remove(func); 33467 } : callback; 33468 _self.remove(callback); 33469 _listeners[prioritize ? "unshift" : "push"](func); 33470 _wake(); 33471 return func; 33472 }, 33473 remove: function remove2(callback, i) { 33474 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 33475 }, 33476 _listeners 33477 }; 33478 return _self; 33479}(); 33480var _wake = function _wake() { 33481 return !_tickerActive && _ticker.wake(); 33482}; 33483var _easeMap = {}; 33484var _customEaseExp = /^[\d.\-M][\d.\-,\s]/; 33485var _quotesExp = /["']/g; 33486var _parseObjectInString = function _parseObjectInString(value) { 33487 var obj2 = {}, split = value.substr(1, value.length - 3).split(":"), key = split[0], i = 1, l = split.length, index, val, parsedVal; 33488 for (;i < l; i++) { 33489 val = split[i]; 33490 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 33491 parsedVal = val.substr(0, index); 33492 obj2[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 33493 key = val.substr(index + 1).trim(); 33494 } 33495 return obj2; 33496}; 33497var _valueInParentheses = function _valueInParentheses(value) { 33498 var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open); 33499 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 33500}; 33501var _configEaseFromString = function _configEaseFromString(name) { 33502 var split = (name + "").split("("), ease = _easeMap[split[0]]; 33503 return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 33504}; 33505var _invertEase = function _invertEase(ease) { 33506 return function(p) { 33507 return 1 - ease(1 - p); 33508 }; 33509}; 33510var _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 33511 var child = timeline._first, ease; 33512 while (child) { 33513 if (child instanceof Timeline) { 33514 _propagateYoyoEase(child, isYoyo); 33515 } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 33516 if (child.timeline) { 33517 _propagateYoyoEase(child.timeline, isYoyo); 33518 } else { 33519 ease = child._ease; 33520 child._ease = child._yEase; 33521 child._yEase = ease; 33522 child._yoyo = isYoyo; 33523 } 33524 } 33525 child = child._next; 33526 } 33527}; 33528var _parseEase = function _parseEase(ease, defaultEase) { 33529 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 33530}; 33531var _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 33532 if (easeOut === undefined) { 33533 easeOut = function easeOut(p) { 33534 return 1 - easeIn(1 - p); 33535 }; 33536 } 33537 if (easeInOut === undefined) { 33538 easeInOut = function easeInOut(p) { 33539 return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 33540 }; 33541 } 33542 var ease = { 33543 easeIn, 33544 easeOut, 33545 easeInOut 33546 }, lowercaseName; 33547 _forEachName(names, function(name) { 33548 _easeMap[name] = _globals[name] = ease; 33549 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 33550 for (var p in ease) { 33551 _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 33552 } 33553 }); 33554 return ease; 33555}; 33556var _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 33557 return function(p) { 33558 return p < 0.5 ? (1 - easeOut(1 - p * 2)) / 2 : 0.5 + easeOut((p - 0.5) * 2) / 2; 33559 }; 33560}; 33561var _configElastic = function _configElastic(type, amplitude, period) { 33562 var p1 = amplitude >= 1 ? amplitude : 1, p2 = (period || (type ? 0.3 : 0.45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), easeOut = function easeOut(p) { 33563 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 33564 }, ease = type === "out" ? easeOut : type === "in" ? function(p) { 33565 return 1 - easeOut(1 - p); 33566 } : _easeInOutFromOut(easeOut); 33567 p2 = _2PI / p2; 33568 ease.config = function(amplitude, period) { 33569 return _configElastic(type, amplitude, period); 33570 }; 33571 return ease; 33572}; 33573var _configBack = function _configBack(type, overshoot) { 33574 if (overshoot === undefined) { 33575 overshoot = 1.70158; 33576 } 33577 var easeOut = function easeOut(p) { 33578 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 33579 }, ease = type === "out" ? easeOut : type === "in" ? function(p) { 33580 return 1 - easeOut(1 - p); 33581 } : _easeInOutFromOut(easeOut); 33582 ease.config = function(overshoot) { 33583 return _configBack(type, overshoot); 33584 }; 33585 return ease; 33586}; 33587_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i) { 33588 var power = i < 5 ? i + 1 : i; 33589 _insertEase(name + ",Power" + (power - 1), i ? function(p) { 33590 return Math.pow(p, power); 33591 } : function(p) { 33592 return p; 33593 }, function(p) { 33594 return 1 - Math.pow(1 - p, power); 33595 }, function(p) { 33596 return p < 0.5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 33597 }); 33598}); 33599_easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; 33600_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 33601(function(n, c) { 33602 var n1 = 1 / c, n2 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut(p) { 33603 return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + 0.75 : p < n3 ? n * (p -= 2.25 / c) * p + 0.9375 : n * Math.pow(p - 2.625 / c, 2) + 0.984375; 33604 }; 33605 _insertEase("Bounce", function(p) { 33606 return 1 - easeOut(1 - p); 33607 }, easeOut); 33608})(7.5625, 2.75); 33609_insertEase("Expo", function(p) { 33610 return Math.pow(2, 10 * (p - 1)) * p + p * p * p * p * p * p * (1 - p); 33611}); 33612_insertEase("Circ", function(p) { 33613 return -(_sqrt(1 - p * p) - 1); 33614}); 33615_insertEase("Sine", function(p) { 33616 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 33617}); 33618_insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 33619_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 33620 config: function config(steps, immediateStart) { 33621 if (steps === undefined) { 33622 steps = 1; 33623 } 33624 var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum; 33625 return function(p) { 33626 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 33627 }; 33628 } 33629}; 33630_defaults.ease = _easeMap["quad.out"]; 33631_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) { 33632 return _callbackNames += name + "," + name + "Params,"; 33633}); 33634var GSCache = function GSCache(target, harness) { 33635 this.id = _gsID++; 33636 target._gsap = this; 33637 this.target = target; 33638 this.harness = harness; 33639 this.get = harness ? harness.get : _getProperty; 33640 this.set = harness ? harness.getSetter : _getSetter; 33641}; 33642var Animation = /* @__PURE__ */ function() { 33643 function Animation(vars) { 33644 this.vars = vars; 33645 this._delay = +vars.delay || 0; 33646 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 33647 this._rDelay = vars.repeatDelay || 0; 33648 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 33649 } 33650 this._ts = 1; 33651 _setDuration(this, +vars.duration, 1, 1); 33652 this.data = vars.data; 33653 if (_context) { 33654 this._ctx = _context; 33655 _context.data.push(this); 33656 } 33657 _tickerActive || _ticker.wake(); 33658 } 33659 var _proto = Animation.prototype; 33660 _proto.delay = function delay(value) { 33661 if (value || value === 0) { 33662 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 33663 this._delay = value; 33664 return this; 33665 } 33666 return this._delay; 33667 }; 33668 _proto.duration = function duration(value) { 33669 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 33670 }; 33671 _proto.totalDuration = function totalDuration(value) { 33672 if (!arguments.length) { 33673 return this._tDur; 33674 } 33675 this._dirty = 0; 33676 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 33677 }; 33678 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 33679 _wake(); 33680 if (!arguments.length) { 33681 return this._tTime; 33682 } 33683 var parent = this._dp; 33684 if (parent && parent.smoothChildTiming && this._ts) { 33685 _alignPlayhead(this, _totalTime); 33686 !parent._dp || parent.parent || _postAddChecks(parent, this); 33687 while (parent && parent.parent) { 33688 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { 33689 parent.totalTime(parent._tTime, true); 33690 } 33691 parent = parent.parent; 33692 } 33693 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) { 33694 _addToTimeline(this._dp, this, this._start - this._delay); 33695 } 33696 } 33697 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !this._initted && this._dur && _totalTime || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 33698 this._ts || (this._pTime = _totalTime); 33699 _lazySafeRender(this, _totalTime, suppressEvents); 33700 } 33701 return this; 33702 }; 33703 _proto.time = function time(value, suppressEvents) { 33704 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; 33705 }; 33706 _proto.totalProgress = function totalProgress(value, suppressEvents) { 33707 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() >= 0 && this._initted ? 1 : 0; 33708 }; 33709 _proto.progress = function progress(value, suppressEvents) { 33710 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; 33711 }; 33712 _proto.iteration = function iteration(value, suppressEvents) { 33713 var cycleDuration = this.duration() + this._rDelay; 33714 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 33715 }; 33716 _proto.timeScale = function timeScale(value, suppressEvents) { 33717 if (!arguments.length) { 33718 return this._rts === -_tinyNum ? 0 : this._rts; 33719 } 33720 if (this._rts === value) { 33721 return this; 33722 } 33723 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; 33724 this._rts = +value || 0; 33725 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; 33726 this.totalTime(_clamp(-Math.abs(this._delay), this.totalDuration(), tTime), suppressEvents !== false); 33727 _setEnd(this); 33728 return _recacheAncestors(this); 33729 }; 33730 _proto.paused = function paused(value) { 33731 if (!arguments.length) { 33732 return this._ps; 33733 } 33734 if (this._ps !== value) { 33735 this._ps = value; 33736 if (value) { 33737 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); 33738 this._ts = this._act = 0; 33739 } else { 33740 _wake(); 33741 this._ts = this._rts; 33742 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); 33743 } 33744 } 33745 return this; 33746 }; 33747 _proto.startTime = function startTime(value) { 33748 if (arguments.length) { 33749 this._start = _roundPrecise(value); 33750 var parent = this.parent || this._dp; 33751 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, this._start - this._delay); 33752 return this; 33753 } 33754 return this._start; 33755 }; 33756 _proto.endTime = function endTime(includeRepeats) { 33757 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 33758 }; 33759 _proto.rawTime = function rawTime(wrapRepeats) { 33760 var parent = this.parent || this._dp; 33761 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); 33762 }; 33763 _proto.revert = function revert(config) { 33764 if (config === undefined) { 33765 config = _revertConfig; 33766 } 33767 var prevIsReverting = _reverting; 33768 _reverting = config; 33769 if (_isRevertWorthy(this)) { 33770 this.timeline && this.timeline.revert(config); 33771 this.totalTime(-0.01, config.suppressEvents); 33772 } 33773 this.data !== "nested" && config.kill !== false && this.kill(); 33774 _reverting = prevIsReverting; 33775 return this; 33776 }; 33777 _proto.globalTime = function globalTime(rawTime) { 33778 var animation = this, time = arguments.length ? rawTime : animation.rawTime(); 33779 while (animation) { 33780 time = animation._start + time / (Math.abs(animation._ts) || 1); 33781 animation = animation._dp; 33782 } 33783 return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time; 33784 }; 33785 _proto.repeat = function repeat(value) { 33786 if (arguments.length) { 33787 this._repeat = value === Infinity ? -2 : value; 33788 return _onUpdateTotalDuration(this); 33789 } 33790 return this._repeat === -2 ? Infinity : this._repeat; 33791 }; 33792 _proto.repeatDelay = function repeatDelay(value) { 33793 if (arguments.length) { 33794 var time = this._time; 33795 this._rDelay = value; 33796 _onUpdateTotalDuration(this); 33797 return time ? this.time(time) : this; 33798 } 33799 return this._rDelay; 33800 }; 33801 _proto.yoyo = function yoyo(value) { 33802 if (arguments.length) { 33803 this._yoyo = value; 33804 return this; 33805 } 33806 return this._yoyo; 33807 }; 33808 _proto.seek = function seek(position, suppressEvents) { 33809 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 33810 }; 33811 _proto.restart = function restart(includeDelay, suppressEvents) { 33812 this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 33813 this._dur || (this._zTime = -_tinyNum); 33814 return this; 33815 }; 33816 _proto.play = function play(from, suppressEvents) { 33817 from != null && this.seek(from, suppressEvents); 33818 return this.reversed(false).paused(false); 33819 }; 33820 _proto.reverse = function reverse(from, suppressEvents) { 33821 from != null && this.seek(from || this.totalDuration(), suppressEvents); 33822 return this.reversed(true).paused(false); 33823 }; 33824 _proto.pause = function pause(atTime, suppressEvents) { 33825 atTime != null && this.seek(atTime, suppressEvents); 33826 return this.paused(true); 33827 }; 33828 _proto.resume = function resume() { 33829 return this.paused(false); 33830 }; 33831 _proto.reversed = function reversed(value) { 33832 if (arguments.length) { 33833 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); 33834 return this; 33835 } 33836 return this._rts < 0; 33837 }; 33838 _proto.invalidate = function invalidate() { 33839 this._initted = this._act = 0; 33840 this._zTime = -_tinyNum; 33841 return this; 33842 }; 33843 _proto.isActive = function isActive() { 33844 var parent = this.parent || this._dp, start = this._start, rawTime; 33845 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 33846 }; 33847 _proto.eventCallback = function eventCallback(type, callback, params) { 33848 var vars = this.vars; 33849 if (arguments.length > 1) { 33850 if (!callback) { 33851 delete vars[type]; 33852 } else { 33853 vars[type] = callback; 33854 params && (vars[type + "Params"] = params); 33855 type === "onUpdate" && (this._onUpdate = callback); 33856 } 33857 return this; 33858 } 33859 return vars[type]; 33860 }; 33861 _proto.then = function then(onFulfilled) { 33862 var self2 = this, prevProm = self2._prom; 33863 return new Promise(function(resolve) { 33864 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, _resolve = function _resolve() { 33865 var _then = self2.then; 33866 self2.then = null; 33867 prevProm && prevProm(); 33868 _isFunction(f) && (f = f(self2)) && (f.then || f === self2) && (self2.then = _then); 33869 resolve(f); 33870 self2.then = _then; 33871 }; 33872 if (self2._initted && self2.totalProgress() === 1 && self2._ts >= 0 || !self2._tTime && self2._ts < 0) { 33873 _resolve(); 33874 } else { 33875 self2._prom = _resolve; 33876 } 33877 }); 33878 }; 33879 _proto.kill = function kill() { 33880 _interrupt(this); 33881 }; 33882 return Animation; 33883}(); 33884_setDefaults(Animation.prototype, { 33885 _time: 0, 33886 _start: 0, 33887 _end: 0, 33888 _tTime: 0, 33889 _tDur: 0, 33890 _dirty: 0, 33891 _repeat: 0, 33892 _yoyo: false, 33893 parent: null, 33894 _initted: false, 33895 _rDelay: 0, 33896 _ts: 1, 33897 _dp: 0, 33898 ratio: 0, 33899 _zTime: -_tinyNum, 33900 _prom: 0, 33901 _ps: false, 33902 _rts: 1 33903}); 33904var Timeline = /* @__PURE__ */ function(_Animation) { 33905 _inheritsLoose(Timeline, _Animation); 33906 function Timeline(vars, position) { 33907 var _this; 33908 if (vars === undefined) { 33909 vars = {}; 33910 } 33911 _this = _Animation.call(this, vars) || this; 33912 _this.labels = {}; 33913 _this.smoothChildTiming = !!vars.smoothChildTiming; 33914 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 33915 _this._sort = _isNotFalse(vars.sortChildren); 33916 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 33917 vars.reversed && _this.reverse(); 33918 vars.paused && _this.paused(true); 33919 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 33920 return _this; 33921 } 33922 var _proto2 = Timeline.prototype; 33923 _proto2.to = function to(targets, vars, position) { 33924 _createTweenType(0, arguments, this); 33925 return this; 33926 }; 33927 _proto2.from = function from(targets, vars, position) { 33928 _createTweenType(1, arguments, this); 33929 return this; 33930 }; 33931 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 33932 _createTweenType(2, arguments, this); 33933 return this; 33934 }; 33935 _proto2.set = function set(targets, vars, position) { 33936 vars.duration = 0; 33937 vars.parent = this; 33938 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 33939 vars.immediateRender = !!vars.immediateRender; 33940 new Tween(targets, vars, _parsePosition(this, position), 1); 33941 return this; 33942 }; 33943 _proto2.call = function call(callback, params, position) { 33944 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 33945 }; 33946 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 33947 vars.duration = duration; 33948 vars.stagger = vars.stagger || stagger; 33949 vars.onComplete = onCompleteAll; 33950 vars.onCompleteParams = onCompleteAllParams; 33951 vars.parent = this; 33952 new Tween(targets, vars, _parsePosition(this, position)); 33953 return this; 33954 }; 33955 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 33956 vars.runBackwards = 1; 33957 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 33958 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 33959 }; 33960 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 33961 toVars.startAt = fromVars; 33962 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 33963 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 33964 }; 33965 _proto2.render = function render(totalTime, suppressEvents, force) { 33966 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, next, iteration, cycleDuration, prevPaused, pauseTween, timeScale, prevStart, prevIteration, yoyo, isYoyo; 33967 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 33968 if (tTime !== this._tTime || force || crossingStart) { 33969 if (prevTime !== this._time && dur) { 33970 tTime += this._time - prevTime; 33971 totalTime += this._time - prevTime; 33972 } 33973 time = tTime; 33974 prevStart = this._start; 33975 timeScale = this._ts; 33976 prevPaused = !timeScale; 33977 if (crossingStart) { 33978 dur || (prevTime = this._zTime); 33979 (totalTime || !suppressEvents) && (this._zTime = totalTime); 33980 } 33981 if (this._repeat) { 33982 yoyo = this._yoyo; 33983 cycleDuration = dur + this._rDelay; 33984 if (this._repeat < -1 && totalTime < 0) { 33985 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 33986 } 33987 time = _roundPrecise(tTime % cycleDuration); 33988 if (tTime === tDur) { 33989 iteration = this._repeat; 33990 time = dur; 33991 } else { 33992 prevIteration = _roundPrecise(tTime / cycleDuration); 33993 iteration = ~~prevIteration; 33994 if (iteration && iteration === prevIteration) { 33995 time = dur; 33996 iteration--; 33997 } 33998 time > dur && (time = dur); 33999 } 34000 prevIteration = _animationCycle(this._tTime, cycleDuration); 34001 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); 34002 if (yoyo && iteration & 1) { 34003 time = dur - time; 34004 isYoyo = 1; 34005 } 34006 if (iteration !== prevIteration && !this._lock) { 34007 var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1); 34008 iteration < prevIteration && (rewinding = !rewinding); 34009 prevTime = rewinding ? 0 : tTime % dur ? dur : tTime; 34010 this._lock = 1; 34011 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 34012 this._tTime = tTime; 34013 !suppressEvents && this.parent && _callback(this, "onRepeat"); 34014 if (this.vars.repeatRefresh && !isYoyo) { 34015 this.invalidate()._lock = 1; 34016 prevIteration = iteration; 34017 } 34018 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { 34019 return this; 34020 } 34021 dur = this._dur; 34022 tDur = this._tDur; 34023 if (doesWrap) { 34024 this._lock = 2; 34025 prevTime = rewinding ? dur : -0.0001; 34026 this.render(prevTime, true); 34027 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 34028 } 34029 this._lock = 0; 34030 if (!this._ts && !prevPaused) { 34031 return this; 34032 } 34033 _propagateYoyoEase(this, isYoyo); 34034 } 34035 } 34036 if (this._hasPause && !this._forcing && this._lock < 2) { 34037 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 34038 if (pauseTween) { 34039 tTime -= time - (time = pauseTween._start); 34040 } 34041 } 34042 this._tTime = tTime; 34043 this._time = time; 34044 this._act = !timeScale; 34045 if (!this._initted) { 34046 this._onUpdate = this.vars.onUpdate; 34047 this._initted = 1; 34048 this._zTime = totalTime; 34049 prevTime = 0; 34050 } 34051 if (!prevTime && tTime && dur && !suppressEvents && !prevIteration) { 34052 _callback(this, "onStart"); 34053 if (this._tTime !== tTime) { 34054 return this; 34055 } 34056 } 34057 if (time >= prevTime && totalTime >= 0) { 34058 child = this._first; 34059 while (child) { 34060 next = child._next; 34061 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 34062 if (child.parent !== this) { 34063 return this.render(totalTime, suppressEvents, force); 34064 } 34065 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 34066 if (time !== this._time || !this._ts && !prevPaused) { 34067 pauseTween = 0; 34068 next && (tTime += this._zTime = -_tinyNum); 34069 break; 34070 } 34071 } 34072 child = next; 34073 } 34074 } else { 34075 child = this._last; 34076 var adjustedTime = totalTime < 0 ? totalTime : time; 34077 while (child) { 34078 next = child._prev; 34079 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 34080 if (child.parent !== this) { 34081 return this.render(totalTime, suppressEvents, force); 34082 } 34083 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && _isRevertWorthy(child)); 34084 if (time !== this._time || !this._ts && !prevPaused) { 34085 pauseTween = 0; 34086 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); 34087 break; 34088 } 34089 } 34090 child = next; 34091 } 34092 } 34093 if (pauseTween && !suppressEvents) { 34094 this.pause(); 34095 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; 34096 if (this._ts) { 34097 this._start = prevStart; 34098 _setEnd(this); 34099 return this.render(totalTime, suppressEvents, force); 34100 } 34101 } 34102 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 34103 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) { 34104 if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) { 34105 if (!this._lock) { 34106 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 34107 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 34108 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 34109 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 34110 } 34111 } 34112 } 34113 } 34114 } 34115 return this; 34116 }; 34117 _proto2.add = function add(child, position) { 34118 var _this2 = this; 34119 _isNumber(position) || (position = _parsePosition(this, position, child)); 34120 if (!(child instanceof Animation)) { 34121 if (_isArray(child)) { 34122 child.forEach(function(obj2) { 34123 return _this2.add(obj2, position); 34124 }); 34125 return this; 34126 } 34127 if (_isString(child)) { 34128 return this.addLabel(child, position); 34129 } 34130 if (_isFunction(child)) { 34131 child = Tween.delayedCall(0, child); 34132 } else { 34133 return this; 34134 } 34135 } 34136 return this !== child ? _addToTimeline(this, child, position) : this; 34137 }; 34138 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 34139 if (nested === undefined) { 34140 nested = true; 34141 } 34142 if (tweens === undefined) { 34143 tweens = true; 34144 } 34145 if (timelines === undefined) { 34146 timelines = true; 34147 } 34148 if (ignoreBeforeTime === undefined) { 34149 ignoreBeforeTime = -_bigNum; 34150 } 34151 var a = [], child = this._first; 34152 while (child) { 34153 if (child._start >= ignoreBeforeTime) { 34154 if (child instanceof Tween) { 34155 tweens && a.push(child); 34156 } else { 34157 timelines && a.push(child); 34158 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 34159 } 34160 } 34161 child = child._next; 34162 } 34163 return a; 34164 }; 34165 _proto2.getById = function getById(id) { 34166 var animations = this.getChildren(1, 1, 1), i = animations.length; 34167 while (i--) { 34168 if (animations[i].vars.id === id) { 34169 return animations[i]; 34170 } 34171 } 34172 }; 34173 _proto2.remove = function remove2(child) { 34174 if (_isString(child)) { 34175 return this.removeLabel(child); 34176 } 34177 if (_isFunction(child)) { 34178 return this.killTweensOf(child); 34179 } 34180 child.parent === this && _removeLinkedListItem(this, child); 34181 if (child === this._recent) { 34182 this._recent = this._last; 34183 } 34184 return _uncache(this); 34185 }; 34186 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 34187 if (!arguments.length) { 34188 return this._tTime; 34189 } 34190 this._forcing = 1; 34191 if (!this._dp && this._ts) { 34192 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts)); 34193 } 34194 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 34195 this._forcing = 0; 34196 return this; 34197 }; 34198 _proto2.addLabel = function addLabel(label, position) { 34199 this.labels[label] = _parsePosition(this, position); 34200 return this; 34201 }; 34202 _proto2.removeLabel = function removeLabel(label) { 34203 delete this.labels[label]; 34204 return this; 34205 }; 34206 _proto2.addPause = function addPause(position, callback, params) { 34207 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 34208 t.data = "isPause"; 34209 this._hasPause = 1; 34210 return _addToTimeline(this, t, _parsePosition(this, position)); 34211 }; 34212 _proto2.removePause = function removePause(position) { 34213 var child = this._first; 34214 position = _parsePosition(this, position); 34215 while (child) { 34216 if (child._start === position && child.data === "isPause") { 34217 _removeFromParent(child); 34218 } 34219 child = child._next; 34220 } 34221 }; 34222 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 34223 var tweens = this.getTweensOf(targets, onlyActive), i = tweens.length; 34224 while (i--) { 34225 _overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 34226 } 34227 return this; 34228 }; 34229 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 34230 var a = [], parsedTargets = toArray(targets), child = this._first, isGlobalTime = _isNumber(onlyActive), children; 34231 while (child) { 34232 if (child instanceof Tween) { 34233 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) { 34234 a.push(child); 34235 } 34236 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { 34237 a.push.apply(a, children); 34238 } 34239 child = child._next; 34240 } 34241 return a; 34242 }; 34243 _proto2.tweenTo = function tweenTo(position, vars) { 34244 vars = vars || {}; 34245 var tl = this, endTime = _parsePosition(tl, position), _vars = vars, { startAt, onStart: _onStart, onStartParams, immediateRender } = _vars, initted, tween = Tween.to(tl, _setDefaults({ 34246 ease: vars.ease || "none", 34247 lazy: false, 34248 immediateRender: false, 34249 time: endTime, 34250 overwrite: "auto", 34251 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 34252 onStart: function onStart() { 34253 tl.pause(); 34254 if (!initted) { 34255 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 34256 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 34257 initted = 1; 34258 } 34259 _onStart && _onStart.apply(tween, onStartParams || []); 34260 } 34261 }, vars)); 34262 return immediateRender ? tween.render(0) : tween; 34263 }; 34264 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 34265 return this.tweenTo(toPosition, _setDefaults({ 34266 startAt: { 34267 time: _parsePosition(this, fromPosition) 34268 } 34269 }, vars)); 34270 }; 34271 _proto2.recent = function recent() { 34272 return this._recent; 34273 }; 34274 _proto2.nextLabel = function nextLabel(afterTime) { 34275 if (afterTime === undefined) { 34276 afterTime = this._time; 34277 } 34278 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 34279 }; 34280 _proto2.previousLabel = function previousLabel(beforeTime) { 34281 if (beforeTime === undefined) { 34282 beforeTime = this._time; 34283 } 34284 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 34285 }; 34286 _proto2.currentLabel = function currentLabel(value) { 34287 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 34288 }; 34289 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 34290 if (ignoreBeforeTime === undefined) { 34291 ignoreBeforeTime = 0; 34292 } 34293 var child = this._first, labels = this.labels, p; 34294 amount = _roundPrecise(amount); 34295 while (child) { 34296 if (child._start >= ignoreBeforeTime) { 34297 child._start += amount; 34298 child._end += amount; 34299 } 34300 child = child._next; 34301 } 34302 if (adjustLabels) { 34303 for (p in labels) { 34304 if (labels[p] >= ignoreBeforeTime) { 34305 labels[p] += amount; 34306 } 34307 } 34308 } 34309 return _uncache(this); 34310 }; 34311 _proto2.invalidate = function invalidate(soft) { 34312 var child = this._first; 34313 this._lock = 0; 34314 while (child) { 34315 child.invalidate(soft); 34316 child = child._next; 34317 } 34318 return _Animation.prototype.invalidate.call(this, soft); 34319 }; 34320 _proto2.clear = function clear(includeLabels) { 34321 if (includeLabels === undefined) { 34322 includeLabels = true; 34323 } 34324 var child = this._first, next; 34325 while (child) { 34326 next = child._next; 34327 this.remove(child); 34328 child = next; 34329 } 34330 this._dp && (this._time = this._tTime = this._pTime = 0); 34331 includeLabels && (this.labels = {}); 34332 return _uncache(this); 34333 }; 34334 _proto2.totalDuration = function totalDuration(value) { 34335 var max = 0, self2 = this, child = self2._last, prevStart = _bigNum, prev, start, parent; 34336 if (arguments.length) { 34337 return self2.timeScale((self2._repeat < 0 ? self2.duration() : self2.totalDuration()) / (self2.reversed() ? -value : value)); 34338 } 34339 if (self2._dirty) { 34340 parent = self2.parent; 34341 while (child) { 34342 prev = child._prev; 34343 child._dirty && child.totalDuration(); 34344 start = child._start; 34345 if (start > prevStart && self2._sort && child._ts && !self2._lock) { 34346 self2._lock = 1; 34347 _addToTimeline(self2, child, start - child._delay, 1)._lock = 0; 34348 } else { 34349 prevStart = start; 34350 } 34351 if (start < 0 && child._ts) { 34352 max -= start; 34353 if (!parent && !self2._dp || parent && parent.smoothChildTiming) { 34354 self2._start += _roundPrecise(start / self2._ts); 34355 self2._time -= start; 34356 self2._tTime -= start; 34357 } 34358 self2.shiftChildren(-start, false, -Infinity); 34359 prevStart = 0; 34360 } 34361 child._end > max && child._ts && (max = child._end); 34362 child = prev; 34363 } 34364 _setDuration(self2, self2 === _globalTimeline && self2._time > max ? self2._time : max, 1, 1); 34365 self2._dirty = 0; 34366 } 34367 return self2._tDur; 34368 }; 34369 Timeline.updateRoot = function updateRoot(time) { 34370 if (_globalTimeline._ts) { 34371 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 34372 _lastRenderedFrame = _ticker.frame; 34373 } 34374 if (_ticker.frame >= _nextGCFrame) { 34375 _nextGCFrame += _config.autoSleep || 120; 34376 var child = _globalTimeline._first; 34377 if (!child || !child._ts) { 34378 if (_config.autoSleep && _ticker._listeners.length < 2) { 34379 while (child && !child._ts) { 34380 child = child._next; 34381 } 34382 child || _ticker.sleep(); 34383 } 34384 } 34385 } 34386 }; 34387 return Timeline; 34388}(Animation); 34389_setDefaults(Timeline.prototype, { 34390 _lock: 0, 34391 _hasPause: 0, 34392 _forcing: 0 34393}); 34394var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 34395 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), index = 0, matchIndex = 0, result, startNums, color, endNum, chunk, startNum, hasRandom, a; 34396 pt.b = start; 34397 pt.e = end; 34398 start += ""; 34399 end += ""; 34400 if (hasRandom = ~end.indexOf("random(")) { 34401 end = _replaceRandom(end); 34402 } 34403 if (stringFilter) { 34404 a = [start, end]; 34405 stringFilter(a, target, prop); 34406 start = a[0]; 34407 end = a[1]; 34408 } 34409 startNums = start.match(_complexStringNumExp) || []; 34410 while (result = _complexStringNumExp.exec(end)) { 34411 endNum = result[0]; 34412 chunk = end.substring(index, result.index); 34413 if (color) { 34414 color = (color + 1) % 5; 34415 } else if (chunk.substr(-5) === "rgba(") { 34416 color = 1; 34417 } 34418 if (endNum !== startNums[matchIndex++]) { 34419 startNum = parseFloat(startNums[matchIndex - 1]) || 0; 34420 pt._pt = { 34421 _next: pt._pt, 34422 p: chunk || matchIndex === 1 ? chunk : ",", 34423 s: startNum, 34424 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 34425 m: color && color < 4 ? Math.round : 0 34426 }; 34427 index = _complexStringNumExp.lastIndex; 34428 } 34429 } 34430 pt.c = index < end.length ? end.substring(index, end.length) : ""; 34431 pt.fp = funcParam; 34432 if (_relExp.test(end) || hasRandom) { 34433 pt.e = 0; 34434 } 34435 this._pt = pt; 34436 return pt; 34437}; 34438var _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { 34439 _isFunction(end) && (end = end(index || 0, target, targets)); 34440 var currentValue = target[prop], parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, pt; 34441 if (_isString(end)) { 34442 if (~end.indexOf("random(")) { 34443 end = _replaceRandom(end); 34444 } 34445 if (end.charAt(1) === "=") { 34446 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 34447 if (pt || pt === 0) { 34448 end = pt; 34449 } 34450 } 34451 } 34452 if (!optional || parsedStart !== end || _forceAllPropTweens) { 34453 if (!isNaN(parsedStart * end) && end !== "") { 34454 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 34455 funcParam && (pt.fp = funcParam); 34456 modifier && pt.modifier(modifier, this, target); 34457 return this._pt = pt; 34458 } 34459 !currentValue && !(prop in target) && _missingPlugin(prop, end); 34460 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 34461 } 34462}; 34463var _processVars = function _processVars(vars, index, target, targets, tween) { 34464 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 34465 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { 34466 return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 34467 } 34468 var copy = {}, p; 34469 for (p in vars) { 34470 copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 34471 } 34472 return copy; 34473}; 34474var _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 34475 var plugin, pt, ptLookup, i; 34476 if (_plugins[property] && (plugin = new _plugins[property]).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 34477 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 34478 if (tween !== _quickTween) { 34479 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; 34480 i = plugin._props.length; 34481 while (i--) { 34482 ptLookup[plugin._props[i]] = pt; 34483 } 34484 } 34485 } 34486 return plugin; 34487}; 34488var _overwritingTween; 34489var _forceAllPropTweens; 34490var _initTween = function _initTween(tween, time, tTime) { 34491 var vars = tween.vars, { ease, startAt, immediateRender, lazy, onUpdate, runBackwards, yoyoEase, keyframes, autoRevert } = vars, { _dur: dur, _startAt: prevStartAt, _targets: targets, parent } = tween, fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, tl = tween.timeline, cleanVars, i, p, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index, harnessVars, overwritten; 34492 tl && (!keyframes || !ease) && (ease = "none"); 34493 tween._ease = _parseEase(ease, _defaults.ease); 34494 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 34495 if (yoyoEase && tween._yoyo && !tween._repeat) { 34496 yoyoEase = tween._yEase; 34497 tween._yEase = tween._ease; 34498 tween._ease = yoyoEase; 34499 } 34500 tween._from = !tl && !!vars.runBackwards; 34501 if (!tl || keyframes && !vars.stagger) { 34502 harness = targets[0] ? _getCache(targets[0]).harness : 0; 34503 harnessVars = harness && vars[harness.prop]; 34504 cleanVars = _copyExcluding(vars, _reservedProps); 34505 if (prevStartAt) { 34506 prevStartAt._zTime < 0 && prevStartAt.progress(1); 34507 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); 34508 prevStartAt._lazy = 0; 34509 } 34510 if (startAt) { 34511 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 34512 data: "isStart", 34513 overwrite: false, 34514 parent, 34515 immediateRender: true, 34516 lazy: !prevStartAt && _isNotFalse(lazy), 34517 startAt: null, 34518 delay: 0, 34519 onUpdate: onUpdate && function() { 34520 return _callback(tween, "onUpdate"); 34521 }, 34522 stagger: 0 34523 }, startAt))); 34524 tween._startAt._dp = 0; 34525 tween._startAt._sat = tween; 34526 time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); 34527 if (immediateRender) { 34528 if (dur && time <= 0 && tTime <= 0) { 34529 time && (tween._zTime = time); 34530 return; 34531 } 34532 } 34533 } else if (runBackwards && dur) { 34534 if (!prevStartAt) { 34535 time && (immediateRender = false); 34536 p = _setDefaults({ 34537 overwrite: false, 34538 data: "isFromStart", 34539 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 34540 immediateRender, 34541 stagger: 0, 34542 parent 34543 }, cleanVars); 34544 harnessVars && (p[harness.prop] = harnessVars); 34545 _removeFromParent(tween._startAt = Tween.set(targets, p)); 34546 tween._startAt._dp = 0; 34547 tween._startAt._sat = tween; 34548 time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 34549 tween._zTime = time; 34550 if (!immediateRender) { 34551 _initTween(tween._startAt, _tinyNum, _tinyNum); 34552 } else if (!time) { 34553 return; 34554 } 34555 } 34556 } 34557 tween._pt = tween._ptCache = 0; 34558 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 34559 for (i = 0;i < targets.length; i++) { 34560 target = targets[i]; 34561 gsData = target._gsap || _harness(targets)[i]._gsap; 34562 tween._ptLookup[i] = ptLookup = {}; 34563 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); 34564 index = fullTargets === targets ? i : fullTargets.indexOf(target); 34565 if (harness && (plugin = new harness).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 34566 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 34567 plugin._props.forEach(function(name) { 34568 ptLookup[name] = pt; 34569 }); 34570 plugin.priority && (hasPriority = 1); 34571 } 34572 if (!harness || harnessVars) { 34573 for (p in cleanVars) { 34574 if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) { 34575 plugin.priority && (hasPriority = 1); 34576 } else { 34577 ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 34578 } 34579 } 34580 } 34581 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 34582 if (autoOverwrite && tween._pt) { 34583 _overwritingTween = tween; 34584 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); 34585 overwritten = !tween.parent; 34586 _overwritingTween = 0; 34587 } 34588 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 34589 } 34590 hasPriority && _sortPropTweensByPriority(tween); 34591 tween._onInit && tween._onInit(tween); 34592 } 34593 tween._onUpdate = onUpdate; 34594 tween._initted = (!tween._op || tween._pt) && !overwritten; 34595 keyframes && time <= 0 && tl.render(_bigNum, true, true); 34596}; 34597var _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) { 34598 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, rootPT, lookup, i; 34599 if (!ptCache) { 34600 ptCache = tween._ptCache[property] = []; 34601 lookup = tween._ptLookup; 34602 i = tween._targets.length; 34603 while (i--) { 34604 pt = lookup[i][property]; 34605 if (pt && pt.d && pt.d._pt) { 34606 pt = pt.d._pt; 34607 while (pt && pt.p !== property && pt.fp !== property) { 34608 pt = pt._next; 34609 } 34610 } 34611 if (!pt) { 34612 _forceAllPropTweens = 1; 34613 tween.vars[property] = "+=0"; 34614 _initTween(tween, time); 34615 _forceAllPropTweens = 0; 34616 return skipRecursion ? _warn(property + " not eligible for reset") : 1; 34617 } 34618 ptCache.push(pt); 34619 } 34620 } 34621 i = ptCache.length; 34622 while (i--) { 34623 rootPT = ptCache[i]; 34624 pt = rootPT._pt || rootPT; 34625 pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; 34626 pt.c = value - pt.s; 34627 rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); 34628 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); 34629 } 34630}; 34631var _addAliasesToVars = function _addAliasesToVars(targets, vars) { 34632 var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p, i, aliases; 34633 if (!propertyAliases) { 34634 return vars; 34635 } 34636 copy = _merge({}, vars); 34637 for (p in propertyAliases) { 34638 if (p in copy) { 34639 aliases = propertyAliases[p].split(","); 34640 i = aliases.length; 34641 while (i--) { 34642 copy[aliases[i]] = copy[p]; 34643 } 34644 } 34645 } 34646 return copy; 34647}; 34648var _parseKeyframe = function _parseKeyframe(prop, obj2, allProps, easeEach) { 34649 var ease = obj2.ease || easeEach || "power1.inOut", p, a; 34650 if (_isArray(obj2)) { 34651 a = allProps[prop] || (allProps[prop] = []); 34652 obj2.forEach(function(value, i) { 34653 return a.push({ 34654 t: i / (obj2.length - 1) * 100, 34655 v: value, 34656 e: ease 34657 }); 34658 }); 34659 } else { 34660 for (p in obj2) { 34661 a = allProps[p] || (allProps[p] = []); 34662 p === "ease" || a.push({ 34663 t: parseFloat(prop), 34664 v: obj2[p], 34665 e: ease 34666 }); 34667 } 34668 } 34669}; 34670var _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 34671 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 34672}; 34673var _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert"; 34674var _staggerPropsToSkip = {}; 34675_forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) { 34676 return _staggerPropsToSkip[name] = 1; 34677}); 34678var Tween = /* @__PURE__ */ function(_Animation2) { 34679 _inheritsLoose(Tween, _Animation2); 34680 function Tween(targets, vars, position, skipInherit) { 34681 var _this3; 34682 if (typeof vars === "number") { 34683 position.duration = vars; 34684 vars = position; 34685 position = null; 34686 } 34687 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 34688 var _this3$vars = _this3.vars, { duration, delay, immediateRender, stagger, overwrite, keyframes, defaults, scrollTrigger, yoyoEase } = _this3$vars, parent = vars.parent || _globalTimeline, parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : ("length" in vars)) ? [targets] : toArray(targets), tl, i, copy, l, p, curTarget, staggerFunc, staggerVarsToMerge; 34689 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || []; 34690 _this3._ptLookup = []; 34691 _this3._overwrite = overwrite; 34692 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 34693 vars = _this3.vars; 34694 tl = _this3.timeline = new Timeline({ 34695 data: "nested", 34696 defaults: defaults || {}, 34697 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 34698 }); 34699 tl.kill(); 34700 tl.parent = tl._dp = _assertThisInitialized(_this3); 34701 tl._start = 0; 34702 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 34703 l = parsedTargets.length; 34704 staggerFunc = stagger && distribute(stagger); 34705 if (_isObject(stagger)) { 34706 for (p in stagger) { 34707 if (~_staggerTweenProps.indexOf(p)) { 34708 staggerVarsToMerge || (staggerVarsToMerge = {}); 34709 staggerVarsToMerge[p] = stagger[p]; 34710 } 34711 } 34712 } 34713 for (i = 0;i < l; i++) { 34714 copy = _copyExcluding(vars, _staggerPropsToSkip); 34715 copy.stagger = 0; 34716 yoyoEase && (copy.yoyoEase = yoyoEase); 34717 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 34718 curTarget = parsedTargets[i]; 34719 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 34720 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 34721 if (!stagger && l === 1 && copy.delay) { 34722 _this3._delay = delay = copy.delay; 34723 _this3._start += delay; 34724 copy.delay = 0; 34725 } 34726 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); 34727 tl._ease = _easeMap.none; 34728 } 34729 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; 34730 } else if (keyframes) { 34731 _inheritDefaults(_setDefaults(tl.vars.defaults, { 34732 ease: "none" 34733 })); 34734 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 34735 var time = 0, a, kf, v; 34736 if (_isArray(keyframes)) { 34737 keyframes.forEach(function(frame) { 34738 return tl.to(parsedTargets, frame, ">"); 34739 }); 34740 tl.duration(); 34741 } else { 34742 copy = {}; 34743 for (p in keyframes) { 34744 p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); 34745 } 34746 for (p in copy) { 34747 a = copy[p].sort(function(a, b) { 34748 return a.t - b.t; 34749 }); 34750 time = 0; 34751 for (i = 0;i < a.length; i++) { 34752 kf = a[i]; 34753 v = { 34754 ease: kf.e, 34755 duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration 34756 }; 34757 v[p] = kf.v; 34758 tl.to(parsedTargets, v, time); 34759 time += v.duration; 34760 } 34761 } 34762 tl.duration() < duration && tl.to({}, { 34763 duration: duration - tl.duration() 34764 }); 34765 } 34766 } 34767 duration || _this3.duration(duration = tl.duration()); 34768 } else { 34769 _this3.timeline = 0; 34770 } 34771 if (overwrite === true && !_suppressOverwrites) { 34772 _overwritingTween = _assertThisInitialized(_this3); 34773 _globalTimeline.killTweensOf(parsedTargets); 34774 _overwritingTween = 0; 34775 } 34776 _addToTimeline(parent, _assertThisInitialized(_this3), position); 34777 vars.reversed && _this3.reverse(); 34778 vars.paused && _this3.paused(true); 34779 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 34780 _this3._tTime = -_tinyNum; 34781 _this3.render(Math.max(0, -delay) || 0); 34782 } 34783 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 34784 return _this3; 34785 } 34786 var _proto3 = Tween.prototype; 34787 _proto3.render = function render(totalTime, suppressEvents, force) { 34788 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, timeline, yoyoEase; 34789 if (!dur) { 34790 _renderZeroDurationTween(this, totalTime, suppressEvents, force); 34791 } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative || this._lazy) { 34792 time = tTime; 34793 timeline = this.timeline; 34794 if (this._repeat) { 34795 cycleDuration = dur + this._rDelay; 34796 if (this._repeat < -1 && isNegative) { 34797 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 34798 } 34799 time = _roundPrecise(tTime % cycleDuration); 34800 if (tTime === tDur) { 34801 iteration = this._repeat; 34802 time = dur; 34803 } else { 34804 prevIteration = _roundPrecise(tTime / cycleDuration); 34805 iteration = ~~prevIteration; 34806 if (iteration && iteration === prevIteration) { 34807 time = dur; 34808 iteration--; 34809 } else if (time > dur) { 34810 time = dur; 34811 } 34812 } 34813 isYoyo = this._yoyo && iteration & 1; 34814 if (isYoyo) { 34815 yoyoEase = this._yEase; 34816 time = dur - time; 34817 } 34818 prevIteration = _animationCycle(this._tTime, cycleDuration); 34819 if (time === prevTime && !force && this._initted && iteration === prevIteration) { 34820 this._tTime = tTime; 34821 return this; 34822 } 34823 if (iteration !== prevIteration) { 34824 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); 34825 if (this.vars.repeatRefresh && !isYoyo && !this._lock && time !== cycleDuration && this._initted) { 34826 this._lock = force = 1; 34827 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 34828 } 34829 } 34830 } 34831 if (!this._initted) { 34832 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 34833 this._tTime = 0; 34834 return this; 34835 } 34836 if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) { 34837 return this; 34838 } 34839 if (dur !== this._dur) { 34840 return this.render(totalTime, suppressEvents, force); 34841 } 34842 } 34843 this._tTime = tTime; 34844 this._time = time; 34845 if (!this._act && this._ts) { 34846 this._act = 1; 34847 this._lazy = 0; 34848 } 34849 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 34850 if (this._from) { 34851 this.ratio = ratio = 1 - ratio; 34852 } 34853 if (!prevTime && tTime && !suppressEvents && !prevIteration) { 34854 _callback(this, "onStart"); 34855 if (this._tTime !== tTime) { 34856 return this; 34857 } 34858 } 34859 pt = this._pt; 34860 while (pt) { 34861 pt.r(ratio, pt.d); 34862 pt = pt._next; 34863 } 34864 timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 34865 if (this._onUpdate && !suppressEvents) { 34866 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); 34867 _callback(this, "onUpdate"); 34868 } 34869 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 34870 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 34871 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 34872 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 34873 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 34874 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 34875 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 34876 } 34877 } 34878 } 34879 return this; 34880 }; 34881 _proto3.targets = function targets() { 34882 return this._targets; 34883 }; 34884 _proto3.invalidate = function invalidate(soft) { 34885 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 34886 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 34887 this._ptLookup = []; 34888 this.timeline && this.timeline.invalidate(soft); 34889 return _Animation2.prototype.invalidate.call(this, soft); 34890 }; 34891 _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) { 34892 _tickerActive || _ticker.wake(); 34893 this._ts || this.play(); 34894 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio; 34895 this._initted || _initTween(this, time); 34896 ratio = this._ease(time / this._dur); 34897 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) { 34898 return this.resetTo(property, value, start, startIsRelative, 1); 34899 } 34900 _alignPlayhead(this, 0); 34901 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 34902 return this.render(0); 34903 }; 34904 _proto3.kill = function kill(targets, vars) { 34905 if (vars === undefined) { 34906 vars = "all"; 34907 } 34908 if (!targets && (!vars || vars === "all")) { 34909 this._lazy = this._pt = 0; 34910 this.parent ? _interrupt(this) : this.scrollTrigger && this.scrollTrigger.kill(!!_reverting); 34911 return this; 34912 } 34913 if (this.timeline) { 34914 var tDur = this.timeline.totalDuration(); 34915 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); 34916 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); 34917 return this; 34918 } 34919 var parsedTargets = this._targets, killingTargets = targets ? toArray(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p, pt, i; 34920 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 34921 vars === "all" && (this._pt = 0); 34922 return _interrupt(this); 34923 } 34924 overwrittenProps = this._op = this._op || []; 34925 if (vars !== "all") { 34926 if (_isString(vars)) { 34927 p = {}; 34928 _forEachName(vars, function(name) { 34929 return p[name] = 1; 34930 }); 34931 vars = p; 34932 } 34933 vars = _addAliasesToVars(parsedTargets, vars); 34934 } 34935 i = parsedTargets.length; 34936 while (i--) { 34937 if (~killingTargets.indexOf(parsedTargets[i])) { 34938 curLookup = propTweenLookup[i]; 34939 if (vars === "all") { 34940 overwrittenProps[i] = vars; 34941 props = curLookup; 34942 curOverwriteProps = {}; 34943 } else { 34944 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 34945 props = vars; 34946 } 34947 for (p in props) { 34948 pt = curLookup && curLookup[p]; 34949 if (pt) { 34950 if (!("kill" in pt.d) || pt.d.kill(p) === true) { 34951 _removeLinkedListItem(this, pt, "_pt"); 34952 } 34953 delete curLookup[p]; 34954 } 34955 if (curOverwriteProps !== "all") { 34956 curOverwriteProps[p] = 1; 34957 } 34958 } 34959 } 34960 } 34961 this._initted && !this._pt && firstPT && _interrupt(this); 34962 return this; 34963 }; 34964 Tween.to = function to(targets, vars) { 34965 return new Tween(targets, vars, arguments[2]); 34966 }; 34967 Tween.from = function from(targets, vars) { 34968 return _createTweenType(1, arguments); 34969 }; 34970 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 34971 return new Tween(callback, 0, { 34972 immediateRender: false, 34973 lazy: false, 34974 overwrite: false, 34975 delay, 34976 onComplete: callback, 34977 onReverseComplete: callback, 34978 onCompleteParams: params, 34979 onReverseCompleteParams: params, 34980 callbackScope: scope 34981 }); 34982 }; 34983 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 34984 return _createTweenType(2, arguments); 34985 }; 34986 Tween.set = function set(targets, vars) { 34987 vars.duration = 0; 34988 vars.repeatDelay || (vars.repeat = 0); 34989 return new Tween(targets, vars); 34990 }; 34991 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 34992 return _globalTimeline.killTweensOf(targets, props, onlyActive); 34993 }; 34994 return Tween; 34995}(Animation); 34996_setDefaults(Tween.prototype, { 34997 _targets: [], 34998 _lazy: 0, 34999 _startAt: 0, 35000 _op: 0, 35001 _onInit: 0 35002}); 35003_forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) { 35004 Tween[name] = function() { 35005 var tl = new Timeline, params = _slice.call(arguments, 0); 35006 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 35007 return tl[name].apply(tl, params); 35008 }; 35009}); 35010var _setterPlain = function _setterPlain(target, property, value) { 35011 return target[property] = value; 35012}; 35013var _setterFunc = function _setterFunc(target, property, value) { 35014 return target[property](value); 35015}; 35016var _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 35017 return target[property](data.fp, value); 35018}; 35019var _setterAttribute = function _setterAttribute(target, property, value) { 35020 return target.setAttribute(property, value); 35021}; 35022var _getSetter = function _getSetter(target, property) { 35023 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 35024}; 35025var _renderPlain = function _renderPlain(ratio, data) { 35026 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e6) / 1e6, data); 35027}; 35028var _renderBoolean = function _renderBoolean(ratio, data) { 35029 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 35030}; 35031var _renderComplexString = function _renderComplexString(ratio, data) { 35032 var pt = data._pt, s = ""; 35033 if (!ratio && data.b) { 35034 s = data.b; 35035 } else if (ratio === 1 && data.e) { 35036 s = data.e; 35037 } else { 35038 while (pt) { 35039 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 1e4) / 1e4) + s; 35040 pt = pt._next; 35041 } 35042 s += data.c; 35043 } 35044 data.set(data.t, data.p, s, data); 35045}; 35046var _renderPropTweens = function _renderPropTweens(ratio, data) { 35047 var pt = data._pt; 35048 while (pt) { 35049 pt.r(ratio, pt.d); 35050 pt = pt._next; 35051 } 35052}; 35053var _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 35054 var pt = this._pt, next; 35055 while (pt) { 35056 next = pt._next; 35057 pt.p === property && pt.modifier(modifier, tween, target); 35058 pt = next; 35059 } 35060}; 35061var _killPropTweensOf = function _killPropTweensOf(property) { 35062 var pt = this._pt, hasNonDependentRemaining, next; 35063 while (pt) { 35064 next = pt._next; 35065 if (pt.p === property && !pt.op || pt.op === property) { 35066 _removeLinkedListItem(this, pt, "_pt"); 35067 } else if (!pt.dep) { 35068 hasNonDependentRemaining = 1; 35069 } 35070 pt = next; 35071 } 35072 return !hasNonDependentRemaining; 35073}; 35074var _setterWithModifier = function _setterWithModifier(target, property, value, data) { 35075 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 35076}; 35077var _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 35078 var pt = parent._pt, next, pt2, first, last; 35079 while (pt) { 35080 next = pt._next; 35081 pt2 = first; 35082 while (pt2 && pt2.pr > pt.pr) { 35083 pt2 = pt2._next; 35084 } 35085 if (pt._prev = pt2 ? pt2._prev : last) { 35086 pt._prev._next = pt; 35087 } else { 35088 first = pt; 35089 } 35090 if (pt._next = pt2) { 35091 pt2._prev = pt; 35092 } else { 35093 last = pt; 35094 } 35095 pt = next; 35096 } 35097 parent._pt = first; 35098}; 35099var PropTween = /* @__PURE__ */ function() { 35100 function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 35101 this.t = target; 35102 this.s = start; 35103 this.c = change; 35104 this.p = prop; 35105 this.r = renderer || _renderPlain; 35106 this.d = data || this; 35107 this.set = setter || _setterPlain; 35108 this.pr = priority || 0; 35109 this._next = next; 35110 if (next) { 35111 next._prev = this; 35112 } 35113 } 35114 var _proto4 = PropTween.prototype; 35115 _proto4.modifier = function modifier(func, tween, target) { 35116 this.mSet = this.mSet || this.set; 35117 this.set = _setterWithModifier; 35118 this.m = func; 35119 this.mt = target; 35120 this.tween = tween; 35121 }; 35122 return PropTween; 35123}(); 35124_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) { 35125 return _reservedProps[name] = 1; 35126}); 35127_globals.TweenMax = _globals.TweenLite = Tween; 35128_globals.TimelineLite = _globals.TimelineMax = Timeline; 35129_globalTimeline = new Timeline({ 35130 sortChildren: false, 35131 defaults: _defaults, 35132 autoRemoveChildren: true, 35133 id: "root", 35134 smoothChildTiming: true 35135}); 35136_config.stringFilter = _colorStringFilter; 35137var _media = []; 35138var _listeners = {}; 35139var _emptyArray = []; 35140var _lastMediaTime = 0; 35141var _contextID = 0; 35142var _dispatch = function _dispatch(type) { 35143 return (_listeners[type] || _emptyArray).map(function(f) { 35144 return f(); 35145 }); 35146}; 35147var _onMediaChange = function _onMediaChange() { 35148 var time = Date.now(), matches = []; 35149 if (time - _lastMediaTime > 2) { 35150 _dispatch("matchMediaInit"); 35151 _media.forEach(function(c) { 35152 var { queries, conditions } = c, match, p, anyMatch, toggled; 35153 for (p in queries) { 35154 match = _win.matchMedia(queries[p]).matches; 35155 match && (anyMatch = 1); 35156 if (match !== conditions[p]) { 35157 conditions[p] = match; 35158 toggled = 1; 35159 } 35160 } 35161 if (toggled) { 35162 c.revert(); 35163 anyMatch && matches.push(c); 35164 } 35165 }); 35166 _dispatch("matchMediaRevert"); 35167 matches.forEach(function(c) { 35168 return c.onMatch(c, function(func) { 35169 return c.add(null, func); 35170 }); 35171 }); 35172 _lastMediaTime = time; 35173 _dispatch("matchMedia"); 35174 } 35175}; 35176var Context2 = /* @__PURE__ */ function() { 35177 function Context(func, scope) { 35178 this.selector = scope && selector(scope); 35179 this.data = []; 35180 this._r = []; 35181 this.isReverted = false; 35182 this.id = _contextID++; 35183 func && this.add(func); 35184 } 35185 var _proto5 = Context.prototype; 35186 _proto5.add = function add(name, func, scope) { 35187 if (_isFunction(name)) { 35188 scope = func; 35189 func = name; 35190 name = _isFunction; 35191 } 35192 var self2 = this, f = function f() { 35193 var prev = _context, prevSelector = self2.selector, result; 35194 prev && prev !== self2 && prev.data.push(self2); 35195 scope && (self2.selector = selector(scope)); 35196 _context = self2; 35197 result = func.apply(self2, arguments); 35198 _isFunction(result) && self2._r.push(result); 35199 _context = prev; 35200 self2.selector = prevSelector; 35201 self2.isReverted = false; 35202 return result; 35203 }; 35204 self2.last = f; 35205 return name === _isFunction ? f(self2, function(func) { 35206 return self2.add(null, func); 35207 }) : name ? self2[name] = f : f; 35208 }; 35209 _proto5.ignore = function ignore(func) { 35210 var prev = _context; 35211 _context = null; 35212 func(this); 35213 _context = prev; 35214 }; 35215 _proto5.getTweens = function getTweens() { 35216 var a = []; 35217 this.data.forEach(function(e) { 35218 return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); 35219 }); 35220 return a; 35221 }; 35222 _proto5.clear = function clear() { 35223 this._r.length = this.data.length = 0; 35224 }; 35225 _proto5.kill = function kill(revert, matchMedia) { 35226 var _this4 = this; 35227 if (revert) { 35228 (function() { 35229 var tweens = _this4.getTweens(), i = _this4.data.length, t; 35230 while (i--) { 35231 t = _this4.data[i]; 35232 if (t.data === "isFlip") { 35233 t.revert(); 35234 t.getChildren(true, true, false).forEach(function(tween) { 35235 return tweens.splice(tweens.indexOf(tween), 1); 35236 }); 35237 } 35238 } 35239 tweens.map(function(t) { 35240 return { 35241 g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity, 35242 t 35243 }; 35244 }).sort(function(a, b) { 35245 return b.g - a.g || -Infinity; 35246 }).forEach(function(o) { 35247 return o.t.revert(revert); 35248 }); 35249 i = _this4.data.length; 35250 while (i--) { 35251 t = _this4.data[i]; 35252 if (t instanceof Timeline) { 35253 if (t.data !== "nested") { 35254 t.scrollTrigger && t.scrollTrigger.revert(); 35255 t.kill(); 35256 } 35257 } else { 35258 !(t instanceof Tween) && t.revert && t.revert(revert); 35259 } 35260 } 35261 _this4._r.forEach(function(f) { 35262 return f(revert, _this4); 35263 }); 35264 _this4.isReverted = true; 35265 })(); 35266 } else { 35267 this.data.forEach(function(e) { 35268 return e.kill && e.kill(); 35269 }); 35270 } 35271 this.clear(); 35272 if (matchMedia) { 35273 var i = _media.length; 35274 while (i--) { 35275 _media[i].id === this.id && _media.splice(i, 1); 35276 } 35277 } 35278 }; 35279 _proto5.revert = function revert(config) { 35280 this.kill(config || {}); 35281 }; 35282 return Context; 35283}(); 35284var MatchMedia = /* @__PURE__ */ function() { 35285 function MatchMedia(scope) { 35286 this.contexts = []; 35287 this.scope = scope; 35288 _context && _context.data.push(this); 35289 } 35290 var _proto6 = MatchMedia.prototype; 35291 _proto6.add = function add(conditions, func, scope) { 35292 _isObject(conditions) || (conditions = { 35293 matches: conditions 35294 }); 35295 var context = new Context2(0, scope || this.scope), cond = context.conditions = {}, mq, p, active; 35296 _context && !context.selector && (context.selector = _context.selector); 35297 this.contexts.push(context); 35298 func = context.add("onMatch", func); 35299 context.queries = conditions; 35300 for (p in conditions) { 35301 if (p === "all") { 35302 active = 1; 35303 } else { 35304 mq = _win.matchMedia(conditions[p]); 35305 if (mq) { 35306 _media.indexOf(context) < 0 && _media.push(context); 35307 (cond[p] = mq.matches) && (active = 1); 35308 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 35309 } 35310 } 35311 } 35312 active && func(context, function(f) { 35313 return context.add(null, f); 35314 }); 35315 return this; 35316 }; 35317 _proto6.revert = function revert(config) { 35318 this.kill(config || {}); 35319 }; 35320 _proto6.kill = function kill(revert) { 35321 this.contexts.forEach(function(c) { 35322 return c.kill(revert, true); 35323 }); 35324 }; 35325 return MatchMedia; 35326}(); 35327var _gsap = { 35328 registerPlugin: function registerPlugin() { 35329 for (var _len2 = arguments.length, args2 = new Array(_len2), _key2 = 0;_key2 < _len2; _key2++) { 35330 args2[_key2] = arguments[_key2]; 35331 } 35332 args2.forEach(function(config) { 35333 return _createPlugin(config); 35334 }); 35335 }, 35336 timeline: function timeline(vars) { 35337 return new Timeline(vars); 35338 }, 35339 getTweensOf: function getTweensOf(targets, onlyActive) { 35340 return _globalTimeline.getTweensOf(targets, onlyActive); 35341 }, 35342 getProperty: function getProperty(target, property, unit, uncache) { 35343 _isString(target) && (target = toArray(target)[0]); 35344 var getter = _getCache(target || {}).get, format = unit ? _passThrough : _numericIfPossible; 35345 unit === "native" && (unit = ""); 35346 return !target ? target : !property ? function(property, unit, uncache) { 35347 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 35348 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 35349 }, 35350 quickSetter: function quickSetter(target, property, unit) { 35351 target = toArray(target); 35352 if (target.length > 1) { 35353 var setters = target.map(function(t) { 35354 return gsap.quickSetter(t, property, unit); 35355 }), l = setters.length; 35356 return function(value) { 35357 var i = l; 35358 while (i--) { 35359 setters[i](value); 35360 } 35361 }; 35362 } 35363 target = target[0] || {}; 35364 var Plugin = _plugins[property], cache = _getCache(target), p = cache.harness && (cache.harness.aliases || {})[property] || property, setter = Plugin ? function(value) { 35365 var p = new Plugin; 35366 _quickTween._pt = 0; 35367 p.init(target, unit ? value + unit : value, _quickTween, 0, [target]); 35368 p.render(1, p); 35369 _quickTween._pt && _renderPropTweens(1, _quickTween); 35370 } : cache.set(target, p); 35371 return Plugin ? setter : function(value) { 35372 return setter(target, p, unit ? value + unit : value, cache, 1); 35373 }; 35374 }, 35375 quickTo: function quickTo(target, property, vars) { 35376 var _setDefaults2; 35377 var tween = gsap.to(target, _setDefaults((_setDefaults2 = {}, _setDefaults2[property] = "+=0.1", _setDefaults2.paused = true, _setDefaults2.stagger = 0, _setDefaults2), vars || {})), func = function func(value, start, startIsRelative) { 35378 return tween.resetTo(property, value, start, startIsRelative); 35379 }; 35380 func.tween = tween; 35381 return func; 35382 }, 35383 isTweening: function isTweening(targets) { 35384 return _globalTimeline.getTweensOf(targets, true).length > 0; 35385 }, 35386 defaults: function defaults(value) { 35387 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 35388 return _mergeDeep(_defaults, value || {}); 35389 }, 35390 config: function config(value) { 35391 return _mergeDeep(_config, value || {}); 35392 }, 35393 registerEffect: function registerEffect(_ref3) { 35394 var { name, effect, plugins, defaults, extendTimeline } = _ref3; 35395 (plugins || "").split(",").forEach(function(pluginName) { 35396 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 35397 }); 35398 _effects[name] = function(targets, vars, tl) { 35399 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 35400 }; 35401 if (extendTimeline) { 35402 Timeline.prototype[name] = function(targets, vars, position) { 35403 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 35404 }; 35405 } 35406 }, 35407 registerEase: function registerEase(name, ease) { 35408 _easeMap[name] = _parseEase(ease); 35409 }, 35410 parseEase: function parseEase(ease, defaultEase) { 35411 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 35412 }, 35413 getById: function getById(id) { 35414 return _globalTimeline.getById(id); 35415 }, 35416 exportRoot: function exportRoot(vars, includeDelayedCalls) { 35417 if (vars === undefined) { 35418 vars = {}; 35419 } 35420 var tl = new Timeline(vars), child, next; 35421 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 35422 _globalTimeline.remove(tl); 35423 tl._dp = 0; 35424 tl._time = tl._tTime = _globalTimeline._time; 35425 child = _globalTimeline._first; 35426 while (child) { 35427 next = child._next; 35428 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) { 35429 _addToTimeline(tl, child, child._start - child._delay); 35430 } 35431 child = next; 35432 } 35433 _addToTimeline(_globalTimeline, tl, 0); 35434 return tl; 35435 }, 35436 context: function context(func, scope) { 35437 return func ? new Context2(func, scope) : _context; 35438 }, 35439 matchMedia: function matchMedia(scope) { 35440 return new MatchMedia(scope); 35441 }, 35442 matchMediaRefresh: function matchMediaRefresh() { 35443 return _media.forEach(function(c) { 35444 var cond = c.conditions, found, p; 35445 for (p in cond) { 35446 if (cond[p]) { 35447 cond[p] = false; 35448 found = 1; 35449 } 35450 } 35451 found && c.revert(); 35452 }) || _onMediaChange(); 35453 }, 35454 addEventListener: function addEventListener2(type, callback) { 35455 var a = _listeners[type] || (_listeners[type] = []); 35456 ~a.indexOf(callback) || a.push(callback); 35457 }, 35458 removeEventListener: function removeEventListener2(type, callback) { 35459 var a = _listeners[type], i = a && a.indexOf(callback); 35460 i >= 0 && a.splice(i, 1); 35461 }, 35462 utils: { 35463 wrap, 35464 wrapYoyo, 35465 distribute, 35466 random, 35467 snap, 35468 normalize, 35469 getUnit, 35470 clamp, 35471 splitColor, 35472 toArray, 35473 selector, 35474 mapRange, 35475 pipe, 35476 unitize, 35477 interpolate: interpolate2, 35478 shuffle 35479 }, 35480 install: _install, 35481 effects: _effects, 35482 ticker: _ticker, 35483 updateRoot: Timeline.updateRoot, 35484 plugins: _plugins, 35485 globalTimeline: _globalTimeline, 35486 core: { 35487 PropTween, 35488 globals: _addGlobal, 35489 Tween, 35490 Timeline, 35491 Animation, 35492 getCache: _getCache, 35493 _removeLinkedListItem, 35494 reverting: function reverting() { 35495 return _reverting; 35496 }, 35497 context: function context(toAdd) { 35498 if (toAdd && _context) { 35499 _context.data.push(toAdd); 35500 toAdd._ctx = _context; 35501 } 35502 return _context; 35503 }, 35504 suppressOverwrites: function suppressOverwrites(value) { 35505 return _suppressOverwrites = value; 35506 } 35507 } 35508}; 35509_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) { 35510 return _gsap[name] = Tween[name]; 35511}); 35512_ticker.add(Timeline.updateRoot); 35513_quickTween = _gsap.to({}, { 35514 duration: 0 35515}); 35516var _getPluginPropTween = function _getPluginPropTween(plugin, prop) { 35517 var pt = plugin._pt; 35518 while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { 35519 pt = pt._next; 35520 } 35521 return pt; 35522}; 35523var _addModifiers = function _addModifiers(tween, modifiers) { 35524 var targets = tween._targets, p, i, pt; 35525 for (p in modifiers) { 35526 i = targets.length; 35527 while (i--) { 35528 pt = tween._ptLookup[i][p]; 35529 if (pt && (pt = pt.d)) { 35530 if (pt._pt) { 35531 pt = _getPluginPropTween(pt, p); 35532 } 35533 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 35534 } 35535 } 35536 } 35537}; 35538var _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 35539 return { 35540 name, 35541 headless: 1, 35542 rawVars: 1, 35543 init: function init(target, vars, tween) { 35544 tween._onInit = function(tween) { 35545 var temp, p; 35546 if (_isString(vars)) { 35547 temp = {}; 35548 _forEachName(vars, function(name) { 35549 return temp[name] = 1; 35550 }); 35551 vars = temp; 35552 } 35553 if (modifier) { 35554 temp = {}; 35555 for (p in vars) { 35556 temp[p] = modifier(vars[p]); 35557 } 35558 vars = temp; 35559 } 35560 _addModifiers(tween, vars); 35561 }; 35562 } 35563 }; 35564}; 35565var gsap = _gsap.registerPlugin({ 35566 name: "attr", 35567 init: function init(target, vars, tween, index, targets) { 35568 var p, pt, v; 35569 this.tween = tween; 35570 for (p in vars) { 35571 v = target.getAttribute(p) || ""; 35572 pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); 35573 pt.op = p; 35574 pt.b = v; 35575 this._props.push(p); 35576 } 35577 }, 35578 render: function render(ratio, data) { 35579 var pt = data._pt; 35580 while (pt) { 35581 _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); 35582 pt = pt._next; 35583 } 35584 } 35585}, { 35586 name: "endArray", 35587 headless: 1, 35588 init: function init(target, value) { 35589 var i = value.length; 35590 while (i--) { 35591 this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); 35592 } 35593 } 35594}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; 35595Tween.version = Timeline.version = gsap.version = "3.14.2"; 35596_coreReady = 1; 35597_windowExists() && _wake(); 35598var Power0 = _easeMap.Power0; 35599var Power1 = _easeMap.Power1; 35600var Power2 = _easeMap.Power2; 35601var Power3 = _easeMap.Power3; 35602var Power4 = _easeMap.Power4; 35603var Linear = _easeMap.Linear; 35604var Quad = _easeMap.Quad; 35605var Cubic = _easeMap.Cubic; 35606var Quart = _easeMap.Quart; 35607var Quint = _easeMap.Quint; 35608var Strong = _easeMap.Strong; 35609var Elastic = _easeMap.Elastic; 35610var Back = _easeMap.Back; 35611var SteppedEase = _easeMap.SteppedEase; 35612var Bounce = _easeMap.Bounce; 35613var Sine = _easeMap.Sine; 35614var Expo = _easeMap.Expo; 35615var Circ = _easeMap.Circ; 35616
vendor: 45,645 bytes, lines 35617-36675
35617// node_modules/gsap/CSSPlugin.js 35618/*! 35619 * CSSPlugin 3.14.2 35620 * https://gsap.com 35621 * 35622 * Copyright 2008-2025, GreenSock. All rights reserved. 35623 * Subject to the terms at https://gsap.com/standard-license 35624 * @author: Jack Doyle, [email protected] 35625*/ 35626var _win2; 35627var _doc2; 35628var _docElement; 35629var _pluginInitted; 35630var _tempDiv; 35631var _tempDivStyler; 35632var _recentSetterPlugin; 35633var _reverting2; 35634var _windowExists2 = function _windowExists() { 35635 return typeof window !== "undefined"; 35636}; 35637var _transformProps = {}; 35638var _RAD2DEG = 180 / Math.PI; 35639var _DEG2RAD = Math.PI / 180; 35640var _atan2 = Math.atan2; 35641var _bigNum2 = 1e8; 35642var _capsExp = /([A-Z])/g; 35643var _horizontalExp = /(left|right|width|margin|padding|x)/i; 35644var _complexExp = /[\s,\(]\S/; 35645var _propertyAliases = { 35646 autoAlpha: "opacity,visibility", 35647 scale: "scaleX,scaleY", 35648 alpha: "opacity" 35649}; 35650var _renderCSSProp = function _renderCSSProp(ratio, data) { 35651 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data); 35652}; 35653var _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 35654 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data); 35655}; 35656var _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 35657 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u : data.b, data); 35658}; 35659var _renderCSSPropWithBeginningAndEnd = function _renderCSSPropWithBeginningAndEnd(ratio, data) { 35660 return data.set(data.t, data.p, ratio === 1 ? data.e : ratio ? Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u : data.b, data); 35661}; 35662var _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 35663 var value = data.s + data.c * ratio; 35664 data.set(data.t, data.p, ~~(value + (value < 0 ? -0.5 : 0.5)) + data.u, data); 35665}; 35666var _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 35667 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 35668}; 35669var _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 35670 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 35671}; 35672var _setterCSSStyle = function _setterCSSStyle(target, property, value) { 35673 return target.style[property] = value; 35674}; 35675var _setterCSSProp = function _setterCSSProp(target, property, value) { 35676 return target.style.setProperty(property, value); 35677}; 35678var _setterTransform = function _setterTransform(target, property, value) { 35679 return target._gsap[property] = value; 35680}; 35681var _setterScale = function _setterScale(target, property, value) { 35682 return target._gsap.scaleX = target._gsap.scaleY = value; 35683}; 35684var _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 35685 var cache = target._gsap; 35686 cache.scaleX = cache.scaleY = value; 35687 cache.renderTransform(ratio, cache); 35688}; 35689var _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 35690 var cache = target._gsap; 35691 cache[property] = value; 35692 cache.renderTransform(ratio, cache); 35693}; 35694var _transformProp = "transform"; 35695var _transformOriginProp = _transformProp + "Origin"; 35696var _saveStyle = function _saveStyle(property, isNotCSS) { 35697 var _this = this; 35698 var target = this.target, { style, _gsap: cache } = target; 35699 if (property in _transformProps && style) { 35700 this.tfm = this.tfm || {}; 35701 if (property !== "transform") { 35702 property = _propertyAliases[property] || property; 35703 ~property.indexOf(",") ? property.split(",").forEach(function(a) { 35704 return _this.tfm[a] = _get(target, a); 35705 }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property); 35706 property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin); 35707 } else { 35708 return _propertyAliases.transform.split(",").forEach(function(p) { 35709 return _saveStyle.call(_this, p, isNotCSS); 35710 }); 35711 } 35712 if (this.props.indexOf(_transformProp) >= 0) { 35713 return; 35714 } 35715 if (cache.svg) { 35716 this.svgo = target.getAttribute("data-svg-origin"); 35717 this.props.push(_transformOriginProp, isNotCSS, ""); 35718 } 35719 property = _transformProp; 35720 } 35721 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 35722}; 35723var _removeIndependentTransforms = function _removeIndependentTransforms(style) { 35724 if (style.translate) { 35725 style.removeProperty("translate"); 35726 style.removeProperty("scale"); 35727 style.removeProperty("rotate"); 35728 } 35729}; 35730var _revertStyle = function _revertStyle() { 35731 var props = this.props, target = this.target, { style, _gsap: cache } = target, i, p; 35732 for (i = 0;i < props.length; i += 3) { 35733 if (!props[i + 1]) { 35734 props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase()); 35735 } else if (props[i + 1] === 2) { 35736 target[props[i]](props[i + 2]); 35737 } else { 35738 target[props[i]] = props[i + 2]; 35739 } 35740 } 35741 if (this.tfm) { 35742 for (p in this.tfm) { 35743 cache[p] = this.tfm[p]; 35744 } 35745 if (cache.svg) { 35746 cache.renderTransform(); 35747 target.setAttribute("data-svg-origin", this.svgo || ""); 35748 } 35749 i = _reverting2(); 35750 if ((!i || !i.isStart) && !style[_transformProp]) { 35751 _removeIndependentTransforms(style); 35752 if (cache.zOrigin && style[_transformOriginProp]) { 35753 style[_transformOriginProp] += " " + cache.zOrigin + "px"; 35754 cache.zOrigin = 0; 35755 cache.renderTransform(); 35756 } 35757 cache.uncache = 1; 35758 } 35759 } 35760}; 35761var _getStyleSaver = function _getStyleSaver(target, properties) { 35762 var saver = { 35763 target, 35764 props: [], 35765 revert: _revertStyle, 35766 save: _saveStyle 35767 }; 35768 target._gsap || gsap.core.getCache(target); 35769 properties && target.style && target.nodeType && properties.split(",").forEach(function(p) { 35770 return saver.save(p); 35771 }); 35772 return saver; 35773}; 35774var _supports3D; 35775var _createElement = function _createElement(type, ns) { 35776 var e = _doc2.createElementNS ? _doc2.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc2.createElement(type); 35777 return e && e.style ? e : _doc2.createElement(type); 35778}; 35779var _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 35780 var cs = getComputedStyle(target); 35781 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; 35782}; 35783var _prefixes = "O,Moz,ms,Ms,Webkit".split(","); 35784var _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 35785 var e = element || _tempDiv, s = e.style, i = 5; 35786 if (property in s && !preferPrefix) { 35787 return property; 35788 } 35789 property = property.charAt(0).toUpperCase() + property.substr(1); 35790 while (i-- && !(_prefixes[i] + property in s)) {} 35791 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 35792}; 35793var _initCore = function _initCore() { 35794 if (_windowExists2() && window.document) { 35795 _win2 = window; 35796 _doc2 = _win2.document; 35797 _docElement = _doc2.documentElement; 35798 _tempDiv = _createElement("div") || { 35799 style: {} 35800 }; 35801 _tempDivStyler = _createElement("div"); 35802 _transformProp = _checkPropPrefix(_transformProp); 35803 _transformOriginProp = _transformProp + "Origin"; 35804 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; 35805 _supports3D = !!_checkPropPrefix("perspective"); 35806 _reverting2 = gsap.core.reverting; 35807 _pluginInitted = 1; 35808 } 35809}; 35810var _getReparentedCloneBBox = function _getReparentedCloneBBox(target) { 35811 var owner = target.ownerSVGElement, svg = _createElement("svg", owner && owner.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), clone2 = target.cloneNode(true), bbox; 35812 clone2.style.display = "block"; 35813 svg.appendChild(clone2); 35814 _docElement.appendChild(svg); 35815 try { 35816 bbox = clone2.getBBox(); 35817 } catch (e) {} 35818 svg.removeChild(clone2); 35819 _docElement.removeChild(svg); 35820 return bbox; 35821}; 35822var _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 35823 var i = attributesArray.length; 35824 while (i--) { 35825 if (target.hasAttribute(attributesArray[i])) { 35826 return target.getAttribute(attributesArray[i]); 35827 } 35828 } 35829}; 35830var _getBBox = function _getBBox(target) { 35831 var bounds, cloned; 35832 try { 35833 bounds = target.getBBox(); 35834 } catch (error) { 35835 bounds = _getReparentedCloneBBox(target); 35836 cloned = 1; 35837 } 35838 bounds && (bounds.width || bounds.height) || cloned || (bounds = _getReparentedCloneBBox(target)); 35839 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 35840 x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, 35841 y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, 35842 width: 0, 35843 height: 0 35844 } : bounds; 35845}; 35846var _isSVG = function _isSVG(e) { 35847 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 35848}; 35849var _removeProperty = function _removeProperty(target, property) { 35850 if (property) { 35851 var style = target.style, first2Chars; 35852 if (property in _transformProps && property !== _transformOriginProp) { 35853 property = _transformProp; 35854 } 35855 if (style.removeProperty) { 35856 first2Chars = property.substr(0, 2); 35857 if (first2Chars === "ms" || property.substr(0, 6) === "webkit") { 35858 property = "-" + property; 35859 } 35860 style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase()); 35861 } else { 35862 style.removeAttribute(property); 35863 } 35864 } 35865}; 35866var _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 35867 var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 35868 plugin._pt = pt; 35869 pt.b = beginning; 35870 pt.e = end; 35871 plugin._props.push(property); 35872 return pt; 35873}; 35874var _nonConvertibleUnits = { 35875 deg: 1, 35876 rad: 1, 35877 turn: 1 35878}; 35879var _nonStandardLayouts = { 35880 grid: 1, 35881 flex: 1 35882}; 35883var _convertToUnit = function _convertToUnit(target, property, value, unit) { 35884 var curValue = parseFloat(value) || 0, curUnit = (value + "").trim().substr((curValue + "").length) || "px", style = _tempDiv.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, cache, isSVG; 35885 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { 35886 return curValue; 35887 } 35888 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 35889 isSVG = target.getCTM && _isSVG(target); 35890 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 35891 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 35892 return _round(toPercent ? curValue / px * amount : curValue / 100 * px); 35893 } 35894 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 35895 parent = unit !== "rem" && ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 35896 if (isSVG) { 35897 parent = (target.ownerSVGElement || {}).parentNode; 35898 } 35899 if (!parent || parent === _doc2 || !parent.appendChild) { 35900 parent = _doc2.body; 35901 } 35902 cache = parent._gsap; 35903 if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) { 35904 return _round(curValue / cache.width * amount); 35905 } else { 35906 if (toPercent && (property === "height" || property === "width")) { 35907 var v = target.style[property]; 35908 target.style[property] = amount + unit; 35909 px = target[measureProperty]; 35910 v ? target.style[property] = v : _removeProperty(target, property); 35911 } else { 35912 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 35913 parent === target && (style.position = "static"); 35914 parent.appendChild(_tempDiv); 35915 px = _tempDiv[measureProperty]; 35916 parent.removeChild(_tempDiv); 35917 style.position = "absolute"; 35918 } 35919 if (horizontal && toPercent) { 35920 cache = _getCache(parent); 35921 cache.time = _ticker.time; 35922 cache.width = parent[measureProperty]; 35923 } 35924 } 35925 return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 35926}; 35927var _get = function _get(target, property, unit, uncache) { 35928 var value; 35929 _pluginInitted || _initCore(); 35930 if (property in _propertyAliases && property !== "transform") { 35931 property = _propertyAliases[property]; 35932 if (~property.indexOf(",")) { 35933 property = property.split(",")[0]; 35934 } 35935 } 35936 if (_transformProps[property] && property !== "transform") { 35937 value = _parseTransform(target, uncache); 35938 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 35939 } else { 35940 value = target.style[property]; 35941 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { 35942 value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); 35943 } 35944 } 35945 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 35946}; 35947var _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 35948 if (!start || start === "none") { 35949 var p = _checkPropPrefix(prop, target, 1), s = p && _getComputedProperty(target, p, 1); 35950 if (s && s !== start) { 35951 prop = p; 35952 start = s; 35953 } else if (prop === "borderColor") { 35954 start = _getComputedProperty(target, "borderTopColor"); 35955 } 35956 } 35957 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), index = 0, matchIndex = 0, a, result, startValues, startNum, color, startValue, endValue, endNum, chunk, endUnit, startUnit, endValues; 35958 pt.b = start; 35959 pt.e = end; 35960 start += ""; 35961 end += ""; 35962 if (end.substring(0, 6) === "var(--") { 35963 end = _getComputedProperty(target, end.substring(4, end.indexOf(")"))); 35964 } 35965 if (end === "auto") { 35966 startValue = target.style[prop]; 35967 target.style[prop] = end; 35968 end = _getComputedProperty(target, prop) || end; 35969 startValue ? target.style[prop] = startValue : _removeProperty(target, prop); 35970 } 35971 a = [start, end]; 35972 _colorStringFilter(a); 35973 start = a[0]; 35974 end = a[1]; 35975 startValues = start.match(_numWithUnitExp) || []; 35976 endValues = end.match(_numWithUnitExp) || []; 35977 if (endValues.length) { 35978 while (result = _numWithUnitExp.exec(end)) { 35979 endValue = result[0]; 35980 chunk = end.substring(index, result.index); 35981 if (color) { 35982 color = (color + 1) % 5; 35983 } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") { 35984 color = 1; 35985 } 35986 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 35987 startNum = parseFloat(startValue) || 0; 35988 startUnit = startValue.substr((startNum + "").length); 35989 endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit); 35990 endNum = parseFloat(endValue); 35991 endUnit = endValue.substr((endNum + "").length); 35992 index = _numWithUnitExp.lastIndex - endUnit.length; 35993 if (!endUnit) { 35994 endUnit = endUnit || _config.units[prop] || startUnit; 35995 if (index === end.length) { 35996 end += endUnit; 35997 pt.e += endUnit; 35998 } 35999 } 36000 if (startUnit !== endUnit) { 36001 startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 36002 } 36003 pt._pt = { 36004 _next: pt._pt, 36005 p: chunk || matchIndex === 1 ? chunk : ",", 36006 s: startNum, 36007 c: endNum - startNum, 36008 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 36009 }; 36010 } 36011 } 36012 pt.c = index < end.length ? end.substring(index, end.length) : ""; 36013 } else { 36014 pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 36015 } 36016 _relExp.test(end) && (pt.e = 0); 36017 this._pt = pt; 36018 return pt; 36019}; 36020var _keywordToPercent = { 36021 top: "0%", 36022 bottom: "100%", 36023 left: "0%", 36024 right: "100%", 36025 center: "50%" 36026}; 36027var _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 36028 var split = value.split(" "), x = split[0], y = split[1] || "50%"; 36029 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 36030 value = x; 36031 x = y; 36032 y = value; 36033 } 36034 split[0] = _keywordToPercent[x] || x; 36035 split[1] = _keywordToPercent[y] || y; 36036 return split.join(" "); 36037}; 36038var _renderClearProps = function _renderClearProps(ratio, data) { 36039 if (data.tween && data.tween._time === data.tween._dur) { 36040 var target = data.t, style = target.style, props = data.u, cache = target._gsap, prop, clearTransforms, i; 36041 if (props === "all" || props === true) { 36042 style.cssText = ""; 36043 clearTransforms = 1; 36044 } else { 36045 props = props.split(","); 36046 i = props.length; 36047 while (--i > -1) { 36048 prop = props[i]; 36049 if (_transformProps[prop]) { 36050 clearTransforms = 1; 36051 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 36052 } 36053 _removeProperty(target, prop); 36054 } 36055 } 36056 if (clearTransforms) { 36057 _removeProperty(target, _transformProp); 36058 if (cache) { 36059 cache.svg && target.removeAttribute("transform"); 36060 style.scale = style.rotate = style.translate = "none"; 36061 _parseTransform(target, 1); 36062 cache.uncache = 1; 36063 _removeIndependentTransforms(style); 36064 } 36065 } 36066 } 36067}; 36068var _specialProps = { 36069 clearProps: function clearProps(plugin, target, property, endValue, tween) { 36070 if (tween.data !== "isFromStart") { 36071 var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); 36072 pt.u = endValue; 36073 pt.pr = -10; 36074 pt.tween = tween; 36075 plugin._props.push(property); 36076 return 1; 36077 } 36078 } 36079}; 36080var _identity2DMatrix = [1, 0, 0, 1, 0, 0]; 36081var _rotationalProperties = {}; 36082var _isNullTransform = function _isNullTransform(value) { 36083 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 36084}; 36085var _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 36086 var matrixString = _getComputedProperty(target, _transformProp); 36087 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round); 36088}; 36089var _getMatrix = function _getMatrix(target, force2D) { 36090 var cache = target._gsap || _getCache(target), style = target.style, matrix = _getComputedTransformMatrixAsArray(target), parent, nextSibling, temp, addedToDOM; 36091 if (cache.svg && target.getAttribute("transform")) { 36092 temp = target.transform.baseVal.consolidate().matrix; 36093 matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; 36094 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 36095 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 36096 temp = style.display; 36097 style.display = "block"; 36098 parent = target.parentNode; 36099 if (!parent || !target.offsetParent && !target.getBoundingClientRect().width) { 36100 addedToDOM = 1; 36101 nextSibling = target.nextElementSibling; 36102 _docElement.appendChild(target); 36103 } 36104 matrix = _getComputedTransformMatrixAsArray(target); 36105 temp ? style.display = temp : _removeProperty(target, "display"); 36106 if (addedToDOM) { 36107 nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 36108 } 36109 } 36110 return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; 36111}; 36112var _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 36113 var cache = target._gsap, matrix = matrixArray || _getMatrix(target, true), xOriginOld = cache.xOrigin || 0, yOriginOld = cache.yOrigin || 0, xOffsetOld = cache.xOffset || 0, yOffsetOld = cache.yOffset || 0, a = matrix[0], b = matrix[1], c = matrix[2], d = matrix[3], tx = matrix[4], ty = matrix[5], originSplit = origin.split(" "), xOrigin = parseFloat(originSplit[0]) || 0, yOrigin = parseFloat(originSplit[1]) || 0, bounds, determinant, x, y; 36114 if (!originIsAbsolute) { 36115 bounds = _getBBox(target); 36116 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); 36117 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); 36118 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 36119 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 36120 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 36121 xOrigin = x; 36122 yOrigin = y; 36123 } 36124 if (smooth || smooth !== false && cache.smooth) { 36125 tx = xOrigin - xOriginOld; 36126 ty = yOrigin - yOriginOld; 36127 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 36128 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 36129 } else { 36130 cache.xOffset = cache.yOffset = 0; 36131 } 36132 cache.xOrigin = xOrigin; 36133 cache.yOrigin = yOrigin; 36134 cache.smooth = !!smooth; 36135 cache.origin = origin; 36136 cache.originIsAbsolute = !!originIsAbsolute; 36137 target.style[_transformOriginProp] = "0px 0px"; 36138 if (pluginToAddPropTweensTo) { 36139 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 36140 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 36141 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 36142 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 36143 } 36144 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 36145}; 36146var _parseTransform = function _parseTransform(target, uncache) { 36147 var cache = target._gsap || new GSCache(target); 36148 if ("x" in cache && !uncache && !cache.uncache) { 36149 return cache; 36150 } 36151 var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp) || "0", x, y, z, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos, sin, a, b, c, d, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32; 36152 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 36153 scaleX = scaleY = 1; 36154 cache.svg = !!(target.getCTM && _isSVG(target)); 36155 if (cs.translate) { 36156 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") { 36157 style[_transformProp] = (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] !== "none" ? cs[_transformProp] : ""); 36158 } 36159 style.scale = style.rotate = style.translate = "none"; 36160 } 36161 matrix = _getMatrix(target, cache.svg); 36162 if (cache.svg) { 36163 if (cache.uncache) { 36164 t2 = target.getBBox(); 36165 origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; 36166 t1 = ""; 36167 } else { 36168 t1 = !uncache && target.getAttribute("data-svg-origin"); 36169 } 36170 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 36171 } 36172 xOrigin = cache.xOrigin || 0; 36173 yOrigin = cache.yOrigin || 0; 36174 if (matrix !== _identity2DMatrix) { 36175 a = matrix[0]; 36176 b = matrix[1]; 36177 c = matrix[2]; 36178 d = matrix[3]; 36179 x = a12 = matrix[4]; 36180 y = a22 = matrix[5]; 36181 if (matrix.length === 6) { 36182 scaleX = Math.sqrt(a * a + b * b); 36183 scaleY = Math.sqrt(d * d + c * c); 36184 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; 36185 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 36186 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 36187 if (cache.svg) { 36188 x -= xOrigin - (xOrigin * a + yOrigin * c); 36189 y -= yOrigin - (xOrigin * b + yOrigin * d); 36190 } 36191 } else { 36192 a32 = matrix[6]; 36193 a42 = matrix[7]; 36194 a13 = matrix[8]; 36195 a23 = matrix[9]; 36196 a33 = matrix[10]; 36197 a43 = matrix[11]; 36198 x = matrix[12]; 36199 y = matrix[13]; 36200 z = matrix[14]; 36201 angle = _atan2(a32, a33); 36202 rotationX = angle * _RAD2DEG; 36203 if (angle) { 36204 cos = Math.cos(-angle); 36205 sin = Math.sin(-angle); 36206 t1 = a12 * cos + a13 * sin; 36207 t2 = a22 * cos + a23 * sin; 36208 t3 = a32 * cos + a33 * sin; 36209 a13 = a12 * -sin + a13 * cos; 36210 a23 = a22 * -sin + a23 * cos; 36211 a33 = a32 * -sin + a33 * cos; 36212 a43 = a42 * -sin + a43 * cos; 36213 a12 = t1; 36214 a22 = t2; 36215 a32 = t3; 36216 } 36217 angle = _atan2(-c, a33); 36218 rotationY = angle * _RAD2DEG; 36219 if (angle) { 36220 cos = Math.cos(-angle); 36221 sin = Math.sin(-angle); 36222 t1 = a * cos - a13 * sin; 36223 t2 = b * cos - a23 * sin; 36224 t3 = c * cos - a33 * sin; 36225 a43 = d * sin + a43 * cos; 36226 a = t1; 36227 b = t2; 36228 c = t3; 36229 } 36230 angle = _atan2(b, a); 36231 rotation = angle * _RAD2DEG; 36232 if (angle) { 36233 cos = Math.cos(angle); 36234 sin = Math.sin(angle); 36235 t1 = a * cos + b * sin; 36236 t2 = a12 * cos + a22 * sin; 36237 b = b * cos - a * sin; 36238 a22 = a22 * cos - a12 * sin; 36239 a = t1; 36240 a12 = t2; 36241 } 36242 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 36243 rotationX = rotation = 0; 36244 rotationY = 180 - rotationY; 36245 } 36246 scaleX = _round(Math.sqrt(a * a + b * b + c * c)); 36247 scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32)); 36248 angle = _atan2(a12, a22); 36249 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 36250 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 36251 } 36252 if (cache.svg) { 36253 t1 = target.getAttribute("transform"); 36254 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 36255 t1 && target.setAttribute("transform", t1); 36256 } 36257 } 36258 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 36259 if (invertedScaleX) { 36260 scaleX *= -1; 36261 skewX += rotation <= 0 ? 180 : -180; 36262 rotation += rotation <= 0 ? 180 : -180; 36263 } else { 36264 scaleY *= -1; 36265 skewX += skewX <= 0 ? 180 : -180; 36266 } 36267 } 36268 uncache = uncache || cache.uncache; 36269 cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; 36270 cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; 36271 cache.z = z + px; 36272 cache.scaleX = _round(scaleX); 36273 cache.scaleY = _round(scaleY); 36274 cache.rotation = _round(rotation) + deg; 36275 cache.rotationX = _round(rotationX) + deg; 36276 cache.rotationY = _round(rotationY) + deg; 36277 cache.skewX = skewX + deg; 36278 cache.skewY = skewY + deg; 36279 cache.transformPerspective = perspective + px; 36280 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) { 36281 style[_transformOriginProp] = _firstTwoOnly(origin); 36282 } 36283 cache.xOffset = cache.yOffset = 0; 36284 cache.force3D = _config.force3D; 36285 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 36286 cache.uncache = 0; 36287 return cache; 36288}; 36289var _firstTwoOnly = function _firstTwoOnly(value) { 36290 return (value = value.split(" "))[0] + " " + value[1]; 36291}; 36292var _addPxTranslate = function _addPxTranslate(target, start, value) { 36293 var unit = getUnit(start); 36294 return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 36295}; 36296var _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 36297 cache.z = "0px"; 36298 cache.rotationY = cache.rotationX = "0deg"; 36299 cache.force3D = 0; 36300 _renderCSSTransforms(ratio, cache); 36301}; 36302var _zeroDeg = "0deg"; 36303var _zeroPx = "0px"; 36304var _endParenthesis = ") "; 36305var _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 36306 var _ref = cache || this, { xPercent, yPercent, x, y, z, rotation, rotationY, rotationX, skewX, skewY, scaleX, scaleY, transformPerspective, force3D, target, zOrigin } = _ref, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; 36307 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 36308 var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle), cos; 36309 angle = parseFloat(rotationX) * _DEG2RAD; 36310 cos = Math.cos(angle); 36311 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 36312 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 36313 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 36314 } 36315 if (transformPerspective !== _zeroPx) { 36316 transforms += "perspective(" + transformPerspective + _endParenthesis; 36317 } 36318 if (xPercent || yPercent) { 36319 transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 36320 } 36321 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) { 36322 transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 36323 } 36324 if (rotation !== _zeroDeg) { 36325 transforms += "rotate(" + rotation + _endParenthesis; 36326 } 36327 if (rotationY !== _zeroDeg) { 36328 transforms += "rotateY(" + rotationY + _endParenthesis; 36329 } 36330 if (rotationX !== _zeroDeg) { 36331 transforms += "rotateX(" + rotationX + _endParenthesis; 36332 } 36333 if (skewX !== _zeroDeg || skewY !== _zeroDeg) { 36334 transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 36335 } 36336 if (scaleX !== 1 || scaleY !== 1) { 36337 transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 36338 } 36339 target.style[_transformProp] = transforms || "translate(0, 0)"; 36340}; 36341var _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 36342 var _ref2 = cache || this, { xPercent, yPercent, x, y, rotation, skewX, skewY, scaleX, scaleY, target, xOrigin, yOrigin, xOffset, yOffset, forceCSS } = _ref2, tx = parseFloat(x), ty = parseFloat(y), a11, a21, a12, a22, temp; 36343 rotation = parseFloat(rotation); 36344 skewX = parseFloat(skewX); 36345 skewY = parseFloat(skewY); 36346 if (skewY) { 36347 skewY = parseFloat(skewY); 36348 skewX += skewY; 36349 rotation += skewY; 36350 } 36351 if (rotation || skewX) { 36352 rotation *= _DEG2RAD; 36353 skewX *= _DEG2RAD; 36354 a11 = Math.cos(rotation) * scaleX; 36355 a21 = Math.sin(rotation) * scaleX; 36356 a12 = Math.sin(rotation - skewX) * -scaleY; 36357 a22 = Math.cos(rotation - skewX) * scaleY; 36358 if (skewX) { 36359 skewY *= _DEG2RAD; 36360 temp = Math.tan(skewX - skewY); 36361 temp = Math.sqrt(1 + temp * temp); 36362 a12 *= temp; 36363 a22 *= temp; 36364 if (skewY) { 36365 temp = Math.tan(skewY); 36366 temp = Math.sqrt(1 + temp * temp); 36367 a11 *= temp; 36368 a21 *= temp; 36369 } 36370 } 36371 a11 = _round(a11); 36372 a21 = _round(a21); 36373 a12 = _round(a12); 36374 a22 = _round(a22); 36375 } else { 36376 a11 = scaleX; 36377 a22 = scaleY; 36378 a21 = a12 = 0; 36379 } 36380 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 36381 tx = _convertToUnit(target, "x", x, "px"); 36382 ty = _convertToUnit(target, "y", y, "px"); 36383 } 36384 if (xOrigin || yOrigin || xOffset || yOffset) { 36385 tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 36386 ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 36387 } 36388 if (xPercent || yPercent) { 36389 temp = target.getBBox(); 36390 tx = _round(tx + xPercent / 100 * temp.width); 36391 ty = _round(ty + yPercent / 100 * temp.height); 36392 } 36393 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 36394 target.setAttribute("transform", temp); 36395 forceCSS && (target.style[_transformProp] = temp); 36396}; 36397var _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { 36398 var cap = 360, isString = _isString(endValue), endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), change = endNum - startNum, finalValue = startNum + change + "deg", direction, pt; 36399 if (isString) { 36400 direction = endValue.split("_")[1]; 36401 if (direction === "short") { 36402 change %= cap; 36403 if (change !== change % (cap / 2)) { 36404 change += change < 0 ? cap : -cap; 36405 } 36406 } 36407 if (direction === "cw" && change < 0) { 36408 change = (change + cap * _bigNum2) % cap - ~~(change / cap) * cap; 36409 } else if (direction === "ccw" && change > 0) { 36410 change = (change - cap * _bigNum2) % cap - ~~(change / cap) * cap; 36411 } 36412 } 36413 plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 36414 pt.e = finalValue; 36415 pt.u = "deg"; 36416 plugin._props.push(property); 36417 return pt; 36418}; 36419var _assign = function _assign(target, source) { 36420 for (var p in source) { 36421 target[p] = source[p]; 36422 } 36423 return target; 36424}; 36425var _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 36426 var startCache = _assign({}, target._gsap), exclude = "perspective,force3D,transformOrigin,svgOrigin", style = target.style, endCache, p, startValue, endValue, startNum, endNum, startUnit, endUnit; 36427 if (startCache.svg) { 36428 startValue = target.getAttribute("transform"); 36429 target.setAttribute("transform", ""); 36430 style[_transformProp] = transforms; 36431 endCache = _parseTransform(target, 1); 36432 _removeProperty(target, _transformProp); 36433 target.setAttribute("transform", startValue); 36434 } else { 36435 startValue = getComputedStyle(target)[_transformProp]; 36436 style[_transformProp] = transforms; 36437 endCache = _parseTransform(target, 1); 36438 style[_transformProp] = startValue; 36439 } 36440 for (p in _transformProps) { 36441 startValue = startCache[p]; 36442 endValue = endCache[p]; 36443 if (startValue !== endValue && exclude.indexOf(p) < 0) { 36444 startUnit = getUnit(startValue); 36445 endUnit = getUnit(endValue); 36446 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 36447 endNum = parseFloat(endValue); 36448 plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 36449 plugin._pt.u = endUnit || 0; 36450 plugin._props.push(p); 36451 } 36452 } 36453 _assign(endCache, startCache); 36454}; 36455_forEachName("padding,margin,Width,Radius", function(name, index) { 36456 var t = "Top", r = "Right", b = "Bottom", l = "Left", props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function(side) { 36457 return index < 2 ? name + side : "border" + side + name; 36458 }); 36459 _specialProps[index > 1 ? "border" + name : name] = function(plugin, target, property, endValue, tween) { 36460 var a, vars; 36461 if (arguments.length < 4) { 36462 a = props.map(function(prop) { 36463 return _get(plugin, prop, property); 36464 }); 36465 vars = a.join(" "); 36466 return vars.split(a[0]).length === 5 ? a[0] : vars; 36467 } 36468 a = (endValue + "").split(" "); 36469 vars = {}; 36470 props.forEach(function(prop, i) { 36471 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 36472 }); 36473 plugin.init(target, vars, tween); 36474 }; 36475}); 36476var CSSPlugin = { 36477 name: "css", 36478 register: _initCore, 36479 targetTest: function targetTest(target) { 36480 return target.style && target.nodeType; 36481 }, 36482 init: function init(target, vars, tween, index, targets) { 36483 var props = this._props, style = target.style, startAt = tween.vars.startAt, startValue, endValue, endNum, startNum, type, specialProp, p, startUnit, endUnit, relative, isTransformRelated, transformPropTween, cache, smooth, hasPriority, inlineProps, finalTransformValue; 36484 _pluginInitted || _initCore(); 36485 this.styles = this.styles || _getStyleSaver(target); 36486 inlineProps = this.styles.props; 36487 this.tween = tween; 36488 for (p in vars) { 36489 if (p === "autoRound") { 36490 continue; 36491 } 36492 endValue = vars[p]; 36493 if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) { 36494 continue; 36495 } 36496 type = typeof endValue; 36497 specialProp = _specialProps[p]; 36498 if (type === "function") { 36499 endValue = endValue.call(tween, index, target, targets); 36500 type = typeof endValue; 36501 } 36502 if (type === "string" && ~endValue.indexOf("random(")) { 36503 endValue = _replaceRandom(endValue); 36504 } 36505 if (specialProp) { 36506 specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 36507 } else if (p.substr(0, 2) === "--") { 36508 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 36509 endValue += ""; 36510 _colorExp.lastIndex = 0; 36511 if (!_colorExp.test(startValue)) { 36512 startUnit = getUnit(startValue); 36513 endUnit = getUnit(endValue); 36514 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 36515 } 36516 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 36517 props.push(p); 36518 inlineProps.push(p, 0, style[p]); 36519 } else if (type !== "undefined") { 36520 if (startAt && p in startAt) { 36521 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 36522 _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue)); 36523 getUnit(startValue + "") || startValue === "auto" || (startValue += _config.units[p] || getUnit(_get(target, p)) || ""); 36524 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); 36525 } else { 36526 startValue = _get(target, p); 36527 } 36528 startNum = parseFloat(startValue); 36529 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 36530 relative && (endValue = endValue.substr(2)); 36531 endNum = parseFloat(endValue); 36532 if (p in _propertyAliases) { 36533 if (p === "autoAlpha") { 36534 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { 36535 startNum = 0; 36536 } 36537 inlineProps.push("visibility", 0, style.visibility); 36538 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 36539 } 36540 if (p !== "scale" && p !== "transform") { 36541 p = _propertyAliases[p]; 36542 ~p.indexOf(",") && (p = p.split(",")[0]); 36543 } 36544 } 36545 isTransformRelated = p in _transformProps; 36546 if (isTransformRelated) { 36547 this.styles.save(p); 36548 finalTransformValue = endValue; 36549 if (type === "string" && endValue.substring(0, 6) === "var(--") { 36550 endValue = _getComputedProperty(target, endValue.substring(4, endValue.indexOf(")"))); 36551 if (endValue.substring(0, 5) === "calc(") { 36552 var origPerspective = target.style.perspective; 36553 target.style.perspective = endValue; 36554 endValue = _getComputedProperty(target, "perspective"); 36555 origPerspective ? target.style.perspective = origPerspective : _removeProperty(target, "perspective"); 36556 } 36557 endNum = parseFloat(endValue); 36558 } 36559 if (!transformPropTween) { 36560 cache = target._gsap; 36561 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); 36562 smooth = vars.smoothOrigin !== false && cache.smooth; 36563 transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); 36564 transformPropTween.dep = 1; 36565 } 36566 if (p === "scale") { 36567 this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); 36568 this._pt.u = 0; 36569 props.push("scaleY", p); 36570 p += "X"; 36571 } else if (p === "transformOrigin") { 36572 inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); 36573 endValue = _convertKeywordsToPercentages(endValue); 36574 if (cache.svg) { 36575 _applySVGOrigin(target, endValue, 0, smooth, 0, this); 36576 } else { 36577 endUnit = parseFloat(endValue.split(" ")[2]) || 0; 36578 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 36579 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 36580 } 36581 continue; 36582 } else if (p === "svgOrigin") { 36583 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 36584 continue; 36585 } else if (p in _rotationalProperties) { 36586 _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue); 36587 continue; 36588 } else if (p === "smoothOrigin") { 36589 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 36590 continue; 36591 } else if (p === "force3D") { 36592 cache[p] = endValue; 36593 continue; 36594 } else if (p === "transform") { 36595 _addRawTransformPTs(this, endValue, target); 36596 continue; 36597 } 36598 } else if (!(p in style)) { 36599 p = _checkPropPrefix(p) || p; 36600 } 36601 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 36602 startUnit = (startValue + "").substr((startNum + "").length); 36603 endNum || (endNum = 0); 36604 endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit); 36605 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 36606 this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 36607 this._pt.u = endUnit || 0; 36608 if (isTransformRelated && finalTransformValue !== endValue) { 36609 this._pt.b = startValue; 36610 this._pt.e = finalTransformValue; 36611 this._pt.r = _renderCSSPropWithBeginningAndEnd; 36612 } else if (startUnit !== endUnit && endUnit !== "%") { 36613 this._pt.b = startValue; 36614 this._pt.r = _renderCSSPropWithBeginning; 36615 } 36616 } else if (!(p in style)) { 36617 if (p in target) { 36618 this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); 36619 } else if (p !== "parseTransform") { 36620 _missingPlugin(p, endValue); 36621 continue; 36622 } 36623 } else { 36624 _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); 36625 } 36626 isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : typeof target[p] === "function" ? inlineProps.push(p, 2, target[p]()) : inlineProps.push(p, 1, startValue || target[p])); 36627 props.push(p); 36628 } 36629 } 36630 hasPriority && _sortPropTweensByPriority(this); 36631 }, 36632 render: function render(ratio, data) { 36633 if (data.tween._time || !_reverting2()) { 36634 var pt = data._pt; 36635 while (pt) { 36636 pt.r(ratio, pt.d); 36637 pt = pt._next; 36638 } 36639 } else { 36640 data.styles.revert(); 36641 } 36642 }, 36643 get: _get, 36644 aliases: _propertyAliases, 36645 getSetter: function getSetter(target, property, plugin) { 36646 var p = _propertyAliases[property]; 36647 p && p.indexOf(",") < 0 && (property = p); 36648 return property in _transformProps && property !== _transformOriginProp && (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); 36649 }, 36650 core: { 36651 _removeProperty, 36652 _getMatrix 36653 } 36654}; 36655gsap.utils.checkPrefix = _checkPropPrefix; 36656gsap.core.getStyleSaver = _getStyleSaver; 36657(function(positionAndScale, rotation, others, aliases) { 36658 var all2 = _forEachName(positionAndScale + "," + rotation + "," + others, function(name) { 36659 _transformProps[name] = 1; 36660 }); 36661 _forEachName(rotation, function(name) { 36662 _config.units[name] = "deg"; 36663 _rotationalProperties[name] = 1; 36664 }); 36665 _propertyAliases[all2[13]] = positionAndScale + "," + rotation; 36666 _forEachName(aliases, function(name) { 36667 var split = name.split(":"); 36668 _propertyAliases[split[1]] = all2[split[0]]; 36669 }); 36670})("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"); 36671_forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) { 36672 _config.units[name] = "px"; 36673}); 36674gsap.registerPlugin(CSSPlugin); 36675
vendor: 135 bytes, lines 36676-36679
36676// node_modules/gsap/index.js 36677var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap; 36678var TweenMaxWithCSS = gsapWithCSS.core.Tween; 36679
36680// app/javascript/theme/stickers.js 36681var ready3 = function() { 36682 if (import_jquery4.default(".stickers.index").length === 0) { 36683 return; 36684 } 36685 var $postits = import_jquery4.default(".stickers__postit"); 36686 var $photos = import_jquery4.default(".stickers__photo"); 36687 var postitsL = $postits.length; 36688 var organizedEls = []; 36689 organizedEls.push($photos[0]); 36690 [].shift.call($photos); 36691 organizedEls.push($postits[0]); 36692 [].shift.call($postits); 36693 for (var i = 0;i < postitsL; i++) { 36694 organizedEls.push($photos[0]); 36695 [].shift.call($photos); 36696 organizedEls.push($postits[0]); 36697 [].shift.call($postits); 36698 } 36699 import_jquery4.default(".stickers-container").html(organizedEls).addClass("ready"); 36700 var controllerStickers = new import_scrollmagic.default.Controller({ 36701 globalSceneOptions: { 36702 triggerHook: "onEnter", 36703 offset: -300 36704 } 36705 }); 36706 var sticks = import_jquery4.default(".stickers-container > *").not(".stickers__button"); 36707 var scenes = []; 36708 for (var i = 0;i < sticks.length; i++) { 36709 var yTrans, xTrans; 36710 if (i % 20 == 0) { 36711 yTrans = -430; 36712 xTrans = -430; 36713 } else if (i % 20 == 1) { 36714 yTrans = -110; 36715 xTrans = -430; 36716 } else if (i % 20 == 2) { 36717 yTrans = 0; 36718 xTrans = -430; 36719 } else if (i % 20 == 7) { 36720 yTrans = 250; 36721 xTrans = -430; 36722 } else if (i % 20 == 13) { 36723 yTrans = 160; 36724 xTrans = -430; 36725 } else if (i % 20 == 5) { 36726 yTrans = -430; 36727 xTrans = -250; 36728 } else if (i % 20 == 6) { 36729 yTrans = -430; 36730 xTrans = 0; 36731 } else if (i % 20 == 10) { 36732 yTrans = -430; 36733 xTrans = 110; 36734 } else if (i % 20 == 14) { 36735 yTrans = -430; 36736 xTrans = 160; 36737 } else if (i % 20 == 9) { 36738 yTrans = -430; 36739 xTrans = 160; 36740 } else if (i % 20 == 3) { 36741 yTrans = -110; 36742 xTrans = 160; 36743 } else if (i % 20 == 11) { 36744 yTrans = 0; 36745 xTrans = 160; 36746 } else if (i % 20 == 12) { 36747 yTrans = 250; 36748 xTrans = 160; 36749 } else if (i % 20 == 8) { 36750 yTrans = 160; 36751 xTrans = 160; 36752 } else if (i % 20 == 4) { 36753 yTrans = 160; 36754 xTrans = -250; 36755 } else if (i % 20 == 15) { 36756 yTrans = 160; 36757 xTrans = 0; 36758 } else if (i % 20 == 16) { 36759 yTrans = 160; 36760 xTrans = 110; 36761 } else if (i % 20 == 17) { 36762 yTrans = 160; 36763 xTrans = 160; 36764 } else { 36765 yTrans = 160; 36766 xTrans = -430; 36767 } 36768 yTrans = yTrans + Math.floor(Math.random() * 20) + 1; 36769 xTrans = xTrans + Math.floor(Math.random() * 20) + 1; 36770 var vRotate = Math.floor(Math.random() * 10) + 1; 36771 var time = (Math.floor(Math.random() * 6) + 1) / 10 + 0.6; 36772 if (i % 3 == 0) { 36773 vRotate = -vRotate; 36774 } 36775 const element = sticks[i]; 36776 scenes[i] = new import_scrollmagic.default.Scene({ 36777 triggerElement: element 36778 }).on("enter", function() { 36779 gsapWithCSS.to(element, { 36780 duration: time, 36781 opacity: 1, 36782 rotation: vRotate, 36783 y: yTrans, 36784 x: xTrans, 36785 scale: 1, 36786 ease: "power1.inOut" 36787 }); 36788 }); 36789 } 36790 controllerStickers.addScene(scenes); 36791}; 36792import_jquery4.default(document).on("turbo:load", ready3); 36793
36794// app/javascript/theme/courses.js 36795var import_jquery5 = __toESM(require_jquery()); 36796function isCourses() { 36797 return import_jquery5.default(".courses.show").length > 0; 36798} 36799function selectMenu(el) { 36800 var scrollSpyNav = import_jquery5.default("#scrollspy-nav"); 36801 scrollSpyNav.find(".active").removeClass("active"); 36802 scrollSpyNav.find('a[href="' + el + '"]').addClass("active"); 36803} 36804var ready4 = function() { 36805 if (!isCourses()) { 36806 return; 36807 } 36808 var checkSidebar = false; 36809 import_jquery5.default(window).scroll(function() { 36810 if (!isCourses()) { 36811 return; 36812 } 36813 var scroll = import_jquery5.default(window).scrollTop(); 36814 if (scroll >= 450) { 36815 import_jquery5.default(".fixed-training-nav").addClass("is-visible"); 36816 checkSidebar = true; 36817 } 36818 if (scroll < 450) { 36819 import_jquery5.default(".fixed-training-nav").removeClass("is-visible"); 36820 checkSidebar = false; 36821 } 36822 var descriptionPosition = import_jquery5.default("#description").offset().top; 36823 var outlinePosition = import_jquery5.default("#outline").offset().top; 36824 var trainerPosition = import_jquery5.default("#trainer").offset().top; 36825 if (scroll > descriptionPosition) { 36826 selectMenu("#description"); 36827 } 36828 if (scroll > outlinePosition - 150) { 36829 selectMenu("#outline"); 36830 } 36831 if (scroll > trainerPosition - 150) { 36832 selectMenu("#trainer"); 36833 } 36834 if (import_jquery5.default("#quotes").length > 0) { 36835 var quotesPosition = import_jquery5.default("#quotes").offset().top; 36836 if (scroll > quotesPosition - 150) { 36837 selectMenu("#quotes"); 36838 } 36839 } 36840 if (checkSidebar) { 36841 var footertotop = import_jquery5.default("#footer").position().top; 36842 var sidebarH = import_jquery5.default(".sidebar").height(); 36843 var scrolltop = import_jquery5.default(document).scrollTop() + sidebarH; 36844 if (scrolltop > footertotop) { 36845 import_jquery5.default(".sidebar").addClass("is-absolute"); 36846 } else { 36847 import_jquery5.default(".sidebar").removeClass("is-absolute"); 36848 } 36849 } 36850 }); 36851}; 36852import_jquery5.default(document).on("turbo:load", ready4); 36853
36854// app/javascript/theme/quotes_carousel.js 36855document.addEventListener("turbo:load", function() { 36856 const isMobile = window.innerWidth <= 768 || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 36857 if (isMobile) 36858 return; 36859 const carousels = document.querySelectorAll(".quotes-carousel"); 36860 carousels.forEach((carousel, index) => { 36861 const quotes = carousel.querySelectorAll(".quote"); 36862 if (quotes.length === 0) 36863 return; 36864 const clonedQuotes = Array.from(quotes).map((quote) => quote.cloneNode(true)); 36865 clonedQuotes.forEach((clone2) => carousel.appendChild(clone2)); 36866 const direction = index === 0 ? "left-to-right" : "right-to-left"; 36867 carousel.classList.add(`scroll-${direction}`); 36868 if (direction === "right-to-left") { 36869 setTimeout(() => { 36870 const maxScroll = carousel.scrollWidth - carousel.clientWidth; 36871 carousel.scrollLeft = maxScroll; 36872 }, 100); 36873 } 36874 let isAnimating = true; 36875 let animationId; 36876 function startAnimation() { 36877 if (!isAnimating) 36878 return; 36879 const scrollSpeed = 0.5; 36880 const currentScroll = carousel.scrollLeft; 36881 const maxScroll = carousel.scrollWidth - carousel.clientWidth; 36882 if (direction === "left-to-right") { 36883 carousel.scrollLeft = currentScroll >= maxScroll ? 0 : currentScroll + scrollSpeed; 36884 } else { 36885 carousel.scrollLeft = currentScroll <= 0 ? maxScroll : currentScroll - scrollSpeed; 36886 } 36887 animationId = requestAnimationFrame(startAnimation); 36888 } 36889 function pauseAnimation() { 36890 isAnimating = false; 36891 if (animationId) { 36892 cancelAnimationFrame(animationId); 36893 } 36894 } 36895 function resumeAnimation() { 36896 isAnimating = true; 36897 startAnimation(); 36898 } 36899 carousel.addEventListener("mouseenter", pauseAnimation); 36900 carousel.addEventListener("mouseleave", resumeAnimation); 36901 setTimeout(() => { 36902 startAnimation(); 36903 }, 200); 36904 document.addEventListener("visibilitychange", function() { 36905 if (document.hidden) { 36906 pauseAnimation(); 36907 } else { 36908 resumeAnimation(); 36909 } 36910 }); 36911 window.addEventListener("resize", function() { 36912 const isNowMobile = window.innerWidth <= 768; 36913 if (isNowMobile) { 36914 pauseAnimation(); 36915 } else { 36916 resumeAnimation(); 36917 } 36918 }); 36919 }); 36920}); 36921
36922// app/javascript/terminal_config.js 36923var import_jquery6 = __toESM(require_jquery()); 36924var import_jquery7 = __toESM(require_jquery_terminal()); 36925document.addEventListener("turbo:load", function() { 36926 if (import_jquery6.default("body").hasClass("home")) { 36927 let typed = function(finish_typing) { 36928 return function(term2, message, delay, finish2) { 36929 anim = true; 36930 var prompt = term2.get_prompt(); 36931 var c = 0; 36932 if (message.length > 0) { 36933 term2.set_prompt(""); 36934 var interval = setInterval(function() { 36935 term2.insert(message[c++]); 36936 if (c == message.length) { 36937 clearInterval(interval); 36938 setTimeout(function() { 36939 finish_typing(term2, message, prompt); 36940 anim = false; 36941 finish2 && finish2(); 36942 }, delay); 36943 } 36944 }, delay); 36945 } 36946 }; 36947 }; 36948 var splash = "[[;springgreen;]" + ""; 36949 splash += ` _ _ _____ _ 36950`; 36951 splash += ` | | | | / ____| | | 36952`; 36953 splash += ` | |__| |_ _ _ __ ___ __ _ _ __ | | ___ __| | ___ _ __ ___ 36954`; 36955 splash += " | __ | | | | '_ ` _ \\ / _` | '_ \\ | | / _ \\ / _` |/ _ \\ '__/ __|\n"; 36956 splash += ` | | | | |_| | | | | | | (_| | | | | | |___| (_) | (_| | __/ | \\__ \\ 36957`; 36958 splash += ` |_| |_|\\__,_|_| |_| |_|\\__,_|_| |_| \\_____\\___/ \\__,_|\\___|_| |___/ 36959`; 36960 splash += ` 36961`; 36962 var anim = false; 36963 var typed_prompt = typed(function(term2, message, prompt) { 36964 term2.set_command(""); 36965 term2.set_prompt(message + " "); 36966 }); 36967 var typed_message = typed(function(term2, message, prompt) { 36968 term2.set_command(""); 36969 term2.echo(message); 36970 term2.set_prompt(prompt); 36971 }); 36972 window.terminalInit = function() { 36973 import_jquery6.default("#term_demo").terminal(function(command, term2) { 36974 var finish2 = false; 36975 if (command == "test") { 36976 term2.error("Pas très original... essaye encore !"); 36977 } else if (command === "help") { 36978 term2.echo(` 36979Commandes disponibles: 36980 36981`); 36982 term2.echo("[[gb;<COLOR>;]clear] - Efface l'écran"); 36983 term2.echo("[[gb;<COLOR>;]contact] - Affiche différents moyens de discuter avec nous"); 36984 term2.echo("[[gb;<COLOR>;]love] - <3"); 36985 term2.echo("[[gb;<COLOR>;]splash] - Affiche le splash screen"); 36986 } else if (command == "contact") { 36987 term2.echo("Ecris-nous !"); 36988 term2.echo('Email: <a href="mailto:[email protected]">[email protected]</a><br />', { raw: true }); 36989 term2.echo('Phone: <a href="tel:+33-1-84-17-38-96">+33(0)1 84 17 38 96</a><br />', { raw: true }); 36990 term2.echo('Twitter: <a href="https://x.com/humancoders">@humancoders</a><br />', { raw: true }); 36991 term2.echo('LinkedIn: <a href="https://www.linkedin.com/company/2487898">Human Coders</a><br />', { raw: true }); 36992 term2.echo('Facebook: <a href="https://www.facebook.com/humancoders/">Human Coders</a><br />', { raw: true }); 36993 } else if (command === "love") { 36994 term2.echo("<3"); 36995 window.open("/stickers", "_blank"); 36996 } else if (command === "ls") { 36997 term2.error("C'est malin... mais ce n'est qu'un émulateur !"); 36998 } else if (command === "dir") { 36999 term2.error("Il y a encore des gens qui utilisent ça ??"); 37000 } else if (command === "splash") { 37001 term2.echo(splash); 37002 } else { 37003 term2.error(command + ": Cette commande n'existe pas"); 37004 } 37005 }, { 37006 name: "human_coders", 37007 height: 300, 37008 prompt: "www.humancoders.com$ ", 37009 greetings: false, 37010 onInit: function(term2) { 37011 var msg = "Connexion à la console Human Coders..."; 37012 typed_message(term2, msg, 50, function() { 37013 finish = true; 37014 }); 37015 term2.echo(splash); 37016 term2.echo("<br />Tapez 'help' pour lister les commandes disponibles<br />", { raw: true }); 37017 }, 37018 onClear: function(term2) { 37019 term2.echo(splash); 37020 term2.echo("<br />Tapez 'help' pour lister les commandes disponibles<br />", { raw: true }); 37021 }, 37022 keydown: function(e) { 37023 if (anim) { 37024 return false;
37025 } 37026 } 37027 }); 37028 }; 37029 } 37030}); 37031
37032// app/javascript/trainer_admin.js 37033var import_jquery8 = __toESM(require_jquery()); 37034document.addEventListener("turbo:load", function() { 37035 import_jquery8.default('[data-toggle="tooltip"]').tooltip(); 37036 import_jquery8.default("button[data-copy-emails]").click(function(e) { 37037 e.preventDefault(); 37038 var emails = import_jquery8.default(this).data("copy-emails"); 37039 if (navigator.clipboard && window.isSecureContext) { 37040 navigator.clipboard.writeText(emails).then(function() { 37041 showCopyAlert(); 37042 }).catch(function() { 37043 fallbackCopyTextToClipboard(emails); 37044 }); 37045 } else { 37046 fallbackCopyTextToClipboard(emails); 37047 } 37048 }); 37049 function fallbackCopyTextToClipboard(text2) { 37050 var textArea = document.createElement("textarea"); 37051 textArea.value = text2; 37052 textArea.style.position = "fixed"; 37053 textArea.style.left = "-999999px"; 37054 textArea.style.top = "-999999px"; 37055 document.body.appendChild(textArea); 37056 textArea.focus(); 37057 textArea.select(); 37058 try { 37059 document.execCommand("copy"); 37060 showCopyAlert(); 37061 } catch (err) { 37062 console.error("Fallback: Unable to copy", err); 37063 } 37064 document.body.removeChild(textArea); 37065 } 37066 function showCopyAlert() { 37067 var alertHtml = '<div class="alert alert-success alert-dismissible fade show" role="alert">' + "Le(s) contact(s) ont bien été copié" + '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + '<span aria-hidden="true">×</span>' + "</button>" + "</div>"; 37068 import_jquery8.default(".alert-container").html(alertHtml); 37069 setTimeout(function() { 37070 import_jquery8.default(".alert-container .alert").alert("close"); 37071 }, 3000); 37072 } 37073}); 37074document.addEventListener("turbo:before-cache", function() { 37075 import_jquery8.default('[data-toggle="tooltip"]').tooltip("dispose"); 37076}); 37077
37078// app/javascript/attendee.js 37079var import_jquery9 = __toESM(require_jquery()); 37080document.addEventListener("turbo:load", function() { 37081 if (import_jquery9.default("body").hasClass("before_session_self_ratings")) { 37082 import_jquery9.default(document).on("click", "#accesibility", function() { 37083 import_jquery9.default("#accessibility_text_area").removeClass("hidden"); 37084 }); 37085 import_jquery9.default(document).on("change", ".ai-tools-checkbox", function() { 37086 if (import_jquery9.default(this).is(":checked")) { 37087 import_jquery9.default(".evaluation_question_8").removeClass("hidden"); 37088 import_jquery9.default(".ai-tools-hidden-field").val("true"); 37089 } else { 37090 import_jquery9.default(".evaluation_question_8").addClass("hidden"); 37091 import_jquery9.default("#ai_tools_text_area").val(""); 37092 import_jquery9.default(".ai-tools-hidden-field").val("false"); 37093 } 37094 }); 37095 } 37096}); 37097
vendor: 15,944 bytes, lines 37098-37568
37098// node_modules/@algolia/client-common/dist/common.js 37099function createBrowserLocalStorageCache(options2) { 37100 let storage; 37101 const namespaceKey = `algolia-client-js-${options2.key}`; 37102 function getStorage() { 37103 if (storage === undefined) { 37104 storage = options2.localStorage || window.localStorage; 37105 } 37106 return storage; 37107 } 37108 function getNamespace() { 37109 return JSON.parse(getStorage().getItem(namespaceKey) || "{}"); 37110 } 37111 function setNamespace(namespace) { 37112 getStorage().setItem(namespaceKey, JSON.stringify(namespace)); 37113 } 37114 function removeOutdatedCacheItems() { 37115 const timeToLive = options2.timeToLive ? options2.timeToLive * 1000 : null; 37116 const namespace = getNamespace(); 37117 const filteredNamespaceWithoutOldFormattedCacheItems = Object.fromEntries(Object.entries(namespace).filter(([, cacheItem]) => { 37118 return cacheItem.timestamp !== undefined; 37119 })); 37120 setNamespace(filteredNamespaceWithoutOldFormattedCacheItems); 37121 if (!timeToLive) { 37122 return; 37123 } 37124 const filteredNamespaceWithoutExpiredItems = Object.fromEntries(Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(([, cacheItem]) => { 37125 const currentTimestamp = (/* @__PURE__ */ new Date()).getTime(); 37126 const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp; 37127 return !isExpired; 37128 })); 37129 setNamespace(filteredNamespaceWithoutExpiredItems); 37130 } 37131 return { 37132 get(key, defaultValue, events = { 37133 miss: () => Promise.resolve() 37134 }) { 37135 return Promise.resolve().then(() => { 37136 removeOutdatedCacheItems(); 37137 return getNamespace()[JSON.stringify(key)]; 37138 }).then((value) => { 37139 return Promise.all([value ? value.value : defaultValue(), value !== undefined]); 37140 }).then(([value, exists]) => { 37141 return Promise.all([value, exists || events.miss(value)]); 37142 }).then(([value]) => value); 37143 }, 37144 set(key, value) { 37145 return Promise.resolve().then(() => { 37146 const namespace = getNamespace(); 37147 namespace[JSON.stringify(key)] = { 37148 timestamp: (/* @__PURE__ */ new Date()).getTime(), 37149 value 37150 }; 37151 getStorage().setItem(namespaceKey, JSON.stringify(namespace)); 37152 return value; 37153 }); 37154 }, 37155 delete(key) { 37156 return Promise.resolve().then(() => { 37157 const namespace = getNamespace(); 37158 delete namespace[JSON.stringify(key)]; 37159 getStorage().setItem(namespaceKey, JSON.stringify(namespace)); 37160 }); 37161 }, 37162 clear() { 37163 return Promise.resolve().then(() => { 37164 getStorage().removeItem(namespaceKey); 37165 }); 37166 } 37167 }; 37168} 37169function createNullCache() { 37170 return { 37171 get(_key, defaultValue, events = { 37172 miss: () => Promise.resolve() 37173 }) { 37174 const value = defaultValue(); 37175 return value.then((result) => Promise.all([result, events.miss(result)])).then(([result]) => result); 37176 }, 37177 set(_key, value) { 37178 return Promise.resolve(value); 37179 }, 37180 delete(_key) { 37181 return Promise.resolve(); 37182 }, 37183 clear() { 37184 return Promise.resolve(); 37185 } 37186 }; 37187} 37188function createFallbackableCache(options2) { 37189 const caches = [...options2.caches]; 37190 const current = caches.shift(); 37191 if (current === undefined) { 37192 return createNullCache(); 37193 } 37194 return { 37195 get(key, defaultValue, events = { 37196 miss: () => Promise.resolve() 37197 }) { 37198 return current.get(key, defaultValue, events).catch(() => { 37199 return createFallbackableCache({ caches }).get(key, defaultValue, events); 37200 }); 37201 }, 37202 set(key, value) { 37203 return current.set(key, value).catch(() => { 37204 return createFallbackableCache({ caches }).set(key, value); 37205 }); 37206 }, 37207 delete(key) { 37208 return current.delete(key).catch(() => { 37209 return createFallbackableCache({ caches }).delete(key); 37210 }); 37211 }, 37212 clear() { 37213 return current.clear().catch(() => { 37214 return createFallbackableCache({ caches }).clear(); 37215 }); 37216 } 37217 }; 37218} 37219function createMemoryCache(options2 = { serializable: true }) { 37220 let cache = {}; 37221 return { 37222 get(key, defaultValue, events = { 37223 miss: () => Promise.resolve() 37224 }) { 37225 const keyAsString = JSON.stringify(key); 37226 if (keyAsString in cache) { 37227 return Promise.resolve(options2.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]); 37228 } 37229 const promise = defaultValue(); 37230 return promise.then((value) => events.miss(value)).then(() => promise); 37231 }, 37232 set(key, value) { 37233 cache[JSON.stringify(key)] = options2.serializable ? JSON.stringify(value) : value; 37234 return Promise.resolve(value); 37235 }, 37236 delete(key) { 37237 delete cache[JSON.stringify(key)]; 37238 return Promise.resolve(); 37239 }, 37240 clear() { 37241 cache = {}; 37242 return Promise.resolve(); 37243 } 37244 }; 37245} 37246function createAlgoliaAgent(version) { 37247 const algoliaAgent = { 37248 value: `Algolia for JavaScript (${version})`, 37249 add(options2) { 37250 const addedAlgoliaAgent = `; ${options2.segment}${options2.version !== undefined ? ` (${options2.version})` : ""}`; 37251 if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) { 37252 algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`; 37253 } 37254 return algoliaAgent; 37255 } 37256 }; 37257 return algoliaAgent; 37258} 37259function createAuth(appId, apiKey, authMode = "WithinHeaders") { 37260 const credentials = { 37261 "x-algolia-api-key": apiKey, 37262 "x-algolia-application-id": appId 37263 }; 37264 return { 37265 headers() { 37266 return authMode === "WithinHeaders" ? credentials : {}; 37267 }, 37268 queryParameters() { 37269 return authMode === "WithinQueryParameters" ? credentials : {}; 37270 } 37271 }; 37272} 37273function getAlgoliaAgent({ algoliaAgents, client, version }) { 37274 const defaultAlgoliaAgent = createAlgoliaAgent(version).add({ 37275 segment: client, 37276 version 37277 }); 37278 algoliaAgents.forEach((algoliaAgent) => defaultAlgoliaAgent.add(algoliaAgent)); 37279 return defaultAlgoliaAgent; 37280} 37281function createNullLogger() { 37282 return { 37283 debug(_message, _args) { 37284 return Promise.resolve(); 37285 }, 37286 info(_message, _args) { 37287 return Promise.resolve(); 37288 }, 37289 error(_message, _args) { 37290 return Promise.resolve(); 37291 } 37292 }; 37293} 37294var EXPIRATION_DELAY = 2 * 60 * 1000; 37295function createStatefulHost(host, status = "up") { 37296 const lastUpdate = Date.now(); 37297 function isUp() { 37298 return status === "up" || Date.now() - lastUpdate > EXPIRATION_DELAY; 37299 } 37300 function isTimedOut() { 37301 return status === "timed out" && Date.now() - lastUpdate <= EXPIRATION_DELAY; 37302 } 37303 return { ...host, status, lastUpdate, isUp, isTimedOut }; 37304} 37305var AlgoliaError = class extends Error { 37306 name = "AlgoliaError"; 37307 constructor(message, name) { 37308 super(message); 37309 if (name) { 37310 this.name = name; 37311 } 37312 } 37313}; 37314var ErrorWithStackTrace = class extends AlgoliaError { 37315 stackTrace; 37316 constructor(message, stackTrace, name) { 37317 super(message, name); 37318 this.stackTrace = stackTrace; 37319 } 37320}; 37321var RetryError = class extends ErrorWithStackTrace { 37322 constructor(stackTrace) { 37323 super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", stackTrace, "RetryError"); 37324 } 37325}; 37326var ApiError = class extends ErrorWithStackTrace { 37327 status; 37328 constructor(message, status, stackTrace, name = "ApiError") { 37329 super(message, stackTrace, name); 37330 this.status = status; 37331 } 37332}; 37333var DeserializationError = class extends AlgoliaError { 37334 response; 37335 constructor(message, response) { 37336 super(message, "DeserializationError"); 37337 this.response = response; 37338 } 37339}; 37340var DetailedApiError = class extends ApiError { 37341 error; 37342 constructor(message, status, error, stackTrace) { 37343 super(message, status, stackTrace, "DetailedApiError"); 37344 this.error = error; 37345 } 37346}; 37347function shuffle2(array) { 37348 const shuffledArray = array; 37349 for (let c = array.length - 1;c > 0; c--) { 37350 const b = Math.floor(Math.random() * (c + 1)); 37351 const a = array[c]; 37352 shuffledArray[c] = array[b]; 37353 shuffledArray[b] = a; 37354 } 37355 return shuffledArray; 37356} 37357function serializeUrl(host, path, queryParameters) { 37358 const queryParametersAsString = serializeQueryParameters(queryParameters); 37359 let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ""}/${path.charAt(0) === "/" ? path.substring(1) : path}`; 37360 if (queryParametersAsString.length) { 37361 url += `?${queryParametersAsString}`; 37362 } 37363 return url; 37364} 37365function serializeQueryParameters(parameters) { 37366 return Object.keys(parameters).filter((key) => parameters[key] !== undefined).sort().map((key) => `${key}=${encodeURIComponent(Object.prototype.toString.call(parameters[key]) === "[object Array]" ? parameters[key].join(",") : parameters[key]).replace(/\+/g, "%20")}`).join("&"); 37367} 37368function serializeData(request, requestOptions) { 37369 if (request.method === "GET" || request.data === undefined && requestOptions.data === undefined) { 37370 return; 37371 } 37372 const data = Array.isArray(request.data) ? request.data : { ...request.data, ...requestOptions.data }; 37373 return JSON.stringify(data); 37374} 37375function serializeHeaders(baseHeaders, requestHeaders, requestOptionsHeaders) { 37376 const headers = { 37377 Accept: "application/json", 37378 ...baseHeaders, 37379 ...requestHeaders, 37380 ...requestOptionsHeaders 37381 }; 37382 const serializedHeaders = {}; 37383 Object.keys(headers).forEach((header) => { 37384 const value = headers[header]; 37385 serializedHeaders[header.toLowerCase()] = value; 37386 }); 37387 return serializedHeaders; 37388} 37389function deserializeSuccess(response) { 37390 try { 37391 return JSON.parse(response.content); 37392 } catch (e) { 37393 throw new DeserializationError(e.message, response); 37394 } 37395} 37396function deserializeFailure({ content, status }, stackFrame) { 37397 try { 37398 const parsed = JSON.parse(content); 37399 if ("error" in parsed) { 37400 return new DetailedApiError(parsed.message, status, parsed.error, stackFrame); 37401 } 37402 return new ApiError(parsed.message, status, stackFrame); 37403 } catch {} 37404 return new ApiError(content, status, stackFrame); 37405} 37406function isNetworkError({ isTimedOut, status }) { 37407 return !isTimedOut && ~~status === 0; 37408} 37409function isRetryable({ isTimedOut, status }) { 37410 return isTimedOut || isNetworkError({ isTimedOut, status }) || ~~(status / 100) !== 2 && ~~(status / 100) !== 4; 37411} 37412function isSuccess({ status }) { 37413 return ~~(status / 100) === 2; 37414} 37415function stackTraceWithoutCredentials(stackTrace) { 37416 return stackTrace.map((stackFrame) => stackFrameWithoutCredentials(stackFrame)); 37417} 37418function stackFrameWithoutCredentials(stackFrame) { 37419 const modifiedHeaders = stackFrame.request.headers["x-algolia-api-key"] ? { "x-algolia-api-key": "*****" } : {}; 37420 return { 37421 ...stackFrame, 37422 request: { 37423 ...stackFrame.request, 37424 headers: { 37425 ...stackFrame.request.headers, 37426 ...modifiedHeaders 37427 } 37428 } 37429 }; 37430} 37431function createTransporter({ 37432 hosts, 37433 hostsCache, 37434 baseHeaders, 37435 logger, 37436 baseQueryParameters, 37437 algoliaAgent, 37438 timeouts, 37439 requester, 37440 requestsCache, 37441 responsesCache 37442}) { 37443 async function createRetryableOptions(compatibleHosts) { 37444 const statefulHosts = await Promise.all(compatibleHosts.map((compatibleHost) => { 37445 return hostsCache.get(compatibleHost, () => { 37446 return Promise.resolve(createStatefulHost(compatibleHost)); 37447 }); 37448 })); 37449 const hostsUp = statefulHosts.filter((host) => host.isUp()); 37450 const hostsTimedOut = statefulHosts.filter((host) => host.isTimedOut()); 37451 const hostsAvailable = [...hostsUp, ...hostsTimedOut]; 37452 const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts; 37453 return { 37454 hosts: compatibleHostsAvailable, 37455 getTimeout(timeoutsCount, baseTimeout) { 37456 const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount; 37457 return timeoutMultiplier * baseTimeout; 37458 } 37459 }; 37460 } 37461 async function retryableRequest(request, requestOptions, isRead) { 37462 const stackTrace = []; 37463 const data = serializeData(request, requestOptions); 37464 const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers); 37465 const dataQueryParameters = request.method === "GET" ? { 37466 ...request.data, 37467 ...requestOptions.data 37468 } : {}; 37469 const queryParameters = { 37470 ...baseQueryParameters, 37471 ...request.queryParameters, 37472 ...dataQueryParameters 37473 }; 37474 if (algoliaAgent.value) { 37475 queryParameters["x-algolia-agent"] = algoliaAgent.value; 37476 } 37477 if (requestOptions && requestOptions.queryParameters) { 37478 for (const key of Object.keys(requestOptions.queryParameters)) { 37479 if (!requestOptions.queryParameters[key] || Object.prototype.toString.call(requestOptions.queryParameters[key]) === "[object Object]") { 37480 queryParameters[key] = requestOptions.queryParameters[key]; 37481 } else { 37482 queryParameters[key] = requestOptions.queryParameters[key].toString(); 37483 } 37484 } 37485 } 37486 let timeoutsCount = 0; 37487 const retry = async (retryableHosts, getTimeout) => { 37488 const host = retryableHosts.pop(); 37489 if (host === undefined) { 37490 throw new RetryError(stackTraceWithoutCredentials(stackTrace)); 37491 } 37492 const timeout = { ...timeouts, ...requestOptions.timeouts }; 37493 const payload = { 37494 data, 37495 headers, 37496 method: request.method, 37497 url: serializeUrl(host, request.path, queryParameters), 37498 connectTimeout: getTimeout(timeoutsCount, timeout.connect), 37499 responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write) 37500 }; 37501 const pushToStackTrace = (response2) => { 37502 const stackFrame = { 37503 request: payload, 37504 response: response2, 37505 host, 37506 triesLeft: retryableHosts.length 37507 }; 37508 stackTrace.push(stackFrame); 37509 return stackFrame; 37510 }; 37511 const response = await requester.send(payload); 37512 if (isRetryable(response)) { 37513 const stackFrame = pushToStackTrace(response); 37514 if (response.isTimedOut) { 37515 timeoutsCount++; 37516 } 37517 logger.info("Retryable failure", stackFrameWithoutCredentials(stackFrame)); 37518 await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? "timed out" : "down")); 37519 return retry(retryableHosts, getTimeout); 37520 } 37521 if (isSuccess(response)) { 37522 return deserializeSuccess(response); 37523 } 37524 pushToStackTrace(response); 37525 throw deserializeFailure(response, stackTrace); 37526 }; 37527 const compatibleHosts = hosts.filter((host) => host.accept === "readWrite" || (isRead ? host.accept === "read" : host.accept === "write")); 37528 const options2 = await createRetryableOptions(compatibleHosts); 37529 return retry([...options2.hosts].reverse(), options2.getTimeout); 37530 } 37531 function createRequest(request, requestOptions = {}) { 37532 const createRetryableRequest = () => { 37533 return retryableRequest(request, requestOptions, isRead); 37534 }; 37535 const isRead = request.useReadTransporter || request.method === "GET"; 37536 const cacheable = requestOptions.cacheable || request.cacheable; 37537 if (cacheable !== true) { 37538 return createRetryableRequest(); 37539 } 37540 const key = { 37541 request, 37542 requestOptions, 37543 transporter: { 37544 queryParameters: baseQueryParameters, 37545 headers: baseHeaders 37546 } 37547 }; 37548 return responsesCache.get(key, () => { 37549 return requestsCache.get(key, () => requestsCache.set(key, createRetryableRequest()).then((response) => Promise.all([requestsCache.delete(key), response]), (err) => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response)); 37550 }, { 37551 miss: (response) => responsesCache.set(key, response) 37552 }); 37553 } 37554 return { 37555 hostsCache, 37556 requester, 37557 timeouts, 37558 logger, 37559 algoliaAgent, 37560 baseHeaders, 37561 baseQueryParameters, 37562 hosts, 37563 request: createRequest, 37564 requestsCache, 37565 responsesCache 37566 }; 37567} 37568
vendor: 998 bytes, lines 37569-37589
37569// node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js 37570function m2() { 37571 function r(t) { 37572 return new Promise((s) => { 37573 let e = new XMLHttpRequest; 37574 e.open(t.method, t.url, true), Object.keys(t.headers).forEach((n) => e.setRequestHeader(n, t.headers[n])); 37575 let i = (n, a) => setTimeout(() => { 37576 e.abort(), s({ status: 0, content: a, isTimedOut: true }); 37577 }, n), u = i(t.connectTimeout, "Connection timeout"), o; 37578 e.onreadystatechange = () => { 37579 e.readyState > e.OPENED && o === undefined && (clearTimeout(u), o = i(t.responseTimeout, "Socket timeout")); 37580 }, e.onerror = () => { 37581 e.status === 0 && (clearTimeout(u), clearTimeout(o), s({ content: e.responseText || "Network request failed", status: e.status, isTimedOut: false })); 37582 }, e.onload = () => { 37583 clearTimeout(u), clearTimeout(o), s({ content: e.responseText, status: e.status, isTimedOut: false }); 37584 }, e.send(t.data); 37585 }); 37586 } 37587 return { send: r }; 37588} 37589
vendor: 6,006 bytes, lines 37590-37790
37590// node_modules/algoliasearch/dist/lite/builds/browser.js 37591var apiClientVersion = "5.49.0"; 37592function getDefaultHosts(appId) { 37593 return [ 37594 { 37595 url: `${appId}-dsn.algolia.net`, 37596 accept: "read", 37597 protocol: "https" 37598 }, 37599 { 37600 url: `${appId}.algolia.net`, 37601 accept: "write", 37602 protocol: "https" 37603 } 37604 ].concat(shuffle2([ 37605 { 37606 url: `${appId}-1.algolianet.com`, 37607 accept: "readWrite", 37608 protocol: "https" 37609 }, 37610 { 37611 url: `${appId}-2.algolianet.com`, 37612 accept: "readWrite", 37613 protocol: "https" 37614 }, 37615 { 37616 url: `${appId}-3.algolianet.com`, 37617 accept: "readWrite", 37618 protocol: "https" 37619 } 37620 ])); 37621} 37622function createLiteClient({ 37623 appId: appIdOption, 37624 apiKey: apiKeyOption, 37625 authMode, 37626 algoliaAgents, 37627 ...options2 37628}) { 37629 const auth = createAuth(appIdOption, apiKeyOption, authMode); 37630 const transporter = createTransporter({ 37631 hosts: getDefaultHosts(appIdOption), 37632 ...options2, 37633 algoliaAgent: getAlgoliaAgent({ 37634 algoliaAgents, 37635 client: "Lite", 37636 version: apiClientVersion 37637 }), 37638 baseHeaders: { 37639 "content-type": "text/plain", 37640 ...auth.headers(), 37641 ...options2.baseHeaders 37642 }, 37643 baseQueryParameters: { 37644 ...auth.queryParameters(), 37645 ...options2.baseQueryParameters 37646 } 37647 }); 37648 return { 37649 transporter, 37650 appId: appIdOption, 37651 apiKey: apiKeyOption, 37652 clearCache() { 37653 return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => { 37654 return; 37655 }); 37656 }, 37657 get _ua() { 37658 return transporter.algoliaAgent.value; 37659 }, 37660 addAlgoliaAgent(segment, version) { 37661 transporter.algoliaAgent.add({ segment, version }); 37662 }, 37663 setClientApiKey({ apiKey }) { 37664 if (!authMode || authMode === "WithinHeaders") { 37665 transporter.baseHeaders["x-algolia-api-key"] = apiKey; 37666 } else { 37667 transporter.baseQueryParameters["x-algolia-api-key"] = apiKey; 37668 } 37669 }, 37670 searchForHits(searchMethodParams, requestOptions) { 37671 return this.search(searchMethodParams, requestOptions); 37672 }, 37673 searchForFacets(searchMethodParams, requestOptions) { 37674 return this.search(searchMethodParams, requestOptions); 37675 }, 37676 customPost({ path, parameters, body }, requestOptions) { 37677 if (!path) { 37678 throw new Error("Parameter `path` is required when calling `customPost`."); 37679 } 37680 const requestPath = "/{path}".replace("{path}", path); 37681 const headers = {}; 37682 const queryParameters = parameters ? parameters : {}; 37683 const request = { 37684 method: "POST", 37685 path: requestPath, 37686 queryParameters, 37687 headers, 37688 data: body ? body : {} 37689 }; 37690 return transporter.request(request, requestOptions); 37691 }, 37692 getRecommendations(getRecommendationsParams, requestOptions) { 37693 if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) { 37694 const newSignatureRequest = { 37695 requests: getRecommendationsParams 37696 }; 37697 getRecommendationsParams = newSignatureRequest; 37698 } 37699 if (!getRecommendationsParams) { 37700 throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`."); 37701 } 37702 if (!getRecommendationsParams.requests) { 37703 throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`."); 37704 } 37705 const requestPath = "/1/indexes/*/recommendations"; 37706 const headers = {}; 37707 const queryParameters = {}; 37708 const request = { 37709 method: "POST", 37710 path: requestPath, 37711 queryParameters, 37712 headers, 37713 data: getRecommendationsParams, 37714 useReadTransporter: true, 37715 cacheable: true 37716 }; 37717 return transporter.request(request, requestOptions); 37718 }, 37719 search(searchMethodParams, requestOptions) { 37720 if (searchMethodParams && Array.isArray(searchMethodParams)) { 37721 const newSignatureRequest = { 37722 requests: searchMethodParams.map(({ params, ...legacyRequest }) => { 37723 if (legacyRequest.type === "facet") { 37724 return { 37725 ...legacyRequest, 37726 ...params, 37727 type: "facet" 37728 }; 37729 } 37730 return { 37731 ...legacyRequest, 37732 ...params, 37733 facet: undefined, 37734 maxFacetHits: undefined, 37735 facetQuery: undefined 37736 }; 37737 }) 37738 }; 37739 searchMethodParams = newSignatureRequest; 37740 } 37741 if (!searchMethodParams) { 37742 throw new Error("Parameter `searchMethodParams` is required when calling `search`."); 37743 } 37744 if (!searchMethodParams.requests) { 37745 throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`."); 37746 } 37747 const requestPath = "/1/indexes/*/queries"; 37748 const headers = {}; 37749 const queryParameters = {}; 37750 const request = { 37751 method: "POST", 37752 path: requestPath, 37753 queryParameters, 37754 headers, 37755 data: searchMethodParams, 37756 useReadTransporter: true, 37757 cacheable: true 37758 }; 37759 return transporter.request(request, requestOptions); 37760 } 37761 }; 37762} 37763function liteClient(appId, apiKey, options2) { 37764 if (!appId || typeof appId !== "string") { 37765 throw new Error("`appId` is missing."); 37766 } 37767 if (!apiKey || typeof apiKey !== "string") { 37768 throw new Error("`apiKey` is missing."); 37769 } 37770 return createLiteClient({ 37771 appId, 37772 apiKey, 37773 timeouts: { 37774 connect: 1000, 37775 read: 2000, 37776 write: 30000 37777 }, 37778 logger: createNullLogger(), 37779 requester: m2(), 37780 algoliaAgents: [{ segment: "Browser" }], 37781 authMode: "WithinQueryParameters", 37782 responsesCache: createMemoryCache(), 37783 requestsCache: createMemoryCache({ serializable: false }), 37784 hostsCache: createFallbackableCache({ 37785 caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()] 37786 }), 37787 ...options2 37788 }); 37789} 37790
vendor: 147 bytes, lines 37791-37797
37791// node_modules/@algolia/autocomplete-shared/dist/esm/createRef.js 37792function createRef(initialValue) { 37793 return { 37794 current: initialValue 37795 }; 37796} 37797
vendor: 441 bytes, lines 37798-37813
37798// node_modules/@algolia/autocomplete-shared/dist/esm/debounce.js 37799function debounce3(fn2, time) { 37800 var timerId = undefined; 37801 return function() { 37802 for (var _len = arguments.length, args2 = new Array(_len), _key = 0;_key < _len; _key++) { 37803 args2[_key] = arguments[_key]; 37804 } 37805 if (timerId) { 37806 clearTimeout(timerId); 37807 } 37808 timerId = setTimeout(function() { 37809 return fn2.apply(undefined, args2); 37810 }, time); 37811 }; 37812} 37813
vendor: 2,819 bytes, lines 37814-37899
37814// node_modules/@algolia/autocomplete-shared/dist/esm/decycle.js 37815function _slicedToArray(arr, i) { 37816 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); 37817} 37818function _nonIterableRest() { 37819 throw new TypeError(`Invalid attempt to destructure non-iterable instance. 37820In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 37821} 37822function _unsupportedIterableToArray(o, minLen) { 37823 if (!o) 37824 return; 37825 if (typeof o === "string") 37826 return _arrayLikeToArray(o, minLen); 37827 var n = Object.prototype.toString.call(o).slice(8, -1); 37828 if (n === "Object" && o.constructor) 37829 n = o.constructor.name; 37830 if (n === "Map" || n === "Set") 37831 return Array.from(o); 37832 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 37833 return _arrayLikeToArray(o, minLen); 37834} 37835function _arrayLikeToArray(arr, len) { 37836 if (len == null || len > arr.length) 37837 len = arr.length; 37838 for (var i = 0, arr2 = new Array(len);i < len; i++) 37839 arr2[i] = arr[i]; 37840 return arr2; 37841} 37842function _iterableToArrayLimit(arr, i) { 37843 var _i = arr == null ? null : typeof Symbol != "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; 37844 if (_i != null) { 37845 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 37846 try { 37847 if (_x = (_i = _i.call(arr)).next, i === 0) { 37848 if (Object(_i) !== _i) 37849 return; 37850 _n = false; 37851 } else 37852 for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true) 37853 ; 37854 } catch (err) { 37855 _d = true, _e = err; 37856 } finally { 37857 try { 37858 if (!_n && _i.return != null && (_r = _i.return(), Object(_r) !== _r)) 37859 return; 37860 } finally { 37861 if (_d) 37862 throw _e; 37863 } 37864 } 37865 return _arr; 37866 } 37867} 37868function _arrayWithHoles(arr) { 37869 if (Array.isArray(arr)) 37870 return arr; 37871} 37872function _typeof(obj2) { 37873 "@babel/helpers - typeof"; 37874 return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 37875 return typeof obj2; 37876 } : function(obj2) { 37877 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 37878 }, _typeof(obj2); 37879} 37880function decycle(obj2) { 37881 var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set; 37882 if (!obj2 || _typeof(obj2) !== "object") { 37883 return obj2; 37884 } 37885 if (seen.has(obj2)) { 37886 return "[Circular]"; 37887 } 37888 var newSeen = seen.add(obj2); 37889 if (Array.isArray(obj2)) { 37890 return obj2.map(function(x) { 37891 return decycle(x, newSeen); 37892 }); 37893 } 37894 return Object.fromEntries(Object.entries(obj2).map(function(_ref) { 37895 var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; 37896 return [key, decycle(value, newSeen)]; 37897 })); 37898} 37899
vendor: 169 bytes, lines 37900-37906
37900// node_modules/@algolia/autocomplete-shared/dist/esm/flatten.js 37901function flatten(values) { 37902 return values.reduce(function(a, b) { 37903 return a.concat(b); 37904 }, []); 37905} 37906
vendor: 194 bytes, lines 37907-37912
37907// node_modules/@algolia/autocomplete-shared/dist/esm/generateAutocompleteId.js 37908var autocompleteId = 0; 37909function generateAutocompleteId() { 37910 return "autocomplete-".concat(autocompleteId++); 37911} 37912
vendor: 229 bytes, lines 37913-37919
37913// node_modules/@algolia/autocomplete-shared/dist/esm/getAttributeValueByPath.js 37914function getAttributeValueByPath(record, path) { 37915 return path.reduce(function(current, key) { 37916 return current && current[key]; 37917 }, record); 37918} 37919
vendor: 277 bytes, lines 37920-37929
37920// node_modules/@algolia/autocomplete-shared/dist/esm/getItemsCount.js 37921function getItemsCount(state) { 37922 if (state.collections.length === 0) { 37923 return 0; 37924 } 37925 return state.collections.reduce(function(sum, collection) { 37926 return sum + collection.items.length; 37927 }, 0); 37928} 37929
vendor: 251 bytes, lines 37930-37937
37930// node_modules/@algolia/autocomplete-shared/dist/esm/invariant.js 37931function invariant(condition, message) { 37932 if (false) {} 37933 if (!condition) { 37934 throw new Error("[Autocomplete] ".concat(typeof message === "function" ? message() : message)); 37935 } 37936} 37937
vendor: 710 bytes, lines 37938-37963
37938// node_modules/@algolia/autocomplete-shared/dist/esm/isEqual.js 37939function isPrimitive(obj2) { 37940 return obj2 !== Object(obj2); 37941} 37942function isEqual(first, second) { 37943 if (first === second) { 37944 return true; 37945 } 37946 if (isPrimitive(first) || isPrimitive(second) || typeof first === "function" || typeof second === "function") { 37947 return first === second; 37948 } 37949 if (Object.keys(first).length !== Object.keys(second).length) { 37950 return false; 37951 } 37952 for (var _i = 0, _Object$keys = Object.keys(first);_i < _Object$keys.length; _i++) { 37953 var key = _Object$keys[_i]; 37954 if (!(key in second)) { 37955 return false; 37956 } 37957 if (!isEqual(first[key], second[key])) { 37958 return false; 37959 } 37960 } 37961 return true; 37962} 37963
vendor: 94 bytes, lines 37964-37966
37964// node_modules/@algolia/autocomplete-shared/dist/esm/noop.js 37965var noop = function noop() {}; 37966
vendor: 215 bytes, lines 37967-37976
37967// node_modules/@algolia/autocomplete-shared/dist/esm/safelyRunOnBrowser.js 37968function safelyRunOnBrowser(callback) { 37969 if (typeof window !== "undefined") { 37970 return callback({ 37971 window 37972 }); 37973 } 37974 return; 37975} 37976
vendor: 90 bytes, lines 37977-37979
37977// node_modules/@algolia/autocomplete-shared/dist/esm/version.js 37978var version = "1.19.6"; 37979
vendor: 135 bytes, lines 37980-37985
37980// node_modules/@algolia/autocomplete-shared/dist/esm/userAgents.js 37981var userAgents = [{ 37982 segment: "autocomplete-core", 37983 version 37984}]; 37985
vendor: 434 bytes, lines 37986-38002
37986// node_modules/@algolia/autocomplete-shared/dist/esm/warn.js 37987var warnCache = { 37988 current: {} 37989}; 37990function warn2(condition, message) { 37991 if (false) {} 37992 if (condition) { 37993 return; 37994 } 37995 var sanitizedMessage = message.trim(); 37996 var hasAlreadyPrinted = warnCache.current[sanitizedMessage]; 37997 if (!hasAlreadyPrinted) { 37998 warnCache.current[sanitizedMessage] = true; 37999 console.warn("[Autocomplete] ".concat(sanitizedMessage)); 38000 } 38001} 38002
vendor: 483 bytes, lines 38003-38016
38003// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createClickedEvent.js 38004function createClickedEvent(_ref) { 38005 var { item, items: _ref$items } = _ref, items = _ref$items === undefined ? [] : _ref$items; 38006 return { 38007 index: item.__autocomplete_indexName, 38008 items: [item], 38009 positions: [1 + items.findIndex(function(x) { 38010 return x.objectID === item.objectID; 38011 })], 38012 queryID: item.__autocomplete_queryID, 38013 algoliaSource: ["autocomplete"] 38014 }; 38015} 38016
vendor: 2,270 bytes, lines 38017-38082
38017// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/isModernInsightsClient.js 38018function _slicedToArray2(arr, i) { 38019 return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i) || _unsupportedIterableToArray2(arr, i) || _nonIterableRest2(); 38020} 38021function _nonIterableRest2() { 38022 throw new TypeError(`Invalid attempt to destructure non-iterable instance. 38023In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 38024} 38025function _unsupportedIterableToArray2(o, minLen) { 38026 if (!o) 38027 return; 38028 if (typeof o === "string") 38029 return _arrayLikeToArray2(o, minLen); 38030 var n = Object.prototype.toString.call(o).slice(8, -1); 38031 if (n === "Object" && o.constructor) 38032 n = o.constructor.name; 38033 if (n === "Map" || n === "Set") 38034 return Array.from(o); 38035 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 38036 return _arrayLikeToArray2(o, minLen); 38037} 38038function _arrayLikeToArray2(arr, len) { 38039 if (len == null || len > arr.length) 38040 len = arr.length; 38041 for (var i = 0, arr2 = new Array(len);i < len; i++) 38042 arr2[i] = arr[i]; 38043 return arr2; 38044} 38045function _iterableToArrayLimit2(arr, i) { 38046 var _i = arr == null ? null : typeof Symbol != "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; 38047 if (_i != null) { 38048 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 38049 try { 38050 if (_x = (_i = _i.call(arr)).next, i === 0) { 38051 if (Object(_i) !== _i) 38052 return; 38053 _n = false; 38054 } else 38055 for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true) 38056 ; 38057 } catch (err) { 38058 _d = true, _e = err; 38059 } finally { 38060 try { 38061 if (!_n && _i.return != null && (_r = _i.return(), Object(_r) !== _r)) 38062 return; 38063 } finally { 38064 if (_d) 38065 throw _e; 38066 } 38067 } 38068 return _arr; 38069 } 38070} 38071function _arrayWithHoles2(arr) { 38072 if (Array.isArray(arr)) 38073 return arr; 38074} 38075function isModernInsightsClient(client) { 38076 var _split$map = (client.version || "").split(".").map(Number), _split$map2 = _slicedToArray2(_split$map, 2), major = _split$map2[0], minor = _split$map2[1]; 38077 var v3 = major >= 3; 38078 var v2_4 = major === 2 && minor >= 4; 38079 var v1_10 = major === 1 && minor >= 10; 38080 return v3 || v2_4 || v1_10; 38081} 38082
vendor: 9,694 bytes, lines 38083-38339
38083// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createSearchInsightsApi.js 38084var _excluded = ["items"]; 38085var _excluded2 = ["items"]; 38086function _typeof2(obj2) { 38087 "@babel/helpers - typeof"; 38088 return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 38089 return typeof obj2; 38090 } : function(obj2) { 38091 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 38092 }, _typeof2(obj2); 38093} 38094function _toConsumableArray(arr) { 38095 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray3(arr) || _nonIterableSpread(); 38096} 38097function _nonIterableSpread() { 38098 throw new TypeError(`Invalid attempt to spread non-iterable instance. 38099In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 38100} 38101function _unsupportedIterableToArray3(o, minLen) { 38102 if (!o) 38103 return; 38104 if (typeof o === "string") 38105 return _arrayLikeToArray3(o, minLen); 38106 var n = Object.prototype.toString.call(o).slice(8, -1); 38107 if (n === "Object" && o.constructor) 38108 n = o.constructor.name; 38109 if (n === "Map" || n === "Set") 38110 return Array.from(o); 38111 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 38112 return _arrayLikeToArray3(o, minLen); 38113} 38114function _iterableToArray(iter) { 38115 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 38116 return Array.from(iter); 38117} 38118function _arrayWithoutHoles(arr) { 38119 if (Array.isArray(arr)) 38120 return _arrayLikeToArray3(arr); 38121} 38122function _arrayLikeToArray3(arr, len) { 38123 if (len == null || len > arr.length) 38124 len = arr.length; 38125 for (var i = 0, arr2 = new Array(len);i < len; i++) 38126 arr2[i] = arr[i]; 38127 return arr2; 38128} 38129function _objectWithoutProperties(source, excluded) { 38130 if (source == null) 38131 return {}; 38132 var target = _objectWithoutPropertiesLoose(source, excluded); 38133 var key, i; 38134 if (Object.getOwnPropertySymbols) { 38135 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 38136 for (i = 0;i < sourceSymbolKeys.length; i++) { 38137 key = sourceSymbolKeys[i]; 38138 if (excluded.indexOf(key) >= 0) 38139 continue; 38140 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 38141 continue; 38142 target[key] = source[key]; 38143 } 38144 } 38145 return target; 38146} 38147function _objectWithoutPropertiesLoose(source, excluded) { 38148 if (source == null) 38149 return {}; 38150 var target = {}; 38151 var sourceKeys = Object.keys(source); 38152 var key, i; 38153 for (i = 0;i < sourceKeys.length; i++) { 38154 key = sourceKeys[i]; 38155 if (excluded.indexOf(key) >= 0) 38156 continue; 38157 target[key] = source[key]; 38158 } 38159 return target; 38160} 38161function ownKeys(object, enumerableOnly) { 38162 var keys = Object.keys(object); 38163 if (Object.getOwnPropertySymbols) { 38164 var symbols = Object.getOwnPropertySymbols(object); 38165 enumerableOnly && (symbols = symbols.filter(function(sym) { 38166 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 38167 })), keys.push.apply(keys, symbols); 38168 } 38169 return keys; 38170} 38171function _objectSpread(target) { 38172 for (var i = 1;i < arguments.length; i++) { 38173 var source = arguments[i] != null ? arguments[i] : {}; 38174 i % 2 ? ownKeys(Object(source), true).forEach(function(key) { 38175 _defineProperty(target, key, source[key]); 38176 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { 38177 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 38178 }); 38179 } 38180 return target; 38181} 38182function _defineProperty(obj2, key, value) { 38183 key = _toPropertyKey(key); 38184 if (key in obj2) { 38185 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 38186 } else { 38187 obj2[key] = value; 38188 } 38189 return obj2; 38190} 38191function _toPropertyKey(arg) { 38192 var key = _toPrimitive(arg, "string"); 38193 return _typeof2(key) === "symbol" ? key : String(key); 38194} 38195function _toPrimitive(input, hint) { 38196 if (_typeof2(input) !== "object" || input === null) 38197 return input; 38198 var prim = input[Symbol.toPrimitive]; 38199 if (prim !== undefined) { 38200 var res = prim.call(input, hint || "default"); 38201 if (_typeof2(res) !== "object") 38202 return res; 38203 throw new TypeError("@@toPrimitive must return a primitive value."); 38204 } 38205 return (hint === "string" ? String : Number)(input); 38206} 38207function chunk(item) { 38208 var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20; 38209 var chunks = []; 38210 for (var i = 0;i < item.objectIDs.length; i += chunkSize) { 38211 chunks.push(_objectSpread(_objectSpread({}, item), {}, { 38212 objectIDs: item.objectIDs.slice(i, i + chunkSize) 38213 })); 38214 } 38215 return chunks; 38216} 38217function mapToInsightsParamsApi(params) { 38218 return params.map(function(_ref) { 38219 var items = _ref.items, param = _objectWithoutProperties(_ref, _excluded); 38220 return _objectSpread(_objectSpread({}, param), {}, { 38221 objectIDs: (items === null || items === undefined ? undefined : items.map(function(_ref2) { 38222 var objectID = _ref2.objectID; 38223 return objectID; 38224 })) || param.objectIDs 38225 }); 38226 }); 38227} 38228function createSearchInsightsApi(searchInsights) { 38229 var canSendHeaders = isModernInsightsClient(searchInsights); 38230 function sendToInsights(method, payloads, items) { 38231 if (canSendHeaders && typeof items !== "undefined") { 38232 var _items$0$__autocomple = items[0].__autocomplete_algoliaCredentials, { appId, apiKey } = _items$0$__autocomple; 38233 var headers = { 38234 "X-Algolia-Application-Id": appId, 38235 "X-Algolia-API-Key": apiKey 38236 }; 38237 searchInsights.apply(undefined, [method].concat(_toConsumableArray(payloads), [{ 38238 headers 38239 }])); 38240 } else { 38241 searchInsights.apply(undefined, [method].concat(_toConsumableArray(payloads))); 38242 } 38243 } 38244 return { 38245 init: function init(appId, apiKey) { 38246 searchInsights("init", { 38247 appId, 38248 apiKey 38249 }); 38250 }, 38251 setAuthenticatedUserToken: function setAuthenticatedUserToken(authenticatedUserToken) { 38252 searchInsights("setAuthenticatedUserToken", authenticatedUserToken); 38253 }, 38254 setUserToken: function setUserToken(userToken) { 38255 searchInsights("setUserToken", userToken); 38256 }, 38257 clickedObjectIDsAfterSearch: function clickedObjectIDsAfterSearch() { 38258 for (var _len = arguments.length, params = new Array(_len), _key = 0;_key < _len; _key++) { 38259 params[_key] = arguments[_key]; 38260 } 38261 if (params.length > 0) { 38262 sendToInsights("clickedObjectIDsAfterSearch", mapToInsightsParamsApi(params), params[0].items); 38263 } 38264 }, 38265 clickedObjectIDs: function clickedObjectIDs() { 38266 for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0;_key2 < _len2; _key2++) { 38267 params[_key2] = arguments[_key2]; 38268 } 38269 if (params.length > 0) { 38270 sendToInsights("clickedObjectIDs", mapToInsightsParamsApi(params), params[0].items); 38271 } 38272 }, 38273 clickedFilters: function clickedFilters() { 38274 for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0;_key3 < _len3; _key3++) { 38275 params[_key3] = arguments[_key3]; 38276 } 38277 if (params.length > 0) { 38278 searchInsights.apply(undefined, ["clickedFilters"].concat(params)); 38279 } 38280 }, 38281 convertedObjectIDsAfterSearch: function convertedObjectIDsAfterSearch() { 38282 for (var _len4 = arguments.length, params = new Array(_len4), _key4 = 0;_key4 < _len4; _key4++) { 38283 params[_key4] = arguments[_key4]; 38284 } 38285 if (params.length > 0) { 38286 sendToInsights("convertedObjectIDsAfterSearch", mapToInsightsParamsApi(params), params[0].items); 38287 } 38288 }, 38289 convertedObjectIDs: function convertedObjectIDs() { 38290 for (var _len5 = arguments.length, params = new Array(_len5), _key5 = 0;_key5 < _len5; _key5++) { 38291 params[_key5] = arguments[_key5]; 38292 } 38293 if (params.length > 0) { 38294 sendToInsights("convertedObjectIDs", mapToInsightsParamsApi(params), params[0].items); 38295 } 38296 }, 38297 convertedFilters: function convertedFilters() { 38298 for (var _len6 = arguments.length, params = new Array(_len6), _key6 = 0;_key6 < _len6; _key6++) { 38299 params[_key6] = arguments[_key6]; 38300 } 38301 if (params.length > 0) { 38302 searchInsights.apply(undefined, ["convertedFilters"].concat(params)); 38303 } 38304 }, 38305 viewedObjectIDs: function viewedObjectIDs() { 38306 for (var _len7 = arguments.length, params = new Array(_len7), _key7 = 0;_key7 < _len7; _key7++) { 38307 params[_key7] = arguments[_key7]; 38308 } 38309 if (params.length > 0) { 38310 params.reduce(function(acc, _ref3) { 38311 var items = _ref3.items, param = _objectWithoutProperties(_ref3, _excluded2); 38312 return [].concat(_toConsumableArray(acc), _toConsumableArray(chunk(_objectSpread(_objectSpread({}, param), {}, { 38313 objectIDs: (items === null || items === undefined ? undefined : items.map(function(_ref4) { 38314 var objectID = _ref4.objectID; 38315 return objectID; 38316 })) || param.objectIDs 38317 })).map(function(payload) { 38318 return { 38319 items, 38320 payload 38321 }; 38322 }))); 38323 }, []).forEach(function(_ref5) { 38324 var { items, payload } = _ref5; 38325 return sendToInsights("viewedObjectIDs", [payload], items); 38326 }); 38327 } 38328 }, 38329 viewedFilters: function viewedFilters() { 38330 for (var _len8 = arguments.length, params = new Array(_len8), _key8 = 0;_key8 < _len8; _key8++) { 38331 params[_key8] = arguments[_key8]; 38332 } 38333 if (params.length > 0) { 38334 searchInsights.apply(undefined, ["viewedFilters"].concat(params)); 38335 } 38336 } 38337 }; 38338} 38339
vendor: 693 bytes, lines 38340-38357
38340// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createViewedEvents.js 38341function createViewedEvents(_ref) { 38342 var items = _ref.items; 38343 var itemsByIndexName = items.reduce(function(acc, current) { 38344 var _acc$current$__autoco; 38345 acc[current.__autocomplete_indexName] = ((_acc$current$__autoco = acc[current.__autocomplete_indexName]) !== null && _acc$current$__autoco !== undefined ? _acc$current$__autoco : []).concat(current); 38346 return acc; 38347 }, {}); 38348 return Object.keys(itemsByIndexName).map(function(indexName) { 38349 var items = itemsByIndexName[indexName]; 38350 return { 38351 index: indexName, 38352 items, 38353 algoliaSource: ["autocomplete"] 38354 }; 38355 }); 38356} 38357
vendor: 220 bytes, lines 38358-38362
38358// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/isAlgoliaInsightsHit.js 38359function isAlgoliaInsightsHit(hit) { 38360 return hit.objectID && hit.__autocomplete_indexName && hit.__autocomplete_queryID; 38361} 38362
vendor: 10,257 bytes, lines 38363-38648
38363// node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createAlgoliaInsightsPlugin.js 38364function _typeof3(obj2) { 38365 "@babel/helpers - typeof"; 38366 return _typeof3 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 38367 return typeof obj2; 38368 } : function(obj2) { 38369 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 38370 }, _typeof3(obj2); 38371} 38372function _toConsumableArray2(arr) { 38373 return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray4(arr) || _nonIterableSpread2(); 38374} 38375function _nonIterableSpread2() { 38376 throw new TypeError(`Invalid attempt to spread non-iterable instance. 38377In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 38378} 38379function _unsupportedIterableToArray4(o, minLen) { 38380 if (!o) 38381 return; 38382 if (typeof o === "string") 38383 return _arrayLikeToArray4(o, minLen); 38384 var n = Object.prototype.toString.call(o).slice(8, -1); 38385 if (n === "Object" && o.constructor) 38386 n = o.constructor.name; 38387 if (n === "Map" || n === "Set") 38388 return Array.from(o); 38389 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 38390 return _arrayLikeToArray4(o, minLen); 38391} 38392function _iterableToArray2(iter) { 38393 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 38394 return Array.from(iter); 38395} 38396function _arrayWithoutHoles2(arr) { 38397 if (Array.isArray(arr)) 38398 return _arrayLikeToArray4(arr); 38399} 38400function _arrayLikeToArray4(arr, len) { 38401 if (len == null || len > arr.length) 38402 len = arr.length; 38403 for (var i = 0, arr2 = new Array(len);i < len; i++) 38404 arr2[i] = arr[i]; 38405 return arr2; 38406} 38407function ownKeys2(object, enumerableOnly) { 38408 var keys = Object.keys(object); 38409 if (Object.getOwnPropertySymbols) { 38410 var symbols = Object.getOwnPropertySymbols(object); 38411 enumerableOnly && (symbols = symbols.filter(function(sym) { 38412 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 38413 })), keys.push.apply(keys, symbols); 38414 } 38415 return keys; 38416} 38417function _objectSpread2(target) { 38418 for (var i = 1;i < arguments.length; i++) { 38419 var source = arguments[i] != null ? arguments[i] : {}; 38420 i % 2 ? ownKeys2(Object(source), true).forEach(function(key) { 38421 _defineProperty2(target, key, source[key]); 38422 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key) { 38423 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 38424 }); 38425 } 38426 return target; 38427} 38428function _defineProperty2(obj2, key, value) { 38429 key = _toPropertyKey2(key); 38430 if (key in obj2) { 38431 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 38432 } else { 38433 obj2[key] = value; 38434 } 38435 return obj2; 38436} 38437function _toPropertyKey2(arg) { 38438 var key = _toPrimitive2(arg, "string"); 38439 return _typeof3(key) === "symbol" ? key : String(key); 38440} 38441function _toPrimitive2(input, hint) { 38442 if (_typeof3(input) !== "object" || input === null) 38443 return input; 38444 var prim = input[Symbol.toPrimitive]; 38445 if (prim !== undefined) { 38446 var res = prim.call(input, hint || "default"); 38447 if (_typeof3(res) !== "object") 38448 return res; 38449 throw new TypeError("@@toPrimitive must return a primitive value."); 38450 } 38451 return (hint === "string" ? String : Number)(input); 38452} 38453var VIEW_EVENT_DELAY = 400; 38454var ALGOLIA_INSIGHTS_VERSION = "2.15.0"; 38455var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js"); 38456var sendViewedObjectIDs = debounce3(function(_ref) { 38457 var { onItemsChange, items, insights, state } = _ref; 38458 onItemsChange({ 38459 insights, 38460 insightsEvents: createViewedEvents({ 38461 items 38462 }).map(function(event) { 38463 return _objectSpread2({ 38464 eventName: "Items Viewed" 38465 }, event); 38466 }), 38467 state 38468 }); 38469}, VIEW_EVENT_DELAY); 38470function createAlgoliaInsightsPlugin(options2) { 38471 var _getOptions = getOptions(options2), { insightsClient: providedInsightsClient, insightsInitParams, onItemsChange, onSelect: onSelectEvent, onActive: onActiveEvent, __autocomplete_clickAnalytics } = _getOptions; 38472 var insightsClient = providedInsightsClient; 38473 if (!providedInsightsClient) { 38474 safelyRunOnBrowser(function(_ref2) { 38475 var window2 = _ref2.window; 38476 var pointer = window2.AlgoliaAnalyticsObject || "aa"; 38477 if (typeof pointer === "string") { 38478 insightsClient = window2[pointer]; 38479 } 38480 if (!insightsClient) { 38481 window2.AlgoliaAnalyticsObject = pointer; 38482 if (!window2[pointer]) { 38483 window2[pointer] = function() { 38484 if (!window2[pointer].queue) { 38485 window2[pointer].queue = []; 38486 } 38487 for (var _len = arguments.length, args2 = new Array(_len), _key = 0;_key < _len; _key++) { 38488 args2[_key] = arguments[_key]; 38489 } 38490 window2[pointer].queue.push(args2); 38491 }; 38492 } 38493 window2[pointer].version = ALGOLIA_INSIGHTS_VERSION; 38494 insightsClient = window2[pointer]; 38495 loadInsights(window2); 38496 } 38497 }); 38498 } 38499 if (!insightsClient) { 38500 return {}; 38501 } 38502 if (insightsInitParams) { 38503 insightsClient("init", _objectSpread2({ 38504 partial: true 38505 }, insightsInitParams)); 38506 } 38507 var insights = createSearchInsightsApi(insightsClient); 38508 var previousItems = createRef([]); 38509 var debouncedOnStateChange = debounce3(function(_ref3) { 38510 var state = _ref3.state; 38511 if (!state.isOpen) { 38512 return; 38513 } 38514 var items = state.collections.reduce(function(acc, current) { 38515 return [].concat(_toConsumableArray2(acc), _toConsumableArray2(current.items)); 38516 }, []).filter(isAlgoliaInsightsHit); 38517 if (!isEqual(previousItems.current.map(function(x) { 38518 return x.objectID; 38519 }), items.map(function(x) { 38520 return x.objectID; 38521 }))) { 38522 previousItems.current = items; 38523 if (items.length > 0) { 38524 sendViewedObjectIDs({ 38525 onItemsChange, 38526 items, 38527 insights, 38528 state 38529 }); 38530 } 38531 } 38532 }, 0); 38533 return { 38534 name: "aa.algoliaInsightsPlugin", 38535 subscribe: function subscribe(_ref4) { 38536 var { setContext, onSelect, onActive } = _ref4; 38537 function setInsightsContext(userToken) { 38538 setContext({ 38539 algoliaInsightsPlugin: { 38540 __algoliaSearchParameters: _objectSpread2(_objectSpread2({}, __autocomplete_clickAnalytics ? { 38541 clickAnalytics: true 38542 } : {}), userToken ? { 38543 userToken: normalizeUserToken(userToken) 38544 } : {}), 38545 insights 38546 } 38547 }); 38548 } 38549 insightsClient("addAlgoliaAgent", "insights-plugin"); 38550 setInsightsContext(); 38551 insightsClient("onUserTokenChange", function(userToken) { 38552 setInsightsContext(userToken); 38553 }); 38554 insightsClient("getUserToken", null, function(_error, userToken) { 38555 setInsightsContext(userToken); 38556 }); 38557 onSelect(function(_ref5) { 38558 var { item, state, event, source } = _ref5; 38559 if (!isAlgoliaInsightsHit(item)) { 38560 return; 38561 } 38562 onSelectEvent({ 38563 state, 38564 event, 38565 insights, 38566 item, 38567 insightsEvents: [_objectSpread2({ 38568 eventName: "Item Selected" 38569 }, createClickedEvent({ 38570 item, 38571 items: source.getItems().filter(isAlgoliaInsightsHit) 38572 }))] 38573 }); 38574 }); 38575 onActive(function(_ref6) { 38576 var { item, source, state, event } = _ref6; 38577 if (!isAlgoliaInsightsHit(item)) { 38578 return; 38579 } 38580 onActiveEvent({ 38581 state, 38582 event, 38583 insights, 38584 item, 38585 insightsEvents: [_objectSpread2({ 38586 eventName: "Item Active" 38587 }, createClickedEvent({ 38588 item, 38589 items: source.getItems().filter(isAlgoliaInsightsHit) 38590 }))] 38591 }); 38592 }); 38593 }, 38594 onStateChange: function onStateChange(_ref7) { 38595 var state = _ref7.state; 38596 debouncedOnStateChange({ 38597 state 38598 }); 38599 }, 38600 __autocomplete_pluginOptions: options2 38601 }; 38602} 38603function getAlgoliaSources() { 38604 var _context$algoliaInsig; 38605 var algoliaSourceBase = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 38606 var context = arguments.length > 1 ? arguments[1] : undefined; 38607 return [].concat(_toConsumableArray2(algoliaSourceBase), ["autocomplete-internal"], _toConsumableArray2((_context$algoliaInsig = context.algoliaInsightsPlugin) !== null && _context$algoliaInsig !== undefined && _context$algoliaInsig.__automaticInsights ? ["autocomplete-automatic"] : [])); 38608} 38609function getOptions(options2) { 38610 return _objectSpread2({ 38611 onItemsChange: function onItemsChange(_ref8) { 38612 var { insights, insightsEvents, state } = _ref8; 38613 insights.viewedObjectIDs.apply(insights, _toConsumableArray2(insightsEvents.map(function(event) { 38614 return _objectSpread2(_objectSpread2({}, event), {}, { 38615 algoliaSource: getAlgoliaSources(event.algoliaSource, state.context) 38616 }); 38617 }))); 38618 }, 38619 onSelect: function onSelect(_ref9) { 38620 var { insights, insightsEvents, state } = _ref9; 38621 insights.clickedObjectIDsAfterSearch.apply(insights, _toConsumableArray2(insightsEvents.map(function(event) { 38622 return _objectSpread2(_objectSpread2({}, event), {}, { 38623 algoliaSource: getAlgoliaSources(event.algoliaSource, state.context) 38624 }); 38625 }))); 38626 }, 38627 onActive: noop, 38628 __autocomplete_clickAnalytics: true 38629 }, options2); 38630} 38631function loadInsights(environment) { 38632 var errorMessage = "[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete"; 38633 try { 38634 var script = environment.document.createElement("script"); 38635 script.async = true; 38636 script.src = ALGOLIA_INSIGHTS_SRC; 38637 script.onerror = function() { 38638 console.error(errorMessage); 38639 }; 38640 document.body.appendChild(script); 38641 } catch (cause) { 38642 console.error(errorMessage); 38643 } 38644} 38645function normalizeUserToken(userToken) { 38646 return typeof userToken === "number" ? userToken.toString() : userToken; 38647} 38648
vendor: 226 bytes, lines 38649-38653
38649// node_modules/@algolia/autocomplete-core/dist/esm/checkOptions.js 38650function checkOptions(options2) { 38651 warn2(!options2.debug, "The `debug` option is meant for development debugging and should not be used in production."); 38652} 38653
vendor: 1,975 bytes, lines 38654-38717
38654// node_modules/@algolia/autocomplete-core/dist/esm/utils/createCancelablePromise.js 38655function createInternalCancelablePromise(promise, initialState) { 38656 var state = initialState; 38657 return { 38658 then: function then(onfulfilled, onrejected) { 38659 return createInternalCancelablePromise(promise.then(createCallback(onfulfilled, state, promise), createCallback(onrejected, state, promise)), state); 38660 }, 38661 catch: function _catch(onrejected) { 38662 return createInternalCancelablePromise(promise.catch(createCallback(onrejected, state, promise)), state); 38663 }, 38664 finally: function _finally(onfinally) { 38665 if (onfinally) { 38666 state.onCancelList.push(onfinally); 38667 } 38668 return createInternalCancelablePromise(promise.finally(createCallback(onfinally && function() { 38669 state.onCancelList = []; 38670 return onfinally(); 38671 }, state, promise)), state); 38672 }, 38673 cancel: function cancel() { 38674 state.isCanceled = true; 38675 var callbacks = state.onCancelList; 38676 state.onCancelList = []; 38677 callbacks.forEach(function(callback) { 38678 callback(); 38679 }); 38680 }, 38681 isCanceled: function isCanceled() { 38682 return state.isCanceled === true; 38683 } 38684 }; 38685} 38686function createCancelablePromise(executor) { 38687 return createInternalCancelablePromise(new Promise(function(resolve, reject) { 38688 return executor(resolve, reject); 38689 }), { 38690 isCanceled: false, 38691 onCancelList: [] 38692 }); 38693} 38694createCancelablePromise.resolve = function(value) { 38695 return cancelable(Promise.resolve(value)); 38696}; 38697createCancelablePromise.reject = function(reason) { 38698 return cancelable(Promise.reject(reason)); 38699}; 38700function cancelable(promise) { 38701 return createInternalCancelablePromise(promise, { 38702 isCanceled: false, 38703 onCancelList: [] 38704 }); 38705} 38706function createCallback(onResult, state, fallback) { 38707 if (!onResult) { 38708 return fallback; 38709 } 38710 return function callback(arg) { 38711 if (state.isCanceled) { 38712 return arg; 38713 } 38714 return onResult(arg); 38715 }; 38716} 38717
vendor: 1,092 bytes, lines 38718-38754
38718// node_modules/@algolia/autocomplete-core/dist/esm/utils/createCancelablePromiseList.js 38719var _hasWaitPromiseResolved = true; 38720var _waitPromise; 38721function createCancelablePromiseList() { 38722 var list = []; 38723 return { 38724 add: function add(cancelablePromise) { 38725 list.push(cancelablePromise); 38726 return cancelablePromise.finally(function() { 38727 list = list.filter(function(item) { 38728 return item !== cancelablePromise; 38729 }); 38730 }); 38731 }, 38732 cancelAll: function cancelAll() { 38733 list.forEach(function(promise) { 38734 return promise.cancel(); 38735 }); 38736 }, 38737 isEmpty: function isEmpty() { 38738 return list.length === 0; 38739 }, 38740 wait: function wait(timeout) { 38741 if (!_hasWaitPromiseResolved) { 38742 return _waitPromise; 38743 } 38744 _hasWaitPromiseResolved = false; 38745 _waitPromise = !timeout ? Promise.all(list) : Promise.race([Promise.all(list), new Promise(function(resolve) { 38746 return setTimeout(resolve, timeout); 38747 })]); 38748 return _waitPromise.then(function() { 38749 _hasWaitPromiseResolved = true; 38750 }); 38751 } 38752 }; 38753} 38754
vendor: 618 bytes, lines 38755-38773
38755// node_modules/@algolia/autocomplete-core/dist/esm/utils/createConcurrentSafePromise.js 38756function createConcurrentSafePromise() { 38757 var basePromiseId = -1; 38758 var latestResolvedId = -1; 38759 var latestResolvedValue = undefined; 38760 return function runConcurrentSafePromise(promise) { 38761 basePromiseId++; 38762 var currentPromiseId = basePromiseId; 38763 return Promise.resolve(promise).then(function(x) { 38764 if (latestResolvedValue && currentPromiseId < latestResolvedId) { 38765 return latestResolvedValue; 38766 } 38767 latestResolvedId = currentPromiseId; 38768 latestResolvedValue = x; 38769 return x; 38770 }); 38771 }; 38772} 38773
vendor: 558 bytes, lines 38774-38788
38774// node_modules/@algolia/autocomplete-core/dist/esm/utils/getNextActiveItemId.js 38775function getNextActiveItemId(moveAmount, baseIndex, itemCount, defaultActiveItemId) { 38776 if (!itemCount) { 38777 return null; 38778 } 38779 if (moveAmount < 0 && (baseIndex === null || defaultActiveItemId !== null && baseIndex === 0)) { 38780 return itemCount + moveAmount; 38781 } 38782 var numericIndex = (baseIndex === null ? -1 : baseIndex) + moveAmount; 38783 if (numericIndex <= -1 || numericIndex >= itemCount) { 38784 return defaultActiveItemId === null ? null : 0; 38785 } 38786 return numericIndex; 38787} 38788
vendor: 3,698 bytes, lines 38789-38883
38789// node_modules/@algolia/autocomplete-core/dist/esm/utils/getNormalizedSources.js 38790function ownKeys3(object, enumerableOnly) { 38791 var keys = Object.keys(object); 38792 if (Object.getOwnPropertySymbols) { 38793 var symbols = Object.getOwnPropertySymbols(object); 38794 enumerableOnly && (symbols = symbols.filter(function(sym) { 38795 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 38796 })), keys.push.apply(keys, symbols); 38797 } 38798 return keys; 38799} 38800function _objectSpread3(target) { 38801 for (var i = 1;i < arguments.length; i++) { 38802 var source = arguments[i] != null ? arguments[i] : {}; 38803 i % 2 ? ownKeys3(Object(source), true).forEach(function(key) { 38804 _defineProperty3(target, key, source[key]); 38805 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys3(Object(source)).forEach(function(key) { 38806 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 38807 }); 38808 } 38809 return target; 38810} 38811function _defineProperty3(obj2, key, value) { 38812 key = _toPropertyKey3(key); 38813 if (key in obj2) { 38814 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 38815 } else { 38816 obj2[key] = value; 38817 } 38818 return obj2; 38819} 38820function _toPropertyKey3(arg) { 38821 var key = _toPrimitive3(arg, "string"); 38822 return _typeof4(key) === "symbol" ? key : String(key); 38823} 38824function _toPrimitive3(input, hint) { 38825 if (_typeof4(input) !== "object" || input === null) 38826 return input; 38827 var prim = input[Symbol.toPrimitive]; 38828 if (prim !== undefined) { 38829 var res = prim.call(input, hint || "default"); 38830 if (_typeof4(res) !== "object") 38831 return res; 38832 throw new TypeError("@@toPrimitive must return a primitive value."); 38833 } 38834 return (hint === "string" ? String : Number)(input); 38835} 38836function _typeof4(obj2) { 38837 "@babel/helpers - typeof"; 38838 return _typeof4 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 38839 return typeof obj2; 38840 } : function(obj2) { 38841 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 38842 }, _typeof4(obj2); 38843} 38844function getNormalizedSources(getSources, params) { 38845 var seenSourceIds = []; 38846 return Promise.resolve(getSources(params)).then(function(sources) { 38847 invariant(Array.isArray(sources), function() { 38848 return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof4(sources)), `: 38849 38850`).concat(JSON.stringify(decycle(sources), null, 2)); 38851 }); 38852 return Promise.all(sources.filter(function(maybeSource) { 38853 return Boolean(maybeSource); 38854 }).map(function(source) { 38855 invariant(typeof source.sourceId === "string", "A source must provide a `sourceId` string."); 38856 if (seenSourceIds.includes(source.sourceId)) { 38857 throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(source.sourceId), " is not unique.")); 38858 } 38859 seenSourceIds.push(source.sourceId); 38860 var defaultSource = { 38861 getItemInputValue: function getItemInputValue(_ref) { 38862 var state = _ref.state; 38863 return state.query; 38864 }, 38865 getItemUrl: function getItemUrl() { 38866 return; 38867 }, 38868 onSelect: function onSelect(_ref2) { 38869 var setIsOpen = _ref2.setIsOpen; 38870 setIsOpen(false); 38871 }, 38872 onActive: noop, 38873 onResolve: noop 38874 }; 38875 Object.keys(defaultSource).forEach(function(key) { 38876 defaultSource[key].__default = true; 38877 }); 38878 var normalizedSource = _objectSpread3(_objectSpread3({}, defaultSource), source); 38879 return Promise.resolve(normalizedSource); 38880 })); 38881 }); 38882} 38883
vendor: 3,056 bytes, lines 38884-38972
38884// node_modules/@algolia/autocomplete-core/dist/esm/utils/getPluginSubmitPromise.js 38885function _createForOfIteratorHelper(o, allowArrayLike) { 38886 var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; 38887 if (!it) { 38888 if (Array.isArray(o) || (it = _unsupportedIterableToArray5(o)) || allowArrayLike && o && typeof o.length === "number") { 38889 if (it) 38890 o = it; 38891 var i = 0; 38892 var F = function F() {}; 38893 return { s: F, n: function n() { 38894 if (i >= o.length) 38895 return { done: true }; 38896 return { done: false, value: o[i++] }; 38897 }, e: function e(_e) { 38898 throw _e; 38899 }, f: F }; 38900 } 38901 throw new TypeError(`Invalid attempt to iterate non-iterable instance. 38902In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 38903 } 38904 var normalCompletion = true, didErr = false, err; 38905 return { s: function s() { 38906 it = it.call(o); 38907 }, n: function n() { 38908 var step = it.next(); 38909 normalCompletion = step.done; 38910 return step; 38911 }, e: function e(_e2) { 38912 didErr = true; 38913 err = _e2; 38914 }, f: function f() { 38915 try { 38916 if (!normalCompletion && it.return != null) 38917 it.return(); 38918 } finally { 38919 if (didErr) 38920 throw err; 38921 } 38922 } }; 38923} 38924function _unsupportedIterableToArray5(o, minLen) { 38925 if (!o) 38926 return; 38927 if (typeof o === "string") 38928 return _arrayLikeToArray5(o, minLen); 38929 var n = Object.prototype.toString.call(o).slice(8, -1); 38930 if (n === "Object" && o.constructor) 38931 n = o.constructor.name; 38932 if (n === "Map" || n === "Set") 38933 return Array.from(o); 38934 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 38935 return _arrayLikeToArray5(o, minLen); 38936} 38937function _arrayLikeToArray5(arr, len) { 38938 if (len == null || len > arr.length) 38939 len = arr.length; 38940 for (var i = 0, arr2 = new Array(len);i < len; i++) 38941 arr2[i] = arr[i]; 38942 return arr2; 38943} 38944var getPluginSubmitPromise = function getPluginSubmitPromise(plugins, pendingRequests) { 38945 var waitUntilComplete = false; 38946 var timeouts = []; 38947 var _iterator = _createForOfIteratorHelper(plugins), _step; 38948 try { 38949 for (_iterator.s();!(_step = _iterator.n()).done; ) { 38950 var _plugin$__autocomplet, _plugin$__autocomplet2, _plugin$__autocomplet3; 38951 var plugin = _step.value; 38952 var value = (_plugin$__autocomplet = plugin.__autocomplete_pluginOptions) === null || _plugin$__autocomplet === undefined ? undefined : (_plugin$__autocomplet2 = (_plugin$__autocomplet3 = _plugin$__autocomplet).awaitSubmit) === null || _plugin$__autocomplet2 === undefined ? undefined : _plugin$__autocomplet2.call(_plugin$__autocomplet3); 38953 if (typeof value === "number") { 38954 timeouts.push(value); 38955 } else if (value === true) { 38956 waitUntilComplete = true; 38957 break; 38958 } 38959 } 38960 } catch (err) { 38961 _iterator.e(err); 38962 } finally { 38963 _iterator.f(); 38964 } 38965 if (waitUntilComplete) { 38966 return pendingRequests.wait(); 38967 } else if (timeouts.length > 0) { 38968 return pendingRequests.wait(Math.max.apply(Math, timeouts)); 38969 } 38970 return; 38971}; 38972
vendor: 1,605 bytes, lines 38973-39032
38973// node_modules/@algolia/autocomplete-core/dist/esm/utils/getActiveItem.js 38974function getCollectionFromActiveItemId(state) { 38975 var accumulatedCollectionsCount = state.collections.map(function(collections) { 38976 return collections.items.length; 38977 }).reduce(function(acc, collectionsCount, index) { 38978 var previousValue = acc[index - 1] || 0; 38979 var nextValue = previousValue + collectionsCount; 38980 acc.push(nextValue); 38981 return acc; 38982 }, []); 38983 var collectionIndex = accumulatedCollectionsCount.reduce(function(acc, current) { 38984 if (current <= state.activeItemId) { 38985 return acc + 1; 38986 } 38987 return acc; 38988 }, 0); 38989 return state.collections[collectionIndex]; 38990} 38991function getRelativeActiveItemId(_ref) { 38992 var { state, collection } = _ref; 38993 var isOffsetFound = false; 38994 var counter = 0; 38995 var previousItemsOffset = 0; 38996 while (isOffsetFound === false) { 38997 var currentCollection = state.collections[counter]; 38998 if (currentCollection === collection) { 38999 isOffsetFound = true; 39000 break; 39001 } 39002 previousItemsOffset += currentCollection.items.length; 39003 counter++; 39004 } 39005 return state.activeItemId - previousItemsOffset; 39006} 39007function getActiveItem(state) { 39008 var collection = getCollectionFromActiveItemId(state); 39009 if (!collection) { 39010 return null; 39011 } 39012 var item = collection.items[getRelativeActiveItemId({ 39013 state, 39014 collection 39015 })]; 39016 var source = collection.source; 39017 var itemInputValue = source.getItemInputValue({ 39018 item, 39019 state 39020 }); 39021 var itemUrl = source.getItemUrl({ 39022 item, 39023 state 39024 }); 39025 return { 39026 item, 39027 itemInputValue, 39028 itemUrl, 39029 source 39030 }; 39031} 39032
vendor: 330 bytes, lines 39033-39037
39033// node_modules/@algolia/autocomplete-core/dist/esm/utils/getAutocompleteElementId.js 39034function getAutocompleteElementId(autocompleteInstanceId, elementId, source) { 39035 return [autocompleteInstanceId, source === null || source === undefined ? undefined : source.sourceId, elementId].filter(Boolean).join("-").replace(/\s/g, ""); 39036} 39037
vendor: 177 bytes, lines 39038-39042
39038// node_modules/@algolia/autocomplete-core/dist/esm/utils/isOrContainsNode.js 39039function isOrContainsNode(parent, child) { 39040 return parent === child || parent.contains(child); 39041} 39042
vendor: 228 bytes, lines 39043-39048
39043// node_modules/@algolia/autocomplete-core/dist/esm/utils/isSamsung.js 39044var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i; 39045function isSamsung(userAgent) { 39046 return Boolean(userAgent && userAgent.match(regex)); 39047} 39048
vendor: 713 bytes, lines 39049-39072
39049// node_modules/@algolia/autocomplete-core/dist/esm/utils/mapToAlgoliaResponse.js 39050function mapToAlgoliaResponse(rawResults) { 39051 return { 39052 results: rawResults, 39053 hits: rawResults.map(function(result) { 39054 return result.hits; 39055 }).filter(Boolean), 39056 facetHits: rawResults.map(function(result) { 39057 var _facetHits; 39058 return (_facetHits = result.facetHits) === null || _facetHits === undefined ? undefined : _facetHits.map(function(facetHit) { 39059 return { 39060 label: facetHit.value, 39061 count: facetHit.count, 39062 _highlightResult: { 39063 label: { 39064 value: facetHit.highlighted 39065 } 39066 } 39067 }; 39068 }); 39069 }).filter(Boolean) 39070 }; 39071} 39072
vendor: 149 bytes, lines 39073-39077
39073// node_modules/@algolia/autocomplete-core/dist/esm/utils/getNativeEvent.js 39074function getNativeEvent(event) { 39075 return event.nativeEvent || event; 39076} 39077
vendor: 2,644 bytes, lines 39078-39154
39078// node_modules/@algolia/autocomplete-core/dist/esm/createStore.js 39079function _typeof5(obj2) { 39080 "@babel/helpers - typeof"; 39081 return _typeof5 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39082 return typeof obj2; 39083 } : function(obj2) { 39084 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39085 }, _typeof5(obj2); 39086} 39087function ownKeys4(object, enumerableOnly) { 39088 var keys = Object.keys(object); 39089 if (Object.getOwnPropertySymbols) { 39090 var symbols = Object.getOwnPropertySymbols(object); 39091 enumerableOnly && (symbols = symbols.filter(function(sym) { 39092 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39093 })), keys.push.apply(keys, symbols); 39094 } 39095 return keys; 39096} 39097function _objectSpread4(target) { 39098 for (var i = 1;i < arguments.length; i++) { 39099 var source = arguments[i] != null ? arguments[i] : {}; 39100 i % 2 ? ownKeys4(Object(source), true).forEach(function(key) { 39101 _defineProperty4(target, key, source[key]); 39102 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key) { 39103 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39104 }); 39105 } 39106 return target; 39107} 39108function _defineProperty4(obj2, key, value) { 39109 key = _toPropertyKey4(key); 39110 if (key in obj2) { 39111 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39112 } else { 39113 obj2[key] = value; 39114 } 39115 return obj2; 39116} 39117function _toPropertyKey4(arg) { 39118 var key = _toPrimitive4(arg, "string"); 39119 return _typeof5(key) === "symbol" ? key : String(key); 39120} 39121function _toPrimitive4(input, hint) { 39122 if (_typeof5(input) !== "object" || input === null) 39123 return input; 39124 var prim = input[Symbol.toPrimitive]; 39125 if (prim !== undefined) { 39126 var res = prim.call(input, hint || "default"); 39127 if (_typeof5(res) !== "object") 39128 return res; 39129 throw new TypeError("@@toPrimitive must return a primitive value."); 39130 } 39131 return (hint === "string" ? String : Number)(input); 39132} 39133function createStore(reducer, props, onStoreStateChange) { 39134 var state = props.initialState; 39135 return { 39136 getState: function getState() { 39137 return state; 39138 }, 39139 dispatch: function dispatch(action, payload) { 39140 var prevState = _objectSpread4({}, state); 39141 state = reducer(state, { 39142 type: action, 39143 props, 39144 payload 39145 }); 39146 onStoreStateChange({ 39147 state, 39148 prevState 39149 }); 39150 }, 39151 pendingRequests: createCancelablePromiseList() 39152 }; 39153} 39154
vendor: 3,280 bytes, lines 39155-39249
39155// node_modules/@algolia/autocomplete-core/dist/esm/getAutocompleteSetters.js 39156function _typeof6(obj2) { 39157 "@babel/helpers - typeof"; 39158 return _typeof6 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39159 return typeof obj2; 39160 } : function(obj2) { 39161 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39162 }, _typeof6(obj2); 39163} 39164function ownKeys5(object, enumerableOnly) { 39165 var keys = Object.keys(object); 39166 if (Object.getOwnPropertySymbols) { 39167 var symbols = Object.getOwnPropertySymbols(object); 39168 enumerableOnly && (symbols = symbols.filter(function(sym) { 39169 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39170 })), keys.push.apply(keys, symbols); 39171 } 39172 return keys; 39173} 39174function _objectSpread5(target) { 39175 for (var i = 1;i < arguments.length; i++) { 39176 var source = arguments[i] != null ? arguments[i] : {}; 39177 i % 2 ? ownKeys5(Object(source), true).forEach(function(key) { 39178 _defineProperty5(target, key, source[key]); 39179 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key) { 39180 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39181 }); 39182 } 39183 return target; 39184} 39185function _defineProperty5(obj2, key, value) { 39186 key = _toPropertyKey5(key); 39187 if (key in obj2) { 39188 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39189 } else { 39190 obj2[key] = value; 39191 } 39192 return obj2; 39193} 39194function _toPropertyKey5(arg) { 39195 var key = _toPrimitive5(arg, "string"); 39196 return _typeof6(key) === "symbol" ? key : String(key); 39197} 39198function _toPrimitive5(input, hint) { 39199 if (_typeof6(input) !== "object" || input === null) 39200 return input; 39201 var prim = input[Symbol.toPrimitive]; 39202 if (prim !== undefined) { 39203 var res = prim.call(input, hint || "default"); 39204 if (_typeof6(res) !== "object") 39205 return res; 39206 throw new TypeError("@@toPrimitive must return a primitive value."); 39207 } 39208 return (hint === "string" ? String : Number)(input); 39209} 39210function getAutocompleteSetters(_ref) { 39211 var store = _ref.store; 39212 var setActiveItemId = function setActiveItemId(value) { 39213 store.dispatch("setActiveItemId", value); 39214 }; 39215 var setQuery = function setQuery(value) { 39216 store.dispatch("setQuery", value); 39217 }; 39218 var setCollections = function setCollections(rawValue) { 39219 var baseItemId = 0; 39220 var value = rawValue.map(function(collection) { 39221 return _objectSpread5(_objectSpread5({}, collection), {}, { 39222 items: flatten(collection.items).map(function(item) { 39223 return _objectSpread5(_objectSpread5({}, item), {}, { 39224 __autocomplete_id: baseItemId++ 39225 }); 39226 }) 39227 }); 39228 }); 39229 store.dispatch("setCollections", value); 39230 }; 39231 var setIsOpen = function setIsOpen(value) { 39232 store.dispatch("setIsOpen", value); 39233 }; 39234 var setStatus = function setStatus(value) { 39235 store.dispatch("setStatus", value); 39236 }; 39237 var setContext = function setContext(value) { 39238 store.dispatch("setContext", value); 39239 }; 39240 return { 39241 setActiveItemId, 39242 setQuery, 39243 setCollections, 39244 setIsOpen, 39245 setStatus, 39246 setContext 39247 }; 39248} 39249
vendor: 7,906 bytes, lines 39250-39451
39250// node_modules/@algolia/autocomplete-core/dist/esm/getDefaultProps.js 39251function _typeof7(obj2) { 39252 "@babel/helpers - typeof"; 39253 return _typeof7 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39254 return typeof obj2; 39255 } : function(obj2) { 39256 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39257 }, _typeof7(obj2); 39258} 39259function _toConsumableArray3(arr) { 39260 return _arrayWithoutHoles3(arr) || _iterableToArray3(arr) || _unsupportedIterableToArray6(arr) || _nonIterableSpread3(); 39261} 39262function _nonIterableSpread3() { 39263 throw new TypeError(`Invalid attempt to spread non-iterable instance. 39264In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 39265} 39266function _unsupportedIterableToArray6(o, minLen) { 39267 if (!o) 39268 return; 39269 if (typeof o === "string") 39270 return _arrayLikeToArray6(o, minLen); 39271 var n = Object.prototype.toString.call(o).slice(8, -1); 39272 if (n === "Object" && o.constructor) 39273 n = o.constructor.name; 39274 if (n === "Map" || n === "Set") 39275 return Array.from(o); 39276 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 39277 return _arrayLikeToArray6(o, minLen); 39278} 39279function _iterableToArray3(iter) { 39280 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 39281 return Array.from(iter); 39282} 39283function _arrayWithoutHoles3(arr) { 39284 if (Array.isArray(arr)) 39285 return _arrayLikeToArray6(arr); 39286} 39287function _arrayLikeToArray6(arr, len) { 39288 if (len == null || len > arr.length) 39289 len = arr.length; 39290 for (var i = 0, arr2 = new Array(len);i < len; i++) 39291 arr2[i] = arr[i]; 39292 return arr2; 39293} 39294function ownKeys6(object, enumerableOnly) { 39295 var keys = Object.keys(object); 39296 if (Object.getOwnPropertySymbols) { 39297 var symbols = Object.getOwnPropertySymbols(object); 39298 enumerableOnly && (symbols = symbols.filter(function(sym) { 39299 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39300 })), keys.push.apply(keys, symbols); 39301 } 39302 return keys; 39303} 39304function _objectSpread6(target) { 39305 for (var i = 1;i < arguments.length; i++) { 39306 var source = arguments[i] != null ? arguments[i] : {}; 39307 i % 2 ? ownKeys6(Object(source), true).forEach(function(key) { 39308 _defineProperty6(target, key, source[key]); 39309 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys6(Object(source)).forEach(function(key) { 39310 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39311 }); 39312 } 39313 return target; 39314} 39315function _defineProperty6(obj2, key, value) { 39316 key = _toPropertyKey6(key); 39317 if (key in obj2) { 39318 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39319 } else { 39320 obj2[key] = value; 39321 } 39322 return obj2; 39323} 39324function _toPropertyKey6(arg) { 39325 var key = _toPrimitive6(arg, "string"); 39326 return _typeof7(key) === "symbol" ? key : String(key); 39327} 39328function _toPrimitive6(input, hint) { 39329 if (_typeof7(input) !== "object" || input === null) 39330 return input; 39331 var prim = input[Symbol.toPrimitive]; 39332 if (prim !== undefined) { 39333 var res = prim.call(input, hint || "default"); 39334 if (_typeof7(res) !== "object") 39335 return res; 39336 throw new TypeError("@@toPrimitive must return a primitive value."); 39337 } 39338 return (hint === "string" ? String : Number)(input); 39339} 39340function getDefaultProps(props, pluginSubscribers) { 39341 var _props$id; 39342 var environment = typeof window !== "undefined" ? window : {}; 39343 var plugins = props.plugins || []; 39344 return _objectSpread6(_objectSpread6({ 39345 debug: false, 39346 openOnFocus: false, 39347 enterKeyHint: undefined, 39348 ignoreCompositionEvents: false, 39349 placeholder: "", 39350 autoFocus: false, 39351 defaultActiveItemId: null, 39352 stallThreshold: 300, 39353 insights: undefined, 39354 environment, 39355 shouldPanelOpen: function shouldPanelOpen(_ref) { 39356 var state = _ref.state; 39357 return getItemsCount(state) > 0; 39358 }, 39359 reshape: function reshape(_ref2) { 39360 var sources = _ref2.sources; 39361 return sources; 39362 } 39363 }, props), {}, { 39364 id: (_props$id = props.id) !== null && _props$id !== undefined ? _props$id : generateAutocompleteId(), 39365 plugins, 39366 initialState: _objectSpread6({ 39367 activeItemId: null, 39368 query: "", 39369 completion: null, 39370 collections: [], 39371 isOpen: false, 39372 status: "idle", 39373 context: {} 39374 }, props.initialState), 39375 onStateChange: function onStateChange(params) { 39376 var _props$onStateChange; 39377 (_props$onStateChange = props.onStateChange) === null || _props$onStateChange === undefined || _props$onStateChange.call(props, params); 39378 plugins.forEach(function(x) { 39379 var _x$onStateChange; 39380 return (_x$onStateChange = x.onStateChange) === null || _x$onStateChange === undefined ? undefined : _x$onStateChange.call(x, params); 39381 }); 39382 }, 39383 onSubmit: function onSubmit(params) { 39384 var _props$onSubmit; 39385 (_props$onSubmit = props.onSubmit) === null || _props$onSubmit === undefined || _props$onSubmit.call(props, params); 39386 plugins.forEach(function(x) { 39387 var _x$onSubmit; 39388 return (_x$onSubmit = x.onSubmit) === null || _x$onSubmit === undefined ? undefined : _x$onSubmit.call(x, params); 39389 }); 39390 }, 39391 onReset: function onReset(params) { 39392 var _props$onReset; 39393 (_props$onReset = props.onReset) === null || _props$onReset === undefined || _props$onReset.call(props, params); 39394 plugins.forEach(function(x) { 39395 var _x$onReset; 39396 return (_x$onReset = x.onReset) === null || _x$onReset === undefined ? undefined : _x$onReset.call(x, params); 39397 }); 39398 }, 39399 getSources: function getSources(params) { 39400 return Promise.all([].concat(_toConsumableArray3(plugins.map(function(plugin) { 39401 return plugin.getSources; 39402 })), [props.getSources]).filter(Boolean).map(function(getSources) { 39403 return getNormalizedSources(getSources, params); 39404 })).then(function(nested) { 39405 return flatten(nested); 39406 }).then(function(sources) { 39407 return sources.map(function(source) { 39408 return _objectSpread6(_objectSpread6({}, source), {}, { 39409 onSelect: function onSelect(params) { 39410 source.onSelect(params); 39411 pluginSubscribers.forEach(function(x) { 39412 var _x$onSelect; 39413 return (_x$onSelect = x.onSelect) === null || _x$onSelect === undefined ? undefined : _x$onSelect.call(x, params); 39414 }); 39415 }, 39416 onActive: function onActive(params) { 39417 source.onActive(params); 39418 pluginSubscribers.forEach(function(x) { 39419 var _x$onActive; 39420 return (_x$onActive = x.onActive) === null || _x$onActive === undefined ? undefined : _x$onActive.call(x, params); 39421 }); 39422 }, 39423 onResolve: function onResolve(params) { 39424 source.onResolve(params); 39425 pluginSubscribers.forEach(function(x) { 39426 var _x$onResolve; 39427 return (_x$onResolve = x.onResolve) === null || _x$onResolve === undefined ? undefined : _x$onResolve.call(x, params); 39428 }); 39429 } 39430 }); 39431 }); 39432 }); 39433 }, 39434 navigator: _objectSpread6({ 39435 navigate: function navigate(_ref3) { 39436 var itemUrl = _ref3.itemUrl; 39437 environment.location.assign(itemUrl); 39438 }, 39439 navigateNewTab: function navigateNewTab(_ref4) { 39440 var itemUrl = _ref4.itemUrl; 39441 var windowReference = environment.open(itemUrl, "_blank", "noopener"); 39442 windowReference === null || windowReference === undefined || windowReference.focus(); 39443 }, 39444 navigateNewWindow: function navigateNewWindow(_ref5) { 39445 var itemUrl = _ref5.itemUrl; 39446 environment.open(itemUrl, "_blank", "noopener"); 39447 } 39448 }, props.navigator) 39449 }); 39450} 39451
vendor: 3,127 bytes, lines 39452-39537
39452// node_modules/@algolia/autocomplete-core/dist/esm/reshape.js 39453function _typeof8(obj2) { 39454 "@babel/helpers - typeof"; 39455 return _typeof8 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39456 return typeof obj2; 39457 } : function(obj2) { 39458 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39459 }, _typeof8(obj2); 39460} 39461function ownKeys7(object, enumerableOnly) { 39462 var keys = Object.keys(object); 39463 if (Object.getOwnPropertySymbols) { 39464 var symbols = Object.getOwnPropertySymbols(object); 39465 enumerableOnly && (symbols = symbols.filter(function(sym) { 39466 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39467 })), keys.push.apply(keys, symbols); 39468 } 39469 return keys; 39470} 39471function _objectSpread7(target) { 39472 for (var i = 1;i < arguments.length; i++) { 39473 var source = arguments[i] != null ? arguments[i] : {}; 39474 i % 2 ? ownKeys7(Object(source), true).forEach(function(key) { 39475 _defineProperty7(target, key, source[key]); 39476 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys7(Object(source)).forEach(function(key) { 39477 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39478 }); 39479 } 39480 return target; 39481} 39482function _defineProperty7(obj2, key, value) { 39483 key = _toPropertyKey7(key); 39484 if (key in obj2) { 39485 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39486 } else { 39487 obj2[key] = value; 39488 } 39489 return obj2; 39490} 39491function _toPropertyKey7(arg) { 39492 var key = _toPrimitive7(arg, "string"); 39493 return _typeof8(key) === "symbol" ? key : String(key); 39494} 39495function _toPrimitive7(input, hint) { 39496 if (_typeof8(input) !== "object" || input === null) 39497 return input; 39498 var prim = input[Symbol.toPrimitive]; 39499 if (prim !== undefined) { 39500 var res = prim.call(input, hint || "default"); 39501 if (_typeof8(res) !== "object") 39502 return res; 39503 throw new TypeError("@@toPrimitive must return a primitive value."); 39504 } 39505 return (hint === "string" ? String : Number)(input); 39506} 39507function reshape(_ref) { 39508 var { collections, props, state } = _ref; 39509 var originalSourcesBySourceId = collections.reduce(function(acc, collection) { 39510 return _objectSpread7(_objectSpread7({}, acc), {}, _defineProperty7({}, collection.source.sourceId, _objectSpread7(_objectSpread7({}, collection.source), {}, { 39511 getItems: function getItems() { 39512 return flatten(collection.items); 39513 } 39514 }))); 39515 }, {}); 39516 var _props$plugins$reduce = props.plugins.reduce(function(acc, plugin) { 39517 if (plugin.reshape) { 39518 return plugin.reshape(acc); 39519 } 39520 return acc; 39521 }, { 39522 sourcesBySourceId: originalSourcesBySourceId, 39523 state 39524 }), sourcesBySourceId = _props$plugins$reduce.sourcesBySourceId; 39525 var reshapeSources = props.reshape({ 39526 sourcesBySourceId, 39527 sources: Object.values(sourcesBySourceId), 39528 state 39529 }); 39530 return flatten(reshapeSources).filter(Boolean).map(function(source) { 39531 return { 39532 source, 39533 items: source.getItems() 39534 }; 39535 }); 39536} 39537
vendor: 7,183 bytes, lines 39538-39730
39538// node_modules/@algolia/autocomplete-core/dist/esm/resolve.js 39539function _typeof9(obj2) { 39540 "@babel/helpers - typeof"; 39541 return _typeof9 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39542 return typeof obj2; 39543 } : function(obj2) { 39544 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39545 }, _typeof9(obj2); 39546} 39547function ownKeys8(object, enumerableOnly) { 39548 var keys = Object.keys(object); 39549 if (Object.getOwnPropertySymbols) { 39550 var symbols = Object.getOwnPropertySymbols(object); 39551 enumerableOnly && (symbols = symbols.filter(function(sym) { 39552 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39553 })), keys.push.apply(keys, symbols); 39554 } 39555 return keys; 39556} 39557function _objectSpread8(target) { 39558 for (var i = 1;i < arguments.length; i++) { 39559 var source = arguments[i] != null ? arguments[i] : {}; 39560 i % 2 ? ownKeys8(Object(source), true).forEach(function(key) { 39561 _defineProperty8(target, key, source[key]); 39562 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys8(Object(source)).forEach(function(key) { 39563 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39564 }); 39565 } 39566 return target; 39567} 39568function _defineProperty8(obj2, key, value) { 39569 key = _toPropertyKey8(key); 39570 if (key in obj2) { 39571 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39572 } else { 39573 obj2[key] = value; 39574 } 39575 return obj2; 39576} 39577function _toPropertyKey8(arg) { 39578 var key = _toPrimitive8(arg, "string"); 39579 return _typeof9(key) === "symbol" ? key : String(key); 39580} 39581function _toPrimitive8(input, hint) { 39582 if (_typeof9(input) !== "object" || input === null) 39583 return input; 39584 var prim = input[Symbol.toPrimitive]; 39585 if (prim !== undefined) { 39586 var res = prim.call(input, hint || "default"); 39587 if (_typeof9(res) !== "object") 39588 return res; 39589 throw new TypeError("@@toPrimitive must return a primitive value."); 39590 } 39591 return (hint === "string" ? String : Number)(input); 39592} 39593function _toConsumableArray4(arr) { 39594 return _arrayWithoutHoles4(arr) || _iterableToArray4(arr) || _unsupportedIterableToArray7(arr) || _nonIterableSpread4(); 39595} 39596function _nonIterableSpread4() { 39597 throw new TypeError(`Invalid attempt to spread non-iterable instance. 39598In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 39599} 39600function _unsupportedIterableToArray7(o, minLen) { 39601 if (!o) 39602 return; 39603 if (typeof o === "string") 39604 return _arrayLikeToArray7(o, minLen); 39605 var n = Object.prototype.toString.call(o).slice(8, -1); 39606 if (n === "Object" && o.constructor) 39607 n = o.constructor.name; 39608 if (n === "Map" || n === "Set") 39609 return Array.from(o); 39610 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 39611 return _arrayLikeToArray7(o, minLen); 39612} 39613function _iterableToArray4(iter) { 39614 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 39615 return Array.from(iter); 39616} 39617function _arrayWithoutHoles4(arr) { 39618 if (Array.isArray(arr)) 39619 return _arrayLikeToArray7(arr); 39620} 39621function _arrayLikeToArray7(arr, len) { 39622 if (len == null || len > arr.length) 39623 len = arr.length; 39624 for (var i = 0, arr2 = new Array(len);i < len; i++) 39625 arr2[i] = arr[i]; 39626 return arr2; 39627} 39628function isDescription(item) { 39629 return Boolean(item.execute); 39630} 39631function isRequesterDescription(description) { 39632 return Boolean(description === null || description === undefined ? undefined : description.execute); 39633} 39634function preResolve(itemsOrDescription, sourceId, state) { 39635 if (isRequesterDescription(itemsOrDescription)) { 39636 var contextParameters = itemsOrDescription.requesterId === "algolia" ? Object.assign.apply(Object, [{}].concat(_toConsumableArray4(Object.keys(state.context).map(function(key) { 39637 var _state$context$key; 39638 return (_state$context$key = state.context[key]) === null || _state$context$key === undefined ? undefined : _state$context$key.__algoliaSearchParameters; 39639 })))) : {}; 39640 return _objectSpread8(_objectSpread8({}, itemsOrDescription), {}, { 39641 requests: itemsOrDescription.queries.map(function(query) { 39642 return { 39643 query: itemsOrDescription.requesterId === "algolia" ? _objectSpread8(_objectSpread8({}, query), {}, { 39644 params: _objectSpread8(_objectSpread8({}, contextParameters), query.params) 39645 }) : query, 39646 sourceId, 39647 transformResponse: itemsOrDescription.transformResponse 39648 }; 39649 }) 39650 }); 39651 } 39652 return { 39653 items: itemsOrDescription, 39654 sourceId 39655 }; 39656} 39657function resolve(items) { 39658 var packed = items.reduce(function(acc, current) { 39659 if (!isDescription(current)) { 39660 acc.push(current); 39661 return acc; 39662 } 39663 var { searchClient, execute, requesterId, requests: requests2 } = current; 39664 var container = acc.find(function(item) { 39665 return isDescription(current) && isDescription(item) && item.searchClient === searchClient && Boolean(requesterId) && item.requesterId === requesterId; 39666 }); 39667 if (container) { 39668 var _container$items; 39669 (_container$items = container.items).push.apply(_container$items, _toConsumableArray4(requests2)); 39670 } else { 39671 var request = { 39672 execute, 39673 requesterId, 39674 items: requests2, 39675 searchClient 39676 }; 39677 acc.push(request); 39678 } 39679 return acc; 39680 }, []); 39681 var values = packed.map(function(maybeDescription) { 39682 if (!isDescription(maybeDescription)) { 39683 return Promise.resolve(maybeDescription); 39684 } 39685 var _ref = maybeDescription, { execute, items, searchClient } = _ref; 39686 return execute({ 39687 searchClient, 39688 requests: items 39689 }); 39690 }); 39691 return Promise.all(values).then(function(responses) { 39692 return flatten(responses); 39693 }); 39694} 39695function postResolve(responses, sources, store) { 39696 return sources.map(function(source) { 39697 var matches = responses.filter(function(response) { 39698 return response.sourceId === source.sourceId; 39699 }); 39700 var results = matches.map(function(_ref2) { 39701 var items = _ref2.items; 39702 return items; 39703 }); 39704 var transform = matches[0].transformResponse; 39705 var items = transform ? transform(mapToAlgoliaResponse(results)) : results; 39706 source.onResolve({ 39707 source, 39708 results, 39709 items, 39710 state: store.getState() 39711 }); 39712 invariant(Array.isArray(items), function() { 39713 return 'The `getItems` function from source "'.concat(source.sourceId, '" must return an array of items but returned type ').concat(JSON.stringify(_typeof9(items)), `: 39714 39715`).concat(JSON.stringify(decycle(items), null, 2), `. 39716 39717See: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems`); 39718 }); 39719 invariant(items.every(Boolean), 'The `getItems` function from source "'.concat(source.sourceId, '" must return an array of items but returned ').concat(JSON.stringify(undefined), `. 39720 39721Did you forget to return items? 39722 39723See: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems`)); 39724 return { 39725 source, 39726 items 39727 }; 39728 }); 39729} 39730
vendor: 6,982 bytes, lines 39731-39916
39731// node_modules/@algolia/autocomplete-core/dist/esm/onInput.js 39732function _typeof10(obj2) { 39733 "@babel/helpers - typeof"; 39734 return _typeof10 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39735 return typeof obj2; 39736 } : function(obj2) { 39737 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39738 }, _typeof10(obj2); 39739} 39740var _excluded3 = ["event", "nextState", "props", "query", "refresh", "store"]; 39741function ownKeys9(object, enumerableOnly) { 39742 var keys = Object.keys(object); 39743 if (Object.getOwnPropertySymbols) { 39744 var symbols = Object.getOwnPropertySymbols(object); 39745 enumerableOnly && (symbols = symbols.filter(function(sym) { 39746 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39747 })), keys.push.apply(keys, symbols); 39748 } 39749 return keys; 39750} 39751function _objectSpread9(target) { 39752 for (var i = 1;i < arguments.length; i++) { 39753 var source = arguments[i] != null ? arguments[i] : {}; 39754 i % 2 ? ownKeys9(Object(source), true).forEach(function(key) { 39755 _defineProperty9(target, key, source[key]); 39756 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys9(Object(source)).forEach(function(key) { 39757 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39758 }); 39759 } 39760 return target; 39761} 39762function _defineProperty9(obj2, key, value) { 39763 key = _toPropertyKey9(key); 39764 if (key in obj2) { 39765 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39766 } else { 39767 obj2[key] = value; 39768 } 39769 return obj2; 39770} 39771function _toPropertyKey9(arg) { 39772 var key = _toPrimitive9(arg, "string"); 39773 return _typeof10(key) === "symbol" ? key : String(key); 39774} 39775function _toPrimitive9(input, hint) { 39776 if (_typeof10(input) !== "object" || input === null) 39777 return input; 39778 var prim = input[Symbol.toPrimitive]; 39779 if (prim !== undefined) { 39780 var res = prim.call(input, hint || "default"); 39781 if (_typeof10(res) !== "object") 39782 return res; 39783 throw new TypeError("@@toPrimitive must return a primitive value."); 39784 } 39785 return (hint === "string" ? String : Number)(input); 39786} 39787function _objectWithoutProperties2(source, excluded) { 39788 if (source == null) 39789 return {}; 39790 var target = _objectWithoutPropertiesLoose2(source, excluded); 39791 var key, i; 39792 if (Object.getOwnPropertySymbols) { 39793 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 39794 for (i = 0;i < sourceSymbolKeys.length; i++) { 39795 key = sourceSymbolKeys[i]; 39796 if (excluded.indexOf(key) >= 0) 39797 continue; 39798 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 39799 continue; 39800 target[key] = source[key]; 39801 } 39802 } 39803 return target; 39804} 39805function _objectWithoutPropertiesLoose2(source, excluded) { 39806 if (source == null) 39807 return {}; 39808 var target = {}; 39809 var sourceKeys = Object.keys(source); 39810 var key, i; 39811 for (i = 0;i < sourceKeys.length; i++) { 39812 key = sourceKeys[i]; 39813 if (excluded.indexOf(key) >= 0) 39814 continue; 39815 target[key] = source[key]; 39816 } 39817 return target; 39818} 39819var lastStalledId = null; 39820var runConcurrentSafePromise = createConcurrentSafePromise(); 39821function onInput(_ref) { 39822 var { event, nextState: _ref$nextState } = _ref, nextState = _ref$nextState === undefined ? {} : _ref$nextState, { props, query, refresh, store } = _ref, setters = _objectWithoutProperties2(_ref, _excluded3); 39823 if (lastStalledId) { 39824 props.environment.clearTimeout(lastStalledId); 39825 } 39826 var { setCollections, setIsOpen, setQuery, setActiveItemId, setStatus, setContext } = setters; 39827 setQuery(query); 39828 setActiveItemId(props.defaultActiveItemId); 39829 if (!query && props.openOnFocus === false) { 39830 var _nextState$isOpen; 39831 var collections = store.getState().collections.map(function(collection) { 39832 return _objectSpread9(_objectSpread9({}, collection), {}, { 39833 items: [] 39834 }); 39835 }); 39836 setStatus("idle"); 39837 setCollections(collections); 39838 setIsOpen((_nextState$isOpen = nextState.isOpen) !== null && _nextState$isOpen !== undefined ? _nextState$isOpen : props.shouldPanelOpen({ 39839 state: store.getState() 39840 })); 39841 var _request = cancelable(runConcurrentSafePromise(collections).then(function() { 39842 return Promise.resolve(); 39843 })); 39844 return store.pendingRequests.add(_request); 39845 } 39846 setStatus("loading"); 39847 lastStalledId = props.environment.setTimeout(function() { 39848 setStatus("stalled"); 39849 }, props.stallThreshold); 39850 var request = cancelable(runConcurrentSafePromise(props.getSources(_objectSpread9({ 39851 query, 39852 refresh, 39853 state: store.getState() 39854 }, setters)).then(function(sources) { 39855 return Promise.all(sources.map(function(source) { 39856 return Promise.resolve(source.getItems(_objectSpread9({ 39857 query, 39858 refresh, 39859 state: store.getState() 39860 }, setters))).then(function(itemsOrDescription) { 39861 return preResolve(itemsOrDescription, source.sourceId, store.getState()); 39862 }); 39863 })).then(resolve).then(function(responses) { 39864 var __automaticInsights = responses.some(function(_ref2) { 39865 var items = _ref2.items; 39866 return isSearchResponseWithAutomaticInsightsFlag(items); 39867 }); 39868 if (__automaticInsights) { 39869 var _store$getState$conte; 39870 setContext({ 39871 algoliaInsightsPlugin: _objectSpread9(_objectSpread9({}, ((_store$getState$conte = store.getState().context) === null || _store$getState$conte === undefined ? undefined : _store$getState$conte.algoliaInsightsPlugin) || {}), {}, { 39872 __automaticInsights 39873 }) 39874 }); 39875 } 39876 return postResolve(responses, sources, store); 39877 }).then(function(collections) { 39878 return reshape({ 39879 collections, 39880 props, 39881 state: store.getState() 39882 }); 39883 }); 39884 }))).then(function(collections) { 39885 var _nextState$isOpen2; 39886 setStatus("idle"); 39887 setCollections(collections); 39888 var isPanelOpen = props.shouldPanelOpen({ 39889 state: store.getState() 39890 }); 39891 setIsOpen((_nextState$isOpen2 = nextState.isOpen) !== null && _nextState$isOpen2 !== undefined ? _nextState$isOpen2 : props.openOnFocus && !query && isPanelOpen || isPanelOpen); 39892 var highlightedItem = getActiveItem(store.getState()); 39893 if (store.getState().activeItemId !== null && highlightedItem) { 39894 var { item, itemInputValue, itemUrl, source } = highlightedItem; 39895 source.onActive(_objectSpread9({ 39896 event, 39897 item, 39898 itemInputValue, 39899 itemUrl, 39900 refresh, 39901 source, 39902 state: store.getState() 39903 }, setters)); 39904 } 39905 }).finally(function() { 39906 setStatus("idle"); 39907 if (lastStalledId) { 39908 props.environment.clearTimeout(lastStalledId); 39909 } 39910 }); 39911 return store.pendingRequests.add(request); 39912} 39913function isSearchResponseWithAutomaticInsightsFlag(items) { 39914 return !Array.isArray(items) && Boolean(items === null || items === undefined ? undefined : items._automaticInsights); 39915} 39916
vendor: 7,498 bytes, lines 39917-40149
39917// node_modules/@algolia/autocomplete-core/dist/esm/onKeyDown.js 39918function _typeof11(obj2) { 39919 "@babel/helpers - typeof"; 39920 return _typeof11 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 39921 return typeof obj2; 39922 } : function(obj2) { 39923 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 39924 }, _typeof11(obj2); 39925} 39926var _excluded4 = ["event", "props", "refresh", "store"]; 39927function ownKeys10(object, enumerableOnly) { 39928 var keys = Object.keys(object); 39929 if (Object.getOwnPropertySymbols) { 39930 var symbols = Object.getOwnPropertySymbols(object); 39931 enumerableOnly && (symbols = symbols.filter(function(sym) { 39932 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 39933 })), keys.push.apply(keys, symbols); 39934 } 39935 return keys; 39936} 39937function _objectSpread10(target) { 39938 for (var i = 1;i < arguments.length; i++) { 39939 var source = arguments[i] != null ? arguments[i] : {}; 39940 i % 2 ? ownKeys10(Object(source), true).forEach(function(key) { 39941 _defineProperty10(target, key, source[key]); 39942 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys10(Object(source)).forEach(function(key) { 39943 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 39944 }); 39945 } 39946 return target; 39947} 39948function _defineProperty10(obj2, key, value) { 39949 key = _toPropertyKey10(key); 39950 if (key in obj2) { 39951 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 39952 } else { 39953 obj2[key] = value; 39954 } 39955 return obj2; 39956} 39957function _toPropertyKey10(arg) { 39958 var key = _toPrimitive10(arg, "string"); 39959 return _typeof11(key) === "symbol" ? key : String(key); 39960} 39961function _toPrimitive10(input, hint) { 39962 if (_typeof11(input) !== "object" || input === null) 39963 return input; 39964 var prim = input[Symbol.toPrimitive]; 39965 if (prim !== undefined) { 39966 var res = prim.call(input, hint || "default"); 39967 if (_typeof11(res) !== "object") 39968 return res; 39969 throw new TypeError("@@toPrimitive must return a primitive value."); 39970 } 39971 return (hint === "string" ? String : Number)(input); 39972} 39973function _objectWithoutProperties3(source, excluded) { 39974 if (source == null) 39975 return {}; 39976 var target = _objectWithoutPropertiesLoose3(source, excluded); 39977 var key, i; 39978 if (Object.getOwnPropertySymbols) { 39979 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 39980 for (i = 0;i < sourceSymbolKeys.length; i++) { 39981 key = sourceSymbolKeys[i]; 39982 if (excluded.indexOf(key) >= 0) 39983 continue; 39984 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 39985 continue; 39986 target[key] = source[key]; 39987 } 39988 } 39989 return target; 39990} 39991function _objectWithoutPropertiesLoose3(source, excluded) { 39992 if (source == null) 39993 return {}; 39994 var target = {}; 39995 var sourceKeys = Object.keys(source); 39996 var key, i; 39997 for (i = 0;i < sourceKeys.length; i++) { 39998 key = sourceKeys[i]; 39999 if (excluded.indexOf(key) >= 0) 40000 continue; 40001 target[key] = source[key]; 40002 } 40003 return target; 40004} 40005function onKeyDown(_ref) { 40006 var { event, props, refresh, store } = _ref, setters = _objectWithoutProperties3(_ref, _excluded4); 40007 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 40008 var triggerScrollIntoView = function triggerScrollIntoView() { 40009 var highlightedItem = getActiveItem(store.getState()); 40010 var nodeItem = props.environment.document.getElementById(getAutocompleteElementId(props.id, "item-".concat(store.getState().activeItemId), highlightedItem === null || highlightedItem === undefined ? undefined : highlightedItem.source)); 40011 if (nodeItem) { 40012 nodeItem.scrollIntoView({ 40013 block: "nearest", 40014 inline: "nearest" 40015 }); 40016 } 40017 }; 40018 var triggerOnActive = function triggerOnActive() { 40019 var highlightedItem = getActiveItem(store.getState()); 40020 if (store.getState().activeItemId !== null && highlightedItem) { 40021 var { item, itemInputValue, itemUrl, source } = highlightedItem; 40022 source.onActive(_objectSpread10({ 40023 event, 40024 item, 40025 itemInputValue, 40026 itemUrl, 40027 refresh, 40028 source, 40029 state: store.getState() 40030 }, setters)); 40031 } 40032 }; 40033 event.preventDefault(); 40034 if (store.getState().isOpen === false && (props.openOnFocus || Boolean(store.getState().query))) { 40035 onInput(_objectSpread10({ 40036 event, 40037 props, 40038 query: store.getState().query, 40039 refresh, 40040 store 40041 }, setters)).then(function() { 40042 store.dispatch(event.key, { 40043 nextActiveItemId: props.defaultActiveItemId 40044 }); 40045 triggerOnActive(); 40046 setTimeout(triggerScrollIntoView, 0); 40047 }); 40048 } else { 40049 store.dispatch(event.key, {}); 40050 triggerOnActive(); 40051 triggerScrollIntoView(); 40052 } 40053 } else if (event.key === "Escape") { 40054 event.preventDefault(); 40055 store.dispatch(event.key, null); 40056 store.pendingRequests.cancelAll(); 40057 } else if (event.key === "Tab") { 40058 store.dispatch("blur", null); 40059 store.pendingRequests.cancelAll(); 40060 } else if (event.key === "Enter") { 40061 if (store.getState().activeItemId === null || store.getState().collections.every(function(collection) { 40062 return collection.items.length === 0; 40063 })) { 40064 var waitForSubmit = getPluginSubmitPromise(props.plugins, store.pendingRequests); 40065 if (waitForSubmit !== undefined) { 40066 waitForSubmit.then(store.pendingRequests.cancelAll); 40067 } else if (!props.debug) { 40068 store.pendingRequests.cancelAll(); 40069 } 40070 return; 40071 } 40072 event.preventDefault(); 40073 var _ref2 = getActiveItem(store.getState()), { item, itemInputValue, itemUrl, source } = _ref2; 40074 if (event.metaKey || event.ctrlKey) { 40075 if (itemUrl !== undefined) { 40076 source.onSelect(_objectSpread10({ 40077 event, 40078 item, 40079 itemInputValue, 40080 itemUrl, 40081 refresh, 40082 source, 40083 state: store.getState() 40084 }, setters)); 40085 props.navigator.navigateNewTab({ 40086 itemUrl, 40087 item, 40088 state: store.getState() 40089 }); 40090 } 40091 } else if (event.shiftKey) { 40092 if (itemUrl !== undefined) { 40093 source.onSelect(_objectSpread10({ 40094 event, 40095 item, 40096 itemInputValue, 40097 itemUrl, 40098 refresh, 40099 source, 40100 state: store.getState() 40101 }, setters)); 40102 props.navigator.navigateNewWindow({ 40103 itemUrl, 40104 item, 40105 state: store.getState() 40106 }); 40107 } 40108 } else if (event.altKey) {} else { 40109 if (itemUrl !== undefined) { 40110 source.onSelect(_objectSpread10({ 40111 event, 40112 item, 40113 itemInputValue, 40114 itemUrl, 40115 refresh, 40116 source, 40117 state: store.getState() 40118 }, setters)); 40119 props.navigator.navigate({ 40120 itemUrl, 40121 item, 40122 state: store.getState() 40123 }); 40124 return; 40125 } 40126 onInput(_objectSpread10({ 40127 event, 40128 nextState: { 40129 isOpen: false 40130 }, 40131 props, 40132 query: itemInputValue, 40133 refresh, 40134 store 40135 }, setters)).then(function() { 40136 source.onSelect(_objectSpread10({ 40137 event, 40138 item, 40139 itemInputValue, 40140 itemUrl, 40141 refresh, 40142 source, 40143 state: store.getState() 40144 }, setters)); 40145 }); 40146 } 40147 } 40148} 40149
vendor: 13,082 bytes, lines 40150-40504
40150// node_modules/@algolia/autocomplete-core/dist/esm/getPropGetters.js 40151function _typeof12(obj2) { 40152 "@babel/helpers - typeof"; 40153 return _typeof12 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 40154 return typeof obj2; 40155 } : function(obj2) { 40156 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40157 }, _typeof12(obj2); 40158} 40159var _excluded5 = ["props", "refresh", "store"]; 40160var _excluded22 = ["inputElement", "formElement", "panelElement"]; 40161var _excluded32 = ["inputElement"]; 40162var _excluded42 = ["inputElement", "maxLength"]; 40163var _excluded52 = ["source"]; 40164var _excluded6 = ["item", "source"]; 40165function ownKeys11(object, enumerableOnly) { 40166 var keys = Object.keys(object); 40167 if (Object.getOwnPropertySymbols) { 40168 var symbols = Object.getOwnPropertySymbols(object); 40169 enumerableOnly && (symbols = symbols.filter(function(sym) { 40170 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40171 })), keys.push.apply(keys, symbols); 40172 } 40173 return keys; 40174} 40175function _objectSpread11(target) { 40176 for (var i = 1;i < arguments.length; i++) { 40177 var source = arguments[i] != null ? arguments[i] : {}; 40178 i % 2 ? ownKeys11(Object(source), true).forEach(function(key) { 40179 _defineProperty11(target, key, source[key]); 40180 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys11(Object(source)).forEach(function(key) { 40181 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 40182 }); 40183 } 40184 return target; 40185} 40186function _defineProperty11(obj2, key, value) { 40187 key = _toPropertyKey11(key); 40188 if (key in obj2) { 40189 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 40190 } else { 40191 obj2[key] = value; 40192 } 40193 return obj2; 40194} 40195function _toPropertyKey11(arg) { 40196 var key = _toPrimitive11(arg, "string"); 40197 return _typeof12(key) === "symbol" ? key : String(key); 40198} 40199function _toPrimitive11(input, hint) { 40200 if (_typeof12(input) !== "object" || input === null) 40201 return input; 40202 var prim = input[Symbol.toPrimitive]; 40203 if (prim !== undefined) { 40204 var res = prim.call(input, hint || "default"); 40205 if (_typeof12(res) !== "object") 40206 return res; 40207 throw new TypeError("@@toPrimitive must return a primitive value."); 40208 } 40209 return (hint === "string" ? String : Number)(input); 40210} 40211function _objectWithoutProperties4(source, excluded) { 40212 if (source == null) 40213 return {}; 40214 var target = _objectWithoutPropertiesLoose4(source, excluded); 40215 var key, i; 40216 if (Object.getOwnPropertySymbols) { 40217 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 40218 for (i = 0;i < sourceSymbolKeys.length; i++) { 40219 key = sourceSymbolKeys[i]; 40220 if (excluded.indexOf(key) >= 0) 40221 continue; 40222 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 40223 continue; 40224 target[key] = source[key]; 40225 } 40226 } 40227 return target; 40228} 40229function _objectWithoutPropertiesLoose4(source, excluded) { 40230 if (source == null) 40231 return {}; 40232 var target = {}; 40233 var sourceKeys = Object.keys(source); 40234 var key, i; 40235 for (i = 0;i < sourceKeys.length; i++) { 40236 key = sourceKeys[i]; 40237 if (excluded.indexOf(key) >= 0) 40238 continue; 40239 target[key] = source[key]; 40240 } 40241 return target; 40242} 40243function getPropGetters(_ref) { 40244 var { props, refresh, store } = _ref, setters = _objectWithoutProperties4(_ref, _excluded5); 40245 var getEnvironmentProps = function getEnvironmentProps(providedProps) { 40246 var { inputElement, formElement, panelElement } = providedProps, rest = _objectWithoutProperties4(providedProps, _excluded22); 40247 function onMouseDownOrTouchStart(event) { 40248 var isAutocompleteInteraction = store.getState().isOpen || !store.pendingRequests.isEmpty(); 40249 if (!isAutocompleteInteraction || event.target === inputElement) { 40250 return; 40251 } 40252 var isTargetWithinAutocomplete = [formElement, panelElement].some(function(contextNode) { 40253 return isOrContainsNode(contextNode, event.target); 40254 }); 40255 if (isTargetWithinAutocomplete === false) { 40256 store.dispatch("blur", null); 40257 if (!props.debug) { 40258 store.pendingRequests.cancelAll(); 40259 } 40260 } 40261 } 40262 return _objectSpread11({ 40263 onTouchStart: onMouseDownOrTouchStart, 40264 onMouseDown: onMouseDownOrTouchStart, 40265 onTouchMove: function onTouchMove(event) { 40266 if (store.getState().isOpen === false || inputElement !== props.environment.document.activeElement || event.target === inputElement) { 40267 return; 40268 } 40269 inputElement.blur(); 40270 } 40271 }, rest); 40272 }; 40273 var getRootProps = function getRootProps(rest) { 40274 return _objectSpread11({ 40275 role: "combobox", 40276 "aria-expanded": store.getState().isOpen, 40277 "aria-haspopup": "listbox", 40278 "aria-controls": store.getState().isOpen ? store.getState().collections.map(function(_ref2) { 40279 var source = _ref2.source; 40280 return getAutocompleteElementId(props.id, "list", source); 40281 }).join(" ") : undefined, 40282 "aria-labelledby": getAutocompleteElementId(props.id, "label") 40283 }, rest); 40284 }; 40285 var getFormProps = function getFormProps(providedProps) { 40286 var inputElement = providedProps.inputElement, rest = _objectWithoutProperties4(providedProps, _excluded32); 40287 var handleSubmit = function handleSubmit(event) { 40288 var _providedProps$inputE; 40289 props.onSubmit(_objectSpread11({ 40290 event, 40291 refresh, 40292 state: store.getState() 40293 }, setters)); 40294 store.dispatch("submit", null); 40295 (_providedProps$inputE = providedProps.inputElement) === null || _providedProps$inputE === undefined || _providedProps$inputE.blur(); 40296 }; 40297 return _objectSpread11({ 40298 action: "", 40299 noValidate: true, 40300 role: "search", 40301 onSubmit: function onSubmit(event) { 40302 event.preventDefault(); 40303 var waitForSubmit = getPluginSubmitPromise(props.plugins, store.pendingRequests); 40304 if (waitForSubmit !== undefined) { 40305 waitForSubmit.then(function() { 40306 return handleSubmit(event); 40307 }); 40308 } else { 40309 handleSubmit(event); 40310 } 40311 }, 40312 onReset: function onReset(event) { 40313 var _providedProps$inputE2; 40314 event.preventDefault(); 40315 props.onReset(_objectSpread11({ 40316 event, 40317 refresh, 40318 state: store.getState() 40319 }, setters)); 40320 store.dispatch("reset", null); 40321 (_providedProps$inputE2 = providedProps.inputElement) === null || _providedProps$inputE2 === undefined || _providedProps$inputE2.focus(); 40322 } 40323 }, rest); 40324 }; 40325 var getInputProps = function getInputProps(providedProps) { 40326 var _props$environment$na; 40327 function onFocus(event) { 40328 if (props.openOnFocus || Boolean(store.getState().query)) { 40329 onInput(_objectSpread11({ 40330 event, 40331 props, 40332 query: store.getState().completion || store.getState().query, 40333 refresh, 40334 store 40335 }, setters)); 40336 } 40337 store.dispatch("focus", null); 40338 } 40339 var _ref3 = providedProps || {}, { inputElement, maxLength: _ref3$maxLength } = _ref3, maxLength = _ref3$maxLength === undefined ? 512 : _ref3$maxLength, rest = _objectWithoutProperties4(_ref3, _excluded42); 40340 var activeItem = getActiveItem(store.getState()); 40341 var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === undefined ? undefined : _props$environment$na.userAgent) || ""; 40342 var shouldFallbackKeyHint = isSamsung(userAgent); 40343 var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== undefined && activeItem.itemUrl && !shouldFallbackKeyHint ? "go" : "search"); 40344 return _objectSpread11({ 40345 "aria-autocomplete": "both", 40346 "aria-activedescendant": store.getState().isOpen && store.getState().activeItemId !== null ? getAutocompleteElementId(props.id, "item-".concat(store.getState().activeItemId), activeItem === null || activeItem === undefined ? undefined : activeItem.source) : undefined, 40347 "aria-controls": store.getState().isOpen ? store.getState().collections.filter(function(collection) { 40348 return collection.items.length > 0; 40349 }).map(function(_ref4) { 40350 var source = _ref4.source; 40351 return getAutocompleteElementId(props.id, "list", source); 40352 }).join(" ") : undefined, 40353 "aria-labelledby": getAutocompleteElementId(props.id, "label"), 40354 value: store.getState().completion || store.getState().query, 40355 id: getAutocompleteElementId(props.id, "input"), 40356 autoComplete: "off", 40357 autoCorrect: "off", 40358 autoCapitalize: "off", 40359 enterKeyHint, 40360 spellCheck: "false", 40361 autoFocus: props.autoFocus, 40362 placeholder: props.placeholder, 40363 maxLength, 40364 type: "search", 40365 onChange: function onChange(event) { 40366 var value = event.currentTarget.value; 40367 if (props.ignoreCompositionEvents && getNativeEvent(event).isComposing) { 40368 setters.setQuery(value); 40369 return; 40370 } 40371 onInput(_objectSpread11({ 40372 event, 40373 props, 40374 query: value.slice(0, maxLength), 40375 refresh, 40376 store 40377 }, setters)); 40378 }, 40379 onCompositionEnd: function onCompositionEnd(event) { 40380 onInput(_objectSpread11({ 40381 event, 40382 props, 40383 query: event.currentTarget.value.slice(0, maxLength), 40384 refresh, 40385 store 40386 }, setters)); 40387 }, 40388 onKeyDown: function onKeyDown2(event) { 40389 if (getNativeEvent(event).isComposing) { 40390 return; 40391 } 40392 onKeyDown(_objectSpread11({ 40393 event, 40394 props, 40395 refresh, 40396 store 40397 }, setters)); 40398 }, 40399 onFocus, 40400 onBlur: noop, 40401 onClick: function onClick(event) { 40402 if (providedProps.inputElement === props.environment.document.activeElement && !store.getState().isOpen) { 40403 onFocus(event); 40404 } 40405 } 40406 }, rest); 40407 }; 40408 var getLabelProps = function getLabelProps(rest) { 40409 return _objectSpread11({ 40410 htmlFor: getAutocompleteElementId(props.id, "input"), 40411 id: getAutocompleteElementId(props.id, "label") 40412 }, rest); 40413 }; 40414 var getListProps = function getListProps(providedProps) { 40415 var _ref5 = providedProps || {}, source = _ref5.source, rest = _objectWithoutProperties4(_ref5, _excluded52); 40416 return _objectSpread11({ 40417 role: "listbox", 40418 "aria-labelledby": getAutocompleteElementId(props.id, "label"), 40419 id: getAutocompleteElementId(props.id, "list", source) 40420 }, rest); 40421 }; 40422 var getPanelProps = function getPanelProps(rest) { 40423 return _objectSpread11({ 40424 onMouseDown: function onMouseDown(event) { 40425 event.preventDefault(); 40426 }, 40427 onMouseLeave: function onMouseLeave() { 40428 store.dispatch("mouseleave", null); 40429 } 40430 }, rest); 40431 }; 40432 var getItemProps = function getItemProps(providedProps) { 40433 var { item, source } = providedProps, rest = _objectWithoutProperties4(providedProps, _excluded6); 40434 return _objectSpread11({ 40435 id: getAutocompleteElementId(props.id, "item-".concat(item.__autocomplete_id), source), 40436 role: "option", 40437 "aria-selected": store.getState().activeItemId === item.__autocomplete_id, 40438 onMouseMove: function onMouseMove(event) { 40439 if (item.__autocomplete_id === store.getState().activeItemId) { 40440 return; 40441 } 40442 store.dispatch("mousemove", item.__autocomplete_id); 40443 var activeItem = getActiveItem(store.getState()); 40444 if (store.getState().activeItemId !== null && activeItem) { 40445 var { item: _item, itemInputValue, itemUrl, source: _source } = activeItem; 40446 _source.onActive(_objectSpread11({ 40447 event, 40448 item: _item, 40449 itemInputValue, 40450 itemUrl, 40451 refresh, 40452 source: _source, 40453 state: store.getState() 40454 }, setters)); 40455 } 40456 }, 40457 onMouseDown: function onMouseDown(event) { 40458 event.preventDefault(); 40459 }, 40460 onClick: function onClick(event) { 40461 var itemInputValue = source.getItemInputValue({ 40462 item, 40463 state: store.getState() 40464 }); 40465 var itemUrl = source.getItemUrl({ 40466 item, 40467 state: store.getState() 40468 }); 40469 var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread11({ 40470 event, 40471 nextState: { 40472 isOpen: false 40473 }, 40474 props, 40475 query: itemInputValue, 40476 refresh, 40477 store 40478 }, setters)); 40479 runPreCommand.then(function() { 40480 source.onSelect(_objectSpread11({ 40481 event, 40482 item, 40483 itemInputValue, 40484 itemUrl, 40485 refresh, 40486 source, 40487 state: store.getState() 40488 }, setters)); 40489 }); 40490 } 40491 }, rest); 40492 }; 40493 return { 40494 getEnvironmentProps, 40495 getRootProps, 40496 getFormProps, 40497 getLabelProps, 40498 getInputProps, 40499 getPanelProps, 40500 getListProps, 40501 getItemProps 40502 }; 40503} 40504
vendor: 4,095 bytes, lines 40505-40592
40505// node_modules/@algolia/autocomplete-core/dist/esm/metadata.js 40506function _typeof13(obj2) { 40507 "@babel/helpers - typeof"; 40508 return _typeof13 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 40509 return typeof obj2; 40510 } : function(obj2) { 40511 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40512 }, _typeof13(obj2); 40513} 40514function ownKeys12(object, enumerableOnly) { 40515 var keys = Object.keys(object); 40516 if (Object.getOwnPropertySymbols) { 40517 var symbols = Object.getOwnPropertySymbols(object); 40518 enumerableOnly && (symbols = symbols.filter(function(sym) { 40519 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40520 })), keys.push.apply(keys, symbols); 40521 } 40522 return keys; 40523} 40524function _objectSpread12(target) { 40525 for (var i = 1;i < arguments.length; i++) { 40526 var source = arguments[i] != null ? arguments[i] : {}; 40527 i % 2 ? ownKeys12(Object(source), true).forEach(function(key) { 40528 _defineProperty12(target, key, source[key]); 40529 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys12(Object(source)).forEach(function(key) { 40530 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 40531 }); 40532 } 40533 return target; 40534} 40535function _defineProperty12(obj2, key, value) { 40536 key = _toPropertyKey12(key); 40537 if (key in obj2) { 40538 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 40539 } else { 40540 obj2[key] = value; 40541 } 40542 return obj2; 40543} 40544function _toPropertyKey12(arg) { 40545 var key = _toPrimitive12(arg, "string"); 40546 return _typeof13(key) === "symbol" ? key : String(key); 40547} 40548function _toPrimitive12(input, hint) { 40549 if (_typeof13(input) !== "object" || input === null) 40550 return input; 40551 var prim = input[Symbol.toPrimitive]; 40552 if (prim !== undefined) { 40553 var res = prim.call(input, hint || "default"); 40554 if (_typeof13(res) !== "object") 40555 return res; 40556 throw new TypeError("@@toPrimitive must return a primitive value."); 40557 } 40558 return (hint === "string" ? String : Number)(input); 40559} 40560function getMetadata(_ref) { 40561 var _, _options$__autocomple, _options$__autocomple2, _options$__autocomple3; 40562 var { plugins, options: options2 } = _ref; 40563 var optionsKey = (_ = (((_options$__autocomple = options2.__autocomplete_metadata) === null || _options$__autocomple === undefined ? undefined : _options$__autocomple.userAgents) || [])[0]) === null || _ === undefined ? undefined : _.segment; 40564 var extraOptions = optionsKey ? _defineProperty12({}, optionsKey, Object.keys(((_options$__autocomple2 = options2.__autocomplete_metadata) === null || _options$__autocomple2 === undefined ? undefined : _options$__autocomple2.options) || {})) : {}; 40565 return { 40566 plugins: plugins.map(function(plugin) { 40567 return { 40568 name: plugin.name, 40569 options: Object.keys(plugin.__autocomplete_pluginOptions || []) 40570 }; 40571 }), 40572 options: _objectSpread12({ 40573 "autocomplete-core": Object.keys(options2) 40574 }, extraOptions), 40575 ua: userAgents.concat(((_options$__autocomple3 = options2.__autocomplete_metadata) === null || _options$__autocomple3 === undefined ? undefined : _options$__autocomple3.userAgents) || []) 40576 }; 40577} 40578function injectMetadata(_ref3) { 40579 var _environment$navigato, _environment$navigato2; 40580 var { metadata, environment } = _ref3; 40581 var isMetadataEnabled = (_environment$navigato = environment.navigator) === null || _environment$navigato === undefined ? undefined : (_environment$navigato2 = _environment$navigato.userAgent) === null || _environment$navigato2 === undefined ? undefined : _environment$navigato2.includes("Algolia Crawler"); 40582 if (isMetadataEnabled) { 40583 var metadataContainer = environment.document.createElement("meta"); 40584 var headRef = environment.document.querySelector("head"); 40585 metadataContainer.name = "algolia:metadata"; 40586 setTimeout(function() { 40587 metadataContainer.content = JSON.stringify(metadata); 40588 headRef.appendChild(metadataContainer); 40589 }, 0); 40590 } 40591} 40592
vendor: 380 bytes, lines 40593-40602
40593// node_modules/@algolia/autocomplete-core/dist/esm/getCompletion.js 40594function getCompletion(_ref) { 40595 var _getActiveItem; 40596 var state = _ref.state; 40597 if (state.isOpen === false || state.activeItemId === null) { 40598 return null; 40599 } 40600 return ((_getActiveItem = getActiveItem(state)) === null || _getActiveItem === undefined ? undefined : _getActiveItem.itemInputValue) || null; 40601} 40602
vendor: 5,774 bytes, lines 40603-40773
40603// node_modules/@algolia/autocomplete-core/dist/esm/stateReducer.js 40604function _typeof14(obj2) { 40605 "@babel/helpers - typeof"; 40606 return _typeof14 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 40607 return typeof obj2; 40608 } : function(obj2) { 40609 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40610 }, _typeof14(obj2); 40611} 40612function ownKeys13(object, enumerableOnly) { 40613 var keys = Object.keys(object); 40614 if (Object.getOwnPropertySymbols) { 40615 var symbols = Object.getOwnPropertySymbols(object); 40616 enumerableOnly && (symbols = symbols.filter(function(sym) { 40617 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40618 })), keys.push.apply(keys, symbols); 40619 } 40620 return keys; 40621} 40622function _objectSpread13(target) { 40623 for (var i = 1;i < arguments.length; i++) { 40624 var source = arguments[i] != null ? arguments[i] : {}; 40625 i % 2 ? ownKeys13(Object(source), true).forEach(function(key) { 40626 _defineProperty13(target, key, source[key]); 40627 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys13(Object(source)).forEach(function(key) { 40628 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 40629 }); 40630 } 40631 return target; 40632} 40633function _defineProperty13(obj2, key, value) { 40634 key = _toPropertyKey13(key); 40635 if (key in obj2) { 40636 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 40637 } else { 40638 obj2[key] = value; 40639 } 40640 return obj2; 40641} 40642function _toPropertyKey13(arg) { 40643 var key = _toPrimitive13(arg, "string"); 40644 return _typeof14(key) === "symbol" ? key : String(key); 40645} 40646function _toPrimitive13(input, hint) { 40647 if (_typeof14(input) !== "object" || input === null) 40648 return input; 40649 var prim = input[Symbol.toPrimitive]; 40650 if (prim !== undefined) { 40651 var res = prim.call(input, hint || "default"); 40652 if (_typeof14(res) !== "object") 40653 return res; 40654 throw new TypeError("@@toPrimitive must return a primitive value."); 40655 } 40656 return (hint === "string" ? String : Number)(input); 40657} 40658var stateReducer = function stateReducer(state, action) { 40659 switch (action.type) { 40660 case "setActiveItemId": { 40661 return _objectSpread13(_objectSpread13({}, state), {}, { 40662 activeItemId: action.payload 40663 }); 40664 } 40665 case "setQuery": { 40666 return _objectSpread13(_objectSpread13({}, state), {}, { 40667 query: action.payload, 40668 completion: null 40669 }); 40670 } 40671 case "setCollections": { 40672 return _objectSpread13(_objectSpread13({}, state), {}, { 40673 collections: action.payload 40674 }); 40675 } 40676 case "setIsOpen": { 40677 return _objectSpread13(_objectSpread13({}, state), {}, { 40678 isOpen: action.payload 40679 }); 40680 } 40681 case "setStatus": { 40682 return _objectSpread13(_objectSpread13({}, state), {}, { 40683 status: action.payload 40684 }); 40685 } 40686 case "setContext": { 40687 return _objectSpread13(_objectSpread13({}, state), {}, { 40688 context: _objectSpread13(_objectSpread13({}, state.context), action.payload) 40689 }); 40690 } 40691 case "ArrowDown": { 40692 var nextState = _objectSpread13(_objectSpread13({}, state), {}, { 40693 activeItemId: action.payload.hasOwnProperty("nextActiveItemId") ? action.payload.nextActiveItemId : getNextActiveItemId(1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId) 40694 }); 40695 return _objectSpread13(_objectSpread13({}, nextState), {}, { 40696 completion: getCompletion({ 40697 state: nextState 40698 }) 40699 }); 40700 } 40701 case "ArrowUp": { 40702 var _nextState = _objectSpread13(_objectSpread13({}, state), {}, { 40703 activeItemId: getNextActiveItemId(-1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId) 40704 }); 40705 return _objectSpread13(_objectSpread13({}, _nextState), {}, { 40706 completion: getCompletion({ 40707 state: _nextState 40708 }) 40709 }); 40710 } 40711 case "Escape": { 40712 if (state.isOpen) { 40713 return _objectSpread13(_objectSpread13({}, state), {}, { 40714 activeItemId: null, 40715 isOpen: false, 40716 completion: null 40717 }); 40718 } 40719 return _objectSpread13(_objectSpread13({}, state), {}, { 40720 activeItemId: null, 40721 query: "", 40722 status: "idle", 40723 collections: [] 40724 }); 40725 } 40726 case "submit": { 40727 return _objectSpread13(_objectSpread13({}, state), {}, { 40728 activeItemId: null, 40729 isOpen: false, 40730 status: "idle" 40731 }); 40732 } 40733 case "reset": { 40734 return _objectSpread13(_objectSpread13({}, state), {}, { 40735 activeItemId: action.props.openOnFocus === true ? action.props.defaultActiveItemId : null, 40736 status: "idle", 40737 completion: null, 40738 query: "" 40739 }); 40740 } 40741 case "focus": { 40742 return _objectSpread13(_objectSpread13({}, state), {}, { 40743 activeItemId: action.props.defaultActiveItemId, 40744 isOpen: (action.props.openOnFocus || Boolean(state.query)) && action.props.shouldPanelOpen({ 40745 state 40746 }) 40747 }); 40748 } 40749 case "blur": { 40750 if (action.props.debug) { 40751 return state; 40752 } 40753 return _objectSpread13(_objectSpread13({}, state), {}, { 40754 isOpen: false, 40755 activeItemId: null 40756 }); 40757 } 40758 case "mousemove": { 40759 return _objectSpread13(_objectSpread13({}, state), {}, { 40760 activeItemId: action.payload 40761 }); 40762 } 40763 case "mouseleave": { 40764 return _objectSpread13(_objectSpread13({}, state), {}, { 40765 activeItemId: action.props.defaultActiveItemId 40766 }); 40767 } 40768 default: 40769 invariant(false, "The reducer action ".concat(JSON.stringify(action.type), " is not supported.")); 40770 return state; 40771 } 40772}; 40773
vendor: 5,052 bytes, lines 40774-40919
40774// node_modules/@algolia/autocomplete-core/dist/esm/createAutocomplete.js 40775function _typeof15(obj2) { 40776 "@babel/helpers - typeof"; 40777 return _typeof15 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 40778 return typeof obj2; 40779 } : function(obj2) { 40780 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 40781 }, _typeof15(obj2); 40782} 40783function ownKeys14(object, enumerableOnly) { 40784 var keys = Object.keys(object); 40785 if (Object.getOwnPropertySymbols) { 40786 var symbols = Object.getOwnPropertySymbols(object); 40787 enumerableOnly && (symbols = symbols.filter(function(sym) { 40788 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 40789 })), keys.push.apply(keys, symbols); 40790 } 40791 return keys; 40792} 40793function _objectSpread14(target) { 40794 for (var i = 1;i < arguments.length; i++) { 40795 var source = arguments[i] != null ? arguments[i] : {}; 40796 i % 2 ? ownKeys14(Object(source), true).forEach(function(key) { 40797 _defineProperty14(target, key, source[key]); 40798 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys14(Object(source)).forEach(function(key) { 40799 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 40800 }); 40801 } 40802 return target; 40803} 40804function _defineProperty14(obj2, key, value) { 40805 key = _toPropertyKey14(key); 40806 if (key in obj2) { 40807 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 40808 } else { 40809 obj2[key] = value; 40810 } 40811 return obj2; 40812} 40813function _toPropertyKey14(arg) { 40814 var key = _toPrimitive14(arg, "string"); 40815 return _typeof15(key) === "symbol" ? key : String(key); 40816} 40817function _toPrimitive14(input, hint) { 40818 if (_typeof15(input) !== "object" || input === null) 40819 return input; 40820 var prim = input[Symbol.toPrimitive]; 40821 if (prim !== undefined) { 40822 var res = prim.call(input, hint || "default"); 40823 if (_typeof15(res) !== "object") 40824 return res; 40825 throw new TypeError("@@toPrimitive must return a primitive value."); 40826 } 40827 return (hint === "string" ? String : Number)(input); 40828} 40829function createAutocomplete(options2) { 40830 checkOptions(options2); 40831 var subscribers = []; 40832 var props = getDefaultProps(options2, subscribers); 40833 var store = createStore(stateReducer, props, onStoreStateChange); 40834 var setters = getAutocompleteSetters({ 40835 store 40836 }); 40837 var propGetters = getPropGetters(_objectSpread14({ 40838 props, 40839 refresh, 40840 store, 40841 navigator: props.navigator 40842 }, setters)); 40843 function onStoreStateChange(_ref) { 40844 var _state$context, _state$context$algoli; 40845 var { prevState, state } = _ref; 40846 props.onStateChange(_objectSpread14({ 40847 prevState, 40848 state, 40849 refresh, 40850 navigator: props.navigator 40851 }, setters)); 40852 if (!isAlgoliaInsightsPluginEnabled() && (_state$context = state.context) !== null && _state$context !== undefined && (_state$context$algoli = _state$context.algoliaInsightsPlugin) !== null && _state$context$algoli !== undefined && _state$context$algoli.__automaticInsights && props.insights !== false) { 40853 var plugin = createAlgoliaInsightsPlugin({ 40854 __autocomplete_clickAnalytics: false 40855 }); 40856 props.plugins.push(plugin); 40857 subscribePlugins([plugin]); 40858 } 40859 } 40860 function refresh() { 40861 return onInput(_objectSpread14({ 40862 event: new Event("input"), 40863 nextState: { 40864 isOpen: store.getState().isOpen 40865 }, 40866 props, 40867 navigator: props.navigator, 40868 query: store.getState().query, 40869 refresh, 40870 store 40871 }, setters)); 40872 } 40873 function subscribePlugins(plugins) { 40874 plugins.forEach(function(plugin) { 40875 var _plugin$subscribe; 40876 return (_plugin$subscribe = plugin.subscribe) === null || _plugin$subscribe === undefined ? undefined : _plugin$subscribe.call(plugin, _objectSpread14(_objectSpread14({}, setters), {}, { 40877 navigator: props.navigator, 40878 refresh, 40879 onSelect: function onSelect(fn2) { 40880 subscribers.push({ 40881 onSelect: fn2 40882 }); 40883 }, 40884 onActive: function onActive(fn2) { 40885 subscribers.push({ 40886 onActive: fn2 40887 }); 40888 }, 40889 onResolve: function onResolve(fn2) { 40890 subscribers.push({ 40891 onResolve: fn2 40892 }); 40893 } 40894 })); 40895 }); 40896 } 40897 function isAlgoliaInsightsPluginEnabled() { 40898 return props.plugins.some(function(plugin) { 40899 return plugin.name === "aa.algoliaInsightsPlugin"; 40900 }); 40901 } 40902 if (props.insights && !isAlgoliaInsightsPluginEnabled()) { 40903 var insightsParams = typeof props.insights === "boolean" ? {} : props.insights; 40904 props.plugins.push(createAlgoliaInsightsPlugin(insightsParams)); 40905 } 40906 subscribePlugins(props.plugins); 40907 injectMetadata({ 40908 metadata: getMetadata({ 40909 plugins: props.plugins, 40910 options: options2 40911 }), 40912 environment: props.environment 40913 }); 40914 return _objectSpread14(_objectSpread14({ 40915 refresh, 40916 navigator: props.navigator 40917 }, propGetters), setters); 40918} 40919
vendor: 1,774 bytes, lines 40920-40945
40920// node_modules/htm/dist/htm.module.js 40921var n = function(t, s, r, e) { 40922 var u; 40923 s[0] = 0; 40924 for (var h = 1;h < s.length; h++) { 40925 var p = s[h++], a = s[h] ? (s[0] |= p ? 1 : 2, r[s[h++]]) : s[++h]; 40926 p === 3 ? e[0] = a : p === 4 ? e[1] = Object.assign(e[1] || {}, a) : p === 5 ? (e[1] = e[1] || {})[s[++h]] = a : p === 6 ? e[1][s[++h]] += a + "" : p ? (u = t.apply(a, n(t, a, r, ["", null])), e.push(u), a[0] ? s[0] |= 2 : (s[h - 2] = 0, s[h] = u)) : e.push(a); 40927 } 40928 return e; 40929}; 40930var t = new Map; 40931function htm_module_default(s) { 40932 var r = t.get(this); 40933 return r || (r = new Map, t.set(this, r)), (r = n(this, r.get(s) || (r.set(s, r = function(n) { 40934 for (var t, s, r = 1, e = "", u = "", h = [0], p = function(n) { 40935 r === 1 && (n || (e = e.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? h.push(0, n, e) : r === 3 && (n || e) ? (h.push(3, n, e), r = 2) : r === 2 && e === "..." && n ? h.push(4, n, 0) : r === 2 && e && !n ? h.push(5, 0, true, e) : r >= 5 && ((e || !n && r === 5) && (h.push(r, 0, e, s), r = 6), n && (h.push(r, n, 0, s), r = 6)), e = ""; 40936 }, a = 0;a < n.length; a++) { 40937 a && (r === 1 && p(), p(a)); 40938 for (var l = 0;l < n[a].length; l++) 40939 t = n[a][l], r === 1 ? t === "<" ? (p(), h = [h], r = 3) : e += t : r === 4 ? e === "--" && t === ">" ? (r = 1, e = "") : e = t + e[0] : u ? t === u ? u = "" : e += t : t === '"' || t === "'" ? u = t : t === ">" ? (p(), r = 1) : r && (t === "=" ? (r = 5, s = e, e = "") : t === "/" && (r < 5 || n[a][l + 1] === ">") ? (p(), r === 3 && (h = h[0]), r = h, (h = h[0]).push(2, 0, r), r = 0) : t === " " || t === "\t" || t === ` 40940` || t === "\r" ? (p(), r = 2) : e += t), r === 3 && e === "!--" && (r = 4, h = h[0]); 40941 } 40942 return p(), h; 40943 }(s)), r), arguments, [])).length > 1 ? r : r[0]; 40944} 40945
vendor: 961 bytes, lines 40946-40960
40946// node_modules/@algolia/autocomplete-js/dist/esm/elements/ClearIcon.js 40947var ClearIcon = function ClearIcon(_ref) { 40948 var environment = _ref.environment; 40949 var element = environment.document.createElementNS("http://www.w3.org/2000/svg", "svg"); 40950 element.setAttribute("class", "aa-ClearIcon"); 40951 element.setAttribute("viewBox", "0 0 24 24"); 40952 element.setAttribute("width", "18"); 40953 element.setAttribute("height", "18"); 40954 element.setAttribute("fill", "currentColor"); 40955 var path = environment.document.createElementNS("http://www.w3.org/2000/svg", "path"); 40956 path.setAttribute("d", "M5.293 6.707l5.293 5.293-5.293 5.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l5.293-5.293 5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-5.293-5.293 5.293-5.293c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"); 40957 element.appendChild(path); 40958 return element; 40959}; 40960
vendor: 366 bytes, lines 40961-40970
40961// node_modules/@algolia/autocomplete-js/dist/esm/utils/getHTMLElement.js 40962function getHTMLElement(environment, value) { 40963 if (typeof value === "string") { 40964 var element = environment.document.querySelector(value); 40965 invariant(element !== null, "The element ".concat(JSON.stringify(value), " is not in the document.")); 40966 return element; 40967 } 40968 return value; 40969} 40970
vendor: 560 bytes, lines 40971-40987
40971// node_modules/@algolia/autocomplete-js/dist/esm/utils/mergeClassNames.js 40972function mergeClassNames() { 40973 for (var _len = arguments.length, values = new Array(_len), _key = 0;_key < _len; _key++) { 40974 values[_key] = arguments[_key]; 40975 } 40976 return values.reduce(function(acc, current) { 40977 Object.keys(current).forEach(function(key) { 40978 var accValue = acc[key]; 40979 var currentValue = current[key]; 40980 if (accValue !== currentValue) { 40981 acc[key] = [accValue, currentValue].filter(Boolean).join(" "); 40982 } 40983 }); 40984 return acc; 40985 }, {}); 40986} 40987
vendor: 2,569 bytes, lines 40988-41054
40988// node_modules/@algolia/autocomplete-js/dist/esm/utils/mergeDeep.js 40989function _toConsumableArray5(arr) { 40990 return _arrayWithoutHoles5(arr) || _iterableToArray5(arr) || _unsupportedIterableToArray8(arr) || _nonIterableSpread5(); 40991} 40992function _nonIterableSpread5() { 40993 throw new TypeError(`Invalid attempt to spread non-iterable instance. 40994In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 40995} 40996function _unsupportedIterableToArray8(o, minLen) { 40997 if (!o) 40998 return; 40999 if (typeof o === "string") 41000 return _arrayLikeToArray8(o, minLen); 41001 var n = Object.prototype.toString.call(o).slice(8, -1); 41002 if (n === "Object" && o.constructor) 41003 n = o.constructor.name; 41004 if (n === "Map" || n === "Set") 41005 return Array.from(o); 41006 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 41007 return _arrayLikeToArray8(o, minLen); 41008} 41009function _iterableToArray5(iter) { 41010 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 41011 return Array.from(iter); 41012} 41013function _arrayWithoutHoles5(arr) { 41014 if (Array.isArray(arr)) 41015 return _arrayLikeToArray8(arr); 41016} 41017function _arrayLikeToArray8(arr, len) { 41018 if (len == null || len > arr.length) 41019 len = arr.length; 41020 for (var i = 0, arr2 = new Array(len);i < len; i++) 41021 arr2[i] = arr[i]; 41022 return arr2; 41023} 41024function _typeof16(obj2) { 41025 "@babel/helpers - typeof"; 41026 return _typeof16 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 41027 return typeof obj2; 41028 } : function(obj2) { 41029 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41030 }, _typeof16(obj2); 41031} 41032var isPlainObject = function isPlainObject(value) { 41033 return value && _typeof16(value) === "object" && Object.prototype.toString.call(value) === "[object Object]"; 41034}; 41035function mergeDeep() { 41036 for (var _len = arguments.length, values = new Array(_len), _key = 0;_key < _len; _key++) { 41037 values[_key] = arguments[_key]; 41038 } 41039 return values.reduce(function(acc, current) { 41040 Object.keys(current).forEach(function(key) { 41041 var accValue = acc[key]; 41042 var currentValue = current[key]; 41043 if (Array.isArray(accValue) && Array.isArray(currentValue)) { 41044 acc[key] = accValue.concat.apply(accValue, _toConsumableArray5(currentValue)); 41045 } else if (isPlainObject(accValue) && isPlainObject(currentValue)) { 41046 acc[key] = mergeDeep(accValue, currentValue); 41047 } else { 41048 acc[key] = currentValue; 41049 } 41050 }); 41051 return acc; 41052 }, {}); 41053} 41054
vendor: 4,348 bytes, lines 41055-41179
41055// node_modules/@algolia/autocomplete-js/dist/esm/utils/pickBy.js 41056function _typeof17(obj2) { 41057 "@babel/helpers - typeof"; 41058 return _typeof17 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 41059 return typeof obj2; 41060 } : function(obj2) { 41061 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41062 }, _typeof17(obj2); 41063} 41064function ownKeys15(object, enumerableOnly) { 41065 var keys = Object.keys(object); 41066 if (Object.getOwnPropertySymbols) { 41067 var symbols = Object.getOwnPropertySymbols(object); 41068 enumerableOnly && (symbols = symbols.filter(function(sym) { 41069 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41070 })), keys.push.apply(keys, symbols); 41071 } 41072 return keys; 41073} 41074function _objectSpread15(target) { 41075 for (var i = 1;i < arguments.length; i++) { 41076 var source = arguments[i] != null ? arguments[i] : {}; 41077 i % 2 ? ownKeys15(Object(source), true).forEach(function(key) { 41078 _defineProperty15(target, key, source[key]); 41079 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys15(Object(source)).forEach(function(key) { 41080 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 41081 }); 41082 } 41083 return target; 41084} 41085function _defineProperty15(obj2, key, value) { 41086 key = _toPropertyKey15(key); 41087 if (key in obj2) { 41088 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 41089 } else { 41090 obj2[key] = value; 41091 } 41092 return obj2; 41093} 41094function _toPropertyKey15(arg) { 41095 var key = _toPrimitive15(arg, "string"); 41096 return _typeof17(key) === "symbol" ? key : String(key); 41097} 41098function _toPrimitive15(input, hint) { 41099 if (_typeof17(input) !== "object" || input === null) 41100 return input; 41101 var prim = input[Symbol.toPrimitive]; 41102 if (prim !== undefined) { 41103 var res = prim.call(input, hint || "default"); 41104 if (_typeof17(res) !== "object") 41105 return res; 41106 throw new TypeError("@@toPrimitive must return a primitive value."); 41107 } 41108 return (hint === "string" ? String : Number)(input); 41109} 41110function _slicedToArray3(arr, i) { 41111 return _arrayWithHoles3(arr) || _iterableToArrayLimit3(arr, i) || _unsupportedIterableToArray9(arr, i) || _nonIterableRest3(); 41112} 41113function _nonIterableRest3() { 41114 throw new TypeError(`Invalid attempt to destructure non-iterable instance. 41115In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 41116} 41117function _unsupportedIterableToArray9(o, minLen) { 41118 if (!o) 41119 return; 41120 if (typeof o === "string") 41121 return _arrayLikeToArray9(o, minLen); 41122 var n = Object.prototype.toString.call(o).slice(8, -1); 41123 if (n === "Object" && o.constructor) 41124 n = o.constructor.name; 41125 if (n === "Map" || n === "Set") 41126 return Array.from(o); 41127 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 41128 return _arrayLikeToArray9(o, minLen); 41129} 41130function _arrayLikeToArray9(arr, len) { 41131 if (len == null || len > arr.length) 41132 len = arr.length; 41133 for (var i = 0, arr2 = new Array(len);i < len; i++) 41134 arr2[i] = arr[i]; 41135 return arr2; 41136} 41137function _iterableToArrayLimit3(arr, i) { 41138 var _i = arr == null ? null : typeof Symbol != "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; 41139 if (_i != null) { 41140 var _s, _e, _x, _r, _arr = [], _n = true, _d = false; 41141 try { 41142 if (_x = (_i = _i.call(arr)).next, i === 0) { 41143 if (Object(_i) !== _i) 41144 return; 41145 _n = false; 41146 } else 41147 for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true) 41148 ; 41149 } catch (err) { 41150 _d = true, _e = err; 41151 } finally { 41152 try { 41153 if (!_n && _i.return != null && (_r = _i.return(), Object(_r) !== _r)) 41154 return; 41155 } finally { 41156 if (_d) 41157 throw _e; 41158 } 41159 } 41160 return _arr; 41161 } 41162} 41163function _arrayWithHoles3(arr) { 41164 if (Array.isArray(arr)) 41165 return arr; 41166} 41167function pickBy(obj2, predicate) { 41168 return Object.entries(obj2).reduce(function(acc, _ref) { 41169 var _ref2 = _slicedToArray3(_ref, 2), key = _ref2[0], value = _ref2[1]; 41170 if (predicate({ 41171 key, 41172 value 41173 })) { 41174 return _objectSpread15(_objectSpread15({}, acc), {}, _defineProperty15({}, key, value)); 41175 } 41176 return acc; 41177 }, {}); 41178} 41179
vendor: 2,548 bytes, lines 41180-41260
41180// node_modules/@algolia/autocomplete-js/dist/esm/utils/setProperties.js 41181var TOUCH_EVENTS_ALIASES = ["ontouchstart", "ontouchend", "ontouchmove", "ontouchcancel"]; 41182function setStyle(style, key, value) { 41183 if (value === null) { 41184 style[key] = ""; 41185 } else if (typeof value !== "number") { 41186 style[key] = value; 41187 } else { 41188 style[key] = value + "px"; 41189 } 41190} 41191function eventProxy(event) { 41192 var _this$_listeners; 41193 this === null || this === undefined || (_this$_listeners = this._listeners) === null || _this$_listeners === undefined || _this$_listeners[event.type](event); 41194} 41195function setProperty(dom, name, value) { 41196 var useCapture; 41197 var nameLower; 41198 var oldValue = dom[name]; 41199 if (name === "style") { 41200 if (typeof value == "string") { 41201 dom.style = value; 41202 } else { 41203 if (value === null) { 41204 dom.style = ""; 41205 } else { 41206 for (name in value) { 41207 if (!oldValue || value[name] !== oldValue[name]) { 41208 setStyle(dom.style, name, value[name]); 41209 } 41210 } 41211 } 41212 } 41213 } else if (name[0] === "o" && name[1] === "n") { 41214 useCapture = name !== (name = name.replace(/Capture$/, "")); 41215 nameLower = name.toLowerCase(); 41216 if (nameLower in dom || TOUCH_EVENTS_ALIASES.includes(nameLower)) 41217 name = nameLower; 41218 name = name.slice(2); 41219 if (!dom._listeners) 41220 dom._listeners = {}; 41221 dom._listeners[name] = value; 41222 if (value) { 41223 if (!oldValue) 41224 dom.addEventListener(name, eventProxy, useCapture); 41225 } else { 41226 dom.removeEventListener(name, eventProxy, useCapture); 41227 } 41228 } else if (name !== "list" && name !== "tagName" && name !== "form" && name !== "type" && name !== "size" && name !== "download" && name !== "href" && name in dom) { 41229 dom[name] = value == null ? "" : value; 41230 } else if (typeof value != "function" && name !== "dangerouslySetInnerHTML") { 41231 if (value == null || value === false && !/^ar/.test(name)) { 41232 dom.removeAttribute(name); 41233 } else { 41234 dom.setAttribute(name, value); 41235 } 41236 } 41237} 41238function getNormalizedName(name) { 41239 switch (name) { 41240 case "onChange": 41241 return "onInput"; 41242 case "onCompositionEnd": 41243 return "oncompositionend"; 41244 default: 41245 return name; 41246 } 41247} 41248function setProperties(dom, props) { 41249 for (var name in props) { 41250 setProperty(dom, getNormalizedName(name), props[name]); 41251 } 41252} 41253function setPropertiesWithoutEvents(dom, props) { 41254 for (var name in props) { 41255 if (!(name[0] === "o" && name[1] === "n")) { 41256 setProperty(dom, getNormalizedName(name), props[name]); 41257 } 41258 } 41259} 41260
vendor: 2,723 bytes, lines 41261-41339
41261// node_modules/@algolia/autocomplete-js/dist/esm/getCreateDomElement.js 41262var _excluded7 = ["children"]; 41263function _toConsumableArray6(arr) { 41264 return _arrayWithoutHoles6(arr) || _iterableToArray6(arr) || _unsupportedIterableToArray10(arr) || _nonIterableSpread6(); 41265} 41266function _nonIterableSpread6() { 41267 throw new TypeError(`Invalid attempt to spread non-iterable instance. 41268In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 41269} 41270function _unsupportedIterableToArray10(o, minLen) { 41271 if (!o) 41272 return; 41273 if (typeof o === "string") 41274 return _arrayLikeToArray10(o, minLen); 41275 var n = Object.prototype.toString.call(o).slice(8, -1); 41276 if (n === "Object" && o.constructor) 41277 n = o.constructor.name; 41278 if (n === "Map" || n === "Set") 41279 return Array.from(o); 41280 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 41281 return _arrayLikeToArray10(o, minLen); 41282} 41283function _iterableToArray6(iter) { 41284 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 41285 return Array.from(iter); 41286} 41287function _arrayWithoutHoles6(arr) { 41288 if (Array.isArray(arr)) 41289 return _arrayLikeToArray10(arr); 41290} 41291function _arrayLikeToArray10(arr, len) { 41292 if (len == null || len > arr.length) 41293 len = arr.length; 41294 for (var i = 0, arr2 = new Array(len);i < len; i++) 41295 arr2[i] = arr[i]; 41296 return arr2; 41297} 41298function _objectWithoutProperties5(source, excluded) { 41299 if (source == null) 41300 return {}; 41301 var target = _objectWithoutPropertiesLoose5(source, excluded); 41302 var key, i; 41303 if (Object.getOwnPropertySymbols) { 41304 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 41305 for (i = 0;i < sourceSymbolKeys.length; i++) { 41306 key = sourceSymbolKeys[i]; 41307 if (excluded.indexOf(key) >= 0) 41308 continue; 41309 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 41310 continue; 41311 target[key] = source[key]; 41312 } 41313 } 41314 return target; 41315} 41316function _objectWithoutPropertiesLoose5(source, excluded) { 41317 if (source == null) 41318 return {}; 41319 var target = {}; 41320 var sourceKeys = Object.keys(source); 41321 var key, i; 41322 for (i = 0;i < sourceKeys.length; i++) { 41323 key = sourceKeys[i]; 41324 if (excluded.indexOf(key) >= 0) 41325 continue; 41326 target[key] = source[key]; 41327 } 41328 return target; 41329} 41330function getCreateDomElement(environment) { 41331 return function createDomElement(tagName, _ref) { 41332 var _ref$children = _ref.children, children = _ref$children === undefined ? [] : _ref$children, props = _objectWithoutProperties5(_ref, _excluded7); 41333 var element = environment.document.createElement(tagName); 41334 setProperties(element, props); 41335 element.append.apply(element, _toConsumableArray6(children)); 41336 return element; 41337 }; 41338} 41339
vendor: 3,965 bytes, lines 41340-41449
41340// node_modules/@algolia/autocomplete-js/dist/esm/elements/Input.js 41341function _typeof18(obj2) { 41342 "@babel/helpers - typeof"; 41343 return _typeof18 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 41344 return typeof obj2; 41345 } : function(obj2) { 41346 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41347 }, _typeof18(obj2); 41348} 41349var _excluded8 = ["autocompleteScopeApi", "environment", "classNames", "getInputProps", "getInputPropsCore", "isDetached", "state"]; 41350function ownKeys16(object, enumerableOnly) { 41351 var keys = Object.keys(object); 41352 if (Object.getOwnPropertySymbols) { 41353 var symbols = Object.getOwnPropertySymbols(object); 41354 enumerableOnly && (symbols = symbols.filter(function(sym) { 41355 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41356 })), keys.push.apply(keys, symbols); 41357 } 41358 return keys; 41359} 41360function _objectSpread16(target) { 41361 for (var i = 1;i < arguments.length; i++) { 41362 var source = arguments[i] != null ? arguments[i] : {}; 41363 i % 2 ? ownKeys16(Object(source), true).forEach(function(key) { 41364 _defineProperty16(target, key, source[key]); 41365 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys16(Object(source)).forEach(function(key) { 41366 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 41367 }); 41368 } 41369 return target; 41370} 41371function _defineProperty16(obj2, key, value) { 41372 key = _toPropertyKey16(key); 41373 if (key in obj2) { 41374 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 41375 } else { 41376 obj2[key] = value; 41377 } 41378 return obj2; 41379} 41380function _toPropertyKey16(arg) { 41381 var key = _toPrimitive16(arg, "string"); 41382 return _typeof18(key) === "symbol" ? key : String(key); 41383} 41384function _toPrimitive16(input, hint) { 41385 if (_typeof18(input) !== "object" || input === null) 41386 return input; 41387 var prim = input[Symbol.toPrimitive]; 41388 if (prim !== undefined) { 41389 var res = prim.call(input, hint || "default"); 41390 if (_typeof18(res) !== "object") 41391 return res; 41392 throw new TypeError("@@toPrimitive must return a primitive value."); 41393 } 41394 return (hint === "string" ? String : Number)(input); 41395} 41396function _objectWithoutProperties6(source, excluded) { 41397 if (source == null) 41398 return {}; 41399 var target = _objectWithoutPropertiesLoose6(source, excluded); 41400 var key, i; 41401 if (Object.getOwnPropertySymbols) { 41402 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 41403 for (i = 0;i < sourceSymbolKeys.length; i++) { 41404 key = sourceSymbolKeys[i]; 41405 if (excluded.indexOf(key) >= 0) 41406 continue; 41407 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 41408 continue; 41409 target[key] = source[key]; 41410 } 41411 } 41412 return target; 41413} 41414function _objectWithoutPropertiesLoose6(source, excluded) { 41415 if (source == null) 41416 return {}; 41417 var target = {}; 41418 var sourceKeys = Object.keys(source); 41419 var key, i; 41420 for (i = 0;i < sourceKeys.length; i++) { 41421 key = sourceKeys[i]; 41422 if (excluded.indexOf(key) >= 0) 41423 continue; 41424 target[key] = source[key]; 41425 } 41426 return target; 41427} 41428var Input = function Input(_ref) { 41429 var { autocompleteScopeApi, environment, classNames, getInputProps, getInputPropsCore, isDetached, state } = _ref, props = _objectWithoutProperties6(_ref, _excluded8); 41430 var createDomElement = getCreateDomElement(environment); 41431 var element = createDomElement("input", props); 41432 var inputProps = getInputProps(_objectSpread16({ 41433 state, 41434 props: getInputPropsCore({ 41435 inputElement: element 41436 }), 41437 inputElement: element 41438 }, autocompleteScopeApi)); 41439 setProperties(element, _objectSpread16(_objectSpread16({}, inputProps), {}, { 41440 onKeyDown: function onKeyDown(event) { 41441 if (isDetached && event.key === "Tab") { 41442 return; 41443 } 41444 inputProps.onKeyDown(event); 41445 } 41446 })); 41447 return element; 41448}; 41449
vendor: 1,081 bytes, lines 41450-41488
41450// node_modules/@algolia/autocomplete-js/dist/esm/elements/LoadingIcon.js 41451var LoadingIcon = function LoadingIcon(_ref) { 41452 var environment = _ref.environment; 41453 var element = environment.document.createElementNS("http://www.w3.org/2000/svg", "svg"); 41454 element.setAttribute("class", "aa-LoadingIcon"); 41455 element.setAttribute("viewBox", "0 0 100 100"); 41456 element.setAttribute("width", "20"); 41457 element.setAttribute("height", "20"); 41458 element.innerHTML = `<circle 41459 cx="50" 41460 cy="50" 41461 fill="none" 41462 r="35" 41463 stroke="currentColor" 41464 stroke-dasharray="164.93361431346415 56.97787143782138" 41465 stroke-width="6" 41466> 41467 <animateTransform 41468 attributeName="transform" 41469 type="rotate" 41470 repeatCount="indefinite" 41471 dur="1s" 41472 values="0 50 50;90 50 50;180 50 50;360 50 50" 41473 keyTimes="0;0.40;0.65;1" 41474 /> 41475</circle>`; 41476 var pauseAnimations = function pauseAnimations() { 41477 if (!element.parentElement) { 41478 setTimeout(pauseAnimations, 0); 41479 return; 41480 } 41481 element.pauseAnimations(); 41482 }; 41483 if ("pauseAnimations" in element) { 41484 pauseAnimations(); 41485 } 41486 return element; 41487}; 41488
vendor: 1,247 bytes, lines 41489-41503
41489// node_modules/@algolia/autocomplete-js/dist/esm/elements/SearchIcon.js 41490var SearchIcon = function SearchIcon(_ref) { 41491 var environment = _ref.environment; 41492 var element = environment.document.createElementNS("http://www.w3.org/2000/svg", "svg"); 41493 element.setAttribute("class", "aa-SubmitIcon"); 41494 element.setAttribute("viewBox", "0 0 24 24"); 41495 element.setAttribute("width", "20"); 41496 element.setAttribute("height", "20"); 41497 element.setAttribute("fill", "currentColor"); 41498 var path = environment.document.createElementNS("http://www.w3.org/2000/svg", "path"); 41499 path.setAttribute("d", "M16.041 15.856c-0.034 0.026-0.067 0.055-0.099 0.087s-0.060 0.064-0.087 0.099c-1.258 1.213-2.969 1.958-4.855 1.958-1.933 0-3.682-0.782-4.95-2.050s-2.050-3.017-2.050-4.95 0.782-3.682 2.050-4.95 3.017-2.050 4.95-2.050 3.682 0.782 4.95 2.050 2.050 3.017 2.050 4.95c0 1.886-0.745 3.597-1.959 4.856zM21.707 20.293l-3.675-3.675c1.231-1.54 1.968-3.493 1.968-5.618 0-2.485-1.008-4.736-2.636-6.364s-3.879-2.636-6.364-2.636-4.736 1.008-6.364 2.636-2.636 3.879-2.636 6.364 1.008 4.736 2.636 6.364 3.879 2.636 6.364 2.636c2.125 0 4.078-0.737 5.618-1.968l3.675 3.675c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"); 41500 element.appendChild(path); 41501 return element; 41502}; 41503
vendor: 7,254 bytes, lines 41504-41717
41504// node_modules/@algolia/autocomplete-js/dist/esm/createAutocompleteDom.js 41505function _typeof19(obj2) { 41506 "@babel/helpers - typeof"; 41507 return _typeof19 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 41508 return typeof obj2; 41509 } : function(obj2) { 41510 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 41511 }, _typeof19(obj2); 41512} 41513function ownKeys17(object, enumerableOnly) { 41514 var keys = Object.keys(object); 41515 if (Object.getOwnPropertySymbols) { 41516 var symbols = Object.getOwnPropertySymbols(object); 41517 enumerableOnly && (symbols = symbols.filter(function(sym) { 41518 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 41519 })), keys.push.apply(keys, symbols); 41520 } 41521 return keys; 41522} 41523function _objectSpread17(target) { 41524 for (var i = 1;i < arguments.length; i++) { 41525 var source = arguments[i] != null ? arguments[i] : {}; 41526 i % 2 ? ownKeys17(Object(source), true).forEach(function(key) { 41527 _defineProperty17(target, key, source[key]); 41528 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys17(Object(source)).forEach(function(key) { 41529 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 41530 }); 41531 } 41532 return target; 41533} 41534function _defineProperty17(obj2, key, value) { 41535 key = _toPropertyKey17(key); 41536 if (key in obj2) { 41537 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 41538 } else { 41539 obj2[key] = value; 41540 } 41541 return obj2; 41542} 41543function _toPropertyKey17(arg) { 41544 var key = _toPrimitive17(arg, "string"); 41545 return _typeof19(key) === "symbol" ? key : String(key); 41546} 41547function _toPrimitive17(input, hint) { 41548 if (_typeof19(input) !== "object" || input === null) 41549 return input; 41550 var prim = input[Symbol.toPrimitive]; 41551 if (prim !== undefined) { 41552 var res = prim.call(input, hint || "default"); 41553 if (_typeof19(res) !== "object") 41554 return res; 41555 throw new TypeError("@@toPrimitive must return a primitive value."); 41556 } 41557 return (hint === "string" ? String : Number)(input); 41558} 41559function createAutocompleteDom(_ref) { 41560 var { autocomplete, autocompleteScopeApi, classNames, environment, isDetached, placeholder: _ref$placeholder } = _ref, placeholder = _ref$placeholder === undefined ? "Search" : _ref$placeholder, { propGetters, setIsModalOpen, state, translations } = _ref; 41561 var createDomElement = getCreateDomElement(environment); 41562 var rootProps = propGetters.getRootProps(_objectSpread17({ 41563 state, 41564 props: autocomplete.getRootProps({}) 41565 }, autocompleteScopeApi)); 41566 var root2 = createDomElement("div", _objectSpread17({ 41567 class: classNames.root 41568 }, rootProps)); 41569 var detachedContainer = createDomElement("div", { 41570 class: classNames.detachedContainer, 41571 onMouseDown: function onMouseDown(event) { 41572 event.stopPropagation(); 41573 } 41574 }); 41575 var detachedOverlay = createDomElement("div", { 41576 class: classNames.detachedOverlay, 41577 children: [detachedContainer], 41578 onMouseDown: function onMouseDown() { 41579 setIsModalOpen(false); 41580 autocomplete.setIsOpen(false); 41581 } 41582 }); 41583 var labelProps = propGetters.getLabelProps(_objectSpread17({ 41584 state, 41585 props: autocomplete.getLabelProps({}) 41586 }, autocompleteScopeApi)); 41587 var submitButton = createDomElement("button", { 41588 class: classNames.submitButton, 41589 type: "submit", 41590 title: translations.submitButtonTitle, 41591 children: [SearchIcon({ 41592 environment 41593 })] 41594 }); 41595 var label = createDomElement("label", _objectSpread17({ 41596 class: classNames.label, 41597 children: [submitButton], 41598 ariaLabel: translations.submitButtonTitle 41599 }, labelProps)); 41600 var clearButton = createDomElement("button", { 41601 class: classNames.clearButton, 41602 type: "reset", 41603 title: translations.clearButtonTitle, 41604 children: [ClearIcon({ 41605 environment 41606 })] 41607 }); 41608 var loadingIndicator = createDomElement("div", { 41609 class: classNames.loadingIndicator, 41610 children: [LoadingIcon({ 41611 environment 41612 })] 41613 }); 41614 var input = Input({ 41615 class: classNames.input, 41616 environment, 41617 state, 41618 getInputProps: propGetters.getInputProps, 41619 getInputPropsCore: autocomplete.getInputProps, 41620 autocompleteScopeApi, 41621 isDetached 41622 }); 41623 var inputWrapperPrefix = createDomElement("div", { 41624 class: classNames.inputWrapperPrefix, 41625 children: [label, loadingIndicator] 41626 }); 41627 var inputWrapperSuffix = createDomElement("div", { 41628 class: classNames.inputWrapperSuffix, 41629 children: [clearButton] 41630 }); 41631 var inputWrapper = createDomElement("div", { 41632 class: classNames.inputWrapper, 41633 children: [input] 41634 }); 41635 var formProps = propGetters.getFormProps(_objectSpread17({ 41636 state, 41637 props: autocomplete.getFormProps({ 41638 inputElement: input 41639 }) 41640 }, autocompleteScopeApi)); 41641 var form = createDomElement("form", _objectSpread17({ 41642 class: classNames.form, 41643 children: [inputWrapperPrefix, inputWrapper, inputWrapperSuffix] 41644 }, formProps)); 41645 var panelProps = propGetters.getPanelProps(_objectSpread17({ 41646 state, 41647 props: autocomplete.getPanelProps({}) 41648 }, autocompleteScopeApi)); 41649 var panel = createDomElement("div", _objectSpread17({ 41650 class: classNames.panel 41651 }, panelProps)); 41652 var detachedSearchButtonQuery = createDomElement("div", { 41653 class: classNames.detachedSearchButtonQuery, 41654 textContent: state.query 41655 }); 41656 var detachedSearchButtonPlaceholder = createDomElement("div", { 41657 class: classNames.detachedSearchButtonPlaceholder, 41658 hidden: Boolean(state.query), 41659 textContent: placeholder 41660 }); 41661 if (false) {} 41662 if (isDetached) { 41663 var detachedSearchButtonIcon = createDomElement("div", { 41664 class: classNames.detachedSearchButtonIcon, 41665 ariaLabel: translations.detachedSearchButtonTitle, 41666 children: [SearchIcon({ 41667 environment 41668 })] 41669 }); 41670 var detachedSearchButton = createDomElement("button", { 41671 type: "button", 41672 class: classNames.detachedSearchButton, 41673 title: translations.detachedSearchButtonTitle, 41674 id: labelProps.id, 41675 onClick: function onClick() { 41676 setIsModalOpen(true); 41677 }, 41678 children: [detachedSearchButtonIcon, detachedSearchButtonPlaceholder, detachedSearchButtonQuery] 41679 }); 41680 var detachedCancelButton = createDomElement("button", { 41681 type: "button", 41682 class: classNames.detachedCancelButton, 41683 textContent: translations.detachedCancelButtonText, 41684 onTouchStart: function onTouchStart(event) { 41685 event.stopPropagation(); 41686 }, 41687 onClick: function onClick() { 41688 autocomplete.setIsOpen(false); 41689 setIsModalOpen(false); 41690 } 41691 }); 41692 var detachedFormContainer = createDomElement("div", { 41693 class: classNames.detachedFormContainer, 41694 children: [form, detachedCancelButton] 41695 }); 41696 detachedContainer.appendChild(detachedFormContainer); 41697 root2.appendChild(detachedSearchButton); 41698 } else { 41699 root2.appendChild(form); 41700 } 41701 return { 41702 detachedContainer, 41703 detachedOverlay, 41704 detachedSearchButtonQuery, 41705 detachedSearchButtonPlaceholder, 41706 inputWrapper, 41707 input, 41708 root: root2, 41709 form, 41710 label, 41711 submitButton, 41712 clearButton, 41713 loadingIndicator, 41714 panel 41715 }; 41716} 41717
vendor: 681 bytes, lines 41718-41745
41718// node_modules/@algolia/autocomplete-js/dist/esm/createEffectWrapper.js 41719function createEffectWrapper() { 41720 var effects = []; 41721 var cleanups = []; 41722 function runEffect(fn2) { 41723 effects.push(fn2); 41724 var effectCleanup = fn2(); 41725 cleanups.push(effectCleanup); 41726 } 41727 return { 41728 runEffect, 41729 cleanupEffects: function cleanupEffects() { 41730 var currentCleanups = cleanups; 41731 cleanups = []; 41732 currentCleanups.forEach(function(cleanup) { 41733 cleanup(); 41734 }); 41735 }, 41736 runEffects: function runEffects() { 41737 var currentEffects = effects; 41738 effects = []; 41739 currentEffects.forEach(function(effect) { 41740 runEffect(effect); 41741 }); 41742 } 41743 }; 41744} 41745
vendor: 667 bytes, lines 41746-41774
41746// node_modules/@algolia/autocomplete-js/dist/esm/createReactiveWrapper.js 41747function createReactiveWrapper() { 41748 var reactives = []; 41749 return { 41750 reactive: function reactive(value) { 41751 var current = value(); 41752 var reactive = { 41753 _fn: value, 41754 _ref: { 41755 current 41756 }, 41757 get value() { 41758 return this._ref.current; 41759 }, 41760 set value(value) { 41761 this._ref.current = value; 41762 } 41763 }; 41764 reactives.push(reactive); 41765 return reactive; 41766 }, 41767 runReactives: function runReactives() { 41768 reactives.forEach(function(value) { 41769 value._ref.current = value._fn(); 41770 }); 41771 } 41772 }; 41773} 41774
vendor: 14,313 bytes, lines 41775-42083
41775// node_modules/preact/dist/preact.module.js 41776var n2; 41777var l; 41778var u; 41779var t2; 41780var i; 41781var r; 41782var o; 41783var e; 41784var f; 41785var c; 41786var s; 41787var a; 41788var h; 41789var p = {}; 41790var v = []; 41791var y = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; 41792var d = Array.isArray; 41793function w(n, l) { 41794 for (var u in l) 41795 n[u] = l[u]; 41796 return n; 41797} 41798function g(n) { 41799 n && n.parentNode && n.parentNode.removeChild(n); 41800} 41801function _(l, u, t) { 41802 var i, r, o, e = {}; 41803 for (o in u) 41804 o == "key" ? i = u[o] : o == "ref" ? r = u[o] : e[o] = u[o]; 41805 if (arguments.length > 2 && (e.children = arguments.length > 3 ? n2.call(arguments, 2) : t), typeof l == "function" && l.defaultProps != null) 41806 for (o in l.defaultProps) 41807 e[o] === undefined && (e[o] = l.defaultProps[o]); 41808 return m3(l, e, i, r, null); 41809} 41810function m3(n, t, i, r, o) { 41811 var e = { type: n, props: t, key: i, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: undefined, __v: o == null ? ++u : o, __i: -1, __u: 0 }; 41812 return o == null && l.vnode != null && l.vnode(e), e; 41813} 41814function k(n) { 41815 return n.children; 41816} 41817function x(n, l) { 41818 this.props = n, this.context = l; 41819} 41820function S(n, l) { 41821 if (l == null) 41822 return n.__ ? S(n.__, n.__i + 1) : null; 41823 for (var u;l < n.__k.length; l++) 41824 if ((u = n.__k[l]) != null && u.__e != null) 41825 return u.__e; 41826 return typeof n.type == "function" ? S(n) : null; 41827} 41828function C(n) { 41829 if (n.__P && n.__d) { 41830 var u = n.__v, t = u.__e, i = [], r = [], o = w({}, u); 41831 o.__v = u.__v + 1, l.vnode && l.vnode(o), z(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, t == null ? S(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, V(i, o, r), u.__e = u.__ = null, o.__e != t && M(o); 41832 } 41833} 41834function M(n) { 41835 if ((n = n.__) != null && n.__c != null) 41836 return n.__e = n.__c.base = null, n.__k.some(function(l) { 41837 if (l != null && l.__e != null) 41838 return n.__e = n.__c.base = l.__e; 41839 }), M(n); 41840} 41841function $10(n) { 41842 (!n.__d && (n.__d = true) && i.push(n) && !I.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(I); 41843} 41844function I() { 41845 for (var n, l = 1;i.length; ) 41846 i.length > l && i.sort(e), n = i.shift(), l = i.length, C(n); 41847 I.__r = 0; 41848} 41849function P(n, l, u, t, i, r, o, e, f, c, s) { 41850 var a, h, y, d, w, g, _, m2 = t && t.__k || v, b = l.length; 41851 for (f = A(u, l, m2, f, b), a = 0;a < b; a++) 41852 (y = u.__k[a]) != null && (h = y.__i != -1 && m2[y.__i] || p, y.__i = a, g = z(n, y, h, i, r, o, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && D(h.ref, null, y), s.push(y.ref, y.__c || d, y)), w == null && d != null && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = H(y, f, n, _) : typeof y.type == "function" && g !== undefined ? f = g : d && (f = d.nextSibling), y.__u &= -7); 41853 return u.__e = w, f; 41854} 41855function A(n, l, u, t, i) { 41856 var r, o, e, f, c, s = u.length, a = s, h = 0; 41857 for (n.__k = new Array(i), r = 0;r < i; r++) 41858 (o = l[r]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = n.__k[r] = m3(null, o, null, null, null) : d(o) ? o = n.__k[r] = m3(k, { children: o }, null, null, null) : o.constructor === undefined && o.__b > 0 ? o = n.__k[r] = m3(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : n.__k[r] = o, f = r + h, o.__ = n, o.__b = n.__b + 1, e = null, (c = o.__i = T(o, u, f, a)) != -1 && (a--, (e = u[c]) && (e.__u |= 2)), e == null || e.__v == null ? (c == -1 && (i > s ? h-- : i < s && h++), typeof o.type != "function" && (o.__u |= 4)) : c != f && (c == f - 1 ? h-- : c == f + 1 ? h++ : (c > f ? h-- : h++, o.__u |= 4))) : n.__k[r] = null; 41859 if (a) 41860 for (r = 0;r < s; r++) 41861 (e = u[r]) != null && (2 & e.__u) == 0 && (e.__e == t && (t = S(e)), E(e, e)); 41862 return t; 41863} 41864function H(n, l, u, t) { 41865 var i, r; 41866 if (typeof n.type == "function") { 41867 for (i = n.__k, r = 0;i && r < i.length; r++) 41868 i[r] && (i[r].__ = n, l = H(i[r], l, u, t)); 41869 return l; 41870 } 41871 n.__e != l && (t && (l && n.type && !l.parentNode && (l = S(n)), u.insertBefore(n.__e, l || null)), l = n.__e); 41872 do { 41873 l = l && l.nextSibling; 41874 } while (l != null && l.nodeType == 8); 41875 return l; 41876} 41877function T(n, l, u, t) { 41878 var i, r, o, { key: e, type: f } = n, c = l[u], s = c != null && (2 & c.__u) == 0; 41879 if (c === null && e == null || s && e == c.key && f == c.type) 41880 return u; 41881 if (t > (s ? 1 : 0)) { 41882 for (i = u - 1, r = u + 1;i >= 0 || r < l.length; ) 41883 if ((c = l[o = i >= 0 ? i-- : r++]) != null && (2 & c.__u) == 0 && e == c.key && f == c.type) 41884 return o; 41885 } 41886 return -1; 41887} 41888function j(n, l, u) { 41889 l[0] == "-" ? n.setProperty(l, u == null ? "" : u) : n[l] = u == null ? "" : typeof u != "number" || y.test(l) ? u : u + "px"; 41890} 41891function F(n, l, u, t, i) { 41892 var r, o; 41893 n: 41894 if (l == "style") 41895 if (typeof u == "string") 41896 n.style.cssText = u; 41897 else { 41898 if (typeof t == "string" && (n.style.cssText = t = ""), t) 41899 for (l in t) 41900 u && l in u || j(n.style, l, ""); 41901 if (u) 41902 for (l in u) 41903 t && u[l] == t[l] || j(n.style, l, u[l]); 41904 } 41905 else if (l[0] == "o" && l[1] == "n") 41906 r = l != (l = l.replace(f, "$1")), o = l.toLowerCase(), l = o in n || l == "onFocusOut" || l == "onFocusIn" ? o.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + r] = u, u ? t ? u.u = t.u : (u.u = c, n.addEventListener(l, r ? a : s, r)) : n.removeEventListener(l, r ? a : s, r); 41907 else { 41908 if (i == "http://www.w3.org/2000/svg") 41909 l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); 41910 else if (l != "width" && l != "height" && l != "href" && l != "list" && l != "form" && l != "tabIndex" && l != "download" && l != "rowSpan" && l != "colSpan" && l != "role" && l != "popover" && l in n) 41911 try { 41912 n[l] = u == null ? "" : u; 41913 break n; 41914 } catch (n) {} 41915 typeof u == "function" || (u == null || u === false && l[4] != "-" ? n.removeAttribute(l) : n.setAttribute(l, l == "popover" && u == 1 ? "" : u)); 41916 } 41917} 41918function O(n) { 41919 return function(u) { 41920 if (this.l) { 41921 var t = this.l[u.type + n]; 41922 if (u.t == null) 41923 u.t = c++; 41924 else if (u.t < t.u) 41925 return; 41926 return t(l.event ? l.event(u) : u); 41927 } 41928 }; 41929} 41930function z(n, u, t, i, r, o, e, f, c, s) { 41931 var a, h, p, y, _, m2, b, S, C, M, $2, I, A, H, L, T = u.type; 41932 if (u.constructor !== undefined) 41933 return null; 41934 128 & t.__u && (c = !!(32 & t.__u), o = [f = u.__e = t.__e]), (a = l.__b) && a(u); 41935 n: 41936 if (typeof T == "function") 41937 try { 41938 if (S = u.props, C = "prototype" in T && T.prototype.render, M = (a = T.contextType) && i[a.__c], $2 = a ? M ? M.props.value : a.__ : i, t.__c ? b = (h = u.__c = t.__c).__ = h.__E : (C ? u.__c = h = new T(S, $2) : (u.__c = h = new x(S, $2), h.constructor = T, h.render = G), M && M.sub(h), h.state || (h.state = {}), h.__n = i, p = h.__d = true, h.__h = [], h._sb = []), C && h.__s == null && (h.__s = h.state), C && T.getDerivedStateFromProps != null && (h.__s == h.state && (h.__s = w({}, h.__s)), w(h.__s, T.getDerivedStateFromProps(S, h.__s))), y = h.props, _ = h.state, h.__v = u, p) 41939 C && T.getDerivedStateFromProps == null && h.componentWillMount != null && h.componentWillMount(), C && h.componentDidMount != null && h.__h.push(h.componentDidMount); 41940 else { 41941 if (C && T.getDerivedStateFromProps == null && S !== y && h.componentWillReceiveProps != null && h.componentWillReceiveProps(S, $2), u.__v == t.__v || !h.__e && h.shouldComponentUpdate != null && h.shouldComponentUpdate(S, h.__s, $2) === false) { 41942 u.__v != t.__v && (h.props = S, h.state = h.__s, h.__d = false), u.__e = t.__e, u.__k = t.__k, u.__k.some(function(n) { 41943 n && (n.__ = u); 41944 }), v.push.apply(h.__h, h._sb), h._sb = [], h.__h.length && e.push(h); 41945 break n; 41946 } 41947 h.componentWillUpdate != null && h.componentWillUpdate(S, h.__s, $2), C && h.componentDidUpdate != null && h.__h.push(function() { 41948 h.componentDidUpdate(y, _, m2); 41949 }); 41950 } 41951 if (h.context = $2, h.props = S, h.__P = n, h.__e = false, I = l.__r, A = 0, C) 41952 h.state = h.__s, h.__d = false, I && I(u), a = h.render(h.props, h.state, h.context), v.push.apply(h.__h, h._sb), h._sb = []; 41953 else 41954 do { 41955 h.__d = false, I && I(u), a = h.render(h.props, h.state, h.context), h.state = h.__s; 41956 } while (h.__d && ++A < 25); 41957 h.state = h.__s, h.getChildContext != null && (i = w(w({}, i), h.getChildContext())), C && !p && h.getSnapshotBeforeUpdate != null && (m2 = h.getSnapshotBeforeUpdate(y, _)), H = a != null && a.type === k && a.key == null ? q(a.props.children) : a, f = P(n, d(H) ? H : [H], u, t, i, r, o, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), b && (h.__E = h.__ = null); 41958 } catch (n) { 41959 if (u.__v = null, c || o != null) 41960 if (n.then) { 41961 for (u.__u |= c ? 160 : 128;f && f.nodeType == 8 && f.nextSibling; ) 41962 f = f.nextSibling; 41963 o[o.indexOf(f)] = null, u.__e = f; 41964 } else { 41965 for (L = o.length;L--; ) 41966 g(o[L]); 41967 N(u); 41968 } 41969 else 41970 u.__e = t.__e, u.__k = t.__k, n.then || N(u); 41971 l.__e(n, u, t); 41972 } 41973 else 41974 o == null && u.__v == t.__v ? (u.__k = t.__k, u.__e = t.__e) : f = u.__e = B(t.__e, u, t, i, r, o, e, c, s); 41975 return (a = l.diffed) && a(u), 128 & u.__u ? undefined : f; 41976} 41977function N(n) { 41978 n && (n.__c && (n.__c.__e = true), n.__k && n.__k.some(N)); 41979} 41980function V(n, u, t) { 41981 for (var i = 0;i < t.length; i++) 41982 D(t[i], t[++i], t[++i]); 41983 l.__c && l.__c(u, n), n.some(function(u) { 41984 try { 41985 n = u.__h, u.__h = [], n.some(function(n) { 41986 n.call(u); 41987 }); 41988 } catch (n) { 41989 l.__e(n, u.__v); 41990 } 41991 }); 41992} 41993function q(n) { 41994 return typeof n != "object" || n == null || n.__b > 0 ? n : d(n) ? n.map(q) : w({}, n); 41995} 41996function B(u, t, i, r, o, e, f, c, s) { 41997 var a, h, v, y, w, _, m2, b = i.props || p, { props: k, type: x } = t; 41998 if (x == "svg" ? o = "http://www.w3.org/2000/svg" : x == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), e != null) { 41999 for (a = 0;a < e.length; a++) 42000 if ((w = e[a]) && "setAttribute" in w == !!x && (x ? w.localName == x : w.nodeType == 3)) { 42001 u = w, e[a] = null; 42002 break; 42003 } 42004 } 42005 if (u == null) { 42006 if (x == null) 42007 return document.createTextNode(k); 42008 u = document.createElementNS(o, x, k.is && k), c && (l.__m && l.__m(t, e), c = false), e = null; 42009 } 42010 if (x == null) 42011 b === k || c && u.data == k || (u.data = k); 42012 else { 42013 if (e = e && n2.call(u.childNodes), !c && e != null) 42014 for (b = {}, a = 0;a < u.attributes.length; a++) 42015 b[(w = u.attributes[a]).name] = w.value; 42016 for (a in b) 42017 w = b[a], a == "dangerouslySetInnerHTML" ? v = w : a == "children" || (a in k) || a == "value" && ("defaultValue" in k) || a == "checked" && ("defaultChecked" in k) || F(u, a, null, w, o); 42018 for (a in k) 42019 w = k[a], a == "children" ? y = w : a == "dangerouslySetInnerHTML" ? h = w : a == "value" ? _ = w : a == "checked" ? m2 = w : c && typeof w != "function" || b[a] === w || F(u, a, w, b[a], o); 42020 if (h) 42021 c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = []; 42022 else if (v && (u.innerHTML = ""), P(t.type == "template" ? u.content : u, d(y) ? y : [y], t, i, r, x == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, e, f, e ? e[0] : i.__k && S(i, 0), c, s), e != null) 42023 for (a = e.length;a--; ) 42024 g(e[a]); 42025 c || (a = "value", x == "progress" && _ == null ? u.removeAttribute("value") : _ != null && (_ !== u[a] || x == "progress" && !_ || x == "option" && _ != b[a]) && F(u, a, _, b[a], o), a = "checked", m2 != null && m2 != u[a] && F(u, a, m2, b[a], o)); 42026 } 42027 return u; 42028} 42029function D(n, u, t) { 42030 try { 42031 if (typeof n == "function") { 42032 var i = typeof n.__u == "function"; 42033 i && n.__u(), i && u == null || (n.__u = n(u)); 42034 } else 42035 n.current = u; 42036 } catch (n) { 42037 l.__e(n, t); 42038 } 42039} 42040function E(n, u, t) { 42041 var i, r; 42042 if (l.unmount && l.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || D(i, null, u)), (i = n.__c) != null) { 42043 if (i.componentWillUnmount) 42044 try { 42045 i.componentWillUnmount(); 42046 } catch (n) { 42047 l.__e(n, u); 42048 } 42049 i.base = i.__P = null; 42050 } 42051 if (i = n.__k) 42052 for (r = 0;r < i.length; r++) 42053 i[r] && E(i[r], u, t || typeof n.type != "function"); 42054 t || g(n.__e), n.__c = n.__ = n.__e = undefined; 42055} 42056function G(n, l, u) { 42057 return this.constructor(n, u); 42058} 42059function J(u, t, i) { 42060 var r, o, e, f; 42061 t == document && (t = document.documentElement), l.__ && l.__(u, t), o = (r = typeof i == "function") ? null : i && i.__k || t.__k, e = [], f = [], z(t, u = (!r && i || t).__k = _(k, null, [u]), o || p, p, t.namespaceURI, !r && i ? [i] : o ? null : t.firstChild ? n2.call(t.childNodes) : null, e, !r && i ? i : o ? o.__e : t.firstChild, r, f), V(e, u, f); 42062} 42063n2 = v.slice, l = { __e: function(n, l, u, t) { 42064 for (var i, r, o;l = l.__; ) 42065 if ((i = l.__c) && !i.__) 42066 try { 42067 if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(n)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(n, t || {}), o = i.__d), o) 42068 return i.__E = i; 42069 } catch (l) { 42070 n = l; 42071 } 42072 throw n; 42073} }, u = 0, t2 = function(n) { 42074 return n != null && n.constructor === undefined; 42075}, x.prototype.setState = function(n, l) { 42076 var u; 42077 u = this.__s != null && this.__s != this.state ? this.__s : this.__s = w({}, this.state), typeof n == "function" && (n = n(w({}, u), this.props)), n && w(u, n), n != null && this.__v && (l && this._sb.push(l), $10(this)); 42078}, x.prototype.forceUpdate = function(n) { 42079 this.__v && (this.__e = true, n && this.__h.push(n), $10(this)); 42080}, x.prototype.render = k, i = [], o = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n, l) { 42081 return n.__v.__b - l.__v.__b; 42082}, I.__r = 0, f = /(PointerCapture)$|Capture$/i, c = 0, s = O(false), a = O(true), h = 0; 42083
vendor: 172 bytes, lines 42084-42087
42084// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/constants/index.js 42085var HIGHLIGHT_PRE_TAG = "__aa-highlight__"; 42086var HIGHLIGHT_POST_TAG = "__/aa-highlight__"; 42087
vendor: 1,331 bytes, lines 42088-42132
42088// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAttribute.js 42089function createAttributeSet() { 42090 var initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 42091 var value = initialValue; 42092 return { 42093 get: function get() { 42094 return value; 42095 }, 42096 add: function add(part) { 42097 var lastPart = value[value.length - 1]; 42098 if ((lastPart === null || lastPart === undefined ? undefined : lastPart.isHighlighted) === part.isHighlighted) { 42099 value[value.length - 1] = { 42100 value: lastPart.value + part.value, 42101 isHighlighted: lastPart.isHighlighted 42102 }; 42103 } else { 42104 value.push(part); 42105 } 42106 } 42107 }; 42108} 42109function parseAttribute(_ref) { 42110 var highlightedValue = _ref.highlightedValue; 42111 var preTagParts = highlightedValue.split(HIGHLIGHT_PRE_TAG); 42112 var firstValue = preTagParts.shift(); 42113 var parts = createAttributeSet(firstValue ? [{ 42114 value: firstValue, 42115 isHighlighted: false 42116 }] : []); 42117 preTagParts.forEach(function(part) { 42118 var postTagParts = part.split(HIGHLIGHT_POST_TAG); 42119 parts.add({ 42120 value: postTagParts[0], 42121 isHighlighted: true 42122 }); 42123 if (postTagParts[1] !== "") { 42124 parts.add({ 42125 value: postTagParts[1], 42126 isHighlighted: false 42127 }); 42128 } 42129 }); 42130 return parts.get(); 42131} 42132
vendor: 2,085 bytes, lines 42133-42182
42133// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitHighlight.js 42134function _toConsumableArray7(arr) { 42135 return _arrayWithoutHoles7(arr) || _iterableToArray7(arr) || _unsupportedIterableToArray11(arr) || _nonIterableSpread7(); 42136} 42137function _nonIterableSpread7() { 42138 throw new TypeError(`Invalid attempt to spread non-iterable instance. 42139In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 42140} 42141function _unsupportedIterableToArray11(o, minLen) { 42142 if (!o) 42143 return; 42144 if (typeof o === "string") 42145 return _arrayLikeToArray11(o, minLen); 42146 var n = Object.prototype.toString.call(o).slice(8, -1); 42147 if (n === "Object" && o.constructor) 42148 n = o.constructor.name; 42149 if (n === "Map" || n === "Set") 42150 return Array.from(o); 42151 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 42152 return _arrayLikeToArray11(o, minLen); 42153} 42154function _iterableToArray7(iter) { 42155 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 42156 return Array.from(iter); 42157} 42158function _arrayWithoutHoles7(arr) { 42159 if (Array.isArray(arr)) 42160 return _arrayLikeToArray11(arr); 42161} 42162function _arrayLikeToArray11(arr, len) { 42163 if (len == null || len > arr.length) 42164 len = arr.length; 42165 for (var i = 0, arr2 = new Array(len);i < len; i++) 42166 arr2[i] = arr[i]; 42167 return arr2; 42168} 42169function parseAlgoliaHitHighlight(_ref) { 42170 var { hit, attribute } = _ref; 42171 var path = Array.isArray(attribute) ? attribute : [attribute]; 42172 var highlightedValue = getAttributeValueByPath(hit, ["_highlightResult"].concat(_toConsumableArray7(path), ["value"])); 42173 if (typeof highlightedValue !== "string") { 42174 warn2(false, 'The attribute "'.concat(path.join("."), '" described by the path ').concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToHighlight`?") + ` 42175See https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/`); 42176 highlightedValue = getAttributeValueByPath(hit, path) || ""; 42177 } 42178 return parseAttribute({ 42179 highlightedValue 42180 }); 42181} 42182
vendor: 1,171 bytes, lines 42183-42215
42183// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/isPartHighlighted.js 42184var htmlEscapes = { 42185 "&": "&", 42186 "<": "<", 42187 ">": ">", 42188 """: '"', 42189 "'": "'" 42190}; 42191var hasLetterOrNumber = function() { 42192 try { 42193 return new RegExp("[\\p{L}\\p{N}_]", "u"); 42194 } catch (_unused) { 42195 return new RegExp(/\w/i); 42196 } 42197}(); 42198var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g; 42199var regexHasEscapedHtml = RegExp(regexEscapedHtml.source); 42200function unescape(value) { 42201 return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function(character) { 42202 return htmlEscapes[character]; 42203 }) : value; 42204} 42205function isPartHighlighted(parts, i) { 42206 var _parts, _parts2; 42207 var current = parts[i]; 42208 var isNextHighlighted = ((_parts = parts[i + 1]) === null || _parts === undefined ? undefined : _parts.isHighlighted) || true; 42209 var isPreviousHighlighted = ((_parts2 = parts[i - 1]) === null || _parts2 === undefined ? undefined : _parts2.isHighlighted) || true; 42210 if (!hasLetterOrNumber.test(unescape(current.value)) && isPreviousHighlighted === isNextHighlighted) { 42211 return isPreviousHighlighted; 42212 } 42213 return current.isHighlighted; 42214} 42215
vendor: 2,628 bytes, lines 42216-42287
42216// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/reverseHighlightedParts.js 42217function _typeof20(obj2) { 42218 "@babel/helpers - typeof"; 42219 return _typeof20 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 42220 return typeof obj2; 42221 } : function(obj2) { 42222 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42223 }, _typeof20(obj2); 42224} 42225function ownKeys18(object, enumerableOnly) { 42226 var keys = Object.keys(object); 42227 if (Object.getOwnPropertySymbols) { 42228 var symbols = Object.getOwnPropertySymbols(object); 42229 enumerableOnly && (symbols = symbols.filter(function(sym) { 42230 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42231 })), keys.push.apply(keys, symbols); 42232 } 42233 return keys; 42234} 42235function _objectSpread18(target) { 42236 for (var i = 1;i < arguments.length; i++) { 42237 var source = arguments[i] != null ? arguments[i] : {}; 42238 i % 2 ? ownKeys18(Object(source), true).forEach(function(key) { 42239 _defineProperty18(target, key, source[key]); 42240 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys18(Object(source)).forEach(function(key) { 42241 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 42242 }); 42243 } 42244 return target; 42245} 42246function _defineProperty18(obj2, key, value) { 42247 key = _toPropertyKey18(key); 42248 if (key in obj2) { 42249 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 42250 } else { 42251 obj2[key] = value; 42252 } 42253 return obj2; 42254} 42255function _toPropertyKey18(arg) { 42256 var key = _toPrimitive18(arg, "string"); 42257 return _typeof20(key) === "symbol" ? key : String(key); 42258} 42259function _toPrimitive18(input, hint) { 42260 if (_typeof20(input) !== "object" || input === null) 42261 return input; 42262 var prim = input[Symbol.toPrimitive]; 42263 if (prim !== undefined) { 42264 var res = prim.call(input, hint || "default"); 42265 if (_typeof20(res) !== "object") 42266 return res; 42267 throw new TypeError("@@toPrimitive must return a primitive value."); 42268 } 42269 return (hint === "string" ? String : Number)(input); 42270} 42271function reverseHighlightedParts(parts) { 42272 if (!parts.some(function(part) { 42273 return part.isHighlighted; 42274 })) { 42275 return parts.map(function(part) { 42276 return _objectSpread18(_objectSpread18({}, part), {}, { 42277 isHighlighted: false 42278 }); 42279 }); 42280 } 42281 return parts.map(function(part, i) { 42282 return _objectSpread18(_objectSpread18({}, part), {}, { 42283 isHighlighted: !isPartHighlighted(parts, i) 42284 }); 42285 }); 42286} 42287
vendor: 227 bytes, lines 42288-42292
42288// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitReverseHighlight.js 42289function parseAlgoliaHitReverseHighlight(props) { 42290 return reverseHighlightedParts(parseAlgoliaHitHighlight(props)); 42291} 42292
vendor: 2,075 bytes, lines 42293-42342
42293// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitSnippet.js 42294function _toConsumableArray8(arr) { 42295 return _arrayWithoutHoles8(arr) || _iterableToArray8(arr) || _unsupportedIterableToArray12(arr) || _nonIterableSpread8(); 42296} 42297function _nonIterableSpread8() { 42298 throw new TypeError(`Invalid attempt to spread non-iterable instance. 42299In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 42300} 42301function _unsupportedIterableToArray12(o, minLen) { 42302 if (!o) 42303 return; 42304 if (typeof o === "string") 42305 return _arrayLikeToArray12(o, minLen); 42306 var n = Object.prototype.toString.call(o).slice(8, -1); 42307 if (n === "Object" && o.constructor) 42308 n = o.constructor.name; 42309 if (n === "Map" || n === "Set") 42310 return Array.from(o); 42311 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 42312 return _arrayLikeToArray12(o, minLen); 42313} 42314function _iterableToArray8(iter) { 42315 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 42316 return Array.from(iter); 42317} 42318function _arrayWithoutHoles8(arr) { 42319 if (Array.isArray(arr)) 42320 return _arrayLikeToArray12(arr); 42321} 42322function _arrayLikeToArray12(arr, len) { 42323 if (len == null || len > arr.length) 42324 len = arr.length; 42325 for (var i = 0, arr2 = new Array(len);i < len; i++) 42326 arr2[i] = arr[i]; 42327 return arr2; 42328} 42329function parseAlgoliaHitSnippet(_ref) { 42330 var { hit, attribute } = _ref; 42331 var path = Array.isArray(attribute) ? attribute : [attribute]; 42332 var highlightedValue = getAttributeValueByPath(hit, ["_snippetResult"].concat(_toConsumableArray8(path), ["value"])); 42333 if (typeof highlightedValue !== "string") { 42334 warn2(false, 'The attribute "'.concat(path.join("."), '" described by the path ').concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToSnippet`?") + ` 42335See https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/`); 42336 highlightedValue = getAttributeValueByPath(hit, path) || ""; 42337 } 42338 return parseAttribute({ 42339 highlightedValue 42340 }); 42341} 42342
vendor: 221 bytes, lines 42343-42347
42343// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitReverseSnippet.js 42344function parseAlgoliaHitReverseSnippet(props) { 42345 return reverseHighlightedParts(parseAlgoliaHitSnippet(props)); 42346} 42347
vendor: 3,019 bytes, lines 42348-42430
42348// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/requester/createRequester.js 42349function _typeof21(obj2) { 42350 "@babel/helpers - typeof"; 42351 return _typeof21 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 42352 return typeof obj2; 42353 } : function(obj2) { 42354 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42355 }, _typeof21(obj2); 42356} 42357function ownKeys19(object, enumerableOnly) { 42358 var keys = Object.keys(object); 42359 if (Object.getOwnPropertySymbols) { 42360 var symbols = Object.getOwnPropertySymbols(object); 42361 enumerableOnly && (symbols = symbols.filter(function(sym) { 42362 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42363 })), keys.push.apply(keys, symbols); 42364 } 42365 return keys; 42366} 42367function _objectSpread19(target) { 42368 for (var i = 1;i < arguments.length; i++) { 42369 var source = arguments[i] != null ? arguments[i] : {}; 42370 i % 2 ? ownKeys19(Object(source), true).forEach(function(key) { 42371 _defineProperty19(target, key, source[key]); 42372 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys19(Object(source)).forEach(function(key) { 42373 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 42374 }); 42375 } 42376 return target; 42377} 42378function _defineProperty19(obj2, key, value) { 42379 key = _toPropertyKey19(key); 42380 if (key in obj2) { 42381 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 42382 } else { 42383 obj2[key] = value; 42384 } 42385 return obj2; 42386} 42387function _toPropertyKey19(arg) { 42388 var key = _toPrimitive19(arg, "string"); 42389 return _typeof21(key) === "symbol" ? key : String(key); 42390} 42391function _toPrimitive19(input, hint) { 42392 if (_typeof21(input) !== "object" || input === null) 42393 return input; 42394 var prim = input[Symbol.toPrimitive]; 42395 if (prim !== undefined) { 42396 var res = prim.call(input, hint || "default"); 42397 if (_typeof21(res) !== "object") 42398 return res; 42399 throw new TypeError("@@toPrimitive must return a primitive value."); 42400 } 42401 return (hint === "string" ? String : Number)(input); 42402} 42403function createRequester(fetcher, requesterId) { 42404 function execute(fetcherParams) { 42405 return fetcher({ 42406 searchClient: fetcherParams.searchClient, 42407 queries: fetcherParams.requests.map(function(x) { 42408 return x.query; 42409 }) 42410 }).then(function(responses) { 42411 return responses.map(function(response, index) { 42412 var _fetcherParams$reques = fetcherParams.requests[index], { sourceId, transformResponse } = _fetcherParams$reques; 42413 return { 42414 items: response, 42415 sourceId, 42416 transformResponse 42417 }; 42418 }); 42419 }); 42420 } 42421 return function createSpecifiedRequester(requesterParams) { 42422 return function requester(requestParams) { 42423 return _objectSpread19(_objectSpread19({ 42424 requesterId, 42425 execute 42426 }, requesterParams), requestParams); 42427 }; 42428 }; 42429} 42430
vendor: 588 bytes, lines 42431-42445
42431// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/utils/getAppIdAndApiKey.js 42432function getAppIdAndApiKey(searchClient) { 42433 var transporter = searchClient.transporter || {}; 42434 var headers = transporter.headers || transporter.baseHeaders || {}; 42435 var queryParameters = transporter.queryParameters || transporter.baseQueryParameters || {}; 42436 var APP_ID = "x-algolia-application-id"; 42437 var API_KEY = "x-algolia-api-key"; 42438 var appId = headers[APP_ID] || queryParameters[APP_ID]; 42439 var apiKey = headers[API_KEY] || queryParameters[API_KEY]; 42440 return { 42441 appId, 42442 apiKey 42443 }; 42444} 42445
vendor: 6,270 bytes, lines 42446-42608
42446// node_modules/@algolia/autocomplete-preset-algolia/dist/esm/search/fetchAlgoliaResults.js 42447function _typeof22(obj2) { 42448 "@babel/helpers - typeof"; 42449 return _typeof22 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 42450 return typeof obj2; 42451 } : function(obj2) { 42452 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42453 }, _typeof22(obj2); 42454} 42455var _excluded9 = ["params"]; 42456function ownKeys20(object, enumerableOnly) { 42457 var keys = Object.keys(object); 42458 if (Object.getOwnPropertySymbols) { 42459 var symbols = Object.getOwnPropertySymbols(object); 42460 enumerableOnly && (symbols = symbols.filter(function(sym) { 42461 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42462 })), keys.push.apply(keys, symbols); 42463 } 42464 return keys; 42465} 42466function _objectSpread20(target) { 42467 for (var i = 1;i < arguments.length; i++) { 42468 var source = arguments[i] != null ? arguments[i] : {}; 42469 i % 2 ? ownKeys20(Object(source), true).forEach(function(key) { 42470 _defineProperty20(target, key, source[key]); 42471 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys20(Object(source)).forEach(function(key) { 42472 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 42473 }); 42474 } 42475 return target; 42476} 42477function _defineProperty20(obj2, key, value) { 42478 key = _toPropertyKey20(key); 42479 if (key in obj2) { 42480 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 42481 } else { 42482 obj2[key] = value; 42483 } 42484 return obj2; 42485} 42486function _toPropertyKey20(arg) { 42487 var key = _toPrimitive20(arg, "string"); 42488 return _typeof22(key) === "symbol" ? key : String(key); 42489} 42490function _toPrimitive20(input, hint) { 42491 if (_typeof22(input) !== "object" || input === null) 42492 return input; 42493 var prim = input[Symbol.toPrimitive]; 42494 if (prim !== undefined) { 42495 var res = prim.call(input, hint || "default"); 42496 if (_typeof22(res) !== "object") 42497 return res; 42498 throw new TypeError("@@toPrimitive must return a primitive value."); 42499 } 42500 return (hint === "string" ? String : Number)(input); 42501} 42502function _objectWithoutProperties7(source, excluded) { 42503 if (source == null) 42504 return {}; 42505 var target = _objectWithoutPropertiesLoose7(source, excluded); 42506 var key, i; 42507 if (Object.getOwnPropertySymbols) { 42508 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 42509 for (i = 0;i < sourceSymbolKeys.length; i++) { 42510 key = sourceSymbolKeys[i]; 42511 if (excluded.indexOf(key) >= 0) 42512 continue; 42513 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 42514 continue; 42515 target[key] = source[key]; 42516 } 42517 } 42518 return target; 42519} 42520function _objectWithoutPropertiesLoose7(source, excluded) { 42521 if (source == null) 42522 return {}; 42523 var target = {}; 42524 var sourceKeys = Object.keys(source); 42525 var key, i; 42526 for (i = 0;i < sourceKeys.length; i++) { 42527 key = sourceKeys[i]; 42528 if (excluded.indexOf(key) >= 0) 42529 continue; 42530 target[key] = source[key]; 42531 } 42532 return target; 42533} 42534function _toConsumableArray9(arr) { 42535 return _arrayWithoutHoles9(arr) || _iterableToArray9(arr) || _unsupportedIterableToArray13(arr) || _nonIterableSpread9(); 42536} 42537function _nonIterableSpread9() { 42538 throw new TypeError(`Invalid attempt to spread non-iterable instance. 42539In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); 42540} 42541function _unsupportedIterableToArray13(o, minLen) { 42542 if (!o) 42543 return; 42544 if (typeof o === "string") 42545 return _arrayLikeToArray13(o, minLen); 42546 var n = Object.prototype.toString.call(o).slice(8, -1); 42547 if (n === "Object" && o.constructor) 42548 n = o.constructor.name; 42549 if (n === "Map" || n === "Set") 42550 return Array.from(o); 42551 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) 42552 return _arrayLikeToArray13(o, minLen); 42553} 42554function _iterableToArray9(iter) { 42555 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 42556 return Array.from(iter); 42557} 42558function _arrayWithoutHoles9(arr) { 42559 if (Array.isArray(arr)) 42560 return _arrayLikeToArray13(arr); 42561} 42562function _arrayLikeToArray13(arr, len) { 42563 if (len == null || len > arr.length) 42564 len = arr.length; 42565 for (var i = 0, arr2 = new Array(len);i < len; i++) 42566 arr2[i] = arr[i]; 42567 return arr2; 42568} 42569function fetchAlgoliaResults(_ref) { 42570 var { searchClient, queries, userAgents: _ref$userAgents } = _ref, userAgents2 = _ref$userAgents === undefined ? [] : _ref$userAgents; 42571 if (typeof searchClient.addAlgoliaAgent === "function") { 42572 var algoliaAgents = [].concat(_toConsumableArray9(userAgents), _toConsumableArray9(userAgents2)); 42573 algoliaAgents.forEach(function(_ref2) { 42574 var { segment, version } = _ref2; 42575 searchClient.addAlgoliaAgent(segment, version); 42576 }); 42577 } 42578 var _getAppIdAndApiKey = getAppIdAndApiKey(searchClient), { appId, apiKey } = _getAppIdAndApiKey; 42579 invariant(Boolean(appId), "The Algolia `appId` was not accessible from the searchClient passed."); 42580 invariant(Boolean(apiKey), "The Algolia `apiKey` was not accessible from the searchClient passed."); 42581 return searchClient.search(queries.map(function(searchParameters) { 42582 var params = searchParameters.params, headers = _objectWithoutProperties7(searchParameters, _excluded9); 42583 return _objectSpread20(_objectSpread20({}, headers), {}, { 42584 params: _objectSpread20({ 42585 hitsPerPage: 5, 42586 highlightPreTag: HIGHLIGHT_PRE_TAG, 42587 highlightPostTag: HIGHLIGHT_POST_TAG 42588 }, params) 42589 }); 42590 })).then(function(response) { 42591 return response.results.map(function(result, resultIndex) { 42592 var _result$hits; 42593 return _objectSpread20(_objectSpread20({}, result), {}, { 42594 hits: (_result$hits = result.hits) === null || _result$hits === undefined ? undefined : _result$hits.map(function(hit) { 42595 return _objectSpread20(_objectSpread20({}, hit), {}, { 42596 __autocomplete_indexName: result.index || queries[resultIndex].indexName, 42597 __autocomplete_queryID: result.queryID, 42598 __autocomplete_algoliaCredentials: { 42599 appId, 42600 apiKey 42601 } 42602 }); 42603 }) 42604 }); 42605 }); 42606 }); 42607} 42608
vendor: 633 bytes, lines 42609-42626
42609// node_modules/@algolia/autocomplete-js/dist/esm/components/Highlight.js 42610function createHighlightComponent(_ref) { 42611 var { createElement, Fragment } = _ref; 42612 function Highlight(_ref2) { 42613 var { hit, attribute, tagName: _ref2$tagName } = _ref2, tagName = _ref2$tagName === undefined ? "mark" : _ref2$tagName; 42614 return createElement(Fragment, {}, parseAlgoliaHitHighlight({ 42615 hit, 42616 attribute 42617 }).map(function(x, index) { 42618 return x.isHighlighted ? createElement(tagName, { 42619 key: index 42620 }, x.value) : x.value; 42621 })); 42622 } 42623 Highlight.__autocomplete_componentName = "Highlight"; 42624 return Highlight; 42625} 42626
vendor: 682 bytes, lines 42627-42644
42627// node_modules/@algolia/autocomplete-js/dist/esm/components/ReverseHighlight.js 42628function createReverseHighlightComponent(_ref) { 42629 var { createElement, Fragment } = _ref; 42630 function ReverseHighlight(_ref2) { 42631 var { hit, attribute, tagName: _ref2$tagName } = _ref2, tagName = _ref2$tagName === undefined ? "mark" : _ref2$tagName; 42632 return createElement(Fragment, {}, parseAlgoliaHitReverseHighlight({ 42633 hit, 42634 attribute 42635 }).map(function(x, index) { 42636 return x.isHighlighted ? createElement(tagName, { 42637 key: index 42638 }, x.value) : x.value; 42639 })); 42640 } 42641 ReverseHighlight.__autocomplete_componentName = "ReverseHighlight"; 42642 return ReverseHighlight; 42643} 42644
vendor: 668 bytes, lines 42645-42662
42645// node_modules/@algolia/autocomplete-js/dist/esm/components/ReverseSnippet.js 42646function createReverseSnippetComponent(_ref) { 42647 var { createElement, Fragment } = _ref; 42648 function ReverseSnippet(_ref2) { 42649 var { hit, attribute, tagName: _ref2$tagName } = _ref2, tagName = _ref2$tagName === undefined ? "mark" : _ref2$tagName; 42650 return createElement(Fragment, {}, parseAlgoliaHitReverseSnippet({ 42651 hit, 42652 attribute 42653 }).map(function(x, index) { 42654 return x.isHighlighted ? createElement(tagName, { 42655 key: index 42656 }, x.value) : x.value; 42657 })); 42658 } 42659 ReverseSnippet.__autocomplete_componentName = "ReverseSnippet"; 42660 return ReverseSnippet; 42661} 42662
vendor: 619 bytes, lines 42663-42680
42663// node_modules/@algolia/autocomplete-js/dist/esm/components/Snippet.js 42664function createSnippetComponent(_ref) { 42665 var { createElement, Fragment } = _ref; 42666 function Snippet(_ref2) { 42667 var { hit, attribute, tagName: _ref2$tagName } = _ref2, tagName = _ref2$tagName === undefined ? "mark" : _ref2$tagName; 42668 return createElement(Fragment, {}, parseAlgoliaHitSnippet({ 42669 hit, 42670 attribute 42671 }).map(function(x, index) { 42672 return x.isHighlighted ? createElement(tagName, { 42673 key: index 42674 }, x.value) : x.value; 42675 })); 42676 } 42677 Snippet.__autocomplete_componentName = "Snippet"; 42678 return Snippet; 42679} 42680
vendor: 9,984 bytes, lines 42681-42881
42681// node_modules/@algolia/autocomplete-js/dist/esm/getDefaultOptions.js 42682function _typeof23(obj2) { 42683 "@babel/helpers - typeof"; 42684 return _typeof23 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 42685 return typeof obj2; 42686 } : function(obj2) { 42687 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42688 }, _typeof23(obj2); 42689} 42690var _excluded10 = ["classNames", "container", "getEnvironmentProps", "getFormProps", "getInputProps", "getItemProps", "getLabelProps", "getListProps", "getPanelProps", "getRootProps", "panelContainer", "panelPlacement", "render", "renderNoResults", "renderer", "detachedMediaQuery", "components", "translations"]; 42691function ownKeys21(object, enumerableOnly) { 42692 var keys = Object.keys(object); 42693 if (Object.getOwnPropertySymbols) { 42694 var symbols = Object.getOwnPropertySymbols(object); 42695 enumerableOnly && (symbols = symbols.filter(function(sym) { 42696 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42697 })), keys.push.apply(keys, symbols); 42698 } 42699 return keys; 42700} 42701function _objectSpread21(target) { 42702 for (var i = 1;i < arguments.length; i++) { 42703 var source = arguments[i] != null ? arguments[i] : {}; 42704 i % 2 ? ownKeys21(Object(source), true).forEach(function(key) { 42705 _defineProperty21(target, key, source[key]); 42706 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys21(Object(source)).forEach(function(key) { 42707 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 42708 }); 42709 } 42710 return target; 42711} 42712function _defineProperty21(obj2, key, value) { 42713 key = _toPropertyKey21(key); 42714 if (key in obj2) { 42715 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 42716 } else { 42717 obj2[key] = value; 42718 } 42719 return obj2; 42720} 42721function _toPropertyKey21(arg) { 42722 var key = _toPrimitive21(arg, "string"); 42723 return _typeof23(key) === "symbol" ? key : String(key); 42724} 42725function _toPrimitive21(input, hint) { 42726 if (_typeof23(input) !== "object" || input === null) 42727 return input; 42728 var prim = input[Symbol.toPrimitive]; 42729 if (prim !== undefined) { 42730 var res = prim.call(input, hint || "default"); 42731 if (_typeof23(res) !== "object") 42732 return res; 42733 throw new TypeError("@@toPrimitive must return a primitive value."); 42734 } 42735 return (hint === "string" ? String : Number)(input); 42736} 42737function _objectWithoutProperties8(source, excluded) { 42738 if (source == null) 42739 return {}; 42740 var target = _objectWithoutPropertiesLoose8(source, excluded); 42741 var key, i; 42742 if (Object.getOwnPropertySymbols) { 42743 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 42744 for (i = 0;i < sourceSymbolKeys.length; i++) { 42745 key = sourceSymbolKeys[i]; 42746 if (excluded.indexOf(key) >= 0) 42747 continue; 42748 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 42749 continue; 42750 target[key] = source[key]; 42751 } 42752 } 42753 return target; 42754} 42755function _objectWithoutPropertiesLoose8(source, excluded) { 42756 if (source == null) 42757 return {}; 42758 var target = {}; 42759 var sourceKeys = Object.keys(source); 42760 var key, i; 42761 for (i = 0;i < sourceKeys.length; i++) { 42762 key = sourceKeys[i]; 42763 if (excluded.indexOf(key) >= 0) 42764 continue; 42765 target[key] = source[key]; 42766 } 42767 return target; 42768} 42769var defaultClassNames = { 42770 clearButton: "aa-ClearButton", 42771 detachedCancelButton: "aa-DetachedCancelButton", 42772 detachedContainer: "aa-DetachedContainer", 42773 detachedFormContainer: "aa-DetachedFormContainer", 42774 detachedOverlay: "aa-DetachedOverlay", 42775 detachedSearchButton: "aa-DetachedSearchButton", 42776 detachedSearchButtonIcon: "aa-DetachedSearchButtonIcon", 42777 detachedSearchButtonPlaceholder: "aa-DetachedSearchButtonPlaceholder", 42778 detachedSearchButtonQuery: "aa-DetachedSearchButtonQuery", 42779 form: "aa-Form", 42780 input: "aa-Input", 42781 inputWrapper: "aa-InputWrapper", 42782 inputWrapperPrefix: "aa-InputWrapperPrefix", 42783 inputWrapperSuffix: "aa-InputWrapperSuffix", 42784 item: "aa-Item", 42785 label: "aa-Label", 42786 list: "aa-List", 42787 loadingIndicator: "aa-LoadingIndicator", 42788 panel: "aa-Panel", 42789 panelLayout: "aa-PanelLayout aa-Panel--scrollable", 42790 root: "aa-Autocomplete", 42791 source: "aa-Source", 42792 sourceFooter: "aa-SourceFooter", 42793 sourceHeader: "aa-SourceHeader", 42794 sourceNoResults: "aa-SourceNoResults", 42795 submitButton: "aa-SubmitButton" 42796}; 42797var defaultRender = function defaultRender(_ref, root2) { 42798 var { children, render } = _ref; 42799 render(children, root2); 42800}; 42801var defaultRenderer = { 42802 createElement: _, 42803 Fragment: k, 42804 render: J 42805}; 42806function getDefaultOptions(options2) { 42807 var _core$id; 42808 var { classNames, container, getEnvironmentProps, getFormProps, getInputProps, getItemProps, getLabelProps, getListProps, getPanelProps, getRootProps, panelContainer, panelPlacement, render, renderNoResults, renderer, detachedMediaQuery, components, translations } = options2, core = _objectWithoutProperties8(options2, _excluded10); 42809 var environment = typeof window !== "undefined" ? window : {}; 42810 var containerElement = getHTMLElement(environment, container); 42811 invariant(containerElement.tagName !== "INPUT", "The `container` option does not support `input` elements. You need to change the container to a `div`."); 42812 warn2(!(render && renderer && !(renderer !== null && renderer !== undefined && renderer.render)), "You provided the `render` option but did not provide a `renderer.render`. Since v1.6.0, you can provide a `render` function directly in `renderer`." + ` 42813To get rid of this warning, do any of the following depending on your use case.` + "\n- If you are using the `render` option only to override Autocomplete's default `render` function, pass the `render` function into `renderer` and remove the `render` option." + "\n- If you are using the `render` option to customize the layout, pass your `render` function into `renderer` and use it from the provided parameters of the `render` option." + "\n- If you are using the `render` option to work with React 18, pass an empty `render` function into `renderer`." + ` 42814See https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-render`); 42815 warn2(!renderer || render || renderer.Fragment && renderer.createElement && renderer.render, "You provided an incomplete `renderer` (missing: ".concat([!(renderer !== null && renderer !== undefined && renderer.createElement) && "`renderer.createElement`", !(renderer !== null && renderer !== undefined && renderer.Fragment) && "`renderer.Fragment`", !(renderer !== null && renderer !== undefined && renderer.render) && "`renderer.render`"].filter(Boolean).join(", "), "). This can cause rendering issues.") + ` 42816See https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-renderer`); 42817 var defaultedRenderer = _objectSpread21(_objectSpread21({}, defaultRenderer), renderer); 42818 var defaultComponents = { 42819 Highlight: createHighlightComponent(defaultedRenderer), 42820 ReverseHighlight: createReverseHighlightComponent(defaultedRenderer), 42821 ReverseSnippet: createReverseSnippetComponent(defaultedRenderer), 42822 Snippet: createSnippetComponent(defaultedRenderer) 42823 }; 42824 var defaultTranslations = { 42825 clearButtonTitle: "Clear", 42826 detachedCancelButtonText: "Cancel", 42827 detachedSearchButtonTitle: "Search", 42828 submitButtonTitle: "Submit" 42829 }; 42830 return { 42831 renderer: { 42832 classNames: mergeClassNames(defaultClassNames, classNames !== null && classNames !== undefined ? classNames : {}), 42833 container: containerElement, 42834 getEnvironmentProps: getEnvironmentProps !== null && getEnvironmentProps !== undefined ? getEnvironmentProps : function(_ref2) { 42835 var props = _ref2.props; 42836 return props; 42837 }, 42838 getFormProps: getFormProps !== null && getFormProps !== undefined ? getFormProps : function(_ref3) { 42839 var props = _ref3.props; 42840 return props; 42841 }, 42842 getInputProps: getInputProps !== null && getInputProps !== undefined ? getInputProps : function(_ref4) { 42843 var props = _ref4.props; 42844 return props; 42845 }, 42846 getItemProps: getItemProps !== null && getItemProps !== undefined ? getItemProps : function(_ref5) { 42847 var props = _ref5.props; 42848 return props; 42849 }, 42850 getLabelProps: getLabelProps !== null && getLabelProps !== undefined ? getLabelProps : function(_ref6) { 42851 var props = _ref6.props; 42852 return props; 42853 }, 42854 getListProps: getListProps !== null && getListProps !== undefined ? getListProps : function(_ref7) { 42855 var props = _ref7.props; 42856 return props; 42857 }, 42858 getPanelProps: getPanelProps !== null && getPanelProps !== undefined ? getPanelProps : function(_ref8) { 42859 var props = _ref8.props; 42860 return props; 42861 }, 42862 getRootProps: getRootProps !== null && getRootProps !== undefined ? getRootProps : function(_ref9) { 42863 var props = _ref9.props; 42864 return props; 42865 }, 42866 panelContainer: panelContainer ? getHTMLElement(environment, panelContainer) : environment.document.body, 42867 panelPlacement: panelPlacement !== null && panelPlacement !== undefined ? panelPlacement : "input-wrapper-width", 42868 render: render !== null && render !== undefined ? render : defaultRender, 42869 renderNoResults, 42870 renderer: defaultedRenderer, 42871 detachedMediaQuery: detachedMediaQuery !== null && detachedMediaQuery !== undefined ? detachedMediaQuery : getComputedStyle(environment.document.documentElement).getPropertyValue("--aa-detached-media-query"), 42872 components: _objectSpread21(_objectSpread21({}, defaultComponents), components), 42873 translations: _objectSpread21(_objectSpread21({}, defaultTranslations), translations) 42874 }, 42875 core: _objectSpread21(_objectSpread21({}, core), {}, { 42876 id: (_core$id = core.id) !== null && _core$id !== undefined ? _core$id : generateAutocompleteId(), 42877 environment 42878 }) 42879 }; 42880} 42881
vendor: 1,347 bytes, lines 42882-42925
42882// node_modules/@algolia/autocomplete-js/dist/esm/getPanelPlacementStyle.js 42883function getPanelPlacementStyle(_ref) { 42884 var { panelPlacement, container, form, environment } = _ref; 42885 var containerRect = container.getBoundingClientRect(); 42886 var scrollTop = environment.pageYOffset || environment.document.documentElement.scrollTop || environment.document.body.scrollTop || 0; 42887 var top = scrollTop + containerRect.top + containerRect.height; 42888 switch (panelPlacement) { 42889 case "start": { 42890 return { 42891 top, 42892 left: containerRect.left 42893 }; 42894 } 42895 case "end": { 42896 return { 42897 top, 42898 right: environment.document.documentElement.clientWidth - (containerRect.left + containerRect.width) 42899 }; 42900 } 42901 case "full-width": { 42902 return { 42903 top, 42904 left: 0, 42905 right: 0, 42906 width: "unset", 42907 maxWidth: "unset" 42908 }; 42909 } 42910 case "input-wrapper-width": { 42911 var formRect = form.getBoundingClientRect(); 42912 return { 42913 top, 42914 left: formRect.left, 42915 right: environment.document.documentElement.clientWidth - (formRect.left + formRect.width), 42916 width: "unset", 42917 maxWidth: "unset" 42918 }; 42919 } 42920 default: { 42921 throw new Error("[Autocomplete] The `panelPlacement` value ".concat(JSON.stringify(panelPlacement), " is not valid.")); 42922 } 42923 } 42924} 42925
vendor: 7,150 bytes, lines 42926-43134
42926// node_modules/@algolia/autocomplete-js/dist/esm/render.js 42927function _typeof24(obj2) { 42928 "@babel/helpers - typeof"; 42929 return _typeof24 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 42930 return typeof obj2; 42931 } : function(obj2) { 42932 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 42933 }, _typeof24(obj2); 42934} 42935function _extends() { 42936 _extends = Object.assign ? Object.assign.bind() : function(target) { 42937 for (var i = 1;i < arguments.length; i++) { 42938 var source = arguments[i]; 42939 for (var key in source) { 42940 if (Object.prototype.hasOwnProperty.call(source, key)) { 42941 target[key] = source[key]; 42942 } 42943 } 42944 } 42945 return target; 42946 }; 42947 return _extends.apply(this, arguments); 42948} 42949function ownKeys22(object, enumerableOnly) { 42950 var keys = Object.keys(object); 42951 if (Object.getOwnPropertySymbols) { 42952 var symbols = Object.getOwnPropertySymbols(object); 42953 enumerableOnly && (symbols = symbols.filter(function(sym) { 42954 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 42955 })), keys.push.apply(keys, symbols); 42956 } 42957 return keys; 42958} 42959function _objectSpread22(target) { 42960 for (var i = 1;i < arguments.length; i++) { 42961 var source = arguments[i] != null ? arguments[i] : {}; 42962 i % 2 ? ownKeys22(Object(source), true).forEach(function(key) { 42963 _defineProperty22(target, key, source[key]); 42964 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys22(Object(source)).forEach(function(key) { 42965 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 42966 }); 42967 } 42968 return target; 42969} 42970function _defineProperty22(obj2, key, value) { 42971 key = _toPropertyKey22(key); 42972 if (key in obj2) { 42973 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 42974 } else { 42975 obj2[key] = value; 42976 } 42977 return obj2; 42978} 42979function _toPropertyKey22(arg) { 42980 var key = _toPrimitive22(arg, "string"); 42981 return _typeof24(key) === "symbol" ? key : String(key); 42982} 42983function _toPrimitive22(input, hint) { 42984 if (_typeof24(input) !== "object" || input === null) 42985 return input; 42986 var prim = input[Symbol.toPrimitive]; 42987 if (prim !== undefined) { 42988 var res = prim.call(input, hint || "default"); 42989 if (_typeof24(res) !== "object") 42990 return res; 42991 throw new TypeError("@@toPrimitive must return a primitive value."); 42992 } 42993 return (hint === "string" ? String : Number)(input); 42994} 42995function renderSearchBox(_ref) { 42996 var { autocomplete, autocompleteScopeApi, dom, propGetters, state } = _ref; 42997 setPropertiesWithoutEvents(dom.root, propGetters.getRootProps(_objectSpread22({ 42998 state, 42999 props: autocomplete.getRootProps({}) 43000 }, autocompleteScopeApi))); 43001 setPropertiesWithoutEvents(dom.input, propGetters.getInputProps(_objectSpread22({ 43002 state, 43003 props: autocomplete.getInputProps({ 43004 inputElement: dom.input 43005 }), 43006 inputElement: dom.input 43007 }, autocompleteScopeApi))); 43008 setProperties(dom.label, { 43009 hidden: state.status === "stalled" 43010 }); 43011 setProperties(dom.loadingIndicator, { 43012 hidden: state.status !== "stalled" 43013 }); 43014 toggleAnimation(dom.loadingIndicator, state.status === "stalled"); 43015 setProperties(dom.clearButton, { 43016 hidden: !state.query 43017 }); 43018 setProperties(dom.detachedSearchButtonQuery, { 43019 textContent: state.query 43020 }); 43021 setProperties(dom.detachedSearchButtonPlaceholder, { 43022 hidden: Boolean(state.query) 43023 }); 43024} 43025function toggleAnimation(element, isActive) { 43026 var _element$firstChild; 43027 var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === undefined ? undefined : _element$firstChild.nodeName) === "svg" ? element.firstChild : null; 43028 if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) { 43029 return; 43030 } 43031 if (isActive) { 43032 svgElement.unpauseAnimations(); 43033 } else { 43034 svgElement.pauseAnimations(); 43035 } 43036} 43037function renderPanel(render, _ref2) { 43038 var { autocomplete, autocompleteScopeApi, classNames, html, dom, panelContainer, propGetters, state, components, renderer } = _ref2; 43039 if (!state.isOpen) { 43040 if (panelContainer.contains(dom.panel)) { 43041 panelContainer.removeChild(dom.panel); 43042 } 43043 return; 43044 } 43045 if (!panelContainer.contains(dom.panel) && state.status !== "loading") { 43046 panelContainer.appendChild(dom.panel); 43047 } 43048 dom.panel.classList.toggle("aa-Panel--stalled", state.status === "stalled"); 43049 var sections = state.collections.filter(function(_ref3) { 43050 var { source, items } = _ref3; 43051 return source.templates.noResults || items.length > 0; 43052 }).map(function(_ref4, sourceIndex) { 43053 var { source, items } = _ref4; 43054 return renderer.createElement("section", { 43055 key: sourceIndex, 43056 className: classNames.source, 43057 "data-autocomplete-source-id": source.sourceId 43058 }, source.templates.header && renderer.createElement("div", { 43059 className: classNames.sourceHeader 43060 }, source.templates.header({ 43061 components, 43062 createElement: renderer.createElement, 43063 Fragment: renderer.Fragment, 43064 items, 43065 source, 43066 state, 43067 html 43068 })), source.templates.noResults && items.length === 0 ? renderer.createElement("div", { 43069 className: classNames.sourceNoResults 43070 }, source.templates.noResults({ 43071 components, 43072 createElement: renderer.createElement, 43073 Fragment: renderer.Fragment, 43074 source, 43075 state, 43076 html 43077 })) : renderer.createElement("ul", _extends({ 43078 className: classNames.list 43079 }, propGetters.getListProps(_objectSpread22({ 43080 state, 43081 props: autocomplete.getListProps({ 43082 source 43083 }) 43084 }, autocompleteScopeApi))), items.map(function(item) { 43085 var itemProps = autocomplete.getItemProps({ 43086 item, 43087 source 43088 }); 43089 return renderer.createElement("li", _extends({ 43090 key: itemProps.id, 43091 className: classNames.item 43092 }, propGetters.getItemProps(_objectSpread22({ 43093 state, 43094 props: itemProps 43095 }, autocompleteScopeApi))), source.templates.item({ 43096 components, 43097 createElement: renderer.createElement, 43098 Fragment: renderer.Fragment, 43099 item, 43100 state, 43101 html 43102 })); 43103 })), source.templates.footer && renderer.createElement("div", { 43104 className: classNames.sourceFooter 43105 }, source.templates.footer({ 43106 components, 43107 createElement: renderer.createElement, 43108 Fragment: renderer.Fragment, 43109 items, 43110 source, 43111 state, 43112 html 43113 }))); 43114 }); 43115 var children = renderer.createElement(renderer.Fragment, null, renderer.createElement("div", { 43116 className: classNames.panelLayout 43117 }, sections), renderer.createElement("div", { 43118 className: "aa-GradientBottom" 43119 })); 43120 var elements = sections.reduce(function(acc, current) { 43121 acc[current.props["data-autocomplete-source-id"]] = current; 43122 return acc; 43123 }, {}); 43124 render(_objectSpread22(_objectSpread22({ 43125 children, 43126 state, 43127 sections, 43128 elements 43129 }, renderer), {}, { 43130 components, 43131 html 43132 }, autocompleteScopeApi), dom.panel); 43133} 43134
vendor: 130 bytes, lines 43135-43140
43135// node_modules/@algolia/autocomplete-js/dist/esm/userAgents.js 43136var userAgents2 = [{ 43137 segment: "autocomplete-js", 43138 version 43139}]; 43140
vendor: 13,798 bytes, lines 43141-43489
43141// node_modules/@algolia/autocomplete-js/dist/esm/autocomplete.js 43142var _excluded11 = ["components"]; 43143function _typeof25(obj2) { 43144 "@babel/helpers - typeof"; 43145 return _typeof25 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 43146 return typeof obj2; 43147 } : function(obj2) { 43148 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43149 }, _typeof25(obj2); 43150} 43151function _objectWithoutProperties9(source, excluded) { 43152 if (source == null) 43153 return {}; 43154 var target = _objectWithoutPropertiesLoose9(source, excluded); 43155 var key, i; 43156 if (Object.getOwnPropertySymbols) { 43157 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 43158 for (i = 0;i < sourceSymbolKeys.length; i++) { 43159 key = sourceSymbolKeys[i]; 43160 if (excluded.indexOf(key) >= 0) 43161 continue; 43162 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 43163 continue; 43164 target[key] = source[key]; 43165 } 43166 } 43167 return target; 43168} 43169function _objectWithoutPropertiesLoose9(source, excluded) { 43170 if (source == null) 43171 return {}; 43172 var target = {}; 43173 var sourceKeys = Object.keys(source); 43174 var key, i; 43175 for (i = 0;i < sourceKeys.length; i++) { 43176 key = sourceKeys[i]; 43177 if (excluded.indexOf(key) >= 0) 43178 continue; 43179 target[key] = source[key]; 43180 } 43181 return target; 43182} 43183function ownKeys23(object, enumerableOnly) { 43184 var keys = Object.keys(object); 43185 if (Object.getOwnPropertySymbols) { 43186 var symbols = Object.getOwnPropertySymbols(object); 43187 enumerableOnly && (symbols = symbols.filter(function(sym) { 43188 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43189 })), keys.push.apply(keys, symbols); 43190 } 43191 return keys; 43192} 43193function _objectSpread23(target) { 43194 for (var i = 1;i < arguments.length; i++) { 43195 var source = arguments[i] != null ? arguments[i] : {}; 43196 i % 2 ? ownKeys23(Object(source), true).forEach(function(key) { 43197 _defineProperty23(target, key, source[key]); 43198 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys23(Object(source)).forEach(function(key) { 43199 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 43200 }); 43201 } 43202 return target; 43203} 43204function _defineProperty23(obj2, key, value) { 43205 key = _toPropertyKey23(key); 43206 if (key in obj2) { 43207 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 43208 } else { 43209 obj2[key] = value; 43210 } 43211 return obj2; 43212} 43213function _toPropertyKey23(arg) { 43214 var key = _toPrimitive23(arg, "string"); 43215 return _typeof25(key) === "symbol" ? key : String(key); 43216} 43217function _toPrimitive23(input, hint) { 43218 if (_typeof25(input) !== "object" || input === null) 43219 return input; 43220 var prim = input[Symbol.toPrimitive]; 43221 if (prim !== undefined) { 43222 var res = prim.call(input, hint || "default"); 43223 if (_typeof25(res) !== "object") 43224 return res; 43225 throw new TypeError("@@toPrimitive must return a primitive value."); 43226 } 43227 return (hint === "string" ? String : Number)(input); 43228} 43229var instancesCount = 0; 43230function autocomplete(options2) { 43231 var _createEffectWrapper = createEffectWrapper(), { runEffect, cleanupEffects, runEffects } = _createEffectWrapper; 43232 var _createReactiveWrappe = createReactiveWrapper(), { reactive, runReactives } = _createReactiveWrappe; 43233 var hasNoResultsSourceTemplateRef = createRef(false); 43234 var optionsRef = createRef(options2); 43235 var onStateChangeRef = createRef(undefined); 43236 var props = reactive(function() { 43237 return getDefaultOptions(optionsRef.current); 43238 }); 43239 var isDetached = reactive(function() { 43240 return props.value.core.environment.matchMedia(props.value.renderer.detachedMediaQuery).matches; 43241 }); 43242 var autocomplete = reactive(function() { 43243 return createAutocomplete(_objectSpread23(_objectSpread23({}, props.value.core), {}, { 43244 onStateChange: function onStateChange(params) { 43245 var _onStateChangeRef$cur, _props$value$core$onS, _props$value$core; 43246 hasNoResultsSourceTemplateRef.current = params.state.collections.some(function(collection) { 43247 return collection.source.templates.noResults; 43248 }); 43249 (_onStateChangeRef$cur = onStateChangeRef.current) === null || _onStateChangeRef$cur === undefined || _onStateChangeRef$cur.call(onStateChangeRef, params); 43250 (_props$value$core$onS = (_props$value$core = props.value.core).onStateChange) === null || _props$value$core$onS === undefined || _props$value$core$onS.call(_props$value$core, params); 43251 }, 43252 shouldPanelOpen: optionsRef.current.shouldPanelOpen || function(_ref) { 43253 var state = _ref.state; 43254 if (isDetached.value) { 43255 return true; 43256 } 43257 var hasItems = getItemsCount(state) > 0; 43258 if (!props.value.core.openOnFocus && !state.query) { 43259 return hasItems; 43260 } 43261 var hasNoResultsTemplate = Boolean(hasNoResultsSourceTemplateRef.current || props.value.renderer.renderNoResults); 43262 return !hasItems && hasNoResultsTemplate || hasItems; 43263 }, 43264 __autocomplete_metadata: { 43265 userAgents: userAgents2, 43266 options: options2 43267 } 43268 })); 43269 }); 43270 var lastStateRef = createRef(_objectSpread23({ 43271 collections: [], 43272 completion: null, 43273 context: {}, 43274 isOpen: false, 43275 query: "", 43276 activeItemId: null, 43277 status: "idle" 43278 }, props.value.core.initialState)); 43279 var propGetters = { 43280 getEnvironmentProps: props.value.renderer.getEnvironmentProps, 43281 getFormProps: props.value.renderer.getFormProps, 43282 getInputProps: props.value.renderer.getInputProps, 43283 getItemProps: props.value.renderer.getItemProps, 43284 getLabelProps: props.value.renderer.getLabelProps, 43285 getListProps: props.value.renderer.getListProps, 43286 getPanelProps: props.value.renderer.getPanelProps, 43287 getRootProps: props.value.renderer.getRootProps 43288 }; 43289 var autocompleteScopeApi = { 43290 setActiveItemId: autocomplete.value.setActiveItemId, 43291 setQuery: autocomplete.value.setQuery, 43292 setCollections: autocomplete.value.setCollections, 43293 setIsOpen: autocomplete.value.setIsOpen, 43294 setStatus: autocomplete.value.setStatus, 43295 setContext: autocomplete.value.setContext, 43296 refresh: autocomplete.value.refresh, 43297 navigator: autocomplete.value.navigator 43298 }; 43299 var html = reactive(function() { 43300 return htm_module_default.bind(props.value.renderer.renderer.createElement); 43301 }); 43302 var dom = reactive(function() { 43303 return createAutocompleteDom({ 43304 autocomplete: autocomplete.value, 43305 autocompleteScopeApi, 43306 classNames: props.value.renderer.classNames, 43307 environment: props.value.core.environment, 43308 isDetached: isDetached.value, 43309 placeholder: props.value.core.placeholder, 43310 propGetters, 43311 setIsModalOpen, 43312 state: lastStateRef.current, 43313 translations: props.value.renderer.translations 43314 }); 43315 }); 43316 function setPanelPosition() { 43317 setProperties(dom.value.panel, { 43318 style: isDetached.value ? {} : getPanelPlacementStyle({ 43319 panelPlacement: props.value.renderer.panelPlacement, 43320 container: dom.value.root, 43321 form: dom.value.form, 43322 environment: props.value.core.environment 43323 }) 43324 }); 43325 } 43326 function scheduleRender(state) { 43327 lastStateRef.current = state; 43328 var renderProps = { 43329 autocomplete: autocomplete.value, 43330 autocompleteScopeApi, 43331 classNames: props.value.renderer.classNames, 43332 components: props.value.renderer.components, 43333 container: props.value.renderer.container, 43334 html: html.value, 43335 dom: dom.value, 43336 panelContainer: isDetached.value ? dom.value.detachedContainer : props.value.renderer.panelContainer, 43337 propGetters, 43338 state: lastStateRef.current, 43339 renderer: props.value.renderer.renderer 43340 }; 43341 var render = !getItemsCount(state) && !hasNoResultsSourceTemplateRef.current && props.value.renderer.renderNoResults || props.value.renderer.render; 43342 renderSearchBox(renderProps); 43343 renderPanel(render, renderProps); 43344 } 43345 runEffect(function() { 43346 var environmentProps = autocomplete.value.getEnvironmentProps({ 43347 formElement: dom.value.form, 43348 panelElement: dom.value.panel, 43349 inputElement: dom.value.input 43350 }); 43351 setProperties(props.value.core.environment, environmentProps); 43352 return function() { 43353 setProperties(props.value.core.environment, Object.keys(environmentProps).reduce(function(acc, key) { 43354 return _objectSpread23(_objectSpread23({}, acc), {}, _defineProperty23({}, key, undefined)); 43355 }, {})); 43356 }; 43357 }); 43358 runEffect(function() { 43359 var panelContainerElement = isDetached.value ? props.value.core.environment.document.body : props.value.renderer.panelContainer; 43360 var panelElement = isDetached.value ? dom.value.detachedOverlay : dom.value.panel; 43361 if (isDetached.value && lastStateRef.current.isOpen) { 43362 setIsModalOpen(true); 43363 } 43364 scheduleRender(lastStateRef.current); 43365 return function() { 43366 if (panelContainerElement.contains(panelElement)) { 43367 panelContainerElement.removeChild(panelElement); 43368 panelContainerElement.classList.remove("aa-Detached"); 43369 } 43370 }; 43371 }); 43372 runEffect(function() { 43373 var containerElement = props.value.renderer.container; 43374 containerElement.appendChild(dom.value.root); 43375 return function() { 43376 containerElement.removeChild(dom.value.root); 43377 }; 43378 }); 43379 runEffect(function() { 43380 var debouncedRender = debounce3(function(_ref2) { 43381 var state = _ref2.state; 43382 scheduleRender(state); 43383 }, 0); 43384 onStateChangeRef.current = function(_ref3) { 43385 var { state, prevState } = _ref3; 43386 if (isDetached.value && prevState.isOpen !== state.isOpen) { 43387 setIsModalOpen(state.isOpen); 43388 } 43389 if (!isDetached.value && state.isOpen && !prevState.isOpen) { 43390 setPanelPosition(); 43391 } 43392 if (state.query !== prevState.query) { 43393 var scrollablePanels = props.value.core.environment.document.querySelectorAll(".aa-Panel--scrollable"); 43394 scrollablePanels.forEach(function(scrollablePanel) { 43395 if (scrollablePanel.scrollTop !== 0) { 43396 scrollablePanel.scrollTop = 0; 43397 } 43398 }); 43399 } 43400 debouncedRender({ 43401 state 43402 }); 43403 }; 43404 return function() { 43405 onStateChangeRef.current = undefined; 43406 }; 43407 }); 43408 runEffect(function() { 43409 var onResize = debounce3(function() { 43410 var previousIsDetached = isDetached.value; 43411 isDetached.value = props.value.core.environment.matchMedia(props.value.renderer.detachedMediaQuery).matches; 43412 if (previousIsDetached !== isDetached.value) { 43413 update({}); 43414 } else { 43415 requestAnimationFrame(setPanelPosition); 43416 } 43417 }, 20); 43418 props.value.core.environment.addEventListener("resize", onResize); 43419 return function() { 43420 props.value.core.environment.removeEventListener("resize", onResize); 43421 }; 43422 }); 43423 runEffect(function() { 43424 if (!isDetached.value) { 43425 return function() {}; 43426 } 43427 function toggleModalClassname(isActive) { 43428 dom.value.detachedContainer.classList.toggle("aa-DetachedContainer--modal", isActive); 43429 } 43430 function onChange(event) { 43431 toggleModalClassname(event.matches); 43432 } 43433 var isModalDetachedMql = props.value.core.environment.matchMedia(getComputedStyle(props.value.core.environment.document.documentElement).getPropertyValue("--aa-detached-modal-media-query")); 43434 toggleModalClassname(isModalDetachedMql.matches); 43435 var hasModernEventListener = Boolean(isModalDetachedMql.addEventListener); 43436 hasModernEventListener ? isModalDetachedMql.addEventListener("change", onChange) : isModalDetachedMql.addListener(onChange); 43437 return function() { 43438 hasModernEventListener ? isModalDetachedMql.removeEventListener("change", onChange) : isModalDetachedMql.removeListener(onChange); 43439 }; 43440 }); 43441 runEffect(function() { 43442 requestAnimationFrame(setPanelPosition); 43443 return function() {}; 43444 }); 43445 function destroy() { 43446 instancesCount--; 43447 cleanupEffects(); 43448 } 43449 function update() { 43450 var updatedOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 43451 cleanupEffects(); 43452 var _props$value$renderer = props.value.renderer, components = _props$value$renderer.components, rendererProps = _objectWithoutProperties9(_props$value$renderer, _excluded11); 43453 optionsRef.current = mergeDeep(rendererProps, props.value.core, { 43454 components: pickBy(components, function(_ref4) { 43455 var value = _ref4.value; 43456 return !value.hasOwnProperty("__autocomplete_componentName"); 43457 }), 43458 initialState: lastStateRef.current 43459 }, updatedOptions); 43460 runReactives(); 43461 runEffects(); 43462 autocomplete.value.refresh().then(function() { 43463 scheduleRender(lastStateRef.current); 43464 }); 43465 } 43466 function setIsModalOpen(value) { 43467 var prevValue = props.value.core.environment.document.body.contains(dom.value.detachedOverlay); 43468 if (value === prevValue) { 43469 return; 43470 } 43471 if (value) { 43472 props.value.core.environment.document.body.appendChild(dom.value.detachedOverlay); 43473 props.value.core.environment.document.body.classList.add("aa-Detached"); 43474 dom.value.input.focus(); 43475 } else { 43476 props.value.core.environment.document.body.removeChild(dom.value.detachedOverlay); 43477 props.value.core.environment.document.body.classList.remove("aa-Detached"); 43478 } 43479 } 43480 warn2(instancesCount === 0, `Autocomplete doesn't support multiple instances running at the same time. Make sure to destroy the previous instance before creating a new one. 43481 43482See: https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-destroy`); 43483 instancesCount++; 43484 return _objectSpread23(_objectSpread23({}, autocompleteScopeApi), {}, { 43485 update, 43486 destroy 43487 }); 43488} 43489
vendor: 2,378 bytes, lines 43490-43550
43490// node_modules/@algolia/autocomplete-js/dist/esm/requesters/createAlgoliaRequester.js 43491function _typeof26(obj2) { 43492 "@babel/helpers - typeof"; 43493 return _typeof26 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { 43494 return typeof obj2; 43495 } : function(obj2) { 43496 return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 43497 }, _typeof26(obj2); 43498} 43499function ownKeys24(object, enumerableOnly) { 43500 var keys = Object.keys(object); 43501 if (Object.getOwnPropertySymbols) { 43502 var symbols = Object.getOwnPropertySymbols(object); 43503 enumerableOnly && (symbols = symbols.filter(function(sym) { 43504 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 43505 })), keys.push.apply(keys, symbols); 43506 } 43507 return keys; 43508} 43509function _objectSpread24(target) { 43510 for (var i = 1;i < arguments.length; i++) { 43511 var source = arguments[i] != null ? arguments[i] : {}; 43512 i % 2 ? ownKeys24(Object(source), true).forEach(function(key) { 43513 _defineProperty24(target, key, source[key]); 43514 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys24(Object(source)).forEach(function(key) { 43515 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 43516 }); 43517 } 43518 return target; 43519} 43520function _defineProperty24(obj2, key, value) { 43521 key = _toPropertyKey24(key); 43522 if (key in obj2) { 43523 Object.defineProperty(obj2, key, { value, enumerable: true, configurable: true, writable: true }); 43524 } else { 43525 obj2[key] = value; 43526 } 43527 return obj2; 43528} 43529function _toPropertyKey24(arg) { 43530 var key = _toPrimitive24(arg, "string"); 43531 return _typeof26(key) === "symbol" ? key : String(key); 43532} 43533function _toPrimitive24(input, hint) { 43534 if (_typeof26(input) !== "object" || input === null) 43535 return input; 43536 var prim = input[Symbol.toPrimitive]; 43537 if (prim !== undefined) { 43538 var res = prim.call(input, hint || "default"); 43539 if (_typeof26(res) !== "object") 43540 return res; 43541 throw new TypeError("@@toPrimitive must return a primitive value."); 43542 } 43543 return (hint === "string" ? String : Number)(input); 43544} 43545var createAlgoliaRequester = createRequester(function(params) { 43546 return fetchAlgoliaResults(_objectSpread24(_objectSpread24({}, params), {}, { 43547 userAgents: userAgents2 43548 })); 43549}, "algolia"); 43550
vendor: 226 bytes, lines 43551-43557
43551// node_modules/@algolia/autocomplete-js/dist/esm/requesters/getAlgoliaResults.js 43552var getAlgoliaResults = createAlgoliaRequester({ 43553 transformResponse: function transformResponse(response) { 43554 return response.hits; 43555 } 43556}); 43557
vendor: 18,436 bytes, lines 43558-43953
43558// node_modules/search-insights/dist/search-insights-browser.mjs 43559var version2 = "2.17.3"; 43560function extractAdditionalParams(e) { 43561 return e.reduce(function(e, t) { 43562 var { events: n, additionalParams: e } = e; 43563 return "index" in t ? { additionalParams: e, events: n.concat([t]) } : { events: n, additionalParams: t }; 43564 }, { events: [], additionalParams: undefined }); 43565} 43566var supportsCookies = function() { 43567 try { 43568 return Boolean(navigator.cookieEnabled); 43569 } catch (e) { 43570 return false; 43571 } 43572}; 43573var supportsSendBeacon = function() { 43574 try { 43575 return Boolean(navigator.sendBeacon); 43576 } catch (e) { 43577 return false; 43578 } 43579}; 43580var supportsXMLHttpRequest = function() { 43581 try { 43582 return Boolean(XMLHttpRequest); 43583 } catch (e) { 43584 return false; 43585 } 43586}; 43587var supportsNativeFetch = function() { 43588 try { 43589 return fetch !== undefined; 43590 } catch (e) { 43591 return false; 43592 } 43593}; 43594var LocalStorage = function() {}; 43595function ensureLocalStorage() { 43596 try { 43597 var e = "__test_localStorage__"; 43598 return globalThis.localStorage.setItem(e, e), globalThis.localStorage.removeItem(e), globalThis.localStorage; 43599 } catch (e) {} 43600} 43601LocalStorage.get = function(e) { 43602 var t = (t = this.store) == null ? undefined : t.getItem(e); 43603 if (!t) 43604 return null; 43605 try { 43606 return JSON.parse(t); 43607 } catch (e) { 43608 return null; 43609 } 43610}, LocalStorage.set = function(t, e) { 43611 var n; 43612 try { 43613 (n = this.store) != null && n.setItem(t, JSON.stringify(e)); 43614 } catch (e) { 43615 console.error("Unable to set " + t + " in localStorage, storage may be full."); 43616 } 43617}, LocalStorage.remove = function(e) { 43618 var t; 43619 (t = this.store) != null && t.removeItem(e); 43620}, LocalStorage.store = ensureLocalStorage(); 43621var STORE = "AlgoliaObjectQueryCache"; 43622var LIMIT = 5000; 43623var FREE = 1000; 43624function getCache() { 43625 var e; 43626 return (e = LocalStorage.get(STORE)) != null ? e : {}; 43627} 43628function setCache(e) { 43629 LocalStorage.set(STORE, limited(e)); 43630} 43631function limited(e) { 43632 return Object.keys(e).length > LIMIT ? purgeOldest(e) : e; 43633} 43634function purgeOldest(e) { 43635 e = Object.entries(e).sort(function(e, t) { 43636 e = e[1][1]; 43637 return t[1][1] - e; 43638 }); 43639 return e.slice(0, e.length - FREE - 1).reduce(function(e, t) { 43640 var n = t[0], t = t[1]; 43641 return Object.assign(Object.assign({}, e), ((e = {})[n] = t, e)); 43642 }, {}); 43643} 43644function makeKey(e, t) { 43645 return e + "_" + t; 43646} 43647function storeQueryForObject(e, t, n) { 43648 var i = getCache(); 43649 i[makeKey(e, t)] = [n, Date.now()], setCache(i); 43650} 43651function getQueryForObject(e, t) { 43652 return getCache()[makeKey(e, t)]; 43653} 43654function removeQueryForObjects(t, e) { 43655 var n = getCache(); 43656 e.forEach(function(e) { 43657 delete n[makeKey(t, e)]; 43658 }), setCache(n); 43659} 43660var isUndefined = function(e) { 43661 return e === undefined; 43662}; 43663var isNumber = function(e) { 43664 return typeof e == "number"; 43665}; 43666var isFunction = function(e) { 43667 return typeof e == "function"; 43668}; 43669var isPromise = function(e) { 43670 return typeof (e == null ? undefined : e.then) == "function"; 43671}; 43672function getFunctionalInterface(i) { 43673 return function(e) { 43674 for (var t = [], n = arguments.length - 1;0 < n--; ) 43675 t[n] = arguments[n + 1]; 43676 if (e && isFunction(i[e])) 43677 return i[e].apply(i, t); 43678 console.warn("The method `" + e + "` doesn't exist."); 43679 }; 43680} 43681var DEFAULT_ALGOLIA_AGENTS = ["insights-js (" + version2 + ")", "insights-js-browser-esm (" + version2 + ")"]; 43682function addAlgoliaAgent(e) { 43683 this._ua.indexOf(e) === -1 && this._ua.push(e); 43684} 43685function getVersion(e) { 43686 return isFunction(e) && e(this.version), this.version; 43687} 43688function __rest(e, t) { 43689 var n = {}; 43690 for (r in e) 43691 Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); 43692 if (e != null && typeof Object.getOwnPropertySymbols == "function") 43693 for (var i = 0, r = Object.getOwnPropertySymbols(e);i < r.length; i++) 43694 t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]); 43695 return n; 43696} 43697function addQueryId(e) { 43698 return e.map(function(i) { 43699 var r, e; 43700 return !isValidEventForQueryIdLookup(i) || (r = [], e = (e = i.objectIDs) == null ? undefined : e.map(function(e, t) { 43701 var n = (n = i.objectData) == null ? undefined : n[t]; 43702 return n != null && n.queryID ? n : ((t = ((t = getQueryForObject(i.index, e)) != null ? t : [])[0]) && r.push(e), Object.assign(Object.assign({}, n), { queryID: t })); 43703 }), r.length === 0) ? i : Object.assign(Object.assign({}, i), { objectData: e, objectIDsWithInferredQueryID: r }); 43704 }); 43705} 43706function isValidEventForQueryIdLookup(e) { 43707 return !e.queryID && e.eventType === "conversion"; 43708} 43709function makeSendEvents(r) { 43710 return function(e, t) { 43711 var i = this; 43712 if (this._userHasOptedOut) 43713 return Promise.resolve(false); 43714 if (!(!isUndefined(this._apiKey) && !isUndefined(this._appId) || ((n = t == null ? undefined : t.headers) == null ? undefined : n["X-Algolia-Application-Id"]) && ((n = t == null ? undefined : t.headers) == null ? undefined : n["X-Algolia-API-Key"]))) 43715 throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters."); 43716 !this._userToken && this._anonymousUserToken && this.setAnonymousUserToken(true); 43717 var n = (t != null && t.inferQueryID ? addQueryId(e) : e).map(function(e) { 43718 var t = e.filters, n = __rest(e, ["filters"]), e = Object.assign(Object.assign({}, n), { userToken: (n = e == null ? undefined : e.userToken) != null ? n : i._userToken, authenticatedUserToken: (n = e == null ? undefined : e.authenticatedUserToken) != null ? n : i._authenticatedUserToken }); 43719 return isUndefined(t) || (e.filters = t.map(encodeURIComponent)), e; 43720 }); 43721 return n.length === 0 ? Promise.resolve(false) : (e = sendRequest(r, this._ua, this._endpointOrigin, n, this._appId, this._apiKey, t == null ? undefined : t.headers), isPromise(e) ? e.then(purgePurchased(n)) : e); 43722 }; 43723} 43724function purgePurchased(t) { 43725 return function(e) { 43726 return e && t.filter(function(e) { 43727 var { eventType: t, eventSubtype: n, objectIDs: e } = e; 43728 return t === "conversion" && n === "purchase" && (e == null ? undefined : e.length); 43729 }).forEach(function(e) { 43730 return removeQueryForObjects(e.index, e.objectIDs); 43731 }), e; 43732 }; 43733} 43734function sendRequest(e, t, n, i, r, o, s) { 43735 var a = (s = s === undefined ? {} : s)["X-Algolia-Application-Id"], c = s["X-Algolia-API-Key"], s = __rest(s, ["X-Algolia-Application-Id", "X-Algolia-API-Key"]), u = Object.assign({ "X-Algolia-Application-Id": a != null ? a : r, "X-Algolia-API-Key": c != null ? c : o, "X-Algolia-Agent": encodeURIComponent(t.join("; ")) }, s); 43736 return e(n + "/1/events?" + Object.keys(u).map(function(e) { 43737 return e + "=" + u[e]; 43738 }).join("&"), { events: i }); 43739} 43740function createUUID() { 43741 return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) { 43742 var t = 16 * Math.random() | 0; 43743 return (e === "x" ? t : 3 & t | 8).toString(16); 43744 }); 43745} 43746var COOKIE_KEY = "_ALGOLIA"; 43747var MONTH = 2592000000; 43748var setCookie = function(e, t, n) { 43749 var i = new Date, n = (i.setTime(i.getTime() + n), "expires=" + i.toUTCString()); 43750 document.cookie = e + "=" + t + ";" + n + ";path=/"; 43751}; 43752var getCookie = function(e) { 43753 for (var t = e + "=", n = document.cookie.split(";"), i = 0;i < n.length; i++) { 43754 for (var r = n[i];r.charAt(0) === " "; ) 43755 r = r.substring(1); 43756 if (r.indexOf(t) === 0) 43757 return r.substring(t.length, r.length); 43758 } 43759 return ""; 43760}; 43761function checkIfAnonymousToken(e) { 43762 return typeof e != "number" && e.indexOf("anonymous-") === 0; 43763} 43764function saveTokenAsCookie() { 43765 var e = getCookie(COOKIE_KEY); 43766 !this._userToken || e && e !== "" && e.indexOf("anonymous-") === 0 || setCookie(COOKIE_KEY, this._userToken, this._cookieDuration); 43767} 43768function setAnonymousUserToken(e) { 43769 (e = e !== undefined && e) ? this.setUserToken("anonymous-" + createUUID()) : supportsCookies() && ((e = getCookie(COOKIE_KEY)) && e !== "" && e.indexOf("anonymous-") === 0 ? this.setUserToken(e) : (e = this.setUserToken("anonymous-" + createUUID()), setCookie(COOKIE_KEY, e, this._cookieDuration))); 43770} 43771function setUserToken(e) { 43772 return this._userToken = e, isFunction(this._onUserTokenChangeCallback) && this._onUserTokenChangeCallback(this._userToken), this._userToken; 43773} 43774function getUserToken(e, t) { 43775 return isFunction(t) && t(null, this._userToken), this._userToken; 43776} 43777function onUserTokenChange(e, t) { 43778 this._onUserTokenChangeCallback = e, t && t.immediate && isFunction(this._onUserTokenChangeCallback) && this._onUserTokenChangeCallback(this._userToken); 43779} 43780function setAuthenticatedUserToken(e) { 43781 return this._authenticatedUserToken = e, isFunction(this._onAuthenticatedUserTokenChangeCallback) && this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken), this._authenticatedUserToken; 43782} 43783function getAuthenticatedUserToken(e, t) { 43784 return isFunction(t) && t(null, this._authenticatedUserToken), this._authenticatedUserToken; 43785} 43786function onAuthenticatedUserTokenChange(e, t) { 43787 this._onAuthenticatedUserTokenChangeCallback = e, t && t.immediate && isFunction(this._onAuthenticatedUserTokenChangeCallback) && this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken); 43788} 43789function addEventType(t, e) { 43790 return e.map(function(e) { 43791 return Object.assign({ eventType: t }, e); 43792 }); 43793} 43794function addEventTypeAndSubtype(t, n, e) { 43795 return e.map(function(e) { 43796 return Object.assign({ eventType: t, eventSubtype: n }, e); 43797 }); 43798} 43799function clickedObjectIDsAfterSearch() { 43800 for (var i = this, e = [], t = arguments.length;t--; ) 43801 e[t] = arguments[t]; 43802 var n = extractAdditionalParams(e), { events: r, additionalParams: n } = n; 43803 return r.forEach(function(e) { 43804 var { index: t, queryID: n } = e; 43805 return e.objectIDs.forEach(function(e) { 43806 return !i._userHasOptedOut && storeQueryForObject(t, e, n); 43807 }); 43808 }), this.sendEvents(addEventType("click", r), n); 43809} 43810function clickedObjectIDs() { 43811 for (var e = [], t = arguments.length;t--; ) 43812 e[t] = arguments[t]; 43813 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43814 return this.sendEvents(addEventType("click", i), n); 43815} 43816function clickedFilters() { 43817 for (var e = [], t = arguments.length;t--; ) 43818 e[t] = arguments[t]; 43819 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43820 return this.sendEvents(addEventType("click", i), n); 43821} 43822function convertedObjectIDsAfterSearch() { 43823 for (var e = [], t = arguments.length;t--; ) 43824 e[t] = arguments[t]; 43825 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43826 return this.sendEvents(addEventType("conversion", i), n); 43827} 43828function addedToCartObjectIDsAfterSearch() { 43829 for (var o = this, e = [], t = arguments.length;t--; ) 43830 e[t] = arguments[t]; 43831 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43832 return i.forEach(function(e) { 43833 var { index: n, queryID: i, objectIDs: t, objectData: r } = e; 43834 return t.forEach(function(e, t) { 43835 t = (t = (t = r == null ? undefined : r[t]) == null ? undefined : t.queryID) != null ? t : i; 43836 !o._userHasOptedOut && t && storeQueryForObject(n, e, t); 43837 }); 43838 }), this.sendEvents(addEventTypeAndSubtype("conversion", "addToCart", i), n); 43839} 43840function purchasedObjectIDsAfterSearch() { 43841 for (var e = [], t = arguments.length;t--; ) 43842 e[t] = arguments[t]; 43843 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43844 return this.sendEvents(addEventTypeAndSubtype("conversion", "purchase", i), n); 43845} 43846function convertedObjectIDs() { 43847 for (var e = [], t = arguments.length;t--; ) 43848 e[t] = arguments[t]; 43849 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43850 return this.sendEvents(addEventType("conversion", i), n); 43851} 43852function addedToCartObjectIDs() { 43853 for (var r = this, e = [], t = arguments.length;t--; ) 43854 e[t] = arguments[t]; 43855 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43856 return i.forEach(function(e) { 43857 var { index: n, objectIDs: t, objectData: i } = e; 43858 return t.forEach(function(e, t) { 43859 t = (t = i == null ? undefined : i[t]) == null ? undefined : t.queryID; 43860 !r._userHasOptedOut && t && storeQueryForObject(n, e, t); 43861 }); 43862 }), this.sendEvents(addEventTypeAndSubtype("conversion", "addToCart", i), n); 43863} 43864function purchasedObjectIDs() { 43865 for (var e = [], t = arguments.length;t--; ) 43866 e[t] = arguments[t]; 43867 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43868 return this.sendEvents(addEventTypeAndSubtype("conversion", "purchase", i), n); 43869} 43870function convertedFilters() { 43871 for (var e = [], t = arguments.length;t--; ) 43872 e[t] = arguments[t]; 43873 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43874 return this.sendEvents(addEventType("conversion", i), n); 43875} 43876var SUPPORTED_REGIONS = ["de", "us"]; 43877function init(e) { 43878 var t; 43879 if (!isUndefined((e = e === undefined ? {} : e).region) && SUPPORTED_REGIONS.indexOf(e.region) === -1) 43880 throw new Error("optional region is incorrect, please provide either one of: " + SUPPORTED_REGIONS.join(", ") + "."); 43881 if (!(isUndefined(e.cookieDuration) || isNumber(e.cookieDuration) && isFinite(e.cookieDuration) && Math.floor(e.cookieDuration) === e.cookieDuration)) 43882 throw new Error("optional cookieDuration is incorrect, expected an integer."); 43883 setOptions(this, e, { _userHasOptedOut: Boolean(e.userHasOptedOut), _region: e.region, _host: e.host, _anonymousUserToken: (t = e.anonymousUserToken) == null || t, _useCookie: (t = e.useCookie) != null && t, _cookieDuration: e.cookieDuration || 6 * MONTH }), this._endpointOrigin = this._host || (this._region ? "https://insights." + this._region + ".algolia.io" : "https://insights.algolia.io"), this._ua = [].concat(DEFAULT_ALGOLIA_AGENTS), e.authenticatedUserToken && this.setAuthenticatedUserToken(e.authenticatedUserToken), e.userToken ? this.setUserToken(e.userToken) : this._userToken || this._userHasOptedOut || !this._useCookie ? checkIfTokenNeedsToBeSaved(this) && this.saveTokenAsCookie() : this.setAnonymousUserToken(); 43884} 43885function setOptions(e, t, n) { 43886 var i = t.partial, r = __rest(t, ["partial"]); 43887 i || Object.assign(e, n), Object.assign(e, Object.keys(r).reduce(function(e, t) { 43888 return Object.assign(Object.assign({}, e), ((e = {})["_" + t] = r[t], e)); 43889 }, {})); 43890} 43891function checkIfTokenNeedsToBeSaved(e) { 43892 return e._userToken !== undefined && checkIfAnonymousToken(e._userToken) && e._useCookie && !e._userHasOptedOut; 43893} 43894function viewedObjectIDs() { 43895 for (var e = [], t = arguments.length;t--; ) 43896 e[t] = arguments[t]; 43897 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43898 return this.sendEvents(addEventType("view", i), n); 43899} 43900function viewedFilters() { 43901 for (var e = [], t = arguments.length;t--; ) 43902 e[t] = arguments[t]; 43903 var n = extractAdditionalParams(e), { events: i, additionalParams: n } = n; 43904 return this.sendEvents(addEventType("view", i), n); 43905} 43906var AlgoliaAnalytics = function(e) { 43907 e = e.requestFn; 43908 this._endpointOrigin = "https://insights.algolia.io", this._anonymousUserToken = true, this._userHasOptedOut = false, this._useCookie = false, this._cookieDuration = 6 * MONTH, this._ua = [], this.version = version2, this.sendEvents = makeSendEvents(e).bind(this), this.init = init.bind(this), this.addAlgoliaAgent = addAlgoliaAgent.bind(this), this.saveTokenAsCookie = saveTokenAsCookie.bind(this), this.setUserToken = setUserToken.bind(this), this.setAnonymousUserToken = setAnonymousUserToken.bind(this), this.getUserToken = getUserToken.bind(this), this.onUserTokenChange = onUserTokenChange.bind(this), this.setAuthenticatedUserToken = setAuthenticatedUserToken.bind(this), this.getAuthenticatedUserToken = getAuthenticatedUserToken.bind(this), this.onAuthenticatedUserTokenChange = onAuthenticatedUserTokenChange.bind(this), this.clickedObjectIDsAfterSearch = clickedObjectIDsAfterSearch.bind(this), this.clickedObjectIDs = clickedObjectIDs.bind(this), this.clickedFilters = clickedFilters.bind(this), this.convertedObjectIDsAfterSearch = convertedObjectIDsAfterSearch.bind(this), this.purchasedObjectIDsAfterSearch = purchasedObjectIDsAfterSearch.bind(this), this.addedToCartObjectIDsAfterSearch = addedToCartObjectIDsAfterSearch.bind(this), this.convertedObjectIDs = convertedObjectIDs.bind(this), this.addedToCartObjectIDs = addedToCartObjectIDs.bind(this), this.purchasedObjectIDs = purchasedObjectIDs.bind(this), this.convertedFilters = convertedFilters.bind(this), this.viewedObjectIDs = viewedObjectIDs.bind(this), this.viewedFilters = viewedFilters.bind(this), this.getVersion = getVersion.bind(this); 43909}; 43910function createInsightsClient(e) { 43911 var t, e = getFunctionalInterface(new AlgoliaAnalytics({ requestFn: e })); 43912 if (typeof window == "object" && !window.AlgoliaAnalyticsObject) { 43913 for (;t = createUUID(), window[t] !== undefined; ) 43914 ; 43915 window.AlgoliaAnalyticsObject = t, window[window.AlgoliaAnalyticsObject] = e; 43916 } 43917 return e.version = version2, e; 43918} 43919var requestWithXMLHttpRequest = function(r, o) { 43920 return new Promise(function(e, t) { 43921 var n = JSON.stringify(o), i = new XMLHttpRequest; 43922 i.addEventListener("readystatechange", function() { 43923 i.readyState === 4 && i.status === 200 ? e(true) : i.readyState === 4 && e(false); 43924 }), i.addEventListener("error", function() { 43925 return t(); 43926 }), i.addEventListener("timeout", function() { 43927 return e(false); 43928 }), i.open("POST", r), i.setRequestHeader("Content-Type", "application/json"), i.send(n); 43929 }); 43930}; 43931var requestWithSendBeacon = function(e, t) { 43932 var n = JSON.stringify(t), n = navigator.sendBeacon(e, n); 43933 return Promise.resolve(!!n || requestWithXMLHttpRequest(e, t)); 43934}; 43935var requestWithNativeFetch = function(e, i) { 43936 return new Promise(function(t, n) { 43937 fetch(e, { method: "POST", body: JSON.stringify(i), headers: { "Content-Type": "application/json" } }).then(function(e) { 43938 t(e.status === 200); 43939 }).catch(function(e) { 43940 n(e); 43941 }); 43942 }); 43943}; 43944function getRequesterForBrowser() { 43945 if (supportsSendBeacon()) 43946 return requestWithSendBeacon; 43947 if (supportsXMLHttpRequest()) 43948 return requestWithXMLHttpRequest; 43949 if (supportsNativeFetch()) 43950 return requestWithNativeFetch; 43951 throw new Error("Could not find a supported HTTP request client in this environment."); 43952} 43953var entryBrowser = createInsightsClient(getRequesterForBrowser());
vendor: 93 bytes, lines 43954-43956
43954// node_modules/search-insights/index-browser.mjs 43955var index_browser_default = entryBrowser; 43956
43957// app/javascript/autocomplete.js 43958var inlineInstance = null; 43959var modalInstance = null; 43960var currentActiveItemId = 0; 43961var keydownHandlerAttached = false; 43962var INLINE_CONTAINERS = ["#autocomplete", "#header-autocomplete"]; 43963var MODAL_CONTAINER_ID = "search-modal-autocomplete"; 43964function toPathname(url) { 43965 try { 43966 return new URL(url).pathname; 43967 } catch { 43968 return url; 43969 } 43970} 43971function getConfig2() { 43972 const appId = document.querySelector('meta[name="algolia-app-id"]')?.content; 43973 const searchKey = document.querySelector('meta[name="algolia-search-key"]')?.content; 43974 const indexPrefix = document.querySelector('meta[name="algolia-index-prefix"]')?.content || "development"; 43975 if (!appId || !searchKey) 43976 return null; 43977 return { appId, searchKey, indexPrefix }; 43978} 43979function getItemElements() { 43980 return Array.from(document.querySelectorAll(".aa-Item")); 43981} 43982function highlightItem(index) { 43983 const items = getItemElements(); 43984 items.forEach((el, i) => { 43985 el.setAttribute("aria-selected", i === index ? "true" : "false"); 43986 }); 43987 currentActiveItemId = index; 43988 if (items[index]) { 43989 items[index].scrollIntoView({ block: "nearest" }); 43990 } 43991} 43992function buildSources(searchClient, config, searchUrl) { 43993 return ({ query }) => { 43994 if (!query) 43995 return []; 43996 const searchPageUrl = `${searchUrl}?q=${encodeURIComponent(query)}`; 43997 return [ 43998 { 43999 sourceId: "suggestions", 44000 async getItems() { 44001 const suggestions = [{ label: query, url: searchPageUrl }]; 44002 const response = await searchClient.search({ 44003 requests: [ 44004 { indexName: `Tag_${config.indexPrefix}`, query, hitsPerPage: 2 }, 44005 { indexName: `Course_${config.indexPrefix}`, query, hitsPerPage: 2 } 44006 ] 44007 }); 44008 const seen = new Set([query.toLowerCase()]); 44009 for (const result of response.results || []) { 44010 for (const hit of result.hits || []) { 44011 const lower = hit.title.toLowerCase(); 44012 if (!seen.has(lower)) { 44013 seen.add(lower); 44014 suggestions.push({ 44015 label: hit.title.toLowerCase(), 44016 url: `${searchUrl}?q=${encodeURIComponent(hit.title)}` 44017 }); 44018 } 44019 } 44020 } 44021 return suggestions.slice(0, 3); 44022 }, 44023 getItemUrl({ item }) { 44024 return item.url; 44025 }, 44026 onSelect({ item }) { 44027 Turbo.visit(item.url); 44028 }, 44029 templates: { 44030 item({ item, html }) { 44031 return html` 44032 <div class="aa-ItemWrapper" data-item-url="${item.url}"> 44033 <div class="aa-ItemContent"> 44034 <div class="aa-ItemIcon aa-ItemIcon--search"> 44035 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> 44036 <circle cx="11" cy="11" r="8"></circle> 44037 <line x1="21" y1="21" x2="16.65" y2="16.65"></line> 44038 </svg> 44039 </div> 44040 <div class="aa-ItemContentBody"> 44041 <div class="aa-ItemContentTitle">Rechercher « ${item.label} »</div> 44042 </div> 44043 </div> 44044 </div> 44045 `; 44046 } 44047 } 44048 }, 44049 { 44050 sourceId: "tags", 44051 getItems() { 44052 return getAlgoliaResults({ 44053 searchClient, 44054 queries: [{ indexName: `Tag_${config.indexPrefix}`, params: { query, hitsPerPage: 2, clickAnalytics: true } }] 44055 }); 44056 }, 44057 getItemUrl({ item }) { 44058 return `/formations/tags/${item.slug}`; 44059 }, 44060 onSelect({ item }) { 44061 Turbo.visit(`/formations/tags/${item.slug}`); 44062 }, 44063 templates: { 44064 header({ html }) { 44065 return html`<span class="aa-SourceHeaderTitle">Catégories</span>`; 44066 }, 44067 item({ item, html }) { 44068 const count = item.courses_count || 0; 44069 const label = count > 1 ? "formations" : "formation"; 44070 return html` 44071 <div class="aa-ItemWrapper" data-item-url="${`/formations/tags/${item.slug}`}"> 44072 <div class="aa-ItemContent"> 44073 <div class="aa-ItemIcon aa-ItemIcon--tag"> 44074 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> 44075 <path d="M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"></path> 44076 <line x1="7" y1="7" x2="7.01" y2="7"></line> 44077 </svg> 44078 </div> 44079 <div class="aa-ItemContentBody"> 44080 <div class="aa-ItemContentTitle">${item.title}</div> 44081 <div class="aa-ItemContentDescription">
44081${count} ${label}</div> 44082 </div> 44083 </div> 44084 </div> 44085 `; 44086 } 44087 } 44088 }, 44089 { 44090 sourceId: "courses", 44091 getItems() { 44092 return getAlgoliaResults({ 44093 searchClient, 44094 queries: [{ indexName: `Course_${config.indexPrefix}`, params: { query, hitsPerPage: 4, clickAnalytics: true } }] 44095 }); 44096 }, 44097 getItemUrl({ item }) { 44098 return `/formations/${item.slug}`; 44099 }, 44100 onSelect({ item }) { 44101 Turbo.visit(`/formations/${item.slug}`); 44102 }, 44103 templates: { 44104 header({ html }) { 44105 return html`<span class="aa-SourceHeaderTitle">Formations</span>`; 44106 }, 44107 item({ item, html }) { 44108 const logoSrc = item.logo; 44109 const duration = item.duration; 44110 const durationLabel = duration === 1 ? "jour" : "jours"; 44111 return html` 44112 <div class="aa-ItemWrapper" data-item-url="${`/formations/${item.slug}`}"> 44113 <div class="aa-ItemContent"> 44114 <div class="aa-ItemIcon aa-ItemIcon--course"> 44115 ${logoSrc ? html`<img src="${logoSrc}" alt="" />` : html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M2 3h6a4 4 0 014 4v14a3 3 0 00-3-3H2z"></path><path d="M22 3h-6a4 4 0 00-4 4v14a3 3 0 013-3h7z"></path></svg>`} 44116 </div> 44117 <div class="aa-ItemContentBody"> 44118 <div class="aa-ItemContentTitle">${item.title}</div> 44119 <div class="aa-ItemContentDescription">${duration} ${durationLabel}</div> 44120 </div> 44121 </div> 44122 </div> 44123 `; 44124 } 44125 } 44126 }, 44127 { 44128 sourceId: "pages", 44129 getItems() { 44130 return getAlgoliaResults({ 44131 searchClient, 44132 queries: [{ indexName: "human_coders_pages", params: { query, hitsPerPage: 3, clickAnalytics: true } }] 44133 }); 44134 }, 44135 getItemUrl({ item }) { 44136 return toPathname(item.url); 44137 }, 44138 onSelect({ item }) { 44139 Turbo.visit(toPathname(item.url)); 44140 }, 44141 templates: { 44142 header({ html }) { 44143 return html`<span class="aa-SourceHeaderTitle">Pages</span>`; 44144 }, 44145 item({ item, html }) { 44146 const title = item.title || ""; 44147 const itemPath = toPathname(item.url); 44148 return html` 44149 <div class="aa-ItemWrapper" data-item-url="${itemPath}"> 44150 <div class="aa-ItemContent"> 44151 <div class="aa-ItemIcon aa-ItemIcon--page"> 44152 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> 44153 <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"></path> 44154 <polyline points="14 2 14 8 20 8"></polyline> 44155 <line x1="16" y1="13" x2="8" y2="13"></line> 44156 <line x1="16" y1="17" x2="8" y2="17"></line> 44157 </svg> 44158 </div> 44159 <div class="aa-ItemContentBody"> 44160 <div class="aa-ItemContentTitle">${title}</div> 44161 </div> 44162 </div> 44163 </div> 44164 `; 44165 } 44166 } 44167 } 44168 ]; 44169 }; 44170} 44171function clearInlineContainers() { 44172 for (const selector of INLINE_CONTAINERS) { 44173 const container = document.querySelector(selector); 44174 if (container) 44175 container.innerHTML = ""; 44176 } 44177} 44178function destroyAllInstances() { 44179 if (inlineInstance) { 44180 inlineInstance.destroy(); 44181 inlineInstance = null; 44182 } 44183 if (modalInstance) { 44184 modalInstance.destroy(); 44185 modalInstance = null; 44186 } 44187 document.getElementById(MODAL_CONTAINER_ID)?.remove(); 44188 clearInlineContainers(); 44189} 44190function initAutocomplete() { 44191 destroyAllInstances(); 44192 const config = getConfig2(); 44193 if (!config) 44194 return; 44195 const searchClient = liteClient(config.appId, config.searchKey); 44196 const searchUrl = "/formations/search"; 44197 index_browser_default("init", { appId: config.appId, apiKey: config.searchKey }); 44198 const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({ insightsClient: index_browser_default }); 44199 function createInlineInstance() { 44200 for (const selector of INLINE_CONTAINERS) { 44201 const container = document.querySelector(selector); 44202 if (!container) 44203 continue; 44204 const url = container.dataset.searchUrl || searchUrl; 44205 const initialQuery = container.dataset.initialQuery || ""; 44206 inlineInstance = autocomplete({ 44207 container, 44208 placeholder: "Claude Code, Python, React...", 44209 detachedMediaQuery: "none", 44210 initialState: { query: initialQuery }, 44211 defaultActiveItemId: 0, 44212 plugins: [algoliaInsightsPlugin], 44213 onSubmit({ state }) { 44214 Turbo.visit(`${url}?q=${encodeURIComponent(state.query)}`); 44215 }, 44216 getSources: buildSources(searchClient, config, url) 44217 }); 44218 break; 44219 } 44220 } 44221 createInlineInstance(); 44222 function openSearchModal() { 44223 if (inlineInstance) { 44224 inlineInstance.destroy(); 44225 inlineInstance = null; 44226 } 44227 let modalContainer = document.getElementById(MODAL_CONTAINER_ID); 44228 if (!modalContainer) { 44229 modalContainer = document.createElement("div"); 44230 modalContainer.id = MODAL_CONTAINER_ID; 44231 modalContainer.style.display = "none"; 44232 document.body.appendChild(modalContainer); 44233 } 44234 modalInstance = autocomplete({
44235 container: `#${MODAL_CONTAINER_ID}`, 44236 placeholder: "Claude Code, Python, React...", 44237 detachedMediaQuery: "(min-width: 0px)", 44238 openOnFocus: true, 44239 defaultActiveItemId: 0, 44240 plugins: [algoliaInsightsPlugin], 44241 onSubmit({ state }) { 44242 Turbo.visit(`${searchUrl}?q=${encodeURIComponent(state.query)}`); 44243 }, 44244 getSources: buildSources(searchClient, config, searchUrl) 44245 }); 44246 const btn = modalContainer.querySelector(".aa-DetachedSearchButton"); 44247 if (btn) 44248 btn.click(); 44249 const observer = new MutationObserver(() => { 44250 if (!document.querySelector(".aa-DetachedOverlay")) { 44251 observer.disconnect(); 44252 if (modalInstance) { 44253 modalInstance.destroy(); 44254 modalInstance = null; 44255 } 44256 document.getElementById(MODAL_CONTAINER_ID)?.remove(); 44257 createInlineInstance(); 44258 } 44259 }); 44260 observer.observe(document.body, { childList: true }); 44261 } 44262 document.querySelectorAll(".nav-search-link, .mobile-search-link").forEach((link) => { 44263 link.addEventListener("click", (e) => { 44264 e.preventDefault(); 44265 openSearchModal(); 44266 }); 44267 }); 44268 if (!keydownHandlerAttached) { 44269 keydownHandlerAttached = true; 44270 document.addEventListener("keydown", (event) => { 44271 if (!event.target.classList?.contains("aa-Input")) 44272 return; 44273 event.stopImmediatePropagation(); 44274 const panel = document.querySelector(".aa-Panel"); 44275 const panelVisible = panel && !panel.hasAttribute("hidden") && panel.childElementCount > 0; 44276 if (event.key === "ArrowDown" || event.key === "ArrowUp") { 44277 event.preventDefault(); 44278 if (!panelVisible) 44279 return; 44280 const items = getItemElements(); 44281 const total = items.length; 44282 if (total === 0) 44283 return; 44284 if (event.key === "ArrowDown") { 44285 currentActiveItemId = (currentActiveItemId + 1) % total; 44286 } else { 44287 currentActiveItemId = (currentActiveItemId - 1 + total) % total; 44288 } 44289 highlightItem(currentActiveItemId); 44290 } else if (event.key === "Enter") { 44291 event.preventDefault(); 44292 if (panelVisible) { 44293 const items = getItemElements(); 44294 const activeItem = items[currentActiveItemId]; 44295 if (activeItem) { 44296 const wrapper = activeItem.querySelector("[data-item-url]"); 44297 if (wrapper) { 44298 Turbo.visit(wrapper.dataset.itemUrl); 44299 return; 44300 } 44301 } 44302 } 44303 const query = event.target.value?.trim(); 44304 if (query) { 44305 Turbo.visit(`${searchUrl}?q=${encodeURIComponent(query)}`); 44306 } 44307 } else if (event.key === "Escape") { 44308 inlineInstance?.setIsOpen(false); 44309 modalInstance?.setIsOpen(false); 44310 } 44311 }, true); 44312 } 44313} 44314function reparentMobileSearch() { 44315 const mobileSearch = document.querySelector(".mobile-search"); 44316 const navbarBrand = document.querySelector(".navbar-brand"); 44317 const toggleMenu = document.querySelector(".toggle-menu"); 44318 if (mobileSearch && navbarBrand && toggleMenu && mobileSearch.parentElement !== navbarBrand) { 44319 navbarBrand.insertBefore(mobileSearch, toggleMenu); 44320 } 44321} 44322document.addEventListener("turbo:load", () => { 44323 currentActiveItemId = 0; 44324 reparentMobileSearch(); 44325 initAutocomplete(); 44326}); 44327document.addEventListener("turbo:before-cache", () => { 44328 destroyAllInstances(); 44329 const mobileSearch = document.querySelector(".mobile-search"); 44330 const header = document.querySelector("header"); 44331 if (mobileSearch && header && mobileSearch.closest(".navbar-brand")) { 44332 header.appendChild(mobileSearch); 44333 } 44334}); 44335
44336// app/javascript/application.js 44337import_smoothscroll_polyfill.default.polyfill(); 44338 44339//# debugId=74EE030488D8D8FA64756E2164756E21
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.